Search completed in 0.99 seconds.
1368 results for "close":
Your results are loading. Please wait...
CloseEvent.initCloseEvent() - Web APIs
the page on creating and triggering events gives more information about the way to use these. syntax event.initmouseevent(type, canbubble, cancelable, wasclean, reasoncode, reason); parameters type the string to set the event's type to. ...
...normally using the document.createevent() method). events initialized in this way must have been created with the document.createevent() method. this method must be called to set the event before it is dispatched, using eventtarget.dispatchevent(). once dispatched, it doesn't do anything anymore. do not use this method anymore as it is deprecated. instead use specific event constructors, like closeevent(). the page on creating and triggering events gives more information about the way to use these. syntax event.initmouseevent(type, canbubble, cancelable, wasclean, reasoncode, reason); parameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubbl...
...ameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubble. sets the value of event.bubbles. cancelable whether or not the event's default action can be prevented. sets the value of event.cancelable. wasclean whether or not the connection was cleanly closed. reasoncode the reason of the close. reason a domstring describing the reason of the close in shuman-readable way. specifications this is no part of any specifications, though it was in some early drafts. ...
Element.closest() - Web APIs
Web › API › Element › closest
it may be null. exceptions syntaxerror is thrown if the selectors is not a valid selector list string. ...
...it may be null. exceptions syntaxerror is thrown if the selectors is not a valid selector list string. ...
...it may be null. exceptions syntaxerror is thrown if the selectors is not a valid selector list string. ...
...And 11 more matches
OpenClose - Archive of obsolete content
a simple example: somemenu.open = true; this single line of code will open a menu referenced by the variable 'somemenu'. note that the open property applies to the menu or button, not to the menupopup. ...
...menus menus will display themselves automatically when needed without extra work. for instance, a menu's popup will open when the menu label is clicked, and a submenu will open when the mouse is hovered over the parent menu element. however, there may be situations when you wish to open a menu manually. the menu element has an open property which may be set to true to open the menu, or false to close the menu. a simple example: somemenu.open = true; this single line of code will open a menu referenced by the variable 'somemenu'. note that the open property applies to the menu or button, not to the menupopup. here is a complete example which uses a button to open a menu: <button label="open menu" oncommand="document.getelementbyid('editmenu').open = true;"/> <menu id="editmenu" la...
...the parent menu first, and then open the child menu in a popupshown event listener. see the popupshown event for an example of how to do this. a menu in an unprivileged content window (such as a web page) can only open a popup while its window is focused, and it is in the currently active tab. that means that a document in a background tab cannot open a menu or popup. closing menus menus will close automatically once the user has made a selection from the menu. when an menu item is selected, it fires a command event so that code may be used to perform an action. the user may cancel selecting a command from a menu by pressing the escape key. this will close a single menu, but if this menu has a parent menu, the parent menu will remain open. a user may also cancel selecting from a menu by cli...
...And 7 more matches
CloseEvent - Web APIs
the following values are permitted status codes. the following definitions are sourced from the iana website [ref]. note that the 1xxx codes are only websocket-internal and not for the same meaning by the transported data (like when the application-layer protocol is invalid). the only permitted codes to be specified in firefox are 1000 and 3000 to 4999 [source, bug]. ...
...the following values are permitted status codes. the following definitions are sourced from the iana website [ref]. note that the 1xxx codes are only websocket-internal and not for the same meaning by the transported data (like when the application-layer protocol is invalid). the only permitted codes to be specified in firefox are 1000 and 3000 to 4999 [source, bug]. ...
...int received data of a type it cannot accept (for example, a text-only endpoint received binary data). 1004 reserved. a meaning might be defined in the future. 1005 no status received reserved. indicates that no status code was provided even though one was expected. 1006 abnormal closure reserved. used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected. 1007 invalid frame payload data the endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-utf-8 data within a text message). 1008 policy violation the endpoint is terminating the connection because it received a m...
...And 4 more matches
HTMLDialogElement: close event - Web APIs
the close event is fired on an htmldialogelement object when the dialog it represents has been closed. ...
... the close event is fired on an htmldialogelement object when the dialog it represents has been closed. ...
... the close event is fired on an htmldialogelement object when the dialog it represents has been closed. ...
...And 4 more matches
ReadableStreamDefaultReader.closed - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
...And 4 more matches
close - Archive of obsolete content
properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. ...
... properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. ...
... properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. ...
...And 3 more matches
AudioContext.close() - Web APIs
this function does not automatically release all audiocontext-created objects, unless other references have been released as well; however, it will forcibly release any system audio resources that might prevent additional audiocontexts from being created and used, suspend the progression of audio time in the audio context, and stop processing audio data. the returned promise resolves when all audiocontext-creation-blocking resources have been released. this method throws an invalid_state_err exception if called on an offlineaudiocontext. ...
...might prevent additional audiocontexts from being created and used, suspend the progression of audio time in the audio context, and stop processing audio data. the returned promise resolves when all audiocontext-creation-blocking resources have been released. this method throws an invalid_state_err exception if called on an offlineaudiocontext. ...
... created and used, suspend the progression of audio time in the audio context, and stop processing audio data. the returned promise resolves when all audiocontext-creation-blocking resources have been released. this method throws an invalid_state_err exception if called on an offlineaudiocontext. syntax var audioctx = new audiocontext(); audioctx.close().then(function() { ... }); await audioctx.close(); returns a promise that resolves with void. ...
...And 2 more matches
ReadableByteStreamController.close() - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
...And 2 more matches
ReadableStreamBYOBReader.closed - Web APIs
living standard initial definition. ...
... living standard initial definition. ...
... living standard initial definition. ...
...And 2 more matches
ReadableStreamDefaultController.close() - Web APIs
return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). ...
... return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). ...
...ple, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the start() function generates a random string of text every second and enqueues it into the stream. a cancel() function is also provided to stop the generation if readablestream.cancel() is called for any reason. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement(...
...And 2 more matches
WritableStreamDefaultWriter.close() - Web APIs
the close() method of the writablestreamdefaultwriter interface closes the associated writable stream. the underlying sink will finish processing any previously-written chunks, before invoking the close behavior. during this time any further attempts to write will fail (without erroring the stream). syntax var promise = writablestreamdefaultwriter.close(); parameters none. return value a promise, which fulfills with the undefined if all remaining chunks were successfully written before the close, or rejects with an error if a problem was encountered during the process. exceptions typeerror the stream you are trying to close is not a writablestream. examples the following example shows the creation of a writablestream with a custom sink and an api-supplied queuing strategy. i...
...the creation of a writablestream with a custom sink and an api-supplied queuing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: true }); e...
...ultwriter.ready .then(() => { return defaultwriter.write(chunk); }) .then(() => { console.log("chunk written to sink."); }) .catch((err) => { console.log("chunk error:", err); }); }); // call ready again to ensure that all chunks are written // before closing the writer. ...
...And 2 more matches
<menclose> - MathML
attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. notation a list of notations, separated by white space, to apply to the child elements. the symbols are each drawn as if the others are not present, and therefore may overlap. ...
... recommendation initial specification ...
... recommendation initial specification ...
...And 2 more matches
IDBDatabase: close event - Web APIs
the close event is fired on idbdatabase when the database connection is unexpectedly closed. this could happen, for example, if the underlying storage is removed or if the user clears the database in the browser's history preferences. note that it is not fired if the database connection is closed normally using idbdatabase.close(). ...
..., if the underlying storage is removed or if the user clears the database in the browser's history preferences. note that it is not fired if the database connection is closed normally using idbdatabase.close(). ...
...index('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.addeventlistener('close', () => { console.log('database connection closed'); }); }; the same example, using the onclose property instead of addeventlistener(): // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.result; // create an objectstore for this database const objectstore = db.createobjectstore('to...
...jectstore.createindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { const db = dbopenrequest.result; db.onclose = () => { console.log('database connection closed'); }; }; ...
Notification.close() - Web APIs
returns void. ...
... returns void. ...
... method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown. a valid use for this api would be to remove a notification that is no longer relevant (e.g. the user already read the notification on the webpage in the case of a messaging app or the following song is already playing in a music app). syntax notification.close(); parameters none. returns void. examples in the following snippet, we have a simple function that when called creates an options object and then a new notification. 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. function spawnnotification(thebody, theicon, thetitle) ...
...vant content has been read on the webpage. ...
RTCDataChannel.close() - Web APIs
the rtcdatachannel.close() method closes the rtcdatachannel. either peer is permitted to call this method to initiate closure of the channel. closure of the data channel is not instantaneous. most of the process of closing the connection is handled asynchronously; you can detect when the channel has finished closing by watching for a close event on the data channel. the sequence of events which occurs in response to this method being called: rtcdatachannel.readystate is set to "closing". a background task is established to handle the remainder of the steps below, and close() returns to the caller. the transport layer deals with any buffered messages; the protocol layer decides whether to send them or discard them. the underlying data transport is closed. the rtcdatachannel.readystate ...
...is method being called: rtcdatachannel.readystate is set to "closing". a background task is established to handle the remainder of the steps below, and close() returns to the caller. the transport layer deals with any buffered messages; the protocol layer decides whether to send them or discard them. the underlying data transport is closed. the rtcdatachannel.readystate property is set to "closed". if the transport was closed with an error, the rtcdatachannel is sent a networkerror event. a close event is sent to the channel. in firefox, the rtcdatachannel interface was implemented under the name datachannel until firefox 24, so this method was called datachannel.close(). syntax rtcdatachannel.close(); parameters none. return value undefined. example var pc = new rtcpeerco...
...in firefox, the rtcdatachannel interface was implemented under the name datachannel until firefox 24, so this method was called datachannel.close(). syntax rtcdatachannel.close(); parameters none. return value undefined. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); dc.onmessage = function (event) { console.log("received: " + event.data); dc.close(); // we decided to close after the first received message }; dc.onopen = function () { console.log("datachannel open"); }; dc.onclose = function ( console.log("datachannel close"); }; // now negotiate the connection and so forth... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachanne...
...; // we decided to close after the first received message }; dc.onopen = function () { console.log("datachannel open"); }; dc.onclose = function ( console.log("datachannel close"); }; // now negotiate the connection and so forth... specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.close()' in that specification. candidate recommendation initial specification. ...
RTCDataChannel: close event - Web APIs
the close event is sent to the onclose event handler on an rtcdatachannel instance when the data transport being used for the data channel has closed. before any further data can be transferred using rtcdatachannel, a new data channel instance must be created. bubbles no cancelable no interface event event handler property rtcdatachannel.onclose examples this example sets up a handler for the close event for the rtcdatachannel named dc; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started. ...
...o cancelable no interface event event handler property rtcdatachannel.onclose examples this example sets up a handler for the close event for the rtcdatachannel named dc; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started. ...
...c; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started. dc.addeventlistener("close", ev => { messageinputbox.disabled = true; sendbutton.disabled = true; connectbutton.disabled = false; disconnectbutton.disabled = true; }, false); all this code does in response to receiving the close event is to disable an input box and its "send" button, and to enable the button used to start a call (while disabling the one that ends a call). ...
...ntlistener("close", ev => { messageinputbox.disabled = true; sendbutton.disabled = true; connectbutton.disabled = false; disconnectbutton.disabled = true; }, false); all this code does in response to receiving the close event is to disable an input box and its "send" button, and to enable the button used to start a call (while disabling the one that ends a call). you can also use the onclose event handler property to set a handler for close events: dc.onclose = ev => { messageinputbox.disabled = true; sendbutton.disabled = true; connectbutton.disabled = false; disconnectbutton.disabled = true; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'close' in that specification. cand...
Window.close() - Web APIs
Web › API › Window › close
the window.close() method closes the current window, or the window on which it was called. this method can only be called on windows that were opened by a script using the window.open() method. if the window was not opened by a script, an error similar to this one appears in the console: scripts may not close windows that were not opened by script. note also that close() has no effect when called on window objects returned by htmliframe​element​.content​window. syntax window.close(); examples closing a window opened with window.open() this example shows a method which opens a window and a second one which closes the window; this demonstrates how to use window.close() to close a window opened by calling window.open(). //global var to store a reference to the opened window var open...
...; examples closing a window opened with window.open() this example shows a method which opens a window and a second one which closes the window; this demonstrates how to use window.close() to close a window opened by calling window.open(). ...
...with window.open() this example shows a method which opens a window and a second one which closes the window; this demonstrates how to use window.close() to close a window opened by calling window.open(). //global var to store a reference to the opened window var openedwindow; function openwindow() { openedwindow = window.open('moreinfo.htm'); } function closeopenedwindow() { openedwindow.close(); } closing the current window in the past, when you called the window object's close() method directly, rather than calling close() on a window instance, the browser closed the frontmost window, whether your script created that window or not. this is no longer the case; for security reasons, scripts are no longer allowed to close windows they didn't open. (firefox 46.0.1: scripts can not clo...
...past, when you called the window object's close() method directly, rather than calling close() on a window instance, the browser closed the frontmost window, whether your script created that window or not. this is no longer the case; for security reasons, scripts are no longer allowed to close windows they didn't open. (firefox 46.0.1: scripts can not close windows, they had not opened) function closecurrentwindow() { window.close(); } specification specification status comment html living standardthe definition of 'window.close()' in that specification. living standard html5the definition of 'window.close()' in that specification. recommendation ...
mozbrowserclose
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the mozbrowserclose event is fired when the content of a browser <iframe> calls the window.close() method. general info specification non standard interface customevent bubbles yes cancelable yes target <iframe> default action none properties property type description target read only eventtarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean ...
...enttarget the event target (the topmost target in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
... tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not. cancelable read only boolean whether the event is cancellable or not. ...
FC_CloseAllSessions
name fc_closeallsessions - close all sessions between an application and a token. syntax ck_rv fc_closeallsessions( ck_slot_id slotid ); parameters slotid [in] the id of the token's slot. description fc_closeallsessions closes all sessions between an application and the token in the slot with the id slotid. the nss cryptographic module currently doesn't call the surrender callback function notify. (see pkcs #11 v2.20 section 11.17.1.) a user may call fc_closeallsessions without logging into the token (to assume the nss user role). ...
...slot. description fc_closeallsessions closes all sessions between an application and the token in the slot with the id slotid. the nss cryptographic module currently doesn't call the surrender callback function notify. (see pkcs #11 v2.20 section 11.17.1.) a user may call fc_closeallsessions without logging into the token (to assume the nss user role). ...
...n fc_closeallsessions closes all sessions between an application and the token in the slot with the id slotid. the nss cryptographic module currently doesn't call the surrender callback function notify. (see pkcs #11 v2.20 section 11.17.1.) a user may call fc_closeallsessions without logging into the token (to assume the nss user role). ...
CanvasRenderingContext2D.closePath() - Web APIs
the canvasrenderingcontext2d.closepath() method of the canvas 2d api attempts to add a straight line from the current point to the start of the current sub-path. if the shape has already been closed or has only one point, this function does nothing. this method doesn't draw anything to the canvas directly. you can render the path using the stroke() or fill() methods. syntax void ctx.closepath(); examples closing a triangle this example creates the first two (diagonal) sides of a triangle using the lineto() method. after that, the triangle's base is created with the closepath() method, which automatically connects the shape's first and last points. html <canvas id="canvas"></canvas> javascript the triangle's corners are at (20, 150), (120, 20), and (220, 150). const canvas = docume...
...d last points. html <canvas id="canvas"></canvas> javascript the triangle's corners are at (20, 150), (120, 20), and (220, 150). const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(20, 140); // move pen to bottom-left corner ctx.lineto(120, 10); // line to top corner ctx.lineto(220, 140); // line to bottom-right corner ctx.closepath(); // line to bottom-left corner ctx.stroke(); result closing just one sub-path this example draws a smiley face consisting of three disconnected sub-paths. note: although closepath() is called after all the arcs have been created, only the last arc (sub-path) gets closed. html <canvas id="canvas"></canvas> javascript the first two arcs create the face's eyes. the last arc...
...-path) gets closed. html <canvas id="canvas"></canvas> javascript the first two arcs create the face's eyes. the last arc creates the mouth. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.arc(240, 20, 40, 0, math.pi); ctx.moveto(100, 20); ctx.arc(60, 20, 40, 0, math.pi); ctx.moveto(215, 80); ctx.arc(150, 80, 65, 0, math.pi); ctx.closepath(); ctx.linewidth = 6; ctx.stroke(); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.closepath' in that specification. living standard ...
HTMLDialogElement.close() - Web APIs
the close() method of the htmldialogelement interface closes the dialog. an optional domstring may be passed as an argument, updating the returnvalue of the the dialog. syntax dialoginstance.close(returnvalue); parameters returnvalue optional a domstring representing an updated value for the htmldialogelement.returnvalue of the dialog. return value void. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or submit the form via the submit button. <!-- simple pop-up dialog box, containing a form --> <dialog id="favdialog"> <form method="dialog"> <section> <p><l...
... <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>...
...cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script> note: you can find this example on github as htmldialogelement-basic (see it live also). specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard html 5.1the definition of 'close()' in that specification. recommendation ...
IDBDatabase.close() - Web APIs
Web › API › IDBDatabase › close
the close() method of the idbdatabase interface returns immediately and closes the connection in a separate thread. the connection is not actually closed until all transactions created using this connection are complete. no new transactions can be created for this connection once this method is called. methods that create transactions throw an exception if a closing operation is pending. note: this feature is available in web workers. syntax idbdatabase.close(); example // let us open our database var dbopenrequest = window.indexeddb.open("todolist", 4); // opening a database. // create event handlers for both success and failure of dbopenrequest.onerror = function(event) { note.innerhtml += "<li>error loading database.</li>"; }; dbopenrequest.onsuccess = function(event) { note.
...", 4); // opening a database. // create event handlers for both success and failure of dbopenrequest.onerror = function(event) { note.innerhtml += "<li>error loading database.</li>"; }; dbopenrequest.onsuccess = function(event) { note.innerhtml += "<li>database initialised.</li>"; // store the result of opening the database in the db variable. db = dbopenrequest.result; // now let"s close the database again! db.close(); }; specification specification status comment indexed database api 2.0the definition of 'close()' in that specification. recommendation indexed database api draftthe definition of 'close()' in that specification. recommendation browser compatibility the compatibility table on this page is generated from...
...ation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
IDBDatabase.onclose - Web APIs
the onclose event handler of the idbdatabase interface handles the close event, which is fired when the database is unexpectedly closed. this can happen, for example, when the application is shut down or access to the disk the database is stored on is lost while the database is open. the close event is fired after all transactions have been aborted and the connection has been closed. note: this feature is available in web workers. syntax idbdatabase.onclose = function(event) { ... }; value a function which is called when the close event is fired. ...
... application is shut down or access to the disk the database is stored on is lost while the database is open. the close event is fired after all transactions have been aborted and the connection has been closed. note: this feature is available in web workers. syntax idbdatabase.onclose = function(event) { ... }; value a function which is called when the close event is fired. example db.onclose = function(event) { myappshowalert('the database "' + db.name + '" has unexpectedly closed.'); }; specifications specification status comment indexed database api draftthe definition of 'onclose' in that specification. recommendation browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribut...
...ion browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
USBDevice.close() - Web APIs
Web › API › USBDevice › close
draft initial definition. ...
... draft initial definition. ...
... draft initial definition. ...
WebSocket.close() - Web APIs
Web › API › WebSocket › close
reason optional a human-readable string explaining why the connection is closing. this string must be no longer than 123 bytes of utf-8 text (not characters). exceptions thrown invalid_access_err an invalid code was specified. syntax_err the reason string is too long or contains unpaired surrogates. ...
... reason optional a human-readable string explaining why the connection is closing. this string must be no longer than 123 bytes of utf-8 text (not characters). exceptions thrown invalid_access_err an invalid code was specified. syntax_err the reason string is too long or contains unpaired surrogates. ...
...ceptions thrown invalid_access_err an invalid code was specified. syntax_err the reason string is too long or contains unpaired surrogates. note: in gecko, this method didn't support any parameters prior to gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5). specifications specification status comment html living standard the definition of 'websocket.close()' in that specification. living standard initial definition ...
WebSocket: close event - Web APIs
the close event is fired when a connection with a websocket is closed. bubbles no cancelable no interface closeevent event handler property onclose examples you might want to know when the connection has been closed so that you can update the ui or, perhaps, save data about the closed connection. given that you have a variable called examplesocket that refers to an opened websocket, this handler would handle the situation where the socket has been closed. ...
...ent event handler property onclose examples you might want to know when the connection has been closed so that you can update the ui or, perhaps, save data about the closed connection. given that you have a variable called examplesocket that refers to an opened websocket, this handler would handle the situation where the socket has been closed. ...
...es you might want to know when the connection has been closed so that you can update the ui or, perhaps, save data about the closed connection. given that you have a variable called examplesocket that refers to an opened websocket, this handler would handle the situation where the socket has been closed. examplesocket.addeventlistener('close', (event) => { console.log('the connection has been closed successfully.'); )}; you can perform the same actions using the event handler property, like this: examplesocket.onclose = function (event) { console.log('the connection has been closed successfully.'); }; specifications specification status html living standardthe definition of 'websocket close' in that specification. living standard ...
Window.closed - Web APIs
Web › API › Window › closed
the window.closed read-only property indicates whether the referenced window is closed or not. syntax const isclosed = windowref.closed; value a boolean. possible values: true: the window has been closed. false: the window is open. examples change the url of a window from a popup the following example demonstrates how a popup window can change the url of the window that opened it. before attempting to change the url, it checks that the current window has an opener using the window.opener property and that the opener isn't closed: // check that an opener exists and is not closed if (window.opener && !window.opener.closed) { window.opener.location.href = 'http://www.mozilla.org'; } note that popups can only access the window that opened them. refreshing a previously opened popu...
... not closed if (window.opener && !window.opener.closed) { window.opener.location.href = 'http://www.mozilla.org'; } note that popups can only access the window that opened them. 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. if the popup hasn't been opened yet or the user has closed it a new window is opened. ...
... popups can only access the window that opened them. 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. if the popup hasn't been opened yet or the user has closed it a new window is opened. const popupwindow = null; function refreshpopupwindow() { if (popupwindow && !popupwindow.closed) { // popupwindow is open, refresh it popupwindow.location.reload(true); } else { // open a new popup window popupwindow = window.open('popup.html', 'datawindow'); } } specification specification status comment html living standardthe definition of 'window.closed' in that specification. living standard ...
disableclose - Archive of obsolete content
...
... ...
onclosetab - Archive of obsolete content
...
... ...
PR_CloseSharedMemory
returns prstatus. ...
... returns prstatus. ...
CloseEvent() - Web APIs
the closeevent() constructor creates a new closeevent. syntax var event = new closeevent(typearg, closeeventinit); values typearg is a domstring representing the name of the event. closeeventinit optional is a closeeventinit dictionary, having the following fields: "wasclean", optional and defaulting to false, of type long, indicates if the connection has been closed cleanly or not. "code", optional and defaulting to 0, of type unsigned short, that is the connection close code sent by the server. "reason", optional and defaulting to '', of type domstring, that is a human-readable reason why the server closed the connection. the closeeventinit dictionary also accepts fields from the eventinit dictionary. specifications specification status commen...
...d short, that is the connection close code sent by the server. "reason", optional and defaulting to '', of type domstring, that is a human-readable reason why the server closed the connection. the closeeventinit dictionary also accepts fields from the eventinit dictionary. specifications specification status comment html living standardthe definition of 'closeevent()' in that specification. living standard initial definition. ...
MessagePort.close() - Web APIs
Web › API › MessagePort › close
the close() method of the messageport interface disconnects the port, so it is no longer active. this stops the flow of messages to that port. note: this feature is available in web workers. syntax port.close() returns void. parameters none. example in the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using eventtarget.addeventlistener. ...
...n the following code block, you can see a handlemessage handler function, run when a message is sent back to this document using eventtarget.addeventlistener. channel.port1.addeventlistener('message', handlemessage, false); function handlemessage(e) { para.innerhtml = e.data; textinput.value = ''; } channel.port1.start(); you could stop messages being sent at any time using channel.port1.close(); specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard ...
RTCDataChannel.onclose - Web APIs
the rtcdatachannel.onclose property is an eventhandler which specifies a function to be called by the browser when the close event is received by the rtcdatachannel. this is a simple event which indicates that the data channel has closed down. syntax rtcdatachannel.onclose = function; value a function which the browser will call to handle the close event. the function receives as its sole input parameter the event itself, as an object of type event. example in this sample from a hypothetical instant messaging client, a data channel is created, then handlers for the open and close events are set up to enable and disable user interface objects based on the state of the channel. this way, the message entry field and the send button are only enabled for use when the connection is actually...
...ects based on the state of the channel. this way, the message entry field and the send button are only enabled for use when the connection is actually open. let pc = new rtcpeerconnection(); let dc = pc.createdatachannel("messagechannel")}}; dc.onopen = function(event) { document.getelementbyid("messagebox").disabled = false; document.getelementbyid("sendbutton").disabled = false; }; dc.onclose = function(event) { document.getelementbyid("messagebox").disabled = true; document.getelementbyid("sendbutton").disabled = true; } /* now negotiate the connection, etc... */ specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannel.onclose' in that specification. candidate recommendation...
RTCPeerConnection.close() - Web APIs
the rtcpeerconnection.close() method closes the current peer connection. syntax peerconnection.close(); this method has no parameters, and returns nothing. calling this method terminates the rtcpeerconnection's ice agent, ending any ongoing ice processing and any active streams. this also releases any resources in use by the ice agent, including turn permissions. all rtcrtpsender objects are considered to be stopped once this returns (they may still be in the process of stopping, but for all intents and purposes, they're stopped). once this method returns, the signaling state as returned by rtcpeerconnection.signalingstate is closed. make sure that you delete all references to the previous rtcpeerconnection before attempting to create a new one that connects to the same remote peer, a...
...osed. make sure that you delete all references to the previous rtcpeerconnection before attempting to create a new one that connects to the same remote peer, as not doing so might result in some errors depending on the browser. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); dc.onmessage = function (event) { console.log("received: " + event.data); pc.close(); // we decided to close after the first received message }; dc.onopen = function () { console.log("datachannel open"); }; dc.onclose = function () { console.log("datachannel close"); }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.close()' in that specification. candida...
onnotificationclose - Web APIs
the serviceworkerglobalscope.onnotificationclose property is an event handler called whenever the notificationclose event is dispatched on the serviceworkerglobalscope object, that is when a user closes a displayed notification spawned by serviceworkerregistration.shownotification(). notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a close event on the notification object itself. note: trying to create a notification inside the serviceworkerglobalscope using the notification() constructor will throw an error. syntax serviceworkerglobalscope.onnotificationclose = function(notificationevent) { ... }; serviceworkerglobalscope.addeventlistener('notificationclose', function(notificationevent) { ... })...
...object itself. note: trying to create a notification inside the serviceworkerglobalscope using the notification() constructor will throw an error. syntax serviceworkerglobalscope.onnotificationclose = function(notificationevent) { ... }; serviceworkerglobalscope.addeventlistener('notificationclose', function(notificationevent) { ... }); example //inside a service worker. self.onnotificationclose = function(event) { console.log('on notification close: ', event.notification.tag); }; specifications specification status comment notifications apithe definition of 'onnotificationclick' in that specification. living standard initial definition. this property is specified on the notifications_api even though it's part of serviceworkerglobalscope. ...
close - Archive of obsolete content
« xul reference home close type: boolean if the panel has a titlebar, set the panel's close attribute to true to have a close button appear on the titlebar. pressing the close button will close the panel. ...
closebutton - Archive of obsolete content
« xul reference home closebutton obsolete since gecko 1.9.2 type: boolean if this attribute is set to true, the tabs row will have a "new tab" button and "close" button on the ends. this feature is used by the tabbrowser to provide the facilities for adding and closing tabs. you can set an image to the "new tab" and "close" buttons by applying them to the tabs-newbutton and tabs-closebutton classes respectively. ...
closemenu - Archive of obsolete content
« xul reference home closemenu type: one of the values below indicates if the menu closes when the menuitem is activated. auto this, the default value if the closemenu attribute is not specified, closes up the menu and all parent menus. single the menu the item is contained within is closed, but the parent menus remain open. none no menus are closed. ...
close - Archive of obsolete content
Archive › Mozilla › XUL › Method › close
« xul reference home close() return type: no return value closes the notification or findbar and removes it from its enclosing notificationbox or findbar. ...
PR_Close
closes a file descriptor. syntax #include <prio.h> prstatus pr_close(prfiledesc *fd); parameters the function has the following parameters: fd a pointer to a prfiledesc object. returns one of the following values: if file descriptor is closed successfully, pr_success. if the file descriptor is not closed successfully, pr_failure. description the file descriptor may represent a normal file, a socket, or an end point of a pipe. on successful return, pr_close frees the dynamic memory and other resources identified by the fd parameter. ...
PR_CloseDir
closes the specified directory. syntax #include <prio.h> prstatus pr_closedir(prdir *dir); parameter the function has the following parameter: dir a pointer to a prdir structure representing the directory to be closed. returns if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. description when a prdir object is no longer needed, it must be closed and freed with a call to pr_closedir call. note that after a pr_closedir call, any prdirentry object returned by a previous pr_readdir call on the same prdir object becomes invalid. see also pr_opendir ...
PR_CloseFileMap
closes a file mapping. syntax #include <prio.h> prstatus pr_closefilemap(prfilemap *fmap); parameter the function has the following parameter: fmap the file mapping to be closed. returns the function returns one of the following values: if the memory region is successfully unmapped, pr_success. if the memory region is not successfully unmapped, pr_failure. the error code can be retrieved via pr_geterror. description when a file mapping created with a call to pr_createfilemap is no longer needed, it should be closed with a call to pr_closefilemap. ...
PR_CloseSemaphore
closes a specified semaphore. syntax #include <pripcsem.h> nspr_api(prstatus) pr_closesemaphore(prsem *sem); parameter the function has the following parameter: sem a pointer to a prsem structure returned from a call to pr_opensemaphore. returns prstatus ...
FC_CloseSession
name fc_closesession - close a session opened between an application and a token. syntax ck_rv fc_closesession( ck_session_handle hsession ); parameters hsession [in] the session handle to be closed. description fc_closesession closes a session between an application and a token. a user may call fc_closesession without logging into the token (to assume the nss user role). return value examples see also fc_opensession ...
close
...
close
...
close
...
BroadcastChannel.close() - Web APIs
the broadcastchannel.close() terminates the connection to the underlying channel, allowing the object to be garbage collected. this is a necessary step to perform as there is no other way for a browser to know that this channel is not needed anymore. note: this feature is available in web workers. syntax var str = channel.close(); example // connect to a channel var bc = new broadcastchannel('test_channel'); // more operations (like postmessage, …) // when done, disconnect from the channel bc.close(); specifications specification status comment html living standardthe definition of 'broadcastchannel.close()' in that specification. living standard initial definition. ...
DedicatedWorkerGlobalScope.close() - Web APIs
the close() method of the dedicatedworkerglobalscope interface discards any tasks queued in the dedicatedworkerglobalscope's event loop, effectively closing this particular scope. syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope. note: there is also a way to stop the worker from the main thread: the worker.terminate method. specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard ...
Document.close() - Web APIs
Web › API › Document › close
the document.close() method finishes writing to a document, opened with document.open(). syntax document.close(); example // open a document to write to it document.open(); // write the content of the document document.write("<p>the one and only content.</p>"); // close the document document.close(); specifications specification status comment html living standardthe definition of 'document.close()' in that specification. living standard document object model (dom) level 2 html specificationthe definition of 'document.close()' in that specification. obsolete ...
Element.openOrClosedShadowRoot - Web APIs
note: this api is available only to webextensions. the element.openorcloseshadowroot read-only property represents the shadow root hosted by the element, regardless if its mode is open or closed. use element.attachshadow() to add a shadow root to an existing element. syntax var shadowroot = element.shadowroot; value a shadowroot object instance, regardless if its mode is set to open or closed, or null if no shadow root is present. (see element.attachshadow() for further details). specifications this property is not part of any specification. ...
EventSource.close() - Web APIs
Web › API › EventSource › close
the close() method of the eventsource interface closes the connection, if one is made, and sets the eventsource.readystate attribute to 2 (closed). note: if the connection is already closed, the method does nothing. syntax eventsource.close(); parameters none. return value void. examples var button = document.queryselector('button'); var evtsource = new eventsource('sse.php'); button.onclick = function() { console.log('connection closed'); evtsource.close(); } note: you can find a full example on github — see simple sse demo using php. specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard initial definition ...
GlobalEventHandlers.onclose - Web APIs
the onclose property of the globaleventhandlers mixin is an eventhandler for processing close events sent to a <dialog> element. the close event fires when the user closes a <dialog>. note: to handle the closing of a window, use onbeforeunload or onunload. syntax target.onclose = functionref; value functionref is a function name or a function expression. the function receives an event object as its sole argument. only one onclose handler can be assigned to an object at a time. you may prefer to use the eventtarget.addeventlistener() method instead, since it's more flexible. specifications specification status comment html living standardthe definition of 'onclose' in that specification. living standard ...
ImageBitmap.close() - Web APIs
Web › API › ImageBitmap › close
the imagebitmap.close() method disposes of all graphical resources associated with an imagebitmap. syntax void imagebitmap.close() examples var offscreen = new offscreencanvas(256, 256); var gl = offscreen.getcontext('webgl'); // ... some drawing using the gl context ... var bitmap = offscreen.transfertoimagebitmap(); // imagebitmap { width: 256, height: 256 } bitmap.close(); // imagebitmap { width: 0, height: 0 } -- disposed specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard ...
close() - Web APIs
the mediakeysession.close() method notifies that the current media session is no longer needed, and that the content decryption module should release any resources associated with this object and close it. then, it returns a promise. syntax mediakeysession.close().then(function() { ... }); return value a promise. specifications specification status comment encrypted media extensionsthe definition of 'close()' in that specification. recommendation initial definition ...
MediaKeySession.closed - Web APIs
the mediakeysession.closed read-only property returns a promise signaling when a mediakeysession closes. this promise can only be fulfilled and is never rejected. closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. syntax var promise = mediakeysessionobj.closed; value a promise. specifications specification status comment encrypted media extensionsthe definition of 'closed' in that specification. recommendation initial definition ...
Notification.onclose - Web APIs
note: this feature is available in web workers. the onclose property of the notification interface specifies an event listener to receive close events. these events occur when a notification is closed. syntax notification.onclose = function() { ... }; ...
SharedWorkerGlobalScope.close() - Web APIs
the close() method of the sharedworkerglobalscope interface discards any tasks queued in the sharedworkerglobalscope's event loop, effectively closing this particular scope. syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope. note: there is also a way to stop the worker from the main thread: the worker.terminate method. specifications specification status comment html living standardthe definition of 'close()' in that specification. living standard ...
WebSocket.onclose - Web APIs
Web › API › WebSocket › onclose
the websocket.onclose property is an eventhandler that is called when the websocket connection's readystate changes to closed. it is called with a closeevent. syntax awebsocket.onclose = function(event) { console.log("websocket is closed now."); }; value an eventlistener. specifications specification status comment html living standardthe definition of 'websocket: onclose' in that specification. living standard initial definition ...
WorkerGlobalScope.close() - Web APIs
the close() method of the workerglobalscope interface discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. syntax self.close(); example if you wanted to close your worker instance from inside the worker itself, you could call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope. note: there is also a way to stop the worker from the main thread: the worker.terminate method. ...
WorkerGlobalScope.onclose - Web APIs
summary the onclose property of the workerglobalscope interface represents an eventhandler to be called when the close event occurs and bubbles through the worker. this non-standard event handler was only implemented by a few browsers and has been removed from all or nearly all of them. syntax self.onclose = function() { ... }; example the following code snippet shows an onclose handler set inside a worker: self.onclose = function() { console.log('your worker instance has been closed'); } specifications this feature is no longer defined in any specifications. ...
WritableStreamDefaultWriter.closed - Web APIs
the closed read-only property of the writablestreamdefaultwriter interface returns a promise that fulfills if the stream becomes closed or the writer's lock is released, or rejects if the stream errors. syntax var closed = writablestreamdefaultwriter.closed; value a promise. examples const writablestream = new writablestream({ start(controller) { }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); .. // check if the stream is closed writer.closed.then(() => { console.log('writer closed'); }) specifications specification status comment streamsthe definition of 'closed' in that specification. living standard initial definiti...
Index - Web APIs
Web › API › Index
124 audiocontext.baselatency api, audio, audiocontext, experimental, media, property, web audio api, baselatency the baselatency read-only property of the audiocontext interface returns a double that represents the number of seconds of processing latency incurred by the audiocontext passing the audio from the audiodestinationnode to the audio subsystem. 125 audiocontext.close() api, audiocontext, media, method, reference, web audio api, close the close() method of the audiocontext interface closes the audio context, releasing any system audio resources that it uses. 126 audiocontext.createjavascriptnode() api, audio, method, obsolete, reference, web, createjavascriptnode the following script illustrates the use of createjavascriptnode():...
...same origin. messages are broadcasted via a message event fired at all broadcastchannel objects listening to the channel. 364 broadcastchannel() api, broadcast channel api, broadcastchannel, constructor, experimental, html api, reference the broadcastchannel() constructor creates a new broadcastchannel and connects it to the underlying channel. 365 broadcastchannel.close() api, broadcast channel api, broadcastchannel, experimental, html api, method, reference the broadcastchannel.close() terminates the connection to the underlying channel, allowing the object to be garbage collected. this is a necessary step to perform as there is no other way for a browser to know that this channel is not needed anymore. 366 broadcastchannel.name broadca...
...es the pixels in a rectangular area by setting them to transparent black. 551 canvasrenderingcontext2d.clip() api, canvas, canvasrenderingcontext2d, method, reference the canvasrenderingcontext2d.clip() method of the canvas 2d api turns the current or given path into the current clipping region. it replaces any previous clipping region. 552 canvasrenderingcontext2d.closepath() api, canvas, canvasrenderingcontext2d, method, reference the canvasrenderingcontext2d.closepath() method of the canvas 2d api attempts to add a straight line from the current point to the start of the current sub-path. if the shape has already been closed or has only one point, this function does nothing. 553 canvasrenderingcontext2d.createimagedata() api, canvas, c...
...And 68 more matches
MathML Accessibility in Mozilla
kit's bug 146454 a. pre-subscript e pre-superscript f pre-superscript g subscript b subscript c superscript d a base b subscript c subscript d superscript e presubscript f presuperscript g presuperscript scripted x+y __________ long division symbol enclosing x plus y end symbol __________ not supported. see webkit's bug 146543. ...
...uperscript g subscript b subscript c superscript d a base b subscript c subscript d superscript e presubscript f presuperscript g presuperscript scripted x+y __________ long division symbol enclosing x plus y end symbol __________ not supported. see webkit's bug 146543. x plus y enclosed by: a long division sign x + y long division enclosed x+y __________ long division symbol enclosing x plus y end symbol __________ not supported. see webkit's bug 146543. x plus y enclosed by: a long division sign x + y long division enclosed x+y __________ actuarial symbol enclosing x plus y end symbol __________ not supported. ...
...long division symbol enclosing x plus y end symbol __________ not supported. see webkit's bug 146543. x plus y enclosed by: a long division sign x + y long division enclosed x+y __________ actuarial symbol enclosing x plus y end symbol __________ not supported. see webkit's bug 146543. x plus y enclosed by: an actuarial symbol x + y actuarial enclosed x+y __________ x plus y __________ not supported. see webkit's bug 146543. ...
...And 17 more matches
Signaling and video calling - Web APIs
ideo" <video> element presents a preview of the user's camera; specifiying the muted attribute, as we don't need to hear local audio in this preview panel. finally, the "hangup-button" <button>, to disconnect from a call, is defined and configured to start disabled (setting this as our default for when no call is connected) and apply the function hangupcall() on click. this function's role is to close the call, and send a signalling server notification to the other peer, requesting it also close. the javascript code we'll divide this code into functional areas to more easily describe how it works. the main body of this code is found in the connect() function: it opens up a websocket server on port 6503, and establishes a handler to receive messages in json object format. this code generally ...
...me) { case "notfounderror": alert("unable to open your call because no camera and/or microphone" + "were found."); break; case "securityerror": case "permissiondeniederror": // do nothing; this is the same as the user canceling the call. ...
...this code is designed to safely handle partially-started calls. ...
...And 17 more matches
OS.File for the main thread
// write a subset of |data| return promise.then(function onsuccess(bytes) { return loop(pos + bytes); // ... and loop. }); }; let promise = loop(0); // enter the loop. promise = promise.then(function onsuccess() { // once loop is complete, finalize. ...
...hen(function onsuccess(bytes) { return loop(pos + bytes); // ... and loop. }); }; let promise = loop(0); // enter the loop. promise = promise.then(function onsuccess() { // once loop is complete, finalize. ...
...after image loads it then draws it to canvas, makes it a blob, and u...
...And 14 more matches
Index
n/should be assigned to the certificate at the time of import, which can later be used to easily identify and retrieve it. it's important to note that nss requires strict cleanup for all handles returned by nss. the application should always call the appropriate dereference (destroy) functions once a handle is no longer needed. this is particularly important for applications that might need to close a database and reinitialize nss using a different one, without restarting. such an operation might fail at runtime if data elements are still being referenced. in addition to the freebl, softoken, and ckbi modules, there is an utility library for general operations (e.g., encoding/decoding between data formats, a list of standardized object identifiers (oid)). nss has an ssl/tls module that im...
...arser implementations, each having their own specific properties, advantages and disadvantages, which is why all of them are still being used (nobody has yet dared to replace the older with the newer ones because of risks for side effects). when using the asn.1 parser(s), a template definition is passed to the parser, which will analyze the asn.1 data stream accordingly. the templates are usually closely aligned to definitions found in rfc documents. a data block described as der is usually in asn.1 format. you must know which data you are expecting, and use the correct template for parsing, based on the context of your software's interaction. data described as pem is a base64 encoded presentation of der, usually wrapped between human readable begin/end lines. nss prefers the binary presenta...
...eresting to mention a property of the nspr file descriptors, which are stacked in layers. this means you can define multiple layers that are involved in data processing. a file descriptor has a pointer to the first layer handling the data. that layer has a pointer to a potential second layer, which might have another pointer to a third layer, etc. each layer defines its own functions for the open/close/read/write/poll/select (etc.) functions. when using an ssl network connection, you'll already have two layers, the basic nspr layer and an ssl library layer. the mozilla applications define a third layer where application specific processing is performed. you can find more details in the nspr reference documents. nss occassionally has to create outbound network connections, in addition to the ...
...And 14 more matches
nsISessionStore
owser.sessionstore.enabled must be true for these calls to be successful. starting in firefox 3.5, this preference is no longer used. ...
...refox 3.5, this preference is no longer used. ...
...node atab, in astring akey); void deletewindowvalue(in nsidomwindow awindow, in astring akey); nsidomnode duplicatetab(in nsidomwindow awindow, in nsidomnode atab); nsidomnode forgetclosedtab(in nsidomwindow awindow, in unsigned long aindex); nsidomnode forgetclosedwindow(in unsigned long aindex); astring getbrowserstate(); unsigned long getclosedtabcount(in nsidomwindow awindow); astring getclosedtabdata(in nsidomwindow awindow); unsigned long getclosedwindowcount(); astring getclosedwindowdata(); astring gettabstate(in nsidomnode atab); astring gettabvalue(in nsidomnode atab, in astring akey); astring getwindowstate(in nsidomwindow awindow); astring getwindowvalue(in nsid...
...And 14 more matches
Index - Archive of obsolete content
reference no summary! 800 checked xul attributes, xul reference no summary! 801 chromemargin xul, xul attribute, xul reference no summary! 802 class xul attributes, xul reference no summary! 803 clicktoscroll clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. ...
...ul reference no summary! 801 chromemargin xul, xul attribute, xul reference no summary! 802 class xul attributes, xul reference no summary! 803 clicktoscroll clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. ...
...te, xul reference no summary! 802 class xul attributes, xul reference no summary! 803 clicktoscroll clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. ...
...And 11 more matches
Index
Mozilla › Tech › XPCOM › Index
table, needscontent, streams, xpcom api reference, xpcom interface reference if an input stream is non-blocking, it may return ns_base_stream_would_block when read. the caller must then wait for the stream to have some data to read. if the stream implements nsiasyncinputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes readable or closed (via the asyncwait() method). 338 nsiasyncoutputstream interfaces, interfaces:scriptable, needscontent, streams, xpcom, xpcom api reference, xpcom interface reference if an output stream is non-blocking, it may return ns_base_stream_would_block when written to. the caller must then wait for the stream to become writable. if the stream implements nsiasyncoutputstream, then th...
...eedscontent, streams, xpcom, xpcom api reference, xpcom interface reference if an output stream is non-blocking, it may return ns_base_stream_would_block when written to. the caller must then wait for the stream to become writable. if the stream implements nsiasyncoutputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes writable or closed (via the asyncwait() method). 339 nsiasyncstreamcopier interfaces, interfaces:scriptable, streams, xpcom, xpcom api reference, xpcom interface reference starts the copy operation. the specified observer is notified when the copy completes. 340 nsiasyncverifyredirectcallback interfaces, interfaces:scriptable, xpcom, xpcom interface reference no summary! ...
... namespace for various cache constants. it does not represent an actual object. 369 nsicachedeviceinfo cache, interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference no summary! 370 nsicacheentrydescriptor cache, interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference this method explicitly closes the descriptor (optional). 371 nsicacheentryinfo cache, interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference this method finds out whether or not the cache entry is stream based. 372 nsicachelistener interfaces, interfaces:scriptable, xpcom, xpcom api reference, xpcom interface reference this method is called when the ...
...And 10 more matches
A simple RTCDataChannel sample - Web APIs
clarity. note: even though both ends of our connection will be on the same page, we're going to refer to the one that starts the connection as the "local" one, and to the other as the "remote" end. ...
... it's important to keep in mind that each end of the channel has its own rtcdatachannel object. ...
...this is saved, and we set up, on the channel, event listeners for the events we want to handle. once this is done, our handlereceivemessage() method will be called each time data is received by the remote peer, and the...
...And 10 more matches
Event reference
es not bubble). focusin an element is about to receive focus (does bubble). focusout an element is about to lose focus (does bubble). websocket events event name fired when open a websocket connection has been established. message a message is received through a websocket. error a websocket connection has been closed with prejudice (some data couldn't be sent for example). close a websocket connection has been closed. session history events event name fired when pagehide a session history entry is being traversed from. pageshow a session history entry is being traversed to. popstate a session history entry is being navigated to (in c...
...ransitionrun a css transition has begun running (fired before any delay starts). form events event name fired when reset the reset button is pressed submit the submit button is pressed printing events event name fired when beforeprint the print dialog is opened afterprint the print dialog is closed text composition events event name fired when compositionstart the composition of a passage of text is prepared (similar to keydown for a keyboard input, but works with other inputs such as speech recognition). compositionupdate a character is added to a passage of text being composed. compositionend the composition of a passage of ...
... event name fired when abort a dom request is aborted, i.e. using abortcontroller.abort(). ...
...And 10 more matches
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
etservice(components.interfaces.nsiwindowmediator); var browser = windowmediator.getmostrecentwindow('navigator:browser'); alert(browser.gbrowser.mtabs.length); get overview of all windows with a certain type use the nsiwindowmediator.getenumerator() method to get an overview of all windows that have a certain type. ...
...all windows that have a certain type. listing 5 shows how to get a summary of all browser windows in firefox and then close them. listing 5: closing all browser windows var browsers = windowmediator.getenumerator('navigator:browser'); var browser; while (browsers.hasmoreelements()) { browser = browsers.getnext().queryinterface(components.interfaces.nsidomwindowinternal); browser.browsertrytoclosewindow(); } this method returns an overview of the specified window type in the form of an iterator pattern object called nsisimpleenumerator. after getting an element with the nsisimpleenumerator.getnext() method, use the queryinterface method to get the interface, which allows you to handle each element as a window object. like the getmostrecentwindow() method, passing null as the parameter fo...
... outputting binary files listing 14 shows the opposite operation, taking a string of bytes an...
...And 9 more matches
Accessing the Windows Registry Using XPCOM
xpcom interfaces to read and write registry data. this article will show you how to use the available interfaces in several mozilla products. the examples in this document are all written in javascript using xpcom. support in firefox 1.5 or newer in firefox 1.5, a new api was added, nsiwindowsregkey, which provides extensive registry functionality. the interface follows the windows api fairly closely, but with many of the low-level details taken care of for you. if you are writing an extension that only needs to support firefox 1.5 or newer, then you only need to read this section. a simple example here's a simple example showing how to read your windows productid: var wrk = components.classes["@mozilla.org/windows-registry-key;1"] .createinstance(components.interface...
...first, you must use createinstance() to get an object implementing this interface, not getservice(). second, you must call open() on the key before attempting to read a value. notice in the open() call that the root key to use is specified using the named constants available on the nsiwindowsregkey interfa...
...d c++ string constants. the desired access rights are specified using a named constant from the interface, in this example access_read. this can be very important when dealing with non-administrator accounts with restricted privileges. the value is read using readstringvalue(). you have to specify what type of data you expect to read, which we will expand on later. finally, note that you should close the key when you are done to avoid wasting system resources. opening registry keys before doing anything with a registry key you must first open the key you are interested in. the example above demonstates this using the open() method. if you want to create a new key, you can use the create() method, which takes the same parameters as open(). note that it is not an error to call create() on an ...
...And 9 more matches
Using readable streams - Web APIs
a blob, create an object url out of that blob using url.createobjecturl(), and then display it on screen in an <img> element, effectively creating a copy of the image we originally fetched. ...
...jecturl(), and then display it on screen in an <img> element, effectively creating a copy of the image we originally fetched. ...
... we first invoke read(), which returns a promise containing a results object — this has the results of our read in it, in the form { done, value }: return reader.read().then(({ done, value }) => { the results can be one of three different types: if a chunk is available to read, the promise will be fulfilled with an object of the form { value: thechunk, done: false }. ...
...And 9 more matches
Using IndexedDB - Web APIs
deneeded event is triggered straight away, allowing you to provide an updated schema in its handler. more on this later in updating the version of the database below, and the idbfactory.open reference page. important: the version number is an unsigned long long number, which means that it can be a very big integer. it also means that you can't use a float, otherwise it will be converted to the closest lower integer and the transaction may not start, nor the upgradeneeded event trigger. so for example, don't use 2.4 as a version number: var request = indexeddb.open("mytestdatabase", 2.4); // don't do this, as the version will be rounded to 2 generating handlers the first thing you'll want to do with almost all of the requests you generate is to add success and error handlers: request.one...
... see storage limits.) obviously, browsers do not want to allow some advertising network or malicious website to pollute your computer, so browsers used to prompt the user the first time any given web app attempts to open an indexeddb for storage. the user could choose to allow or deny access. also, indexeddb storage in browsers' privacy modes only lasts in-memory until the incognito session is closed (private browsing mode for firefox and incognito mode for chrome, but in firefox this is not implemented yet as of april 2020 so you can't use indexeddb in firefox private browsing at all). now, assuming that the user allowed your request to create a database, and you've received a success event to trigger the success callback; what's next? the request here was generated with a call to indexedd...
... want the transaction to span all object stores, but don't do it because the spec says an empty array should generate an invalidaccesserror. if you don't specify anything for the second argument, you get a read-only transaction. since you want to write to it here you need to pass the "readwrite" flag. now that you have a transaction you need to understand its lifetime. transactions are tied very closely to the event loop. if you make a transaction and return to the event loop without using it then the transaction will become inactive. the only way to keep the transaction active is to make a request on it. when the request is finished you'll get a dom event and, assuming that the request succeeded, you'll have another opportunity to extend the transaction during that callback. if you return to ...
...And 8 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
, xul reference no summary! 53 checked xul attributes, xul reference no summary! 54 chromemargin xul, xul attribute, xul reference no summary! 55 class xul attributes, xul reference no summary! 56 clicktoscroll clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. ...
...es, xul reference no summary! 54 chromemargin xul, xul attribute, xul reference no summary! 55 class xul attributes, xul reference no summary! 56 clicktoscroll clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. ...
...tribute, xul reference no summary! 55 class xul attributes, xul reference no summary! 56 clicktoscroll clicktoscroll, if true, the arrows must be clicked to scroll the scrollbox content. ...
...And 7 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
buf, sizeof(ibuf))) > 0) { rv = sgn_update(sgn, ibuf, nb); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while sgn_update\n"); goto cleanup; } } rv = sgn_end(sgn, res); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while sgn_end\n"); goto cleanup; } cleanup: if (infile) { pr_close(infile); } if (sgn) { sgn_destroycontext(sgn, pr_true); } return rv; } /* * verify the signature using public key */ secstatus verifydata(const char *infilename, seckeypublickey *pk, secitem *sigitem, secupwdata *pwdata) { unsigned int nb; unsigned char ibuf[4096]; secstatus rv = secfailure; vfycontext *vfy = null...
...le, ibuf, sizeof(ibuf))) > 0) { rv = vfy_update(vfy, ibuf, nb); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while vfy_update\n"); goto cleanup; } } rv = vfy_end(vfy); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while vfy_end\n"); goto cleanup; } cleanup: if (infile) { pr_close(infile); } if (vfy) { vfy_destroycontext(vfy, pr_true); } return rv; } /* * write cryptographic parameters to header file */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; const char *header; const char *trailer; switch (type) { case sy...
... if (body) { trail = strstr(++body, trailer); if (trail != null) { pr_fprintf(pr_stderr, "input has no header but has trailer\n"); port_free(filedata.data); rv = secfailure; goto cleanup; } } } hextobuf(body, item, ishexdata); cleanup: if (file) { pr_close(file); } return rv; } /* * generate the private key */ seckeyprivatekey * generateprivatekey(keytype keytype, pk11slotinfo *slot, int size, int publicexponent, const char *noise, seckeypublickey **pubkeyp, const char *pqgfile, secupwdata *pwdata) { ck_mechanism_type mechanism; secoidtag algtag; ...
...And 7 more matches
sample2
cess) { pr_fprintf(pr_stderr, "problem while sgn_begin\n"); goto cleanup; } while ((nb = pr_read(infile, ibuf, sizeof(ibuf))) > 0) { rv = sgn_update(sgn, ibuf, nb); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while sgn_update\n"); goto cleanup; } } rv = sgn_end(sgn, res); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while sgn_end\n"); goto cleanup; } cleanup: if (infile) { pr_close(infile); } if (sgn) { sgn_destroycontext(sgn, pr_true); } return rv; } /* * verify the signature using public key */ secstatus verifydata(const char *infilename, seckeypublickey *pk, secitem *sigitem, secupwdata *pwdata) { unsigned int nb; unsigned char ibuf[4096]; secstatus rv = secfailure; vfycontext *vfy = null; prfiledesc *infile = null; /* open the input file for reading */ infile = pr_open(...
...ecsuccess) { pr_fprintf(pr_stderr, "problem while vfy_begin\n"); goto cleanup; } while ((nb = pr_read(infile, ibuf, sizeof(ibuf))) > 0) { rv = vfy_update(vfy, ibuf, nb); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while vfy_update\n"); goto cleanup; } } rv = vfy_end(vfy); if (rv != secsuccess) { pr_fprintf(pr_stderr, "problem while vfy_end\n"); goto cleanup; } cleanup: if (infile) { pr_close(infile); } if (vfy) { vfy_destroycontext(vfy, pr_true); } return rv; } /* * write cryptographic parameters to header file */ secstatus writetoheaderfile(const char *buf, unsigned int len, headertype type, prfiledesc *outfile) { secstatus rv; const char *header; const char *trailer; switch (type) { case symkey: header = enckey_header; trailer = enckey_trailer; break; case mackey: header = mackey_h...
...ut no trailer\n"); port_free(filedata.data); rv = secfailure; goto cleanup; } } else { /* headers didn't exist */ char *trail = null; body = nonbody; if (body) { trail = strstr(++body, trailer); if (trail != null) { pr_fprintf(pr_stderr, "input has no header but has trailer\n"); port_free(filedata.data); rv = secfailure; goto cleanup; } } } hextobuf(body, item, ishexdata); cleanup: if (file) { pr_close(file); } return rv; } /* * generate the private key */ seckeyprivatekey * generateprivatekey(keytype keytype, pk11slotinfo *slot, int size, int publicexponent, const char *noise, seckeypublickey **pubkeyp, const char *pqgfile, secupwdata *pwdata) { ck_mechanism_type mechanism; secoidtag algtag; pk11rsagenparams rsaparams; void *params; seckeyprivatekey *privkey = null; secstatus rv; unsigned char...
...And 7 more matches
nsIContentViewer
sisupports last changed in gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7) implemented by: ?????????????????????????????????????. ...
...in nsiwidgetptr aparentwidget, [const] in nsintrectref abounds); native code only! void loadcomplete(in unsigned long astatus); void loadstart(in nsisupports adoc); void move(in long ax, in long ay); void open(in nsisupports astate, in nsishentry ashentry); void pagehide(in boolean isunload); boolean permitunload([optional] in boolean acallercloseswindow); boolean requestwindowclose(); void resetclosewindow(); void setbounds([const] in nsintrectref abounds); native code only! void setdocumentinternal(in nsidocumentptr adocument, in boolean aforcereuseinnerwindow); native code only! [noscript,notxpcom,nostdcall] void setnavigationtiming(in nsdomnavigationtimingptr atiming); void setpa...
...fox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer. presshell nsipresshellptr read only. native code only! note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer. ...
...And 7 more matches
Standard OS Libraries
unix unix based operating systems are linux, *bsd, solaris, etc. there is a star/asterik ("*") before "bsd" because this means the bsd family such as freebsd, openbsd (who by the way made ssh), netbsd, etc. gtk+ ...
... // gdk2 var x = gint(); var y = gint(); var mask = gdkmodifiertype(); var win_undermouse = gdk_window_get_pointer( winroot_gdkwindowptr, x.address(), y.address(), mask.address() ); console.info('win_undermouse:', win_undermouse, win_undermouse.tostring()); console.info('x:', x, x.tostring()); console.info('y:', y, y.tostring()); console.info('mask:', mask, mask.tostring()); gdk.close(); example: gdk_window_get_device_position this example works only for gdk3, as the function gdk_window_get_device_position was not available in gdk2, for gdk2 equivalent see above warning this example does not work yet it needs some bug fixing components.utils.import('resource://gre/modules/ctypes.jsm'); var gdk = ctypes.open('libgdk-x11-2.0.so.0'); var gdk3 = ctypes.open('libgdk-3.so.0');...
...the list of the exposed symbols/functions can be found here: gnome developer :: gtk+ reference manual. example: ... // placeholder - example soon to come x11 x11 runs primarily on unix® and unix-like operating systems like linux, all of the bsd variants, sun solaris both native 32 and 64 bit support, solaris x86, mac os x (via darwin...
...And 7 more matches
RTCPeerConnection - Web APIs
the rtcpeerconnection interface represents a webrtc connection between the local computer and a remote peer. it provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e...
...candidate().addstream() the obsolete rtcpeerconnection method addstream() adds a mediastream as a local source of audio or video. instead of using this obsolete method, you should instead use addtrack() once for each track you wish to send to the remote peer.addtrack()the rtcpeerconnection method addtrack() adds a new media track to the set of tracks which will be transmitted to the other peer.close() the rtcpeerconnection.close() method closes the current peer connection.createanswer() the createanswer() method on the rtcpeerconnection interface creates an sdp answer to an offer received from a remote peer during the offer/answer negotiation of a webrtc connection. the answer contains information about any media already attached to the session, codecs and options supported by the browser,...
...viding access to it.getconfiguration() the rtcpeerconnection.getconfiguration() method returns an rtcconfiguration object which indicates the current configuration of the rtcpeerconnection on which the method is called.getidentityassertion() the rtcpeerconnection.getidentityassertion() method initiates the gathering of an identity assertion. this has an effect only if the signalingstate is not "closed".getreceivers() the rtcpeerconnection.getreceivers() method returns an array of rtcrtpreceiver objects, each of which represents one rtp receiver. each rtp receiver manages the reception and decoding of data for a mediastreamtrack on an rtcpeerconnectiongetsenders()the rtcpeerconnection method getsenders() returns an array of rtcrtpsender objects, each of which represents the rtp sender respons...
...And 7 more matches
prefwindow - Archive of obsolete content
the preference dialog, one for each prefpane. each pane will usually group together a set of related preferences. if there is only one prefpane, the navigation area will be hidden. on platforms where the convention is to apply changes immediately, the preferences are adjusted as soon as the user interface element is changed. on other platforms, the preferences are not applied until the dialog is closed. you can open a preference window using a window's opendialog method as with other dialogs. you can pass the id of a particular pane as the fourth argument to opendialog to open a specific pane by default. you can also set the lastselected attribute on the prefwindow tag to the id of the pane to start with. normally, you would not set this attribute as it will be set automatically such that the...
...her dialogs. you can pass the id of a particular pane as the fourth argument to opendialog to open a specific pane by default. you can also set the lastselected attribute on the prefwindow tag to the id of the pane to start with. normally, you would not set this attribute as it will be set automatically such that the default pane is the same as the one showing when the preferences dialog was last closed. more information is available in the preferences system article. important note for xulrunner-based applications: the preferences system - part of the toolkit - still relies on two browser.* preferences. the first one is browser.preferences.instantapply, a boolean preference. the preference window will not run correctly if you do not set this preference in your application's defaults (see ...
... still relies on two browser.* preferences. the first one is browser.preferences.instantapply, a boolean preference. the preference window will not run correctly if you do not set this preference in your application's defaults (see bug 485150 for more information). a true value for this preference makes the preference window apply immediately the user choices, without waiting for the dialog to close with ok. the second preference is browser.preferences.animatefadein, again a boolean preference. this one can be safely omitted in xulrunner-based applications but you can override the default behavior (true for mac os x and false for other platforms) setting it. for animatefadein to work properly, contents of prefpanes should be put into overlays. note for mac os x: a common way of opening mo...
...And 6 more matches
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
« xul reference home [ examples | attributes | properties | methods | related ] a row of tabs. a tabs element should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...ome [ examples | attributes | properties | methods | related ] a row of tabs. a tabs element should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...| attributes | properties | methods | related ] a row of tabs. a tabs element should be placed inside a tabbox and should contain tab elements. nb: you can add some other elements to tabs such as button, but they will receive an index. activating them will not change the selectedindex. more information is available in the xul tutorial. ...
...And 6 more matches
nsIMsgDatabase
the nsimsgdatabase interface is an abstract interface used to access the mail database backend. mailnews/db/msgdb/public/nsimsgdatabase.idlscriptable please add a summary to this article. ...
...tract interface used to access the mail database backend. mailnews/db/msgdb/public/nsimsgdatabase.idlscriptable please add a summary to this article. ...
...sgdatabase.idlscriptable please add a summary to this article. ...
...And 6 more matches
tabs - Archive of obsolete content
open, manipulate, and access tabs, and receive tab events. usage open a tab you can open a new tab, specifying various properties including location: var tabs = require("sdk/tabs"); tabs.open("http://www.example.com"); track tabs you can register event listeners to be notified when tabs open, close, finish loading dom content, or are made active or inactive: var tabs = require("sdk/tabs"); // listen for tab openings. tabs.on('open', function onopen(tab) { myopentabs.push(tab); }); // listen for tab content loads. tabs.on('ready', function(tab) { console.log('tab is loaded', tab.title, tab.url); }); access tabs the module itself can be used as a list of all opened tabs across all windows. in particular, you can enumerate it: var tabs = require('sdk/tabs'); for (let tab of tabs...
.../tabs'); tabs.on('ready', function () { console.log('first: ' + tabs[0].title); console.log('last: ' + tabs[tabs.length-1].title); }); you can access the currently active tab: var tabs = require('sdk/tabs'); tabs.on('activate', function () { console.log('active: ' + tabs.activetab.url); }); track a single tab given a tab, you can register event listeners to be notified when the tab is closed, activated or deactivated, or when the page hosted by the tab is loaded or retrieved from the "back-forward cache": var tabs = require("sdk/tabs"); function onopen(tab) { console.log(tab.url + " is open"); tab.on("pageshow", logshow); tab.on("activate", logactivate); tab.on("deactivate", logdeactivate); tab.on("close", logclose); } function logshow(tab) { console.log(tab.url + " i...
...by setting the url property you can load a new page in the tab: var tabs = require("sdk/tabs"); tabs.on('activat...
...And 5 more matches
JavaScript Daemons Management - Archive of obsolete content
= this.makesteps(this.index - nidx, true, bforce); if (this.index !== 0 && this.index !== this.length) { this.backw = bdirection; } return bsuccess; }; daemon.prototype.skipfor = function (ndelta, bforce) { /* warning: this method requires the daemon.prototype.makesteps() method */ return this.makesteps(ndelta, this.isatend() !== this.backw, bforce); }; daemon.prototype.close = function (breverse, bforce) { /* warning: this method requires the daemon.prototype.makesteps() method */ if (!isfinite(this.length)) { return false; } this.pause(); this.reversals = 0; return this.makesteps(breverse ? this.index : this.length - this.index, breverse, bforce); }; daemon.prototype.reclose = function (bforce) { /* warning: this method requires the daem...
...g: this method requires the daemon.prototype.makesteps() method */ if (!isfinite(this.length)) { return false; } this.pause(); this.reversals = 0; return this.makesteps(breverse ? this.index : this.length - this.index, breverse, bforce); }; daemon.prototype.reclose = function (bforce) { /* warning: this method requires the daemon.prototype.makesteps() and daemon.prototype.close() methods */ return this.close(this.isatend() !== this.backw, bforce || false); }; /* others */ daemon.prototype.restart = function () { this.stop(); this.start(); }; daemon.prototype.loopuntil = function (vdate) { if (!isfinite(this.length)) { return; } var ntime = vdate.constructor === date ? vdate.gettime() : isnan(vdate) ? date.parse(vdate) : vdate; if (is...
...es needed to reach the index position. if the force argument is set to true, the possible return false of the callback function will be ignored. mydaemon.skipfor(delta[, force]) calls synchronously the callback function howmany times in the same direction in which it was oriented. if the force argument is set to true, the possible return false of the callback function will be ignored. ...
...And 5 more matches
Tree View Details - Archive of obsolete content
cal custom view in the last section, we created a simple tree view that implemented only a minimum amount of functionality. next, let's look at some additional functions that views may implement. here, we will examine how to create a hierarchical set of items using the view. this is a fairly tricky process as it involves keeping track of which items have children and also which rows are open and closed. nesting level every row in the tree has a nesting level. the topmost rows are at level 0, the children of those rows are at level 1, their children at level 2 and so on. the tree will query the view for each row by calling its getlevel method to find out the level of that row. the view will need to return 0 for the outermost rows and higher values for inner rows. the tree will use this inform...
...scontainer, iscontainerempty and iscontaineropen that are used to handle a parent item in the tree. the iscontainer method should return true if a row is a container and might contain children. the iscontainerempty method should return true if a row is an empty container, for instance, a directory with no files in it. the iscontaineropen method is used to determine which items are opened and closed. the view is required to keep track of this. the tree will call this method to determine which containers are open and which are closed. note that the tree will call neither iscontainerempty nor iscontaineropen for rows that are not containers as indicated by the return value of the iscontainer method. a container may be rendered differently than a non-container. for instance, a container may...
...the return value of the iscontainer method. a container may be rendered differently than a non-container. for instance, a container may have a folder icon beside it. a style sheet may be used to style items based on various properties such as whether a row is open. this is described in a later section. a non-empty container will be displayed with a twisty next to it so that the user may open and close the row to see child items. empty containers will not have a twisty, but will still be treated like a container. when the user clicks the twisty to open a row, the tree will call the view's toggleopenstate method. the view should then perform any necessary operations to retrieve the child rows and then update the tree with the new rows. note: as of this writing (gecko 2.0), custom nsitreeview ...
...And 5 more matches
Enc Dec MAC Output Public Key as CSR
railer; break; case iv: header = iv_header; trailer = iv_trailer; break; case mac: header = mac_header; trailer = mac_trailer; break; case pad: header = pad_header; trailer = pad_trailer; break; case lab: header = lab_header; trailer = lab_trailer; break; default: pr_close(file); return secfailure; } rv = filetoitem(&filedata, file); nonbody = (char *)filedata.data; if (!nonbody) { pr_fprintf(pr_stderr, "unable to read data from input file\n"); rv = secfailure; goto cleanup; } /* check for headers and trailers and remove them */ char *trail = null; if ((body = strstr(nonbody, header)) != null) { ...
... } } else { /* headers didn't exist */ body = nonbody; if (body) { trail = strstr(++body, trailer); if (trail != null) { pr_fprintf(pr_stderr, "input has no header but has trailer\n"); port_free(filedata.data); return secfailure; } } } cleanup: pr_close(file); atob_convertasciitoitem(item, body); return secsuccess; } /* * generate the private key */ seckeyprivatekey * generateprivatekey(keytype keytype, pk11slotinfo *slot, int size, int publicexponent, const char *noisefilename, seckeypublickey **pubkeyp, const char *pqgfile, secupwdata *pwdata) { ck_mechanism_type mechanis...
....len); if (numbytes != (int)result.len) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; goto cleanup; } } cleanup: if (spki) { seckey_destroysubjectpublickeyinfo(spki); } if (cr) { cert_destroycertificaterequest (cr); } if (arena) { port_freearena(arena, pr_false); } if (outfile) { pr_close(outfile); } return rv; } /* * mac and encrypt the input file content */ secstatus encryptandmac(prfiledesc *infile, prfiledesc *headerfile, prfiledesc *encfile, pk11symkey *ek, pk11symkey *mk, unsigned char *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char ptext[blocksiz...
...And 5 more matches
Encrypt Decrypt_MAC_Using Token
chr(nonbody, '\r'); /* maybe this is a mac file. ...
... */ secstatus getivandckaidsfromheader(const char *cipherfilename, secitem *ivitem, secitem *enckeyitem, secitem *mackeyitem) { secstatus rv; /* open intermediate file, read in header, get iv and cka_ids of two keys * from it. */ rv = readfromheaderfile(cipherfilename, iv, ivitem,...
...e db token. * open output file. * loop until eof(input): * read a buffer of ciphertext from input file. * save last block of ciphertext. * decrypt ciphertext buffer using cbc and iv. * compute and check mac, then remove mac from plaintext. * replace iv with saved last block of ciphertext. * write the plain text to output file. * close files. * report success. */ secstatus rv; secitem ivitem; secitem enckeyitem; secitem mackeyitem; secitem cipheritem; secitem macitem; secitem paditem; pk11symkey *enckey = null; pk11symkey *mackey = null; /* open intermed...
...And 5 more matches
NSS Sample Code Sample_3_Basic Encryption and MACing
rchr(nonbody, '\r'); /* maybe this is a mac file */ if (body) trail = strstr(++body, trailer); if (trail != null) { *trail = '\0'; } else { pr_fprintf(pr_stderr, "input has header but no trailer\n"); port_free(filedata.data); return secfailure; } } else { body = nonbody; } cleanup: pr_close(file); hextobuf(body, item, ishexdata); return secsuccess; } /* * encryptandmac */ secstatus encryptandmac(prfiledesc *infile, prfiledesc *headerfile, prfiledesc *encfile, pk11symkey *ek, pk11symkey *mk, unsigned char *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char pte...
...intf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { pk11_destroycontext(ctxmac, pr_true); } if (ctxenc) { pk11_destroycontext(ctxenc, pr_true); } if (outfile) { pr_close(outfile); } return rv; } /* * gets iv and ckaids from header file */ secstatus getivandckaidsfromheader(const char *cipherfilename, secitem *ivitem, secitem *enckeyitem, secitem *mackeyitem) { secstatus rv; /* open intermediate file, read in header, get iv and cka_ids of two keys * from it */ rv = readfromheaderfile(cipherfilename, iv, ivitem, p...
...ys in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file * save last block of ciphertext * decrypt ciphertext buffer using cbc and iv * compute and check mac, then remove mac from plaintext * replace iv with saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; secitem mackeyitem; secitem cipheritem; secitem macitem; secitem paditem; pk11symkey *enckey = null; pk11symkey *mackey = null; /* open intermedia...
...And 5 more matches
EncDecMAC using token object - sample 3
header)) != null) { char *trail = null; nonbody = body; body = port_strchr(body, '\n'); if (!body) body = port_strchr(nonbody, '\r'); /* maybe this is a mac file */ if (body) trail = strstr(++body, trailer); if (trail != null) { *trail = '\0'; } else { pr_fprintf(pr_stderr, "input has header but no trailer\n"); port_free(filedata.data); return secfailure; } } else { body = nonbody; } cleanup: pr_close(file); hextobuf(body, item, ishexdata); return secsuccess; } /* * encryptandmac */ secstatus encryptandmac(prfiledesc *infile, prfiledesc *headerfile, prfiledesc *encfile, pk11symkey *ek, pk11symkey *mk, unsigned char *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char ptext[blocksize]; unsigned int ptextlen; unsigned char mac[digestsize]; unsigned int maclen; unsigned int nwritt...
... rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { pk11_destroycontext(ctxmac, pr_true); } if (ctxenc) { pk11_destroycontext(ctxenc, pr_true); } if (outfile) { pr_close(outfile); } return rv; } /* * gets iv and ckaids from header file */ secstatus getivandckaidsfromheader(const char *cipherfilename, secitem *ivitem, secitem *enckeyitem, secitem *mackeyitem) { secstatus rv; /* open intermediate file, read in header, get iv and cka_ids of two keys * from it */ rv = readfromheaderfile(cipherfilename, iv, ivitem, pr_true); if (rv != secsuccess) { pr_fprintf(pr_stder...
...d in header, get iv and cka_ids of two keys from it * find those keys in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file, * save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; secitem mackeyitem; secitem cipheritem; secitem macitem; secitem paditem; pk11symkey *enckey = null; pk11symkey *mackey = null; /* open intermediate file, read in header, get iv and cka_ids of two keys * from it */ rv = getivandckaidsfromheader(headerfilename, &ivitem, &enckeyitem, &mackeyitem); if (rv != secsuccess) { go...
...And 5 more matches
Observer Notifications
te interesting things that happen that the browser alerts you to. topic description browser:purge-session-history sent when the sanitizer runs to purge all history and other information. browser:purge-domain-data sent after domain-specific history and other information have been purged. the data value is a string form of the domain. ...
...alerts you to. topic description browser:purge-session-history sent when the sanitizer runs to purge all history and other information. browser:purge-domain-data sent after domain-specific history and other information have been purged. the data value is a string form of the domain. browser-lastwindow-close-requested sent when the browser wishes to close the last open browser window. ...
...other information have been purged. the data value is a string form of the domain. browser-lastwindow-close-requested sent when the browser wishes to close the last open browser window. when this is sent, it is possible that other windows may still be open, such as the download manager or preferences. the data value is an nsisupportsprbool. recipients may set this to true to abort the close. browser-lastwindow-close-granted sent when all interested parties have responded to the browser-lastwindow-close-requested notification and none of them requested that the close be aborted. after this is sent and handled, the browser window will close. browser-delayed-startup-finished sent when the browser window and all its components have been loaded and initialized. ...
...And 5 more matches
nsIAppShellService
rovides the appshellservice. ...
...created and maintained by this appshellservice. read only. nativeappsupport nsinativeappsupport getter for "native application support." read only. obsolete since gecko 1.8 constants constant value description size_to_content -1 create a window, which will be initially invisible. ...
...tiveappsupport nsinativeappsupport getter for "native application support." read only. obsolete since gecko 1.8 constants constant value description size_to_content -1 create a window, which will be initially invisible. econsiderquit 1 attempt to quit if all windows are closed. obsolete since gecko 1.8 eattemptquit 2 try to close all windows, then quit if successful. ...
...And 5 more matches
nsIWebSocketChannel
ented by: ?????????????????????????????????????. to create an instance, use: var websocketchannel = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsiwebsocketchannel); method overview void asyncopen(in nsiuri auri, in acstring aorigin, in nsiwebsocketlistener alistener, in nsisupports acontext); void close(in unsigned short acode, in autf8string areason); void sendbinarymsg(in acstring amsg); void sendmsg(in autf8string amsg); attributes attribute type description extensions acstring sec-websocket-extensions response header value. read only. loadgroup nsiloadgroup the load group of the websockets code. notificationcallbac...
...e. securityinfo nsisupports transport-level security information (if any). read only. uri nsiuri the uri corresponding to the protocol connection after any redirections are completed. read only. status codes the following values are permitted status codes. status code name description 0-999 reserved and not used. ...
... uri corresponding to the protocol connection after any redirections are completed. read only. status codes the following values are permitted status codes. status code name description 0-999 reserved and not used. 1000 close_normal normal closure; the connection successfully completed whatever purpose for which it was created. ...
...And 5 more matches
Using js-ctypes
dows, the following locations are searched for the library, in this order: the application's directory. the system directory. the 16-bit system directory. the windows directory. the current working directory the directories listed in the path environment variable. note: this information comes from this article on msdn. after you're done when you're finished using a library, you should close it by calling the library object's close() method: lib.close(); if you fail to close the library, it will be automatically closed when it is garbage collected. using the library you may need to declare new types. these can be simple types or more complex types such as structures. see declaring types for details. you will almost certainly need to declare one or more functions, so that you can ...
... instead of defining the whole path, you may also just give the file name. about declaring the function h...
... instead of defining the whole path, you may also just give the file name. ...
...And 5 more matches
RTCDataChannel - Web APIs
rgetonbufferedamountlow the rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rtcdatachannel. ...
... rtcdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rtcdatachannel. this event, which is represented by a simple event object, is sent when the amount of data buffered to be sent falls to or below the threshold specified by the channel's bufferedamountlowthreshold.onclose the rtcdatachannel.onclose property is an eventhandler which specifies a function to be called by the browser when the close event is received by the rtcdatachannel. this is a simple event which indicates that the data channel has closed down.onclosing the rtcdatachannel.onclosing property is an eventhandler which specifies a function to be called by the browser when the closing event is received by the rtcdatachannel. th...
... by the browser when the close event is received by the rtcdatachannel. this is a simple event which indicates that the data channel has closed down.onclosing the rtcdatachannel.onclosing property is an eventhandler which specifies a function to be called by the browser when the closing event is received by the rtcdatachannel. this is a simple event which indicates that the data channel is being closed, that is, rtcdatachannel transitions to "closing" state. for example, after rtcdatachannel.close() was called but the underlying data transport might not have been closed yet.onerror the rtcdatachannel.onerror property is an eventhandler which specifies a function to be called when the error event is received. when an error occurs on the data channel, the function receives as input an erroreven...
...And 5 more matches
windows - Archive of obsolete content
enumerate and examine open browser windows, open new windows, and listen for window events. usage the windows module provides basic functions for working with browser windows. with this module, you can: enumerate the currently opened browser windows open new browser windows listen for common window events such as open and close private windows if your add-on has not opted into private browsing, then you won't see any private browser windows. private browser windows won't appear in the browserwindows property, you won't receive any window events, and you won't be able to open private windows. to learn more about private windows, how to opt into private browsing, and how to support private browsing, refer to the documentation for the private-browsing module. converting to chrome wi...
...http://www.example.com", onopen: function(window) { // do stuff like listen for content // loading. } }); returns the window that was opened: var windows = require("sdk/windows").browserwindows; var example = windows.open("http://www.example.com"); require("sdk/ui/button/action").actionbutton({ id: "read", label: "read", icon: "./read.png", onclick: function() { example.close(); } }); this example uses the action button api, which is only available from firefox 29 onwards. parameters options : object required options: name type url string string url to be opened in the new window. this is a required property. isprivate boolean boolean which will determine whether the new window should be privat...
...e the private-browsing documentation for more information. optional options: name type onopen function a callback function that is called when the window has opened. this does not mean that the url content has loaded, only that the window itself is fully functional and its properties can be accessed. this is an optional property. onclose function a callback function that is called when the window will be called. this is an optional property. onactivate function a callback function that is called when the window is made active. this is an optional property. ondeactivate function a callback function that is called when the window is made inactive. this is an optional proper...
...And 4 more matches
io/text-streams - Archive of obsolete content
experimental provides streams for reading and writing text. function readtextfromfile(filename) { var fileio = require("sdk/io/file"); var text = null; if (fileio.exists(filename)) { var textreader = fileio.open(filename, "r"); if (!textreader.closed) { text = textreader.read(); textreader.close(); } } return text; } function writetexttofile(text, filename) { var fileio = require("sdk/io/file"); var textwriter = fileio.open(filename, "w"); if (!textwriter.closed) { textwriter.write(text); textwriter.close(); } } globals constructors textreader(inputstream, charset) creates a buffered input stream that reads text from a backing stream using a given text encoding. you can also create textreader objects using io/file's open() function. ...
...g io/file's open() function. parameters outputstream : stream the backing stream, an nsioutputstream. it must already be opened. charset : string text will be written to outputstream using the character encoding named by this value. if not specified, "utf-8" is assumed. see nsicharsetconvertermanager.idl for documentation on how to determine other valid values for this. ...
...'s open() function. parameters outputstream : stream the backing stream, an nsioutputstream. it must already be opened. charset : string text will be written to outputstream using the character encoding named by this value. if not specified, "utf-8" is assumed. see nsicharsetconvertermanager.idl for documentation on how to determine other valid values for this. ...
...And 4 more matches
Panels - Archive of obsolete content
="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <button label="details" type="panel"> <panel id="search-panel"> <label control="name" value="name:"/> <textbox id="name"/> </panel> </button> </window> many panels will be associated with a button, as in this example. when the button is pressed, the panel is opened. clicking outside the panel or pressing escape will close the panel. you can also place a close button in the panel which will close the panel with a script if desired. when you want to associate a panel with a button, place the <panel> element directly inside the button element. you also need to set the type attribute on the button to the value panel, or the button will look and behave like a regular button. the popup panel will, by default, appear wi...
...popups, has an openpopup method which may be used to open the popup using a script. for example, the following would open a panel underneath a button: panel.openpopup(button, "after_start", 0, 0, false, false); likewise, the openpopupatscreen method will open a panel at a specific screen position. for more details about both methods, see opening and closing popups. ...
...n: panel.openpopup(button, "after_start", 0, 0, false, false); likewise, the openpopupatscreen method will open a panel at a specific screen position. for more details about both methods, see opening and closing popups. closing a panel a panel is closed automatically when the user clicks outside of the panel. it is quite common however, to have an element such as a button within the panel to close it as well. ...
...And 4 more matches
panel - Archive of obsolete content
Archive › Mozilla › XUL › panel
ndow that may contain any type of content. it does not have any window decorations. when open, it floats above the window and may extend outside the border of the main window. typically, it will be attached to a button using the button's type attribute so that when the button is pressed, the panel will be displayed. a panel may also be opened via a script using the openpopup method. the panel is closed when the user clicks outside the panel, presses escape or when the panel's hidepopup method is called. warning: for firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. some features may work, but only on some platforms. for those versions of firefox, it is best to avoid child frames in a panel, if possible. this limitation was resolved as ...
... presses escape or when the panel's hidepopup method is called. warning: for firefox versions between 3.6 and 4.0, placing an iframe, browser or editor inside a panel is not supported. some features may work, but only on some platforms. for those versions of firefox, it is best to avoid child frames in a panel, if possible. this limitation was resolved as of firefox 4.0. ...
...u have 6 new messages."/> <hbox> <button label="read mail"/> <button label="new message"/> </hbox> </vbox> </hbox> </panel> <description value="6 new messages" popup="thepanel"/> attributes backdrag type: boolean setting the backdrag attribute on a xul panel lets the user move the panel by clicking and dragging anywhere on its background area. close type: boolean if the panel has a titlebar, set the panel's close attribute to true to have a close button appear on the titlebar. pressing the close button will close the panel. consumeoutsideclicks type: boolean controls whether or not the event that caused the popup to be automatically dismissed (or "rolled up") should be consumed or be dispatched as a n...
...And 4 more matches
Theme changes in Firefox 2 - Archive of obsolete content
o icon to use if it's positioned at the left end of the url field. browser/preferences/preferences.css file that skins the preferences window. browser/safebrowsing/browser-protection.css new file; css for the window that appears to warn the user that a site may be fraudulent, as well as the url bar icon that indicates a site may be fraudulent. browser/safebrowsing/close16x16.png new file; this is the icon displayed in the safe browsing warning window as a close box for the window. browser/safebrowsing/dim.png new file; this is a graphic overlaid on top of the contents of the window to "dim" it when the safe browsing warning window is displayed. it should use translucency to allow the window contents to be visible through it. browser/safeb...
...down menu at the right side of the tab bar. global/alltabs-box-overflow-bkgnd.png new file; the background for the "all tabs" drop-down menu when there are enough tabs to activate tab bar scrolling. global/browser.css revised to support new styles for the main browser window. global/globalbindings.xml updated to support changes to the tab bar, including per-tab close buttons. global/icons/alltabs.png not actually used; left over from earlier drafts of the theme. global/inactivetab-left.png removed file. global/inactivetab-right.png removed file. global/menu.css updated to include new styles. global/notification.css new file; defines styles used by the notification strip that appears at the top of bro...
...rderless the default theme also includes styles for a[href] img, body, h1, h2, and html. safebrowser/browser-protection.css this file, new to firefox 2, skins browser protection features. ...
...And 4 more matches
CustomizableUI.jsm
for each dom node. aarea is the area that was reset, acontainer the dom node that was reset. onareanodeunregistered(aarea, anode, areason) fired when an area's dom node is unregistered. aarea is the area for which a node was unregistered, anode the dom node which was unregistered, and areason indicates whether the area as a whole was unregistered (reason_area_unregistered), or whether a window closed (reason_window_closed). onareanoderegistered(aarea, anode) fired after an area node is first built when it is registered. this is often when the window has opened, but in the case of add-ons, could fire when the node has just been registered with customizableui after an add-on update or disable/enable sequence. onwidgetcreated(awidgetid) fired when a widget with id awidgetid has been created...
...stomize mode in awindow. onwidgetoverflow(anode, acontainer) fired when a widget's dom node is overflowing its container, a toolbar, and will be displayed in the overflow panel. onwidgetunderflow(anode, acontainer) fired when a widget's dom node is not overflowing its container, a toolbar, anymore. onwindowopened(awindow) fired when a new customizable (ie browser) window is opened. onwindowclosed(awindow) fired when a customizable (ie browser) window is closed. method overview void addlistener(alistener); void removelistener(alistener); void registerarea(aareaid, aproperties); void registertoolbarnode(atoolbar, aexistingchildren); void registermenupanel(apanel); void unregisterarea(aareaid, adestroyplacements); void addwi...
...id reset(); void undoreset(); void removeextratoolbar(); object getplacementofwidget(awidgetid); bool iswidgetremovable(awidgetnodeorwidgetid); bool canwidgetmovetoarea(awidgetid); void getlocalizedproperty(awidget, aprop, aformatargs, adef); void hidepanelfornode(anode); bool isspecialwidget(awidgetid); void addpanelcloselisteners(apanel); void removepanelcloselisteners(apanel); void onwidgetdrag(awidgetid, aarea); void notifystartcustomizing(awindow); void notifyendcustomizing(awindow); void dispatchtoolboxevent(aevent, adetails, awindow); bool isareaoverflowable(aareaid); void settoolbarvisibility(atoolbarid, aisvisible); string getplacefori...
...And 4 more matches
mozIStorageConnection
he primary interface for interacting with a database, including creating prepared statements, executing sql, and examining database errors. 1.0 68 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) for a general overview on how to use this interface, see storage. ...
... 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) for a general overview on how to use this interface, see storage. ...
... mozistorageprogresshandler setprogresshandler(in print32 agranularity, in mozistorageprogresshandler ahandler); boolean tableexists(in autf8string atablename); attributes attribute type description connectionready boolean indicates if the connection is open and ready to use. this will be false if the connection failed to open, or it has been closed. read only. databasefile nsifile the current database nsifile. null if the database connection refers to an in-memory database. read only. lasterror long the last sqlite error code that occurred. read only. note: this is not reliable if you are using asynchronous statements or if you are using the connection on multiple threads. lasterrorstring au...
...And 4 more matches
nsIAsyncInputStream
mary to this article. inherits from: nsiinputstream last changed in gecko 1.7 if an input stream is non-blocking, it may return ns_base_stream_would_block when read. the caller must then wait for the stream to have some data to read. if the stream implements nsiasyncinputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes readable or closed (via the asyncwait() method). while this interface is almost exclusively used with non-blocking streams, it is not necessary that nsiinputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsiinputstream implementation also implement nsiasyncinputstream. method overview void asyncwait(in nsiinputstreamcallback acallback, in unsigned long aflags, in unsigned long arequ...
... is almost exclusively used with non-blocking streams, it is not necessary that nsiinputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsiinputstream implementation also implement nsiasyncinputstream. method overview void asyncwait(in nsiinputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget); void closewithstatus(in nsresult astatus); constants constant value description wait_closure_only (1<<0) if passed to asyncwait(), this flag overrides the default behavior, causing the oninputstreamready notification to be suppressed until the stream becomes closed (either as a result of closewithstatus()/close being called on the stream or possibly due to some error in the underlying stream). me...
...the notification is one-shot, meaning that each asyncwait call will result in exactly one notification callback. ...
...And 4 more matches
nsIAsyncOutputStream
ry to this article. inherits from: nsioutputstream last changed in gecko 1.7 if an output stream is non-blocking, it may return ns_base_stream_would_block when written to. the caller must then wait for the stream to become writable. if the stream implements nsiasyncoutputstream, then the caller can use this interface to request an asynchronous notification when the stream becomes writable or closed (via the asyncwait() method). while this interface is almost exclusively used with non-blocking streams, it is not necessary that nsioutputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsioutputstream implementation also implement nsiasyncoutputstream. method overview void asyncwait(in nsioutputstreamcallback acallback, in unsigned long aflags, in unsigned long a...
...almost exclusively used with non-blocking streams, it is not necessary that nsioutputstream.isnonblocking() return true. nor is it necessary that a non-blocking nsioutputstream implementation also implement nsiasyncoutputstream. method overview void asyncwait(in nsioutputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget); void closewithstatus(in nsresult reason); constants constant value description wait_closure_only (1<<0) if passed to asyncwait(), this flag overrides the default behavior, causing the onoutputstreamready notification to be suppressed until the stream becomes closed (either as a result of closewithstatus()/close being called on the stream or possibly due to some error in the underlying stream). me...
...the notification is one-shot, meaning that each asyncwait call will result in exactly one notification callback. ...
...And 4 more matches
nsIScriptableInputStream
xpcom/io/nsiscriptableinputstream.idlscriptable this interface provides scriptable access to a nsiinputstream instance. inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview unsigned long available(); void close(); void init(in nsiinputstream ainputstream); string read(in unsigned long acount); acstring readbytes(in unsigned long acount); methods available() return the number of bytes currently available in the stream. note: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size of...
...e: this method should not be used to determine the total size of a stream, even if the stream corresponds to a local file. moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size of the underlying data source. unsigned long available(); parameters none. return value the number of bytes. exceptions thrown ns_base_stream_closed if called after the stream has been closed. close() closes the stream. note: the close method may be called more than once, but subsequent calls are ignored. void close(); parameters none. init() wrap the given nsiinputstream with this nsiscriptableinputstream. note: the init method may be called more than once, allowing a nsiscriptableinputstream instance to be reused. void init( in nsi...
...te values are encoded as iso-latin-1. this is the case for the javascript bindings. string read( in unsigned long acount ); parameters acount the maximum number of bytes to read from the stream. return value the data read as a string, which will be an empty string if the stream is at eof. exceptions thrown ns_error_not_initialized if init() was not called. ns_base_stream_closed if called after the stream has been closed. ns_base_stream_would_block indicates that reading from the input stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if nsiinputstream.isnonblocking() returns true. readbytes() read data from the stream, including null bytes. acstring readbytes( in unsigned long acount ); paramete...
...And 4 more matches
DevTools API - Firefox Developer Tools
nt information about the tool (like its name and its icon), and a build method that will be used later-on to start an instance of this tool. the gdevtools global object provides methods to register a tool definition and to access tool instances. an instance of a tool is called a toolpanel. the toolpanel is built only when the tool is selected (not when the toolbox is opened). there is no way to "close/destroy" a toolpanel. the only way to close a toolpanel is to close its containing toolbox. all these objects implement the eventemitter interface. api gdevtools the gdevtools api can be used to register new tools, themes and handle toolboxes for different tabs and windows. to use the gdevtools api from an add-on, it can be imported with following snippet const { gdevtools } = require("resour...
...ost. see hosttype for details. return value: a promise that is fulfilled with the toolbox instance once it has been initialized and the selected tool is loaded. gettoolbox(target) fetch the toolbox object for the given target. parameters: target {target} - the target the toolbox is debugging. return value: toolbox object or undefined if there's no toolbox for the given target.. closetoolbox(target) closes the toolbox for given target. parameters: target {target} - the target of the toolbox that should be closed. return value: a promise that is fulfilled once the toolbox has been destroyed. getdefaulttools() returns an array of tooldefinition objects for the built-in tools. getadditionaltools() returns an array of tooldefinition objects for tools added by ...
...ttool(toolid) highlights the tab for the given tool. parameters: toolid {string} - the tool to highlight. unhighlighttool(toolid) unhighlights the tab for the given tool. parameters: toolid {string} - the tool to unhighlight. opensplitconsole() opens the split console to the bottom of the toolbox. return value: a promise that is fulfilled once the console has loaded. closesplitconsole() closes the split console. togglesplitconsole() toggles the state of the split console. return value: a promise that is fulfilled once the operation has finished. switchhost(hosttype) switches the location of the toolbox parameters: hosttype {toolbox.hosttype} - the type of the new host. return value: a promise that is fulfilled once the new host is ready. ...
...And 4 more matches
Advanced animations - Web APIs
drawing a ball we are going to use a ball for our animation studies, so let's first draw that ball onto the canvas. the following code will set us up. <canvas id="canvas" width="600" height="300"></canvas> as usual, we need a drawing context first. to draw the ball, we will create a ball object which contains properties and a draw() method to paint it on the canvas. ...
...g context first. to draw the ball, we will create a ball object which contains properties and a draw() method to paint it on the canvas. var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); var ball = { x: 100, y: 100, radius: 25, color: 'blue', draw: function() { ctx.beginpath(); ctx.arc(this.x, this.y, this.radius, 0, math.pi * 2, true); ctx.closepath(); ctx.fillstyle = this.color; ctx.fill(); } }; ball.draw(); nothing special here, the ball is actually a simple circle and gets drawn with the help of the arc() method. adding velocity now that we have a ball, we are ready to add a basic animation like we have learned in the last chapter of this tutorial. again, window.requestanimationframe() helps us to control the animation. ...
...ity vector to the position. for each frame, we also clear the canvas to remove old circles from prior frames. ...
...And 4 more matches
Event.composedPath() - Web APIs
the composedpath() method of the event interface returns the event’s path which is an array of the objects on which listeners will be invoked. this does not include nodes in shadow trees if the shadow root was created with its shadowroot.mode closed. syntax var composed = event.composedpath(); parameters none. return value an array of eventtarget objects representing the objects on which an event listener will be invoked. examples in our composed-composed-path example (see it live), we define two trivial custom elements, <open-shadow> and <closed-shadow>, both of which take the contents of their text attribute and insert them into the element's shadow dom as the text content of a <p> element. the only difference between the two is that their shadow roots are attached with their modes...
... be invoked. examples in our composed-composed-path example (see it live), we define two trivial custom elements, <open-shadow> and <closed-shadow>, both of which take the contents of their text attribute and insert them into the element's shadow dom as the text content of a <p> element. the only difference between the two is that their shadow roots are attached with their modes set to open and closed respectively. the first definition looks like this, for example: customelements.define('open-shadow', class extends htmlelement { constructor() { super(); let pelem = document.createelement('p'); pelem.textcontent = this.getattribute('text'); let shadowroot = this.attachshadow({mode: 'open'}) .appendchild(pelem); } }); we then insert one of each elem...
...first, the composed property return...
...And 4 more matches
HTMLDialogElement: cancel event - Web APIs
the cancel event fires on a <dialog> when the user instructs the browser that they wish to dismiss the current open dialog. for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui. ...
...t they wish to dismiss the current open dialog. for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui. ...
...ss the current open dialog. for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui. ...
...And 4 more matches
Using writable streams - Web APIs
table streams work let’s look at how the writable stream functionality in our demo works. constructing a writable stream to create a writable stream, we use the writablestream() constructor; the syntax looks complex at first, but actually isn’t too bad. the syntax skeleton looks like this: const stream = new writablestream({ start(controller) { }, write(chunk,controller) { }, close(controller) { }, abort(reason) { } }, { highwatermark, size() }); the constructor takes two objects as parameters. the first object is required, and creates a model in javascript of the underlying sink the data is being written to. the second object is optional, and allows you to specify a custom queueing strategy to use for your stream, which takes the form of an instance of bytelen...
...art(controller) — a method that is called once, immediately after the writablestream is constructed. inside this method, you should include code that sets up the stream functionality, e.g. getting access to the underlying sink. write(chunk,controller) — a method that is called repeatedly every time a new chunk is ready to be written to the underlying sink (specified in the chunk parameter). close(controller) — a method that is called if the app signals that it has finished writing chunks to the stream. it should do whatever is necessary to finalize writes to the underlying sink, and release access to it. abort(reason) — a method that will be called if the app signals that it wishes to abruptly close the stream and put it in an errored state. the constructor call in our example look...
...this is called when each chunk is actual...
...And 4 more matches
WebGL model view projection - Web APIs
so the first step in reducing the number of polygons we need to compute and render, we turn this pyramid into the viewing frustum. the two planes we'll use to chop away vertices in order to reduce the polygon count are the near cl...
... so the first step in reducing the number of polygons we need to compute and render, we turn this pyramid into the viewing frustum. the two planes we'll use to chop away vertices in order to reduce the polygon count are the near clipping plane and the far clippi...
...ts peripheral vision range, and its base at the farthest distance it can see, like this: if we simply used this to determine the polygons to be rendered each frame, our renderer would need to render every polygon within this pyramid, all the way off into infinity, including also polygons that are very close to the lens—likely too close to be useful (and certainly including things that are so close that a real human wouldn't be able to focus on them in the same setting). so the first step in reducing the number of polygons we need to compute and render, we turn this pyramid into the viewing frustum. the two planes we'll use to chop away vertices in order to reduce the polygon count are the near clipping plane and the far clipping plane. in webxr, the near and far clipping planes are defin...
...And 4 more matches
Window.open() - Web APIs
Web › API › Window › open
. in addition, setting this feature also automatically sets noopener. see rel="noreferrer" for additional details and compatibility information. firefox introduced support for noreferrer in firefox 68. best practices <script type="text/javascript"> var windowobjectreference = null; // global variable function openffpromotionpopup() { if(windowobjectreference == null || windowobjectreference.closed) /* if the pointer to the window object in memory does not exist or if such pointer exists but the window was closed */ { windowobjectreference = window.open("http://www.spreadfirefox.com/", "promotefirefoxwindowname", "resizable,scrollbars,status"); /* then create it. the new window will be created and will be brought on top of any other window. */ } else { ...
...there would be no need to re-create the window or to reload the referenced resource. ...
...ute specifications how do i create a link that opens a new window? ...
...And 4 more matches
content - CSS: Cascading Style Sheets
Web › CSS › content
normal computes to none for the ::before and ::after pseudo-elements. <string> specifies ...
... normal computes to none for the ::before and ::after pseudo-elements. <string> specifies the "alt text" for the element. this value can be...
...th the given name in scope at the given pseudo-element, from outermost to innermost, separated by the specified string. the counters are rendered in the indicated style (decimal by default). attr(x) the value of the element's attribute x as a string. if there is no attribute x, an empty string is returned. the case-sensitivity of attribute names depends on the document language. open-quote | close-quote these values are replaced by the appropriate string from the quotes property. no-open-quote | no-close-quote introduces no content, but increments (decrements) the level of nesting for quotes. accessibility concerns css-generated content is not included in the dom. because of this, it will not be represented in the accessibility tree and certain assistive technology/browser combinati...
...And 4 more matches
Grammar and types - JavaScript
avascript. these are fixed values—not variables—that you literally provide in your script. this section describes the following types of literals: array literals boolean literals floating-point literals numeric literals object literals regexp literals string literals array literals an array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets ([]). when you create an array using an array literal, it is initialized with the specified values as its elements, and its length is set to the number of arguments specified. the following example creates the coffees array with three elements and a length of three: let coffees = ['french roast', 'colombian', 'kona']; note : an array literal is a type of object initialize...
...ch can be signed (preceded by "+" or "-"). a floating-point literal must have at least one digit, and either a decimal point or "e" (or "e"). more succinctly, the syntax is: [(+|-)][digits].[digits][(e|e)[(+|-)]digits] for example: 3.1415926 -.123456789 -3.1e+12 .1e-23 object literals an object literal is a list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}). do not use an object literal at the beginning of a statement! this will lead to an error (or not behave as you expect), because the { will be interpreted as the beginning of a block. the following is an example of an object literal. the first element of the car object defines a property, mycar, and assigns to it a new string, "saturn"; the second element, the getcar pro...
... literal for the name of a property or nest an object inside another. the following example uses these options. var car = { manycars: {a: 'saab', b: 'jeep'}, 7: 'mazda' }; console.log(car.manycars.b); // jeep console.log(car[7]); // mazda object property names can be any string, including the empty string. if the property name would not be a valid javascript identifier or number, it must be enclosed in quotes. property names that are not valid identifiers cannot be accessed as a dot (.) property, but can be accessed and set with the array-like notation("[]"). var unusualpropertynames = { '': 'an empty string', '!': 'bang!' } console.log(unusualpropertynames.''); // syntaxerror: unexpected string console.log(unusualpropertynames['']); // an empty string console.log(unusualpropertyna...
...And 4 more matches
Finding window handles - Archive of obsolete content
__in_ hwnd hwnd * ); */ var setforegroundwindow = user32.declare('setforegroundwindow', ctypes.winapi_abi, ctypes.bool, // return bool ctypes.voidptr_t // hwnd ); var hwnd = ctypes.voidptr_t(ctypes.uint64(hwndstring)); var rez_setforegroundwindow = setforegroundwindow(hwnd); console.log('rez_setforegroundwindow:', rez_setforegroundwindow, rez_setforegroundwindow.tostring()); user32.close(); mac os x objective-c components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) ...
...the string is made into an actual gdkwindow* like this: var gdkwindow = ctypes.structtype('gdkwindow'); var gdkwindowptrstring = basewindow.nativehandle; var gdkwinptr = gdkwindow.ptr(ctypes.uint64(gdkwindowptrstring)); working with gdkwindow* gdkwindow* to xid var gdkwindow...
...types.uint64(gdkwindowptrstring)); var rez_gst = gdk_x11_get_server_time(browserwindow_madeintogdkwinptr); console.info('rez_gst:', rez_gst, uneval(rez_gst)); // return is a number of ms since the computer (xserver) was on var rez_gwf = gdk_window_focus(browserwindow_madeintogdkwinptr, rez_gst); console.info('rez_gwf:', rez_gwf, uneval(rez_gwf)); // return is void so this will be undefined gdk.close(); gtk+ components.utils.import('resource://gre/modules/services.jsm'); var browserwindow = services.wm.getmostrecentwindow('navigator:browser'); if (!browserwindow) { throw new error('no browser window found'); } var basewindow = browserwindow.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinte...
...And 3 more matches
Intercepting Page Loads - Archive of obsolete content
se framesets, but it is common for ads to appear inside iframe elements. in most cases you'll need to compare the page url with some string or regular expression: if (some_regular_expression.test(doc.defaultview.location.href)) you can access and modify the dom of the loaded page, just like you normally would for xul and html documents. you can't, however, easily cancel the page load. you can close the tab, redirect the tab to about:blank or another page, or tell the browser to stop loading this page, but in general you don't want to do this because it will be visible to the user and it will look like a bug. there are better ways to intercept page loads before any content is downloaded, and before the user sees anything in the tab. http observers another common way of detecting and interc...
...nks to other useful documentation. webprogresslisteners when used in the chrome, this is a more sophisticated way of intercepting and modifying the various stages in page loads. but of course, there's always a price to pay: web progress listeners in the chrome are attached to specific instances of the browser element. ...
...eing opened and closed, in order to add and remove your listener. ...
...And 3 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
ymore :-( !! var env_mozdebug= getenv("mozilla_debug"); if (env_mozdebug) {displayerror("no error, just a debug, cn =" + cn + " and mail = " + mail); } } } // 4) call ldap servers to get ldap attributes (mail & cn), this will finally call processldapvalues, "3)" just above. getldapattributes("ldap2.int-evry.fr","ou=people,dc=int-evry,dc=fr","uid=" + env_user,"uid,cn,mail,labeleduri"); // close the try, and call the catch() } catch(e) { displayerror("lockedpref", e); } thunderbird.cfg (version 2 with ad) using thunderbird 9.0.1 and try to use a active directory (windows server 2008) as ldap-source did not work with version 1. here's my own version. //note: for accessing the active directory of windows server later than 2000 //it is necessary to allow anonymous read access. please ...
...pserver.smtp1.username", userinfo.mail ); // glue it all together defaultpref("mail.account.account1.identities", "id1" ); defaultpref("mail.account.account1.server", "server1" ); defaultpref("mail.accountmanager.accounts", "account1" ); defaultpref("mail.accountmanager.defaultaccount", "account1" ); defaultpref("mail.smtp.defaultserver", "smtp1" ); defaultpref("mail.smtpservers", "smtp1" ); // close the try, and call the catch() } catch(e) { displayerror("lockedpref", e); } test autoconfig debug to check that our autoconfig works fine, we just set to env variable to check the read of thunderbird.cfg file: $ export nspr_log_modules=mcd:5 $ export nspr_log_file=/tmp/thunderbird-log.txt when thunderbird has started, you should read: $ cat /tmp/thunderbird-log.txt -1209403040[808a788...
...ebug) {displayerror("no error ,s2ia debug v1.1 just a test, user =" + env_user); } lockpref("browser.startup.homepage", "http://gaspar.it-sudparis.eu" ); // 3) call ldap servers to get ldap attributes (mail & cn) , this will finally call processldapvalues , "2)" just above. // getldapattributes("ldap2.int-evry.fr","ou=people,dc=int-evry,dc=fr","uid=" + env_user,"uid,cn,mail,labeleduri"); // close the try, and call the catch() } catch(e) {displayerror("lockedpref", e);} if ldap call are uncommented in the preference file above, then i get a popup with: netscape.cfg/autoconfig failed. please contact your system administrator. error: getldapattibutes failed: [exception... "could not convert javascript argument arg 0 [nsisupports.queryinterface]" nsresult: "0x80570009 (ns_error_xpc_bad_...
...And 3 more matches
PopupEvents - Archive of obsolete content
r adjust items on the popup based on the context. popupshown this event is fired on a menupopup, panel or tooltip once it is visible on screen. popuphiding this event is fired on a menupopup, panel or tooltip once it is about to be hidden. this may happen because the user selected an item from the menu, or it may be because the popup was closed by clicking elsewhere. popuphidden this event is fired on a menupopup, panel or tooltip once it has been hidden. the popupshowing event just before a popup is about to be displayed, a popupshowing event will fired on the popup. this will occur regardless of how the popup is opened, either from user interaction or from a script calling the openpopup or openpopupatsc...
...t is the right popup and returns early if not. next, the popupshown event listener is removed again. we need to make sure to do this to ensure that the event listener isn't added multiple times. finally, we use a similar technique as the openfilemenu function to open the 'open' submenu. the result is a button that opens both the outer menu and the inner menu. the popuphiding event when a popup is closed, the popuphiding event is fired on the popup just before it is removed from the screen. a listener for the popuphiding event can be used to remove or hide items on the popup again, the reverse of the popupshowing event. the popuphiding event is fired regardless of how the popup was hidden, whether because the user selected an item from a menu, or if the user clicked outside the popup, or if the ...
...owing and hiding different menus and submenus. in this example, the contents of a textbox are cleared whenever a popup is hidden. <panel onpopuphiding="document.getelementbyid('search').value = '';"> <textbox id="search"/> <button label="search" oncommand="dosearch();"/> </panel> you can prevent a popup from hiding by calling the event's preventdefault method. this way, the popup will not be closed. usually, you should not do this. if you wanted to ensure that a value was entered for instance, it is much better to rework the ui such that the code can handle no value being entered instead. otherwise, the user will be distracted with a popup that they cannot close. you also cannot cancel the hiding of a menupopup when a user has made a selection from a menu, as it is already too late to do s...
...And 3 more matches
Keyboard Shortcuts - Archive of obsolete content
des methods in which you can define keyboard shortcuts. we've already seen in the section on menus that we can define an attribute called accesskey which specifies the key which a user can press to activate the menu or menu item. in the example below, the file menu can be selected by pressing alt + f together (or some other key combination for a specific platform). once the file menu is open, the close menu item can be selected by pressing c. example 1 : source view <menubar id="sample-menubar"> <menu id="file-menu" label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem id="close-command" label="close" accesskey="c"/> </menupopup> </menu> </menubar> you can also use the accesskey attribute on buttons. when the key is pressed in this case, the button is selected.
... vk_f2 vk_f3 vk_f4 vk_f5 vk_f6 vk_f7 vk_f8 vk_f9 vk_f10 vk_f11 vk_f12 vk_f13 vk_f14 vk_f15 vk_f16 vk_f17 vk_f18 vk_f19 vk_f20 vk_f21 vk_f22 vk_f23 vk_f24 vk_num_lock vk_scroll_lock vk_comma vk_period vk_slash vk_back_quote vk_open_bracket vk_back_slash vk_close_bracket vk_quote vk_help for example, to create a shortcut that is activated when the user presses alt and f5, do the following: <keyset> <key id="test-key" modifiers="alt" keycode="vk_f5"/> </keyset> the example below demonstrates some more keyboard shortcuts: <keyset> <key id="copy-key" modifiers="accel" key="c"/> <key id="find-key" keycode="vk_f3"/> ...
... easily. to do this add a disabled attribute to the key element and set it to the value true. this disables the keyboard shortcut so that it cannot be invoked. it is useful to change the disabled attribute using a script. our find files example let's add keyboard shortcuts to the find files dialog. ...
...And 3 more matches
Localization - Archive of obsolete content
"&copycmd.label;" accesskey="&copycmd.accesskey;"/> <menuitem label="&pastecmd.label;" accesskey="&pastecmd.accesskey;" disabled="true"/> </menupopup> </popupset> <keyset> <key id="cut_cmd" modifiers="accel" key="&cutcmd.commandkey;"/> <key id="copy_cmd" modifiers="accel" key="&copycmd.commandkey;"/> <key id="paste_cmd" modifiers="accel" key="&pastecmd.commandkey;"/> <key id="close_cmd" keycode="vk_escape" oncommand="window.close();"/> </keyset> <vbox flex="1"> <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="&filemenu.label;" accesskey="&filemenu.accesskey;"> <menupopup id="file-popup"> <menuitem label="&opencmd.label;" accesskey="&opencmd.accesskey;"/> <menuitem label="&savecmd.label;" ...
... <menubar id="findfiles-menubar"> <menu id="file-menu" label="&filemenu.label;" accesskey="&filemenu.accesskey;"> <menupopup id="file-popup"> <menuitem label="&opencmd.label;" accesskey="&opencmd.accesskey;"/> <menuitem label="&savecmd.label;" accesskey="&savecmd.accesskey;"/> <menuseparator/> <menuitem label="&closecmd.label;" accesskey="&closecmd.accesskey;" key="close_cmd" oncommand="window.close();"/> </menupopup> </menu> <menu id="edit-menu" label="&editmenu.label;" accesskey="&editmenu.accesskey;"> <menupopup id="edit-popup"> <menuitem label="&cutcmd.label;" accesskey="&cutcmd.accesskey;" key="cut_cmd"/> <menuitem label="&...
...a dtd file has been included near the beginning of the xul file. each entity that was added should be declared in the dtd file. the window will not be displayed if an entity is found in the xul file that hasn't been declared. note that the name of the entity is not important. in the example above, word...
...And 3 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
arch projects agency network) was an early computer network, constructed in 1969 as a robust medium to transmit sensitive military data and to connect leading research groups throughout the united states. arpanet first ran ncp (network control protocol) and subsequently the first version of the internet protocol or tcp/ip suite, making arpanet a prominent part of the nascent internet. arpanet was closed in early 1990. 23 array array, codingscripting, glossary, javascript, programming an array is an ordered collection of data (either primitive or object depending upon the language). arrays are used to store multiple values in a single variable. this is compared to a variable that can store only one value. 24 asynchronous glossary, web, webmechanics, asynchrono...
...s a block-level element). for example, <p> is by default a block-level element, whereas <a> is an inline element — you can put several links next to one another in your html source and they will sit on the same line as one another in the rendered output. 34 block (scripting) codingscripting, glossary, javascript in javascript, a block is a collection of related statements enclosed in braces ("{}"). for example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code inside the block if the condition is true, or skip the whole block if the condition is false. 35 block cipher mode of operation block cipher mode of operation, cryptography, glossary, security a block cipher mode of operation, us...
...rap bootstrap, css, glossary, intro, framework bootstrap is a free, open source html, css, and javascript framework for quickly building responsive websites. 39 bounding box bounding box, codingscripting, design, glossary the bounding box of an element is the smallest possible rectangle (aligned with the axes of that element's user coordinate system) that entirely encloses it and its descendants. 40 breadcrumb accessibility, glossary, navigation, search, site map, breadcrumb a breadcrumb, or breadcrumb trail, is a navigational aid that is typically placed between a site's header and the main content, displaying either a hierarchy of the current page in relation to the the site's structure, from top level to current page, or a list of the links...
...And 3 more matches
Debugging HTML - Learn web development
tten with some built-in errors for us to explore (the html markup is said to be badly-formed, as opposed to well-formed). next, open it in a browser. you will see something like this: this immediately doesn't look great; let's look at the source code to see if we can work out why (only the body contents are shown): <h1>html debugging examples</h1> <p>what causes errors in html? <ul> <li>unclosed elements: if an element is <strong>not closed properly, then its effect can spread to areas you didn't intend <li>badly nested elements: nesting elements properly is also very important for code behaving correctly. <strong>strong <em>strong emphasised?</strong> what is this?</em> <li>unclosed attributes: another common source of html problems. let's look at an examp...
.... in the dom inspector, you can see what the rendered markup looks like: using the dom inspector, let's explore our code in detail to see how the browser has tried to fix our html errors (we did the review in firefox; other modern browsers should give the same result): the paragraphs and list items have been given closing tags. it isn't clear where the first <strong> element should be closed, so the browser has wrapped each separate block of text with its own strong tag, right down to the bottom of the document! the incorrect nesting has been fixed by the browser as shown here: <strong>strong <em>strong emphasised?</em> </strong> <em> what is this?</em> the link with the missing double quote has been deleted altogether. the last list item looks like this: <li> ...
...browser has wrapped each separate block of text with its own strong tag, right down to the bottom of the document! the incorrect nesting has been fixed by the browser as shown here: <strong>strong <em>strong emphasised?</em> </strong> <em> what is this?</em> the link with the missing double quote has been deleted altogether. the last list item looks like this: <li> <strong>unclosed attributes: another common source of html problems. let's look at an example: </strong> </li> html validation so you can see from the above example that you really want to make sure your html is well-formed! but how? in a small example like the one seen above, it is easy to search through the lines and find the errors, but what about a huge, complex html document? the best strateg...
...And 3 more matches
Sqlite.jsm
e below for api). } catch (error) { // the connection could not be opened. error is an error describing what went wrong. } working with opened connections opened connections are what you will interface most with in sqlite.jsm. the following sections detail the api of an opened connection instance. connection management these apis are used to manage and inspect the state of the connection. close() close this database connection. this must be called on every opened connection or else application shutdown will fail due to waiting on the opened connection to close (gecko doesn't force close connections because it doesn't know that you are really done with them). this function returns a promise that will be resolved when the database has closed. if a transaction is in progress at the time...
...will be resolved when the database has closed. if a transaction is in progress at the time this function is called, the transaction will be forcibly rolled back. if statements are in progress at the time this function is called, they will be cancelled. callers should not attempt to use the connection after calling this method as the connection will be unusable. ...
...osed. if a transaction is in progress at the time this function is called, the transaction will be forcibly rolled back. if statements are in progress at the time this function is called, they will be cancelled. callers should not attempt to use the connection after calling this method as the connection will be unusable. ...
...And 3 more matches
Encrypt Decrypt MAC Keys As Session Objects
rchr(nonbody, '\r'); /* maybe this is a mac file */ if (body) trail = strstr(++body, trailer); if (trail != null) { *trail = '\0'; } else { pr_fprintf(pr_stderr, "input has header but no trailer\n"); port_free(filedata.data); return secfailure; } } else { body = nonbody; } cleanup: pr_close(file); hextobuf(body, item, ishexdata); return secsuccess; } /* * encryptandmac */ secstatus encryptandmac(prfiledesc *infile, prfiledesc *headerfile, prfiledesc *encfile, pk11symkey *ek, pk11symkey *mk, unsigned char *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char pte...
...intf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { pk11_destroycontext(ctxmac, pr_true); } if (ctxenc) { pk11_destroycontext(ctxenc, pr_true); } if (outfile) { pr_close(outfile); } return rv; } /* * gets iv and ckaids from header file */ secstatus getivandckaidsfromheader(const char *cipherfilename, secitem *ivitem, secitem *enckeyitem, secitem *mackeyitem) { secstatus rv; /* open intermediate file, read in header, get iv and cka_ids of two keys * from it */ rv = readfromheaderfile(cipherfilename, iv, ivitem, p...
... in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file, * save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; secitem mackeyitem; secitem cipheritem; secitem macitem; secitem paditem; pk11symkey *enckey = null; pk11symkey *mackey = null; /* open intermedia...
...And 3 more matches
Encrypt and decrypt MAC using token
rchr(nonbody, '\r'); /* maybe this is a mac file */ if (body) trail = strstr(++body, trailer); if (trail != null) { *trail = '\0'; } else { pr_fprintf(pr_stderr, "input has header but no trailer\n"); port_free(filedata.data); return secfailure; } } else { body = nonbody; } cleanup: pr_close(file); hextobuf(body, item, ishexdata); return secsuccess; } /* * encryptandmac */ secstatus encryptandmac(prfiledesc *infile, prfiledesc *headerfile, prfiledesc *encfile, pk11symkey *ek, pk11symkey *mk, unsigned char *iv, unsigned int ivlen, prbool ascii) { secstatus rv; unsigned char pte...
...intf(pr_stderr, "extracted : "); printashex(pr_stderr, macitem->data, macitem->len); pr_fprintf(pr_stderr, "computed : "); printashex(pr_stderr, newmac, newmaclen); rv = secfailure; } cleanup: if (ctxmac) { pk11_destroycontext(ctxmac, pr_true); } if (ctxenc) { pk11_destroycontext(ctxenc, pr_true); } if (outfile) { pr_close(outfile); } return rv; } /* * gets iv and ckaids from header file */ secstatus getivandckaidsfromheader(const char *cipherfilename, secitem *ivitem, secitem *enckeyitem, secitem *mackeyitem) { secstatus rv; /* open intermediate file, read in header, get iv and cka_ids of two keys * from it */ rv = readfromheaderfile(cipherfilename, iv, ivitem, p...
... in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file, * save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; secitem mackeyitem; secitem cipheritem; secitem macitem; secitem paditem; pk11symkey *enckey = null; pk11symkey *mackey = null; /* open intermedia...
...And 3 more matches
NSS PKCS11 Functions
pkcs #11 functions this chapter describes the core pkcs #11 functions that an application needs for communicating with cryptographic modules. in particular, these functions are used for obtaining certificates, keys, and passwords. this was converted from "chapter 7: pkcs #11 functions". back to the nss reference main page. secmod_loadusermodule secmod_unloadusermodule secmod_openuserdb secmod_closeuserdb pk11_findcertfromnickname pk11_findkeybyanycert pk11_getslotname pk11_gettokenname pk11_ishw pk11_ispresent pk11_isreadonly pk11_setpasswordfunc secmod_loadusermodule load a new pkcs #11 module based on a modulespec. syntax #include "secmod.h" extern secmodmodule *secmod_loadusermodule(char *modulespec, secmodmodule *parent, prbool recurse); parameters this function has the following ...
...secmodmodule *module); parameters this function has the following parameters: module is the module to be unloaded. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. description secmod_unloadusermodule detaches a module from the nss trust domain and unloads it. the module should have previously been loaded by secmod_loadusermodule. ...
... *module); parameters this function has the following parameters: module is the module to be unloaded. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. description secmod_unloadusermodule detaches a module from the nss trust domain and unloads it. the module should have previously been loaded by secmod_loadusermodule. ...
...And 3 more matches
NSS tools : ssltab
utput and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to interzone.mcom.com:443 -->; [ alloclen = 66 bytes...
...1f) < encrypted > } ] <-- [ sslrecord { 0: 17 03 00 00 a0 |.... type = 23 (application_data) version = { 3,0 } length = 160 (0xa0) < encrypted > } ] <-- [ sslrecord { 0: 17 03 00 00 df |....ß type = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted > } sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted > } ] server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443 --> [ alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 36 (0x24) sid-length = 0 (0x00) cha...
...example 3 in this example, the -h option turns hex/ascii format. there is no ssl parsing or decoding. the output is routed to a text file. $ ssltap -h -p 444 interzone.mcom.com:443 > h.txt output connected to interzone.mcom.com:443 --> [ 0: 80 40 01 03 00 00 27 00 00 00 10 01 00 80 02 00 | .@....'......... 10: 80 03 00 80 04 00 80 06 00 40 07 00 c0 00 00 04 | .........@...... 20: 00 ff e0 00 00...
...And 3 more matches
NSS tools : ssltap
utput and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to interzone.mcom.com:443 -->; [ alloclen = 66 bytes...
...1f) < encrypted > } ] <-- [ sslrecord { 0: 17 03 00 00 a0 |.... type = 23 (application_data) version = { 3,0 } length = 160 (0xa0) < encrypted > } ] <-- [ sslrecord { 0: 17 03 00 00 df |....ß type = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted > } sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted > } ] server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443 --> [ alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-specs-length = 36 (0x24) sid-length = 0 (0x00) cha...
...example 3 in this example, the -h option turns hex/ascii format. there is no ssl parsing or decoding. the output is routed to a text file. $ ssltap -h -p 444 interzone.mcom.com:443 > h.txt output connected to interzone.mcom.com:443 --> [ 0: 80 40 01 03 00 00 27 00 00 00 10 01 00 80 02 00 | .@....'......... 10: 80 03 00 80 04 00 80 06 00 40 07 00 c0 00 00 04 | .........@...... 20: 00 ff e0 00 00...
...And 3 more matches
NSS tools : ssltap
Mozilla › Projects › NSS › tools › ssltap
t interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 $ ssltap.exe -sx -p 444 interzone.mcom.com:443 > sx.txt output connected to interzone.mcom.com:443 -...
...] <-- [ sslrecord { 0: 17 03 00 00 df |....ß type = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted > } sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted > } ] server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. $ ssltap -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443 --> [ alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} c...
... example 3 in this example, the -h option turns hex/ascii format. there is no ssl parsing or decoding. the output is routed to a text file. $ ssltap -h -p 444 interzone.mcom.com:443 > h.txt output connected to interzone.mcom.com:443 --> [ 0: 80 40 01 03 00 00 27 00 00 00 10 01 00 80 02 00 | .@....'......... 10: 80 03 00 80 04 00 80 06 00 40 07 00 c0 00 00 04 ...
...And 3 more matches
Handling Mozilla Security Bugs
e their consequences are potentially so severe: users' private information (including financial information) could be exposed, users' data could be destroyed, and users' systems could be used as platforms for attacks on other systems. ...
...w security-related bugs are handled, and in particular about the degree to which information about such bugs is publicly disclosed. the mozilla project is a public software development project, and thus we have an inherent bias towards openness. in particular, we understand and acknowledge the concerns of those who believe that all information about security vulnerabilities should be publicly disclosed as soon as it is known, so that users may take immediate steps to protect themselves and so that problems can get the maximum amount of developer attention and be fixed as soon as possible. at the same time, the mozilla project receives substantial contributions of code and developer time from organizations that use (or plan to use) mozilla code in their own product offerings. some of these pro...
...ew applications or, if necessary and appropriate, by removing existing members of the security bug group to make room for new ones. disclosure of security vulnerabilities the security module owner, peers, and other members of the mozilla security bug group will not be asked to sign formal nondisclosure agreements or other legal paperwork. however, we do expect members of the group: not to disclose security bug information to others who are not members of the mozilla security bug group or are not otherwise involved in resolving the bug. however, members of the mozilla security bug group employed by a distributor of mozilla-based products may share such information within that distributor, provided that this information is shared only with those who have a need to know, to the extent they ne...
...And 3 more matches
nsILocalFile
ly identify the file on the local file system. the persistent descriptor is intended to be used whenever a nsilocalfile needs to be serialized to disk and later recovered. this string is not intended for display to users. note: the value of the followlinks attribute is not encoded in the persistent descriptor. constants constant value description delete_on_close 0x80000000 optional parameter used by opennsprfiledesc(). methods native code only! appendrelativenativepath appends a relative, native character encoding, path to the current path of the nsilocalfile object. void appendrelativenativepath( in acstring relativefilepath ); parameters relativefilepath a native relative path. for security reasons, this cannot contain '..
...ing to the given nsilocalfile... nsresult loaddll(nsilocalfile *alocalfile) { prlibrary *dll; nsresult rv = alocalfile->load(&dll); if (ns_failed(rv)) return rv; // do something with the library now that it is open... pr_freelibrary(dll); return ns_ok; } native code only! openansifiledesc returns the result of fopen() on the file. the caller is responsible for calling fclose() on the result. file openansifiledesc( in string mode ); parameters mode an ansi file open mode string, which will be passed to fopen(). return value a pointer to an ansi file type. example #include <stdio.h> #include "nserror.h" #include "nsilocalfile.h" // read the contents of a nsilocalfile... nsresult readlocalfile(nsilocalfile *alocalfile) { file *fp; nsresult rv = aloca...
...ad the contents of a nsilocalfile... nsresult readlocalfile(nsilocalfile *alocalfile) { file *fp; nsresult rv = alocalfile->openansifiledesc("r", &fp); if (ns_failed(rv)) return rv; char buf[512]; size_t n; while ((n = fread(buf, sizeof(buf), 1, fp)) > 0) { // do something with n-byte block of data from file... ...
...And 3 more matches
All keyboard shortcuts - Firefox Developer Tools
he second section lists shortcuts that are applicable to the toolbox itself. after that there's one section for each tool, which lists the shortcuts that you can use within that tool. because access keys are locale-dependent, they're not documented in this page. opening and closing tools these shortcuts work in the main browser window to open the specified tool. the same shortcuts will work to close tools hosted in the toolbox, if the tool is active. for tools like the browser console that open in a new window, you have to close the window to close the tool. command windows macos linux open toolbox (with the most recent tool activated) ctrl + shift + i cmd + opt + i ctrl + shift + i bring toolbox to foreground (if the toolbox is in a separate win...
... you have to close the window to close the tool. ...
...hift + i ctrl + alt + shift + i open scratchpad shift + f4 shift + f4 * shift + f4 open webide shift + f8 shift + f8 * shift + f8 storage inspector shift + f9 shift + f9 * shift + f9 open debugger 3 ctrl + shift + z cmd + opt + z ctrl + shift + z 1. unlike the other toolbox-hosted tools, this shortcut does not also close the web console. instead, it focuses on the web console's command line. to close the web console, use the global toolbox shortcut of ctrl + shift + i (cmd + opt + i on a mac). 2. before firefox 55, the keyboard shortcut was ctrl + shift + q (cmd + opt + q on a mac). 3. starting in firefox 71. before firefox 66, the letter in this shortcut was s. toolbox these shortcuts work whenever the too...
...And 3 more matches
Event.composed - Web APIs
Web › API › Event › composed
posed events are also handled at host as if they were in at_target phase. you can determine the path the event will follow through the shadow root to the dom root by calling composedpath(). if this value is false, the shadow root will be the last node to be offered the event. examples in our composed-composed-path example (see it live), we define two trivial custom elements, <open-shadow> and <closed-shadow>, both of which take the contents of their text attribute and insert them into the element's shadow dom as the text content of a <p> element. the only difference between the two is that their shadow roots are attached with their modes set to open and closed respectively. the first definition looks like this, for example: customelements.define('open-shadow', class extends htmlelement {...
... the composed property returns tr...
... the composed property returns true beause the click event is ...
...And 3 more matches
Using the Notifications API - Web APIs
icon or a text body. for example, in the to-do-list example we use the following snippet to create a notification when required (found inside the createnotification() function): var img = '/to-do-notifications/img/icon-128.png'; var text = 'hey! your task "' + title + '" is now overdue.'; var notification = new notification('to do list', { body: text, icon: img }); closing notifications used close() to remove a notification that is no longer relevant to the user (e.g. the user already read the notification on the webpage, in the case of a messaging app, or the following song is already playing in a music app to notifies upon song changes). most modern browsers dismiss notifications automatically after a few moments (around four seconds) but this isn't something you should generally be conc...
...ications automatically so you can do so after a settimeout() only for those legacy versions in order to not remove notifications from notification trays on other browsers. var n = new notification('my great song'); document.addeventlistener('visibilitychange', function() { if (document.visibilitystate === 'visible') { // the tab has become visible so clear the now-stale notification. ...
... the tab has become visible so clear the now-stale notification. n.close(); } }); note: this api shouldn't be used just to have the notification removed from the screen after a fixed delay (on modern browsers) since this method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown. note: when you receive a "close" event, there is no guarantee that it's the user who closed the notification. ...
...And 3 more matches
WritableStream.WritableStream() - Web APIs
dy to be written to the underlying sink. it can return a promise to signal success or failure of the write operation. the controller parameter passed to this method is a writablestreamdefaultcontroller that can be used by the developer to control the stream as more chunks are submitted for writing. this method will be called only after previous writes have succeeded, and never after the stream is closed or aborted (see below). close(controller) optional this method, also defined by the developer, will be called if the app signals that it has finished writing chunks to the stream. the contents should do whatever is necessary to finalize writes to the underlying sink, and release access to it. if this process is asynchronous, it can return a promise to signal success or failure. this method w...
...turn a promise to signal success or failure. this method will be called only after all queued-up writes have succeeded. the controller parameter passed to this method is a writablestreamdefaultcontroller, which can be used to control the stream at the end of writing. abort(reason) optional this method, also defined by the developer, will be called if the app signals that it wishes to abruptly close the stream and put it in an errored state. it can clean up any held resources, much like close(), but abort() will be called even if writes are queued up — those chunks will be thrown away. if this process is asynchronous, it can return a promise to signal success or failure. the reason parameter contains a domstring describing why the stream was aborted. queuingstrategy optional an objec...
...e creation of the writablestream with a custom sink and an api-supplied queuing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: true }); e...
...And 3 more matches
Text labels and names - Accessibility
l. examples the following example shows a simple dialog box, defined as such using role="dialog" and labelled using aria-labelledby. ...
... details at any time in the user account section.</p> <button>close</button> </div> if the dialog box doesn't have a heading, you can instead use aria-label to contain the label text: <div role="dialog" aria-label="personal details updated confirmation"> <p>your personal details were successfully updated. you can change your details at any time in the user account section.</p> <button>close</button> </div> see also role="dialog" role="alertdialog" aria-label aria-labelledby wai-aria: dialog role dialog authoring practices documents must have a title it is important on each html document to include a <title> that describes the page's purpose. a common navigation technique for users of assistive technology is to infer what content a page contains by reading its title. if t...
...a simple description of a visual item, as provided by the alternative text. example the following example shows code for a figure with a caption. the alt attribute of the <img> describes the appearance of the image; the <figcaption> describes it from a functional perspective (in this case, the latin name of the flower in the image). <figure> <img src="milkweed.jgp" alt="black and white close-up photo of milkweed flowers"> <figcaption>asclepias verticillata</figcaption> </figure> fieldset elements must be labeled fieldset elements must have a text description, similar to other form elements. use the <legend> element to describe the purpose of a fieldset. use a legend to label a fieldset when grouping a set of form elements together with a <fieldset> element, you should include a...
...And 3 more matches
Printing - Developer guides
y have occurred. you can use this to adjust the user interface presented during printing (such as by displaying or hiding user interface elements during the print process). note: you can also use window.onbeforeprint and window.onafterprint to assign handlers for these events, but using eventtarget.addeventlistener() is preferred. examples here are some common examples. ...
...ing printing (such as by displaying or hiding user interface elements during the print process). note: you can also use window.onbeforeprint and window.onafterprint to assign handlers for these events, but using eventtarget.addeventlistener() is preferred. examples here are some common examples. ...
...re are some common examples. ...
...And 3 more matches
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
content sectioning content sectioning elements allow you to organize the document content into logical pieces. use the sectioning elements to create a broad outline for your page content, including header and footer navigation, and heading elements to identify sections of content. element description <address> the html <address> element indicates that the enclosed html provides contact information for a person or people, or for an organization. <article> the html <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication). <aside> the html <aside> element represents a portion of a document whose conten...
...content use html text content elements to organize blocks or sections of content placed between the opening <body> and closing </body> tags. important for accessibility and seo, these elements identify the purpose or structure of that content. element description <blockquote> the html <blockquote> element (or html block quotation element) indicates that the enclosed text is an extended quotation. usually, this is rendered visually by indentation (see notes for how to change it). a url for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element. <dd> the html <dd> element provides the description, definition, or value for the preceding term (<dt>) in a de...
... <dd> the html <dd> element provides the description, definition, or value for the preceding term (<dt>) in a description list (<dl>). <div> the html content division element (<div>) is the generic container for flow content. it has no effect on the content or layout until styled using css. <dl> the html <dl> element represents a description list. the element encloses a list of groups of terms (specified using the <dt> element) and descriptions (provided by <dd> elements). common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs). <dt> the html <dt> element specifies a term in a description or definition list, and as such must be used inside a <dl> element. <figcaption> the html <fi...
...And 3 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
element (<acronym>) allows authors to clearly indicate a sequence of characters that compose an acronym or abbreviation for a word. 58 <address>: the contact address element address, author, contact, contact information, element, email, email address, html, html sections, html:flow content, html:palpable content, reference, web the html <address> element indicates that the enclosed html provides contact information for a person or people, or for an organization. 59 <applet>: the embed java applet element element, html, java, obsolete, reference, web, applet the obsolete html applet element (<applet>) embeds a java applet into the document; this element has been deprecated in favor of <object>. 60 <area> content, element, html, html:flow ...
...round sound, element, html, internet explorer, non-standard, obsolete, reference, web the internet explorer only html background sound element (<bgsound>) sets up a sound file to play in the background while the page is used; use <audio> instead. 70 <big>: the bigger text element element, html, obsolete, reference, web the obsolete html big element (<big>) renders the enclosed text at a font size one level larger than the surrounding text (medium becomes large, for example). 71 <blink>: the blinking text element (obsolete) blink, element, html, obsolete, reference, web the html blink element (<blink>) is a non-standard element which causes the enclosed text to flash slowly. 72 <blockquote>: the block quotation element blockquote, el...
...usually, this is rendered visually by indentation (see notes for how to change it). a url for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element. ...
...And 3 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
enu item. firefox 31 open the dom inspector by open menu>developer>dom inspector menu item. type chrome://browser/content/browser.xul into the url input field at the top, then click the inspect button. a browser pane will appear in the lower part of the window. click the spots numbered 1 and 2 in figure 5, in that order; the menu element (3) will then be selected. expand spot 3; this will disclose the area numbered 4, with several menuitem elements. the menupop element 4 contains the merge point where you’re going to be adding a new menu item; you can see that it has the id menu_toolspopup. look through the menuitem elements within this menupop element and determine where you want to add your new element. for the time being, let’s locate it in the spot numbered fixme: figure 5: find...
...ning a class would be another good way. initializing when opening browser window with extensions, there are a lot of situations where you want to perform some kind of initialization when the browser window opens. to do that, add an event listener for the load event that targets the window object. in listing 15, an init method runs when the window opens, and an uninit method runs when the window closes. adding event handlers add the four event handlers you defined in overlay.js to overlay.xul (listing 16). this takes advantage of event bubbling2, appending the restore event handler to the menupopup element one layer above the menuitem element. in the code for the save and restore event handlers, we will actually need blocks to prevent event bubbling. listing 16: revisions to overlay.xul <m...
...["@mozilla.org/intl/converter-input-stream;1"]. createinstance(components.interfaces.nsiconverterinputstream); cvstream.init(stream, "utf-8", 1024, components.interfaces.nsiconverterinputstream.default_replacement_character); var content = ""; var data = {}; while (cvstream.readstring(4096, data)) { content += data.value; } cvstream.close(); return content.replace(/\r\n?/g, "\n"); } catch (ex) { } return null; }, _writefile method creates a new file for the nslfile object passed as a parameter, and writes the text string, also passed as a parameter. upon writing, the text is converted from unicode to utf-8. listing 23: content for _writefile method _writefile: function(afile, adata) { // init stream ...
...And 2 more matches
XUL Events - Archive of obsolete content
ed. the attribute name is the event name with an 'on' prefix. xul event reference subpages broadcastthe broadcast event is executed when the attributes of the element (such as a broadcaster) being listened to are changed. the event handler should be placed on an observer.checkboxstatechangethe checkboxstatechange event is executed when the state of a <checkbox> element has changed.closethe close event is executed when a request has been made to close the window when the user presses the close button.commandthe command event is executed when an element is activated.commandupdatethe commandupdate event is executed when a command update occurs on a <commandset>. this event would be used to update the disabled status of its commands.dommenuitemactivethe dommenuitemactive event is ex...
...ouse is released on an element. attribute: onmouseup select this event is sent to a listbox or tree when an item is selected. attribute: onselect unload this event is sent to a window when the window has closed. this is done after the close event. you should place this event handler on the window element. attribute: onunload mutation dom events event description domattrmodified this event is sent to an element when one of it...
... event description broadcast the event handler should be placed on an observer. the broadcast event is sent when the attributes of the element (such as a broadcaster) being listened to are changed. ...
...And 2 more matches
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
ce c implementation which can be found embedded in leading software products such as mozilla firefox, adobe acrobat, and aptana jaxer. rhino is a java implementation of javascript which is commonly embedded in java applications to expose scripting capability. the helma web application framework is an example of rhino in use. the dojo toolkit also has capabilities that run in rhino. let’s take a closer look at rhino and its importance to the javascript developer. rhino offers a unique opportunity for the javascript developer to tap into the power of java classes using javascript. armed with some basic java knowledge, you can extend javascript to include some of the most desired capability such as database access, remote web requests, and xml processing. we’ll start b...
...here, we’re including all the classes in the java.sql namespace in the script. the appropriate database driver for mysql is loaded and the connection string to a database named rhino on my local machine is configured using the ...
...here, we’re including all the classes in the java.sql namespace in the script. the appropriate database driver for mysql is loaded and the connection string to a database named rhino on my local machine is configured using the user account u...
...And 2 more matches
Windows Media in Netscape - Archive of obsolete content
ly with netscape 7.1 running on the windows operating system. detecting the right browser like internet explorer, netscape 7.1 and later versions can play windows media files using the popular windows media player activex control. this control is widely used to provide inline media support for web pages that provide sound, video and other media. controls such as windows media player also interact closely with the scripts in a web page. netscape 7.1 is the first netscape gecko™ browser to support the windows media player as an activex control -- previous netscape browsers did not support any activex controls, and thus detecting which versions of netscape support the windows media activex control is an important first step towards building multimedia experiences using html, javascript, and the ...
...within windows media player to web pages: script for event netscape 7.1 supports ie's <script for="activexcontrol" event="activexcontrolevent"> script elements. no netscape browser prior to netscape 7.1 has supported this non-standard way of writing scripts that handle information sent by a plugin or control. a good illustration of the use of this non-standard script element syntax is in creating closed captioning of media content. automatic closed captioning does not work in netscape 7.1 as it does in ie. in ie, a named html element such as a div may be given to the windows media player control and it will be automatically updated with caption data. this does not work in gecko because it requires ie dom functionality that has not been implemented. fortunately, windows media player also fires a...
...nt. automatic closed captioning does not work in netscape 7.1 as it does in ie. in ie, a named html element such as a div may be given to the windows media player control and it will be automatically updated with caption data. this does not work in gecko because it requires ie dom functionality that has not been implemented. fortunately, windows media player also fires a scriptcommand() event for closed captioning, which means content may update the caption manually with a small piece of javascript. for example, in ie it is possible to do this: player.closedcaption.captioningid = "captext"; here, "captext" is the id of an html element, assigned to the captioningid property of the player. instead of doing that, this is the recommendation and workaround for netscape 7.1: <script for="player" eve...
...And 2 more matches
Move the ball - Game development
interval every 10 miliseconds: function draw() { // drawing code } setinterval(draw, 10); thanks to the infinite nature of setinterval the draw() function will be called every 10 milliseconds forever, or until we stop it. now, let's draw the ball — add the following inside your draw() function: ctx.beginpath(); ctx.arc(50, 50, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); try your updated code now — the ball should be repainted on every frame. making it move you won't notice the ball being repainted constantly at the moment, as it's not moving. let's change that. first, instead of a hardcoded position at (50,50) we will define a starting point at the bottom center part of the canvas in variables called x and y, then use those to define the position th...
...n at. first, add the following two lines above your draw() function, to define x and y: var x = canvas.width/2; var y = canvas.height-30; next update the draw() function to use the x and y variables in the arc() method, as shown in the following highlighted line: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } now comes the important part: we want to add a small value to x and y after every frame has been drawn to make it appear that the ball is moving. let's define these small values as dx and dy and set their values to 2 and -2 respectively. add the following below your x and y variable definitions: var dx = 2; var dy = -2; the last thing to do is to update x and y with our dx and dy va...
...le definitions: var dx = 2; var dy = -2; the last thing to do is to update x and y with our dx and dy variable on every frame, so the ball will be painted in the new position on every update. add the following two new lines indicated below to your draw() function: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; } save your code again and try it in your browser. this works ok, although it appears that the ball is leaving a trail behind it: clearing the canvas before each frame the ball is leaving a trail because we're painting a new circle on every frame without removing the previous one. don't worry, because there's a method to clear canvas content: clearrect(). thi...
...And 2 more matches
Build your own function - Learn web development
de that runs when we call the function goes inside the curly braces. finally, add the following code inside the curly braces: const html = document.queryselector('html'); const panel = document.createelement('div'); panel.setattribute('class', 'msgbox'); html.appendchild(panel); const msg = document.createelement('p'); msg.textcontent = 'this is a message box'; panel.appendchild(msg); const closebtn = document.createelement('button'); closebtn.textcontent = 'x'; panel.appendchild(closebtn); closebtn.onclick = function() { panel.parentnode.removechild(panel); } this is quite a lot of code to go through, so we'll walk you through it bit by bit. the first line uses a dom api function called document.queryselector() to select the <html> element and store a reference to it in a constan...
...ndchild() functions we've already seen to create two new elements — a <p> and a <button> — and insert them in the page as children of the panel <div>. we use their node.textcontent property — which represents the text content of an element — to insert a message inside the paragraph, and an 'x' inside the button. ...
...he panel <div>. we use their node.textcontent property — which represents the text content of an element — to insert a message inside the paragraph, and an 'x' inside the button. this button will be what needs to be clicked/activated when the user wants to close the message box. const msg = document.createelement('p'); msg.textcontent = 'this is a message box'; panel.appendchild(msg); const closebtn = document.createelement('button'); closebtn.textcontent = 'x'; panel.appendchild(closebtn); finally, we use an globaleventhandlers.onclick event handler to make it so that when the button is clicked, some code is run to delete the whole panel from the page — to close the message box. briefly, the onclick handler is a property available on the button (or in fact, any element on the page) t...
...And 2 more matches
Debugging on Mac OS X
tem integrity protection (sip). this is due to notarization requiring hardened runtime to be enabled with the com.apple.security.get-task-allow entitlement disallowed. rather than disabling sip (which has security implications), it is recommended to debug with try builds or local builds. the differences are explained below. try server builds in most cases, developers needing to debug a build as close as possible to the production environment should use a try build. these builds enable hardened runtime and only differ from production builds in that they are not notarized which should not otherwise affect functionality, (other than the ability to easily launch the browser on macos 10.15+ -- see quarantine note below). at this time, developers can obtain a hardened runtime build with the com.app...
...t fixes with sip enabled. disabling sip has system security implications that should be understood before taking this step. creating an xcode project if you try to create a new xcode project in an existing directory then xcode will delete its existing contents (xcode will warn you beforehand). to work around that, the steps below have you initialize the project outside the mozilla source tree, close the project, copy the .xcodeproj project "file" into the source tree, and then reopen the project to finish setting it up. note also that since xcode 7.3.1 it doesn't seem to be possible to have the xcode project live outside the source tree. if you try to do that then xcode will simply copy the source files under the project directory rather than link to them (still the case in xcode 10?) which...
...launch from inside xcode. these steps were last updated for xcode 10.3: open xcode, and create a new project with file > new project. select the "cross-platform" tab then under the "other" template group select the "empty" project type. the click next. name the project and click next. create/select a temporary directory to contain the project and then click create. before going any further, close the project (file > close project) and open finder. find the *.xcodejproj directory in the temporary directory, move it into your mozilla source tree, and then double-click on it to reopen it. in the left-hand pane in xcode you should see a tree item where the root item has the project name. if the temporary directory that you originally created the xcode project in is under that, right click it...
...And 2 more matches
HTTP Cache
nse payload) to write to the cache entry, it must open the output stream on it before it calls metadataready. when the writer still keeps the cache entry and has open and keeps open the output stream on it, other consumers may open input streams on the entry. the data will be available as the writer writes data to the cache entry's output stream immediately, even before the output stream is closed. this is called concurrent read/write. concurrent read and write important difference in behavior from the old cache: the cache now supports reading a cache entry data while it is still being written by the first consumer - the writer. this can only be engaged for resumable responses that (bug 960902) don't need revalidation. reason is that when the writer is interrupted (by e.g. external ...
...the eviction preparation operation - i.e. clearing of the internal io state - is then put ...
...ntry::onfileready notification is now expected state == loading: just do nothing and exit call to cacheentry::invokecallbacks cacheentry::invokecallbacks (entry atomic): called on: a new opener has been added to the fifo via an asyncopen call asynchronous result of cachefile open the writer throws the entry away the output stream of the entry has been opened or closed metadataready or setvalid on the entry has been called the entry has been doomed state == empty: on oper_readonly flag use: oncacheentryavailable with null for the cache entry otherwise: state = writing opener is removed from the fifo and remembered as the current 'writer' oncacheentryavailable with anew = true and this entry is invoked (on the caller thr...
...And 2 more matches
NSS Tools ssltap
tput and is not interpreted in any way. this can result in peculiar effects, such as sounds, flashes, and even crashes of the command shell window. to output a basic, printable interpretation of the data, use the -h option, or, if you are looking at an ssl connection, the -s option. you will notice that the page you retrieved looks incomplete in the browser. this is because, by default, the tool closes down after the first connection is complete, so the browser is not able to load images. to make the tool continue to accept connections, switch on looping mode with the -l option. the following examples show the output from commonly used combinations of options. example 1 the s and x options in this example turn on ssl parsing and show undecoded values in hex/ascii format. the output i...
...(0xa0) < encrypted >}]<-- [sslrecord {0: 17 03 00 00 df |....ß type = 23 (application_data) version = { 3,0 } length = 223 (0xdf) < encrypted >}sslrecord { 0: 15 03 00 00 12 |..... type = 21 (alert) version = { 3,0 } length = 18 (0x12) < encrypted >}]server socket closed. example 2 the -s option turns on ssl parsing. because the -x option is not used in this example, undecoded values are output as raw data. the output is routed to a text file. command ssltap.exe -s -p 444 interzone.mcom.com:443 > s.txt output connected to interzone.mcom.com:443--> [alloclen = 63 bytes [ssl2] clienthellov2 { version = {0x03, 0x00} cipher-...
... example 3 in this example, the -h option turns hex/ascii format. there is no ssl parsing or decoding. the output is routed to a text file. command ssltap.exe -h -p 444 interzone.mcom.com:443 > h.txt output connected to interzone.mcom.com:443--> [ 0: 80 40 01 03 00 00 27 00 00 00 10 01 00 80 02 00 | .@....'......... 10: 80 03 00 80 04 00 80 06 00 40 07 00 c0 00 00 04 ...
...And 2 more matches
XPCOM Stream Guide
Mozilla › Tech › XPCOM › Guide › Streams
is a special nsiscriptableinputstream interface and "scriptable stream" wrapper. if you have an input stream called nativestream, you can use code like this: var stream = components.classes["@mozilla.org/scriptableinputstream;1"] .createinstance(components.interfaces.nsiscriptableinputstream); stream.init(nativestream); the stream provides .read(count), .available(), and .close() methods. output streams output streams are usually scriptable: you can call .write(chars, chars.length) as you wish. however, it is usually better to create an input stream that you then feed to the output stream: var outstream = components.classes["@mozilla.org/storagestream;1"] .createinstance(components.interfaces.nsistoragestream) .get...
...am (the asynccopy() method), getting an input stream from another source (the asyncfetch() method), and reading an input stream into a string (the readinputstreamtostring() method). fileutils.jsm provides apis for getting output streams for files, with the .openfileoutputstream(file, modeflags) and .opensafefileoutputstream(file, modeflags) methods, and for closing those output streams with the .closesafefileoutputstream(inputstream) method. as we mentioned earlier, you can use the io service to get any channel, and from there an input stream. the io service is available through the services.jsm module as the .io property. stream listeners a stream listener is an object you build to let you know when there is data in a stream ready for you to consume. most streams are asynchronous: they mak...
... then, write that data to the underlying stream. nsbufferedoutputstream @mozilla.org/network/buffered-output-stream;1 nsibufferedoutputstream .init(stream, buffersize) binary write binary data to the underlying stream, in "big-endian" order. nsbinaryoutputstream @mozilla.org/binaryoutputstream;1 nsibinaryoutputstream .setoutputstream(stream) object ...
...And 2 more matches
nsIWindowWatcher
; void unregisternotification(in nsiobserver aobserver); attributes attribute type description activewindow nsidomwindow the watcher serves as a global storage facility for the current active (front most non-floating-palette-type) window, storing and returning it on demand. users must keep this attribute current, including after the topmost window is closed. this attribute will be null if the active window is not an nsidomwindow; for example, if the active window is an alert. methods getchromeforwindow() retrieve the chrome window mapped to the given dom window. nsiwindowwatcher keeps a list of all top-level dom windows currently open, along with their corresponding chrome interfaces. since dom windows lack a (public) means of retrieving t...
... "aboutmyextension", "chrome,centerscreen", null); note: versions of gecko before gecko 2.0 would ignore some of the chrome flags when opening a chrome window without an opener window, instead behaving as if the "all" flag was present. this was fixed in bug 509124. registernotification() clients of this service can register themselves to be notified when a window is opened or closed (added to or removed from this service). this method adds an nsiobserver to the list of objects to be notified. void registernotification( in nsiobserver aobserver ); parameters note: be careful about generating open/close window events inside nsiobserver.observe(). for example the following code will block the system because it will open windows continuously: function mywindowobserver()...
... adata - not used. setwindowcreator() set the window creator callback...
...And 2 more matches
nsIZipReader
derbird 10.0 / seamonkey 2.7), the nsizipreader api supports a limited 8 bit code page usage. all functions now pass the filenames (both in and out) as autf8string. so you can now read and extract what you wrote with nsizipwriter. if you show filenames from the findentries() result in the user interface, the character matching is only fine on utf-8 zip archives. ...
...0 void test(in autf8string aentryname); void test(in string aentryname); obsolete since gecko 10 attributes attribute type description file nsifile the file that represents the zip with which this zip reader was initialized. read only. manifestentriescount pruint32 the number of entries in the manifest. read only. methods close() closes a zip reader. subsequent attempts to extract() files or read from its input stream will result in an error. subsequent attempts to access a nsizipentry obtained from this zip reader will cause unspecified behavior. void close(); parameters none. example demonstrating this function: list contents of xpi and read file contents extract() extracts a zip entry into a local file spec...
...p entry. return value boolean value, true if the zip entry exists, false is it does not exist. init() obsolete since gecko 1.9 (firefox 3) initializes a zip reader after construction. void init( in nsifile zipfile ); parameters zipfile zip file to initialize. open() opens a zip file for reading. it is allowed to open with another file, but it needs to be closed first with close(). note: prior to gecko 1.9 you first had to call init()"." void open( in nsifile zipfile ); parameters zipfile the zip file to open. example demonstrating this function: list contents of xpi and read file contents openinner() opens a zip file inside a zip file for reading. void openinner( in nsizipreader zipreader, in autf8string zipentry ); parameters ...
...And 2 more matches
nsIZipWriter
nel, in boolean aqueue); void addentrydirectory(in autf8string azipentry, in prtime amodtime, in boolean aqueue); void addentryfile(in autf8string azipentry, in print32 acompression, in nsifile afile, in boolean aqueue); void addentrystream(in autf8string azipentry, in prtime amodtime, in print32 acompression, in nsiinputstream astream, in boolean aqueue); void close(); nsizipentry getentry(in autf8string azipentry); boolean hasentry(in autf8string azipentry); void open(in nsifile afile, in print32 aioflags); void processqueue(in nsirequestobserver aobserver, in nsisupports acontext); void removeentry(in autf8string azipentry, in boolean aqueue); attributes attribute type description ...
...ata. aqueue if true, the operation is queued for later execution. if false, the operation is performed immediately. will be performed when processqueue() is called. exceptions thrown ns_error_not_initialized no zip file is open. ns_error_file_already_exists the specified path already exists in the zip file. ns_error_in_progress the zip writer is already performing another operation. close() closes the zip file. void close(); parameters none. exceptions thrown ns_error_not_initialized no zip file is open. ns_error_in_progress the zip writer is already performing another operation. other errors may be thrown if a failure to complete the zip file occurs. getentry() returns a specified entry or null if there is no such entry in the current zip file. nsizipentry getent...
...ady in progress. ns_error_file_not_found no entry with the given path exists. other errors may occur if updating the zip file fails. ...
...And 2 more matches
Zombie compartments
all the trailing gunk (e.g. "plugins/like.php?..."). this trailing gunk can be misleading and you shouldn't pay too much attention to it. for example, if i open https://bugzilla.mozilla.org/show_bug.cgi?id=668871 in one tab, then compartment(https://bugzilla.mozilla.org/show_bug.cgi?id=668871) will show up in about:memory. if i then open https://bugzilla.mozilla.org/show_bug.cgi?id=700547 and close the first tab, the same compartment will continue to be used. so i'll end up with a compartment whose name doesn't match the only page open from that origin. this can be confusing at first, so be ready for it. when are compartments destroyed? compartments are destroyed when they are garbage collected. this happens some time after the last reference to them disappears. this means there can b...
...tment will continue to be used. so i'll end up with a compartment whose name doesn't match the only page open from that origin. this can be confusing at first, so be ready for it. when are compartments destroyed? compartments are destroyed when they are garbage collected. this happens some time after the last reference to them disappears. this means there can be a delay between a page being closed and its compartments disappearing. explicitly minimizing the memory (a couple of times), i.e. running the garbage collector, with the corresponding about:memory button will help. zombie compartments sometimes, due to bugs in firefox, the add-on sdk and/or add-ons, compartments are created that are never destroyed. these are a particular kind of memory leak, and they cause firefox's memory usa...
...e compartments sometimes, due to bugs in firefox, the add-on sdk and/or add-ons, compartments are created that are never destroyed. these are a particular kind of memory leak, and they cause firefox's memory usage to increase gradually over time, slowing it down and making it more likely to crash. reactive checking if you look at about:memory and you see a compartment for www.foo.com, but you closed your last www.foo.com tab a while ago, there's a good chance you're seeing a zombie compartment. follow these steps to make a more conclusive diagnosis. restart the browser. open the page that you think might cause a zombie compartment. open about:memory in another tab to confirm that the relevant compartment is present. close the first page. minimize memory usage and remeasure in about:...
...And 2 more matches
Drawing shapes with canvas - Web APIs
nge the color and stroke style of the rendered shapes. unlike the path functions we'll see in the next section, all three rectangle functions draw immediately to the canvas. drawing paths now let's look at paths. a path is a list of points, connected by segments of lines that can be of different shapes, curved or not, of different width and of different color. a path, or even a subpath, can be closed. to make shapes using paths, we take some extra steps: first, you create the path. then you use drawing commands to draw into the path. once the path has been created, you can stroke or fill the path to render it. here are the functions used to perform these steps: beginpath() creates a new path. once created, future drawing commands are directed into the path and used to build the pa...
...you create the path. then you use drawing commands to draw into the path. once the path has been created, you can stroke or fill the path to render it. here are the functions used to perform these steps: beginpath() creates a new path. once created, future drawing commands are directed into the path and used to build the path up. path methods methods to set different paths for objects. closepath() adds a straight line to the path, going to the start of the current sub-path. stroke() draws the shape by stroking its outline. fill() draws a solid shape by filling the path's content area. the first step to create a path is to call the beginpath(). internally, paths are stored as a list of sub-paths (lines, arcs, etc) which together form a shape. every time this method is called, t...
...r on a newly created canvas, the first path construction command is always treated as a moveto(), regardless of what it actually is. for that reason, you will almost always want to specifically set your starting position after resetting a path. the second step is calling the methods that actually specify the paths to be drawn. we'll see these shortly. the third, and an optional step, is to call closepath(). this method tries to close the shape by drawing a straight line from the current point to the start. if the shape has already been closed or there's only one point in the list, this function does nothing. note: when you call fill(), any open shapes are closed automatically, so you don't have to call closepath(). this is not the case when you call stroke(). drawing a triangle for example...
...And 2 more matches
IDBDatabase - Web APIs
the connected database. idbdatabase.version read only a 64-bit integer that contains the version of the connected database. when a database is first created, this attribute is an empty string. idbdatabase.objectstorenames read only a domstringlist that contains a list of the names of the object stores currently in the connected database. methods inherits from: eventtarget idbdatabase.close() returns immediately and closes the connection to a database in a separate thread. idbdatabase.createmutablefile() creates a file handle, allowing files to be stored inside an indexeddb database. idbdatabase.createobjectstore() creates and returns a new object store or index. idbdatabase.deleteobjectstore() destroys the object store with the given name in the connected database, along wit...
...n) containing the idbtransaction.objectstore method, which you can use to access your object store. runs in a separate thread. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. abort fired when when a transaction is aborted and bubbles up to the connection object. also available via the onabort property. close fired when the database connection is unexpectedly closed. also available via the onclose property. error fired when a request returns an error and the event bubbles up to the connection object. also available via the onerror property. versionchange fired when a database structure change was requested. also available via the onversionchange property. example in the following code snippet,...
... yeschrome android full support 25firefox android full support 22opera android full support 14safari ios full support 8samsung internet android full support 1.5closechrome full support 24 full support 24 no support 23 — 24prefixed prefixed implemented with the vendor prefix: webkitedge full support 12firefox full support 16 full support ...
...And 2 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
zooming among the best known camera effects is the zoom. zooming is performed in a physical camera by altering the focal length of the lens; this is the distance between the center of the lens itself and the camera's light sensors. thus, zooming doesn't actually involve moving the camera at all. instead, a zoom shot changes the magnification of the camera over time to make the area of focus seem closer to or farther away from the viewer, without actually physically moving the camera. a slow move can bring a sense of movement, ease, or focus to a scene, while a rapid zoom can create a sense of anxiety, surprise, or tension. because a zoom does not move the camera's position, the resulting effect is unnatural. the human eye doesn't have a zoom lens on it. we make things smaller or larger by mov...
...n further. human eyes typically have a horizontal field of view of around 135° (about 2.356 radians) and a vertical fov of about 180° (π or around 3.142 radians). making the camera's fov smaller reduces the arc that will be included in the viewport, thus enlarging that content when rendered to the view. there are differences between this and an optical zoom effect, but the result is generally close enough to get the job done. the following function returns a projection perspective matrix that integrates the specified field of view angle as well as the given near and far clipping plane distances: function createperspectivematrix(viewport, fovdegrees, nearclip, farclip) { const fovradians = fov * (math.pi / 180.0); const aspectratio = viewport.width / viewport.height; const transform...
...trix library's mat4.perspective() function to compute the perspective matrix. the perspective matrix encapsulates the field of view (technically, this is the vertical field of view), aspect ratio, and the near and far clipping planes within the 4x4 matrix transform, which is then returned to the caller. the near clipping plane is the distance in meters to a plane parallel to the display surface closer than which nothing gets drawn. any vertices which lie on the same side of that plane as the camera are not drawn. conversely, the far clipping plane is the distance in meters to a plane beyond which no vertices are drawn. to zoom using a scaling factor or percentage, you can map 1x (100% of normal size) to the largest value of fov you allow (which leads to the most content being visible), then ...
...And 2 more matches
Window - Web APIs
Web › API › Window
ng a web worker. xmlserializer converts a dom tree into xml or html source. properties this interface inherits properties from the eventtarget interface and implements properties from the windoworworkerglobalscope and windoweventhandlers mixins. note that properties which are objects (e.g.,. for overriding the prototype of built-in elements) are listed in a separate section below. window.closed read only this property indicates whether the current window is closed or not. window.console read only returns a reference to the console object which provides access to the browser's debugging console. window.controllers read only returns the xul controller objects for the current chrome window. window.customelements read only returns a reference to the customelementregistry objec...
...ys an alert dialog. window.blur() sets focus away from the window. window.cancelanimationframe() enables you to cancel a callback previously scheduled with window.requestanimationframe. window.cancelidlecallback() enables you to cancel a callback previously scheduled with window.requestidlecallback. window.clearimmediate() cancels the repeated execution set using setimmediate. window.close() closes the current window. window.confirm() displays a dialog with a message that the user needs to respond to. window.dump() writes a message to the console. window.find() searches for a given string in a window. window.focus() sets focus on the current window. window.getcomputedstyle() gets computed style for the specified element. computed style indicates the computed values of ...
...event handler for handled promise rejection events. window.onuserproximity an event handler property for user proximity events. event handlers implemented from elsewhere globaleventhandlers.onabort called when the loading of a resource has been aborted, such as by a user canceling the load while it is still in progress windoweventhandlers.onafterprint called when the print dialog box is closed. see afterprint event. windoweventhandlers.onbeforeprint called when the print dialog box is opened. see beforeprint event. windoweventhandlers.onbeforeunload an event handler property for before-unload events on the window. globaleventhandlers.onblur called after the window loses focus, such as due to a popup. globaleventhandlers.onchange an event handler property for change events on t...
...And 2 more matches
WritableStream - Web APIs
eam() creates a new writablestream object. properties writablestream.locked read only a boolean indicating whether the writablestream is locked to a writer. methods writablestream.abort() aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded. writablestream.close() closes the stream. writablestream.getwriter() returns a new instance of writablestreamdefaultwriter and locks the stream to that instance. while the stream is locked, no other writer can be acquired until this one is released. examples the following example illustrates several features of this interface. it shows the creation of the writablestream with a custom sink and an api-supplied ...
... creation of the writablestream with a custom sink and an api-supplied queueing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: true }); e...
...ultwriter.ready .then(() => { return defaultwriter.write(chunk); }) .then(() => { console.log("chunk written to sink."); }) .catch((err) => { console.log("chunk error:", err); }); }); // call ready again to ensure that all chunks are written // before closing the writer. ...
...And 2 more matches
WritableStreamDefaultWriter - Web APIs
the writablestreamdefaultwriter interface of the the streams api is the object returned by writablestream.getwriter() and once created locks the writer to the writablestream ensuring that no other streams can write to the underlying sink. constructor writablestreamdefaultwriter() creates a new writablestreamdefaultwriter object instance. properties writablestreamdefaultwriter.closedread only allows you to write code that responds to an end to the streaming process. returns a promise that fulfills if the stream becomes closed or the writer's lock is released, or rejects if the stream errors. writablestreamdefaultwriter.desiredsizeread only returns the desired size required to fill the stream's internal queue. writablestreamdefaultwriter.readyread only returns a ...
... size of the stream's internal queue transitions from non-positive to positive, signaling that it is no longer applying backpressure. methods writablestreamdefaultwriter.abort() aborts the stream, signaling that the producer can no longer successfully write to the stream and it is to be immediately moved to an error state, with any queued writes discarded. writablestreamdefaultwriter.close() closes the associated writable stream. writablestreamdefaultwriter.releaselock() releases the writer's lock on the corresponding stream. after the lock is released, the writer is no longer active. if the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed. writablestreamdefaultwriter...
...the creation of a writablestream with a custom sink and an api-supplied queuing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: tru...
...And 2 more matches
ARIA Test Cases - Accessibility
fact that this is an alert, the title and contents of the dialog, then place virtual focus or the real focus on the desired control (like a button). screen magnifier should show the focused button or emulate any other standard behavior found in notification dialogs in windows or respective operating systems. markup used: role="alert" aria-labeledby notes: in the uiuc test example, the 'close' button cannot recieve focus. results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 2 pass, 1 pass with known focus of the close button problem. ffd - i concur - - - voiceover (leopard) n/a n/a - fail voiceover (leopard) n/a n/a - fail window-eyes - - - ...
... fail orca - n/a - - combobox testcases: editable combo 2 dojo nightly build (combobox) dojo nightly build (combobox with auto complete) expected at behavior: on focus, screen reader announces the label, the role and the current content of the combobox. if the currently selected option is changed the new option should be spoken whether the list is open or closed. when the combo box is opened or closed, the new open/closed state should be spoken. markup used: notes: results: at firefox ie opera safari jaws 9 - - n/a n/a jaws 10 fail. label and current content as well as role are spoken, also when typing in a new value, that gets reflected. but when dropping down the lists of states in either exa...
...ad a menu item, the screen reader should announce the name. if it is a radio or checkbox menu item, the screen reader should indicate that it's checkable. if it has a submenu (aria-haspopup), the screen reader should indicate that as well. (mz) if a menu is dropped down, the activation of the new menu should be indicated and the focus tracked as it moves through the items. (mz) when the menu is closed, screen reader should indicate this along with the newly focused item. (mz) this may be the menu bar or higher level menu item, or a control that gains focus after the menu was closed after executing a command. (mz) if the menu caused a dialog to open, the dialog context should be given, just as with regular desktop applications. markup used: role="menubar", role="menu", role="menuitem", ...
...And 2 more matches
Using CSS gradients - CSS: Cascading Style Sheets
ly one is present, otherwise in the order of position from the left and position from the top. <div class="radial-gradient"></div> div { width: 120px; height: 240px; } .radial-gradient { background: radial-gradient(at 0% 30%, red 10px, yellow 30%, #1e90ff 50%); } sizing radial gradients unlike linear gradients, you can specify the size of radial gradients. possible values include closest-corner, closest-side, farthest-corner, and farthest-side, with farthest-corner being the default. example: closest-side for ellipses this example uses the closest-side size value, which means the size is set by the distance from the starting point (the center) to the closest side of the enclosing box. <div class="radial-ellipse-side"></div> div { width: 240px; height: 100px; } .radi...
...ide, with farthest-corner being the default. example: closest-side for ellipses this example uses the closest-side size value, which means the size is set by the distance from the starting point (the center) to the closest side of the enclosing box. <div class="radial-ellipse-side"></div> div { width: 240px; height: 100px; } .radial-ellipse-side { background: radial-gradient(ellipse closest-side, red, yellow 10%, #1e90ff 50%, beige); } example: farthest-corner for ellipses this example is similar to the previous one, except that its size is specified as farthest-corner, which sets the size of the gradient by the distance from the starting point to the farthest corner of the enclosing box from the starting point. <div class="radial-ellipse-far"></div> div { width: ...
...d as farthest-corner, which sets the size of the gradient by the distance from the starting point to the farthest corner of the enclosing box from the starting point. ...
...And 2 more matches
Cubic Bezier Generator - CSS: Cascading Style Sheets
_size + cx(0), ly(i)); if ((i == 0.5) || (i > 0.9)) { ctx.moveto(-2 * basic_scale_size + cx(0), ly(i)); ctx.filltext(math.round(i * 10) / 10, -3 * basic_scale_size + cx(0), cy(i) + 4); // limitation the constant 4 should be font size dependant } ctx.lineto(cx(0), ly(i)); } ctx.stroke(); ctx.closepath(); ctx.beginpath(); // draw the y axis label ctx.save(); ctx.rotate(-math.pi / 2); ctx.textalign = "left"; ctx.filltext("output (value ratio)", -cy(0), -3 * basic_scale_size + cx(0)); ctx.restore(); // draw the x axis ctx.moveto(cx(0), cy(0)); ctx.lineto(cx(0), cy(1)); ctx.textalign = "center"; f...
... // limitation the constant 4 should be dependant of the font size } ctx.lineto(lx(i), cy(0)); } // draw the x axis label ctx.textalign = "left"; ctx.filltext("input (time duration ratio)", cx(0), 4 * basic_scale_size + cy(0)); // limitation the constant 4 should be dependant of the font size ctx.stroke(); ctx.closepath(); // draw the bézier curve ctx.beginpath(); ctx.moveto(cx(0), cy(0)); ctx.strokestyle = 'blue'; ctx.beziercurveto(cx(x1), cy(y1), cx(x2), cy(y2), cx(1), cy(1)); ctx.stroke(); ctx.closepath(); // draw the p2 point (with a line to p0) ctx.beginpath(); ctx.strokestyle = 'red'; ctx.moveto(cx(x1), cy(y1))...
... ctx.moveto(cx(0), cy(0)); ctx.strokestyle = 'blue'; ctx.beziercurveto(cx(x1), cy(y1), cx(x2), cy(y2), cx(1), cy(1)); ctx.stroke(); ctx.closepath(); // draw the p2 point (with a line to p0) ctx.beginpath(); ctx.strokestyle = 'red'; ctx.moveto(cx(x1), cy(y1)); ctx.lineto(cx(0), cy(0)); ctx.stroke(); ctx.closepath(); ctx.beginpath(); ctx.moveto(cx(x1), cy(y1)); ctx.arc(cx(x1), cy(y1), radius, 0, 2 * math.pi); ctx.stroke(); ctx.fillstyle = 'white'; ctx.fill(); ctx.closepath(); // draw the p3 point (with a line to p1) ctx.beginpath(); ctx.strokestyle = 'red'; ctx.moveto(cx(x2), cy(y2)); ctx.lineto(cx(1), cy...
...And 2 more matches
offset-path - CSS: Cascading Style Sheets
the offset-path css property specifies a motion path for an element to follow and defines the element's positioning within the parent container or svg coordinate system. ...
... url() references the id of an svg shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <basic-shape> specifies a css shape including circle(), ellipse(), inset(), polygon(), or path(). path() a path string defined with svg coordinate syntax. none specifies no motion path at...
...ged to offset-path because the property describes static positions, not motion. ...
...And 2 more matches
repeating-radial-gradient() - CSS: Cascading Style Sheets
defaults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. ...
...ircle (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. ...
...e (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. the possible values are: keyword description closest-side the gradient's ending shape meets the side of the box closest to its center (for circles) or meets both the vertical and horizontal sides closest to the center (for ellipses). closest-corner the gradient's ending shape is sized so that it exactly meets the closest corner of the box from its center. farthest-side similar to closest-side, except the ending shape is sized to meet the side of the box farthest from its center (or vertical and horizontal sides). farthest-corner the gradient's end...
...And 2 more matches
shape-outside - CSS: Cascading Style Sheets
wraps around the element's margin box, like usual. <shape-box> the float area is computed according to the shape of a float element's edges (as defined by the css box model). this can be margin-box, border-box, padding-box, or content-box. the shape includes any curvature created by the border-radius property (behavior which is similar to background-clip). ...
...e enclosed by the outside margin edge. the corner radii of this shape are determined by the corresponding border-radius and margin values. if the border-radius / margin ratio is 1 or more, then the margin box corner radius is border-radius + margin. if the ratio is less than 1, then the margin box corner radius is border-radius + (margin * (1 + (ratio-1)^3)). border-box defines the shape enclosed by the outside border edge. the shape follows the normal border radius shaping rules for the outside of the border. padding-box defines the shape enclosed by the outside padding edge. the shape follows the normal border radius shaping rules for the inside of the border. content-box defines the shape enclosed by the outside content edge. each corner radius of this box is the l...
... simple list. the list values interpolate as <length>, <percentage>, or calc() where possible. if list values are not one of those types but are identical (such as finding nonzero in the same list position in both lists), those values do interpolate. both shapes must use the same reference box. if both shapes are the same type, that type is ellipse() or circle(), and none of the radii use the closest-side or farthest-side keywords, interpolate between each value in the shape functions. if both shapes are of type inset(), interpolate between each value in the shape functions. if both shapes are of type polygon(), both polygons have the same number of vertices, and use the same <fill-rule>, interpolate between each value in the shape functions. in all other cases no interpolation occurs. ...
...And 2 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
, dashed, etc.), and so forth. border-color specifies a single color to use for every side of the element's border. border-left-color, border-right-color, border-top-color, and border-bottom-color lets you set the color of the corresponding side of the element's border. border-block-start-color and border-block-end-color with these, you can set the color used to draw the borders which are closest to the start and end of the block the border surrounds. in a left-to-right writing mode (such as the way english is written), the block start border is the top edge and the block end is the bottom. this differs from the inline start and end, which are the left and right edges (corresponding to where each line of text in the box begins and ends). border-inline-start-color and border-inline-end-...
...rounds. in a left-to-right writing mode (such as the way english is written), the block start border is the top edge and the block end is the bottom. this differs from the inline start and end, which are the left and right edges (corresponding to where each line of text in the box begins and ends). border-inline-start-color and border-inline-end-color these let you color the edges of the border closest to to the beginning and the end of the start of lines of text within the box. which side this is will vary depending on the writing-mode, direction, and text-orientation properties, which are typically (but not always) used to adjust text directionality based on the language being displayed. for example, if the box's text is being rendered right-to-left, then the border-inline-start-color is ap...
...r a given color, such as the most intense blue that can be represented by the user's screen. this is the hue (h) component: a value representing the angle around the color wheel for the vivid hue we want to use as our base. then select a greyscale paint that corresponds how bright you want the color to be; this is the luminance. do you want it to be very bright and nearly white, or very dark and closer to black, or somewhere in between? this is specified using a percentage, where 0% is perfectly black and 100% is perfectly white. (regardless of the saturation or hue). in between values are a literal grey area. now that you have a grey paint and a perfectly vivid color, you need to mix them together. the saturation (s) component of the color indicates what percentage of the final color should ...
...And 2 more matches
<details>: The Details disclosure element - HTML: Hypertext Markup Language
Web › HTML › Element › details
the html details element (<details>) creates a disclosure widget in which information is visible only when the widget is toggled into an "open" state. a summary or label can be provided using the <summary> element. a disclosure widget is typically presented onscreen using a small triangle which rotates (or twists) to indicate open/closed status, with a label next to the triangle. if the first child of the <details> element is a <summary>, the contents of the <summary> element are used as the label for the disclosure widget. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the common use of a triangle which rot...
...stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: the common use of a triangle which rotates or twists around to represent opening or closing the widget is why these are sometimes called "twisties." a <details> widget can be in one of two states. the default closed state displays only the triangle and the label inside <summary> (or a user agent-defined default string if no <summary>). this might look like the following: here we see a standard disclosure widget with the label "system requirements", in its default closed state. when the user clicks on the widget or focuses it then presses the space bar, it "twists" open, revealing its contents: from th...
...default string if no <summary>). this might look like the following: here we see a standard disclosure widget with the label "system requirements", in its default closed state. when the user clicks on the widget or focuses it then presses the space bar, it "twists" open, revealing its contents: from there, you can use css to style the disclosure widget, and you can programmatically open and close the widget by setting/removing its open attribute. by default when closed, the widget is only tall enough to display the disclosure triangle and summary. when open, it expands to display the details contained within. note: unfortunately, at this time there's no built-in way to animate the transition between open and closed. fully standards-compliant implementations automatically apply the cs...
...And 2 more matches
Functions - JavaScript
it somewhere in the scope from which you wish to call it. see also the exhaustive reference chapter about javascript functions to get to know the details. defining functions function declarations a function definition (also called a function declaration, or function statement) consists of the function keyword, followed by: the name of the function. a list of parameters to the function, enclosed in parentheses and separated by commas. the javascript statements that define the function, enclosed in curly brackets, {...}. for example, the following code defines a simple function named square: function square(number) { return number * number; } the function square takes one parameter, called number. the function consists of one statement that says to return the parameter of the fun...
...gin: 2 // begin: 1 // begin: 0 // end: 0 // end: 1 // end: 2 // end: 3 nested functions and closures you may nest a function within another function. the nested (inner) function is private to its containing (outer) function. it also forms a closure. a closure is an expression (most commonly, a function) that can have free variables together with an environment that binds those variables (that "closes" the expression). since a nested function is a closure, this means that a nested function can "inherit" the arguments and variables of its containing function. in other words, the inner function contains the scope of the outer function. to summarize: the inner function can be accessed only from statements in the outer function. the inner function forms a closure: the inner function can ...
...tions to work with. the functions do not even have to be assigned to a variable, or have a name. var getcode = (function() { var apicode = '0]eal(eh&2'; // a code we do not want outsiders to be able to modify... ...
...And 2 more matches
MathML attribute reference - MathML
not. unimplemented altimg altimg-width altimg-height altimg-valign alttext <math> visual and textual fall-back options. bevelled <mfrac> specifies the style how the fraction should be displayed. deprecated. use u+2044 (fraction slash) instead. unimplemented charalign <mstack> specifies the horizontal alignment of digits. close <mfenced> a string for the closing delimiter. columnalign <mtable>, <mtd>, <mtr>, <mlabeledtr> specifies the horizontal alignment of table cells. columnlines <mtable> specifies table column borders. columnspacing <mtable> specifies the space between table columns. columnspan <mtd> a non-negative integer value that indicates over ho...
... to have the same total height. unimplemented equalrows <mtable> a boolean value indicating whether to force all rows to have the same total height. fence <mo> a boolean value specifying whether the operator is a fence (such as parentheses). there is no visual effect for this attribute. unimplemented form <mo> specifies the role of the operator in an enclosed expression. frame <mtable> specifies borders of an entire <mtable>. possible values are: none (default), solid and dashed. framespacing <mtable> specifies additional space added between the table and frame. unimplemented groupalign <maligngroup>, <mtable>, <mtd>, <mtr> height <mglyph>, <mpadded>, <mspace> specifies the desired height. ...
...<mfrac> the thickness of the horizontal fraction line. unimplemented location <mscarries> unimplemented longdivstyle <mlongdiv> controls the style of the long division layout. lspace <mo>, <mpadded> the amount of space before the operator (see length for values and units). lquote <ms> the opening quote character (depends on dir) to enclose the content. the default value is "&quot;". mathbackground all the background color. you can use #rgb, #rrggbb and html color names. mathcolor all the text color. you can use #rgb, #rrggbb and html color names. mathsize <mi>, <mn>, <mo>, <ms>, <mtext> the size of the content. mathvariant <mi>, <mn>, <mo>, <ms>, <mtext> the logical class ...
...And 2 more matches
Web audio codec guide - Web media technologies
ormat and contents, and the codec and its configuration during the encoding process. for each factor that affects the encoded audio, there is a simple rule that is nearly always true: because the fidelity of digital audio is determined by the granularity and precision of the samples taken to convert it into a data stream, the more data used to represent the digital version of the audio, the more closely the sampled sound will match the source material. the effect of source audio format on encoded audio output because encoded audio inherently uses fewer bits to represent each sample, the source audio format may actually have less impact on the encoded audio size than one might expect. however, a number of factors do still affect the encoded audio quality and size. the table below lists a numb...
...n out of imperfect or noisy audio. they strip away audio frequencies that aren't used much, tolerate loss of precision in the decoded output, and use other methods to lose audio content, quality, and fidelity to produce smaller encoded media. upon decoding, the output is, to varying degrees, still understandable. the specific codec used—and the compression configuration selected—determine how close to the original, uncompressed audio signal the output seems to be when heard by the human ear. because of the differences in how lossy codecs work compared to lossless ones, especially the fact that lossless ones have to be much more conservative with their compression, lossy codecs nearly always result in significantly smaller compressed audio than lossless codecs do. generally speaking, the m...
...nating audio that falls outside a given frequency range. there is a correlation between the sample rate and the maxium sound frequency that can be represented by a waveform represented by a codec. at a theoretical level, the maximum frequency a codec can represent is the sample rate divided by two; this frequency is called the nyquist frequency. in reality, the maximum is slightly lower, but it's close. the audio frequency bandwidth comes into play especially vividly when a codec is designed or configured to represent human speech rather than a broad range of sounds. human speech generally resides within the audio frequency range of 300 hz to 18 khz. however, the vast majority of human vocalizations exist in the range 300 hz to 8 khz, and you can capture enough of human vocalizations in the fr...
...And 2 more matches
d - SVG: Scalable Vector Graphics
Web › SVG › Attribute › d
ble yes path commands path commands are instructions that define a path to be drawn. each command is composed of a command letter and numbers that represent the command parameters. svg defines 6 types of path commands, for a total of 20 commands: moveto: m, m lineto: l, l, h, h, v, v cubic bézier curve: c, c, s, s quadratic bézier curve: q, q, t, t elliptical arc curve: a, a closepath: z, z note: commands are case-sensitive. an upper-case command specifies absolute coordinates, while a lower-case command specifies coordinates relative to the current position. it is always possible to specify a negative value as an argument to a command: negative angles will be anti-clockwise; absolute negative x and y values are interpreted as negative coordinates; relative negativ...
...if the two points are at different coordinates, a straight line is drawn between those two points. note: the appearance of a shape c...
...ith which the arc is drawn --> <path fill="none" stroke="red" d="m 6,10 a 6 4 10 1 0 14,10" /> <path fill="none" stroke="lime" d="m 6,10 a 6 4 10 1 1 14,10" /> <path fill="none" stroke="purple" d="m 6,10 a 6 4 10 0 1 14,10" /> <path fill="none" stroke="pink" d="m 6,10 a 6 4 10 0 0 14,10" /> </svg> closepath closepath instructions draw a straight line from the current position to the first point in the path. command parameters notes z, z close the current subpath by connecting the last point of the path with its initial point. if the two points are at different coordinates, a straight line is drawn between those two points. note: the appearance of a shape closed with ...
...And 2 more matches
remote/parent - Archive of obsolete content
t for enumerating existing processes and then listening for attach events. properties port an event emitter that sends messages to and receives messages from all processes. events attach event emitted when a new process is started. the event handler is called with a process representing the new process. detach event emitted when a process disconnects from the application. it may have been closed normally or it may have crashed. the event handler is called with the process that detached. frames a list of the content frames across all processes. each element in this list is a frame. listen to attach and detach events to hear as frames are created and destroyed. const { frames } = require("sdk/remote/parent"); frames.on("attach", function(frame) { console.log("frame is attached: " + ...
...e. this is a shortcut for enumerating existing frames and then listening for attach events. properties port an event emitter that sends messages to and receives messages from all frames. events attach event emitted when a new frame is created. the event handler is called with a frame representing the new frame. detach event emitted when a frame is removed. for example, the user might have closed a content tab. the event handler is called with the frame that detached. process a process provides a way to communicate with code running in one of the application's processes. properties port an event emitter that can be used to send and receive events to and from code running in the process. isremote a boolean property that indicates whether the attached process is remote from the main...
...to communicate with code running in one of the application's processes. properties port an event emitter that can be used to send and receive events to and from code running in the process. isremote a boolean property that indicates whether the attached process is remote from the main process. events detach event emitted when this process disconnects from the application. it may have been closed normally or it may have crashed. frame a frame provides a way to pass frame specific messages to code in other processes. the frame this relates to may be in any of the application's processes. properties port an event emitter that can be used to send and receive frame specific events to and from code running in any process. frameelement the dom element that displays this frame in the mai...
... ...
File I/O - Archive of obsolete content
tream;1"]. createinstance(components.interfaces.nsiconverterinputstream); fstream.init(file, -1, 0, 0); cstream.init(fstream, "utf-8", 0, 0); // you can use another encoding here if you wish let (str = {}) { let read = 0; do { read = cstream.readstring(0xffffffff, str); // read as much as we can and put it in str.value data += str.value; } while (read != 0); } cstream.close(); // this closes fstream alert(data); reading line by line note: the sample code below does not handle text with non-ascii characters. see reading textual data details on how to read text from other character sets. // open an input stream from file var istream = components.classes["@mozilla.org/network/file-input-stream;1"]. createinstance(components.interfaces.nsifileinputstre...
...ream = components.classes["@mozilla.org/network/file-input-stream;1"]. createinstance(components.interfaces.nsifileinputstream); istream.init(file, 0x01, 0444, 0); istream.queryinterface(components.interfaces.nsilineinputstream); // read lines into array var line = {}, lines = [], hasmore; do { hasmore = istream.readline(line); lines.push(line.value); } while(hasmore); istream.close(); // do something with read data alert(lines); reading a binary file for instance, to get the data in a png file: var ios = components.classes["@mozilla.org/network/io-service;1"]. getservice(components.interfaces.nsiioservice); var url = ios.newuri(afileurl, null, null); if (!url || !url.schemeis("file")) throw "expected a file url."; var pngfile = url.queryinterface(components...
... "r" or "w" usually. // if you are sure there will never ever be any non-ascii text in data you can // also call fostream.write(data, data.length) directly var converter = components.classes["@mozilla.org/intl/converter-output-stream;1"]. createinstance(components.interfaces.nsiconverteroutputstream); converter.init(fostream, "utf-8", 0, 0); converter.writestring(data); converter.close(); // this closes fostream note: the file status flags used in the nsifileoutputstream.init() function are documented in pr_open. for more information refer directly to nsprpub/pr/include/prio.h writing a binary file for example, here we can write png data to a file. // pngbinary already exists var afile = components.classes["@mozilla.org/file/local;1"]. createinstance(components...
...ype, 0600); var stream = components.classes["@mozilla.org/network/safe-file-output-stream;1"]. createinstance(components.interfaces.nsifileoutputstream); stream.init(afile, 0x04 | 0x08 | 0x20, 0600, 0); // readwrite, create, truncate stream.write(pngbinary, pngbinary.length); if (stream instanceof components.interfaces.nsisafeoutputstream) { stream.finish(); } else { stream.close(); } more there are more methods and properties on nsifile and nsilocalfile interfaces; please refer to their documentation for more details. those methods/properties are mostly self-explanatory, so we haven't included examples of using them here. ...
Adding windows and dialogs - Archive of obsolete content
property: let somevalue = window.arguments[0]; let returnvalue = window.arguments[1]; // returnvalue.accepted = true; // returnvalue.result = "something"; the parameter named returnvalue is an object that the dialog will modify to reflect what the user did in it. this is the simplest way to have the dialog return something to its opener. note that the opener will wait until the dialog is closed. this means the opendialog function call will not return until the dialog has been closed by the user. common dialogs and the prompt service there are several types of dialogs that are fairly common, so there are ways to create them easily without having to reinvent the wheel and write all their xul and js code all over again. whenever you need a new dialog, you should ask yourself if it can b...
...only.xul"> carefully read the specification of the dialog element. you'll see that you can choose from a wide variety of buttons, associate any action you need to them, override their labels, and even add completely customized extra buttons. all of this without having to worry about your dialog looking odd in some operating systems. the only constant rule is that clicking on ok and cancel will close the dialog unless your associated function returns false. you should avoid returning false, though, specially with the cancel button. dialogs in general should be easy to dismiss. your dialogs shouldn't have fixed dimensions because of potential localization problems. dialogs are sized to their contents and will generally work fine. however, there are cases where the dialog contents are genera...
...together. it's a box container with styling that is usually a visible border around its contents, so that it's clear what is being grouped together. it is frequently used with the caption element to associate the grouped elements with a title. the groupbox shouldn't be seen as an aesthetic device, but a logical one. if all you need is a border, use css. the groupbox element should be used when enclosed elements share some function which is separate from other elements or groups in the same window. it's also a useful accessibility feature, because screen readers will read the caption right before reading any text in its contents. you can change its style using css in case you don't want the borders to appear. see the firefox preferences window for an example of this: sections are defined using ...
... you can change its style using css in case you don't want the borders to appear. see the firefox preferences window for an example of this: sections are defined using groupbox elements, but their style is quite different from the default. attribute persistence user actions can change the state of your windows, such as selecting an option in a listbox, or entering text in a textbox. if the user closes and then reopens your window, all the controls are reset to their defaults, which may not be what you want. you need some way of remembering the user-manipulated attribute values so that the window reloads it last state when opened. most xul elements support the persist attribute, which has this exact function. you set the persist attribute with a space-separated list of attribute names, indica...
Tabbed browser - Archive of obsolete content
assumes the tab is opened by your extension, not by some other browser component. we can do re-use an arbitrary tab by attaching a custom attribute to it when we first open it. later, when we want to re-use that tab, we iterate over all open tabs looking for one which has our custom attribute. if such a tab exists, we change its url/uri and focus/select it. if no such tab exists (perhaps the user closed it or we never opened it in the first place), we create a new tab with our custom attribute. function openandreuseonetabperattribute(attrname, url) { var wm = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); for (var found = false, index = 0, tabbrowser = wm.getenumerator('navigator:browser').getnext().g...
...ab(url); newtab.setattribute(attrname, "xyz"); // focus tab tabbrowser.selectedtab = newtab; // focus *this* browser window in case another one is currently focused tabbrowser.ownerdocument.defaultview.focus(); } } the function can be called like so: openandreuseonetabperattribute("myextension-myattribute", "http://developer.mozilla.org/"). closing a tab this example closes the currently selected tab. gbrowser.removecurrenttab(); there is also a more generic removetab method, which accepts a xul tab element as its single parameter. changing active tab this moves one tab forward (to the right). gbrowser.tabcontainer.advanceselectedtab(1, true); this moves one tab to the left. gbrowser.tabcontainer.advanceselectedtab(-1, true); detecting page load see als...
... notification when a tab's attributes cha...
...r.tabcontainer; container.addeventlistener("tabopen", exampletabadded, false); container.addeventlistener("tabmove", exampletabmoved, false); container.addeventlistener("tabclose", exampletabremoved, false); // when no longer needed container.removeeventlistener("tabopen", exampletabadded, false); container.removeeventlistener("tabmove", exampletabmoved, false); container.removeeventlistener("tabclose", exampletabremoved, false); note: starting in gecko 1.9.1, there's an easy way to listen on progress events on all tabs. notification when a tab's attributes change requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) starting in gecko 2.0, you can detect when a tab's attributes change by listening for the tabattrmodified event. the attributes to which changes result i...
Monitoring downloads - Archive of obsolete content
note: the mozistorageconnection m...
...d real, status integer)"); dbconn.close(); }, this is fairly simple stuff. the download manager instance is cached into a member variable in the downloadlogger object for reuse later, and its addlistener() method is called to start listening for download status updates. the database file is opened, and an sqlite create table command is executed to create the table. finally, the database is closed. note: the mozistorageconnection method close() is being added to firefox 3 alpha 8; in prior versions of firefox, there is no way to explicitly close the database. instead, it is closed when the garbage collector disposes of the connection object. handling download state changes once the code above is run, our ondownloadstatechange() method is called whenever a download's state changes. this...
...file); statement = dbconn.createstatement("replace into items values " + "(?1, ?2, ?3, 0, 0.0, 0)"); statement.bindstringparameter(0, adownload.source.spec); statement.bindint64parameter(1, adownload.size); statement.bindint64parameter(2, adownload.starttime); statement.execute(); statement.reset(); dbconn.close(); break; // record the completion (whether failed or successful) of the download case components.interfaces.nsidownloadmanager.download_finished: case components.interfaces.nsidownloadmanager.download_failed: case components.interfaces.nsidownloadmanager.download_canceled: this.logtransfercompleted(adownload); break; } }, we're interested in four ...
...by looking for a record with both the same uri and start time, we properly support the case where the user downloads the same file multiple times. displaying the download log the do...
File object - Archive of obsolete content
ile.intput) do not support random access. file.hasautoflush force a flush on each line break? (readonly) file.position the file position. writing to the property moves the file pointer. file.isnative true if the file is backed by a native stdio file stream. (i.e. file.input, file.output, file.error or a pipeline) methods file.open() opens the file, specifying file mode and type. file.close() closes the file. file.remove() removes the file, provided it is not open. file.copyto() creates a verbatim copy of the file at a new location. file.renameto() removes the file. file.flush() flushes the operating system's write buffers for the file and blocks until any pending data has been committed to disk. file.seek() moves the file position pointer forward or backwards. file.read...
...ring() returns the canonical path to the file. file.tourl() returns a file:// url describing the file relative to the local file system. url is uri-encoded. ...
... url is uri-encoded. ...
... "text"); file.writeln("the quick brown fox jumped over the lazy dogs"); file.close(); example: reading from a file var data; var file = new file("myfile.txt"); file.open("read", "text"); data = file.readln(); file.close(); example: sending mail through a pipeline var mail = new file("|/usr/lib/sendmail foo@bar.com"); mail.writeln("i love javascript.\npipe support is especially good!"); mail.close(); ...
Reading from Files - Archive of obsolete content
e file 'sample.txt' within the user's home directory is retrieved. next, nsiscriptableio.newinputstream() is called to create a new input stream for reading from the file. this method will open the file and return a stream. naturally, if the file does not exist, an error will occur. you may wish to use nsifile.exists() to check if the file exists before opening it. in fact, it is a good idea to enclose file reading and writing operations within a try-catch block to capture any errors that might occur during the process. see file errors for a list of errors that might occur. the newinputstream method takes two arguments in this example. the first argument is the file to read from, and the second is a set of flags which control the reading. in this case, the 'text' flag is used which indicates th...
... encodings below for details about reading text in other encodings. there are several methods available to read from an input stream. the two most common for text files are the readstring and readline methods for reading a string and a line from the file respectively. var file = io.getfile("home", "sample.txt"); var stream = io.newinputstream(file, "text"); var str = stream.readstring(20); stream.close(); in this example, a text input stream is created for the file 'sample.txt'. the readstring method is called to read a 20 character string from the file. since the stream was just opened, the string will be read from the beginning of the file. a further read from the file will read additional characters after the first 20. the readstring takes one argument, the number of characters to read from...
...may not do, for instance if the end of the file was reached. this doesn't trigger an error, and the string will just be returned containing as many characters as are available. you can use the available method to check if data is available for reading: var file = io.getfile("home", "sample.txt"); var stream = io.newinputstream(file, "text"); var str = stream.readstring(stream.available()); stream.close(); in this example, the available method is called to determine the number of available bytes for reading. note that this method returns the number of bytes available, not the number of characters available, because the file hasn't been read and parsed yet, so the actual number of characters isn't known yet. fortunately as a character is always at least one byte long in the default utf-8 encodin...
...entire contents of the file into a single string. the available method returns 0 if there is no more data to read, so you could use a loop to read a number of strings. this example keeps reading 10 character strings from a file until there is no more data to read. note that the last string read may be less than ten characters long. while(stream.available()) output += stream.readstring(10); the close method is used at the end to close the stream when you are finished reading from it. you should always strive to close a stream when you have finished reading or writing to it to ensure that it doesn't remain open longer than necessary. reading lines the readline method may be used to read a line from the file. this method doesn't take a count of characters to read but instead keeps reading until...
PopupKeys - Archive of obsolete content
lowing table lists the keys that are checked, and what the menu keyboard listener does in response: cursor up/down move the highlight within the menu up or down, wrapping around if necessary. on linux and the macintosh, disabled items within the menu are skipped over when navigating with the cursor keys. cursor left/right when a menu is selected, cursor right opens the menu, while a cursor left closes a menu. in a menubar, cursor left and right will cycle between top level menus. home/end move the highlight to the beginning or the end of the menu, selecting the first or last item. enter/return activate the currently highlighted item. if a menuitem is selected, this will close the menu and fire the menuitem's command event. if a menu is selected, the menu will open. escape closes the menu. if ...
... when letter keys are pressed, the accesskeys within the menu are selected. ...
... when letter keys are pressed, the accesskeys within the menu are selected. ...
...tem within the menu, items that don't have access keys can be selected if the key pressed corresponds to the first letter of the label. other keys are ignored by the menu key listener, however, the event does not propagate to the main window. this is because the key listener is a capturing listener attached to the document. for a panel, the only key that is handled by default is the escape key to close the panel. the other keys do not apply. focus in popups a menu does not take the keyboard focus. the menu key listener described above captures key events on the document. thus, a key listener added to a <menupopup> will not receive any key events. instead, you must add a capturing key listener to the document or window if you want to listen for keys pressed within a menu. note that the last arg...
Splitters - Archive of obsolete content
resizing of the elements that come before it and the elements that come after it in the same box. when a splitter is placed inside a horizontal box, it will allow resizing horizontally. when a splitter is placed inside a vertical box, it will allow resizing vertically. the syntax of a splitter is as follows: <splitter id="identifier" state="open" collapse="before" resizebefore="closest" resizeafter="closest"> the attributes are as follows: id the unique identifier of the splitter. state indicates the state of the splitter. set this to open, the default, to have the split panel initially open, or set it to collapsed to have one of the panels shrunk down (collapsed) and the other occupying all of the space. collapse this indicates which side of the panel sho...
...icked or set into a collapsed state. set this to before for the element before the splitter, or after for the element after the splitter. if you set this to none, which is also the default, the splitter grippy does not collapse when clicked. resizebefore when the splitter is dragged, the elements to the left (or above) resize. this attribute indicates which element should resize. set this to closest to have the element immediately to the left of the splitter resize. set this to farthest to have the element that is the farthest away from the splitter to the left resize. (the first element in the box). the default value is closest. resizeafter when the splitter is dragged, the elements to the right (or below) resize. this attribute indicates which element should resize. set this to clos...
...lement immediately to the right of the splitter resize. set this to farthest to have the element that is the farthest away from the splitter to the right resize. (the last element in the box). this attribute can also be set to grow, in which case the elements to the right of the splitter do not change size when the splitter is dragged, but instead the entire box changes size. the default value is closest. if you set the collapse attribute, you should also add a grippy element inside the splitter which the user can use to collapse the element. the width and height attributes of the elements next the splitter are adjusted when the splitter is dragged. the exact element depends on the resizebefore and resizeafter attributes. splitter example an example would be helpful here: example 1 : sour...
...e splitter and the remaining frames would shuffle to the left. the splitter grippy is drawn centered inside the splitter. the splitter has been given a resizeafter value of farthest. this means that when the splitter is dragged, the farthest element after it will change size. in this case, frame 4 will change size. a value has not been specified for resizebefore so it will default to a value of closest. in this case, there is only one frame before the splitter, so frame 1 will change size. frames 2 and 3 will only change size if you drag the splitter far enough to the right that frame 4 has reached its minimum size. this image shows the 4 panels with the splitter in a collapsed state. this image shows the 4 panels with the splitter resized to the right. notice how the middle two panels...
XUL Event Propagation - Archive of obsolete content
ozilla.org/keymaster/gatekeeper/there.is.only.xul" oncommand="alert('window handler')"> <vbox> <vbox style="background-color: lightgrey;" oncommand="alert('box handler')"> <menu class="menu" label="file" oncommand="alert('menu handler')"> <menupopup> <menuitem oncommand="alert('new item alert')" label="new" /> <menuitem label="open" /> <menuitem oncommand="alert('close handler')" label="close" /> </menupopup> </menu> <menu class="menu" label="edit"> <menupopup> <menuitem oncommand="alert('edit source handler')" label="edit source" /> <menuitem label="reload" /> <menuitem label="view source" /> </menupopup> </menu> </vbox> <spring flex="1" /> </vbox> </window> in this file, the lowest-down, or "leaf" elements are t...
... the event handler in the menu finds out which menuitem was actually clicked and takes dif...
... the event handler in the menu finds out which menuitem was actually clicked and takes different actions accordingly. event capturing event capturing is the complement of event bubbling. ...
... the event handler in the menu finds out which menuitem was actually clicked and takes different actions accordingly. event capturing event capturing is the complement of event bubbling. ...
notification - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] the notification is used to display an informative message. it will normally be used as part of a notificationbox. the box includes a button which the user can use to close the box. attributes image, label, priority, persistence, type, value properties accessibletype, control, image, label, priority, persistence, type, value methods close examples <notification label="this is a warning"/> attributes image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no image appears. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if...
...at will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransientnotifications method does not remove them. this may be used to close a set of notifications as a group without affecting other notifications. priority type: integer numeric value that specifies the order in which the notifications appear. should be one of the constants described in the notificationbox's appendnotification method. type type: one of the values below indicates the type of notification, determined from the priority. info a no...
... related elements notificationbox ...
... related elements notificationbox ...
Using IO Timeout And Interrupt On NT - Archive of obsolete content
e on using netscape portable runtime's (nspr) io timeout and interrupt on windows nt 3.51 and 4.0. 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. in this memo we explain the problem this guideline is trying to work around and discuss its limitations. nspr io on nt the io model of nspr 2.0 is synchronous and blocking. a thread calling an io function is blocked until the io operation finishes, either due to a successful io completion or an error. if the io operation cannot complete before the specified timeout, t...
...ptor therefore, we need to cancel the outstanding overlapped io request before the thread exits. nt's <tt>cancelio()</tt> function would be ideal for this purpose. unfortunately, <tt>cancelio()</tt> is not available on nt 3.51. so we can't go this route as long as we are supporting nt 3.51. the only reliable way to cancel outstanding overlapped io request that works on both nt 3.51 and 4.0 is to close the file descriptor, hence the rule of thumb stated at the beginning of this memo. limitations this seemingly harsh way to force the completion of outstanding overlapped io request has the following limitations: it is difficult for threads to shared a file descriptor. for example, suppose thread a and thread b call <tt>pr_accept()</tt> on the same socket, and they time out at the same time. ...
...ated at the beginning of this memo. limitations this seemingly harsh way to force the completion of outstanding overlapped io request has the following limitations: it is difficult for threads to shared a file descriptor. for example, suppose thread a and thread b call <tt>pr_accept()</tt> on the same socket, and they time out at the same time. following the rule of thumb, both threads would close the socket. the first <tt>pr_close()</tt> would succeed, but the second <tt>pr_close()</tt> would be freeing freed memory. a solution that may work is to use a lock to ensure only one thread can be using that socket at all times. once there is a timeout or interrupt error, the file descriptor is no longer usable. suppose the file descriptor is intended to be used for the life time of the process...
...f interrupts when accessing such file descriptors. a related known bug is that timeout and interrupt don't work for <tt>pr_connect()</tt> on nt. this bug is due to a different limitation in our nt implementation. conclusions as long as we need to support nt 3.51, we need to program under the guideline that after an io timeout or interrupt error, the thread must make sure the file descriptor is closed before it exits. programs should also take care in sharing file descriptors and using io timeout or interrupt on files that need to stay open throughout the process. when we stop supporting nt 3.51, we can look into using nt 4's <tt>cancelio()</tt> function to cancel outstanding overlapped io requests when we get io timeout or interrupt errors. if <tt>cancelio()</tt> really works as advertised, ...
Using JavaScript Generators in Firefox - Archive of obsolete content
or later. you can opt in in html as follows: <script type="text/javascript;version=1.7" src="myscript.js"></script> then your myscript.js file might look like this: // need to stash the generator in a global variable. var generator; // simple event listener function to pass the received event to the generator. ...
...pt.js"></script> then your myscript.js file might look like this: // need to stash the generator in a global variable. var generator; // simple event listener function to pass the received event to the generator. function grabevent(event) { generator.send(event); } // when we're all done we can close the generator, but that must happen outside // of the generator so we use a timeout. ...
... this: // need to stash the generator in a global variable. var generator; // simple event listener function to pass the received event to the generator. function grabevent(event) { generator.send(event); } // when we're all done we can close the generator, but that must happen outside // of the generator so we use a timeout. ...
... yield; } generator = databaseoperation(); generator.next(); ...
Common causes of memory leaks in extensions - Extensions
this page explains coding patterns that cause extension to cause memory leaks. causes of zombie compartments zombie compartments are a particular kind of memory leak. all zombie compartments in extensions are caused by a failure to release resources appropriately in certain circumstances, such as when a window is closed, a page unloads, or an extension is disabled or removed. while bug 695480 should prevent most of these compartment leaks, add-ons still need to be aware of the practices that caused these leaks, as the fix causes many add-ons which would have otherwise caused a leak to instead throw errors when attempting to access nodes from documents which no longer exist. storing references to window objects and dom nodes the most common problem is extensions holding onto referen...
...om nodes the most common problem is extensions holding onto references to content windows for too long. for example, in xul overlay code: var contentwindows = []; function inbrowserxuloverlay(contentwindow) { // forgetting or failing to pop the content window thing again contentwindows.push(contentwindow); } this will keep the content window compartments alive until the browser window is closed. users often only open a single browser window per session and use tabs, in which case the leaked compartments will live for the whole life of the session. a similar problem is holding onto window objects or dom nodes (such as window.document) for too long by storing them in a javascript module. for example: var windows = []; function injavascriptcodemodule(window) { // forgetting or failin...
...the interval (or timer) would be destroyed as soon as the document unloads, in the same way that event listeners are automatically destroyed. however, while this is still true, the window.setinterval() in the example originates from the outer chrome window (browser.xul) and not from the content window. hence the interval will only be destroyed when the outer window is unloaded (i.e. when the user closes the whole browser window) but not when the content window unloads (i.e. when the user closes the tab). the interval function in the example would still hold a reference to contentdoc, therefore leaking the content document and the associated window and compartment. if your add-on makes use of long-lived timeouts or uses window.setinterval(), you need to take special care to ensure your code won...
...y. the following example shows how to unload your modules again (bootstrap.js): components.utils.import("resource://gre/modules/services.jsm"); function startup(data, reason) { // this assumes your add-on did register some chrome components.utils.import("chrome://myaddon/content/mymodule.jsm"); } function shutdown(data, reason) { // no need to do regular clean up when the application is closed // unless you need to break circular references that might negatively // impact the shutdown process. if (reason == app_shutdown) return; // your add-on needs to unload all modules it ships and imported! components.utils.unload("chrome://myaddon/content/mymodule.jsm"); } note: modules not belonging to your add-on — such as services.jsm — should not be unloaded by your add-on, as...
What text editors are available? - Learn web development
ular editors: editor licence price os support doc. ...
... atom mit/bsd free windows, mac, linux forum online manual yes bluefish gpl 3 free windows, mac, linux mailing list, wiki online manual yes brackets mit/bsd free windows, mac, linux forum, irc github wiki yes coda closed source $99 mac twitter, forum, e-mail ebook yes codelobster closed source free windows, mac, linux forum, e-mail no end user doc yes emacs gpl 3 free windows, mac, linux faq, mailing list, news group online manual yes espresso closed source $75 mac faq, e-mail no end user doc, but plug-in doc yes gedit gpl free windows, mac, linux mailing list, irc online manual ...
... plug-in doc yes gedit gpl free windows, mac, linux mailing list, irc online manual yes kate lgpl, gpl free windows, mac, linux mailing list, irc online manual yes komodo edit mpl free windows, mac, linux forum online manual yes notepad++ gpl free windows forum wiki yes pspad closed source free windows faq, forum online help yes sublime text closed source $70 windows, mac, linux forum official, unofficial yes textmate closed source $50 mac twitter, irc, mailing list, e-mail online manual, wiki yes textwrangler closed source free mac faq, forum pdf manual no vim specif...
...tty large, complex files. make it easier on yourself by choosing a text editor that understands the technologies you're working with. many text editors help you out with features like: syntax highlighting. make your file more legible by color-coding keywords based on the technology you're using. code completion. save you time by auto-completing recurring structures (for example, automatically close html tags, or suggesting valid values for a given css property). code snippets. as you saw when starting a new html document, many technologies use the same document structure over and over. save yourself the hassle of retyping all this by using a code snippet to pre-fill your document. most text editors now support syntax highlighting, but not necessarily the other two features. make sure in ...
Getting started with HTML - Learn web development
jective: to gain basic familiarity with html, and practice writing a few html elements. what is html? html (hypertext markup language) is not a programming language. it is a markup language that tells web browsers how to structure the web pages you visit. it can be as complicated or as simple as the web developer wants it to be. html consists of a series of elements, which you use to enclose, wrap, or mark up different parts of content to make it appear or act in a certain way. the enclosing tags can make content into a hyperlink to connect to another page, italicize words, and so on. for example, consider the following line of text: my cat is very grumpy if we wanted the text to stand by itself, we could specify that it is a paragraph by enclosing it in a paragraph (<p>) element...
...ment ends. failing to include a closing tag is a common beginner error that can produce peculiar results. the element is the opening tag, followed by content, followed by the closing tag. active learning: creating your first html element edit the line below in the input area by wrapping it with the tags <em> and </em>. to open the element, put the opening tag <em> at the start of the line. to close the element, put the closing tag </em> at the end of the line. doing this should give the line italic text formatting! see your changes update live in the output area. if you make a mistake, you can clear your work using the reset button. if you get really stuck, press the show solution button to see the answer. playable code <h2>live output</h2> <div class="output" style="min-height: 50px;">...
...his is called nesting. if we wanted to state that our cat is very grumpy, we could wrap the word very in a <strong> element, which means that the word is to have strong(er) text formatting: <p>my cat is <strong>very</strong> grumpy.</p> there is a right and wrong way to do nesting. in the example above, we opened the p element first, then opened the strong element. for proper nesting, we should close the strong element first, before closing the p. the following is an example of the wrong way to do nesting: <p>my cat is <strong>very grumpy.</p></strong> the tags have to open and close in a way that they are inside or outside one another. with the kind of overlap in the example above, the browser has to guess at your intent. this kind of guessing can result in unexpected results. block vers...
...a space between it and the element name. (for an element with more than one attribute, the attributes should be separated by spaces too.) the attribute name, followed by an equal sign. an attribute value, wrapped with opening and closing quote marks. active learning: adding attributes to an element another example of an element is <a>. this stands for anchor. an anchor can make the text it encloses into a hyperlink. anchors can take a number of attributes, but several are as follows: href: this attribute's value specifies the web address for the link. for example: href="https://www.mozilla.org/". title: the title attribute specifies extra information about the link, such as a description of the page that is being linked to. for example, title="the mozilla homepage". this appears as a t...
Eclipse CDT
"build directory" to just "${projdirpath}" (this is the top of the source tree). select the behavior tab and remove the "all" from the "build (incremental build)" field. select "c/c++ build > build variables", and add a variable "mozconfig", and set it to the path of your .mozconfig file relative to the top source directory. set any other environment variables you want to set for the build, then close the project properties window. now when you hit the build button (the little hammer icon), you should see the source build in the console tab at the bottom of the window. the benefit of building from inside eclipse is that build errors will appear in the problems tab at the bottom of the window, and from there you can double click on the build error and it will take you straight to the source f...
... is there a mercurial plugin for eclipse? there is mercurialeclipse, but probably most mozilla developers will just prefer to use the command lin...
...space_path = os.path.join(os.environ['home'], "home/relative/path/to/the/directory/of/the/workspace/you/want/to/open") subprocess.popen([eclipse_app_path, "-data", workspace_path]) # uncomment the following line to automatically close the terminal window # that opens if you run this script by double clicking it in finder. #subprocess.popen(["osascript", "-e", 'tell application "terminal"', "-e", "close front window", "-e", "end tell"]) todo: add instructions for linux and windows. is there a mercurial plugin for eclipse? there is mercurialeclipse, but probably most mozilla developers will just prefer to use the command line. if you think we need our own documentation on mercurialeclipse, please consider adding a separate page for that tool since this page is already pretty long. how can i ...
... "available software sites". in the window that opens, click "add", and in the prompt set name to something like "nightly" and location to something like "http://download.eclipse.org/tools/cd...s/juno/nightly" (change "juno" to the current developer branch). click "ok", then "ok" again. type "nightly" into the "work with" field and select the repository that you just added. (if it doesn't appear, close the window, reopen it from the help menu, and try again.) a "cdt main features" option should now have been added in the area below. tick this (all of its sub-options should then be ticked), click "next" twice, accept the license agreement, and then click "finish". eclipse should now update itself and ask you to restart. troubleshooting: if you get an error when trying to update, try clicking "a...
PromiseWorker.jsm
ource://gre/modules/workers/promiseworker.js'); // instantiate abstractworker (see below). let worker = new promiseworker.abstractworker() worker.dispatch = function(method, args = []) { // dispatch a call to method `method` with args `args` return self[method](...args); }; worker.postmessage = function(...args) { // post a message to the main thread self.postmessage(...args); }; worker.close = function() { // close the worker self.close(); }; worker.log = function(...args) { // log (or discard) messages (optional) dump('worker: ' + args.join(' ') + '\n'); }; // connect it to message port. self.addeventlistener('message', msg => worker.handlemessage(msg)); abstractworker is a base class for the worker, and it's designed to be used by derived class, which provides above four...
...but you can instantiate abstractworker itself and set its properties later, instead of creating derived class. ...
...om the main thread. ...
...file myworker.js importscripts('resource://gre/modules/workers/require.js'); let promiseworker = require('resource://gre/modules/workers/promiseworker.js'); let worker = new promiseworker.abstractworker(); worker.dispatch = function(method, args = []) { return self[method](...args); }; worker.postmessage = function(...args) { self.postmessage(...args); }; worker.close = function() { self.close(); }; worker.log = function(...args) { dump('worker: ' + args.join(' ') + '\n'); }; self.addeventlistener('message', msg => worker.handlemessage(msg)); // start - my functionalities function resolvetest(shouldresolve) { if (shouldresolve) { return 'you sent to promiseworker argument of: `' + shouldresolve + '`'; } else { throw new error('you passed in a non-true value for shouldre...
Localizing without a specialized tool
from the create a new localization document, an interested localizer can follow a technical step-by-step process that starts the localization process by focusing on how to localize two of the primary types of localization files (dtd and properties) used in the mozilla source code. with that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version. if you choose to localize mozilla with nothing more than a text editing application and not a specialized tool, this document (along with create a new localization) will enabl...
...get the source change your current directory to your working directory with the following command: $ cd /path/to/your/working/directory first, you will need to check out the sources of mozilla-1.9.2 together with the en-us strings. assuming that you have installed mercurial, issue the following command: $ hg clone htt...
...ales/l10n.ini l10n-mozilla-1.9.2 x-testing > ~/desktop/x-testing.compare open the x-testing.compare file that is on your desktop. ...
...sting > ~/desktop/x-testing.compare open the x-testing.compare file that is on your desktop. you should see something like this: x-testing browser chrome browser aboutcerterror.dtd // add and localize this file aboutdialog.dtd +aboutlink +aboutlink.accesskey +aboutversion +closecmdgnome.accesskey +closecmdgnome.label +copyright +copyright.accesskey +copyrightgnome.accesskey +copyrightinfo1 +copyrightinfo2 +licenselink +licenselinktext aboutprivatebrowsing.dtd // add and localize this file aboutrobots.dtd // add and localize this file ... ... ... x-te...
PRIOMethods
the table of i/o methods used in a file descriptor. ...
... the table of i/o methods used in a file descriptor. ...
...downfn shutdown; prrecvfn recv; prsendfn send; prrecvfromfn recvfrom; prsendtofn sendto; prpollfn poll; pracceptreadfn acceptread; prtransmitfilefn transmitfile; prgetsocknamefn getsockname; prgetpeernamefn getpeername; prgetsockoptfn getsockopt; prsetsockoptfn setsockopt; }; typedef struct priomethods priomethods; parameters file_type type of file represented (tos). close close file and destroy descriptor. read read up to the specified number of bytes into buffer. write write specified number of bytes from buffer. available determine number of bytes available for reading. available64 same as previous field, except 64-bit. fsync flush all in-memory buffers of file to permanent store. seek position the file pointer to the desired place. seek64 same as...
...definition details, see prio.h. the i/o methods table provides procedural access to the functions of the file descriptor. it is the responsibility of a layer implementor to provide suitable functions at every entry point (that is, for every function in the i/o methods table). if a layer provides no functionality, it should call the next lower (higher) function of the same name (for example, the "close" method would return fd->lower->method->close(fd->lower)). not all functions in the methods table are implemented for all types of files. for example, the seek method is implemented for normal files but not for sockets. in cases where this partial implementation occurs, the function returns an error indication with an error code of pr_invalid_method_error. ...
NSS API Guidelines
t for reading and writing data in java archive (jar) format, including zlib compression. port lib/jar jar-ds.h, jar.h, jarfile.h nss provides high-level initialiazation and shutdown of security services. specifically, this library provides nss_init() for establishing default certificate, key, module databases, and initializing a default random number generator. nss_shutdown() closes these databases, to prevent further access by an application. above high cert, high key lib/nss nss.h pk11wrap provides access to pkcs #11 modules, through a unified interface. the pkcs11wrap library provides functions for selecting/finding pkcs #11 modules and slots. it also provides functions that invoke operations in selected modules and slots, such as key selection and g...
... long as from our allocators. combined with purify, this also helps us catch cases where things being allocated by one allocator are freed by another, which is a common windows pitfall. the security code often wants to be sure to zero memory, when it's being freed; we'll add it to the primitives to deal with. the arena_threadmark preprocessor definition (default in debug builds), and code it encloses, will add some checking for the following situation: thread a marks the arena, and allocates some memory from it. thread b allocates some memory from the arena. thread a releases the arena back to the mark. thread b now finds itself with a pointer to released data. some thread -- doesn't matter which -- allocates some data from the arena; this may overlap the chunk thread b has. boom! ...
...read b now finds itself with a pointer to released data. some thread -- doesn't matter which -- allocates some data from the arena; this may overlap the chunk thread b has. boom! threadmark code notes the thread id, whenever an arena is marked, and disallows any allocations or marks by any other thread. ...
...leted before the layer can be used, that layer should supply an initialization function of the form layer_init(). if an initialization function is supplied, a corresponding layer_shutdown() function should also be supplied. layer_init() should increment a count of the number of times it is called, and layer_shutdown() should decrement that count, and shutdown when the count reaches '0'. open, close functions open functions should have a corresponding close function. open and close function are not reference counted, like init and shutdown functions. creation functions in general, data objects should all have functions which create them. these functions should have the form layer_createdatatype[fromdatatype](). for instance generating a new key would change from pk11_keygen() to pk11_c...
Bytecode Descriptions
ed after yield expressions. this is useful for the debugger and abstractgeneratorobject::isafteryieldorawait. it's treated as jump target op so that the baseline interpreter can efficiently restore the frame's interpretericentry when resuming a generator. the preceding instruction in the script must be yield, initialyield, or await. format: jof_icindex finalyieldrval stack: gen ⇒ suspend and close the current generator, async function, or async generator. gen must be the generator object for the current frame. if the current function is a non-async generator, then the value in the frame's return value slot is returned to the caller. it should be an object of the form {value: returnvalue, done: true}. if the current function is an async function or async generator, the frame's return value ...
......
...set (relative to the current op) of the jsop::goto at the end of the try-block body. this is used by bytecode analysis and jit compilation. location information for catch/finally blocks is stored in a side table, script->trynotes(). format: jof_code_offset trydestructuring no-op instruction used by the exception unwinder to determine the correct environment to unwind to when performing iteratorclose due to destructuring. this instruction must appear immediately before each jstry_destructuring span in a script's try notes. exception stack: ⇒ exception push and clear the pending exception. ┬──┬◡ノ(° -°ノ) this must be used only in the fixed sequence of instructions following a jstry_catch span (see "bytecode invariants" above), as that's the only way instructions would run w...
...tsobject. format: jof_qarg, jof_name getlocal operands: (uint24_t localno) stack: ⇒ val push the value of an optimized local variable. if the variable is an uninitialized lexical, push magicvalue(js_uniniitalized_lexical). format: jof_local, jof_name getaliasedvar operands: (uint8_t hops, uint24_t slot) stack: ⇒ aliasedvar push the value of an aliased binding. local bindings that aren't closed over or dynamically accessed are stored in stack slots. global and with bindings are object properties. all other bindings are called "aliased" and stored in environmentobjects. where possible, aliased instructions are used to access aliased bindings. (there's no difference in meaning between aliasedvar and aliasedlexical.) each of these instructions has operands hops and slot that encode an en...
nsIInputStream
xpcom/io/nsiinputstream.idlscriptable this interface represents a readable stream of data. inherits from: nsisupports last changed in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) an input stream may be "blocking" or "non-blocking" (see the isnonblocking() method). a blocking input stream may suspend the calling thread in order to satisfy a call to close(), available(), read(), or readsegments(). a non-blocking input stream, on the other hand, must not block the calling thread of execution. note: blocking input streams are often read on a background thread to avoid locking up the main application thread. for this reason, it is generally the case that a blocking input stream should be implemented using thread-safe addref and release. method overview un...
...d of execution. note: blocking input streams are often read on a background thread to avoid locking up the main application thread. for this reason, it is generally the case that a blocking input stream should be implemented using thread-safe addref and release. method overview unsigned long available();deprecated since gecko 17.0 unsigned long long available(); void close(); boolean isnonblocking(); unsigned long read(in charptr abuf, in unsigned long acount); native code only! unsigned long readsegments(in nswritesegmentfun awriter, in voidptr aclosure, in unsigned long acount); native code only! methods available() determine number of bytes available in the stream. in addition to the number of bytes available in the stream, t...
...igned long acount); native code only! unsigned long readsegments(in nswritesegmentfun awriter, in voidptr aclosure, in unsigned long acount); native code only! methods available() determine number of bytes available in the stream. in addition to the number of bytes available in the stream, this method also informs the caller of the current status of the stream. a stream that is closed will throw an exception when this method is called. that enables the caller to know the condition of the stream before attempting to read from it. if a stream is at end-of-file, but not closed, then this method returns 0 bytes available. note: some nsiinputstream implementations automatically close() when end-of-file is reached; others do not. note: this method should not be used to determin...
...file. moreover, since a stream may make available more than 2^32 bytes of data, this method is incapable of expressing the entire size of the underlying data source. unsigned long available(); parameters none. return value number of bytes currently available in the stream, or pr_uint32_max if the size of the stream exceeds pr_uint32_max. exceptions thrown <other-error> if the stream is closed due to some error condition. ns_base_stream_closed if the stream is closed normally. close() close the stream. 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. void close(); parameters none. isnonblocking() boolean isnonblocking(); p...
nsINavHistoryResultObserver
66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), this interface replaced the older nsinavhistoryresultviewer interface, which only allowed one client at a time. ...
...umber of updates that are about to be notified. this is especially useful when updating user interfaces, to avoid flicker or continuous selection changes, which may result in performance degradation (for example, if updating a view for each update). void batching( in boolean atogglemode ); parameters atogglemode specify true to start batch mode or false to finish the batch. ...
...ay result in performance degradation (for example, if updating a view for each update). void batching( in boolean atogglemode ); parameters atogglemode specify true to start batch mode or false to finish the batch. containerclosed() obsolete since gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8) called when a container node's state changes from opened to closed. note: this method was deprecated in gecko 2.0 and removed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8). implement the containerstatechanged() method instead. void containerclosed( in nsinavhistorycontainerresultnode acontainernode ); parameters acontainernode the container node which was closed. containeropened() obsolete since gecko 11.0 (firefox 11.
...note: this method was deprecated in gecko 2.0 and removed in gecko 11.0 (firefox 11.0 / thunderbird 11.0 / seamonkey 2.8). implement the containerstatechanged() method instead. ...
nsITransport
at is, data is being transfered in some fashion via the streams exposed by this interface). a transport can have an event sink associated with it. the event sink receives transport-specific events as the transfer is occurring. for a socket transport, these events can include status about the connection. see nsisockettransport for more info about socket transport specifics. method overview void close(in nsresult areason); nsiinputstream openinputstream(in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount); nsioutputstream openoutputstream(in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount); void seteventsink(in nsitransporteventsink asink, in nsieventtarget aeventtarget); constants open flags. constant value des...
...constants open flags. constant value description open_blocking 1<<0 open flags. open_unbuffered 1<<1 generic nsitransporteventsink status codes. nsitransport implementations may override these status codes with their own more specific status codes (for example, see nsisockettransport). constant value description status_reading 0x804b0008 status_writing 0x804b0009 methods close() close the transport and any open streams. void close( in nsresult areason ); parameters areason the reason for closing the stream. openinputstream() open an input stream on this transport. nsiinputstream openinputstream( in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount ); parameters aflags optional transport specific flags. flags have the follo...
...pen an input stream on this transport. nsiinputstream openinputstream( in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount ); parameters aflags optional transport specific flags. flags have the following meaning: open_blocking if specified, then the resulting stream will have blocking stream semantics. this means that if the stream has no data and is not closed, then reading from it will block the calling thread until at least one byte is available or until the stream is closed. if this flag is not specified, then the stream has non-blocking stream semantics. this means that if the stream has no data and is not closed, then reading from it returns ns_base_stream_would_block. in addition, in non-blocking mode, the stream is guaranteed to support nsiasyn...
...open an output stream on this transport. nsioutputstream openoutputstream( in unsigned long aflags, in unsigned long asegmentsize, in unsigned long asegmentcount ); parameters aflags optional transport specific flags. flags have the following meaning: open_blocking if specified, then the resulting stream will have blocking stream semantics. this means that if the stream is full and is not closed, then writing to it will block the calling thread until all of the data can be written or until the stream is closed. if this flag is not specified, then the stream has non-blocking stream semantics. this means that if the stream is full and is not closed, then writing to it returns ns_base_stream_would_block. in addition, in non- blocking mode, the stream is guaranteed to support nsiasyncoutput...
nsIWebSocketListener
void onacknowledge( in nsisupports acontext, in pruint32 as...
...eavailable( in nsisupports acontext, in acstring amsg ); parameters acontext user defined context. amsg the message data. onmessageavailable() called when a text message has been received. void onmessageavailable( in nsisupports acontext, in autf8string amsg ); parameters acontext user defined context. amsg the message data, as a utf-8 string. onserverclose() called when the server sends a close message. in the case of errors, onstop() may be called without this method ever getting called. no additional messages through onmessageavailable(), onbinarymessageavailable()() or onacknowledge()() will be delievered to the listener after onserverclose() is called, but outgoing messages can still be sent through the nsiwebsocketchannel connection. void onse...
... acode the websocket closing handshake status code; see status codes for possible values. areason a text string explaining the reason for the closure of the connection. ...
... receives onstart() will also receive onstop(). void onstart( in nsisupports acontext ); parameters acontext user defined context. onstop() called to signify the completion of the message stream. this is the final notification the listener will receive; once it's been received, the websocket connection is complete. this event can be received in error cases even if nsiwebsocketchannel.close() has not been called. void onstop( in nsisupports acontext, in nsresult astatuscode ); parameters acontext user defined context. astatuscode reason for stopping (ns_ok if completed successfully). see also websockets nsiwebsocketchannel ...
Cached compose window FAQ
the downsides are that we have had some bugs, it complicates and bloats the code, and it requires more testing. ...
... the downsides are that we have had some bugs, it complicates and bloats the code, and it requires more testing. ...
...window on every new mail message or reply. but we noticed that the common usage pattern is to compose, send, compose, send, compose send. we decided it would be worth the trouble to cache the compose window. if the user has this usage pattern, we wouldn't have to create a new window. we could just hide it on send, and then show it on the next compose. if the user opens (but never sends or closes compose windows), this trick will not apply to them. but this is not a common usage model. how do i test it? on window and mac, the cached compose window is on by default. to test it start mozilla do new message. this is a new compose window. notice how long it took. close or send the window. (the compose window is now cached) do new message again. this is the cached compose wind...
...them. but this is not a common usage model. how do i test it? on window and mac, the cached compose window is on by default. to test it start mozilla do new message. this is a new compose window. notice how long it took. close or send the window. (the compose window is now cached) do new message again. this is the cached compose window. it should have been faster than in step 2. close or send the window. (the compose window is cached again) do new message again. this is the cached compose window. it should be as fast as in step 4. do new message again. there is no "cached" window, so this will be as slow as step 4. close one of the compose windows. (this window is now cached). close the other compose window. (this window is not cached, since you already have a cached ...
Library
declare() declares an api from the native library, allowing it to be used from javascript. this can be used both for exported data symbols and for functions. ...
... declare() declares an api from the native library, allowing it to be used from javascript. this can be used both for exported data symbols and for functions. ...
... declare() declares an api from the native library, allowing it to be used from javascript. this can be used both for exported data symbols and for functions. ...
... declare() declares an api from the native library, allowing it to be used from javascript. this can be used both for exported data symbols and for functions. ...
Using the CSS Painting API - Web APIs
= 0; const y = size.height * 0.3; const blockwidth = size.width * 0.33; const highlightheight = size.height * 0.85; const color = props.get('--highcolour'); ctx.fillstyle = color; ctx.beginpath(); ctx.moveto( x, y ); ctx.lineto( blockwidth, y ); ctx.lineto( blockwidth + highlightheight, highlightheight ); ctx.lineto( x, highlightheight ); ctx.lineto( x, y ); ctx.closepath(); ctx.fill(); /* create the dashes */ for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginpath(); ctx.moveto( (blockwidth) + (start * 10) + 10, y ); ctx.lineto( (blockwidth) + (start * 10) + 20, y ); ctx.lineto( (blockwidth) + (start * 10) + 20 + (highlightheight), highlightheight ); ctx.lineto( (blockwidth) + (start * 10) + 10 + (highlightheight), highlighthei...
... < 4; i++) { let start = i * 2; ctx.beginpath(); ctx.moveto( (blockwidth) + (start * 10) + 10, y ); ctx.lineto( (blockwidth) + (start * 10) + 20, y ); ctx.lineto( (blockwidth) + (start * 10) + 20 + (highlightheight), highlightheight ); ctx.lineto( (blockwidth) + (start * 10) + 10 + (highlightheight), highlightheight ); ctx.lineto( (blockwidth) + (start * 10) + 10, y ); ctx.closepath(); ctx.fill(); } } // paint }); we can then create a little html that will accept this image as backgrounds: <h1 class="fancy">largest header</h1> <h3 class="fancy">medium size header</h3> <h6 class="fancy">smallest header</h6> we give each header a different value for the --highcolour custom property .fancy { background-image: paint(headerhighlight); } h1 { --highcolour: hsla(1...
...'; ctx.strokestyle = colour; } else if ( stroketype === 'filled' ) { ctx.fillstyle = colour; ctx.strokestyle = colour; } else { ctx.fillstyle = 'none'; ctx.strokestyle = 'none'; } // block ctx.beginpath(); ctx.moveto( x, y ); ctx.lineto( blockwidth, y ); ctx.lineto( blockwidth + blockheight, blockheight ); ctx.lineto( x, blockheight ); ctx.lineto( x, y ); ctx.closepath(); ctx.fill(); ctx.stroke(); // dashes for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginpath(); ctx.moveto( blockwidth + (start * 10) + 10, y); ctx.lineto( blockwidth + (start * 10) + 20, y); ctx.lineto( blockwidth + (start * 10) + 20 + blockheight, blockheight); ctx.lineto( blockwidth + (start * 10) + 10 + blockheight, blockheight); ctx.lineto( blockwidt...
...(); // dashes for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginpath(); ctx.moveto( blockwidth + (start * 10) + 10, y); ctx.lineto( blockwidth + (start * 10) + 20, y); ctx.lineto( blockwidth + (start * 10) + 20 + blockheight, blockheight); ctx.lineto( blockwidth + (start * 10) + 10 + blockheight, blockheight); ctx.lineto( blockwidth + (start * 10) + 10, y); ctx.closepath(); ctx.fill(); ctx.stroke(); } } // paint }); we can set different colors, stroke widths, and pick whether the background image should be filled or hollow: li { --boxcolor: hsla(155, 90%, 60%, 0.5); background-image: paint(hollowhighlights, stroke, 5px); } li:nth-of-type(3n) { --boxcolor: hsla(255, 90%, 60%, 0.5); background-image: paint(hollowhighlights, filled, ...
Element - Web APIs
Web › API › Element
ent is scrolled vertically. element.scrolltopmax read only returns a number representing the maximum top scroll offset possible for the element. element.scrollwidth read only returns a number representing the scroll view width of the element. element.shadowrootread only returns the open shadow root that is hosted by the element, or null if no open shadow root is present. element.openorclosedshadowroot read only returns the shadow root that is hosted by the element, regardless if its open or closed. available only to webextensions. element.slot returns the name of the shadow dom slot the element is inserted in. element.tabstop is a boolean indicating if the element can receive input focus via the tab key. element.tagname read only returns a string with the name of the t...
...menttypechildnode, and animatable. eventtarget.addeventlistener() registers an event handler to a specific event type on the element. element.attachshadow() attaches a shadow dom tree to the specified element and returns a reference to its shadowroot. element.animate() a shortcut method to create and run an animation on an element. returns the created animation object instance. element.closest() returns the element which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter. element.createshadowroot() creates a shadow dom on on the element, turning it into a shadow host. returns a shadowroot. element.computedstylemap() returns a stylepropertymapreadonly interface which provides a read-only representa...
...ified name and namespace, from the current node. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. cancel fires on a <dialog> when the user instructs the browser that they wish to dismiss the current open dialog. for example, the browser might fire this event when the user presses the esc key or clicks a "close dialog" button which is part of the browser's ui. also available via the oncancel property. error fired when a resource failed to load, or can't be used. for example, if a script has an execution error or an image can't be found or is invalid. also available via the onerror property. scroll fired when the document view or an element has been scrolled. also available via the onscroll proper...
...added the following methods: getclientrects(), getboundingclientrect(), scroll(), scrollby(), scrollto() and scrollintoview(). element traversal specificationthe definition of 'element' in that specification. obsolete added inheritance of the elementtraversal interface. domthe definition of 'element' in that specification. living standard added the following methods: closest(), insertadjacentelement() and insertadjacenttext(). moved hasattributes() from the node interface to this one. dom4the definition of 'element' in that specification. obsolete removed the following methods: setidattribute(), setidattributens(), and setidattributenode(). modified the return value of getelementsbytagname() and getelementsbytagnamens(). removed the schem...
Intersection Observer API - Web APIs
to watch for intersection relative to the root element, specify null. whether you're using the viewport or some other element as the root, the api works the same way, executing a callback function you provide whenever the visibility of the target element changes so that it crosses desired amounts ...
...kly as possible; if anything time-consuming needs to be done, use window.requestidlecallback(). also, note that if you specified the root option, the target must be a descendant of the root element. how intersection is calculated all areas considered by the intersection observer api are rectangles; elements which are irregularly shaped are considered as occupying the smallest rectangle which encloses all of the element's parts. similarly, if the visible portion of an element is not rectangular, the element's intersection rectangle is construed to be the smallest rectangle that contains all the visible portions of the element. it's useful to understand a bit about how the various properties provided by intersectionobserverentry describe an intersection. the intersection root and root margin...
...e intersection root's bounding client rectangle (as returned by calling getboundingclientrect() on it). the root intersection rectangle can be adjusted further by setting the root margin, rootmargin, when creating the intersectionobserver. the values in rootmargin define offsets added to each side of the intersection root's bounding box to create the final intersection root bounds (which are disclosed in intersectionobserverentry.rootbounds when the callback is executed). thresholds rather than reporting every infinitesimal change in how much a target element is visible, the intersection observer api uses thresholds. when you create an observer, you can provide one or more numeric values representing percentages of the target element which are visible. then, the api only reports changes to ...
...(".bottomright").innerhtml = visiblepct; }); } startup(); clipping and the intersection rectangle the browser computes the final intersection rectangle as follows; this is all done for you, but it can be helpful to understand these steps in order to better grasp exactly when intersections will occur. the target element's bounding rectangle (that is, the smallest rectangle that fully encloses the bounding boxes of every component that makes up the element) is obtained by calling getboundingclientrect() on the target. this is the largest the intersection rectangle may be. the remaining steps will remove any portions that don't intersect. starting at the target's immediate parent block and moving outward, each containing block's clipping (if any) is applied to the intersection rectang...
Key Values - Web APIs
:key_monbrightnessdown (0x010000b3) keycode_brightness_down (220) "brightnessup" the brightness up key. typically increases the brightness of the display. gdk_key_monbrightnessup (0x1008ff02) qt::key_monbrightnessup (0x010000b2) keycode_brightness_up (221) "eject" the eject key. ejects removable media (or toggles an optical storage device tray open and closed). gdk_key_eject (0x1008ff2c) qt::key_eject (0x010000b9) keycode_media_eject (129) "logoff" [2] the logoff key. gdk_key_logoff (0x1008ff61) qt::key_logoff (0x010000d9) "power" the power button or key, to toggle power on and off. note: not all systems pass this key through to to the user agent. keycode_power (26) ...
... [1] vk_hangul and vk_kana share the same numeric key value on windows, as do vk_hanja and vk_kanji. japanese keyboards only these keys are only available on japanese keyboards. keyboardevent.key value description virtual keycode windows mac linux android "eisu" [1] the eisu key. this key's purpose is defined by the ime, but may be used to close the ime. kvk_jis_eisu (0x66) gdk_key_eisu_toggle (0xff2f) qt::key_eisu_toggle (0x01001130) keycode_eisu (212) "hankaku" [3] the hankaku (half-width characters) key. vk_oem_auto (0xf3) gdk_key_hankaku (0xff29) qt::key_hankaku (0x01001129) "hiragana" the hiragana key; selects kana characters mode. vk_oem_copy (0xf2) gdk_key_hiraga...
...lored_key_3 keycode_prog_blue (186) "colorf4grey" general-purpose media funciton key, color-coded grey. this has index 4 among the colored keys. vk_colored_key_4 keycode_prog_grey "colorf5brown" general-purpose media funciton key, color-coded brown. this has index 5 among the colored keys. vk_colored_key_5 keycode_prog_brown "closedcaptiontoggle" toggles closed captioning on and off. vk_cc keycode_captions (175) "dimmer" adjusts the brightness of the device by toggling between two brightness levels or by cycling among multiple brightness levels. vk_dimmer gdk_key_brightnessadjust (0x1008ff3b) "displayswap" cycles among video sources. vk_display_swap ...
...r_command_control_toggle command on windows generates "unidentified" on firefox. document keys these keys control documents. in the specification, they're included in other sets of keys (such as the media keys), but they are more sensibly considered to be their own category. keyboardevent.key value description virtual keycode windows mac linux android "close" [1] closes the current document or message. must not exit the application. appcommand_close gdk_key_close (0x1008ff56) qt::key_close (0x010000ce) keycode_media_close (128) "new" [1] creates a new document or message. appcommand_new gdk_key_new (0x1008ff68) qt::key_new (0x01000120) "open" [1] opens an existing document or message. a...
RTCDtlsTransport.state - Web APIs
lue a string whose value is taken from the rtcdtlstransportstate enumerated type. its value is one of the following: new the initial state when dtls has not started negotiating yet. connecting dtls is in the process of negotiating a secure connection and verifying the remote fingerprint. connected dtls has completed negotiation of a secure connection and verified the remote fingerprint. closed the transport has been closed intentionally as the result of receipt of a close_notify alert, or calling rtcpeerconnection.close(). failed the transport has failed as the result of an error (such as receipt of an error alert or failure to validate the remote fingerprint). examples this example presents a function, tallysenders(), which iterates over an rtcpeerconnection's rtcrtpsenders, ta...
...tcpeerconnection's rtcrtpsenders, tallying up how many of them are in various states. the function returns an object containing properties whose values indicate how many of the senders are in each state. let pc = new rtcpeerconnection({ bundlepolicy: "max-bundle" }); /* ... ...
... specifications specification stat...
... specifications specification status comment webr...
RTCDtlsTransport - Web APIs
're created whether or not the remote peer supports bundling or not. for this reason, you'll sometimes see separate transports created at first, one for each track, then see them get bundled up once it's known that bundling is possible. if your code accesses rtcrtpsenders and/or rtcrtpreceivers directly, you may encounter situations where they're initially separate, then half or more of them get closed and the senders and receivers updated to refer to the appropriate remaining rtcdtlstransport objects. data channels rtcdatachannels use sctp to communicate. all of a peer connection's data channels share a single rtcsctptransport, found in the connection's sctp property. you can, in turn, identify the rtcdtlstransport used to securely encapsulate the data channels' sctp communications by look...
...tcpeerconnection's rtcrtpsenders, tallying up how many of them are in various states. the function returns an object containing properties whose values indicate how many of the senders are in each state. let pc = new rtcpeerconnection({ bundlepolicy: "max-bundle" }); /* ... ...
... specifications specification stat...
... specifications specification status comment webr...
RTCPeerConnection.connectionState - Web APIs
f type rtcicetransport or rtcdtlstransport) being used by the connection. constant description "new" at least one of the connection's ice transports (rtcicetransports or rtcdtlstransports) are in the "new" state, and none of them are in one of the following states: "connecting", "checking", "failed", or "disconnected", or all of the connection's transports are in the "closed" state. "connecting" one or more of the ice transports are currently in the process of establishing a connection; that is, their rtciceconnectionstate is either "checking" or "connected", and no transports are in the "failed" state. <<< make this a link once i know where that will be documented "connected" every ice transport used by the connection is either in use (state...
...one or more of the ice transports are currently in the process of establishing a connection; that is, their rtciceconnectionstate is either "checking" or "connected", and no transports are in the "failed" state. <<< make this a link once i know where that will be documented "connected" every ice transport used by the connection is either in use (state "connected" or "completed") or is closed (state "closed"); in addition, at least one transport is either "connected" or "completed". "disconnected" at least one of the ice transports for the connection is in the "disconnected" state and none of the other transports are in the state "failed", "connecting", or "checking". "failed" one or more of the ice transports on the connection is in the "failed" state. ...
... this value was in the rtcsignalingstate enum (and therefore found by reading the value of the signalingstate) property until the may 13, 2016 draft of the specification. example var pc = new rtcpeerconnection(configuration); /* ... ...
... transport is either "connected" or "completed". "disconnected" at least one of the ice transports for the connection is in the "disconnected" state and none of the other transports are in the state "failed", "connecting", or "checking". "failed" one or more of the ice transports on the connection is in the "failed" state. "closed" the rtcpeerconnection is closed. this value was in the rtcsignalingstate enum (and therefore found by reading the value of the signalingstate) property until the may 13, 2016 draft of the specification. example var pc = new rtcpeerconnection(configuration); /* ... */ var connectionstate = pc.connectionstate; specifications specification status comment webrtc 1.0: real-time commu...
Using DTMF with WebRTC - Web APIs
tmf within the context of an rtcpeerconnection by studying how an example works. simple example this simple example constructs two rtcpeerconnections, establishes a connection between them, then waits for the user to click a "dial" button. when the button is clicked, a dtmf string is sent over the connection using rtcdtmfsender.insertdtmf(). once the tones finish transmitting, the connection is closed. note: this example is obviously somewhat contrived, since normally the two rtcpeerconnection objects would exist on different devices, and signaling would be done over the network instead of it all being simply linked up inline as it is here. html the html for this example is very basic; there are only three elements of importance: an <audio> element to play the audio received by the rt...
...tones have played. disconnecting."); callerpc.getlocalstreams().foreach(function(stream) { stream.gettracks().foreach(function(track) { track.stop(); }); }); receiverpc.getlocalstreams().foreach(function(stream) { stream.gettracks().foreach(function(track) { track.stop(); }); }); audio.pause(); audio.srcobject = null; receiverpc.close(); callerpc.close(); } } the tonechange event is used both to indicate when an individual tone has played and when all tones have finished playing. the event's tone property is a string indicating which tone just finished playing. if all tones have finished playing, tone is an empty string; when that's the case, rtcdtmfsender.tonebuffer is empty. in this example, we log to the screen whi...
... both the caller and the receiver by iterating over each rtcpeerconnection's track list (as returned by its gettracks() method) and calling each track's stop() method. once both the caller's and the receiver's media tracks are all stopped, we pause the <audio> element and set its srcobject to null. this detaches the audio stream from the <audio> element. then, finally, each rtcpeerconnection is closed by calling its close() method. adding candidates to the caller when the caller's rtcpeerconnection ice layer comes up with a new candidate to propose, it issues an icecandidate event to callerpc. the icecandidate event handler's job is to transmit the candidate to the receiver. in our example, we are directly controlling both the caller and the receiver, so we can just directly add the candida...
...you can click "dial" again to reconnect and send the tones again. ...
WebSocket - Web APIs
Web › API › WebSocket
a websocket connection to a server, as well as for sending and receiving data on the connection. to construct a websocket, use the websocket() constructor. constructor websocket(url[, protocols]) returns a newly created websocket object. constants constant value websocket.connecting 0 websocket.open 1 websocket.closing 2 websocket.closed 3 properties websocket.binarytype the binary data type used by the connection. websocket.bufferedamount read only the number of bytes of queued data. websocket.extensions read only the extensions selected by the server. websocket.onclose an event listener to be called when the connection is closed. websocket.onerror an event listener to be called when an error occurs. we...
...ket.onmessage an event listener to be called when a message is received from the server. websocket.onopen an event listener to be called when the connection is opened. websocket.protocol read only the sub-protocol selected by the server. websocket.readystate read only the current state of the connection. websocket.url read only the absolute url of the websocket. ...
...istener to be called when a message is received from the server. websocket.onopen an event listener to be called when the connection is opened. websocket.protocol read only the sub-protocol selected by the server. websocket.readystate read only the current state of the connection. websocket.url read only the absolute url of the websocket. methods websocket.close([code[, reason]]) closes the connection. ...
...ebsocket.readystate read only the current state of the connection. websocket.url read only the absolute url of the websocket. methods websocket.close([code[, reason]]) closes the connection. websocket.send(data) enqueues data to be transmitted. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. close fired when a connection with a websocket is closed. also available via the onclose property error fired when a connection with a websocket has been closed because of an error, such as when some data couldn't be sent. also available via the onerror property. message fired when data is received through a websocket. also available via the onmessage property. open fired when a connection wi...
Privileged features - Web APIs
inimizable this setting can only apply to dialog windows; minimizable requires dialog=yes. if minimizable is on, the new dialog window will have a minimize system command icon in the titlebar and it will be minimizable. any non-dialog window is always minimizable and minimizable=no will be ignored. dependent if on, the new window is said to be dependent of its parent window. a dependent window closes when its parent window closes. a dependent window is minimized on the windows task bar only when its parent window is minimized. on windows platforms, a dependent window does not show on the task bar. a dependent window also stays in front of the parent window. dependent windows are not implemented on macos x, this option will be ignored. the dependent feature is currently under revision to be...
...ill be no context menu defined by default and none of the standard keyboard shortcuts will work. the page is supposed to provide a user interface of its own, usually this feature is used to open xul documents (standard dialogs like the javascript console are opened this way). dialog the dialog feature removes all icons (restore, minimize, maximize) from the window's titlebar, leaving only the close button. mozilla 1.2+ and netscape 7.1 will render the other menu system commands (in ff 1.0 and in ns 7.0x, the command system menu is not identified with the firefox/ns 7.0x icon on the left end of the titlebar: that's probably a bug. you can access the command system menu with a right-click on the titlebar). dialog windows are windows which have no minimize system command icon and no maximize/r...
...that's probably a bug. you can access the command system menu with a right-click on the titlebar). dialog windows are windows which have no minimize system command icon and no maximize/restore down system command icon on the titlebar nor in correspondent menu item in the command system menu. they are said to be dialog because their normal, usual purpose is to only notify info and to be dismissed, closed. on mac systems, dialog windows have a different window border and they may get turned into a sheet. modal if on, the new window is said to be modal. the user cannot return to the main window until the modal window is closed. a typical modal window is created by the alert() function. the exact behavior of modal windows depends on the platform and on the mozilla release version. note: as of...
...t but the parent window can be minimized. in ns 6.x, the alwayslowered window has no minimize system command icon and no restore/maximize system command. alwaysontop if on, the new window will always be displayed on top of all other windows (browser windows and otherwise), regardless of whether it is active or not. this was added in firefox 66 (see bug 1519893). z-lock same as alwayslowered. close when set to no or 0, this feature removes the system close command icon and system close menu item. it will only work for dialog windows (dialog feature set). close=no will override minimizable=yes. mozilla and firefox users can force new windows to always have a close button by setting dom.disable_window_open_feature.close to true in about:config or in their user.js file. ...
Using the aria-describedby attribute - Accessibility
raph describes a calendar application. aria-describedby is used to associate the paragraph with the application container. <div role="application" aria-labelledby="calendar" aria-describedby="info"> <h1 id="calendar">calendar</h1> <p id="info"> this calendar shows the game schedule for the boston red sox. </p> <div role="grid"> ... ...
...to associate the paragraph with the application container. <div role="application" aria-labelledby="calendar" aria-describedby="info"> <h1 id="calendar">calendar</h1> <p id="info"> this calendar shows the game schedule for the boston red sox. </p> <div role="grid"> ... </div> </div> example 2: a close button in the example below, a link that functions as a 'close' button on a dialog is described elsewhere in the document. ...
...> <p id="info"> this calendar shows the game schedule for the boston red sox. </p> <div role="grid"> ... </div> </div> example 2: a close button in the example below, a link that functions as a 'close' button on a dialog is described elsewhere in the document. the aria-describedby attribute is used to associate the description with the link. <button aria-label="close" aria-describedby="descriptionclose" onclick="mydialog.close()">x</button> ... ...
...e="grid"> ... </div> </div> example 2: a close button in the example below, a link that functions as a 'close' button on a dialog is described elsewhere in the document. the aria-describedby attribute is used to associate the description with the link. <button aria-label="close" aria-describedby="descriptionclose" onclick="mydialog.close()">x</button> ... <div id="descriptionclose">closing this window will discard any information entered and return you back to the main page</div> working examples: checkbox example uses aria-describedby tooltip example uses aria-describedby notes the aria-describedby attributed is not designed to reference descriptions on an external resource—since it is an id, it must reference an element in the same dom document. used by a...
quotes - CSS: Cascading Style Sheets
Web › CSS › quotes
the quotes css property sets how the browser should render quotation marks that are added using the open-quotes or close-quotes values of the css content property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...uotes values of the css content property. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword value */ quotes: none; quotes: auto; /* <string> values */ quotes: "«" "»"; /* set open-quote and close-quote to the french quotation marks */ quotes: "«" "»" "‹" "›"; /* set two levels of quotation marks */ /* global values */ quotes: inherit; quotes: initial; quotes: unset; values none the open-quote and close-quote values of the content property produce no quotation marks. auto appropriate quote marks will be used for whatever language value is set on the selected elements (i.e.
...the first pair represents the outer level of quotation, the second pair is for the first nested level, next pair for third level and so on. ...
... third level and so on. formal definition initial valuedepends on user agentapplies toall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax none | auto | [ <string> <string> ]+ examples basic quote marks html <q>to be or not to be. that's the question!</q> css q { quotes: '"' '"' "'" "'"; } q::before { content: open-quote; } q::after { content: close-quote; } result auto quotes for most browsers, the default value of quotes is auto (firefox 70+), or the browser otherwise had this default behavior (chromiums, safari, edge), so this example works without it being explicitly being set. html <div lang="fr"> <q>ceci est une citation française.</q> <div> <hr> <div lang="ru"> <q>Это русская цитата</q> <div> <hr> <div la...
radial-gradient() - CSS: Cascading Style Sheets
aults to center. <shape> the gradient's shape. the value can be circle (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. ...
...e (meaning that the gradient's shape is a circle with constant radius) or ellipse (meaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. ...
...eaning that the shape is an axis-aligned ellipse). if unspecified, it defaults to ellipse. <extent-keyword> a keyword describing how big the ending shape must be. the possible values are: keyword description closest-side the gradient's ending shape meets the side of the box closest to its center (for circles) or meets both the vertical and horizontal sides closest to the center (for ellipses). closest-corner the gradient's ending shape is sized so that it exactly meets the closest corner of the box from its center. farthest-side similar to closest-side, except the ending shape is sized to meet the side of the box farthest from its center (or vertical and horizontal sides). farthest-corner the default value,...
...to meet the side of the box farthest from its center (or vertical and horizontal sides). farthest-corner the default value, the gradient's ending shape is sized so that it exactly meets the farthest corner of the box from its center. note: early implementations of this function included other keywords (cover and contain) as synonyms of the standard farthest-corner and closest-side, respectively. use the standard keywords only, as some implementations have already dropped those older variants. <linear-color-stop> a color-stop's <color> value, followed by an one or two optional stop positions (either a <percentage> or a <length> along the gradient's axis). a percentage of 0%, or a length of 0, represents the center of the gradient; the value 100% represents the ...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
is change. firefox writes a warning to the javascript console when it ignores a call to document.write(). lack of reparsing prior to html5, parsers reparsed the document if they hit the end of the file within certain elements or within comments. for example, if the document lacked a </title> closing tag, the parser would reparse to look for the first '<' in the document, or if a comment was not closed, it would look for the first '>'. this behavior created a security vulnerability. if an attacker could force a premature end-of-file, the parser might change which parts of the document it considered to be executable scripts. in addition, supporting reparsing led to unnecessarily complex parsing code. with html5, parsers no longer reparse documents. this change has the following consequences fo...
...necessarily complex parsing code. with html5, parsers no longer reparse documents. this change has the following consequences for web developers: if you omit the closing tag for <title>, <style>, <textarea>, or <xmp>, the page will fail to be parsed. ie already fails to parse documents with a missing </title> tag, so if you test with ie, you probably don't have that problem. if you forget to close a comment, the page will most likely fail to be parsed. however, unclosed comments often already break in existing browsers for one reason or another, so it's unlikely that you have this issue in sites that are tested in multiple browsers. in an inline script, in order to use the literal strings <script, </script>, and <!--, you should prevent them from being parsed literally by expressing them...
... can nest svg, mathml and html as you’d expect to be able to nest them. the parser case-corrects markup so <svg viewbox='0 0 10 10'> works in html source. the dom methods and css selectors behave case-sensitively, so you need to write your dom calls and css selectors using the canonical case, which is camelcase for various parts of svg such as viewbox. the syntax <foo/> opens and immediately closes the foo element if it is a mathml or svg element (i.e. not an html element). attributes are tokenized the same way they are tokenized in html, so you can omit quotes in the same situations where you can omit quotes in html (i.e. when the attribute value is not the empty string and does not contain whitespace, ", ', `, <, =, or >). warning: the two above features do not combine well due to the ...
...mproved performance compared to older parsers, because most of the time, gecko can complete these tasks in parallel. to best take advantage of speculative parsing, and help your pages to load as quickly as possible, ensure that when you call document.write(), you write a balanced sub-tree within that chunk of script. a balanced sub-tree is html code in which any elements that are opened are also closed, so that after the script, the elements left open are the same ones that were open before the script. the open and closing tags do not need to be written by the same document.write() call, as long as they are within the same <script> tag. please note that you shouldn't use end tags for void elements that don't have end tags: <area>, <base>, <br>, <col>, <command>, <embed>, <hr>, <img>, <input>,...
<dialog>: The Dialog element - HTML: Hypertext Markup Language
Web › HTML › Element › dialog
ermitted aria roles alertdialog dom interface htmldialogelement attributes this element includes the global attributes. the tabindex attribute must not be used on the <dialog> element. open indicates that the dialog is active and can be interacted with. when the open attribute is not set, the dialog shouldn't be shown to the user. usage notes <form> elements can close a dialog if they have the attribute method="dialog". when such a form is submitted, the dialog closes with its returnvalue property set to the value of the button that was used to submit the form. the ::backdrop css pseudo-element can be used to style behind a <dialog> element when the dialog is displayed with htmldialogelement.showmodal(). for example, to dim unreachable content behind the moda...
... living standard html 5.2the defini...
... living standard html 5.2the definition of '<dialog>' in that specification. recommendation initial def...
... living standard html 5.2the definition of '<dialog>' in that specification. recommendation initial definition ...
Connection management in HTTP/1.x - HTTP
applications. in http/1.x, there are several models: short-lived connections, persistent connections, and http pipelining. http mostly relies on tcp for its transport protocol, providing a connection between the client and the server. in its infancy, http used a single model to handle such connections. these connections were short-lived: a new one created each time a request needed sending, and closed once the answer had been received. this simple model held an innate limitation on performance: opening each tcp connection is a resource-consuming operation. several messages must be exchanged between the client and the server. network latency and bandwidth affect performance when a request needs sending. modern web pages require many requests (a dozen or more) to serve the amount of informatio...
...e-consuming, but a tcp connection adapts to its load, becoming more efficient with more sustained (or warm) connections. short-lived connections do not make use of this efficiency feature of tcp, and performance degrades from optimum by persisting to transmit over a new, cold connection. this model is the default model used in http/1.0 (if there is no connection header, or if its value is set to close). in http/1.1, this model is only used when the connection header is sent with a value of close. unless dealing with a very old system, which doesn't support a persistent connection, there is no compelling reason to use this model. persistent connections short-lived connections have two major hitches: the time taken to establish a new connection is significant, and performance of the underly...
...a persistent connection has been designed, even prior to http/1.1. alternatively this may be called a keep-alive connection. a persistent connection is one which remains open for a period of time, and can be reused for several requests, saving the need for a new tcp handshake, and utilizing tcp's performance enhancing capabilities. this connection will not stay open forever: idle connections are closed after some time (a server may use the keep-alive header to specify a minimum time the connection should be kept open). persistent connections also have drawbacks; even when idling they consume server resources, and under heavy load, dos attacks can be conducted. in such cases, using non-persistent connections, which are closed as soon as they are idle, can provide better performance. http/1.0 ...
...he connection should be kept open). persistent connections also have drawbacks; even when idling they consume server resources, and under heavy load, dos attacks can be conducted. in such cases, using non-persistent connections, which are closed as soon as they are idle, can provide better performance. http/1.0 connections are not persistent by default. setting connection to anything other than close, usually retry-after, will make them persistent. in http/1.1, persistence is the default, and the header is no longer needed (but it is often added as a defensive measure against cases requiring a fallback to http/1.0). http pipelining http pipelining is not activated by default in modern browsers: buggy proxies are still common and these lead to strange and erratic behaviors that web deve...
HTTP Index - HTTP
Web › HTTP › Index
with the requesting website. it allows web developers to have more control over the data stored locally by a browser for their origins. 69 connection http, headers, reference, web the connection general header controls whether or not the network connection stays open after the current transaction finishes. if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done. 70 content-disposition http, reference, header in a multipart/form-data body, the http content-disposition general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to. the subpart is delimited by the boundary defined in the content-type header...
...(redirection) or 201 (created) status response. 167 origin http, reference, request header, header, origin the origin request header indicates where a fetch originates from. it doesn't include any path information, but only the server name. it is sent with cors requests, as well as with post requests. it is similar to the referer header, but, unlike this header, it doesn't disclose the whole path. 168 pragma caching, deprecated, http, header, request the pragma http/1.0 general header is an implementation-specific header that may have various effects along the request-response chain. it is used for backwards compatibility with http/1.0 caches where the cache-control http/1.1 header is not yet present. 169 proxy-authenticate http, http hea...
...response indicating the outcome of processing the request. it is intended for cases where another process or server handles the request, or for batch processing. 224 203 non-authoritative information http, http status code, reference, status code, successful response the http 203 non-authoritative information response status indicates that the request was successful but the enclosed payload has been modified by a transforming proxy from that of the origin server's 200 (ok) response . 225 204 no content http, reference, status code, success the http 204 no content success status response code indicates that the request has succeeded, but that the client doesn't need to go away from its current page. a 204 response is cacheable by default. an etag header ...
...s not fulfilled. in that case, the request, usually an upload or a modification of a resource, cannot be made and this error response is sent back. 248 413 payload too large client error, http, http status code, reference, status code the http 413 payload too large response status code indicates that the request entity is larger than limits defined by server; the server might close the connection or return a retry-after header field. 249 414 uri too long client error, http, reference, status code the http 414 uri too long response status code indicates that the url requested by the client is longer than the server is willing to interpret. 250 415 unsupported media type client error, http, http status code, reference, status code the...
MathML element reference - MathML
he mathml parser (see bug 276028). if you want to learn more about content markup you should consider chapter 4 in the mathml 3 specification. mathml elements implement the mathmlelement class. ...
...parser (see bug 276028). if you want to learn more about content markup you should consider chapter 4 in the mathml 3 specification. mathml elements implement the mathmlelement class. ...
...u want to learn more about content markup you should consider chapter 4 in the mathml 3 specification. mathml elements implement the mathmlelement class. ...
...able or a matrix) u <munder> (underscript) <munderover> (underscript-overscript pair) other elements <semantics> (container for semantic annotations) <annotation> (data annotations) <annotation-xml> (xml annotations) mathml presentation elements by category top-level elements <math> token elements <mglyph> <mi> <mn> <mo> <ms> <mspace> <mtext> general layout <menclose> <merror> <mfenced> <mfrac> <mpadded> <mphantom> <mroot> <mrow> <msqrt> <mstyle> script and limit elements <mmultiscripts> <mover> <mprescripts> <msub> <msubsup> <msup> <munder> <munderover> <none> tabular math <maligngroup> <malignmark> <mlabeledtr> <mtable> <mtd> <mtr> elementary math <mlongdiv> <mscarries> <mscarry> <msgroup> <msline> <msrow> <mstac...
Web video codec guide - Web media technologies
busyness that appears as a flickering haziness or shimmering that roughly follows outside the edges of objects with hard edges or sharp transitions between foreground objects and the background. the effect can be similar in appearance to ringing. the photo above shows mosquito noise in a number of places, including in the sky surrounding the bridge. in the upper-right corner, an inset shows a close-up of a portion of the image that exhibits mosquito noise. mosquito noise artifacts are most commonly found in mpeg video, but can occur whenever a discrete cosine transform (dct) algorithm is used; this includes, for example, jpeg still images. motion compensation block boundary artifacts compression of video generally works by comparing two frames and recording the differences between them, ...
...ting the new frame. this object that describes the shift and the pixel differences is called a residual frame. original frame inter-frame differences difference after motion compensation the first full frame as seen by the viewer. here, only the differences between the first frame and the following frame are seen. everything else is black. looking closely, we can see that the majority of these differences come from a horizontal camera move, making this a good candidate for motion compensation. to minimize the number of pixels that are different, here we take into account the panning of the camera by first shifting the first frame to the right by two pixels, then by taking the difference. this compensates for the panning of the camera, allowin...
... represented by fewer residual frames. the absolute minimum frame rate that a video can be before its contents are no longer perceived as motion by the human eye is about 12 frames per second. less than that, and the video becomes a series of still images. motion picture film is typically 24 frames per second, while standard definition television is about 30 frames per second (slightly less, but close enough) and high definition television is between 24 and 60 frames per second. anything from 24 fps upward will generally be seen as satisfactorily smooth; 30 or 60 fps is an ideal target, depending on your needs. in the end, the decisions about what sacrifices you're able to make are entirely up to you and/or your design team. codec details av1 the aomedia video 1 (av1) codec is an open form...
...high bit rate: x264 --crf 18 -preset ultrafast --output outfilename.mp4 infile while other codecs may have better best-case quality levels when compressing the video by a significant margin, their encoders tend to be slow enough that the nearly-lossless encoding you get with this compression is vastly faster at about the same overall quality level. recording video given the constraints on how close to lossless you can get, you might consider using avc or av1. for example, if you're using the mediastream recording api to record video, you might use code like the following when creating your mediarecorder object: const kbps = 1024; const mbps = kbps*kbps; const options = { mimetype: 'video/webm; codecs="av01.2.19h.12.0.000.09.16.09.1, flac"', bitspersecond: 800*mbps, }; let recorder = ...
2015 MDN Fellowship Program - Archive of obsolete content
we are not accepting applications. this page is a historical archive, originally hosted at /fellowship, and was localized. more information: mdn/developerfellowship wiki page. announcing the mdn fellows! blog post, may 14 2015. mdn fellows successfully oriented blog post, july 6 2015. mdn fellows: what they did & what’s next blog post, september 23, 2015. 2015 mdn fellowship program launching in q1 2015, the mozilla developer fellowship intends to accelerate the involvement of highly-skilled and experienced web developers with the open web. ...
...2015, the mozilla developer fellowship intends to accelerate the involvement of highly-skilled and experienced web developers with the open web. who web and mobile developers with an established track record of contributions and expertise in a specific web technology, function or domain who wish to increase the effectiveness of their teaching and communications. what seven weeks of partnering closely with mozilla to (1) build curriculum, code, or likely both; and (2) receive coaching, training and best practices for effectively communicating and educating with technical information. we expect this to be between 5-10 hours of your time per week. specific projects (we encourage you to target one of these in your application): testthewebforward brief project description mozilla participa...
...for any related visas (mozilla can provide any necessary supporting documentation). fellows will be required to sign mozilla’s fellowship agreement in order to participate. if you’ve read all of this and still have a question, contact diane tate at diane@mozilla.com. if you don’t have specific questions and just want to introduce yourself, please use the application form. applications are closed. the application period has ended. watch this space for information about our 2015 fellows! ...
io/byte-streams - Archive of obsolete content
experimental provides streams for reading and writing bytes. function readbinarydatafromfile (filename) { var fileio = require("sdk/io/file"); var data = null; if (fileio.exists(filename)) { var bytereader = fileio.open(filename, "rb"); if (!bytereader.closed) { data = bytereader.read(); bytereader.close(); } } return data; } function writebinarydatatofile(data, filename) { var fileio = require("sdk/io/file"); var bytewriter = fileio.open(filename, "wb"); if (!bytewriter.closed) { bytewriter.write(data); bytewriter.close(); } } globals constructors bytereader(inputstream) creates a binary input stream that reads bytes from a backing stream. you can also create bytereader objects using io/file's open() function. parameters inputstre...
...reate bytereader objects using io/file's open() function. parameters inputstream : stream the backing stream, an nsiinputstream. bytewriter(outputstream) creates a binary output stream that writes bytes to a backing stream. you can also create bytewriter objects using io/file's open() function. parameters outputstream : stream the backing stream, an nsioutputstream. bytereader methods close() closes both the stream and its backing stream. if the stream is already closed, an exception is thrown. read(numbytes) reads a string from the stream. if the stream is closed, an exception is thrown. parameters numbytes : number the number of bytes to read. if not given, the remainder of the entire stream is read. returns string : a string containing the bytes read. if the stream is at ...
...m. if the stream is already closed, an exception is thrown. read(numbytes) reads a string from the stream. if the stream is closed, an exception is thrown. parameters numbytes : number the number of bytes to read. if not given, the remainder of the entire stream is read. returns string : a string containing the bytes read. if the stream is at the end, returns the empty string. properties closed true if the stream is closed. bytewriter methods close() closes both the stream and its backing stream. if the stream is already closed, an exception is thrown. write(str) writes a string to the stream. if the stream is closed, an exception is thrown. parameters str : string the string to write. properties closed true if the stream is closed. ...
ui/toolbar - Archive of obsolete content
experimental add a toolbar to the firefox user interface. a toolbar is a horizontal strip of user interface real estate. like a panel, a toolbar's content is specified using html. unlike a panel, a toolbar: does not overlap with any web content is persistent, remaining visible until the user chooses to close it is a fixed size, and appears in a fixed location usage creating and destroying toolbars you don't specify toolbar content directly: instead, you create other ui components and supply them to the toolbar constructor. you can supply three sorts of ui components: action buttons toggle buttons frames this add-on builds part of the user interface for a music player using action buttons for the controls and a frame to display art and the currently playing song: var { actio...
...] }); the toolbar appears just above the content window: to destroy a toolbar call its destroy() method. showing and hiding toolbars by default, a toolbar is shown when it is created, although you can specify that a toolbar should be hidden initially by passing hidden:true as an option in its constructor. after that, though, you can't show or hide the toolbar programmatically. toolbars get a close button at the right-hand side, and users can show or hide the toolbar using the firefox "view/toolbars" menu, alongside built-in toolbars like the bookmarks toolbar. hidden state persists even over create/destroy cycles: if a toolbar is created, then hidden, then destroyed, and another toolbar with the same title is then created, the new toolbar will be in the hidden state. toolbar events tool...
...ame = new frame({ url: "./frame.html" }); var toolbar = toolbar({ title: "my toolbar", items: [frame] }); toolbar.on("show", showing); function showing(e) { console.log("showing"); console.log(e.title); console.log(e.items[0]); console.log(e.hidden); } arguments toolbar : the toolbar that was shown. hide this event is emitted when the user hides the toolbar, either using the "close" button or using the "toolbars" menu. the listener is passed the toolbar instance that was hidden: var { toolbar } = require("sdk/ui/toolbar"); var { frame } = require("sdk/ui/frame"); var frame = new frame({ url: "./frame.html" }); var toolbar = toolbar({ title: "my toolbar", items: [frame] }); toolbar.on("hide", hiding); function hiding(e) { console.log("hiding"); console.log(e.t...
Tabbox - Archive of obsolete content
obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
...2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. ...
... var tabs=document.getelementbyid("tabs"); var tabpanels=document.getelementbyid("tabpanels"); tabpanels.removechild(tabpanels.childnodes[currentindex]); tabs.removeitemat(currentindex); /*work around if last tab is removed, widget fails to advance to next tab*/ if(-1 == tabbox.selectedindex && tabs.childnodes.length>0){ tabbox.selectedindex=0; } } creating a close tab button to have a tab close button, you must configure the style. examples: .tabs-closebutton { list-style-image: url(http://mozilla.org/favicon.ico); } .tabs-closebutton { list-style-image: url("chrome://global/skin/icons/close.gif"); } ...
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
d extra2. the labels for these buttons are set using the buttonlabelextra1 and buttonlabelextra2 attributes on the root element, which take arbitrary strings as their values. the action taken when pressing one of these buttons is defined by an event handler with the name ondialog<button name>. ...
...g either the accept button or cancel button will simply close that dialog. listing 8 shows a simple dialog example, and figure 5 shows its output. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="chrome://global/skin/"?> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="my dialog" buttons="accept,cancel" ondialogaccept="savevalues(); window.close();" ondialogcancel="window.close();"> <checkbox label="my option"/> </dialog> listing 8: a dialog figure 5: output from listing 8 note: the functions behind the dialog elements discussed here require "xpconnect privileges," which are discussed in chapter 4, so this example will only run correctly if it can run as firefox code itself or installed extension code. please be aware that if...
...ion, use any image as the one to display and place it in the same folder as the xul document. using the icon attribute instead of the image attribute allows you to display buttons with icons that are standard for the platform. possible values for the icon attribute are given in table 2. figure 8: a button with an image icon attribute value icon attribute value accept close cancel print help add open remove save refresh find go-forward clear go-back yes properties no select-font apply select-color table 2: values for the icon attribute toolbar buttons the toolbarbutton element is the element used to define toolbar buttons. this is typically placed ins...
Session store API - Archive of obsolete content
, nsiconsoleservice is used to display a message to the console. this event is sent just before a tab is restored. an event of type sstabrestored fires each time a tab has finished restoring. it's worth noting that this event is sent even if tab loading at startup is deferred until the user selects the tab. firefox 3 note in firefox 3 and later, if you need to detect when a tab is about to be closed so that you can update data associated with the tab before it is closed, you can watch for the "sstabclosing" event, which is sent to the tab. restoring without restarting firefox 3.6 note this section applies to firefox 3.6 and later. firefox 3.6 knows how to save session store data when the last browser window closes, even if there are still other windows open. similarly, it can now res...
... now possible for sessions to be restored even without the browser quitting and being relaunched. this is something you may need to keep in mind if you rely on the behavior of the session store system. the session restore process the exact sequence of events that occurs when a session is being restored is: a session state is about to be restored. this can be on startup or in response to undo close tab, since closed tabs are restored as single-tab sessions. new windows are opened as required (one for each window that was saved in the session store), and cookies and the list of recently closed tabs are restored. after that, the following steps are taken for each tab being restored: either an existing tab is reused or a new tab is created. in the latter case, a tabopen event is sent. t...
...ist in observer notifications. using the session store api in seamonkey there are a number of differences between the session store api in firefox and the api in seamonkey 2.0: the class name is @mozilla.org/suite/sessionstore;1 var ss = components.classes["@mozilla.org/suite/sessionstore;1"] .getservice(components.interfaces.nsisessionstore); when restoring a window, closed tabs in that window are not currently restored. when closing a tab, seamonkey does not generate sstab events. this means that you cannot currently tell if a tab has been saved or restored. however seamonkey reuses the browser element (up to the undo close tab limit) which means that you can set state on the browser element and it will be restored with the tab. ...
Promises - Archive of obsolete content
recated. the following page contains examples of many promise-based replacement apis for common operations. these apis allow asynchronous operation to be achieved with a coding style similar to synchronous variants. the following examples make use of the task api, which harnesses generator functions to remove some of the syntactic clutter of raw promises, such that asynchronous promise code more closely resembles synchronous, procedural code. a task example like the following: components.utils.import("resource://gre/modules/task.jsm"); task.spawn(function* () { var response = yield request("login", { username: user, password: password }); if (response.messages) { try { yield publish({ username: user, messages: response.messages }); } catch (e) { ...
...path, { encoding: "utf-8" })); let files = []; // get the directory contents from a list of directories. for (let dir of config.directories) { // iterate over the contents of the directory. let iter = new os.file.directoryiterator(dir); yield iter.foreach(entry => { if (!entry.isdir) files.push(entry.path); }); iter.close(); } // read the files as binary blobs and process them. let processor = new fileprocessor(); for (let file of files) { let data = yield os.file.read(file); processor.add(data); } // now write the processed files back out, as a binary blob. yield os.file.writeatomic(config.processedpath, processor.process(), ...
...tbyname("task"), row.getresultbyname("group")); } }); // and quickly grab a single row value. let [row] = yield db.execute( "select value from nodes where key = 'timestamp' \ order by value desc limit 1"); latesttimestamp = row.getresultbyindex(0); } finally { // make sure to close the database when finished. // failure to do this will prevent firefox from shutting down // cleanly. yield db.close(); } }); promise wrappers and helpers the following are some example promise-based wrappers for common callback-based asynchronous apis. addonmanager var aom = { __proto__: addonmanager, addon: function addon(addon) { if (!(addon && ...
Reading textual data - Archive of obsolete content
not doing so can cause problems if you try to rename or delete the file at a later time on some platforms. note that you may get less characters than you asked for, especially (but not only) at the end of the file (stream). unsupported byte sequences you can specify what should happen with byte sequences that do not correspond to a valid charac...
...nit(fis, charset, 1024, replacementchar); now you can read string from is: var str = {}; var numchars = is.readstring(4096, str); if (numchars != 0 /* eof */) var read_string = str.value; to read the entire stream and do something with the data: var str = {}; while (is.readstring(4096, str) != 0) { processdata(str.value); } don't forget to close the stream when you're done with it (is.close()). not doing so can cause problems if you try to rename or delete the file at a later time on some platforms. note that you may get less characters than you asked for, especially (but not only) at the end of the file (stream). unsupported byte sequences you can specify what should happen with byte sequences that do not correspond to a valid character. the last (4th) argument to init specifies...
....org/network/file-input-stream;1"] .createinstance(components.interfaces.nsifileinputstream); fis.init(file, -1, -1, 0); var lis = fis.queryinterface(components.interfaces.nsilineinputstream); var linedata = {}; var cont; do { cont = lis.readline(linedata); var line = converter.converttounicode(linedata.value); // now you can do something with line } while (cont); fis.close(); see also writing textual data joel on software: the absolute minimum every software developer absolutely, positively must know about unicode and character sets ...
Venkman Introduction - Archive of obsolete content
g scripts into the debugger"). the menubar, toolbar, and all of the views can be collapsed or hidden, giving you a lot of control over the debugging environment. the source code view is empty until you select a script, and the interactive session view starts up with basic startup information. each of the views has a label, a float button that lets you display the view in its own window, and a close button that puts the view away until you want to display it again, as seen in figure 2. the following section describes these views and their use within the interface as a whole. getting acquainted with venkman's user interface toolbar the toolbar is located at the top of the debugger. the toolbar contains icons for stop, continue, step over, step into, step out, profile, and pretty print c...
...e constructor by selecting "find constructor" from the property's context menu. you can find the place where the object was instantiated with the "find creator" command. by default, properties of type function are not displayed, in order to conserve space in the view. if you would like to have functions displayed, check the "include functions" menu item in the view's context menu. you may need to close and re-open any objects you had open to see the change. properties that show up in a bold grey font are defined on an object from the prototype chain, and not on the actual object you are inspecting. if you would like to inspect the object's prototype and parent chains, check the "include ecma properties" menu item in the view's context menu. if a property shows up in a bold red font, an excepti...
... over the arrangement and display of views within the application. the debugger is built on top of an application framework that allows you to drag and drop, resize, and toggle all the available views, and even to create new views or modules for the debugger if you choose—though this latter is an advanced topic and a subject for a future article. to remove a view from venkman, simply click the close button at the top right of that view. when the view again becomes necessary—for example, when you open a source file from the loaded scripts view and want to view the source—the view reappears where it was last positioned. to make a view reappear explicitly, select it from the view->show/hide menu of the debugger. you can also make views float in their own separate windows. to make a view flo...
confirm - Archive of obsolete content
ing implementation can freely decide where each of the three buttons is placed. the following examples show the result of calling confirm() with three buttons 0='a', 1='b' and 2='c'. firefox on linux mozilla application suite on win32 it is therefore recommended to only use two buttons wherever possible, and to keep in mind that button 1 has the same return value as "window closed" (see below). abutton0title custom title for button 0. abutton1title custom title for button 1. abutton2title custom title for button 2. acheckmsg a string to display as a checkbox label. acheckstate an object with a boolean value property representing the state of the checkbox: when the dialog box is shown, its chec...
...itle custom title for button 1. abutton2title custom title for button 2. acheckmsg a string to display as a checkbox label. acheckstate an object with a boolean value property representing the state of the checkbox: when the dialog box is shown, its checkbox will be checked when this object's value is true. after the user presses a button (or closes the window), the value property is updated according to the checkbox. var check = { value: false }; var button = confirm("are you sure you want to install foobar 0.1?", "confirm", std_yes_no_buttons, null, null, null, "install fluxcompensator 0.4 as well", ...
... "confirm", std_yes_no_buttons, null, null, null, "install fluxcompensator 0.4 as well", check); returns the return value is an integer indicating which button the user selected: value button 0 'cancel' or button 1. also: user closed the dialog window 1 'ok' or button 0 2 the third button previous versions of the xpinstall api stated the return value of confirm() to be a boolean. that is incorrect, confirm() always returned a plain integer (in pre-gecko-1.8 versions either 0 or 1). notes the preferred method for detecting support for custom dialog boxes is querying the exi...
Attribute (XUL) - Archive of obsolete content
ll beforeselected buttonaccesskeyaccept buttonaccesskeycancel buttonaccesskeydisclosure buttonaccesskeyextra1 buttonaccesskeyextra2 buttonaccesskeyhelp buttonalign buttondir buttondisabledaccept buttonlabelaccept buttonlabelcancel buttonlabeldisclosure buttonlabelextra1 buttonlabelextra2 buttonlabelhelp buttonorient buttonpack buttons checked checkstate clicktoscroll class closebutton closemenu coalesceduplicatearcs collapse collapsed color cols command commandupdater completedefaultindex container containment contentcontextmenu contenttooltip context contextmenu control crop curpos current currentset customindex customizable cycler datasources decimalplaces default defaultbutton defaultset description dir disableautocomplete disableautose...
...menu coalesceduplicatearcs collapse collapsed color cols command commandupdater completedefaultindex container containment contentcontextmenu contenttooltip context contextmenu control crop curpos current currentset customindex customizable cycler datasources decimalplaces default defaultbutton defaultset description dir disableautocomplete disableautoselect disableclose disabled disablehistory disablekeynavigation disablesecurity dlgtype dragging editable editortype element empty emptytext deprecated since gecko 2 enablecolumndrag enablehistory equalsize eventnode events expr firstdayofweek firstpage first-tab fixed flags flex focused forcecomplete grippyhidden grippytooltiptext group handlectrltab height helpuri hidden hidechro...
...tselected last-tab left linkedpanel max maxheight maxlength maxpos maxrows maxwidth member menu menuactive min minheight minresultsforpopup minwidth mode modifiers mousethrough movetoclick multiline multiple name negate newlines next noautofocus noautohide noinitialfocus nomatch norestorefocus object observes onbeforeaccept onbookmarkgroup onchange onclick onclosetab oncommand oncommandupdate ondialogaccept ondialogcancel ondialogclosure ondialogextra1 ondialogextra2 ondialoghelp onerror onerrorcommand onextra1 onextra2 oninput onload onnewtab onpageadvanced onpagehide onpagerewound onpageshow onpaneload onpopuphidden onpopuphiding onpopupshowing onpopupshown onsearchcomplete onselect ontextcommand ontextentered ontextrevert o...
findbar - Archive of obsolete content
ar browser element by either setting the findbar's browserid attribute to the id of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself. attributes browserid, findnextaccesskey, findpreviousaccesskey, highlightaccesskey, matchcaseaccesskey properties browser, findmode methods close, onfindagaincommand, open, startfind, togglehighlight example <browser type="content-primary" flex="1" id="content" src="about:blank"/> <findbar id="findtoolbar" browserid="content"/> attributes browserid type: string the id of the browser element to which the findbar is attached. this attribute is only used when the findbar is constructed. you should use the browser property to get...
... open( mode ) return type: no return value opens the findbar using the specified mode, which should be one of find_normal, find_typeahead, or find_links. if you don't pass a mode, the last-used mode for the same findbar is used. if the findbar hasn't been used befor...
... open( mode ) return type: no return value opens the findbar using the specified mode, which should be one of find_normal, find_typeahead, or find_links. if you don't pass a mode, the last-used mode for the same findbar is used. if the findbar hasn't been used before, find_normal is the default. onfind...
Floating Panels - Archive of obsolete content
nel around on the screen. a floating panel can be created using the panel element with at least two additional attributes as in the following example: <panel id="tools-panel" noautohide="true" titlebar="normal"> <label control="name" value="name:"/> <textbox id="name"/> </panel> the noautohide attribute is used to indicate that the panel is not temporary. when set to true, the popup will not close when the user clicks outside of it, nor when the user presses the escape key. the titlebar attribute creates a panel with a titlebar. currently, only the value normal is supported, which creates a default titlebar. in the future, a distinction will be available to support titlebars of differing styles. the floating panel can be placed and moved independently of the main window, however it will al...
...other application is made active, and become visible again when the xul application is made active. a floating panel may contain any type of element. a label for the titlebar may be set using the label attribute, as in the following example: <panel id="info-panel" noautohide="true" titlebar="normal" label="image properties"> closing a floating panel unlike other panels, a floating panel does not close when clicking outside of it. you can use the close attribute to have a close button on the titlebar. when the user presses it, the popup will be closed. <panel id="info-panel" noautohide="true" titlebar="normal" label="image properties" close="true"> the hidepopup method may be used to manually close a popup. see closing a popup for more information about this. the hidepopup method would be used...
...ou can use the close attribute to have a close button on the titlebar. when the user presses it, the popup will be closed. <panel id="info-panel" noautohide="true" titlebar="normal" label="image properties" close="true"> the hidepopup method may be used to manually close a popup. see closing a popup for more information about this. the hidepopup method would be used if you wish to place your own close button on the panel, or wish to close the panel in response to a user action. ...
More Tree Features - Archive of obsolete content
s which specify the hierarchy of the items in a tree. each item in the tree has a level starting at 0. the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. the tree will query the view for the level of each item in order to determine how to draw the rows. the tree will draw the open and close icons to open and close a parent item as well as lines connecting the children to their parents. the tree will also handle drawing the rows with the right level of indenting. however, the view will need to make sure it keeps track of the level of the rows as necessary. this can sometimes be quite tricky, but fortunately, the built-in content tree view does all of the hard work for us. to create a...
... the container attribute to it as follows: <treeitem container="true" /> this allows the user to click on the row that corresponds to the treeitem to expand and collapse the inner rows. you can have the child rows initially displayed by adding the open attribute. when the user expands and collapses the parent, the view's toggleopenstate function will be called to toggle the item between open and closed. for a content tree view, this will set the open attribute to reflect the current state. the second change is that you must put the primary attribute on the first column. this causes a small triangle or plus sign to appear before the cells in that column to indicate the cells that can be expanded. in addition, child rows are indented. note also that the user cannot hide the primary column using ...
... label="jerry" /> <treecell label="hodge" /> </treerow> </treeitem> </treechildren> </treeitem> </treechildren> </tree> this has created a hierarchical tree. as can be seen in the image, a small plus or minus sign (often called a twisty) has appeared next to the first row, indicating that it contains child rows. by clicking the row, the user can open and close the list. the child rows are indented. notice how the guys row only needs one column as it is a placeholder item for its children. the outer treeitem element contains a single treerow element and a treechildren element. the former creates the data for the parent row and the latter contains the child items. you can nest rows deeper as well. remember that you must use the container attribute on row...
Using the Editor from XUL - Archive of obsolete content
ass null here (which tells the editor that it can edit everything under the <body> of the document). this parameter is more important when the editor is in a text widget, where it points to the the subtree of the parent document that corresponds to widget content. editor teardown window destruction, and hence editor teardown is initiated in two ways, listed below. ...
...parent document that corresponds to widget content. editor teardown window destruction, and hence editor teardown is initiated in two ways, listed below. in both cases, the editorcanclose() method is the javascript is called, which causes the nseditorshell to display a dialog asking the user if they want to save the document, throw away their changes, or cancel. note that if they cancel, the close operation is aborted. the user clicks the close widget in their os/window manager. in this case, the onclose method on the <window> element is called. ...
...orcanclose() method is the javascript is called, which causes the nseditorshell to display a dialog asking the user if they want to save the document, throw away their changes, or cancel. note that if they cancel, the close operation is aborted. the user clicks the close widget in their os/window manager. in this case, the onclose method on the <window> element is called. the user chooses 'close' from the file menu, uses the key shortcut, or quits the application, causing all windows to be closed. before each window is closed, javascript code in globaloverlay.js tries to call a trytoclose method on each window. in editor.js, we set this to call editorcanclose(). if the user chooses to save the document, or throw away their changes, then the window is closed. when the last reference to ...
button - Archive of obsolete content
the user selects one the buttons, the others in the group are unchecked. icon mozilla 1.8 type: string this attribute should be used to set the usage for common buttons. some platforms display these buttons with a small icon indicating their usage. this should be used in place of the image attribute. possible values include: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. if you are using a button that matches one of these common usages, use the icon attribute to indicate this. see the appearance of the different icons on some available platforms. image type: uri the uri of the image to appear on the element. if this attribute is empty or left out, no imag...
...l type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. orient type: one of the values below used to specify whether the children of the element are oriented horizontally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements ...
...ormal button. checkbox this type of button can be in two states. the user can click the button to switch between the states. this is not the same as a checkbox because it looks like a button. menu set the type attribute to the value menu to create a button with a menu popup. place a menupopup element inside the button in this case. the user may click anywhere on the button to open and close the menu. menu-button you can also use the value menu-button to create a button with a menu. unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. panel similar to the menu type, this opens a popup. place a panel element inside the button. panel elements are popups that sup...
dialog - Archive of obsolete content
e comma). warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown as an additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os). the default setting of browser.preferences.instantapply currently is true on linux and mac os and false on windows (which however might or might not change soon, see bug 738797 and bug 1037225). defaultbutton type: string normally this attribute should not be set, but if it is, it specifies the default butto...
... centerwindowonscreen() return type: no return value centers the dialog on the screen. getbutton( type ) return type: button element returns the button element in the dialog corresponding to the given type. movetoalertpos...
...attribute(), removeattributenode(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata acceptdialog() return type: no return value accepts the dialog and closes it, similar to pressing the ok button. canceldialog() return type: no return value cancels the dialog and closes it, similar to pressing the cancel button. centerwindowonscreen() return type: no return value centers the dialog on the screen. getbutton( type ) return type: button element returns the button element in the dialog corresponding to the given type. movetoalertposition() return type: no return value moves and resizes the dialog to a position and size suitable for an alert box. ...
splitter - Archive of obsolete content
her the element immediately before the splitter, or the element immediately after the splitter can be collapsed, if the size of that element would fall below the minimum size due to the position of the splitter. resizeafter type: one of the values below this attribute indicates which element to the right or below the splitter should be resized when the splitter is repositioned. ...
...sitioned. closest the element immediately to the right or below the splitter resizes. farthest the element that is the farthest away from the splitter to the right or below the splitter resizes. grow the elements to the right or below the splitter do not change size (unless they are flexible) when the splitter is dragged, but instead the entire container changes size. flex the closest flexible element resizes. resizebefore type: one of the values below this attribute indicates which element to the left or above the splitter should be resized when the splitter is repositioned. closest the element immediately to the left or above the splitter resizes. farthest the element that is the farthest away from the splitter to the left or above the splitter r...
... state type: one of the values below indicates whether the splitter has collapsed content or not. ...
Displaying notifications (deprecated) - Archive of obsolete content
n object, but does not actually display the notification. this lets you configure the event listeners before the notification is shown, if you need to be notified when the notification is dismissed. setting up event listeners on the notification there are two events you can listen to on created notifications: onclick this event is fired when the user clicks (or taps) on the notification. onclose this event is fired when the notification is closed (whether by being clicked or by some other means). note: if the notification is dismissed by the user clicking on it, both events will get fired. for example, let's simply append a little html to our document when these events fire: notification.onclick = function() { var e = document.createelement("p"); e.innerhtml = "<strong>the noti...
...by some other means). note: if the notification is dismissed by the user clicking on it, both events will get fired. ...
...ll get fired. ...
Game distribution - Game development
you've followed a tutorial or two and created an html5 game — that's great! this article covers all you need to know about the ways in which you can distribute your newly created game into the wild. this includes hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like google play or the ios app store. benefits of html5 over native building games with html5 gives you extra advantages, such as: multiplatform bliss the technology itself is multiplatform, so you can write the code once and target multiple devices. this can range from low-end smartphones or tablets, through laptops and desktop computers, to smart tvs, watches or even a fridge if it can handle a modern enough browser. you don't need to have separate teams to work on the same title...
...f you want to make money out of game dev, you should secure your source code one way or another against people who could easily take it and sell it as their own. you can concatenate and minify the code to make it smaller and uglify it so it's a lot harder to reverse engineer your game. another good measure to take is to provide an online demo if you're planning on packaging it and selling it in a closed store like itunes or steam. if you're working on a side project just for fun, then leaving the source open will benefit those who would like to learn from what you've created. you don't even have to worry about looking for a hosting provider as it's possible to host games on github pages. you'll get free hosting, version control and possible contributors if your project is interesting enough. ...
...humble bundle where the most popular indie games get presented to a broader audience. it's more like an excellent promotional opportunity than a way to earn a lot of money, however, as the prices paid for the games in a bundle are usually quite low. packaging games the web is the first and the best choice for html5 games, but if you want to reach a broader audience and distribute your game in a closed ecosystem, you still can do that by packaging it. the good thing is that you don't need a few separate teams working on the same game for different platforms — you can build it once and use tools like phonegap or cocoonio to package the game for native stores. the resulting packages are usually pretty reliable, but you should still test them and be on the lookout for small issues or bugs to fi...
Create the Canvas and draw on it - Game development
iable. then we're creating the ctx variable to store the 2d rendering context — the actual tool we can use to paint on the canvas. let's see an example piece of code that prints a red square on the canvas. add this below your previous lines of javascript, then load your index.html in a browser to try it out. ctx.beginpath(); ctx.rect(20, 40, 50, 50); ctx.fillstyle = "#ff0000"; ctx.fill(); ctx.closepath(); all the instructions are between the beginpath() and closepath() methods. we are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the second two specify the width and height of the rectangle. in our case the rectangle is painted 20 pixels from the left side of the screen and 40 pixels from the top ...
...erfect square. the fillstyle property stores a color that will be used by the fill() method to paint the square, in our case, red. we're not limited to rectangles — here's a piece of code for printing out a green circle. try adding this to the bottom of your javascript, saving and refreshing: ctx.beginpath(); ctx.arc(240, 160, 20, 0, math.pi*2, false); ctx.fillstyle = "green"; ctx.fill(); ctx.closepath(); as you can see we're using the beginpath() and closepath() methods again. between them, the most important part of the code above is the arc() method. it takes six parameters: x and y coordinates of the arc's center arc radius start angle and end angle (what angle to start and finish drawing the circle, in radians) direction of drawing (false for clockwise, the default, or true for ...
...css, color can be specified as a hexadecimal value, a color keyword, the rgba() function, or any of the other available color methods. instead of using fill() and filling the shapes with colors, we can use stroke() to only colour the outer stroke. try adding this code to your javascript too: ctx.beginpath(); ctx.rect(160, 10, 100, 40); ctx.strokestyle = "rgba(0, 0, 255, 0.5)"; ctx.stroke(); ctx.closepath(); the code above prints a blue-stroked empty rectangle. thanks to the alpha channel in the rgba() function, the blue color is semi transparent. compare your code here's the full source code of the first lesson, running live in a jsfiddle: exercise: try changing the size and color of the given shapes. next steps now we've set up the basic html and learned a bit about canvas, lets co...
Static method - MDN Web Docs Glossary: Definitions of Web-related terms
which is defined by an interface but can be called without instantiating an object of that type first. methods called on object instances are called instance methods. ...
...on object instances are called instance methods. ...
...d is called on the actual notification constructor itself — it is a static method: let promise = notification.requestpermission(); the notification.close() method on the other hand, is an instance method — it is called on an specific notification object instance to close the system notification it represents: let mynotification = new notification('this is my notification'); mynotification.close(); ...
How to build custom form controls - Learn web development
open state overlap a bit, the value may change but the option will definitely not be highlighted accordingly, once again because we did not define any keyboard interactions over options when the control is in its opened state (we have only defined what should happen when the control is opened, but nothing after that). we have to think a little further: what about the escape key? pressing esc key closes an open select. remember, if you want to provide the same functionality as the existing native <select>, it should behave the exact same way as the select for all users, from keyboard to mouse to touch to screen reader, and any other input device. in our example, the missing specifications are obvious so we will handle them, but it can be a real problem for exotic new controls. when it comes to...
...me we want to deactivate a custom control // it takes one parameter // select : the dom node with the `select` class to deactivate function deactivateselect(select) { // if the control is not active there is nothing to do if (!select.classlist.contains('active')) return; // we need to get the list of options for the custom control var optlist = select.queryselector('.optlist'); // we close the list of option optlist.classlist.add('hidden'); // and we deactivate the custom control itself select.classlist.remove('active'); } // this function will be used each time the user wants to (de)activate the control // it takes two parameters: // select : the dom node with the `select` class to activate // selectlist : the list of all the dom nodes with the `select` class function acti...
... controls // because the deactivateselect function fulfills all the requirements of the // foreach callback function, we use it directly without using an intermediate // anonymous function. ...
Advanced text formatting - Learn web development
etc.) is quoted from somewhere else, you should wrap it inside a <blockquote> element to signify this, and include a url pointing to the source of the quote inside a cite attribute. ...
... inline quotations inline quotations work in exactly the same way, except that they use the <q> element. ...
... active learning: who said that? time for another active learni...
Responsive images - Learn web development
srcset list that has the same size as the slot or, if there isn't one, the first image that is bigger than the chosen slot size. and that's it! at this point, if a supporting browser with a viewport width of 480px loads the page, the (max-width: 600px) media condition will be true, and so the browser chooses the 480px slot. the elva-fairy-480w.jpg will be loaded, as its inherent width (480w) is closest to the slot size. the 800px picture is 128kb on disk, whereas the 480px version is only 63kb — a saving of 65kb. now, imagine if this was a page that had many pictures on it. using this technique could save mobile users a lot of bandwidth. note: when testing this with a desktop browser, if the browser fails to load the narrower images when you've got its window set to the narrowest width, h...
... alt="chris standing up holding his daughter elva"> let's fix this, with <picture>! like <video> and <audio>, the <picture> element is a wrapper containing several <source> elements that provide different sources for the browser to choose from, followed by the all-important <img> element. ...
...have fun! ...
Client-side storage - Learn web development
you how: first, go to our web storage blank template on github (open this in a new tab). open the javascript console of your browser's developer tools. all of your web storage data is contained within two object-like structures inside the browser: sessionstorage and localstorage. the first one persists data for as long as the browser is open (the data is lost when the browser is closed) and the second one persists data even after the browser is closed and then opened again. we'll use the second one in this article as it is generally more useful. the storage.setitem() method allows you to save a data item in storage — it takes two parameters: the name of the item, and its value. try typing this into your javascript console (change the value to your own name, if you wish!):...
... look at this in action. open our web storage blank template again, but this time in a different browser to the one you've got this tutorial open in! this will make it easier to deal with. type these lines into the browser's javascript console: localstorage.setitem('name','chris'); let myname = localstorage.getitem('name'); myname you should see the name item returned. now close down the browser and open it up again. enter the following lines again: let myname = localstorage.getitem('name'); myname you should see that the value is still available, even though the browser has been closed and then opened again. separate storage for each domain there is a separate data store for each domain (each separate web address loaded in the browser). you will see tha...
...re large assets in an indexeddb database, avoiding the need to download them more than once. this is already a great improvement to the user experience, but there is still one thing missing — the main html, css, and javascript files still need to be downloaded each time the site is accessed, meaning that it won't work when there is no network connection. this is where service workers and the closely-related cache api come in. a service worker is a javascript file that, simply put, is registered against a particular origin (web site, or part of a web site at a certain domain) when it is accessed by a browser. when registered, it can control pages available at that origin. it does this by sitting between a loaded page and the network and intercepting network requests aimed at that origin. ...
Drawing graphics - Learn web development
calling fill(), we draw a line to the center of the circle. this means that we get the rather nice pac-man-style cutout rendered. if you removed this line (try it!) then re-ran the code, you'd get just an edge of the circle chopped off between the start and end point of the arc. this illustrates another important point of the canvas — if you try to fill an incomplete path (i.e. one that is not closed), the browser fills in a straight line between the start and end point and then fills it in. that's it for now; your final example should look like this: note: the finished code is available on github as 3_canvas_paths.html. note: to find out more about advanced path drawing features such as bézier curves, check out our drawing shapes with canvas tutorial. text canvas also has ...
...s yourself. webgl it's now time to leave 2d behind, and take a quick look at 3d canvas. 3d canvas content is specified using the webgl api, which is a completely separate api from the 2d canvas api, even though they both render onto <canvas> elements. webgl is based on opengl (open graphics library), and allows you to communicate directly with the computer's gpu. as such, writing raw webgl is closer to low level languages such as c++ than regular javascript; it is quite complex but incredibly powerful. using a library because of its complexity, most people write 3d graphics code using a third party javascript library such as three.js, playcanvas, or babylon.js. most of these work in a similar way, providing functionality to create primitive and custom shapes, position viewing cameras and ...
... = 5; the perspectivecamera() constructor takes four arguments: the field of view: how wide the area in front of the camera is that should be visible onscreen, in degrees. the aspect ratio: usually, this is the ratio of the scene's width divided by the scene's height. using another value will distort the scene (which might be what you want, but usually isn't). the near plane: how close to the camera objects can be before we stop rendering them to the screen. think about how when you move your fingertip closer and closer to the space between your eyes, eventually you can't see it anymore. the far plane: how far away things are from the camera before they are no longer rendered. we also set the camera's position to be 5 distance units out of the z axis, which, like in cs...
Handling text — strings in JavaScript - Learn web development
ble quotes"; sgl; dbl; there is very little difference between the two, and which you use is down to personal preference. you should choose one and stick to it, however; differently quoted code can be confusing, especially if you use two different quotes on the same string! the following will return an error: let badquotes = 'what on earth?"; the browser will think the string has not been closed because the other type of quote you are not using to contain your strings can appear in the string. for example, both of these are okay: let sgldbl = 'would you eat a "fish supper"?'; let dblsgl = "i'm feeling blue."; sgldbl; dblsgl; however, you can't include the same quote mark inside the string if it's being used to contain them. the following will error, as it confuses the browser as to...
...ow are you?". in the last instance, we joined only two strings, but you can join as many as you like, as long as you include a + between each pair. try this: let multiple = one + one + one + one + two; multiple; you can also use a mix of variables and actual strings. try this: let response = one + 'i am fine — ' + two; response; note: when you enter an actual string in your code, enclosed in single or double quotes, it is called a string literal. concatenation in context let's have a look at concatenation being used in action — here's an example from earlier in the course: <button>press me</button> const button = document.queryselector('button'); button.onclick = function() { let name = prompt('what is your name?'); alert('hello ' + name + ', nice to see you!'); } ...
...ude expression results inside them, traditional strings can be fiddly to write: let score = 9; let highestscore = 10; let output = 'i like the song "' + song + '". i gave it a score of ' + (score/highestscore * 100) + '%.'; template literals simplify this enormously: output = `i like the song "${ song }". i gave it a score of ${ score/highestscore * 100 }%.`; there is no more need to open and close multiple string pieces — the whole lot can just be wrapped in a single pair of backticks. when you want to include a variable or expression inside the string, you include it inside a ${ } construct, which is called a placeholder. you can include complex expressions inside template literals, for example: let examscore = 45; let examhighestscore = 70; examreport = `you scored ${ examscore }/${ ...
Accessible Toolkit Checklist
ght iaccessible for each event. the checklist this checklist is currently only for microsoft windows, but should be expanded to include information about linux and os x. it is maintained by the mozilla accessibility community. contributions are welcome. general dialogs/windows/general escape key cancels dialogs and refocuses the previously focused on the parent window. alt+f4 closes windows, similar to escape but even works on dialogs without cancel button alt+space opens window menu with restore, move, size, minimize, maximize, close the move and size options must be usable with the arrow keys on the keyboard in windows, initial focus goes to first focusable widget that is not a clickable tabbed property sheet label making tab order definable. defau...
...lds, make sure the autocomplete popup doesn't receive actual or msaa focus unless an up/down arrow is pressed, and don't use the default system highlight color in the list itself unless it really has focus in autocomplete text fields, make sure that the delete or backspace key removes all auto completed selected text. ...
...can use the accessible description to expose the current tab position, such as "3 of 5" in order to provide ease of access for the user. the "of" will be parsed out by the assistive technology, so don't localize it. lists and combo boxes when a list is tabbed to, select the first item if nothing else is already selected f4, alt+down or alt+up toggle a combo box open and closed escape closes combo box if it was open (be careful not to have it cancel entire dialog) up/down arrow key navigation. shift+up and shift+down move and extend the selection. typing letter or several letters to navigate (same letter goes to each item starting with that, different letters go to first item starting with that entire string). multiple selection is possible with...
Command line options
ile. you can also control how mozilla applications open, which components open initially, and what the components do when they open. this page describes the commonly used options and how to use them. you can open the command line interface by pressing shift + f2. syntax rules but first, let's describe the syntax rules that apply for all options. command parameters containing spaces must be enclosed in quotes, such as "joel user". command actions are case insensitive. command parameters, except profile names, are case insensitive. blank spaces ( ) separate commands and parameters. each message option follows the syntax field=value, for example: to=foo@nowhere.net subject=cool page attachment=www.mozilla.org attachment='file:///c:/test.txt' body=check this page or also ...
... to=foo@nowhere.net subject=cool page attachment=www.mozilla.org attachment='file:///c:/test.txt' body=check this page or also in thunderbird 52 and newer: body=c:\path\to\file.txt separate multiple message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . comma separators must not follow or precede spaces ( ). to assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to start the application. if the option contains arguments, enter the argument after the option. some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the ...
...@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to start the application. if the option contains arguments, enter the argument after the option. some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the text below). in some cases, option arguments must be enclosed in quotation marks (this is noted in the option descriptions below). multiple command line options can be specified. in general, the syntax is as follows: application -option -option "argument" -option argument examples the following examples show the use of the "-profilemanager" command, which will open the profile manager prior to starting firefox or thunderbird: windows select run from ...
Error codes returned by Mozilla APIs
(0x80520014) when calling nsifile.remove() on a directory and the 'recursive' argument to this method is false, this error will occur if the directory is not empty. ns_error_file_access_denied (0x80520015) an operation was not performed on a file because the file cannot be accessed, typically because the permissions set for the file do not allow the operation. stream errors ns_base_stream_closed (0x80470002) this error occurs when an operation is performed on a stream that has already been closed. ns_base_stream_oserror (0x80470003) this error occurs when an operating system error occurs. currently, this error only occurs when a file stream is closed. ns_base_stream_illegal_args (0x80470004) ns_base_stream_no_converter (0x80470005) ns_base_stream_bad_conversion (0x80470006) ...
...) the connection does not exist. xxx currently unused - consider removing. ns_error_connection_refused (0x804b000d) ns_error_net_timeout (0x804b000e) ns_error_in_progress (0x804b000f) the requested action could not be completed while the object is busy. implementations of nsichannel.asyncopen() will commonly return this error if the channel has already been opened (and has not yet been closed). ns_error_offline (0x804b0010) ns_error_no_content (0x804b0011) returned from nsichannel.asyncopen() to indicate that ondataavailable will not be called because there is no content available. this is used by helper app style protocols (for example, mailto). ns_error_unknown_protocol (0x804b0012) the uri scheme corresponds to an unknown protocol handler. ns_error_port_access_not_allowed...
... ns_error_xslt_parse_failu...
Hacking with Bonsai
iple platforms. many times, code checked in would compile or run on a handful of platforms. also, with as many as 100 engineers, it was very difficult to determine what happened in the tree that caused the instability. bonsai was created to solve these problems. ...
... joins a group called "the hook" at 8:00 am pst every weekday morning, the source tree is closed. the build team will then pull the 8:00 am tree, and build it on a subset of the platforms, linux, win32 & macppc. at 10:00 am, everyone who is on the hook is available in case the build breaks eventually, the tree builds, and it is re-opened. there is a web page, which records if the tree is open or closed what the date stamp of the last known good tree is who is on the hook for the current tree before the tree is opened, the list of checkins that happened when the tree was closed is reviewed to insure that only build related checkins took place. before the tree is opened, there is a car pool lane where people who have been off on a branch and need a stable tip to merge in can pull the tip for t...
... pool lane is only available to those who arrange access ahead of time with the release team. when the tree is re-opened, the web page is updated and the hook is cleared. use the bonsai query tool to see what's been checked in to the tree lately and to look at differences between versions. read the introduction to bonsai for more information about queries. the rules no checkins when the tree is closed unless you are fixing a build problem at the request of a build person. if you are on the hook, your top priority is to be available to the build team to fix bustages. if you are on the hook, you are findable. you are either at your desk, or pageable, checking e-mail constantly, or on irc so that you can be found immediately and can respond to any problems in your code. helpful attitudes the b...
Downloads.jsm
ad.html")); console.log("example-download.html has been downloaded."); }).then(null, components.utils.reporterror); observing downloads this example logs a message every time a change occurs in one of the global download lists. to demonstrate the logging, a new download is started while a message box is being shown. the download is stopped and removed from the list when the message box is closed, regardless of whether it has been completed or not. components.utils.import("resource://gre/modules/downloads.jsm"); components.utils.import("resource://gre/modules/osfile.jsm") components.utils.import("resource://gre/modules/task.jsm"); task.spawn(function () { let list = yield downloads.getlist(downloads.all); let view = { ondownloadadded: download => console.log("added", download...
...wnload), ondownloadremoved: download => console.log("removed", download) }; yield list.addview(view); try { let download = yield downloads.createdownload({ source: "http://www.mozilla.org/", target: os.path.join(os.constants.path.tmpdir, "example-download.html"), }); list.add(download); try { download.start(); alert("now monitoring all downloads. close the message to stop."); } finally { yield list.remove(download); yield download.finalize(true); } } finally { yield list.removeview(view); } }).then(null, components.utils.reporterror); conversion from nsidownloadmanager starting in firefox for desktop version 26, the nsidownloadmanager and nsidownload interfaces are not available anymore. the new module works dif...
...ress are now more detailed and don't use the special value -1 anymore. you may see the documentation of the new methods and properties for details. using it in a xul app in a xul standalone application (running with xulrunner or firefox --app), you have to do additionnal things in order to use the new download manager. by default it is not enabled. it will be enabled when the bug 851471 will be closed. if you don't activate it, you could use downloads.jsm, but your view will not be called by the external helper app service (when a user click on a file to download, in a web page). to enable the new download manager : first you have to set the pref browser.download.usejstransfer to true. then you should declare the new nsitransfer object during the startup of your app. components.manager...
FileUtils.jsm
ing key, array patharray, bool followlinks); nsifile getdir(string key, array patharray, bool shouldcreate, bool followlinks); nsifileoutputstream openfileoutputstream(nsifile file, int modeflags); nsifileoutputstream openatomicfileoutputstream(nsifile file, int modeflags); nsifileoutputstream opensafefileoutputstream(nsifile file, int modeflags); void closeatomicfileoutputstream(nsifileoutputstream stream); void closesafefileoutputstream(nsifileoutputstream stream); constants constant value description mode_rdonly 0x01 corresponds to the pr_rdonly parameter to pr_open mode_wronly 0x02 corresponds to the pr_wronly parameter to pr_open mode_create 0x08 corresponds to the pr_c...
...leoutputstream openatomicfileoutputstream( nsifile file, int modeflags ); parameters file the file to write to. modeflags optional file open flags (see constants above) return value returns nsifileoutputstream (the safe variant) to write to. note: openatomicfileoutputstream() is generally better than opensafefileoutputstream() because flushing is not needed in most of the issues. closeatomicfileoutputstream() closes an atomic file output stream. void closeatomicfileoutputstream( nsifileoutputstream stream ); parameters stream the stream to close. opensafefileoutputstream() opens a safe file output stream for writing. note: 'safe' and 'atomic' file output streams will never append; they will always overwrite an existing file. starting in gecko 38.0, passing mode_...
... int modeflags ); parameters file the file to write to. modeflags optional file open flags (see constants above) return value returns nsifileoutputstream (the safe variant) to write to. remarks note: starting in gecko 6 the stream is opened with the defer_open nsifileoutputstream behavior flag constant; this means the file is not actually opened until the first time it's accessed. closesafefileoutputstream() closes a safe file output stream. void closesafefileoutputstream( nsifileoutputstream stream ); parameters stream the stream to close. see also nsifileoutputstream code snippets and examples ...
Anonymous Shared Memory
rent and child processes. in the examples, the server creates the file-mapped shared memory, the client attaches to it. first protocol server: fm = pr_openanonfilemap(dirname, size, filemapprot); addr = pr_memmap(fm); attr = pr_newprocessattr(); pr_processattrsetinheritablefilemap( attr, fm, shmname ); pr_createprocess(client); pr_destroyprocessattr(attr); ... yadda ... pr_memunmap( addr ); pr_closefilemap(fm); client: ... started by server via pr_createprocess() fm = pr_getinheritedfilemap( shmname ); addr = pr_memmap(fm); ... yadda ... pr_memunmap(addr); pr_closefilemap(fm); second protocol server: fm = pr_openanonfilemap(dirname, size, filemapprot); fmstring = pr_exportfilemapasstring( fm ); addr = pr_memmap(fm); ... application specific technique to pass fmstring to child ... yadd...
...= pr_getinheritedfilemap( shmname ); addr = pr_memmap(fm); ... yadda ... pr_memunmap(addr); pr_closefilemap(fm); second protocol server: fm = pr_openanonfilemap(dirname, size, filemapprot); fmstring = pr_exportfilemapasstring( fm ); addr = pr_memmap(fm); ... application specific technique to pass fmstring to child ... yadda ... server uses his own magic to create child pr_memunmap( addr ); pr_closefilemap(fm); client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = pr_importfilemapfromstring( fmstring ) addr = pr_memmap(fm); ... yadda ... ...
...; addr = pr_memmap(fm); ... application specific technique to pass fmstring to child ... yadda ... server uses his own magic to create child pr_memunmap( addr ); pr_closefilemap(fm); client: ... started by server via his own magic ... application specific technique to find fmstring from parent fm = pr_importfilemapfromstring( fmstring ) addr = pr_memmap(fm); ... yadda ... ...
I/O Functions
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. some file systems also differentiate drives or volumes. ...
...es. pr_open pr_delete pr_getfileinfo pr_getfileinfo64 pr_rename pr_access type praccesshow functions that act on file descriptors pr_close pr_read pr_write pr_writev pr_getopenfileinfo pr_getopenfileinfo64 pr_seek pr_seek64 pr_available pr_available64 pr_sync pr_getdesctype pr_getspecialfd pr_createpipe directory i/o functions pr_opendir pr_readdir pr_closedir pr_mkdir pr_rmdir socket manipulation functions the network programming interface presented here is a socket api modeled after the popular berkeley sockets. differences include the following: the blocking socket functions in nspr take a timeout parameter. two new functions, pr_transmitfile and pr_acceptread, can exploit the new system calls of some operating systems for higher perform...
...s pr_ntohl pr_htons pr_htonl pr_familyinet memory-mapped i/o functions the memory-mapped i/o functions allow sections of a file to be mapped to memory regions, allowing read-write accesses to the file to be accomplished by normal memory accesses. memory-mapped i/o functions are currently implemented for unix, linux, mac os x, and win32 only. pr_createfilemap pr_memmap pr_memunmap pr_closefilemap anonymous pipe function pr_createpipe polling functions this section describes two of the most important polling functions provided by nspr: pr_poll pr_getconnectstatus pollable events a pollable event is a special kind of file descriptor. the only i/o operation you can perform on a pollable event is to poll it with the pr_poll_read flag. you cannot read from or write to a...
PRLinger
socket send buffer. syntax #include <prio.h> typedef struct prlinger { prbool polarity; printervaltime linger; } prlinger; fields the structure has the following fields: polarity polarity of the option's setting: pr_false means the option is off, in which case the value of linger is ignored. pr_true means the option is on, and the value of linger will be used to determine how long pr_close waits before returning. linger time (in printervaltime units) to linger before closing if any data remain in the socket send buffer. description by default, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the system attempts to deliver the data to the peer. the pr_sockopt_linger socket option, with a value represented by a structure of type prlinger...
...ny data remain in the socket send buffer. description by default, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the system attempts to deliver the data to the peer. the pr_sockopt_linger socket option, with a value represented by a structure of type prlinger, makes it possible to change this default as follows: if polarity is set to pr_false, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the runtime attempts to deliver the data to the peer. if polarity is set to pr_true and linger is set to 0 (pr_interval_no_wait), the runtime aborts the connection when it is closed and discards any data remaining in the socket send buffer. if polarity is set to pr_true and linger is nonzero, the runtime lingers...
..., but if there are any data remaining in the socket send buffer, the runtime attempts to deliver the data to the peer. if polarity is set to pr_true and linger is set to 0 (pr_interval_no_wait), the runtime aborts the connection when it is closed and discards any data remaining in the socket send buffer. if polarity is set to pr_true and linger is nonzero, the runtime lingers when the socket is closed. that is, if any data remains in the socket send buffer, pr_close blocks until either all the data is sent and acknowledged by the peer or the interval specified by linger expires. ...
PR_TransmitFile
the connected socket to send data over. sourcefile a pointer to a prfiledesc object representing the file to send. headers a pointer to the buffer holding the headers to be sent before sending data. hlen length of the headers buffer in bytes. flags one of the following flags: pr_transmitfile_keep_open indicates that the socket will be kept open after the data is sent. ...
...a pointer to a prfiledesc object representing the file to send. headers a pointer to the buffer holding the headers to be sent before sending data. hlen length of the headers buffer in bytes. flags one of the following flags: pr_transmitfile_keep_open indicates that the socket will be kept open after the data is sent. pr_transmitfile_close_socket indicates that the connection should be closed immediately after successful transfer of the file. timeout time limit for completion of the transmit operation. returns a positive number indicates the number of bytes successfully written, including both the headers and the file. the value -1 indicates a failure. if an error occurs while sending the file, the pr_transmitfile_close_socket flag is ignored. the reason for the failure ca...
... description the pr_transmitfile function sends a complete file (sourcefile) across a connected socket (networksocket). if headers is non-null, pr_transmitfile sends the headers across the socket before sending the file. the enumeration prtransmitfileflags, used in the flags parameter, is defined as follows: typedef enum prtransmitfileflags { pr_transmitfile_keep_open = 0, pr_transmitfile_close_socket = 1 } prtransmitfileflags; ...
An overview of NSS Internals
n/should be assigned to the certificate at the time of import, which can later be used to easily identify and retrieve it. it's important to note that nss requires strict cleanup for all handles returned by nss. the application should always call the appropriate dereference (destroy) functions once a handle is no longer needed. this is particularly important for applications that might need to close a database and reinitialize nss using a different one, without restarting. such an operation might fail at runtime if data elements are still being referenced. in addition to the freebl, softoken, and ckbi modules, there is an utility library for general operations (e.g., encoding/decoding between data formats, a list of standardized object identifiers (oid)). nss has an ssl/tls module that im...
...arser implementations, each having their own specific properties, advantages and disadvantages, which is why all of them are still being used (nobody has yet dared to replace the older with the newer ones because of risks for side effects). when using the asn.1 parser(s), a template definition is passed to the parser, which will analyze the asn.1 data stream accordingly. the templates are usually closely aligned to definitions found in rfc documents. a data block described as der is usually in asn.1 format. you must know which data you are expecting, and use the correct template for parsing, based on the context of your software's interaction. data described as pem is a base64 encoded presentation of der, usually wrapped between human readable begin/end lines. nss prefers the binary presenta...
...eresting to mention a property of the nspr file descriptors, which are stacked in layers. this means you can define multiple layers that are involved in data processing. a file descriptor has a pointer to the first layer handling the data. that layer has a pointer to a potential second layer, which might have another pointer to a third layer, etc. each layer defines its own functions for the open/close/read/write/poll/select (etc.) functions. when using an ssl network connection, you'll already have two layers, the basic nspr layer and an ssl library layer. the mozilla applications define a third layer where application specific processing is performed. you can find more details in the nspr reference documents. nss occassionally has to create outbound network connections, in addition to the ...
NSS Sample Code Utilities_1
etrying - the file contents will be the same */ } phrases = port_zalloc(maxpwdfilesize); if (!phrases) { return 0; /* out of memory */ } fd = pr_open(pwfile, pr_rdonly, 0); if (!fd) { fprintf(stderr, "no password file \"%s\" exists.\n", pwfile); port_free(phrases); return null; } nb = pr_read(fd, phrases, maxpwdfilesize); pr_close(fd); if (nb == 0) { fprintf(stderr,"password file contains no data\n"); port_free(phrases); return null; } if (slot) { tokenname = pk11_gettokenname(slot); if (tokenname) { tokenlen = port_strlen(tokenname); } } i = 0; do { int startphrase = i; int phraselen; /* handle the windows eol ca...
...t char *noisefilename) { char buf[2048]; prfiledesc *fd; print32 count; fd = pr_open(noisefilename, pr_rdonly, 0); if (!fd) { fprintf(stderr, "failed to open noise file."); return secfailure; } do { count = pr_read(fd,buf,sizeof(buf)); if (count > 0) { pk11_randomupdate(buf,count); } } while (count > 0); pr_close(fd); return secsuccess; } /* * filesize */ long filesize(const char* filename) { struct stat stbuf; stat(filename, &stbuf); return stbuf.st_size; } /* * readderfromfile */ secstatus readderfromfile(secitem *der, const char *infilename, prbool ascii) { secstatus rv = secsuccess; prfiledesc *infile = null; infile = pr_open(infilename, pr_rdonly, 0); if ...
...t_geterror()); port_free(filedata.data); rv = secfailure; goto cleanup; } port_free(filedata.data); } else { /* read in binary der */ rv = filetoitem(der, infile); if (rv) { pr_fprintf(pr_stderr, "error converting der \n"); rv = secfailure; } } cleanup: if (infile) { pr_close(infile); } return rv; } </nb)> ...
Utilities for nss samples
trying - the files contents will be the same */ } phrases = port_zalloc(maxpwdfilesize); if (!phrases) { return 0; /* out of memory */ } fd = pr_open(pwfile, pr_rdonly, 0); if (!fd) { fprintf(stderr, "no password file \"%s\" exists.\n", pwfile); port_free(phrases); return null; } nb = pr_read(fd, phrases, maxpwdfilesize); pr_close(fd); if (nb == 0) { fprintf(stderr,"password file contains no data\n"); port_free(phrases); return null; } if (slot) { tokenname = pk11_gettokenname(slot); if (tokenname) { tokenlen = port_strlen(tokenname); } } i = 0; do { int startphrase = i; int phraselen; /* handle the windows eol ca...
...t char *noisefilename) { char buf[2048]; prfiledesc *fd; print32 count; fd = pr_open(noisefilename, pr_rdonly, 0); if (!fd) { fprintf(stderr, "failed to open noise file."); return secfailure; } do { count = pr_read(fd,buf,sizeof(buf)); if (count > 0) { pk11_randomupdate(buf,count); } } while (count > 0); pr_close(fd); return secsuccess; } /* * filesize */ long filesize(const char* filename) { struct stat stbuf; stat(filename, &stbuf); return stbuf.st_size; } /* * readderfromfile */ secstatus readderfromfile(secitem *der, const char *infilename, prbool ascii) { secstatus rv = secsuccess; prfiledesc *infile = null; infile = pr_open(infilename, pr_rdonly, 0); if ...
...t_geterror()); port_free(filedata.data); rv = secfailure; goto cleanup; } port_free(filedata.data); } else { /* read in binary der */ rv = filetoitem(der, infile); if (rv) { pr_fprintf(pr_stderr, "error converting der \n"); rv = secfailure; } } cleanup: if (infile) { pr_close(infile); } return rv; } ...
Python binding for NSS
we had always received the entire message in one sock.recv() call because it was so short. but sock.recv() does not guarantee how much data will be received, thus this was a coding mistake. the solution is straight forward, use newlines as a record separator and call sock.readline() instead of sock.recv(). sock.readline() calls sock.recv() internally until a complete line is read or the socket is closed. rewrite setup_certs.py, it was written like an expect script reacting to prompts read from a pseudo terminal but it was fragile and would hang on some systems. new version uses temporary password file and writes hardcoded responses to the stdin of certuil and modutil. setup_certs now creates a new sql sytle nss database (sql:pki) all tests a...
...networkaddress.set_from_string() added optional family parameter. this is necessary for utilizing pr_getaddrinfobyname(). networkaddress initialized via a string paramter are now initalized via pr_getaddrinfobyname using family. add networkaddress.address property to return the address sans the port as a string. networkaddress.str() includes the port. for ipv6 the a hex string must be enclosed in brackets if a port is appended to it, the bracketed hex address with appended with a port is unappropriate in some circumstances, hence the new address property to permit either the address string with a port or without a port. fix the implementation of the networkaddress.family property, it was returning bogus data due to wrong native data size. hostentry objects now support iterat...
...s were enhanced thusly: threads will now yield during blocking io. socket.makefile() reimplemented file object methods that had been missing (readlines(), sendall(), and iteration) were implemented makefile now just returns the same socket object but increments an "open" ref count. thus a socket object behaves like a file object and must be closed once for each makefile() call before it's actually closed. sockets now support the iter protocol added methods: socket.readlines() socket.sendall() apply patches from miloslav trmač <mitr@redhat.com> for ref counting and threading support. thanks miloslav! review all ref counting, numerous ref coun...
Index
dd categories)! 5 future directions guide, mozilla, spidermonkey this article documents future directions in functionality, design, and coding practices for spidermonkey. it can be read as something like an "ideal future state" for the engine. that means the code as it is today won't match this document, and that's ok. whenever practical, new code and changes should move code closer to the ideal future. and of course, the idea of the future is always evolving in time as things change and we learn more. 6 gc rooting guide spidermonkey no summary! 7 gcintegration developing mozilla, firefox, garbage collection, intermediate, intro, jsapi, needsupdate, spidermonkey, tools, memory the spidermonkey garbage collector (gc) will be changing...
..., référence(2), spidermonkey js::clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj. if scopechain is supplied, it uses scopechain as its enclosing scope. if scopechain is omitted, it creates a new function object in cx's global. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created global object. 31 js::compile jsapi reference, reference, référence(2), spidermonkey js::compile compiles a script, srcbuf, chars, bytes, or file, for execution. 32 js::compilefunction jsapi reference, reference, référence(2), spidermonkey js::compilefunction compiles a function from a text string chars, bytes, or srcbuf. 33...
... belonging to objects on obj's prototype chain are not affected. 205 js_clonefunctionobject jsapi reference, spidermonkey js_clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj, but uses parent as its enclosing scope. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created global object. 206 js_comparestrings jsapi reference, spidermonkey js_comparestrings compares two js strings, str1 and str2. if the strings are identical in content and length, js_comparestrings stores 0 in *result. if str1 is less than str2, *result is less than 0. if str1 is greater than str2, *result is greater than 0. 207 js_compilefilehandl...
TPS Tests
to automatically do account confirmation steps for you. even if you opt not to use restmail, do not use your personal firefox account, as tps will delete and replace the data in it many times, not to mention the first run is very likely to fail, since it expects a clean start). note: be prepared not to use your computer for 15 or so minutes after starting a full run of tps, as it will open and close a fairly large number of firefox windows. steps get the source code clone mozilla-central (choose your flavor): hg clone hg.mozilla.org/mozilla-central or git clone github.com/mozilla/gecko-dev cd into the tps folder cd testing/tps create the environment i suggest the path to be outside of the mc source tree python create_venv.py --us...
...is test file will be: firefox is launched with profile1, the tps extension adds the two bookmarks specified in the bookmarks_initial array, then they are synced to the sync server. the sync_wipe_server argument causes tps to set the firstsync="wipeserver" pref before syncing, in case the sync account already contains data (this is typically unnecessary, and done largely as an example). firefox closes. firefox is launched with profile2, and all data is synced from the sync server. the tps extension verifies that all bookmarks in the bookmarks_initial list are present. then it modifies those bookmarks by applying the "changes" property to each of them. e.g., the title of the first bookmark is changed from "google.com" to "google". next, the changes are synced to the sync server. finally, fire...
...firefox is launched with profile2, and all data is synced from the sync server. the tps extension verifies that all bookmarks in the bookmarks_initial list are present. then it modifies those bookmarks by applying the "changes" property to each of them. e.g., the title of the first bookmark is changed from "google.com" to "google". next, the changes are synced to the sync server. finally, firefox closes. firefox is launched with profile1 again, and data is synced from the sync server. the tps extension verifies that the bookmarks in bookmarks_after_first_modify list are present; i.e., all the changes performed in profile2 have successfully been synced to profile1. lastly, firefox closes and the tests ends. (implementation detail) two final cleanup phases are run to wipe the server state and u...
Querying Places
. each result has a container representing the root of the query. it can be retrieved using the root attribute of the result. for general queries, this root container is a nsinavhistoryqueryresultnode with the query parameters and options that you supplied in the original query. for queries mapping to one bookmark folder, this will be a nsinavhistorycontainerresultnode. containers can be open or closed. this corresponds to the open and closed state in a tree view, and can also be mapped to showing and hiding menus. to get at a container's contents, you must first open the container. most container types populate themselves lazily, so opening a container actually corresponds to executing the given query. while a container is open, it will listen to the history and bookmarks systems' notificatio...
...showing and hiding menus. to get at a container's contents, you must first open the container. most container types populate themselves lazily, so opening a container actually corresponds to executing the given query. while a container is open, it will listen to the history and bookmarks systems' notifications and modify their contents to keep themselves up-to-date. for this reason, it is best to close a container as soon as you are done with it, since it will give better performance. if you close a container and re-open it before any history or bookmark change notifications come, the results will generally still be there and this operation will be fast. this example uses the places history service to display all the titles of the history pages. // queries parameters (e.g. domain name matchin...
...er // see : https://developer.mozilla.org/en/nsinavhistorycontainerresultnode var cont = result.root; cont.containeropen = true; for (var i = 0; i < cont.childcount; i ++) { var node = cont.getchild(i); // "node" attributes contains the information (e.g. uri, title, time, icon...) // see : https://developer.mozilla.org/en/nsinavhistoryresultnode dump(node.title+ "\n"); } // close container when done // see : https://developer.mozilla.org/en/nsinavhistorycontainerresultnode cont.containeropen = false; see also places query uris displaying places information using views ...
Retrieving part of the bookmarks tree
istorycontainerresultnode corresponding to your folder. if you have a complex query the root will be a nsinavhistoryqueryresultnode. before accessing the children of any result container, you must first open it, and then you can iterate the children. as long as the container is open, it will listen for notifications from the bookmarks system to keep itself up-to-date. when you're done, be sure to close the container to free up the resources. otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser. var rootnode = result.root; rootnode.containeropen = true; // iterate over the immediate children of this folder and dump to console for (var i = 0; i < rootnode.childcount; i ++) { var node = rootnode.getchild(i); dump("child: " + node.title + ...
...r to free up the resources. otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser. var rootnode = result.root; rootnode.containeropen = true; // iterate over the immediate children of this folder and dump to console for (var i = 0; i < rootnode.childcount; i ++) { var node = rootnode.getchild(i); dump("child: " + node.title + "\n"); } // close a container after using it! rootnode.containeropen = false; if you encounter a node with a type of result_type_folder or another type of container, you can open these folders and descend into the hierarchy. you will want to read the section "using the results" in places:query system to understand the different result types. complete code listing var historyservice = components.classes["@mozilla.
...rootnode.containeropen = false; ...
nsIAppStartup
ecko 1.9.1 constants the following flags may be passed as the amode parameter to the quit() method. one and only one of the "quit" flags must be specified. the erestart flag may be bit-wise combined with one of the "quit" flags to cause the application to restart after it quits. constant value description econsiderquit 0x01 attempt to quit if all windows are closed. eattemptquit 0x02 try to close all windows, then quit if successful. eforcequit 0x03 force all windows to close, then quit. erestart 0x10 restart the application after quitting. the application will be restarted with the same profile and an empty command line. erestartnotsameprofile 0x100 restart the application after quitting. the app...
... 2.0) ensures that at least one window exists after creating the startup state. if one has not been made, this will create a browser window. void ensure1window( in nsicmdlineservice acmdlineservice ); parameters acmdlineservice the command line from which startup args can be read. enterlastwindowclosingsurvivalarea() serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application. bracket the code where the last window could close with these. void enterlastwindowclosingsurvivalarea(); parameters none. exitlastwindowclosingsurvivalarea() this method serves for situations when all application windows will be closed but we don't want to take this as a signal to quit the application. bracket the code wh...
... void exitlastwindowclosingsurvivalarea(); parameters none. getstartupinfo() returns a javascript object with events from startup and the timestamps indicating when they occurred. parameters none. return value a javascript object with the following fields. ...
nsIAsyncStreamCopier
another. inherits from: nsirequest last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void asynccopy(in nsirequestobserver aobserver, in nsisupports aobservercontext); void init(in nsiinputstream asource, in nsioutputstream asink, in nsieventtarget atarget, in boolean asourcebuffered, in boolean asinkbuffered, in unsigned long achunksize, in boolean aclosesource, in boolean aclosesink); methods asynccopy() starts the copy operation. the specified observer is notified when the copy completes. void asynccopy( in nsirequestobserver aobserver, in nsisupports aobservercontext ); parameters aobserver receives notifications. aobservercontext the object to receive notifications with information about the progress of the copy operation. init() ini...
...servercontext the object to receive notifications with information about the progress of the copy operation. init() initializes the stream copier. note: at least one of the streams must be buffered. void init( in nsiinputstream asource, in nsioutputstream asink, in nsieventtarget atarget, in boolean asourcebuffered, in boolean asinkbuffered, in unsigned long achunksize, in boolean aclosesource, in boolean aclosesink ); parameters asource contains the data to be copied. asink specifies the destination for the data. atarget specifies the thread on which the copy will occur. a null value is permitted and causes the copy to occur on an unspecified background thread. asourcebuffered true if asource implements nsiinputstream.readsegments(). asinkbuffered true if asink implements ns...
...occur on an unspecified background thread. asourcebuffered true if asource implements nsiinputstream.readsegments(). asinkbuffered true if asink implements nsiinputstream.writesegments() . achunksize specifies how many bytes to read and write at a time. this controls the granularity of the copy operation. this value should match the segment size of any buffered streams involved in the operation. aclosesource true if asource should be closed after copying. aclosesink true if asink should be closed after copying. see also nsiinputstream nsioutputstream ...
nsIDownloadManager
ocalfile atempfile, in nsicancelable acancelable, in boolean aisprivate); void addlistener(in nsidownloadprogresslistener alistener); void canceldownload(in unsigned long aid); void cleanup(); void endbatchupdate(); obsolete since gecko 1.9.1 void flush(); obsolete since gecko 1.8 nsidownload getdownload(in unsigned long aid); void onclose(); obsolete since gecko 1.9.1 void open(in nsidomwindow aparent, in nsidownload adownload); obsolete since gecko 1.9.1 void openprogressdialogfor(in nsidownload adownload, in nsidomwindow aparent, in boolean acanceldownloadonclose); obsolete since gecko 1.9.1 void pausedownload(in unsigned long aid); void removedownload(in unsigned long aid); void re...
...rieves a download managed by the download manager. this can be one that is in progress, or one that has completed in the past and is stored in the database. nsidownload getdownload( in unsigned long aid ); parameters aid the unique id of the download. return value the download with the specified id. exceptions thrown ns_error_not_available the download is not in the database. onclose() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. called when the download manager front end is closed. useful for third party managers to let us know when they've closed. void onclose(); parameters none. ...
...o 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. opens an individual progress dialog displaying progress for the download. void openprogressdialogfor( in nsidownload adownload, in nsidomwindow aparent, in boolean acanceldownloadonclose ); parameters adownload the download object to display progress for, as returned by getdownload() or adddownload(). aparent the parent, or opener, of the front end. acanceldownloadonclose whether closing the dialog should cancel the download. pausedownload() pauses the specified download. void pausedownload( in unsigned long aid ); parameters aid the unique id of the downloa...
nsIDynamicContainer
ll result nodes directly into the container when it is opened. it can use the property bag on every result node to store data associated with each item, such as a full path on disk. it can also create additional containers for each container, registered to its service. method overview void oncontainermoved(in long long aitemid, in long long anewparent, in long anewindex); void oncontainernodeclosed(in nsinavhistorycontainerresultnode acontainer); void oncontainernodeopening(in nsinavhistorycontainerresultnode acontainer, in nsinavhistoryqueryoptions aoptions); void oncontainerremoving(in long long aitemid); methods oncontainermoved() this method is called when the given container has just been moved, in case the service needs to do any bookkeeping. it is called after the container h...
...y bookkeeping. it is called after the container has been moved. void oncontainermoved( in long long aitemid, in long long anewparent, in long anewindex ); parameters aitemid the item-id of the container item. anewparent the item of the new parent folder for the container. anewindex the index at which the container will be inserted, or "-1" to append to the end of the list. oncontainernodeclosed() this method is called when the given container has just been collapsed so that the service can do any necessary cleanup. this is not guaranteed to get called. in particular, if the query just goes away, you will not get this call. this only happens when the container itself goes from the open state to the closed state. a service with large numbers of dynamically populated items might use this ...
...d so that the service can do any necessary cleanup. this is not guaranteed to get called. in particular, if the query just goes away, you will not get this call. this only happens when the container itself goes from the open state to the closed state. a service with large numbers of dynamically populated items might use this to do some cleanup so those items don't hang around. void oncontainernodeclosed( in nsinavhistorycontainerresultnode acontainer ); parameters acontainer the container node of the container being closed. the service need not worry about removing any created nodes, they will be automatically removed when this call completes. oncontainernodeopening() this method is called when the given container node is about to be populated so that the service can populate the container...
nsIFileStreams
nsifilestreams interface is an input stream that allows you to read from a file. netwerk/base/public/nsifilestreams.idlscriptable please add a summary to this article. ...
...le. netwerk/base/public/nsifilestreams.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void init(in nsifile file, in long ioflags, in long perm, in long behaviorflags); constants constants value description delete_on_close 1<<1 if this is set, the file will be deleted by the time the stream is closed. it may be removed before the stream is closed if it is possible to delete it and still read from it. if open_on_read is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again. close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached. reopen_on_rewind 1<<3 if this is set, the file will ...
... ioflags file open flags listed in prio.h (see pr_open documentation) or -1 to open the file in default mode (pr_rdonly). ...
nsIMessageListenerManager
/globalmessagemanager;1. ...
...istener callbacks for a particular message are invoked when that message is received. the message manager holds a strong reference to listener. if the same listener registers twice for the same message, the second registration is ignored. ...
...d. void addmessagelistener(in astring messagename, in nsimessagelistener listener, [optional] in boolean listenwhenclosed); parameters messagename a string indicating the name of the message to listen for. listener an nsimessagelistener to invoke when a message is received. see nsimessagelistener for details of the message syntax. listenwhenclosed specify true to receive messages during the short period after a frame has been removed from the dom and before its frame script has finished unloading; this is false by default. this parameter only has an effect for frame message managers in the main process. an alternative method to listen for death of frame script is to use a message-manager-disconnect observer; see observer notifications :...
nsIMsgFolder
e/public/nsimsgfolder.idl for the newer methods (esp. isspecialfolder and such). ...
...endfolderloading() void endfolderloading(); updatefolder() get new headers for the database. void updatefolder(nsimsgwindow awindow); getfilterlist() get the filter list on folder's server (or in the case of news, the filter list for this newsgroup). ...
...id endfolderloading(); updatefolder() get new headers for the database. void updatefolder(nsimsgwindow awindow); getfilterlist() get the filter list on folder's server (or in the case of news, the filter list for this newsgroup). ...
nsIMsgWindow
ow = components.classes["@mozilla.org/messenger/msgwindow;1"] .createinstance(components.interfaces.nsimsgwindow); in thunderbird the default message window is stored in the global variable msgwindow. method overview void displayhtmlinmessagepane(in astring title, in astring body, in boolean clearmsghdr); void stopurls(); void closewindow(); attributes attribute type description windowcommands nsimsgwindowcommands this allows the backend code to send commands to the ui, such as clearmsgpane. statusfeedback nsimsgstatusfeedback this allows the backend code to send status feedback to the ui. msgheadersink nsimsghea...
...e not used. body the html to display in the message pane. note that the html is wrapped in <html> and <body> tags for you. clearmsghdr whether or not the existing message pane and header should be cleared before the html is displayed. stopurls() this is equivalent to calling stop(nsiwebnavigation::stop_network) on the nsiwebnavigation object. void stopurls(); closewindow() when the msg window is being unloaded from the content window, this notification can be used to force a flush on anything the message window hangs on. for some reason xpconnect is still hanging onto the message window even though all of our objects have let go of it. this forces a release. it clears out the content listener, the windowcommands, the statusfeedback and the docshell objects.
...) when the msg window is being unloaded from the content window, this notification can be used to force a flush on anything the message window hangs on. for some reason xpconnect is still hanging onto the message window even though all of our objects have let go of it. this forces a release. it clears out the content listener, the windowcommands, the statusfeedback and the docshell objects. void closewindow(); remarks see also ...
nsINavHistoryContainerResultNode
ildren to be altered. read-only. this is false for bookmark folder nodes unless the setfolderreadonly() method has been called to specifically make the folder read-only. it's true for non-folder nodes. if this container is a remote container, this flag may be redefined by the remote container provider. read-only. containeropen boolean set this to true to allow descent into this container. when closed, attempting to call getchild() or access childcount results in an error. when you're done reading the container's children, set this to false. for host and day groupings, doing this has no performance cost since the children have already been computed. for queries and bookmark folders, however, being open means they must keep themselves up-to-date by listening for updates and re-querying as need...
...ves up-to-date by listening for updates and re-querying as needed. dynamiccontainertype autf8string a string representing the dynamic container api service responsible for this container. accessing this throws an exception if the node isn't a dynamic container. read only. haschildren boolean indicates whether or not the node can have children, and may be used whether the container is open or closed. when the container is closed, the result is an exact answer if the node can be populated easily (for example, for bookmark folders). if it can't be populated easily (for complex history queries, for example), the result is always true. when the container is open, the result is always accurate. this value is intended to be used to see if the "+" should be drawn next to a tree item, indicating th...
... be a result_type_remote_container node that has been dynamically generated by the remote container api, or a bookmark folder (result_type_folder) for which some service (such as livemarks) has registered to provide certain operations. state unsigned short the current state of the container. this is one of the state constants. constants state constants constant value description state_closed 0 the container is closed. state_loading 1 the container has been opened asynchronously, but is still loading and is not all the way opened yet. state_opened 2 the container is open. methods findnodebydetails() returns a node matching specified details. nsinavhistoryresultnode findnodebydetails( in autf8string auristring, in prtime atime, in long long aitemid, in boolean rec...
nsIOutputStream
xpcom/io/nsioutputstream.idlscriptable an interface describing a writable stream of data. inherits from: nsisupports last changed in gecko 1.0 an output stream may be "blocking" or "non-blocking" (see the isnonblocking() method). a blocking output stream may suspend the calling thread in order to satisfy a call to close(), flush(), write(), writefrom(), or writesegments(). ...
...itesegments(). a non-blocking output stream, on the other hand, must not block the calling thread of execution. note: blocking output streams are often written to on a background thread to avoid locking up the main application thread. for this reason, it is generally the case that a blocking output stream should be implemented using thread-safe addref and release. method overview void close(); void flush(); boolean isnonblocking(); unsigned long write(in string abuf, in unsigned long acount); unsigned long writefrom(in nsiinputstream afromstream, in unsigned long acount); unsigned long writesegments(in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount); native code only! methods close() close the stream. forc...
... unsigned long writefrom(in nsiinputstream afromstream, in unsigned long acount); unsigned long writesegments(in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount); native code only! methods close() close the stream. forces the output stream to flush() any buffered data. note: this method may be called more than once, but subsequent calls are ignored. void close(); parameters none. exceptions thrown ns_base_stream_would_block indicates that closing the output stream would block the calling thread for an indeterminate amount of time. this exception may only be thrown if isnonblocking() returns true. flush() this method may be called to instruct the output stream to write out the contents of any internal buffers to a low-level data sink, such as...
nsIScriptableIO
specifying the abuffersize parameter. if the text mode is specified, a buffer is always used, regardless of whether or not it is specifically requested. block: when this mode is specified, reading from a transport such as a socket when no data is available will block until data is available before returning. if this mode isn't specified, an exception is thrown if no data is available. deleteonclose: the file is automatically deleted when the stream is closed. this can be useful for temporary files. closeoneof: the file is automatically closed when the end of the file is reached. reopenonrewind: used in conjunction with the seek mode, the file will be reopened when a seek to the beginning of the file is done. multi: the resulting stream is one which is used to concatenate the input fro...
...r writing the stream. exceptions thrown ns_error_invalid_arg abase was null. ...
...son"); if (!file.exists()) file.create(ci.nsifile.normal_file_type, 0600); var stream = io.newoutputstream(file, "text write create truncate"); stream.writestring(json); stream.close(); example: reading from a file var file = io.getfile("profile", null); file.append("localstore.json"); if (file.exists()) { var stream = io.newinputstream(file, "text"); var json = stream.readline(); stream.close(); } see also nsifile, nsiinputstream, nsioutputstream ...
nsIWindowsRegKey
/nsiwindowsregkey.idlscriptable this interface is designed to provide scriptable access to the windows registry system. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) the interface represents a single key in the registry. this interface is highly win32 specific. ...
...is 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. it is possible to initialize this object by setting an hkey on it. in that case, it is the responsibility of the consumer setting the hkey to ensure that it is a valid hkey. warning: setting the key does not close() the old key. native code only! valuecount unsigned long this attribute returns the number of values under this key. read only. constants root key constants the values for these keys correspond to the values from winreg.h in the ms platform sdk. the root_key_ prefix corresponds to the hkey_ prefix in the ms platform sdk. this interface is not restricted to using only these r...
...and reg_expand_sz value types. it is still possible to enumerate values that have other types (that is, getvaluetype() may return a type not defined below). constant value description type_none 0 reg_none type_string 1 reg_sz type_binary 3 reg_binary type_int 4 reg_dword type_int64 11 reg_qword methods close() this method closes the key. if the key is already closed, then this method does nothing. void close(); parameters none. create() this method opens an existing key or creates a new key. note: on 32-bit windows, it is valid to pass any hkey as the rootkey parameter of this function. however, for compatibility with 64-bit windows, that usage should probably be avoided in favor of createchild(). v...
nsIWorkerScope
s/threads/nsidomworkers.idlscriptable this interface represents the global scope in which a worker's script runs. 1.0 66 introduced gecko 1.9.1 inherits from: nsiworkerglobalscope last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview void postmessage(in domstring amessage, [optional] in nsiworkermessageport amessageport); void close(); attributes attribute type description onclose nsidomeventlistener a listener object to be called when the worker stops running. onmessage nsidomeventlistener a listener object to be called when a message is posted on the port. the message is in the event's data member. methods close() allows the worker to terminate itself. if a listener has been established by setting the value ...
...postmessage() posts a message to the scope's parent worker object. void postmessage( in domstring amessage, in nsiworkermessageport amessageport optional ); parameters amessage the message to post. it will be stored as the data member in the event. ...
...postmessage() posts a message to the scope's parent worker object. void postmessage( in domstring amessage, in nsiworkermessageport amessageport optional ); parameters amessage the message to post. it will be stored as the data member in the event. ...
MailNews fakeserver
of '\n' (but not '\r') to '\r\n' for you, as well as append the '\r\n' to the response if not present. it will also properly queue all messages sent in pipelining mode and will present lines without any eol characters. in addition, it uses utf-8 as the transmission medium. the server presents the following api to the handler: <caption> server api </caption> name arguments returns description closesocket none nothing closes the socket and stops the test. setmultiline the new value of multiline nothing the value is a boolean, with true invoking multiline mode. it is off by default. extending a handler to provide different mechanisms is a process not defined here; please check the documentation of the corresponding handler for instructions. using fakeserver in xpcshell tests since there...
...w handler(daemon)); // port to use. i tend to like using 1024 + default port number myself. // probably best to include as a constant somewhere. also, use something // larger than 1024 for best results. server.start(port); // set up a nsimsgincomingserver locally localserver.someactionrequiringconnection(); server.performtest(); // nothing will be executed until the connection is closed // localserver.closecachedconnections() is generally a good way to do so server.resettest(); // set up second test server.performtest(); transaction = server.playtransaction(); // finished with tests server.stop(); } currently, fakeserver provides no means to keep a persistent connection past a test, requiring connections to be closed, possibly forcibly. alternatively, one can w...
...to enable/disable debugging, call setdebuglevel on your nsmailserver instance with one of the following options: const fsdebugnone = 0; // dump nothing const fsdebugrecv = 1; // dump just the received com...
Working with windows in chrome code
you can find the window's opener using its window.opener property or via a callback function passed to the window in a way described in the previous section. let's add cod...
...ner when the user presses cancel on the progress dialog. using window.opener. the opener property returns its window's opener; that is, the window object that opened it. if we're sure the window that opened the progress dialog declares the canceloperation function, we can use window.opener.canceloperation() to notify it, like this: <button label="cancel" oncommand="opener.canceloperation(); close();" /> using a callback function. alternatively, the opener window can pass a callback function to the progress dialog in the same way we passed the status string in the previous example: function oncancel() { alert("operation canceled!"); } ... window.opendialog( "chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress...
...e status string in the previous example: function oncancel() { alert("operation canceled!"); } ... window.opendialog( "chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress: 50, progress: 10}, oncancel ); the progress dialog can then run the callback like this: <button label="cancel" oncommand="window.arguments[1](); close();" /> example 3: using nsiwindowmediator when opener is not enough the window.opener property is very easy to use, but it's only useful when you're sure that your window was opened from one of a few well-known places. in more complicated cases you need to use the nsiwindowmediator interface, introduced above. one case in which you might want to use nsiwindowmediator is in an extension's opti...
Working with ArrayBuffers
ctypes.winapi_abi : ctypes.default_abi, ctypes.void_t, // return ctypes.void_t.ptr, // *dest ctypes.void_t.ptr, // *src ctypes.size_t // count ); } catch (ex) { throw new error('i dont know where to memcpy is defined on your operating syste...
...clare('memcpy', os.constants.sys.name.tolowercase().indexof('win') == 0 ? ...
...r, // *dest ctypes.void_t.ptr, // *src ctypes.size_t // count ); } catch (ex) { throw new error('i dont know where to memcpy is defined on your operating system, "' + os.constants.sys.name + '"'); lib.close() } memcpy(myimgdat.data, pixelbuffer, myimgdat.data.length); // myimgdat.data.length is imgwidth * imgheight *4 because per pixel there is r, g, b, a numbers lib.close(); see also type conversion ...
Plug-in Basics - Plugins
ad multiple instances of the same plug-in on a single page, or in several open windows at the same time. if you are browsing a page that has several embedded realaudio clips, for example, the browser will create as many instances of the realplayer plug-in as are needed (though of course playing several realaudio files at the same time would seldom be a good idea). when the user leaves the page or closes the window, the plug-in instance is deleted. when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory. a plug-in consumes no resources other than disk space when it is not loaded. the next section, understanding the runtime model, describes these stages in more detail. understanding the runtime model plug-ins are dynamic code modules that are associated with one...
...re information about initializing and destructing. the browser calls the plug-in api function npp_new when the instance is created. multiple instances of the same plug-in can exist (a) if there are multiple embedded objects on a single page, or (b) if several browser windows are open and each displays the same data type. a plug-in instance is deleted when a user leaves the instance's page or closes its window; gecko calls the function npp_destroy to inform the plug-in that the instance is being deleted. when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory. gecko calls the function np_shutdown. plug-ins consume no resources (other than disk space) when not loaded. note: plug-in api calls and callbacks use the main navigator thread. in general, if you ...
...i checked also this command with above script (with environment variable) on my system and also working. however, primary working path with binary file was /usr/lib/mozilla/plugins for 32-bit and 64-bit linux distributions and looks still working. firefox and opensuse probably use "moz_plugin_path environment variable" in script to run firefox, so in this way /usr/lib64/mozilla/plugin...
Debugger.Environment - Firefox Developer Tools
a debugger.environment instance represents a lexical environment, associating names with variables. each debugger.frame instance representing a debuggee frame has an associated environment object describing the variables in scope in that frame; and each debugger.object instance representing a debuggee function has an environment object representing the environment the function has closed over. ecmascript environments form a tree, in which each local environment is parented by its enclosing environment (in ecmascript terms, its ‘outer’ environment). we say an environmentbinds an identifier if that environment itself associates the identifier with a variable, independently of its outer environments. we say an identifier isin scope in an environment if the identifier is bound in that ...
...nstances as needed as the debugger inspects stack frames and function objects; calling debugger.environment as a function or constructor raises a typeerror exception. spidermonkey creates exactly one debugger.environment instance for each environment it presents via a given debugger instance: if the debugger encounters the same environment through two different routes (perhaps two functions have closed over the same environment), spidermonkey presents the same debugger.environment instance to the debugger each time. this means that the debugger can use the == operator to recognize when two debugger.environment instances refer to the same environment in the debuggee, and place its own properties on a debugger.environment instance to store metadata about particular environments. (if more than o...
...ment records. “object”, indicating that the environment’s bindings are the properties of an object. the global object and dom elements appear in the chain of environments via object environments. (note that with statements have their own environment type.) “with”, indicating that the environment was introduced by a with statement. parent the environment that encloses this one (the “outer” environment, in ecmascript terminology), or null if this is the outermost environment. object a debugger.object instance referring to the object whose properties this environment reflects. if this is a declarative environment record, this accessor throws a typeerror (since declarative environment records have no such object). both "object" and "with" environments have...
Network request list - Firefox Developer Tools
e red line marks the point at which the page's load event is triggered. blocking specific urls if you want to view your page as it would look without a resource (e.g., if it were blocked by the browser or an extension), you can block requests matching patterns you specify. click the request blocking icon in the toolbar. this opens the blocking sidebar. (click the icon again when you want to close the sidebar.) enter a string in the field with the placeholder text block resource when url contains. reload the page to test it with the specified url blocked. other actions you can take with request blocking: to turn all request blocking off or on: toggle the checkbox next to enable request blocking. to turn a specific block off or on: toggle the checkbox next to that item. to delet...
...s resources coming from a server with the specified ip. remote-ip:63.245.215.53 remote-ip:[2400:cb00:2048:1::6810:2802] cause shows resources matching a specific cause type. the types can be found in the description of the cause column. cause:js cause:stylesheet cause:img transferred shows resources having a specific transferred size or a transferred size close to the one specified. k can be used as suffix for kilobytes and m for megabytes, e.g. the value 1k is equivalent to 1024. transferred:1k size shows resources having a specific size (after decompression) or a size close to the one specified. k can be used as suffix for kilobytes and m for megabytes, e.g. the value 1k is equivalent to 1024. size:2m larger-than shows r...
...cific item that matches the string. clicking an item in the search results highlights that item in the monitor list, and displays the corresponding information in the request details pane. other ways to use the search panel: to clear the search string: click the x icon in the search field. to make the search case sensitive: click the case sensitive (aa) icon next to the search field. to close the search panel, do one of the following: click the x icon next to the search field. click the search icon in the network monitor toolbar. context menu context-clicking on a row in the list displays a context menu with the following options: menuitem description copy > copy url copies the url. copy > copy as curl copies the network reques...
Document.write() - Web APIs
Web › API › Document › write
the document.write() method writes a string of text to a document stream opened by document.open(). 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. syntax document.write(markup); parameters markup a string containing the text to be written to the document. ...
...) document automatically calls document.open(), which will clear the document. syntax document.write(markup); parameters markup a string containing the text to be written to the document. example <html> <head> <title>write example</title> <script> function newcontent() { document.open(); document.write("<h1>out with the old, in with the new!</h1>"); document.close(); } </script> </head> <body onload="newcontent();"> <p>some original document content.</p> </body> </html> notes the text you write is parsed into the document's structure model. in the example above, the h1 element becomes a node in the document. writing to a document that has already loaded without calling document.open() will automatically call document.open(). after writing, ...
...script> </head> <body onload="newcontent();"> <p>some original document content.</p> </body> </html> notes the text you write is parsed into the document's structure model. in the example above, the h1 element becomes a node in the document. writing to a document that has already loaded without calling document.open() will automatically call document.open(). after writing, call document.close() to tell the browser to finish loading the page. if the document.write() call is embedded within an inline html <script> tag, then it will not call document.open(). for example: <script> document.write("<h1>main title</h1>") </script> note: document.write() and document.writeln do not work in xhtml documents (you'll get an "operation is not supported" [ns_error_dom_not_supported_err] error...
EventSource - Web APIs
once the connection is opened, incoming messages from the server are delivered to your code in the form of events. if there is an event field in the incoming message, the triggered event is the same as the event field value. if no event field is present, then a generic message event is fired. ...
... client (defaults to 100). constructor eventsource() creates a new eventsource to handle receiving server-sent events from a specified url, optionally in credentials mode. properties this interface also inherits properties from its parent, eventtarget. eventsource.readystate read only a number representing the state of the connection. possible values are connecting (0), open (1), or closed (2). eventsource.url read only a domstring representing the url of the source. eventsource.withcredentials read only a boolean indicating whether the eventsource object was instantiated with cross-origin (cors) credentials set (true), or not (false, the default). event handlers eventsource.onerror is an eventhandler called when an error occurs and the error event is dispatched on an ...
...or event is dispatched on an eventsource object. eventsource.onmessage is an eventhandler called when a message event is received, that is when a message is coming from the source. eventsource.onopen is an eventhandler called when an open event is received, that is when the connection was just opened. methods this interface also inherits methods from its parent, eventtarget. eventsource.close() closes the connection, if any, and sets the readystate attribute to closed. if the connection is already closed, the method does nothing. events error fired when a connection to an event source failed to open. message fired when data is received from an event source. open fired when a connection to an event source has opened. additionally, the event source itself may send messages ...
HTMLDialogElement - Web APIs
pointer-events: all;} properties inherits properties from its parent, htmlelement. htmldialogelement.open a boolean reflecting the open html attribute, indicating whether the dialog is available for interaction. htmldialogelement.returnvalue a domstring that sets or returns the return value for the dialog. methods inherits methods from its parent, htmlelement. htmldialogelement.close() closes the dialog. an optional domstring may be passed as an argument, updating the returnvalue of the the dialog. htmldialogelement.show() displays the dialog modelessly, i.e. still allowing interaction with content outside of the dialog. htmldialogelement.showmodal() displays the dialog as a modal, over the top of any other dialogs that might be present. interaction outside the dialog is...
... an optional domstring may be passed as an argument, updating the returnvalue of the the dialog. htmldialogelement.show() displays the dialog modelessly, i.e. still allowing interaction with content outside of the dialog. htmldialogelement.showmodal() displays the dialog as a modal, over the top of any other dialogs that might be present. interaction outside the dialog is blocked. events close fired when the dialog is closed. also available via the onclose property. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the htmldialogelement.showmodal() function. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() function), or submit the form via the submit button. <!-- simpl...
... <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>...
Capabilities, constraints, and settings - Web APIs
ll always succeed, because these values will be considered a request, not a requirement. specifying a range of values sometimes, any value within a range is acceptable for a property's value. you can specify ranges with either or both minimum and maximum values, and you can even specify an ideal value within the range, if you choose. if you provide an ideal value, the browser will try to get as close as possible to matching that value, given the other constraints specified. let supports = navigator.mediadevices.getsupportedconstraints(); if (!supports["width"] || !supports["height"] || !supports["framerate"] || !supports["facingmode"]) { // we're missing needed properties, so handle that error. } else { let constraints = { width: { min: 640, ideal: 1920, max: 1920 }, height: { m...
...to getusermedia(). you can also change the constraints of an existing mediastreamtrack on the fly, by calling the track's applyconstraints() method, passing into it an object representing the constraints you wish to apply to the track: videotrack.applyconstraints({ width: 1920, height: 1080 }); in this snippet, the video track referenced by videotrack is updated so that its resolution as closely as possible matches 1920x1080 pixels (1080p high definition). retrieving current constraints and settings it's important to remember the difference between constraints and settings. constraints are a way to specify what values you need, want, and are willing to accept for the various constrainable properties (as described in the documentation for mediatrackconstraints), while settings are the...
...{\n "width": 320,\n "height": 240,\n "framerate": 30\n}'; let audiodefaultconstraintstring = '{\n "samplesize": 16,\n "channelcount": 2,\n "echocancellation": false\n}'; these defaults ask for a pretty common camera configuration, but don't insist on any property being of special importance. the browser should do its best to match these settings but will settle for anything it considers a close match. then we initialize the variables which will hold the mediatrackconstraints objects for the video and audio tracks, as well as the variables which will hold references to the video and audio tracks themselves, to null. let videoconstraints = null; let audioconstraints = null; let audiotrack = null; let videotrack = null; and we get references to all of the elements we'll need to access...
RTCDataChannel.onclosing - Web APIs
syntax rtcdatachannel.onclosing = function; value a function which the browser will call to handle the closing event. ...
... syntax rtcdatachannel.onclosing = function; value a function which the browser will call to handle the closing event. ...
... syntax rtcdatachannel.onclosing = function; value a function which the browser will call to handle the closing event. ...
RTCDataChannel.readyState - Web APIs
new rtcdatachannel created by the webrtc layer when the remote peer created the channel and delivered to the site or app in a datachannel event of type rtcdatachannelevent. "closing" the process of closing the underlying data transport has begun. it is no longer possible to queue new messages to be sent, but previously queued messages may still be send or received before entering the "closed" state. "closed" the underlying data transport has closed, or the attempt to make the connection failed. example var datachannel = peerconnection.createdatachannel("file transfer"); var sendqueue = []; function sendmessage(msg) { switch(datachannel.readystate) { case "connecting": console.log("connection not open; queueing: " + msg); sendqueue.push(msg); ...
... candidate recommendation initial specification. ...
... candidate recommendation initial specification. ...
RTCPeerConnection.removeStream() - Web APIs
the rtcpeerconnection.removestream() method removes a mediastream as a local source of audio or video. if the negotiation already happened, a new one will be needed for the remote peer to be able to use it. because this method has been deprecated, you should instead use removetrack() if your target browser versions have implemented it. if the signalingstate is set to "closed", an invalidstateerror is raised. if the signalingstate is set to "stable", the event negotiationneeded is sent on the rtcpeerconnection. syntax rtcpeerconnection.removestream(mediastream); parameters mediastream a mediastream specifying the stream to remove from the connection. return value undefined. example var pc, videostream; navigator.getusermedia({video: true}, function(stream) { pc = new ...
...t on the rtcpeerconnection. ...
... mediastream a mediastream specifying the stream to remove from the connection. return value undefined. ...
ReadableStreamDefaultController - Web APIs
e and internal queue. default controllers are for streams that are not byte streams. constructor none. readablestreamdefaultcontroller instances are created automatically during readablestream construction. properties readablestreamdefaultcontroller.desiredsize read only returns the desired size required to fill the stream's internal queue. methods readablestreamdefaultcontroller.close() closes the associated stream. readablestreamdefaultcontroller.enqueue() enqueues a given chunk in the associated stream. readablestreamdefaultcontroller.error() causes any future interactions with the associated stream to error. examples in the following simple example, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the s...
...the start() function generates a random string of text every second and enqueues it into the stream. a cancel() function is also provided to stop the generation if readablestream.cancel() is called for any reason. note that a readablestreamdefaultcontroller object is provided as the parameter of the start() and pull() functions. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement(...
... living standa...
Touch.radiusX - Web APIs
Web › API › Touch › radiusX
the value is in css pixels of the same scale as touch.screenx. this value, in combination with touch.radiusy and touch.rotationangle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. this may be a relatively large ellipse representing the contact between a fingertip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
...rtip and the screen or a small area representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var xradius = touchitem.radiusx; return value xradius the x radius of the ellipse that most closely circumscribes the area of contact with the touch surface. example this example illustrates using the touch interface's touch.radiusx, touch.radiusx and touch.rotationangle properties. the touch.radiusx property is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis indicated by the touch point's touch.rotationangle. likewise, the ...
...finger, stylus) along the axis perpendicular to that indicated by touch.rotationangle. ...
Writing WebSocket servers - Web APIs
header for security (checking for same origin, automatically allowing or denying, etc.) and send a 403 forbidden if you don't like what you see. however, be warned that non-browser agents can send a faked origin. most applications reject requests without this header. if any header is not understood or has an incorrect value, the server should send a 400 ("bad request")} response and immediately close the socket. as usual, it may also give the reason why the handshake failed in the http response body, but the message may never be displayed (browsers do not display it). if the server doesn't understand that version of websockets, it should send a sec-websocket-version header back that contains the version(s) it does understand. in the example above, it indicates version 13 of the websocket pro...
...code of 0x9, and pongs have an opcode of 0xa. when you get a ping, send back a pong with the exact same payload data as the ping (for pings and pongs, the max payload length is 125). you might also get a pong without ever sending a ping; ignore this if it happens. if you have gotten more than one ping before you get the chance to send a pong, you only send one pong. closing the connection to close a connection either the client or server can send a control frame with data containing a specified control sequence to begin the closing handshake (detailed in section 5.5.1). upon receiving such a frame, the other peer sends a close frame in response. the first peer then closes the connection. any further data received after closing of connection is then discarded. miscellaneous websocket co...
... more than one, send the first one the client sent. imagine our server can use both soap and wamp. then, in the response handshake, it sends: sec-websocket-protocol: soap the server can't send more than one sec-websocket-protocol header. if the server doesn't want to use any subprotocol, it shouldn't send any sec-websocket-protocol header. sending a blank header is incorrect. the client may close the connection if it doesn't get the subprotocol it wants. if you want your server to obey certain subprotocols, then naturally you'll need extra code on the server. let's imagine we're using a subprotocol json. in this subprotocol, all data is passed as json. if the client solicits this protocol and the server wants to use it, the server needs to have a json parser. practically speaking, this ...
Fundamentals of WebXR - Web APIs
es to achieve a wide enough field of view that the user's eyes are tricked into believing that the virtual world completely surrounds them, the fov needs to at least approach the width of the binocular vision area. basic headsets typically start around 90° or so, while the best headsets generally have a field of view of around 150°. because the fov is a matter of the size of the lenses and how close they are to the user's eyes, there are limitations on how wide the fov can get without installing lenses into the user's eyeballs. a wide fov can substantially improve the user's sense of immersion. however, increasing the fov can also increase the weight and cost of the headset. degrees of freedom the term degrees of freedom is an indication of how much freedom of movement the user has within...
...ch as a headset, and replaces the entire world with the rendered scene using the displays shown to each of the user's eyes. augmented reality in augmented reality (ar), the user sees the imagery you render presented on top of the physical, real-world environment around them. because ar is always an immersive experience, in which the scene is the entire world around the user (rather than being enclosed in a box on a screen), the only ar session mode is immersive-ar. the webxr augmented reality module is still in a state of early development and is not yet stable enough for regular use. we do not yet include documentation for it here on mdn, but it will come as soon as the module's specification settles down. there are two basic types of ar device: devices which use cameras to capture th...
...tion sensors that are worn or held by the user, or, increasingly commonly, using infrared cameras that detect the user's movements. speakers placed around the chamber provide immersive sound as well. these are not common among everyday users; they're mostly either experimental, used for demonstration purposes, or used by larger organizations. one drawback is that the cave can't simulate anything closer than the wall. important health and safety reminders because the entire act of creating a virtual 3d world is, in essence, a trick which takes advantage of our understanding of how eyes collect light and how the brain interprets the collected data, it is important to keep in mind that as such, software designers and developers have a responsibility to be even more careful than usual to ensu...
Inputs and input sources - Web APIs
ce, w, the grip space's origin is located x units to the right, y units above, and z units farther away. given the directionality of the axes, the coordinates of the grip space can be expressed in world coordinates as (x, y, -z); z is negative since the grip space is farther away along the z axis, and is thus in the negative direction. if the controller were instead positioned to the left of and closer to the user than the world space origin (or possibly behind the user, if the user is located at the origin, although that's an uncomfortable way to hold a controller), the coordinates would have a negative value for x, but a positive value for z. the value of y would still be positive unless the controller was moved below the world space origin. this is shown in the diagram below, in which the ...
... although that's an uncomfortable way to hold a controller), the coordinates would have a negative value for x, but a positive value for z. the value of y would still be positive unless the controller was moved below the world space origin. this is shown in the diagram below, in which the controller is located down and to the left of the world space's origin, with the controller also moved to be closer to us than the origin. as a result, the values of x and y are both negative, while z is positive. mapping a grip space to the world origin when the controller is positioned below and to the left of the world origin, and closer to us than the world origin is. gamepad record each input source has a gamepad property which, if not null, is a gamepad object describing the various controls an...
...the controller, or of a model with which the controller is compatible. for example, entry 0 in profiles for an oculus touch controller is oculus-touch. the next entry is generic-trigger-squeeze-thumbstick, indicating a generic device with a trigger, a squeeze control, and a thumbstick. while the oculus touch controller actually has a thumbpad rather than a thumbstick, the overall description is "close enough" that the details within the profile matching the name will let the controller be interpreted usefully. actions in webxr, an action is a special type of event that's triggered by the user activating a special button on the controller. any additional buttons (as well as things like axis controllers—joysticks, for example—and the like) are managed solely through the xrinputsource prope...
Lighting a WebXR setting - Web APIs
ty with distance, the rate of change is very low and is only noticed over vast distances, so the rate of intensity change of sunlight doesn't typically matter for rendering a 3d scene. point light sources a point light source is a light source located at a specific location, radiating outward equally in every direction. light bulbs, candles, and the like are examples of point light sources. the closer an object is to a point light source, the brighter the light it casts onto that object. the rate at which the brightness of a point light falls off is called attenuation, and is a configurable feature of the light source in webgl and other lighting systems. between the law of reflection and the fact that the brightness of the light rays decreases with distance, the light emitted by a point sour...
...r the light it casts onto that object. the rate at which the brightness of a point light falls off is called attenuation, and is a configurable feature of the light source in webgl and other lighting systems. between the law of reflection and the fact that the brightness of the light rays decreases with distance, the light emitted by a point source and reflected back tends to be brightest at the closest point to the light source and dimmer the farther away it is. even if the surface is flat, the closest point to the light source is the center, with rays becoming increasingly long as the angle away from the normal changes. photo of a spotlight shining upon a stucco wall at night. spot light sources a spot light source (or spotlight) is a light source which is located at a specific po...
... be used to detect this pattern and thus determine that a user is in a particular location. this could be done remotely, or it could be performed by an attacker who's located in the same room but wants to determine if the other person is also in the same room. another scenario in which lighting estimation can be used to obtain information about the user without permission: if the light sensor is close enough to the user's display to detect lighting changes caused by the contents of the display, an algorithm could be used to determine whether or not the user is watching a particular video—or even to potentially identify which of a number of videos the user is watching. the lighting estimation api specification mandates that all user agents perform temporal and spatial filtering to fuzz the d...
Movement, orientation, and motion: A WebXR example - Web APIs
r hand, we call its end() method to stop the session. the last thing we do in this code is to check to see if xrsession is still non-null. if it is, we call sessionended(), the handler for the end event. this code should not be necessary, but there appears to be an issue in which at least some browsers are not correctly firing the end event. by running the event handler directly, we complete the close-out process manually in this situation. starting up the webxr session the sessionstarted() function handles actually setting up and starting the session, by setting up event handlers, compiling and installing the glsl code for the vertex and fragment shaders, and attaching the webgl layer to the webxr session before kicking off the rendering loop. it gets called as the handler for the promise r...
...ng it all together when you take all of this code and add in the html and the other javascript code not included above, you get what you see when you try out this example on glitch. remember: as you wander around, if you get lost, just hit the r key to reset yourself to the beginning. a tip: if you don't have an xr device, you may be able to get some of the 3d effect if you bring your face very close to the screen, with your nose centered along the border between the left and right eye images in the canvas. by carefully focusing through the screen at the image, and slowly moving forward and backward, you should eventually be able to bring the 3d image into focus. it can take practice, and your nose may literally be touching the screen, depending on how sharp your eyesight is. there are plent...
...ckward, you should eventually be able to bring the 3d image into focus. it can take practice, and your nose may literally be touching the screen, depending on how sharp your eyesight is. there are plenty of things you can do using this example as a starting point. try adding more objects to the world, or improve the movement controls to move more realistically. add walls, ceiling, and floor to enclose you in a space instead of having an infinite-seeming universe to get lost in. add collision testing or hit testing, or the ability to change the texture of each face of the cube. there are few limitations on what can be done if you set yourself to it. ...
Window.openDialog() - Web APIs
Web › API › Window › openDialog
javascript array object and added to the newly created window as a property named window.arguments. they may be referenced in the javascript of the window at any time, including during the execution of a load handler. these parameters may be used, then, to pass arguments to and from the dialog window. the call to opendialog() returns immediately. if you want the call to block until the user has closed the dialog, supply modal as a windowfeatures parameter. note that this also means the user won't be able to interact with the opener window until he closes the modal dialog. syntax newwindow = opendialog(url, name, features, arg1, arg2, ...) newwindow the opened window url the url to be loaded in the newly opened window. name the window name (optional). see window.open() description f...
...rty named arguments of type array, and this property gets added to the newly opened dialog window. to access these extra parameters from within dialog code, use the following scheme: var food = window.arguments[0]; var price = window.arguments[1]; note that you can access this property from within anywhere in the dialog code. (another example). returning values from the dialog since window.close() erases all properties associated with the dialog window (i.e. the variables specified in the javascript code which gets loaded from the dialog), it is not possible to pass return values back past the close operation using globals (or any other constructs). to be able to pass values back to the caller, you have to supply some object via the extra parameters. you can then access this object from...
...ets loaded from the dialog), it is not possible to pass return values back past the close operation using globals (or any other constructs). to be able to pass values back to the caller, you have to supply some object via the extra parameters. you can then access this object from within the dialog code and set properties on it, containing the values you want to return or preserve past the window.close() operation. var retvals = { address: null, delivery: null }; opendialog("http://example.tld/zzz.xul", "dlg", "modal", "pizza", 6.98, retvals); if you set the properties of the retvals object in the dialog code as described below, you can now access them via the retvals array after the opendialog() call returns. inside the dialog code, you can set the properties as follows: var retvals =...
WritableStream.getWriter() - Web APIs
e creation of the writablestream with a custom sink and an api-supplied queuing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: true }); e...
...ultwriter.ready .then(() => { return defaultwriter.write(chunk); }) .then(() => { console.log("chunk written to sink."); }) .catch((err) => { console.log("chunk error:", err); }); }); // call ready again to ensure that all chunks are written // before closing the writer. ...
... specifications specification status comment ...
WritableStreamDefaultWriter.WritableStreamDefaultWriter() - Web APIs
the creation of a writablestream with a custom sink and an api-supplied queuing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: true }); e...
...ultwriter.ready .then(() => { return defaultwriter.write(chunk); }) .then(() => { console.log("chunk written to sink."); }) .catch((err) => { console.log("chunk error:", err); }); }); // call ready again to ensure that all chunks are written // before closing the writer. ...
... specifications specification status comment ...
WritableStreamDefaultWriter.write() - Web APIs
the creation of a writablestream with a custom sink and an api-supplied queuing strategy. 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 foreach() call is used to write each chunk of the string to the stream. finally, write() and close() return promises that are processed to deal with success or failure of chunks and streams. const list = document.queryselector('ul'); function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter const defaultwriter = writablestream.getwriter(); const encoder = new textencoder(); const encoded = encoder.encode(message, { stream: true }); e...
...ultwriter.ready .then(() => { return defaultwriter.write(chunk); }) .then(() => { console.log("chunk written to sink."); }) .catch((err) => { console.log("chunk error:", err); }); }); // call ready again to ensure that all chunks are written // before closing the writer. ...
... specifications specification status comment ...
ARIA: dialog role - Accessibility
(it's still possible to interact with content outside of the dialog) or modal (only the content in the dialog can be interacted with). <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> description marking up a dialog element with the dialog role helps assistive technology identify the dialog's content as being grouped and separated from the rest of the page content. however, adding role="dialog" alone is not sufficient to make a dialog accessible. additionally, the following needs to be done: the dialog must be properly labeled keyboard focus must be manag...
...e, this text can be associated with the dialog using the aria-describedby attribute. this approach is shown in the code snippet below: <div role="dialog" aria-labelledby="dialog1title" aria-describedby="dialog1desc"> <h2 id="dialog1title">your personal details were successfully updated</h2> <p id="dialog1desc">you can change your details at any time in the user account section.</p> <button>close</button> </div> keep in mind that a dialog's title and description text do not have to be focusable in order to be perceived by screen readers operating in a non-virtual mode. the combination of the aria dialog role and labeling techniques should make the screen reader announce the dialog's information when focus is moved into it. required javascript features focus management a dialog has pa...
...ode. the combination of the aria dialog role and labeling techniques should make the screen reader announce the dialog's information when focus is moved into it. required javascript features focus management a dialog has particular requirements for how keyboard focus should be managed: dialogs should always have at least one focusable control. for many dialogs, there will be a button like "close", "ok" or "cancel". in addition to the needed control, dialogs can contain any number of focusable elements, even entire forms or other container widgets like tabs. when the dialog appears on the screen, keyboard focus (whose control depends upon the dialogs purpose) should be moved to the default focusable control inside the dialog. for dialogs that only provide a basic message, it could be an ...
:target - CSS: Cascading Style Sheets
Web › CSS › :target
re initially hidden on the page. once targeted, the css changes their display so that they are shown. note: a more complete pure-css lightbox based on the :target pseudo-class is available on github (demo). html <ul> <li><a href="#example1">open example #1</a></li> <li><a href="#example2">open example #2</a></li> </ul> <div class="lightbox" id="example1"> <figure> <a href="#" class="close"></a> <figcaption>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec felis enim, placerat id eleifend eu, semper vel sem.</figcaption> </figure> </div> <div class="lightbox" id="example2"> <figure> <a href="#" class="close"></a> <figcaption>cras risus odio, pharetra nec ultricies et, mollis ac augue. nunc et diam quis sapien dignissim auctor. quisque...
...igure> </div> css /* unopened lightbox */ .lightbox { display: none; } /* opened lightbox */ .lightbox:target { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; } /* lightbox content */ .lightbox figcaption { width: 25rem; position: relative; padding: 1.5em; background-color: lightpink; } /* close button */ .lightbox .close { position: relative; display: block; } .lightbox .close::after { right: -1rem; top: -1rem; width: 2rem; height: 2rem; position: absolute; display: flex; z-index: 1; align-items: center; justify-content: center; background-color: black; border-radius: 50%; color: white; content: "×"; cursor: pointer; } /* lightbox overlay */ .lightbox ...
... living standard defines html-specific semantics. ...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
e browser's transform-origin property doesn't consider 10em 10em 10em valid: @supports not (transform-origin: 10em 10em 10em) {} as with any operator, the not operator can be applied to a declaration of any complexity. the following examples are both valid: @supports not (not (transform-origin: 2px)) {} @supports (display: grid) and (not (display: inline-grid)) {} note: there is no need to enclose the not operator between two parentheses at the top level. to combine it with other operators, like and and or, the parentheses are required. the and operator the and operator creates a new expression from the conjunction of two shorter expressions. it returns true only if both of the shorter expressions are also true. the following example returns true if and only if the two shorter expressio...
...ich they apply. otherwise, the condition is invalid and the whole rule is ignored. ...
...<compound-selector> ]*where <compound-selector> = [ <type-selector>? <subclass-selector>* [ <pseudo-element-selector> <pseudo-class-selector>* ]* ]!<combinator> = '>' | '+' | '...
Border-image generator - CSS: Cascading Style Sheets
.25s; } #unit-settings .title { width: 100%; margin: -5px auto 0; color: #666; font-size: 14px; font-weight: bold; line-height: 25px; border-bottom: 1px solid #e5e5e5; } #unit-settings .ui-input-slider { margin: 10px 0 0 0; } #unit-settings .ui-input-slider-info { width: 50px; line-height: 1.5em; } #unit-settings input { font-size: 12px; width: 40px !important; } #unit-settings .close { width: 16px; height: 16px; background: url('https://mdn.mozillademos.org/files/6019/close.png') no-repeat center center; background-size: 75%; position: absolute; top: 4px; right: 4px; opacity: 0.5; } #unit-settings .close:hover { cursor: pointer; opacity: 1; } #unit-settings[data-active='true'] { opacity: 1; } #unit-settings[data-active='false'] { opacity: 0; top: -100px !impo...
...ic; panel.setattribute('data-active', 'true'); panel.style.top = e.target.offsettop - 40 + 'px'; panel.style.left = e.target.offsetleft + 30 + 'px'; inputslidermanager.setvalue('unit-precision', precision); inputslidermanager.setvalue('unit-step', step); }; var init = function init() { panel = document.createelement('div'); title = document.createelement('div'); var close = document.createelement('div'); step = inputslidermanager.createslider('unit-step', 'step'); precision = inputslidermanager.createslider('unit-precision', 'precision'); inputslidermanager.setstep('unit-precision', 1); inputslidermanager.setmax('unit-precision', 2); inputslidermanager.setvalue('unit-precision', 2); inputslidermanager.setsensivity('unit-precision', 20); inp...
... inputslidermanager.setvalue('unit-precision', 2); inputslidermanager.setsensivity('unit-precision', 20); inputslidermanager.setvalue('unit-step', 1); inputslidermanager.setstep('unit-step', 0.01); inputslidermanager.setprecision('unit-step', 2); inputslidermanager.subscribe('unit-precision', updateprecision); inputslidermanager.subscribe('unit-step', updateunitsettings); close.addeventlistener('click', function () { panel.setattribute('data-active', 'false'); }); title.textcontent = 'properties'; title.classname = 'title'; close.classname = 'close'; panel.id = 'unit-settings'; panel.setattribute('data-active', 'false'); panel.appendchild(title); panel.appendchild(precision); panel.appendchild(step); panel.appendchild(close); docume...
Basic Shapes - CSS: Cascading Style Sheets
e how the reference box used as the starting point before offsets are calculated changes. circle() the circle() value for shape-outside can accept two possible arguments. the first is the shape-radius. both circle() and ellipse() values for shape-outside are specified as accepting this argument of <shape-radius>. this argument can be a length or percentage but can also be one of the keywords closest-side or farthest-side. the keyword closest-side uses the length from the center of the shape to the closest side of the reference box. for circles, this is the closest side in any dimension. for ellipses, this is the closest side in the radius dimension. the keyword farthest-side uses the length from the center of the shape to the farthest side of the reference box. for circles, this is the f...
...eference box. for circles, this is the farthest side in any dimension. for ellipses, this is the farthest side in the radius dimension. the second argument is a position. if omitted this will be set to center. however you can use any valid position here to indicate the position of the centre of the circle. our circle therefore accepts one radius value, which may be a length, a percentage or the closest-side or farthest side keyword then optionally the keyword at followed by a position value. in the below example i have created a circle on an item with a width of 100 pixels, plus a margin of 20 pixels. this gives a total width for the reference box of 140 pixels. i have given a value of 50% for the shape-radius value which means that our radius is 70px. i have then set the position value to 3...
...osition values as with circle() to move the centre of the ellipse around. in the example below we have an ellipse with an x radius of 40%, a y radius of 50% and the position being left. this means that the centre of the ellipse is on the left edge of the box giving us a half ellipse shape to wrap our text around. you can change these values to see how the ellipse changes. the keyword values of closest-side and farthest-side are useful to create a quick ellipse based on the size of the floated element reference box. polygon() the final basic shape is the most complex and enables the creation of many side shapes by way of creating a polygon(). this shape accepts three or more pairs of values (a polygon must at least draw a triangle). these values are co-ordinates drawn with reference to th...
perspective() - CSS: Cascading Style Sheets
perspective-origin properties which are attached to the parent of a child transformed in 3-dimensional space. syntax the perspective distance used by perspective() is specified by a <length> value, which represents the distance between the user and the z=0 plane. the z=0 plane is the plane where everything appears in a 2-dimensional view, or the screen. a positive value makes the element appear closer to the user than the rest of the interface, a negative value farther. the greater the value, the further away the perspective of the user is. perspective(d) values d is a <length> representing the distance from the user to the z=0 plane. if it is 0 or a negative value, no perspective transform is applied. cartesian coordinates on ℝ2 homogeneous coordinates on ℝℙ2 ca...
... <p>without perspective:</p> <div class="no-perspective-box"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> <p>with perspective (9cm):</p> <div class="perspective-box-far"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> <p>with perspective (4cm):</p> <div class="perspective-box-closer"> <div class="face front">a</div> <div class="face top">b</div> <div class="face left">c</div> </div> css .face { position: absolute; width: 100px; height: 100px; line-height: 100px; font-size: 100px; text-align: center; } p + div { width: 100px; height: 100px; transform-style: preserve-3d; margin-left: 100px; } .no-perspective-box { transform: rotatex(-15deg) rot...
...e { position: absolute; width: 100px; height: 100px; line-height: 100px; font-size: 100px; text-align: center; } p + div { width: 100px; height: 100px; transform-style: preserve-3d; margin-left: 100px; } .no-perspective-box { transform: rotatex(-15deg) rotatey(30deg); } .perspective-box-far { transform: perspective(9cm) rotatex(-15deg) rotatey(30deg); } .perspective-box-closer { transform: perspective(4cm) rotatex(-15deg) rotatey(30deg); } .top { background-color: skyblue; transform: rotatex(90deg) translate3d(0, 0, 50px); } .left { background-color: pink; transform: rotatey(-90deg) translate3d(0, 0, 50px); } .front { background-color: limegreen; transform: translate3d(0, 0, 50px); } result specifications specification status comm...
translateZ() - CSS: Cascading Style Sheets
its result is a <transform-function> data type. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this transformation is defined by a <length> which specifies how far inward or outward the element or elements move. ...
...ve() function positions the viewer relative to the plane that lies where z=0 (in essence, the surface of the screen). a value of 500px means the user is 500 pixels "in front of" the imagery located at z=0. then, the translatez() function moves the element 200 pixels "outward" from the screen, toward the user. ...
... result specifications specification status comment css transforms level 2the definition of 'transform' in that specification. ...
Control flow and error handling - JavaScript
eption that was thrown. you can use the finally block to make your script fail gracefully when an exception occurs. for example, you may need to release a resource that your script has tied up. the following example opens a file and then executes statements that use the file. ...
...(server-side javascript allows you to access files.) if an exception is thrown while the file is open, the finally block closes the file before the script fails. using finally here ensures that the file is never left open, even if an error occurs. ...
...llows you to access files.) if an exception is thrown while the file is open, the finally block closes the file before the script fails. using finally here ensures that the file is never left open, even if an error occurs. ...
try...catch - JavaScript
inally-block. note that the finally-block executes regardless of whether an exception is thrown. also, if an exception is thrown, the statements in the finally-block execute even if no catch-block handles the exception. the following example shows one use case for the finally-block. ...
...ments in the finally-block execute even if no catch-block handles the exception. the following example shows one use case for the finally-block. the code opens a file and then executes statements that use the file; the finally-block makes sure the file always closes after it is used even if an exception was thrown. ...
...k execute even if no catch-block handles the exception. the following example shows one use case for the finally-block. the code opens a file and then executes statements that use the file; the finally-block makes sure the file always closes after it is used even if an exception was thrown. ...
<mfenced> - MathML
precated mathml <mfenced> element used to provide the possibility to add custom opening and closing parentheses (such as brackets) and separators (such as commas or semicolons) to an expression. it has been removed from the latest mathml standard and modern browsers no longer support it. use the <mrow> and <mo> elements instead. attributes class, id, style provided for use with stylesheets. close a string for the closing delimiter. the default value is ")" and any white space is trimmed. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. open a string for the opening delimiter. the default val...
...cifying more than one character, it is possible to set different separators for each argument in the expression. if there are too many separators, all excess is ignored. if there are too few separators in the expression, the last specified separator is repeated. ...
...parator is repeated. examples the last separator is repeated (,) sample rendering: rendering in your browser: a b c d e <math> <mfenced open="{" close="}" separators=";;,"> <mi>a</mi> <mi>b</mi> <mi>c</mi> <mi>d</mi> <mi>e</mi> </mfenced> </math> all excess is ignored (,) sample rendering: rendering in your browser: a b c d e <math> <mfenced open="[" close="]" separators="||||,"> <mi>a</mi> <mi>b</mi> <mi>c</mi> <mi>d</mi> <mi>e</mi> </mfenced> </math> specifications the <mfenced> element is no longer part of the latest mathml standard. use the <mrow> and <mo> elements instead, or, for backwards compatibility, see mathml-polyfills/mfenced. ...
MathML documentation index - MathML
Web › MathML › Index
ng expressions the following example uses the "toggle" actiontype: 11 <math> mathml, mathml reference, mathml:element the top-level element in mathml is <math>. every valid mathml instance must be wrapped in <math> tags. in addition you must not nest a second <math> element in another, but you can have an arbitrary number of other child elements in it. 12 <menclose> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <menclose> element renders its content inside an enclosing notation specified by the notation attribute. 13 <merror> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <merror> element is used to display contents as error messages. in firefox this er...
...ript and limit schemata the mathml <mover> element is used to attach an accent or a limit over an expression. use the following syntax: <mover> base overscript </mover> 23 <mpadded> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mpadded> element is used to add extra padding and to set the general adjustment of position and size of enclosed contents. 24 <mphantom> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mphantom> element is rendered invisibly, but dimensions (such as height, width, and baseline position) are still kept. 25 <mroot> mathml, mathml reference, mathml:element, mathml:general layout schemata the mathml <mroot> element is used to displa...
...ators with their respective operands (such as <mi> and <mn>). this element renders as a horizontal row containing its arguments. 27 <ms> mathml, mathml reference, mathml:element, mathml:token elements the mathml <ms> element represents a string literal meant to be interpreted by programming languages and computer algebra systems. by default, string literals are displayed as enclosed by double quotes (&quot;); by using the lquote and rquote attributes, you can set custom characters to display. note that quotation marks should not be specified unless they are part of the string literal. the content of an <ms> element is not an ascii string per se, but rather a sequence of characters and <mglyph> and <malignmark> elements. 28 <mspace> mathml, mathml reference, m...
points - SVG: Scalable Vector Graphics
Web › SVG › Attribute › points
ystem. if the attribute contains an odd number of coordinates, the last one will be ignored. two elements are using this attribute: <polyline>, and <polygon> html,body,svg { height:100% } <svg viewbox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> <!-- polygon is a closed shape --> <polygon stroke="black" fill="none" transform="translate(100,0)" points="50,0 21,90 98,35 2,35 79,90"/> <!-- it is usualy considered best practices to separate a x and y coordinate with a comma and a group of coordinates by a space. it makes things more readable for human beings. --> </svg> polyline for <polyline>, points defines a list of points, each representing...
...g viewbox="-10 -10 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> </svg> polygon for <polygon>, points defines a list of points, each representing a vertex of the shape to be drawn. each point is define by a x and y coordinate in the user coordinate system. ...
...n. each point is define by a x and y coordinate in the user coordinate system. note: a polygon is a closed shape, meaning the last point is connected to the first point. value [ <number>+ ]# default value none animatable yes example html,body,svg { height:100% } <svg viewbox="-10 -10 120 120" xmlns="http://www.w3.org/2000/svg"> <!-- polygon is an closed shape --> <polygon stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90" /> </svg> specifications specification status comment scalable vector graphics (svg) 2the definition of 'points' in that specification. candidate recommendation definition for <polygon> scalable vector graphics (svg) 2the definition of 'points' in that specificat...
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
generic element to define a shape. all the basic shapes can be created with a path element. 358 <pattern> element, svg, svg container the <pattern> element defines a graphics object which can be redrawn at repeated x- and y-coordinate intervals ("tiled") to cover an area. 359 <polygon> element, reference, svg, svg graphics the <polygon> element defines a closed shape consisting of a set of connected straight line segments. the last point is connected to the first point. 360 <polyline> element, reference, svg, svg graphics the <polyline> svg element is an svg basic shape that creates straight lines connecting several points. typically a polyline is used to create open shapes as the last point doesn't have to be connected to the firs...
...sting of a set of connected straight line segments. the last point is connected to the first point. 360 <polyline> element, reference, svg, svg graphics the <polyline> svg element is an svg basic shape that creates straight lines connecting several points. typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. for closed shapes see the <polygon> element. 361 <radialgradient> element, svg, svg gradient the <radialgradient> element lets authors define radial gradients that can be applied to fill or stroke of graphical elements. 362 <rect> element, reference, svg, svg graphics the <rect> element is a basic svg shape that draws rectangles, defined by their position, width, a...
...> element. 371 <text> element, reference, svg, svg text content the svg <text> element draws a graphics element consisting of text. it's possible to apply a gradient, pattern, clipping path, mask, or filter to <text>, like any other svg graphics element. 372 <textpath> element, reference, svg, svg text content to render text along the shape of a <path>, enclose the text in a <textpath> element that has an href attribute with a reference to the <path> element. 373 <title> — the svg accessible name element element, reference, svg, svg descriptive the <title> element provides an accessible, short-text description of any svg container element or graphics element. 374 <tref> element, reference, svg, svg text content ...
Using shadow DOM - Web Components
ontains a series of buttons and other controls inside its shadow dom. the shadow dom spec has made it so that you are allowed to actually manipulate the shadow dom of your own custom elements. basic usage you can attach a shadow root to any element using the element.attachshadow() method. ...
...t you are allowed to actually manipulate the shadow dom of your own custom elements. basic usage you can attach a shadow root to any element using the element.attachshadow() method. this takes as its parameter an options object that contains one option — mode — with a value of open or closed: let shadow = elementref.attachshadow({mode: 'open'}); let shadow = elementref.attachshadow({mode: 'closed'}); open means that you can access the shadow dom using javascript written in the main page context, for example using the element.shadowroot property: let myshadowdom = mycustomelem.shadowroot; if you attach a shadow root to a custom element with mode: closed set, you won't be able to access the shadow dom from the outside — mycustomelem.shadowroot returns null. this is the case with built...
...nt.shadowroot property: let myshadowdom = mycustomelem.shadowroot; if you attach a shadow root to a custom element with mode: closed set, you won't be able to access the shadow dom from the outside — mycustomelem.shadowroot returns null. this is the case with built in elements that contain shadow doms, such as <video>. note: as this blog post shows, it is actually fairly easy to work around closed shadow doms, and the hassle to completely hide them is often more than it's worth. if you are attaching a shadow dom to a custom element as part of its constructor (by far the most useful application of the shadow dom), you would use something like this: let shadow = this.attachshadow({mode: 'open'}); when you've attached a shadow dom to an element, manipulating it is a matter of just using ...
private-browsing - Archive of obsolete content
to do this with the sdk, you can listen to the system event named "last-pb-context-exited": var events = require("sdk/system/events"); function listener(event) { console.log("last private window cl...
...tent }); tracking private-browsing exit sometimes it can be useful to cache some data from private windows while they are open, as long as you don't store it after the private browsing windows have been closed. for example, the "downloads" window might want to display all downloads while there are still some private windows open, then clean out all the private data when all private windows have closed. to do this with the sdk, you can listen to the system event named "last-pb-context-exited": var events = require("sdk/system/events"); function listener(event) { console.log("last private window closed"); } events.on("last-pb-context-exited", listener); globals functions isprivate(object) function to check whether the given object is private. it takes an object as an argument, and ret...
content/worker - Archive of obsolete content
function functions that will registered as a listener to an 'error' events. worker worker is composed from the eventemitter trait, therefore instances of worker and their descendants expose all the public properties exposed by eventemitter along with additional public properties that are listed below. methods postmessage(data) asynchronously emits "message" events in the enclosed worker, where content script was loaded. parameters data : number,string,json the data to send. must be stringifiable to json. destroy() destroy the worker by removing the content script from the page and removing all registered listeners. a detach event is fired just before removal. properties port object that allows you to: send customized messages to the worker using the port.emit ...
...d is called. ...
Bootstrapped extensions - Archive of obsolete content
e of addon_install, addon_upgrade, or addon_downgrade. uninstall this function is called after the last call to shutdown() before a particular version of an extension is uninstalled. note: if you open the add-on manager and then click "remove" on an add-on, it will not call uninstall function right away. this is a soft uninstall because of the available "undo" option. if the add-on manager is closed or another event takes place such that the "undo" option becomes unavailable, then the hard uninstall takes place and the uninstall function is called. note: the uninstall function fires on downgrade and upgrade as well so you should make sure it is an uninstall by doing this: function uninstall(adata, areason) { if (areason == addon_uninstall) { console.log('really uninstalling'...
...nside this folder must be a property file. inside the chrome.manifest file these locale must be defined. for example if you had a subfolder of en-us in locale folder your chrome.manifest file will have to contain: locale name_of_your_addon en-us locale/ here is an example: github :: l10n-properties - on startup of this add-on it will show a prompt saying usa or great britain, which ever it deems closest to your locale. you can test different locale by going to about:config and changing preference of general.useragent.locale to en-us and then to en-gb and disabling then re-enabling the add-on. xul and html files - using entities from dtd files many times html pages are used, however they cannot be localized with dtd files. there are three changes you must make: you have to change the html ...
Sidebar - Archive of obsolete content
ar. see the creating a firefox sidebar tutorial for step-by-step instructions on creating a firefox sidebar extension. opening and closing the sidebar firefox provides a built-in sidebarui object function defined in browser-sidebar.js. this means that the function is available in all browser windows. you can use this function to show, hide, or toggle sidebars. // toggle the bookmarks sidebar (close it if it's open or // open it if it's currently closed) sidebarui.toggle("viewbookmarkssidebar"); // show the history sidebar, whether it's hidden or already showing sidebarui.show("viewhistorysidebar"); // hide the sidebar, if one is showing sidebarui.hide(); avoid opening the sidebar on startup. users have been known to complain about this "feature", and if two or more extensions try to op...
...n also disable the ability to resize it manually, using the mouse, by hiding the sidebar's splitter element. for this snippet to work, you have to declare mainwindow as in the previous code block then write: mainwindow.document.getelementbyid("sidebar-splitter").hidden = true; be aware that if you change the splitter's hidden attribute, you need to reset it to a safe value when your sidebar is closed, or replaced by another sidebar. for example, use this in your sidebar's unload event handler: mainwindow.document.getelementbyid("sidebar-splitter").hidden = mainwindow.document.getelementbyid("sidebar-box").hidden; see also bootstrap demo addon that creates a sidebar with html content: https://gist.github.com/noitidart/8728393 ...
How to convert an overlay extension to restartless - Archive of obsolete content
also make sure to only unload your own jsm files to avoid accidentally breaking things horribly. for tearing down and cleaning up on a per-window basis, there is another route you can take...
...your custom "myaddonname-unload" event and just tear down and clean up when that event or a regular "unload" event comes in. step 10: bypass cache when loading properties files the above will get you a working add-on that will install without a firefox restart. it will even get you a working add-on that will update without a firefox restart... usually. some parts work only if you don't look too closely; localization is one of them. as mentioned in the previous section, you'll need to clear the chrome caches on add-on shutdown, namely for chrome images and properties files. doing this will get an update's new properties file to load, however sometimes this will instead produce an error on the next property access. it just doesn't seem that it can reliably clear the cache correctly, for whateve...
Adding sidebars - Archive of obsolete content
relatively large and flexible space to add rich interfaces without requiring new windows or complicated overlays. sidebars take as much space as the user wants them to, and provide a frame where you can add elaborate data and controls. you're probably familiar with the bookmarks and history sidebars. if not, you can open either one from the view > sidebar menu. they also have shortcuts to open or close them using the keyboard. the code required to add a sidebar is very simple, as explained in creating a firefox sidebar. it's even simpler than that. all you need is to overlay the view sidebar menu. <menupopup id="viewsidebarmenu"> <menuitem id="xulschoolhello-sidebar" label="&xulschoolhello.sidebar.title;" accesskey="&xulschoolhello.sidebar.accesskey;" type="checkbox" autocheck...
... be very valuable for advanced users, but don't rely on them. the xul page for the sidebar can hold any content you want and it's no different from other xul windows or overlays. one minor difference is that the xul sidebar should be defined using the « xul reference « root element instead of window or dialog. the load event is fired every time the sidebar is opened, and unload every time it's closed, so you can use those for initialization and clean up . another, more important difference to take into account is that users can resize the sidebar to their liking, and in most cases, the sidebar is going to be fairly narrow. you should design the content of your sidebar carefully, so that it is usable and appealing regardless of width. there are ways to limit the size boundaries of your sideb...
Handling Preferences - Archive of obsolete content
eferenceswindow.xul</em:optionsurl> if you want to open this window from a different place in the ui, such as a menu item or a button in a toolbar, you need to take into account that the opening behavior of a preferences window is different depending on the operating system. ...
...lready open. in that case, just give it focus. make the window modal in systems where the instant apply rule is not used. notice that this is a preference that users can switch, so checking for the operating system is not good enough. the general philosophy in non-windows systems is that a change in a preference applies immediately. preference windows don't have any buttons, or just an ok or close button. on windows, changing preferences don't apply until the user click on the ok button. the user can click on the cancel button and none of the changes performed in the window will apply. this is why it makes sense to have preference windows be modal on windows. this way the user is urged to apply or discard any changes instead of being able to ignore the preferences window. for preference...
Setting up an extension development environment - Archive of obsolete content
not have to install these unstable versions, if you do not wish. make a symbolic link (also referred to as a shortcut) to the firefox binary (firefox.exe on windows), then move the link to your desktop, or your preferred location. to run this version of firefox, simply double click on this file. explore this profile a little: change some settings, install any additional extensions, and finally close this instance of firefox. now run your firefox profile manager. (linux, mac os x, windows instructions.) you'll see the list of available user profiles one which is default (stable) and other (unstable) profile(s) created automatically when you run other versions of firefox earlier. choose default and uncheck "don't ask at startup" checkbox. click "start firefox". now when you start any version...
...s the application at startup sometimes, which may mean you won't have time to see the messages logged before the automatic restart happens. to see them, prevent the automatic restart by setting the environment no_em_restart to 1 before starting the application.) nglayout.debug.disable_xul_fastload = true. for gecko 2.0+ (firefox 4.0+). see this bug for more information. although the bug has been closed, it is believed that this pref is still relevant. you might also want to set dom.report_all_js_exceptions = true. see exception logging in javascript for details. devtools.errorconsole.deprecation_warnings = true. detect deprecated code use. warning: never set nglayout.debug.disable_xul_fastload to true in a production environment; it exists solely to aid in debugging. in particular, add-on...
Case Sensitivity in class and id Names - Archive of obsolete content
ese are technically two distinct class names, browsers other than netscape 6 will treat them as though they are the same thing. therefore, authors should not rely on case-sensitivity as a way of creating distinct identifiers, unless they are designing solely for a truly standards-compliant browser such as netscape 6. why so case-sensitive? netscape 6's unusual sensitivity to case is based on a close reading of the html 4.01 specification. in section 7.5.2, which defines class and ids, we find the following text: id = name [cs] this attribute assigns a name to an element. this name must be unique in a document. class = cdata-list [cs] this attribute assigns a class name or set of class names to an element. any number of elements may be assigned the same class name or names. multiple class n...
... document. class = cdata-list [cs] this attribute assigns a class name or set of class names to an element. any number of elements may be assigned the same class name or names. multiple class names must be separated by white space characters. the marker "[cs]" means "case sensitive," as defined in section 6.1 of the specification. thus, the mozilla team, committed to following open standards as closely as possible, implemented both class and id names as case-sensitive values. as of this writing, netscape 6 is the only browser to honor this defined behavior; other browsers treat both class and id names as case-insensitive. id uniqueness there is a further restriction, however, on the use of id names. section 12.2.1 makes it illegal for the name and id attributes to use values which are a ca...
JXON - Archive of obsolete content
escription": "cardigan sweater" }, "script": { "keyvalue": "function matchwo(a,b) {\n if (a < b && a < 0) { return 1; }\n else { return 0; }\n}", "@type": "text/javascript" } } } this is a possible technique to use if you partially know the structure of the xml document. algorithm #3: a synthetic technique here is another method of conversion. this algorithm is the closest to the parker convention. it is very similar to the previous one, except that nodes which do not contain other recognizable nodes than text or cdatasection are not treated as objects, but directly as booleans, strings, numbers or date objects (see the parker convention). empty nodes (i.e. which do not contain other element nodes, text nodes, cdatasection nodes or attr nodes) have the default va...
...ck" } } }] }, "script": { "@type": "text/javascript", "keyvalue": "function matchwo(a,b) {\n if (a < b && a < 0) { return 1; }\n else { return 0; }\n}" } } } this is a recommended technique if you know the structure of the xml document. algorithm #4: a very minimalist way the following is another possible way to do the conversion. it is very close to the parker convention, too. with this algorithm, all element nodes that contain other child element, text, or cdatasection nodes in the same level are treated as instances of boolean, number, string, or date constructors. so any child element node, if exists, will be nested in these types of objects. for example: <employee type="usher">john smith</employee> <manager>lisa carlucci</manager> ...
Autodial for Windows NT - Archive of obsolete content
itself as a dialer, but it doesn't behave like other dialers. the problem is with the aol client, be the bug could probably be fixed by not changing mozilla to avoid using the aol client as a dialer even though it installs itself as one. a parallel feature has been requested in bug 130774: if we trigger the autodial connection, we should ask the user if he wants to hang up the connection when we close mozilla. there also has been some confusion about what online/offline means. in mozilla, it means try to access the network or not. to some users, it means connected to a network or not. some people expect an option to toggle online/offline should trigger dialup or disconnect. this is a misunderstanding of this mode. hanging up a dialup connection should not cause mozilla to go into offline mode.
...offline should trigger dialup or disconnect. this is a misunderstanding of this mode. hanging up a dialup connection should not cause mozilla to go into offline mode. making a dialup connection should not cause mozilla to go into online mode. a pref to disable users can bypass the feature altogether by setting the pref network.autodial-helper.enabled to false. since the feature was implemented close to the release of netscape 7, the pref was added so that we could include the feature in the 7.0 release with the feature turned off and enable it in specific cases. the feature was turned on in mozilla 1.1 to get more exposure. mozilla 1.1 also includes a fix to bug 157733, which allows our interaction with the autodial service to work a little more reliably. i don't see a need to expose this pr...
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
/span> </div> javascript: var mydiv = document.getelementbyid("foo"); var mychildren = mydiv.childnodes; for (var i = 0; i < mychildren.length; i++) { if (mychildren[i].nodetype == 1){ // element node }; }; generate and manipulate content mozilla supports the legacy methods for adding content into the dom dynamically, such as document.write, document.open and document.close. mozilla also supports internet explorer's innerhtml method, which it can call on almost any node. it does not, however, support outerhtml (which adds markup around an element, and has no standard equivalent) and innertext (which sets the text value of the node, and which you can achieve in mozilla by using textcontent). internet explorer has several content manipulation methods that are nonstan...
...ecification correctly and will change the color to green in this example. you can use two ways to make mozilla behave like internet explorer and not change the color of the text when hovered over: first, you can change the css rule to be a:link:hover {color: green;}, which will only change the color if the element is a link (has an href attribute). alternatively, you can change the markup and close the opened <a /> before the start of the text -- the anchor will continue to work this way. quirks versus standards mode older legacy browsers, such as internet explorer 4, rendered with so-called quirks under certain conditions. while mozilla aims to be a standards-compliant browser, it has three modes that support older web pages created with these quirky behaviors. the page's content and de...
Writing textual data - Archive of obsolete content
ncoding name that mozilla supports var os = components.classes["@mozilla.org/intl/converter-output-stream;1"] .createinstance(components.interfaces.nsiconverteroutputstream); // this assumes that fos is the nsioutputstream you want to write to os.init(fos, charset, 0, 0x0000); os.writestring("umlaute: \u00fc \u00e4\n"); os.writestring("hebrew: \u05d0 \u05d1\n"); // etc. os.close(); you can also write character arrays using the write function, although using writestring is simpler from javascript code. the example above passes 0 as the third argument, which disables buffering (note: the implementation of the converter stream might not support buffering). passing 0 ensures that data will be immediately written to the underlying stream; however, for better perfomance you...
...var chunk = converter.convertfromunicode(your_string); os.write(chunk, chunk.length); // repeat as needed for further strings at the end, you need to call finish and write its data to the stream. note that not many character encodings need it, but for those that do calling this is important for proper output. var fin = converter.finish(); if (fin.length > 0) os.write(fin, fin.length); os.close(); converting a string into a stream sometimes, it is useful to convert a string into a stream, for example for uploading it using nsiuploadchannel. the example here requires gecko 1.8 (firefox 1.5, seamonkey 1.0). nsiscriptableunicodeconverter has a simple method to do that: // first, get and initialize the converter var converter = components.classes["@mozilla.org/intl/scriptableunicodeco...
A XUL Bestiary - Archive of obsolete content
xul parts people sometimes get confused about the syntax for describing the parts of a widget. for a widget like the menu that appears in the following example, menu is the element and both value and the id are attributes. <menu id="file" label="file"> <menupopup> <menuitem label="new" oncommand="createnewdoc()" /> <menuitem label="open" oncommand="opendoc()" /> <menuitem label="close" oncommand="closedoc()" /> </menupopup> </menu> element names the item, the widget, while attributes describes features of that element, such as its name, its style, and so on. in object-oriented parlance, the element is analogous to the object itself while the attribute is like a property. the attribute has a value associated with it (such as the string "file" for the id attribute in the exa...
...bject performs some action. for example, a document fires, or raises, the "load" event when it is loaded into a browser. the "click" event is fired by a button when it is clicked. if you don't do anything about these events, then you probably never know about them. documents will load, buttons will be clicked, and links will be hovered over, and events will be raised for all these actions behind closed doors. if, however, you write event handlers inside event listeners, as we will describe shortly, you can use these events to set off other actions. this using of events to prompt other, more explicit actions is loosely what is meant by an event model. where, exactly, are these events fired? fired at whom? events that are fired by an object "bubble up" the hierarchical model that is the dom (or...
panel.ignorekeys - Archive of obsolete content
...
... ...
Writing to Files - Archive of obsolete content
yinfo.txt"); var stream = io.newoutputstream(file, "text"); } catch (ex) { alert(ex); } this example retrieves a file object on the desktop called 'myinfo.txt' using nsiscriptableio.getfile(). it doesn't matter whether the file exists or not. nsiscriptableio.newoutputstream() is called to create a new output stream, which will be used to write to the file. in this example, the operations are enclosed in a try-catch block in order to capture any errors that might occur during the process. see file errors for a list of errors that might occur. the newoutputstream method takes two arguments in this example. the first argument is the file to write to, and the second is a set of flags which control the writing. in this case, the 'text' flag is used which indicates that you will be writing text to...
.... other character encodings are available; see writing other character encodings below for details about writing text in other encodings. there are several methods available to write to a stream. for text files, you will usually use the writestring method. var file = io.getfile("desktop", "myinfo.txt"); var stream = io.newoutputstream(file, "text"); stream.writestring("this is some text"); stream.close(); in this example, a text input stream is created for the file 'myinfo.txt'. the writestring method is called to write a single string to the file, supplied as an argument to the method. finally, the stream is closed by calling the stream's close method. you should ensure that the file is closed, so that the data is properly written and that the file can be reopened for reading later. to write ...
Menus - Archive of obsolete content
ommands that are available. the user may select a command to invoke it, or may cancel the operation by pressing escape or clicking outside the menu. xul provides a number of tags for creating menus. these tags can be used to create menus which sit on a menubar or are attached to buttons. submenus may be created by nesting one menu inside of another. no special code needs to be written to open or close a menu or submenu, and, in addition, the menus are placed on screen in the appropriate locations automatically. there are four elements that a menupopup can be attached to. in each case, the menupopup element is placed as a direct child of the element. the following is a brief summary of these elements, examples of each will be provided later. menu the menu tag is used when placing menus on ...
...eparator. <menuseparator/> submenus sometimes, you will want an item on a menu to have additional commands tucked away on a second menu that is opened only when the item is selected. a submenu is created by nesting a menu element inside another menupopup. when the mouse is moved over the submenu label, or the cursor keys move the current item to the submenu, that menu's popup appears. it will close when the mouse is moved away or the current item is changed. <menubar id="sample-menubar"> <menu id="view-menu" label="view"> <menupopup> <menuitem label="toolbar"/> <menuitem label="status bar"/> <menuseparator/> <menu label="sort" accesskey="s"> <menupopup> <menuitem label="by name"/> <menuitem label="by date"/> </menupopup> ...
state - Archive of obsolete content
Archive › Mozilla › XUL › Property › state
open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. ...
... open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. ...
Building Hierarchical Trees - Archive of obsolete content
« previousnext » a template may be used to generate hierarchical trees. this works just like with recursive generation using the content builder. each level of the tree is created using a successive iteration of the template build process. if the items are containers, the tree builder will mark the right rows as containers, so that they can be opened and closed with the small icon twisties on the left of the column. remember to make the left column the primary column for these to appear. to be able to do this, the tree builder must know that an item is a container. with an rdf datasource, this would usually be an rdf container such as a seq and the tree would display its children. for an xml datasource, the tree might display a node's children as the children in the tree, maki...
...esults will be generated from a simple rule with no extra conditions. it is the result, or the photo, that will be checked, not the container of photos. since a photo isn't a container, the tree rows will not become containers, so you will not be able to open them. as the rows are not containers, the tree builder does not recurse to find additional data. the tree builder creates rows lazily, so a closed container will not have any data generated inside in it until the row is opened. when the user opens the tree row, the next level of rows are generated from the template and displayed in the tree. similarly, when the user closes a tree row, the rows inside it are removed, such that they will have to be generated again the next time the row is opened. if you want to put rows inside the photo rows...
textbox (Toolkit autocomplete) - Archive of obsolete content
s seamonkey 2.0 type: script code this event handler is called when the user presses escape to revert the textbox to its original uncompleted value. note: for firefox 12 and above, this event handler must be set as an initial attribute. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. showcommentcolumn new in thunderbird 3requires seamonkey 2.0 type: boolean if true, a comment column appears in the popup. for the url history, the comment column will contain the page titles associated with each url. if this attrib...
... popup new in thunderbird 14 requires seamonkey 2.11 type: popup element should be set to the popup element that should appear when the user clicks on the textbox. note: this property is readonly in thunderbird and seamonkey. popupopen new in thunderbird 15 requires seamonkey 2.12 type: boolean indicates whether the popup is open or not. set this property to open or close the popup. searchcount new in thunderbird 15 requires seamonkey 2.12 type: integer returns the number of search components used. this property is read only. searchparam new in thunderbird 15 requires seamonkey 2.12 type: string gets and sets the value of the autocompletesearchparam attribute. selectionend type: integer get or set the end of the selected portion of the field's...
Textbox (XPFE autocomplete) - Archive of obsolete content
seded by the ontextreverted attribute. ontextreverted new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when the user presses escape to revert the textbox to its original uncompleted value. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. searchsessions obsolete since gecko 26 type: space-separated list of session names set to a keyword indicating what type of data to look up for autocomplete. you may set multiple types by separating their names by spaces. the follow...
... popup new in thunderbird 14 requires seamonkey 2.11 type: popup element should be set to the popup element that should appear when the user clicks on the textbox. note: this property is readonly in thunderbird and seamonkey. popupopen new in thunderbird 15 requires seamonkey 2.12 type: boolean indicates whether the popup is open or not. set this property to open or close the popup. resultspopup type: popup element this property is set to the popup element that displays the results. searchcount new in thunderbird 15 requires seamonkey 2.12 type: integer returns the number of search components used. this property is read only. searchparam new in thunderbird 15 requires seamonkey 2.12 type: string gets and sets the value of the autocompletesearc...
Adding Event Handlers - Archive of obsolete content
t if an element is disabled, the click event will be sent regardless of whether the element is disabled or not. our find files example a command handler can be placed on the find and cancel buttons in the find files dialog. pressing the find button should start the search. because we aren't going to implement this part yet, we'll leave it out for now. however, pressing the cancel button should close the window. the code below shows how to do this. while we're at it, let's add the same code to the close menu item. <menuitem label="close" accesskey="c" oncommand="window.close();"/> ... <button id="cancel-button" label="cancel" oncommand="window.close();"/> two handlers have been added here. the oncommand attribute was added to the close menu item. by using this handler, the user will ...
...the oncommand handler was also added to the cancel button. dom event listeners the second way to add an event handler is to call an element's addeventlistener method. ...
Creating a Skin - Archive of obsolete content
window (which actually surrounds all of the window content) has been changed to have a medium blue color. you can see this blue behind the tab strip and along the bottom of the window. four elements, the menubar, the menupopup, the toolbar and the tabpanels appear in light blue. the border around these four elements has been changed to give a heavier 3d appearance. you can see this if you look closely. the background color of the caption has also been changed to match the background. the first rule above (for 'window > box') specifies that the child box of the window has a different color. this probably isn't the best way to do this. we should really change this to use a style class. let's do this. that way, we can modify the xul without needing to keep the box as the first child of the w...
...f creating your own skin, you will need to create new icons or copy the icons to new files. if following the example in this section, just copy the files to your new skin and change the urls accordingly. #find-button { list-style-image: url("chrome://global/skin/checkbox/images/cbox-check.jpg"); font-weight: bold; } #cancel-button { list-style-image: url("chrome://global/skin/icons/images/close-button.jpg"); } button:hover { color: #000066; } we add some images to the buttons and make the find button have bold text to indicate that it is the default button. the last rule applies to buttons when the mouse is hovering over them. we set the text color to dark blue in this case. finally, some minor changes to the spacing around the items, by setting margins: tabbox { margin: 4px; ...
XUL Questions and Answers - Archive of obsolete content
urn the value with the correct type. using the "icon" attribute on a button from xulplanet.com reference: this attribute should be used to set the usage for common buttons. some platforms display these buttons with a small icon indicating their usage. this should be used in place of the image attribute. possible values include: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. if you are using a button that matches one of these common usages, use the icon attribute to indicate this. how to use dynamic objects in toolbar there may be a few ways to implement this: by building your menupopup from an rdf datasource, which could be generated on the server. by getting ...
...s initiated when the application starts up and when the profile is changed. for more information please look at the following link: nsextensionmanager.js is nsivariant fully supported using python? python has full support for variants. pass a python string/int/etc to the method requiring an nsivariant. a python object is convered when implmenting an interface taking an nsivariant. ...
XUL element attributes - Archive of obsolete content
elements, resulting the children being placed in the center of the box. end child elements are placed on the right or bottom edge of the box. if the box is larger than the total size of the children, the extra space is placed on the left or top side. persist type: space-separated list of attribute names a space-separated list of attributes that are maintained when the window is closed. when the window is re-opened, the values of persistent attributes are restored. in mozilla, persistent attributes are stored in the per-profile file xulstore.json. persistence can also be stored using the document.persist function. in order for persistence to work, the element must also have an id. persistence will not remember the absence of an attribute, so for boolean attributes like checked...
...tent attributes are stored in the per-profile file xulstore.json. persistence can also be stored using the document.persist function. in order for persistence to work, the element must also have an id. persistence will not remember the absence of an attribute, so for boolean attributes like checked where absence means false, you will need to explicitly set the attribute to false before the window closes (bug 15232). popup type: id should be set to the value of the id of the popup element that should appear when the user clicks on the element. position type: string (representing an integer) when an element is in an overlay, the position is an index where the child is inserted. the position is one-based, so use a value of 1 to place the element at the beginning. this attribute...
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
vered over. typcially, the theme will use this to highlight the item. a dommenuitemactive event will be sent to the item when the item is hovered over, and a dommenuiteminactive event will be sent to the item when the selection moves away. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. sizetopopup type: one of the values below indicates how the menu width and the menupopup width are determined. if the sizetopopup attribute is left out or set to none, the menu will be its preferred width and the popup may extend outside of this width, unaffected by the maximum width of the menu itself. otherwise, the menu will size itself to at least the size of the popup. if the menu ...
...s no enclosing menu. itemcount type: integer read only property holding the number of child items. menupopup type: menupopup element a reference to the menupopup used by the menu or menulist. this property is read-only. open type: boolean this property will be set to true when the menu is open. the menu may be opened by setting the open property to true and closed by setting it to false. parentcontainer type: menu element read only property that returns the containing menu element, or null if there isn't a containing menu. selected type: boolean this property's value is true if this element is selected, or false if it is not. this property is read only. this property is available for menuitem and menuseparator elements in fir...
menuitem - Archive of obsolete content
« xul reference home [ examples | attributes | properties | methods | related ] a single choice in a menupopup element. it acts much like a button but it is rendered on a menu. more information is available in the xul tutorial. ...
...cts the item, and set it to false instead of removing the attribute (i.e. do menuitem.setattribute("checked", "false") instead of menuitem.removeattribute("checked")) when the user unchecks the menuitem, as a value of false will both correctly hide the checkmark and persist its hidden state. command type: id set to the id of a command element that is being observed by the element. closemenu type: one of the values below indicates if the menu closes when the menuitem is activated. auto this, the default value if the closemenu attribute is not specified, closes up the menu and all parent menus. single the menu the item is contained within is closed, but the parent menus remain open. none no menus are closed. crop type: one of the values belo...
menupopup - Archive of obsolete content
nsipopupboxobject that implements the popup. you wouldn't normally need to use this property as all of its functions are available via the popup itself. position type: string gets and sets the value of the position attribute. state type: string this read only property indicates whether the popup is open or not. four values are possible: closed: the popup is closed and not visible. open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. this state will occur during the popupshowing event. hiding: the popup is about to be hidden. this state will occur during the popuphiding event. triggernode type: nsidomnode this read-only property h...
... moveto( x, y ) return type: no return value moves the popup to a new location defined by screen coordinates (and not client coordinates). if both x and y have the value -1 the call will realign the popup with its anchor node. openpopup( anchor , position , x , y , iscontextmenu, attributesoverride, triggerevent ) return type:...
notificationbox - Archive of obsolete content
ation element the currently displayed notification element or null. this property is read-only. allnotifications type: nodelist nodelist of all notifications. this property is read-only. notificationshidden type: boolean indicating whether the notification area should be hidden. events alertactive type: event fired when a notification element is shown. alertclose type: event fired when a notification element is closed. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), getclientrects(), getelementsbyattribute, getelementsbyattributens, getelementsbyclas...
...the accesskey to appear on the button callback - function to be called when the button is activated. this function is passed three arguments: the <notification> the button is associated with the button description as passed to appendnotification. the element which was the target of the button press event. if the return value from this function is not true, then the notification is closed. the notification is also not closed if an error is thrown. label - the label to appear on the button popup - the id of a popup for the button. if null, the button is not a button popup (e.g. a menu). the type property must also be set to "menu", or "menu-button". isdefault - if true, this is the default button. there can be only one default button. if no button has this set, the first b...
titlebar - Archive of obsolete content
lly don't receive any mouse events, so e.g. buttons inside it can't be clicked and textboxes can't be focused with the mouse. if you don't want this behavior, you can override it by setting allowevents="true" on the titlebar element. the titlebar will send a command event after the move is complete. examples this xul file will create a hud-style window that can be moved with the mouse. ...
...amples this xul file will create a hud-style window that can be moved with the mouse. it will close if the mouse button is released. ...
toolbarbutton - Archive of obsolete content
ty upon user selection of the menuitem. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. orient type: one of the values below used to specify whether the children of the element are oriented horizontally or vertically. the default value depends on the element. you can also use the -moz-box-orient style property. horizontal child elements of the element are placed next to each other in a row in the order that they appear in the xul source. vertical child elements o...
...ibute is not present, a normal button is created. you can set this attribute to the value menu to create a button with a menu popup. this will typically cause the button to be displayed differently. menu: set the type attribute to the value menu to create a button with a menu popup. place a menupopup element inside the button in this case. the user may click anywhere on the button to open and close the menu. menu-button: you can also use the value menu-button to create a button with a menu. unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. checkbox: use this type to create a toggle button which will switch the checked state each time the button is pressed. radio: use t...
tooltip - Archive of obsolete content
he nsipopupboxobject that implements the popup. you wouldn't normally need to use this property as all of its functions are available via the popup itself. position type: string gets and sets the value of the position attribute. state type: string this read only property indicates whether the popup is open or not. four values are possible: closed: the popup is closed and not visible. open: the popup is open and visible on screen. showing: a request has been made to open the popup, but it has not yet been shown. this state will occur during the popupshowing event. hiding: the popup is about to be hidden. this state will occur during the popuphiding event. methods inherited methods addeventlistener(), appendc...
... moveto( x, y ) return type: no return value moves the popup to a new location defined by screen coordinates (and not client coordinates). if both x and y have the value -1 the call will realign the popup with its anchor node. openpopup( anchor , position , x , y , iscontextmenu, attributesoverride, triggerevent ) return type: n...
Mozilla release FAQ - Archive of obsolete content
division of aol), red hat, some other companies, as well as contributors from the community. on what is mozilla based? the mozilla project started near the end of life of the 4.x line of netscape communicator. originally, the plan was just to re-stabilize the code and release 5.0, but it was decided within the community that the more ambitious changes that were planned for later integration were close to being ready. the old layout engine, networking engine, and several of the older modules were gutted, and much later, the sources reached the point where netscape was comfortable making a release, and so netscape 6.0 was released. netscape 6.0 and above are based off of the mozilla source. mozilla 1.0 (mozilla uses a different versioning system than netscape) is due for release soon. when was m...
...8.0 or 2.7.2+ (2.8.0 has some problems, 2.7.2 would be best, at least until the problems with 2.8.1 are ironed out) where can i get the sources to netscape 4.x or lower? these sources are not available. much of the old code cannot be released due to legal concerns, and at the time of mozilla's initial release, that code was removed from the tree. the 'classic' branch of the current cvs tree is as close to the 4.x source as the public will ever see, although that branch has been abandoned in the move to the modern codebase. how do i tweak the interface (replace the logo, etc)? the xptoolkit docs might help in writing the needed xul. you can find replacement themes in preferences, under appearance->themes, using the 'get new themes' link there. where can i get patches? there is not currently a ce...
2006-10-27 - Archive of obsolete content
n answer to cédric corazza posting. cédric's posting was about a french site which had already announced the availablity of ff 2.0 final release and provided download links, even though the release was on october 24. the owner of the site probably browsed on the releases/2.0 dir on the ftp and got the releases, which is kind of unpolite. ...
...paul suggested that the best way to deal with this would be to ask people to wait, and let them know that they're degrading their user experience. ...
NPN_DestroyStream - Archive of obsolete content
syntax #include <npapi.h> nperror npn_destroystream(npp instance, npstream* stream, nperror reason); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream, initiated by either the browser or the plug-in. reason reason the stream was stopped so the application can give the user appropriate feedback. values: npres_done (most common): stream completed normally; all data was sent by the plug-in to the browser. ...
...er. npres_user_break: plug-in is terminating the stream due to a user request. npres_network_err: stream failed due to network problems. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description the plug-in calls the npn_destroystream() function to close and delete a stream. this stream can be either a stream that the browser created and passed to the plug-in in npp_newstream(), or a stream created by the plug-in through a call to npn_newstream(). see also npp_destroystream() npn_newstream() npp_newstream() npstream npp ...
NPAPI plugin reference - Archive of obsolete content
r method and property identifiers, such as strings or integers. npidentifiers are unique, in that for any given string or integer, there is only one npidentifier. the lifetime of npidentifiers is controlled by the browser. npn newstream requests the creation of a new data stream produced by the plug-in and consumed by the browser. npn_createobject allocates a new npobject. npn_destroystream closes and deletes a stream. npn_enumerate gets the names of the properties and methods of the specified npobject. npn_evaluate evaluates a script in the scope of the specified npobject. npn_forceredraw asks the plugin host to immediately (synchronously) repaint invalid areas. npn_getauthenticationinfo the function is called by plugins to get http authentication information from the browser. n...
...pclass and an integer reference count, and possibly also implementation specific (i.e. plugin specific, or browser specific) members. npp represents a single instance of a plug-in. you specify one of these to any npapi function that needs to know which plug-in to work with. npp_destroy deletes a specific instance of a plug-in. npp_destroystream tells the plug-in that a stream is about to be closed or destroyed. npp_getvalue allows the browser to query the plug-in for information. npp_handleevent delivers a platform-specific window event to the instance. npp_new creates a new instance of a plug-in. npp_newstream notifies a plug-in instance of a new data stream. npp_print requests a platform-specific print operation for an embedded or full-screen plug-in. npp_setvalue implemente...
Common Firefox theme issues and solutions - Archive of obsolete content
te" copy and paste review notes for common theme issues. this document was started on july 27, 2012 so it will take some time to completely fill in and some issues still need to have solutions written for them. operating system specific issues windows 7 windows 7 aero missing right-hand title bar buttons when tabs are on top and the menu bar is disabled, firefox is missing the min/max/restore/close button on the right side of the title bar. please see the following threads on mozillazine for solutions to this issue: http://forums.mozillazine.org/viewtopic.php?f=18&t=2131121 http://forums.mozillazine.org/viewtopic.php?f=18&t=1953371&start=60 windows 7 aero not going into full screen mode properly on win7 with aero glass support firefox doesn't always go to full screen mode from a normal ...
...tfavicon.png"); } web developer tools web developer toolbar {to be added} web console web console buttons do not change appearance on the web console (tools > web developer > web console), the toolbar buttons on the left-hand side do not change their appearance between their toggled on and toggled off status as a result it is not possible to determine which buttons are enabled. web console close button is missing the web console (tools > web developer > web console) is missing its close button, which makes it impossible to close. web console close button sprite mapping is messed up on the web console (tools > web developer > web console) the sprite mapping for the close button is messed up. style inspector style inspector is missing button icons on toolbar the style inspector is mi...
Browser Feature Detection - Archive of obsolete content
document.body true true true document.images true true true document.applets true true true document.links true true true document.forms true true true document.anchors true true true document.cookie true true true document.open() true true true document.close() true true true document.write() true true true document.writeln() true true true document.getelementbyid() true true true document.getelementsbyname() true true true dom css 1 support for properties/methods in document.body.style name firefox 1.5 ie 6 & 7 opera 8.54 - 9.01 backgr...
...name: 'domain', 'supported': false}, {name: 'url', 'supported': false}, {name: 'body', 'supported': false}, {name: 'images', 'supported': false}, {name: 'applets', 'supported': false}, {name: 'links', 'supported': false}, {name: 'forms', 'supported': false}, {name: 'anchors', 'supported': false}, {name: 'cookie', 'supported': false}, {name: 'open', 'supported': false}, {name: 'close', 'supported': false}, {name: 'write', 'supported': false}, {name: 'writeln', 'supported': false}, {name: 'getelementbyid', 'supported': false}, {name: 'getelementsbyname', 'supported': false} ], 'domcore2': [ {name: 'doctype', 'supported': false}, {name: 'implementation', 'supported': false}, {name: 'documentelement', 'supported': false}, {name: 'createelement', 'supported': f...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
nown as pilot. pilot had a highly-integrated debugging tool called co-pilot that allowed the xerox development organization to quickly and easily debug issues. however, what xerox neglected to understand was that regardless of how powerful pilot and co-pilot was, the star workstation could not evolve with the times because it was proprietary. xerox was bound to a unique hardware platform and to a closed development operating system. and xerox chose to bypass multiple opportunities to port the code to other platforms, and to provide open-source code. consequently, xerox eventually had to shut down the production of their workstation development because of escalating manufacturing and developing costs and slowed sales. xerox’s biggest asset in the beginning became its weapon of destruction. th...
... consistent and predictable and has subsequently become the de-facto standard. the reason it is consistent and predictable is because microsoft has established a corporate set of usability standards and supports the relevant international standards. accessibility no organization can afford to overlook or ignore accessibility standards. within the web environment, the accessibility standards are closely tied to html, xml, xhtml, and other w3c standards. by integrating and supporting the accessibility guidelines, an organization can offer their product lines or services to a larger and more diverse user base. interchangeability if a user experiences consistent behavior across a range of products, they can predict how a particular action or function will work or respond. as a product provider,...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
electors that combine a bare class selector with the :hover pseudo-class (see bug 169078 for details). named anchor problems in addition to the effects described previously, there are two other relatively common effects that authors may not expect. one is easily fixed by validation, but the other is a little more subtle. ...
...med anchor problems in addition to the effects described previously, there are two other relatively common effects that authors may not expect. one is easily fixed by validation, but the other is a little more subtle. first, there is the problem of authors who open a named anchor but do not close it. for example: <a name="pagetop"> <h2>my page</h2> without a </a>, this name will effectively enclose the rest of the document. this generally means that the rest of the document will take hover styles. consider the effects of the following rule: a:hover {color: red;} in a document with an unclosed named anchor, any text that follows the anchor's open tag will be colored red (unless another css rule intervenes). this brings up the second common problem, which is that named anchors can accept h...
Bounding volume collision detection with THREE.js - Game development
his test. knotbsphere.intersectssphere(othersphere); sphere vs. box3 unfortunately this test is not implemented in three.js, but we can patch sphere to implement a sphere vs. aabb intersection algorithm. ...
... implemented in three.js, but we can patch sphere to implement a sphere vs. aabb intersection algorithm. // expand three.js sphere to support collision tests vs box3 // we are creating a vector outside the method scope to // avoid spawning a new instance of vector3 on every check three.sphere.__closest = new three.vector3(); three.sphere.prototype.intersectsbox = function (box) { // get box closest point to sphere center by clamping three.sphere.__closest.set(this.center.x, this.center.y, this.center.z); three.sphere.__closest.clamp(box.min, box.max); var distance = this.center.distancetosquared(three.sphere.__closest); return distance < (this.radius * this.radius); }; demos we have prepared some live demos to demonstrate these techniques, with source code to examine. ...
3D collision detection - Game development
dius + other.radius); } sphere vs. aabb testing whether a sphere and an aabb are colliding is slightly more complicated, but still simple and fast. a logical approach would be to check every vertex of the aabb, doing a point vs sphere test for each one. ...
...all the vertices is unnecessary, as we can get away with just calculating the distance between the aabb's closest point (not necessarily a vertex) and the sphere's center, seeing if it is less than or equal to the sphere's radius. we can get this value by clamping the sphere's center to the aabb's limits. ...
Build the brick field - Game development
and draw them on the screen. our code might look like this: function drawbricks() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { bricks[c][r].x = 0; bricks[c][r].y = 0; ctx.beginpath(); ctx.rect(0, 0, brickwidth, brickheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } } } again, we're looping through the rows and columns to set the x and y position of each brick, and we're also painting a brick on the canvas — size brickwidth x brickheight — with each loop iteration. the problem is that we're painting them all in one place, at coordinates (0,0). what we need to do is include some calculations that will work out the x and y position of...
...add the following just above the drawball() call: drawbricks(); compare your code at this point, the game has got a little more interesting again : ...
HTML: A good basis for accessibility - Learn web development
ludes an alternate description. webaim: links and hypertext - hypertext links mdn understanding wcag, guideline 3.2 explanations g200: opening new windows and tabs from a link only when necessary | w3c techniques for wcag 2.0 g201: giving users advanced warning when opening a new window | w3c techniques for wcag 2.0 skip links a skip link, also known as skipnav, is an a element placed as close as possible to the opening <body> element that links to the beginning of the page's main content. this link allows people to bypass content repeated throughout multiple pages on a website, such as a website's header and primary navigation. skip links are especially useful for people who navigate with the aid of assistive technology such as switch control, voice command, or mouth sticks/head wand...
...and, or mouth sticks/head wands, where the act of moving through repetitive links can be a laborious task. webaim: "skip navigation" links how–to: use skip navigation links - the a11y project mdn understanding wcag, guideline 2.4 explanations understanding success criterion 2.4.1 | w3c understanding wcag 2.0 proximity large amounts of interactive content—including anchors—placed in close visual proximity to each other should have space inserted to separate them. this spacing is beneficial for people who suffer from fine motor control issues and may accidentally activate the wrong interactive content while navigating. spacing may be created using css properties such as margin. hand tremors and the giant-button-problem - axess lab test your skills! you've reached the end of ...
HTML: A good basis for accessibility - Learn web development
ludes an alternate description. webaim: links and hypertext - hypertext links mdn understanding wcag, guideline 3.2 explanations g200: opening new windows and tabs from a link only when necessary | w3c techniques for wcag 2.0 g201: giving users advanced warning when opening a new window | w3c techniques for wcag 2.0 skip links a skip link, also known as skipnav, is an a element placed as close as possible to the opening <body> element that links to the beginning of the page's main content. this link allows people to bypass content repeated throughout multiple pages on a website, such as a website's header and primary navigation. skip links are especially useful for people who navigate with the aid of assistive technology such as switch control, voice command, or mouth sticks/head wand...
...and, or mouth sticks/head wands, where the act of moving through repetitive links can be a laborious task. webaim: "skip navigation" links how–to: use skip navigation links - the a11y project mdn understanding wcag, guideline 2.4 explanations understanding success criterion 2.4.1 | w3c understanding wcag 2.0 proximity large amounts of interactive content—including anchors—placed in close visual proximity to each other should have space inserted to separate them. this spacing is beneficial for people who suffer from fine motor control issues and may accidentally activate the wrong interactive content while navigating. spacing may be created using css properties such as margin. hand tremors and the giant-button-problem - axess lab test your skills! you've reached the end of ...
HTML basics - Learn web development
e, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables. as the title suggests, this article will give you a basic understanding of html and its functions. so what is html? html is not a programming language; it is a markup language that defines the structure of your content. html consists of a series of elements, which you use to enclose, or wrap, different parts of the content to make it appear a certain way, or act a certain way. the enclosing tags can make a word or image hyperlink to somewhere else, can italicize words, can make the font bigger or smaller, and so on. for example, take the following line of content: my cat is very grumpy if we wanted the line to stand by itself, we could specify that it is a paragraph by en...
...lled nesting. if we wanted to state that our cat is very grumpy, we could wrap the word "very" in a <strong> element, which means that the word is to be strongly emphasized: <p>my cat is <strong>very</strong> grumpy.</p> you do however need to make sure that your elements are properly nested. in the example above, we opened the <p> element first, then the <strong> element; therefore, we have to close the <strong> element first, then the <p> element. the following is incorrect: <p>my cat is <strong>very grumpy.</p></strong> the elements have to open and close correctly so that they are clearly inside or outside one another. if they overlap as shown above, then your web browser will try to make the best guess at what you were trying to say, which can lead to unexpected results. so don't do it...
JavaScript basics - Learn web development
he value by calling the variable name: myvariable; after assigning a value to a variable, you can change it later in the code: let myvariable = 'bob'; myvariable = 'steve'; note that variables may hold values that have different data types: variable explanation example string this is a sequence of text known as a string. to signify that the value is a string, enclose it in single quote marks. let myvariable = 'bob'; number this is a number. numbers don't have quotes around them. let myvariable = 10; boolean this is a true/false value. the words true and false are special keywords that don't need quote marks. let myvariable = true; array this is a structure that allows you to store multiple values in a single refere...
...t's add some new features to our example site. adding an image changer in this section, you will learn how to use javascript and dom api features to alternate the display of one of two images. this change will happen as a user clicks the displayed image. choose an image you want to feature on your example site. ideally, the image will be the same size as the image you added previously, or as close as possible. save this image in your images folder. rename the image firefox2.png. add the javascript below to your main.js file. (also delete your hello world! javascript from the earlier exercise.) let myimage = document.queryselector('img'); myimage.onclick = function() { let mysrc = myimage.getattribute('src'); if(mysrc === 'images/firefox-icon.png') { myimage.setattribute...
HTML table basics - Learn web development
Learn › HTML › Tables › Basics
planets of our solar system (planetary facts taken from nasa's planetary fact sheet - metric. ...
...easures are needed to get table layout styling to effectively work across a variety of devices. active learning: creating your first table we've talked table theory enough, so, let's dive into a practical example and build up a simple table. first of all, make a local copy of blank-template.html and minimal-table.css in a new directory on your local machine. the content of every table is enclosed by these two tags : <table></table>. add these inside the body of your html. the smallest container inside a table is a table cell, which is created by a <td> element ('td' stands for 'table data'). add the following inside your table tags: <td>hi, i'm your first cell.</td> if we want a row of four cells, we need to copy these tags three times. update the contents of your table to look lik...
Storing the information you need — Variables - Learn web development
ple case would be: let iamalive = true; whereas in reality it would be used more like this: let test = 6 < 3; this is using the "less than" operator (<) to test whether 6 is less than 3. as you might expect, it returns false, because 6 is not less than 3! you will learn a lot more about such operators later on in the course. arrays an array is a single object that contains multiple values enclosed in square brackets and separated by commas. try entering the following lines into your console: let mynamearray = ['chris', 'bob', 'jim']; let mynumberarray = [10, 15, 40]; once these arrays are defined, you can access each value by their location within the array. try these lines: mynamearray[0]; // should return 'chris' mynumberarray[2]; // should return 40 the square brackets specify an i...
...llowing syntax: dog.name we won't be looking at objects any more for now — you can learn more about those in a future module. dynamic typing javascript is a "dynamically typed language", which means that, unlike some other languages, you don't need to specify what data type a variable will contain (numbers, strings, arrays, etc). for example, if you declare a variable and give it a value enclosed in quotes, the browser treats the variable as a string: let mystring = 'hello'; even if the value contains numbers, it is still a string, so be careful: let mynumber = '500'; // oops, this is still a string typeof mynumber; mynumber = 500; // much better — now this is a number typeof mynumber; try entering the four lines above into your console one by one, and see what the results are. you...
Getting started with React - Learn web development
ader> </div> ); } export default app; the app.js file consists of three main parts: some import statements at the top, the app component in the middle, and an export statement at the bottom. most react components follow this pattern. import statements the import statements at the top of the file allow app.js to use code that has been defined elsewhere. let's look at these statements more closely. import react from 'react'; import logo from './logo.svg'; import './app.css'; the first statement imports the react library itself. because react turns the jsx we write into react.createelement(), all react components must import the react module. if you skip this step, your application will produce an error. the second statement imports a logo from './logo.svg'. note the use of ./ at the b...
... after the imports, we have a function named app. whereas most of the javascript community prefers camel-case names like helloworld, react components use pascal-case variable names, like helloworld, to make it clear that a given jsx element is a react component, and not a regular html tag. if you were to rename the app function to app, your browser would show you an error. let's look at app more closely. function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo" alt="logo" /> <p> edit <code>src/app.js</code> and save to reload. </p> <a classname="app-link" href="https://reactjs.org" target="_blank" rel="noopener noreferrer" > ...
Setting up your own test automation environment - Learn web development
on mac os x/most linux systems: open your .bash_profile (or .bashrc) file (if you can't see hidden files, you'll need to display them, see show/hide hidden files in mac os x or show hidden folders in ubuntu). paste the following into the bottom of your file (updating the path as it actually is on your machine): #add webdriver browser drivers to path export path=$path:/users/bob save and close this file, then restart your terminal/command prompt to reapply your bash configuration. check that your new paths are in the path variable by entering the following into your terminal: echo $path you should see it printed out in the terminal. to set your path variable on windows, follow the instructions at how can i add a new folder to my system path? ok, let's try a quick test to make ...
..._test you should see an instance of firefox automatically open up! google should automatically be loaded in a tab, "webdriver" should be entered in the search box, and the search button will be clicked. webdriver will then wait for 2 seconds; the document title is then accessed, and if it is "webdriver - google search", we will return a message to claim the test is passed. webdriver will then close down the firefox instance and stop. testing in multiple browsers at once there is also nothing to stop you running the test on multiple browsers simultaneously. let's try this! create another new file inside your project directory called google_test_multiple.js. you can feel free to change the references to some of the other browsers we added, remove them, etc., depending on what browsers yo...
Gecko info for Windows accessibility vendors
led, even if only 1 line. gecko fires this event when the scrolling is finished, rather than fire excessive events. event_scrollingstart is fired when the user has jumped to a named anchor within the page. the event is fired on the first accessible object in the part of the document that has been jumped to. event_menupopupstart and event_menupopupend are fired when xul menus are opened or closed. event_menustart and event_menuend are fired when the xul menubar is activated or deactivated. event_valuechange is fired for sliders, progress meters and other objects who's get_accvalue() may change. event_show, event_hide and event_locationchange are fired for the caret object. event_reorder is fired on an object whenever its children change. event_show and event_hide may also...
...chnology's responsibility to watch for system events that indicate when windows are being destroyed, and to release all iaccessibles related to that window. to help web developers in that regard, there is the wonderful memory leak monitor, a firefox 1.5+ extension from david baron, which warns chrome and extension developers about one particular type of memory leak. it warns when chrome windows close but leave native code pointing at their javascript objects. this typically happens for things like observers, timer callbacks, and (in firefox 1.5 and earlier) event listeners, and is one of the most common causes of leaks in chrome and extension code. additional dom support there are a number of things available in the parsed html or xml of a document that msaa will not tell you. to solve ...
Debugging on Windows
tement {,,msvcr80d}(&__iob_func()[1]) (alternatively you can evaluate {,,msvcr80d}(&__iob_func()[1]) in the quickwatch window) similarly, you can open a file on the disk using fopen: >debug.evaluatestatement {,,msvcr80d}fopen("c:\\123", "w") 0x10311dc0 { ..snip.. } >debug.evaluatestatement ((nsgenericelement*)0x03f0e710)->list((file*)0x10311dc0, 1) <void> >debug.evaluatestatement {,,msvcr80d}fclose((file*)0x10311dc0) 0x00000000 note that you may not see the debugging output until you flush or close the file handle. disabling assertions there are basically two ways to disable assertions. one requires setting an environment variable, while the other affects only the currently running program instance in memory. environment variable there is an environment variable that can disable break...
...be a nop (no operation). you do this by running the program in the debugger until you hit an assertion. you should see some assembly code. one assemly code instruction reads "int 3". check the memory address for that line. now open memory view. type/copy/drag the memory address of "int 3" into the memory view to get it to update on that part of the memory. change the value of the memory to "90", close the memory view and hit "f5" to continue. confused? see the screenshot below: vc++ 7.0? automatically handling assertions without a debugger attached when an assertion happens and there is not a debugger attached, a small helper application (windbgdlg.exe) is run. that application can automatically select a response to the "do you want to debug" dialog instead of prompting if you configure ...
Old Thunderbird build
ip or virtualenv because of os access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist). having the source deep in a filesystem hierarchy can also cause problems with pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it close to the root of your machine and re-building. get the latest source code from mozilla's comm-central mercurial code repository: hg clone https://hg.mozilla.org/comm-central then, get all the repositories it depends on. the comm-central repository includes a script to do just that. this may take a while, it's a lot of code! first, cd into the comm-central subdirectory (created automatically by ...
...that installs the files, which may be a parent directory of the changed file's directory. for all other changes run the full rebuild: ./mozilla/mach build problems building? have you: check comm-central on treeherder for known failures at the time you pulled the code. the current status of the trunk can also be checked at https://treestatus.mozilla.org/ if the trunk is broken (i.e. closed), you may wish to consider building one of the branches (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction). on windows: check that the mapi header files from https://www.microsoft.com/en-us/download/details.aspx?id=12905 are installed because the mapi header files are not bundled with visual studio 2013/2015 (windows sdk 8.1/10). you...
Simple Thunderbird build
ip or virtualenv because of os access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist). having the source deep in a filesystem hierarchy can also cause problems with pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it closer to the root of your machine and re-building. get the latest mozilla source code from mozilla's mozilla-central mercurial code repository, and check it out into a local directory source/ (or however you want to call it). then, get the latest thunderbird source code from mozilla's comm-central mercurial code repository. it now needs to be placed inside the mozilla source code, in a directory name...
...example, to just rebuild the lightning calendar extension: ./mach build comm/calendar/lightning for all other changes run the full rebuild: ./mach build problems building? have you: check comm-central on treeherder for known failures at the time you pulled the code. the current status of the trunk can also be checked at https://treestatus.mozilla.org/ if the trunk is broken (i.e. closed), you may wish to consider building one of the branches (to pull the source code from a branch, just replace the url to the repository in the hg clone instruction). check to make sure that the path in which you placed the source code has no spaces, and is not too long. searched the bug database for issues relating to your problem (e.g., platform-specific issues). try asking in mozilla.de...
Eclipse CDT Manual Setup
directory where eclipse will store files that it generates during indexing, and so on.) it's recommended that you have a separate workspace containing only a single project for each mozilla source tree [rational], and that you choose a directory outside the mozilla source. something like $home/eclipse-workspaces/mozilla-tree-1, for example. after selecting an appropriate directory, click ok, then close the "welcome" tab when the main eclipse window opens. before you proceed any further, check that your changes to eclipse's memory limits have taken effect and are present in eclipse/help > about eclipse > installation details > configuration. to avoid confusion in this and the following sections, note that "workspace preferences" and "project properties" are different things (we'll get to the d...
... your main object directory, then adjust the regular expression as necessary. add a recursive, regular expression "exclude all" filter for files with name matching "\.(?:rej|orig|o|pp|swp)$" to exclude .rej, .orig, .pp, .o, and .swp files. add "exclude all" filters for any other non-source directories that you've added to your source tree (e.g., xcode or msvc project directories). click ok to close the filters window, wait for eclipse to finish processing your resource filters, then make sure the filtered directories and files have disappeared from the project explorer tab on the left. also, if your main object directory is in your source tree, and not somewhere outside it, make sure that it has not disappeared from the project explorer tab. reopen the project properties window and select ...
Frame script loading and lifetime
note that this function will not remove any scripts which have been loaded earlier. frame script lifetime frame scripts are loaded as soon as loadframescript() is called. if you've set allowdelayedload, the script is loaded into a new tab as soon as it is created. frame scripts are associated with a browser tab and not with a page. so once you load them, they will stay loaded until the tab is closed, even if you reload the document or navigate. if you want to limit a script to the lifetime of a page you can create a sandbox instead, where the current content page is used as prototype. if you want a frame script to do something when a new document is loaded, you need to listen for an appropriate dom event, generally domwindowcreated, domcontentloaded, or load. unloading frame scripts fram...
...limit a script to the lifetime of a page you can create a sandbox instead, where the current content page is used as prototype. if you want a frame script to do something when a new document is loaded, you need to listen for an appropriate dom event, generally domwindowcreated, domcontentloaded, or load. unloading frame scripts frame scripts are automatically unloaded when their hosting tab is closed. there is currently no way to unload them when loaded, other than closing the tab they were loaded into. to listen for an event, when your frame script is unloaded (due to tab close for instance), you must set the third argument of addmessagelistener to true. for example, from bootstrap.js: services.mm.addmessagelistener( 'my-addon-id', { receivemessage: function() { ...
Performance
hing) } javascript modules are per-process singletons and thus all their objects are only initialized once, which makes them suitable for stateless callbacks. but care must be taken to not leak references to the frame script global when it is passed into a jsm. alternatively the frame's unload event or weak maps can be used to ensure that frames can be cleaned up when their respective tab is closed. store heavyweight state once per process bad: // addon.js var main = new myaddonservice(); main.onchange(statechange); function statechange() { services.mm.broadcastasyncmessage("my-addon:update-configuration", {newconfig: main.serialize()}) } // framescript.js var maincopy; function onupdate(message) { maincopy = myaddonservice.deserialize(message.data.newconfig); } addmessagelis...
...is is for another tab decoratedocument(doc); } }) observer notifications get fired for events that happen anywhere in the browser, they are not scoped to the current tab. if each framescript registers a seperate listener then the observed action will trigger the callbacks in all tabs. additionally the example above does not clean unregister itself, thus leaking objects each time a tab is closed. frame message manager message and event listeners are limited in their lifetime to that of the frame itself, this does not apply to observer registrations. better: content-document-global-created notifications can be substituted with domwindowcreated events other observers and services should be registered in a process script or jsm instead load frame scripts on demand bad:...
IME handling guide
languages like autocomplete. additionally, ime may be used for handwriting systems or speech input systems on some platforms. if ime is available on focused elements, we call that state "enabled". if ime is not fully available(i.e., user cannot enable ime), we call this state "disabled". if ime is enabled but users use direct input mode (e.g., for inputting latin characters), we call it "ime is closed". otherwise, we call it "ime is open". (fyi: "open" is also called "active" or "turned on". "closed" is also called "inactive" or "turned off") so, this document is useful when you're try to fix a bug for text input in gecko. composition string and clauses typical japanese ime can input two or more words into a composition string. when a user converts from hiragana characters to chinese chara...
... focus, mimestate may be enabled. when you need to check if a password field has focus for security reasons, you should use inputcontext::ispasswordeditor(). the other is ime open state: dont_change_open_state the open state of ime shouldn't be changed. i.e., gecko should keep the last ime open state. open open ime. this is specified only when ime-mode of the new focused element is active. close close ime. this is specified only when ime-mode of the new focused element is inactive. e.g., on linux, applications cannot manage ime open state. on such platforms, this is ignored. ime open state should be changed only when nsiwidget::setinputcontext() is called at dom focus change because changing ime open state while an editor has focus makes users confused. the reason why nsiwidget::se...
OS.File.Error
t does not exist try { let file = os.file.open("myfile.txt"); // ... } catch (ex) { if (ex instanceof os.file.error && ex.becausenosuchfile) { // the file does not exist } } global object os.file.error methods overview the following functions are utility functions that may be used to construct instances of os.file.error, setting the platform-specific error number. error closed() error exists() methods os.file.error.closed() return an error representing the fact that a file is closed. os.file.error.exists() return an error representing the fact that a file exists. instances of os.file.error in case of any i/o error, the functions of os.file raise instances of os.file.error. these exceptions hold both a human-readable error message detailing the i/o error...
...and attributes to help determining the cause of the error. cross-platform attributes operation the human-readable name of the failed operation. becauseexists true if the operation failed because a file or directory exists, false otherwise. becausenosuchfile true if the operation failed because a file or directory does not exist, false otherwise. becauseclosed true if the operation failed because a file or directory is closed, false otherwise. platform-specific attributes unixerrno (defined under unix only) the system error number (errno) for the error. for more details, you may compare it with the error constants of os.constants.libc.e*. winlasterror (defined under windows only) the system error number (getlasterror) ...
QA phase
n; often referred to as "l10n base")/ your-locale-code (a directory with your l10n files, in this example we'll use x-testing) example: root/mozilla-aurora & root/l10n-central/x-testing additionally, you will need to copy and translate the toolkit/defines.inc file directly from en-us before you can build. this is due to a bug in the build logic. please either follow the above structure closely or adjust the commands below according to your custom setup. to copy this file to the appropriate directory, do the following: navigate to your working directory from your command-line terminal (i.e., where you created the folder structure described above). enter the following commands: mkdir -p l10n-central/x-testing/toolkit/ cp mozilla-aurora/toolkit/locales/defines.inc l10n-central/x...
...n's binary (aka, a l10n repack), which allows you to install next to your existing mozilla application installation and use separately. visit the links above to learn how to make these testing builds. testing your l10n & seeing your work now that you have your langpack or l10n repack, let's discuss seeing your work and testing it in the application. testing the langpack will put you one step closer to having your localization added to the l10n releases. follow the steps below to test your localization: install aurora in your preferred language. install the .xpi langpack you just created (or exported). set your language using the quick locale switcher or locale switcher add-ons by navigating to tools->language->your localization's language code. restart your browser and start testing!
Release phase
new changeset in the remote repository. troubleshooting ssh if pushing fails, make sure your ~/.ssh/config has the correct user set under the hg.mozilla.org host. this should be your mozilla ldap account name. next, try issuing the following command: $ ssh hg.mozilla.org if ssh is working fine, you should see the following message: no interactive shells allowed here! connection to hg.mozilla.org closed. if you don't see this message, try running the same command in a more verbose mode (with the debugging information): $ ssh -vvv hg.mozilla.org this should tell you why your connection is not succeeding. if you can't figure it out on your own, copy the output of the above command, paste it on http://pastebin.mozilla.org and ask in #l10n on the irc.mozilla.org server. technical and sign-off revi...
...ully functional. for more detailed information about reviews for new localizations and sign-offs for maintenance releases, visit the technical review and sign-off review pages. tah dah! once again, congratulations! you've arrived at the end! feel free to come back to refer to this tutorial as often as needed. we're happy to have you as a new contributor to mozilla l10n and look forward to working closely with you. « previous ...
MathML Demo: <mo> - operator, fence, separator, or accent
a + b ↚ c ⋅ d a + b ↛ c * d a + b ⇍ c × d a + b ⇏ c ÷ d a + b ⇎ c ⋅ d a + b ↮ c * d fences latex fences that begin with \left and \right are stretchy. they grow vertically to the height and depth of the enclosed math run. this growth is continuous and symmetric. here are examples of the standard latex fences ( x ) ⁢ [ y ] ⁢ { 1 } ⁢ ⟨ t ⟩ ⁢ ⌊ a ⌋ ⌈ . ⌉ | π | ⁢ || Σ || and / f / ⁢ \ n \ ↕ ℜ ↕ ⇕ 1.0 ⇕ ↑ x 2 ↑ ⁢ ⇑ x a 2 ⇑ ↓ x ↓ ⇓ m ⇓ . here are some examples with a bit more stretching ( k 1 2 2 ) ...
... m ⁢ m ⁢ m ] + ( m ⁢ m ) + { m ⁢ m } + ⟨ m ⁢ m ⟩ + | m ⁢ m | ⁢ m ⁢ m m ⁢ [ m ⁢ m ⁢ m ] ⁢ ( m ⁢ m ) ⁢ { m ⁢ m } ⁢ ⟨ m ⁢ m ⟩ ⁢ | m ⁢ m | ⁢ m ⁢ m in latex, all fencing symbols are symmetric - they have equal extent above and below the math axis of the run of math in which they occur directly. fences that enclose fractions illustrate the symmetry issue as seen below. ( 1 2 3 4 5 ) + 1 given the symmetric restriction on fences, it is very difficult for latex to produce the product of a fenced row vector and a fenced column vector as shown below. [ a b c d ] ⁢ [ a b c d ] we want the row vector to typeset at the same level as the top row of ...
Activity Monitor, Battery Status Menu and top
so presumably the measurements are obtained from it. systemstats is a program that runs continuously and periodically measures, among other things, cpu usage and idle wakeups for each running process. tests indicate that it is almost certainly using the same "energy impact" formula to compute the "average energy impact", using measurements from the past 8 hours of wake time (i.e. if a laptop is closed for several hours and then reopened, those hours are not included in the calculation.) battery status menu when you click on the battery icon in the os x menu bar you get a drop-down menu that includes a list of “apps using significant energy”. this is crude but prominent, and therefore worth understanding — even though it's not much use for profiling applications. when you open this ...
... to assume that “energy impact” is again being used to determine which applications are "using significant energy". testing shows that once an energy-intensive application is started it takes less than a minute for it to show up in the battery status menu. and once the application stops using high amounts of energy it takes a few minutes to disappear. the exception is when the application is closed, in which case it disappears immediately. and it appears that a program with an “energy impact” of roughly 20 or more will eventually show up as significant, and programs that have much higher “energy impact” values tend to show up more quickly. all of these battery status menu observations are difficult to make reliably and so should be treated with caution. it is clear, however, that ...
Named Shared Memory
d be called following pr_opensharedmemory to map the memory segment to an address in the application's address space. pr_attachsharedmemory may also be called to remap a shared memory segment after detaching the same prsharedmemory object. be sure to detach it when you're finished. pr_detachsharedmemory should be called to unmap the shared memory segment from the application's address space. pr_closesharedmemory should be called when no further use of the prsharedmemory object is required within a process. following a call to pr_closesharedmemory, the prsharedmemory object is invalid and cannot be reused. pr_deletesharedmemory should be called before process termination. after you call pr_deletesharedmemory, any further use of the shared memory associated with the name may cause unpredictabl...
...tforms, depending on implementation, contents of the backing store for the shared memory can be exposed via the file system. set permissions and or access controls at create and attach time to ensure you get the desired security. on windows platforms, no special security measures are provided. named shared memory functions pr_opensharedmemory pr_attachsharedmemory pr_detachsharedmemory pr_closesharedmemory pr_deletesharedmemory ...
PR_CreateFileMap
...
... ...
PR_OpenTCPSocket
...
... ...
PR OpenUDPSocket
...
... datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_openudpsocket creates a new udp socket of the address family af. the socket may be bound to a well-known port number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. ...
NSS Sample Code Sample_2_Initialization of NSS
etpassword(input, output, "re-enter password: ", checkpassword); if (p0 && p1 && !port_strcmp(p0, p1)) { break; } pr_fprintf(pr_stderr, "passwords do not match. ...
...output, "re-enter password: ", checkpassword); if (p0 && p1 && !port_strcmp(p0, p1)) { break; } pr_fprintf(pr_stderr, "passwords do not match. ...
Initialize NSS database - sample 2
etpassword(input, output, "re-enter password: ", checkpassword); if (p0 && p1 && !port_strcmp(p0, p1)) { break; } pr_fprintf(pr_stderr, "passwords do not match. ...
...output, "re-enter password: ", checkpassword); if (p0 && p1 && !port_strcmp(p0, p1)) { break; } pr_fprintf(pr_stderr, "passwords do not match. ...
PKCS11 Implement
cfk_login_required = true and cfk_user_pin_initialized = false. c_setpin called only in the key generation case, as noted in this document under c_gettokeninfo, when cfk_login_required = true and cfk_user_pin_initialized = false. session management c_opensession the nss calls c_opensession whenever it initializes a token and keeps the session open as long as possible. ...
...er closes a session after it finishes doing something with a token. it uses a single session for all single-part rsa operations such as logging in, logging out, signing, verifying, generating keys, wrapping keys, and so on. the nss opens a separate session for each part of a multipart encryption (bulk encryption). if it runs out of sessions, it uses the initial session for saves and restores. c_closesession the nss calls c_closesession to close sessions created for bulk encryption. c_closeallsessions the nss may call c_closeallsessions when it closes down a slot. c_getsessioninfo the nss calls c_getsessioninfo frequently. if a token has been removed during a session, c_getsessioninfo should return either ckr_session_closed or ckr_session_handle_invalid. if a token has been removed and ...
NSPR functions
t method than creating your own nspr i/o layer is to simply import a native file descriptor into nspr. ...
... convenient and works for most applications. ...
FIPS mode of operation
fc_createobject fc_copyobject fc_destroyobject fc_getobjectsize fc_getattributevalue fc_setattributevalue fc_findobjectsinit fc_findobjects fc_findobjectsfinal encryption functions these functions support triple des and aes in ecb and cbc modes. fc_encryptinit ...
... fc_createobject fc_copyobject fc_destroyobject fc_getobjectsize fc_getattributevalue fc_setattributevalue fc_findobjectsinit fc_findobjects fc_findobjectsfinal encryption functions these functions support triple des and aes in ecb and cbc modes. fc_encryptinit ...
NSS tools : certutil
valid. use when checking certificate validity with the -v option. the format of the validity-time argument is yymmddhhmmss[+hhmm|-hhmm|z], which allows offsets to be set relative to the validity end time. specifying seconds (ss) is optional. when specifying an explicit time, use a z at the end of the term, yymmddhhmmssz, to close it. when specifying an offset time, use yymmddhhmmss+hhmm or yymmddhhmmss-hhmm for adding or subtracting time, respectively. if this option is not used, the validity check defaults to the current system time. -c issuer identify the certificate of the ca from which a new certificate will derive its authenticity. use the exac...
...for example: -t "tc,c,t" use the -l option to see a list of the current certificates and trust attributes in a certificate database. note that the output of the -l option may include "u" flag, which means that there is a private key associated with the certificate. it is a dynamic flag and you ...
NSS tools : modutil
e a default provider. the security mechanisms are specified with the -mechanisms argument. arguments module give the security module to access. modulespec give the security module spec to load into the security database. -ciphers cipher-enable-list enable specific ciphers in a module that is being added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it contains spaces. -dbdir [sql:]directory specify the database directory in which to access or create security module database files. modutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs11.txt). if the prefix sql: is not used, then the tool assumes th...
...files, such as a server's root directory. -libfile library-file specify a path to a library file containing the implementation of the pkcs #11 interface module that is being added to the database. -mechanisms mechanism-list specify the security mechanisms for which a particular module will be flagged as a default provider. the mechanism-list is a colon-delimited list of mechanism names. enclose this list in quotation marks if it contains spaces. the module becomes a default provider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil supports several mechanisms: rsa, dsa, rc2, rc4, rc5, aes, des, dh, sha1, sha256, sha512, ssl, tls, md5, ...
NSS reference
tificate functions based on certificate functions in the ssl reference and "certificate functions" in nss public functions. ...
...the two routines used for pseudorandom number generation -- pk11_generaterandomonslot and pk11_generaterandom -- and the two routines used for seeding pseudorandom number generation -- pk11_seedrandom and pk11_randomupdate. pkcs #11 functions based on pkcs #11 functions in the ssl reference and "crypto functions" in nss public functions. secmod_loadusermodule secmod_unloadusermodule secmod_closeuserdb secmod_openuserdb pk11_findcertfromnickname pk11_findkeybyanycert pk11_getslotname pk11_gettokenname pk11_ishw pk11_ispresent pk11_isreadonly pk11_setpasswordfunc ssl functions based on "ssl functions" in the ssl reference and "ssl functions" and "deprecated ssl functions" in nss public functions. ssl_configserversessionidcache ssl_clearsessioncache s/mime based on the s/...
sslerr.html
gth." this generally indicates that the remote peer system has a flawed implementation of ssl, and is violating the ssl specification. ssl_error_tx_record_too_long -12262 "ssl attempted to send a record that exceeded the maximum permissible length." this error should never occur. if it does, it indicates a flaw in the nss ssl library. ssl_error_close_notify_alert -12230 "ssl peer has closed this connection." the local socket received an ssl3 alert record from the remote peer, reporting that the remote peer has chosen to end the connection. the receipt of this alert is an error only if it occurs while a handshake is in progress. ssl_error_pub_key_size_limit_exceeded -12210 "ssl server attempted to use domest...
...ed in selected cipher suite." ssl_error_decryption_failure -12217 "bulk data decryption algorithm failed in selected cipher suite." ssl_error_socket_write_failure -12216 "attempt to write encrypted data to underlying socket failed." after the data to be sent was encrypted, the attempt to send it out the socket failed. likely causes include that the peer has closed the connection. ssl_error_md5_digest_failure -12215 "md5 digest function failed." ssl_error_sha_digest_failure -12214 "sha-1 digest function failed." ssl_error_mac_computation_failure -12213 "message authentication code computation failed." ssl_error_sym_key_context_failure -12212 "failure to create symmetric key context." ...
sslfnc.html
riptor is copied from the model. if the model parameter is null, then the default ssl configuration is used. the new file descriptor returned by ssl_importfd is not necessarily equal to the original nspr file descriptor. if, after calling ssl_importfd, the file descriptors are not equal, you should perform all operations on the new prfiledesc structure, never the old one. even when it's time to close the file descriptor, always close the new prfiledesc structure, never the old one. ssl_optionset sets a single configuration parameter of a specified socket. call once for each parameter you want to change. ssl_optionset replaces the deprecated function ssl_enable. syntax #include "ssl.h" secstatus ssl_optionset( prfiledesc *fd, print32 option, prbool on); parameters ...
...ve like an ssl client or an ssl server. note that this step would not be necessary if the socket weren't already connected. for an ssl socket that is configured before it is connected, ssl figures this out when the application calls pr_connect or pr_accept. if the socket is already connected before ssl gets involved, you must provide this extra hint. nss shutdown function nss_shutdown closes the key and certificate databases that were opened by nss_init. syntax #include "nss.h" secstatus nss_shutdown(void); description note that if any reference to an nss object is leaked (for example, if an ssl client application doesn't call ssl_clearsessioncache first), nss_shutdown fails with the error code sec_error_busy. deprecated functions the following functions have been ...
sslintro.html
pt. if the socket is already connected before ssl gets involved, you must provide this extra hint. 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. the application's protocol (for example, http) determines which end has responsibility to talk first. the end that has to talk first should call pr_send or pr_write, and the other end should call pr_read or pr_recv. use ssl_fo...
... ...
certutil
is required to be valid. use when checking certificate validity with the -v option. the format of the validity-time argument is yymmddhhmmss[+hhmm|-hhmm|z], which allows offsets to be set relative to the validity end time. specifying seconds (ss) is optional. when specifying an explicit time, use a z at the end of the term, yymmddhhmmssz, to close it. when specifying an offset time, use yymmddhhmmss+hhmm or yymmddhhmmss-hhmm for adding or subtracting time, respectively. if this option is not used, the validity check defaults to the current system time. -c issuer identify the certificate of the ca from which a new certificate will derive its authenticity. use the exact ...
...for example: -t "tcu,cu,tuw" use the -l option to see a list of the current certificates and trust attributes in a certificate database. -u certusage specify a usage context to apply when validating a certificate with the -v option. the contexts are the following: o c (as an ss...
NSS tools : modutil
Mozilla › Projects › NSS › tools › modutil
the -mechanisms argument. arguments module give the security module to access. modulespec give the security module spec to load into the security database. -ciphers cipher-enable-list enable specific ciphers in a module that is being added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it contains spaces. -dbdir [sql:]directory specify the database directory in which to access or create security module database files. modutil supports two types of databases: the legacy security databases (cert8.db, key3.db, and secmod.db) and new sqlite databases (cert9.db, key4.db, and pkcs1...
...brary-file specify a path to a library file containing the implementation of the pkcs #11 interface module that is being added to the database. -mechanisms mechanism-list specify the security mechanisms for which a particular module will be flagged as a default provider. the mechanism-list is a colon-delimited list of mechanism names. enclose this list in quotation marks if it contains spaces. the module becomes a default provider for the listed mechanisms when those mechanisms are enabled. if more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined. modutil supports several mechanisms: rsa, dsa, rc2, ...
Rhino serialization
iptableoutputstream and scriptableinputstream, were introduced to handle serialization of rhino classes. these classes extend objectoutputstream and objectinputstream respectively. ...
...so why do we need these specialized stream classes instead of simply using objectoutputstream and objectinputstream? to understand the answer we must know what goes on behind the scenes when rhino serializes objects. ...
Web Replay
os. windows port work is underway, but is not yet working. the difficulties are in figuring out the set of system library apis to intercept, in getting the memory management and dirty memory parts of the rewind infrastructure to work, and in handling the different graphics and ipc pathways on different platforms. comparison with other projects there is lots of existing work in this area. the closest projects are rr, webkit's replay project, and microsoft's time-travel debugger. compared to rr: this should work on all platforms and architectures supported by gecko, though with substantial port work required. this will be part of gecko itself, rather than a separate tool, which means both that developers won't need additional software to use it and that this can't be used to debug other...
...s able to operate on stable, thoroughly documented library apis. by focusing on intercepting these apis, browser instrumentation, recording overhead, and the maintenance burden going forward are all minimized. compared to a lower level project, this is able to tolerate more non-determinism. all code whose behavior is recorded is compiled into gecko (rather than being part of immutable, usually closed-source libraries) and can be lightly modified to deal with behaviors that function intercepting cannot handle, such as varying hash table layouts and the ordering of atomic accesses. appendix: debugger details here is some more detailed information about how a recording/replaying process affects the debugger, and options for future improvements. debugger changes from the perspective of a ...
Mozilla Projects
script code. l20n l20n lets localizers reach higher levels of free linguistic expression by sharpening the divide between localization and application logic. leak monitor leak monitor is a firefox extension by l. david baron that helps extension and chrome developers to find memory leaks. it will pop-up an alert when a window is closed and javascript still links to that window (for example, an observer that is not cleared when the window closes). mailnews mailnews stands for "mail and newsgroups". mailnews is the back end of the messaging parts of seamonkey and thunderbird. it provides a number of functions and capabilities, including: ...
...ented security tools. the language is written in json, but we do not expect people to write zest in this format - it is designed to be a visual language. the core language does not define any graphical representation - that is expected to be defined by the tools that integrate zest. it is completely free, open source and can be included in any tool whether open or closed, free or commercial. zest is still at a very early stage of development, but is has been made available so that anyone can play around with it. all constructive feedback is very welcome. anyone can contribute to the onward development of zest, and teams or individuals who develop security tools are especially welcome to join and help shape zest's futu...
Gecko events
r object. is supported: yes event_alert an alert has been generated. server applications send this event when a user needs to know that a user interface element has changed. is supported: yes event_foreground the foreground window has changed. is supported: no event_menu_start a menu item on the menu bar has been selected. is supported: yes event_menu_end a menu from the menu bar has been closed. is supported: yes event_menupopup_start a pop-up menu has been displayed. is supported: yes event_menupopup_end a pop-up menu has been closed. is supported: yes event_capture_start a window has received mouse capture. is supported: no event_capture_end a window has lost mouse capture. is supported: no event_movesize_start a window is being moved or resized. is supported: no event_mov...
... is supported: no event_contexthelp_end a window has exited context-sensitive help mode is supported: no event_dragdrop_start an application is about to enter drag-and-drop mode is supported: yes event_dragdrop_end an application is about to exit drag-and-drop mode is supported: no event_dialog_start a dialog box has been displayed is supported: no event_dialog_end a dialog box has been closed is supported: no event_scrolling_start scrolling has started on a scroll bar is supported: yes event_scrolling_end scrolling has ended on a scroll bar is supported: yes event_minimize_start a window object is about to be minimized or maximized is supported: no event_minimize_end a window object has been minimized or maximized is supported: no event_document_load_start is supported: ...
Feed content access API
to get the title of the feed, you look at the feed.title property. the title is an nsifeedtextconstruct that can represent the text in various...
...to get the title of the feed, you look at the feed.title property. the title is an nsifeedtextconstruct that can represent the text in various formats; we get its text property to fetch the feed's title as html-encoded text.
Starting WebLock
++ header file, which you'll need to implement the interface in the component and also a type library that makes the component accessible from javascript or other interpreted languages. in mozilla, javascript is the bridge between components and the xul-based user interface. the xpidl syntax the xpidl syntax is a mix of c++ and java, and of course it's very much like the omg idl upon which it is closely based. the xpidl for iweblock appears below: iweblock #include "nsisupports.idl" interface nsisimpleenumerator; [scriptable, uuid(ea54eee4-9548-4b63-b94d-c519ffc91d09)] interface iweblock : nsisupports { void lock(); void unlock(); // assume strings are utf-8 void addsite(in string url); void removesite(in string url); attribute nsisimpleenumerator sites; }; the first line incl...
...lib/. using nsilocalfile for reading data an nsifile object returned from the directory service may also implement the nsilocalfile interface, which has a method that will return a file pointer that can be used in fread(). to implement the actual read, you need to allocate a buffer the length of the file, use the nsilocalfile interface pointer to obtain a file *, use this result with fread, and close the file pointer. the following code loads the contents of the file referenced by the nsifile object thefile into the buffer buf: nscomptr<nsilocalfile> localfile = do_queryinterface(thefile); if (!localfile) return -1; prbool exists; rv = thefile->exists(&exists); if (ns_failed(rv)) return -1; char *buf = null; if (exists) { // determine file size: pruint32 fs, numread; print64 fi...
Introduction to XPCOM for the DOM
x of tabs and whitespaces. make sure you copy exactly the other entries. then type "make" in dom/ to build the interface. if all goes well, a file nsidomfabian.h should be in dom/public/idl/html/_xpidlgen/, and it should contain the c++ code for our interface. from my own experience unfortunately it sometimes necessary to build "distclean" before it works. interface implementation let's take a closer look at how interfaces are implemented. we already know that an interface has to be implemented by a concrete c++ class. this class can implement multiple interfaces, directly or through inheritance (see the next section for a discussion of inheritance). we also saw that an interface defined in xpidl contains methods and attributes, which are transformed into c++ functions by the xpidl compiler.
... an easy example of "interface forwarding". these two ways are the most common to implement an interface in the dom. there are other ways that are a little more complicated, not worth detailing here. important note: the nsisupports interface, implemented by all the dom classes, cannot be implemented with forwarding or declaration macros. special macros are provided to implement nsisupports this closes this tutorial about how to add a new interface. simply make a full rebuild. i recommend building distclean. your methods will not be available from javascript, however, because nsidomfabian is not in the class info. please see the user's guide of class info to learn how to add it. interface inheritance (advanced topic) the inheritance model in mozilla is of course the same as the class inherit...
IAccessibleTable
startingrowindex the 0 based row index where the header starts, usually 0. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. columnindex() translates the given cell index into the corresponding column index. [propget] hresult columnindex( [in] long cellindex, [out] long columnindex ); parameters cellindex 0 based index of the cell in the parent or closest ancestor table. typically this is the value returned from iaccessible2.indexinparent(), but in the case where the table cells are not direct children of the table this is the cell index specified by the "table-cell-index" object attribute obtained from parsing the attributes string returned by calling iaccessible2.attributes() on the cell object. columnindex returns the 0 based column index of ...
...etable the row header. startingcolumnindex the 0 based column index where the header starts, usually 0. return value s_false if there is no header, [out] values are null and 0 respectively. s_ok. rowindex() translates the given cell index into a row index. [propget] hresult rowindex( [in] long cellindex, [out] long rowindex ); parameters cellindex 0 based index of the cell in the parent or closest ancestor table. typically this is the value returned from iaccessible2.indexinparent(), but in the case where the table cells are not direct children of the table this is the cell index specified by the "table-cell-index" object attribute obtained from parsing the attributes string returned by calling iaccessible2.attributes() on the cell object. rowindex 0 based row index. return value e_inva...
IAccessibleText
s null. s_ok. textafteroffset() returns a text() portion after the given position. returns the substring of the specified text() type that is located after the given character and does not include it. the result of this method should be same as a result for textatoffset() with a suitably increased index value. for example, if text() type is ::ia2_text_boundary_word, then the complete word that is closest to and located after offset is returned. if the index is valid, but no suitable word (or other text() type) is found, a null pointer is returned. [propget] hresult textafteroffset( [in] long offset, [in] enum ia2textboundarytype boundarytype, [out] long startoffset, [out] long endoffset, [out] bstr text ); parameters offset index of the character for which to return the text() part ...
...ely. s_ok. textbeforeoffset() returns a text() portion before the given position. returns the substring of the specified text() type that is located before the given character and does not include it. the result of this method should be same as a result for textatoffset() with a suitably decreased index value. for example, if text() type is ::ia2_text_boundary_word, then the complete word that is closest to and located before offset is returned. if the index is valid, but no suitable word (or other boundary type) is found, a null pointer is returned. [propget] hresult textbeforeoffset( [in] long offset, [in] enum ia2textboundarytype boundarytype, [out] long startoffset, [out] long endoffset, [out] bstr text ); parameters offset index of the character for which to return the text() p...
nsIAccessibleEvent
bject. event_alert 0x0002 0x0016 0x0013 an alert has been generated. server applications send this event when a user needs to know that a user interface element has changed. event_foreground 0x0003 0x0017 0x0014 the foreground window has changed. event_menu_start 0x0018 0x0015 a menu item on the menu bar has been selected. event_menu_end 0x0019 0x0016 a menu from the menu bar has been closed. event_menupopup_start 0x001a 0x0017 a pop-up menu has been displayed. event_menupopup_end 0x001b 0x0018 a pop-up menu has been closed. event_capture_start 0x001c 0x0019 a window has received mouse capture. event_capture_end 0x001d 0x001a a window has lost mouse capture. event_movesize_start 0x001e 0x001b a window is being moved or resized. event_movesize_end 0x001f 0x001...
...e. event_contexthelp_end 0x0021 0x001e a window has exited context-sensitive help mode. event_dragdrop_start 0x0022 0x001f an application is about to enter drag-and-drop mode. event_dragdrop_end 0x0023 0x0020 an application is about to exit drag-and-drop mode. event_dialog_start 0x0024 0x0021 a dialog box has been displayed. event_dialog_end 0x0025 0x0022 a dialog box has been closed. event_scrolling_start 0x0026 0x0023 scrolling has started on a scroll bar. event_scrolling_end 0x0027 0x0024 scrolling has ended on a scroll bar. event_minimize_start 0x0028 0x0025 a window object is about to be minimized or maximized. event_minimize_end 0x0029 0x0026 a window object has been minimized or maximized. event_document_load_complete 0x002b 0x0027 the loading of t...
nsIAccessibleScrollType
accessible/public/nsiaccessibletypes.idlscriptable these constants control the scrolling of an object or substring into a window. 1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) constants constant value description scroll_type_top_left 0x00 scroll the top left of the object or substring to the top left of the window (or as close as possible). scroll_type_bottom_right 0x01 scroll the bottom right of the object or substring to the bottom right of the window (or as close as possible). scroll_type_top_edge 0x02 scroll the top edge of the object or substring to the top edge of the window (or as close as possible). scroll_type_bottom_edge 0x03 scroll the bottom edge of the object or substring to the bottom edge of the wi...
...). scroll_type_bottom_right 0x01 scroll the bottom right of the object or substring to the bottom right of the window (or as close as possible). scroll_type_top_edge 0x02 scroll the top edge of the object or substring to the top edge of the window (or as close as possible). scroll_type_bottom_edge 0x03 scroll the bottom edge of the object or substring to the bottom edge of the window (or as close as possible). scroll_type_left_edge 0x04 scroll the left edge of the object or substring to the left edge of the window (or as close as possible). scroll_type_right_edge 0x05 scroll the right edge of the object or substring to the right edge of the window (or as close as possible). scroll_type_anywhere 0x06 scroll an object the minimum amount necessary in order for the entire frame to be vi...
nsIAlertsService
note: if you are calling this function from javascript, you should wrap it in a try/catch because it can fail on mac os x prior to firefox 22. void showalertnotification( in astring imageurl, in astring title, in astring text, in boolean textcl...
...opic == 'alertshow') { console.log('just showed notification'); } else if (atopic == 'alertfinished') { console.log('just alertfinished') } } }; as.showalertnotification('chrome://branding/content/icon64.png', 'stackoverflow - new messages', 'there are ## new messages. click here to focus the tab', true, null, notiflistener, 'stackoverflow notifier'); closealert() closes alerts created by the service. void closealert( in astring name, optional in nsiprincipal principal optional ); parameters name the name of the notification to close. if no name is provided then only a notification created with no name (if any) will be closed. principal the title for the alert. see also alerts and notifications bug 782211 - implement notificat...
nsICacheEntryDescriptor
netwerk/cache/nsicacheentrydescriptor.idlscriptable this interface provides a cache entry descriptor. ...
...che for an entry that we know up front is going to have to be evicted anyway. see bug 588507. securityinfo nsisupports get or set security info on the cache entry for this descriptor. this fails if the storage policy is not store_in_memory. storagepolicy nscachestoragepolicy get or set the storage policy of the cache entry. see nsicache for the definitions of the storage policies. methods close() this method explicitly closes the descriptor (optional). void close(); parameters none. doom() this method dooms the cache entry this descriptor references in order to slate it for removal. once doomed a cache entry cannot be undoomed. a descriptor with write access can doom the cache entry and choose to fail pending requests. this means that pending requests will not get a cache descriptor. t...
nsIDOMWindowInternal
nsidomwindow window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. ...
...ity can be toggled in the window. personalbar nsidombarprop readonly: returns the personalbar object, whose visibility can be toggled in the window. statusbar nsidombarprop readonly: returns the statusbar object, whose visibility can be toggled in the window. directories nsidombarprop readonly: returns the window directories toolbar object. closed boolean readonly: this property indicates whether the referenced window is closed or not. crypto nsidomcrypto readonly: returns the browser crypto object, which can then be used to manipulate various browser security features. pkcs11 nsidompkcs11 obsolete: this property is not supported in newer versions of firefox. controllers nsicontrollers ...
nsIDirectoryEnumerator
for enumerating the contents of a directory. it is similar to nsisimpleenumerator except the retrieved entries are qi'ed to nsifile, and there is a mechanism for closing the directory when the enumeration is complete. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview void close(); attributes attribute type description nextfile nsifile the next file in the sequence. the nextfile attribute is the first element upon the first call. this attribute is null if there is no next element. read only. methods close() closes the directory being enumerated, releasing the system resource. it is safe to call this function many times. void clos...
...ext file in the sequence. the nextfile attribute is the first element upon the first call. this attribute is null if there is no next element. read only. methods close() closes the directory being enumerated, releasing the system resource. it is safe to call this function many times. void close(); parameters none. exceptions thrown ns_ok if the call succeeded and the directory was closed. ns_error_failure if the directory close failed. ...
nsIFileInputStream
netwerk/base/nsifilestreams.idlscriptable an input stream that allows you to read from a file. inherits from: nsiinputstream last changed in gecko 1.7 method overview void init(in nsifile file, in long ioflags, in long perm, in long behaviorflags); constants constant value description delete_on_close 1<<1 if this is set, the file will be deleted by the time the stream is closed. it may be removed before the stream is closed if it is possible to delete it and still read from it. if open_on_read is defined, and the file was recreated after the first delete, the file will be deleted again when it is closed again. close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached. ...
...te, the file will be deleted again when it is closed again. close_on_eof 1<<2 if this is set, the file will close automatically when the end of the file is reached. reopen_on_rewind 1<<3 if this is set, the file will be reopened whenever seek(0) occurs. if the file is already open and the seek occurs, it will happen naturally. ...
nsIFrameMessageManager
gecko 17.0 inherits from: nsisupports last changed in gecko 17.0 (firefox 17.0 / thunderbird 17.0 / seamonkey 2.14) this interface is obsolete and was removed in firefox 17. you should use nsimessagelistenermanager or nsimessagesender instead. method overview void addmessagelistener(in astring amessage, in nsiframemessagelistener alistener, [optional] in boolean listenwhenclosed); void removemessagelistener(in astring amessage, in nsiframemessagelistener alistener); void sendasyncmessage(in astring amessage, in astring json); methods addmessagelistener() adds a message listener to the local frame. this listener will receive messages sent from the remote frame. void addmessagelistener( in astring amessage, in nsiframemessagelistener aliste...
...er(in astring amessage, in nsiframemessagelistener alistener); void sendasyncmessage(in astring amessage, in astring json); methods addmessagelistener() adds a message listener to the local frame. this listener will receive messages sent from the remote frame. void addmessagelistener( in astring amessage, in nsiframemessagelistener alistener [optional in boolean listenwhenclosed ); parameters amessage the name of the message for which to add a listener. alistener an object implementing nsiframemessagelistener whose receivemessage method will be called when the message is received. listenwhenclosed default is false. set to oo if you want to receive messages during the short period after a frame has been removed from the dom and before its frame script has finis...
nsIMsgDBView
a. ...
... the sort type used for the folder. defined in the interface: nsmsgviewsorttype. sortorder an nsmsgviewsortordervalue designating the sort order used for the folder. defined in the interface: nsmsgviewsortorder. viewflags other flags to be used. defined in the interface: nsmsgviewflagstype. return values acount upon return, the count variable may contain the number of messages loaded. close() close the current list of messages. void close(); init() initializes the database view for use. void init(in nsimessenger amessengerinstance, in nsimsgwindow amsgwindow, in nsimsgdbviewcommandupdater acommandupdater); parameters amessengerinstance amsgwindow acommandupdater sort() sorts the currently loaded messages. void sort(in nsmsgviewsorttypevalue ...
nsIMsgIncomingServer
nsimsgincomingserver mailnews/base/public/nsimsgincomingserver.idlscriptable ??? add brief description of interface ??? ...
...exceptions thrown missing exception missing description cleartemporaryreturnreceiptsfilter() if sent folder pref is changed we need to clear the temporary return receipt filter so that the new return receipt filter can be recreated (by configuretemporaryreturnreceiptsfilter()). void cleartemporaryreturnreceiptsfilter(); parameters none. exceptions thrown missing exception missing description closecachedconnections() void closecachedconnections(); parameters none. exceptions thrown missing exception missing description configuretemporaryfilters() for mail, this configures both the mdn filter, and the server-side spam filter filters, if needed. if we have set up to filter return receipts into our sent folder, this utility method creates a filter to do that, and adds it to our filterlist i...
nsINavHistoryResultViewer
ec 1.0) obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1)this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. note: most methods in this interface were renamed in gecko 1.9.2, and others have slightly different parameter lists. ...
...d long anewindex); void sortingchanged(in unsigned short sortingmode); attributes attribute type description result nsinavhistoryresult the nsinavhistoryresult this viewer monitors. although this attribute is read-write, you should not alter it directly; instead, use the nsinavhistoryresult.viewer attribute to set the viewer. methods containerclosed() called when a container node's state changes from closed to opened. void containerclosed( in nsinavhistorycontainerresultnode acontainernode ); parameters acontainernode the container node whose state changed. containeropened() called when a container node's state changes from closed to opened. void containeropened( in nsinavhistorycontainerresultnode acontainernode ); ...
nsIPipe
hange between two threads. for example, a worker thread might write data to a pipe from which the main thread will read. each end of the pipe can be either blocking or non-blocking. recall that a non-blocking stream will return ns_base_stream_would_block if it cannot be read or written to without blocking the calling thread. for example, if you try to read from an empty pipe that has not yet been closed, then if that pipe's input end is non-blocking, then the read call will fail immediately with ns_base_stream_would_block as the error condition. however, if that pipe's input end is blocking, then the read call will not return until the pipe has data or until the pipe is closed. this example presumes that the pipe is being filled asynchronously on some background thread. the pipe supports nsiasy...
...ly on some background thread. the pipe supports nsiasyncinputstream and nsiasyncoutputstream, which give the user of a non-blocking pipe the ability to wait for the pipe to become ready again. for example, in the case of an empty non-blocking pipe, the user can call nsiasyncinputstream.asyncwait() on the input end of the pipe to be notified when the pipe has data to read (or when the pipe becomes closed). ns_newpipe2() and ns_newpipe() provide convenient pipe constructors for c++. in most cases nsipipe is not actually used. it is usually enough to just get references to the pipe's input and output end. in which case, the pipe is automatically closed when the respective pipe ends are released. ...
nsISeekableStream
to interpret the 'offset' parameter in setting the stream offset associated with the implementing stream, according to the table of constants above. offset specifies a value, in bytes, that is used in conjunction with the 'whence' parameter to set the stream offset of the implementing stream. a negative value causes seeking in the reverse direction. exceptions thrown ns_base_stream_closed if called on a closed stream. seteof() this method truncates the stream at the current offset. void seteof(); parameters none. exceptions thrown ns_base_stream_closed if called on a closed stream. tell() this method reports the current offset, in bytes, from the start of the stream. long long tell(); parameters none. return value the current offset, in bytes, from the start of t...
...s method truncates the stream at the current offset. void seteof(); parameters none. exceptions thrown ns_base_stream_closed if called on a closed stream. tell() this method reports the current offset, in bytes, from the start of the stream. long long tell(); parameters none. return value the current offset, in bytes, from the start of the stream. exceptions thrown ns_base_stream_closed if called on a closed stream. ...
nsIServerSocket
read only. methods asynclisten() this method puts the server socket in the listening state. it will asynchronously listen for and accept client co...
...n the same thread that called asynclisten() (the calling thread must have an nsieventtarget). the listener will be passed a reference to an already connected socket transport (nsisockettransport). see nsiserversocketlistener for more details. void asynclisten( in nsiserversocketlistener alistener ); parameters alistener the listener to be notified when client connections are accepted. close() this method closes a server socket. this does not affect already connected client sockets (i.e., the nsisockettransport instances created from this server socket). this will cause the onstoplistening event to asynchronously fire with a status of ns_binding_aborted. void close(); parameters none. native code only!getaddress returns the address to which this server socket is bound. since a ...
nsITaskbarPreviewController
or nsitaskbarwindowpreview, only certain methods and attributes need to be implemented. method overview boolean drawpreview(in nsidomcanvasrenderingcontext2d ctx); boolean drawthumbnail(in nsidomcanvasrenderingcontext2d ctx, in unsigned long width, in unsigned long height); boolean onactivate(); void onclick(in nsitaskbarpreviewbutton button); void onclose(); attributes attribute type description height unsigned long the height in pixels of the preview image. this value may change at any time. see drawpreview() for more information. read only. thumbnailaspectratio float the thumbnail's aspect ratio. this doesn't need to match the preview's aspect ratio, and is allowed to be changed at any time. s...
...d be activated, false if activation is not accepted. onclick() invoked when one of the buttons on the window preview's toolbar is clicked by the user. void onclick( in nsitaskbarpreviewbutton button ); parameters button an nsitaskbarpreviewbutton object representing the button that was pressed. this can be compared to the buttons returned by the nsitaskbarwindowpreview.getbutton(). onclose() invoked when the user presses the close button on the tab preview. void onclose(); parameters none. see also nsitaskbarpreview nsitaskbartabpreview nsitaskbarwindowpreview nsitaskbarpreviewbutton nsiwintaskbar ...
nsITreeView
row index which returns true for a call to iscontainer, even if iscontainerempty returns true. boolean iscontainer( in long index ); parameters index the index of the row being asked about. return value true if the row is a container. otherwise false. iscontainerempty() one of the methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used. boolean iscontainerempty( in long index ); parameters index the index of the item being asked about. return value true if the item is an empty container. otherwise false. iscontaineropen() one of the methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used. boolean iscontaineropen( ...
...l. value the value to change the cell to. settree() called when setting or clearing the view on the tree to link the view to or disconnect the front end box object. void settree( in nsitreeboxobject tree ); parameters tree the nsitreeboxobject to attach this view to, or null if the view is being removed from the tree. toggleopenstate() called on the view when an item is opened or closed, e.g., by clicking the twisty, keyboard access, et cetera. note: as of this writing (gecko 2.0), custom nsitreeview implementations must be prepared to handle a call to toggleopenstate for any row index which returns true for a call to iscontainer, regardless of whether the container is empty. void toggleopenstate( in long index ); parameters index the index of the row to toggle. see...
nsIURI
boolean schemeis(in string scheme); attributes attribute type description asciihost acstring the uri host with an ascii compatible encoding. follows the idna draft specification for converting internationalized domain names (utf-8) to ascii for compatibility with existing internet infrastructure. read only. note: ipv6 addresses are not enclosed in square brackets. asciispec acstring (us-ascii) the uri spec with an ascii compatible encoding. the host portion follows the idna draft spec. other parts are url-escaped per the rules of rfc3986. the result is strictly ascii. read only. hasref boolean returns if there is a reference portion (the part after the "#") of the uri. host a...
... host autf8string the host is the internet domain name to which this uri refers. it could be an ipv4 (or ipv6) address literal. if supported, it could be a non-ascii internationalized domain name. exceptions thrown ns_error_failure if host is not applicable to the uri scheme (e.g. about:blank) note: characters are not escaped. ipv6 addresses are not enclosed in square brackets. hostport autf8string the "host:port" part of the uri (or simply the host, if port is -1). exceptions thrown ns_error_failure if hostport is not applicable to the uri scheme (e.g. about:blank) note: characters are not escaped. origincharset acstring the charset of the document from which this uri or...
nsIWindowMediator
//as example this will add a function to listen to tab select and will fire alert in that window if (domwindow.gbrowser && domwindow.gbrowser.tabcontainer) { domwindow.gbrowser.tabcontainer.addeventlistener('tabselect', function () { domwindow.alert('tab was selected') }, false); } }, false); }, onclosewindow: function (awindow) {}, onwindowtitlechange: function (awindow, atitle) {} }; //to register services.wm.addlistener(windowlistener); //services.wm.removelistener(windowlistener); //once you want to remove this listener execute removelistener, currently its commented out so you can copy paste this code in scratchpad and see it work native code only!calculatezposition a window wants...
...he window to the top window, zlevelbottom to the bottom. if set to zlevelbelow the window will be placed below iobelow. the value of inbelow will be ignored for zleveltop and zlevelbottom.) inbelow the window inwindow is behind, if zlevelbelow. native code only!unregisterwindow remove the window from the list of known windows. listeners (see addlistener()) will be be notified through their onclosewindow method. void unregisterwindow( in nsixulwindow awindow ); parameters awindow the window to remove. native code only!updatewindowtimestamp call this method when a window gains focus. it's a primitive means of determining the most recent window. it's no longer necessary and it really should be removed. void updatewindowtimestamp( in nsixulwindow awindow ); parameters awind...
XUL Overlays
Mozilla › Tech › XUL › Overlays
menupopup> <titledbutton id="ssp" crop="right" flex="1" value="&ssbutton.label;" onclick="firessp()"/> overlays and id attributes bases and overlays are merged when they share the same id attribute. thus, given the following base: ... <menu id="file-menu"> <menupopup id="menu_filepopup"> <menuitem name="new"/> <menuitem name="open"/> <menuitem name="save"/> <menuitem name="close"/> </menupopup> </menu> ... and given the following overlay: <?xml version="1.0"?> <overlay id="singleitemex" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <menupopup id="menu_filepopup"> <menu id="file_menu"> <menuitem name="super stream player"/> </menu> </menupopup> </overlay> the result will be: ...
...1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <menupopup id="menu_filepopup"> <menu id="file_menu"> <menuitem name="super stream player"/> </menu> </menupopup> </overlay> the result will be: ... <menu id="file-menu"> <menupopup id="menu_filepopup"> <menuitem name="new"/> <menuitem name="open"/> <menuitem name="save"/> <menuitem name="close"/> <menuitem name="super stream player"/> </menupopup> </menu> ... if you are developing a mozilla extension, note that the id namespace is shared by all the extensions. so, in order to avoid unpredicted behaviors you will probably benefit from using a unique prefix for the ids of the xul elements of your extension. for instance, you can use the name of your extension, or an abbreviation of it...
Index
on will not appear. the reason this file name scheme was chosen was is this is how netscape 7.0 im stores buddy icons on disk. so if you use nim, and you use buddy icons, this will just work for free. notes: 16 cached compose window faq seth spitzer (sspitzer@mozilla.org) what is the "cached" compose window? instead of destroying the mail compose window on send (or close) just to create a new one the next time, mozilla mail will "cache" the compose window on send (or close), and use that instead. the downsides are that we have had some bugs, it complicates and bloats the code, and it requires more testing. the upside is that is has been a major performance win why did you do this? back 0.9.7, we hit a wall with the compose window. any new window performanc...
...window on every new mail message or reply. but we noticed that the common usage pattern is to compose, send, compose, send, compose send. we decided it would be worth the trouble to cache the compose window. if the user has this usage pattern, we wouldn't have to create a new window. we could just hide it on send, and then show it on the next compose. if the user opens (but never sends or closes compose windows), this trick will not apply to them. but this is not a common usage model. how do i test it? on window and mac, the cached compose window is on by default. to test it 17 content tabs thunderbird content tabs enable thunderbird to display remote content in a tab, which users can browse in (mostly) the same way as with a browser. for example, invoking thu...
Add to iPhoto
pport core foundation. initializing core foundation the init() method, which sets everything up, looks like this: init: function() { this.lib = ctypes.open("/system/library/frameworks/corefoundation.framework/corefoundation"); // declaring all the apis goes here } shutting down core foundation while the core foundation system framework itself doesn't need to be shut down, we do need to close the library we opened using the js-ctypes api; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } select api declarations let's take a look at a few of the key apis we declare for core foundation, to see how it's done. cfrange cfrange is a structure that identifies a range; that is, it identifies an offset to an item in a list and a number of items. in...
... we need to build the parameters for the lsopenurlswithrole() function, then call it to start up iphoto. the first step here is to create a new fsref object to contain the reference to the iphoto application itself, since lsopenurlswithrole() uses an fsref to specify the application to launch. then we build the lsapplicationparameters structure describing the application to launch. let's take a closer look at this syntax: var appparams = appservices.struct_lsapplicationparameters(0, 1, ref.address(), null, null, null, null); here you're calling a constructor, created for you by js-ctypes, that creates and fills out the structure, specifying the values of all of the parameters. to specify a pointer to the fsref indicating the application to launch, we pass ref.address(), which obtains th...
Initialization and Destruction - Plugins
he basic processes of initialization, instance creation and destruction, and shutdown. 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. shutdown: when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory and the browser calls the function np_shutdown. plug-ins consume no resources, other than disk space, if not referenced. this chapter ends with initialize and shutdown example,...
...data is saved in the history list. as long as the plug-in still appears in this list, that saved data is associated with the page; any new instances receive this data. instance destruction plug-in instances are created with npp_new and destroyed with npp_destroy. the browser calls npp_destroy when a plug-in instance is deleted, usually because the user has left the page containing the instance, closed the window, or quit the application. if this is the last instance created by a plug-in, np_shutdown is called. you should not perform any graphics operations in npp_destroy because the instance window is no longer guaranteed to be valid. also, be sure to delete any private instance-specific information stored in the plug-in's instance->pdata. nperror npp_destroy(npp instance, npsaveddata **sav...
Streams - Plugins
ceive requests for ranges in the same order as you requested (although this typically is the case; the server controls the order). so, you'll need to pay attention to the offsets as data is being written. the stream processes all byte-range requests, and then is placed in seek mode (either explicitly in npp_newstream, or implicitly by a call to npn_requestread). it remains open until the plug-in closes it by calling npn_destroystream, or until the instance is destroyed. note: if you want to be sure that the npn_*stream functions are called in the order you want and behave the way you expect, combine npn_newstream, npn_write, and npn_destroy_stream in the same callback. sending the stream in random-access mode in random-access mode, the plug-in "pulls" stream data by calling the npn_requestr...
...written to. the len parameter specifies the length, in bytes, of data written to the stream. the buf parameter is a pointer to the buffer holding the data to write to the stream. for an example that demonstrates using this function with npn_newstream and npn_destroystream, see "example of sending a stream." deleting the stream when the stream is complete, the plug-in calls npn_destroystream to close and delete it. this applies to streams the plug-in creates with npn_newstream or streams created by the browser with npp_newstream. nperror npn_destroystream(npp instance, npstream* stream, nperror reason); the instance parameter is the current plug-in; the stream parameter specifies the stream, created by either the browser or the plug-in. the reason parameter represents the reason the strea...
Debugger keyboard shortcuts - Firefox Developer Tools
command windows macos linux close current file ctrl + w cmd + w ctrl + w search for a string in the current file ctrl + f cmd + f ctrl + f search for a string in all files ctrl + shift + f cmd + shift + f ctrl + shift + f find next in the current file ctrl + g cmd + g ctrl + g search for scripts by name ctrl + p cmd + p ctrl + p resume execution when at a breakpoint f8 f8 1 f8 step over f10 f10 1 f10 step into f11 f11 1 f11 step out shift + f11 shift + f11 1 shift + f11 toggle breakpoint on the currently selected line ctrl + b cmd + b ctrl + b toggle conditional breakpoint on the currently ...
...e a special feature: for example, to change the screen brightness or the volume. see this guide to using these keys as standard function keys. to use a remapped key as a standard function key, hold the function key down as well (so to open the profiler, use shift + function + f5). note: before firefox 66, the combination ctrl + shift + s on windows and linux or cmd + opt + s on macos would open/close the debugger. from firefox 66 and later, this is no longer the case. global shortcuts these shortcuts work in all tools that are hosted in the toolbox. command windows macos linux increase font size ctrl + + cmd + + ctrl + + decrease font size ctrl + - cmd + - ctrl + - reset font size ctrl + 0 cmd + 0 ctrl + 0 ...
Tutorial: Set a breakpoint - Firefox Developer Tools
...
... in fact, you can use the browser content toolbox’s debugger panel to set its own breakpoint in report, and it will trigger along with the first two. keep in mind, however, that when multiple debuggers share a debuggee, the order in which their handlers run is not specified. if more than one tool tries to influence the debuggee’s behavior, their combined behavior could be unpredictable. close the web page and the browser content toolbox. since both the scratchpad’s global object and the debuggee window are now gone, the debugger instances will be garbage collected, since they can no longer have any visible effect on firefox’s behavior. the debugger api tries to interact with garbage collection as transparently as possible; for example, if both a debugger.object instance and its...
Responsive Design Mode - Firefox Developer Tools
se events are translated into touch events; this includes (starting in firefox 79) translating a mouse-drag event into a touch-drag event. (note that when touch simulation is enabled, this toolbar icon is blue; when simulation is disabled, it is black. ...
...ranslated into touch events; this includes (starting in firefox 79) translating a mouse-drag event into a touch-drag event. (note that when touch simulation is enabled, this toolbar icon is blue; when simulation is disabled, it is black. ...
Settings - Firefox Developer Tools
. new in firefox 53. play camera shutter sound when you click the icon for the screenshot tool, play a shutter sound. new in firefox 53. editor preferences preferences for the codemirror source editor, which is included in firefox and used by several developer tools, including scratchpad and the style editor. detect indentation auto-indent new lines based on the current indentation. autoclose brackets determines whether typing an opening character like [ or { will cause the editor to insert the matching closing character ] or } for you. indent using spaces when checked, indentation will be performed using spaces, when off, the editor will use tabs instead. tab size the frequency of tab stops in the editor. select 2, 4, or 8. keybindings choose the default codemirror keybindings...
...ngs show gecko platform data a setting to control whether or not profiles should include gecko platform symbols. disable http cache disable the browser http cache to simulate first-load performance in all tabs that have the toolbox open. this setting persists, meaning that if it is set, caching will be disabled whenever you reopen the devtools. caching is re-enabled when the devtools are closed. note that service workers are not affected by this option. note that this option was called "disable cache" in firefox versions previous to 49, but it was renamed to make it clearer that this affects the http cache, and not service workers/the cache api. disable javascript reload the current tab with javascript disabled. enable service workers over http enable service worker registration...
Toolbox - Firefox Developer Tools
e main toolbar of the toolbox to reorder your tools as you wish (bug 1226272). docking mode by default, the toolbox appears docked to the bottom of the browser window, but you can also dock it to the right-hand side of the window, or make it a standalone window, using buttons in the toolbar. toolbar the toolbar contains controls to activate a particular tool, to dock/float the window, and to close the window. node picker on the far left there's a button to activate the node picker. this lets you select a page element for inspection. see "selecting elements". toolbox-hosted tools then there is an array of labeled buttons which enables you to switch between the different tools hosted by the toolbox. the array may include the following tools: web console javascript debugger page in...
... main pane the content of the main pane in the window is entirely controlled by, and specific t...
AudioContext.suspend() - Web APIs
an application to power down the audio hardware when it will not be using an audio context for a while. this method will cause an invalid_state_err exception to be thrown if called on an offlineaudiocontext. syntax var audioctx = new audiocontext(); audioctx.suspend().then(function() { ... }); returns a promise that resolves with void. the promise is rejected if the context has already been closed. example the following snippet is taken from our audiocontext states demo (see it running live.) when the suspend/resume button is clicked, the audiocontext.state is queried — if it is running, suspend() is called; if it is suspended, resume() is called. in each case, the text label of the button is updated as appropriate once the promise resolves. susresbtn.onclick = function() { if(audi...
... working draft ...
CSSStyleSheet.insertRule() - Web APIs
ule = function(selectorandrule){ // first, separate the selector from the rule a: for (var i=0, len=selectorandrule.length, isescaped=0, newcharcode=0; i !== len; ++i) { newcharcode = selectorandrule.charcodeat(i); if (!isescaped && (newcharcode === 123)) { // 123 = "{".charcodeat(0) // secondly, find the last closing bracket var openbracketpos = i, closebracketpos = -1; for (; i !== len; ++i) { newcharcode = selectorandrule.charcodeat(i); if (!isescaped && (newcharcode === 125)) { // 125 = "}".charcodeat(0) closebracketpos = i; } isescaped ^= newcharcode===92?1:isescaped; // 92 = "\\".charcodeat(0) } if (closebracketpos === -1) break a; // no closing bra...
... } isescaped ^= newcharcode===92?1:isescaped; // 92 = "\\".charcodeat(0) } if (closebracketpos === -1) break a; // no closing bracket was found! ...
CSS Painting API - Web APIs
ent'; ctx.strokestyle = thecolor; } else if ( stroketype === 'filled' ) { ctx.fillstyle = thecolor; ctx.strokestyle = thecolor; } else { ctx.fillstyle = 'none'; ctx.strokestyle = 'none'; } ctx.beginpath(); ctx.moveto( x, y ); ctx.lineto( blockwidth, y ); ctx.lineto( blockwidth + blockheight, blockheight ); ctx.lineto( x, blockheight ); ctx.lineto( x, y ); ctx.closepath(); ctx.fill(); ctx.stroke(); for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginpath(); ctx.moveto( blockwidth + (start * 10) + 10, y); ctx.lineto( blockwidth + (start * 10) + 20, y); ctx.lineto( blockwidth + (start * 10) + 20 + blockheight, blockheight); ctx.lineto( blockwidth + (start * 10) + 10 + blockheight, blockheight); ctx.lineto( blockwidth + (star...
...tx.stroke(); for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginpath(); ctx.moveto( blockwidth + (start * 10) + 10, y); ctx.lineto( blockwidth + (start * 10) + 20, y); ctx.lineto( blockwidth + (start * 10) + 20 + blockheight, blockheight); ctx.lineto( blockwidth + (start * 10) + 10 + blockheight, blockheight); ctx.lineto( blockwidth + (start * 10) + 10, y); ctx.closepath(); ctx.fill(); ctx.stroke(); } } }); we then include the paintworklet: <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li> <li>item 10</li> <li>item 11</li> <li>item 12</li> <li>item 13</li> <li>item 14</li> <li>item 15</li> ...
CanvasRenderingContext2D - Web APIs
ument: const canvas = document.getelementbyid('my-house'); const ctx = canvas.getcontext('2d'); with the context in hand, you can draw anything you like. this code draws a house: // set line width ctx.linewidth = 10; // wall ctx.strokerect(75, 140, 150, 110); // door ctx.fillrect(130, 190, 40, 60); // roof ctx.beginpath(); ctx.moveto(50, 140); ctx.lineto(150, 60); ctx.lineto(250, 140); ctx.closepath(); ctx.stroke(); the resulting drawing looks like this: reference drawing rectangles there are three methods that immediately draw rectangles to the canvas. canvasrenderingcontext2d.clearrect() sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any previously drawn content. canvasrenderingcontext2d.fillrect() d...
...ontal distance the shadow will be offset. default: 0. canvasrenderingcontext2d.shadowoffsety vertical distance the shadow will be offset. default: 0. paths the following methods can be used to manipulate paths of objects. canvasrenderingcontext2d.beginpath() starts a new path by emptying the list of sub-paths. call this method when you want to create a new path. canvasrenderingcontext2d.closepath() causes the point of the pen to move back to the start of the current sub-path. it tries to draw a straight line from the current point to the start. if the shape has already been closed or has only one point, this function does nothing. canvasrenderingcontext2d.moveto() moves the starting point of a new sub-path to the (x, y) coordinates. canvasrenderingcontext2d.lineto() connects the ...
Applying styles and colors - Web APIs
on the current linecap style whose default value is butt; you may want to compute consistent strokes with half-pixel coordinates for odd-width lines, by setting the linecap style to square, so that the outer border of the stroke around the endpoint will be automatically extended to cover the whole pixel exactly). ...
...ent linecap style whose default value is butt; you may want to compute consistent strokes with half-pixel coordinates for odd-width lines, by setting the linecap style to square, so that the outer border of the stroke around the endpoint will be automatically extended to cover the whole pixel exactly). ...
Compositing and clipping - Web APIs
the clipping path is never affected by adding new shapes. this makes clipping paths ideal for drawing multiple shapes in a restricted area. in the chapter about drawing shapes i only mentioned the stroke() and fill() methods, but there's a third method we can use with paths, called clip(). clip() turns the path currently being built into the current clipping path. you use clip() instead of closepath() to close a path and turn it into a clipping path instead of stroking or filling the path. by default the <canvas> element has a clipping path that's the exact same size as the canvas itself. in other words, no clipping occurs. a clip example in this example, we'll use a circular clipping path to restrict the drawing of a set of random stars to a particular region. function draw() { va...
...next, we create the circular clipping path by drawing an arc and calling clip(). clipping paths are also part of the canvas save state. if we wanted to k...
Clients.openWindow() - Web APIs
(windowclient.focus(), true) : false); // otherwise, ope...
...(windowclient.focus(), true) : false); // otherwise, open a new tab to the applicable url and focus it.
Document - Web APIs
Web › API › Document
raised. globaleventhandlers.oncanplaythrough is an eventhandler representing the code to be called when the canplaythrough event is raised. globaleventhandlers.onchange is an eventhandler representing the code to be called when the change event is raised. globaleventhandlers.onclick is an eventhandler representing the code to be called when the click event is raised. globaleventhandlers.onclose is an eventhandler representing the code to be called when the close event is raised. globaleventhandlers.oncontextmenu is an eventhandler representing the code to be called when the contextmenu event is raised. globaleventhandlers.oncuechange is an eventhandler representing the code to be called when the cuechange event is raised. globaleventhandlers.ondblclick is an eventhandler represen...
...tes an xpathnsresolver object. document.evaluate() evaluates an xpath expression. extension for html documents the document interface for html documents inherit from the htmldocument interface or, since html5, is extended for such documents: document.clear() in majority of modern browsers, including recent versions of firefox and internet explorer, this method does nothing. document.close() closes a document stream for writing. document.execcommand() on an editable document, executes a formating command. document.getelementsbyname() returns a list of elements with the given name. document.hasfocus() returns true if the focus is currently located anywhere inside the specified document. document.open() opens a document stream for writing. document.querycommandenabled() re...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
text node, all ws } /** * version of |previoussibling| that skips nodes that are entirely * whitespace or comments. (normally |previoussibling| is a property * of all dom nodes that gives the sibling node, the node that is * a child of the same parent, that occurs immediately before the * reference node.) * * @param sib the reference node. * @return either: * 1) the closest previous sibling to |sib| that is not * ignorable according to |is_ignorable|, or * 2) null if no such node exists. */ function node_before( sib ) { while ((sib = sib.previoussibling)) { if (!is_ignorable(sib)) return sib; } return null; } /** * version of |nextsibling| that skips nodes that are entirely * whitespace or comments. * * @param sib ...
...ble according to |is_ignorable|, or * 2) null if no such node exists. */ function node_before( sib ) { while ((sib = sib.previoussibling)) { if (!is_ignorable(sib)) return sib; } return null; } /** * version of |nextsibling| that skips nodes that are entirely * whitespace or comments. * * @param sib the reference node. * @return either: * 1) the closest next sibling to |sib| that is not * ignorable according to |is_ignorable|, or * 2) null if no such node exists. */ function node_after( sib ) { while ((sib = sib.nextsibling)) { if (!is_ignorable(sib)) return sib; } return null; } /** * version of |lastchild| that skips nodes that are entirely * whitespace or comments. (normally |lastchild| is a p...
Document Object Model (DOM) - Web APIs
aversal entity entityreference namelist notation typeinfo userdatahandler html dom a document containing html is described using the document interface, which is extended by the html specification to include various html-specific features. in particular, the element interface is enhanced to become htmlelement and various subclasses, each representing one of (or a family of closely related) elements. the html dom api provides access to various browser features such as tabs and windows, css styles and stylesheets, browser history, and so forth. these interfaces are discussed further in the html dom api documentation. svg interfaces svg element interfaces svgaelement svgaltglyphelement svgaltglyphdefelement svgaltglyphitemelement svganimationelement svgani...
...seelement svgunknownelement svgviewelement svgvkernelement svg data type interfaces here are the dom apis for data types used in the definitions of svg properties and attributes. ...
Event - Web APIs
Web › API › Event
bbling and capture settings of each handler triggered. interfaces based on event below is a list of interfaces which are based on the main event interface, with links to their respective documentation in the mdn api reference. note that all event interfaces have names which end in "event". ...
...nt). deprecated properties event.scoped read only a boolean indicating whether the given event will bubble across through the shadow root into the standard dom. use composed instead. methods event.composedpath() returns the event’s path (objects on which listeners will be invoked). this does not include nodes in shadow trees if the shadow root was created with its shadowroot.mode closed. event.preventdefault() cancels the event (if it is cancelable). event.stopimmediatepropagation() for this particular event, prevent all other listeners from being called. this includes listeners attached to the same element as well as those attached to elements that will be traversed later (during the capture phase, for instance). event.stoppropagation() stops the propagation of events...
HTMLCanvasElement.toBlob() - Web APIs
windows xp doesn't support converting from png to ico, so it uses bmp instead. a download link is created by setting the download attribute. the value of the download attribute is the name it will use as the file name. ...
...p;bpp=32'); save toblob to disk with os.file (chrome/add-on context only) this technique saves it to the desktop and is only useful in firefox chrome context or add-on code as os apis are not present on web sites. var canvas = document.getelementbyid('canvas'); var d = canvas.width; ctx = canvas.getcontext('2d'); ctx.beginpath(); ctx.moveto(d / 2, 0); ctx.lineto(d, d); ctx.lineto(0, d); ctx.closepath(); ctx.fillstyle = 'yellow'; ctx.fill(); function blobcallback(iconname) { return function(b) { var r = new filereader(); r.onloadend = function () { // r.result contains the arraybuffer. cu.import('resource://gre/modules/osfile.jsm'); var writepath = os.path.join(os.constants.path.desktopdir, iconname + '.ico'); var promise = os.fil...
HTMLDetailsElement: toggle event - Web APIs
html <aside id="log"> <b>open chapters:</b> <div data-id="ch1" hidden>i</div> <div data-id="ch2" hidden>ii</div> <div data-id="ch3" hidden>iii</div> </aside> <section id="summaries"> <b>chapter summaries:</b> <details id="ch1"> <summary>chapter i</summary> philosophy reproves boethius for the foolishness of his complaints against fortune. ...
... html <aside id="log"> <b>open chapters:</b> <div data-id="ch1" hidden>i</div> <div data-id="ch2" hidden>ii</div> <div data-id="ch3" hidden>iii</div> </aside> <section id="summaries"> <b>chapter summaries:</b> <details id="ch1"> <summary>chapter i</summary> philosophy reproves boethius for the foolishness of his complaints against fortune. ...
HTMLDialogElement.open - Web APIs
set, and therefore the dialog is shown. false means it not set, and therefore the dialog is not shown. the property is now read only — it is possible to set the value to programmatically show or hide the dialog. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or submit the form via the submit button. <!-- simple pop-up dialog box, containing a form --> <dialog id="favdialog"> <form method="dialog"> <section> <p><label for="favanimal">favorite animal:</label> <select id="favanimal" name="favanimal"> <option></option> <option>brine shrimp</option> ...
... <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>...
HTMLDialogElement.returnValue - Web APIs
the returnvalue property of the htmldialogelement interface gets or sets the return value for the <dialog>, usually to indicate which button the user pressed to close it. syntax dialoginstance.returnvalue = 'myreturnvalue'; var myreturnvalue = dialoginstance.returnvalue; value a domstring representing the returnvalue of the dialog. examples the following example displays a button to open a <dialog> containing a form via the showmodal() method. from there, either button will close the dialog. <!-- simple pop-up dialog box containing a form --> <dialog id="favdialog"> <form method="dialog"> <p><label>favorite animal: <select name="favanimal" required> <option></option> <option>brine shrimp</option> <option>red panda</option> ...
...tton id="updatedetails">update details</button> </menu> <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if (dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } function handleuserinput(returnvalue) { if (returnvalue === 'cancel' || returnvalue == null) { // user canceled the dialog, do nothing } else if (returnvalue === 'confirm') { // user chose a favorite animal, do something with it } } // “update details” button opens the <dialog> modally updatebutton.add...
HTMLDialogElement.show() - Web APIs
show() method of the htmldialogelement interface displays the dialog modelessly, i.e. still allowing interaction with content outside of the dialog. syntax dialoginstance.show(); parameters none. return value void. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the show() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or submit the form via the submit button. <!-- simple pop-up dialog box, containing a form --> <dialog id="favdialog"> <form method="dialog"> <section> <p><label for="favanimal">favorite animal:</label> <select id="favanimal" name="favanimal"> <option></option> <option>brine shrimp</option> ...
... <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>...
HTMLDialogElement.showModal() - Web APIs
ax dialoginstance.showmodal(); parameters none. return value void. exceptions if the dialog is already open (i.e. if the open attribute is already set on the <dialog> element), an invalidstateerror is thrown. examples the following example shows a simple button that, when clicked, opens a <dialog> containing a form via the showmodal() method. from there you can click the cancel button to close the dialog (via the htmldialogelement.close() method), or submit the form via the submit button. <!-- simple pop-up dialog box, containing a form --> <dialog id="favdialog"> <form method="dialog"> <section> <p><label for="favanimal">favorite animal:</label> <select id="favanimal" name="favanimal"> <option></option> <option>brine shrimp</option> ...
... <script> (function() { var updatebutton = document.getelementbyid('updatedetails'); var cancelbutton = document.getelementbyid('cancel'); var dialog = document.getelementbyid('favdialog'); dialog.returnvalue = 'favanimal'; function opencheck(dialog) { if(dialog.open) { console.log('dialog open'); } else { console.log('dialog closed'); } } // update button opens a modal dialog updatebutton.addeventlistener('click', function() { dialog.showmodal(); opencheck(dialog); }); // form cancel button closes the dialog box cancelbutton.addeventlistener('click', function() { dialog.close('animalnotchosen'); opencheck(dialog); }); })(); </script>...
Ajax navigation example - Web APIs
ef="third_page.php">third example</a> | <a class="ajax-nav" href="unexisting.php">unexisting page</a> ] </p> include/header.php: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="js/ajax_nav.js"></script> <link rel="stylesheet" href="css/style.css" /> js/ajax_nav.js: "use strict"; const ajaxrequest = new (function () { function closereq () { oloadingbox.parentnode && document.body.removechild(oloadingbox); bisloading = false; } function abortreq () { if (!bisloading) { return; } oreq.abort(); closereq(); } function ajaxerror () { alert("unknown error."); } function ajaxload () { var vmsg, nstatus = this.status; switch (nstatus) { ...
..."&" + sviewkey + "=" + sviewmode : "").slice(1)).replace(rendqstmark, ""); } function getpage (spage) { if (bisloading) { return; } oreq = new xmlhttprequest(); bisloading = true; oreq.onload = ajaxlo...
Location - Web APIs
Web › API › Location
t is a synonym for htmlhyperlinkelementutils.href, though it can't be used to modify the value. ...
...reate anchor element and use href property for the purpose of this example // a more correct alternative is to browse to the url and use document.location or window.location var url = document.createelement('a'); url.href = 'https://developer.mozilla.org:8080/search?q=url#search-results-close-container'; console.log(url.href); // https://developer.mozilla.org:8080/search?q=url#search-results-close-container console.log(url.protocol); // https: console.log(url.host); // developer.mozilla.org:8080 console.log(url.hostname); // developer.mozilla.org console.log(url.port); // 8080 console.log(url.pathname); // /search console.log(url.search); // ?q=url console.log(url.hash); // #search-results-close-container console.log(url.origin); // https://developer.mozilla.org:808...
MediaKeySession - Web APIs
this promise can only be fulfilled and is never rejected. closing a session means that licenses and keys associated with it are no longer valid for decrypting media data. mediakeysession.expiration read only the time after which the keys in the current session can no longer be used to decrypt media data, or nan if no such time exists. ...
...d by the cdm for the current media object and its associated keys or licenses. event handlers mediakeysession.onkeystatuseschange sets the eventhandler called when there has been a change in the keys in a session or their statuses. mediakeysession.onmessage sets the eventhandler called when the content decryption module has generated a message for the session. methods mediakeysession.close() returns a promise after notifying the current media session is no longer needed and that the cdm should release any resources associated with this object and close it. mediakeysession.generaterequest() returns a promise after generating a media request based on initialization data. mediakeysession.load() returns a promise that resolves to a boolean value after loading data for a specif...
MediaSource.readyState - Web APIs
open: the source is attached to a media element and ready to receive sourcebuffer objects. ended: the source is attached to a media element but the stream has been ended via a call to mediasource.endofstream(). syntax var myreadystate = mediasource.readystate; value a domstring. ...
...tream(). syntax var myreadystate = mediasource.readystate; value a domstring. ...
MediaSource - Web APIs
returns a sourcebufferlist object containing a subset of the sourcebuffer objects contained within mediasource.sourcebuffers — the list of objects providing the selected video track, enabled audio tracks, and shown/hidden text tracks. mediasource.readystate read only returns an enum representing the state of the current mediasource, whether it is not currently attached to a media element (closed), attached and ready to receive sourcebuffer objects (open), or attached but the stream has been ended via mediasource.endofstream() (ended.) mediasource.duration gets and sets the duration of the current media being presented. event handlers mediasource.onsourceclose the event handler for the sourceclose event. mediasource.onsourceended the event handler for the sourceended event. me...
...igation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource(); //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeven...
MediaStreamConstraints.video - Web APIs
as long as a video input device is available and the user allows it to be used, a video track will be included in the resulting stream, and it will match the specified constraints as well as possible. result specifications specification status comment media capture...
...20, 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. as long as a video input device is available and the user allows it to be used, a video track will be included in the resulting stream, and it will match the specified constraints as well as possible. result specifications specification status comment media capture and streamsthe definition of 'mediastreamconstraints.video' in ...
Notification - Web APIs
present, or future). notification.title read only the title of the notification as specified in the first parameter of the constructor. notification.vibrate read only specifies a vibration pattern for devices with vibration hardware to emit. event handlers notification.onclick a handler for the click event. it is triggered each time the user clicks on the notification. notification.onclose a handler for the close event. it is triggered when the user closes the notification. notification.onerror a handler for the error event. it is triggered each time the notification encounters an error. notification.onshow a handler for the show event. it is triggered when the notification is displayed. methods static methods these methods are available only on the notification object its...
...methods static methods these methods are available only on the notification object itself. notification.requestpermission() requests permission from the user to display notifications. instance methods these properties are available only on an instance of the notification object or through its prototype. the notification object also inherits from the eventtarget interface. notification.close() programmatically closes a notification instance. examples assume this basic html: <button onclick="notifyme()">notify me!</button> it's possible to send a notification as follows — here we present a fairly verbose and complete set of code you could use if you wanted to first check whether notifications are supported, then check if permission has been granted for the current origin to se...
PaymentResponse.complete() - Web APIs
this method must be called after the user accepts the payment request and the promise returned by the paymentrequest.show() method is resolved. syntax completepromise = paymentrequest.complete(result); parameters result optional a domstring indicating the state of the payment operation upon completion. it must be one of the following: success the payment was successfully processed. ...
...present any notification, even if it normally would. this is the default value. note: in older versions of the specification, an empty string, "", was used instead of unknown to indicate a completion without a known result state. see the browser compatibility section below for details. return value a promise which resolves with no input value once the payment interface has been fully closed. if an error occurs, the promise instead rejects, returning one of the exceptions listed below. exceptions aborterror the document in which the payment request is taking place became inactive while the user interface was shown. invalidstateerror the payment has already completed, or complete() was called while a request to retry the payment is pending. you can't treat a payment as complet...
PerformanceResourceTiming.responseEnd - Web APIs
example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
... example in the following example, the value of the *start and *end properties of all "resource" type events are logged. ...
Proximity Events - Web APIs
note: obviously, the api requires the device to have a proximity sensor, which are mostly available only on mobile devices. devices without such a sensor may support those events but will never fire them. proximity events when the device proximity sensor detects a change between the device and an object, it notifies the browser of that change. ...
...d (using the deviceproximity or userproximity event name) or by attaching an event handler to the window.ondeviceproximity or window.onuserproximity properties. once captured, the event object gives access to different kinds of information: the deviceproximityevent event provides an exact match for the distance between the device and the object through its value property. it also provides the closest and farthest distance the device is able to detect something through its min and max properties. the userproximityevent event provides a rough approximation of the distance, expressed through a boolean. the userproximityevent.near property is true if the object is close or false if the object is far. example window.addeventlistener('userproximity', function(event) { if (event.near) { ...
RTCDataChannel.send() - Web APIs
the send() method of the rtcdatachannel interface sends data across the data channel to the remote peer. this can be done any time except during the initial process of creating the underlying transport channel. data sent before connecting is buffered if possible (or an error occurs if it's not possible), and is also buffered if sent while the connection is closing or closed. different browsers have different limitations on the size of the message you can send. specifications exist to define how to automatically fragment large messages, but not all browsers implement them, and those that do have various additional restrictions. this will get less complicated over time, but for now, if you have questions, see understanding message size limits in using webrtc data channels. syntax rtcdatacha...
...ta channel uses a separate transport channel from the media content, it must establish its own connection; if it hasn't finished doing so (that is, its readystate is "connecting"), this error occurs without sending or buffering the data. networkerror the specified data would need to be buffered, and there isn't room for it in the buffer. in this scenario, the underlying transport is immediately closed. typeerror the specified data is too large for the other peer to receive. since there are multiple techniques for breaking up large data into smaller pieces for transfer, it's possible to encounter scenarios in which the other peer does not support the same ones. for example, if one peer is a modern browser that supports using the eor (end of record) flag to indicate when a received message is...
RTCPeerConnection: datachannel event - Web APIs
s example sets up a function that handles datachannel events by gathering the information needed to communicate with the newly added rtcdatachannel and by adding event handlers for the events that occur on that channel. pc.addeventlistener("datachannel", ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = myhandleopen; receivechannel.onclose = myhandleclose; }, false); receivechannel is set to the value of the event's channel property, which specifies the rtcdatachannel object representing the data channel linking the remote peer to the local one. this same code can also instead use the rtcpeerconnection interface's ondatachannel event handler property, like this: pc.ondatachannel = ev => { receivechannel = ev.channel; receiv...
..., which specifies the rtcdatachannel object representing the data channel linking the remote peer to the local one. this same code can also instead use the rtcpeerconnection interface's ondatachannel event handler property, like this: pc.ondatachannel = ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = myhandleopen; receivechannel.onclose = myhandleclose; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'datachannel' in that specification. candidate recommendation basic definition. ...
RTCPeerConnection.removeTrack() - Web APIs
event is sent to the rtcpeerconnection to let the local end know this negotiation must occur. syntax pc.removetrack(sender); parameters mediatrack a rtcrtpsender specifying the sender to remove from the connection. return value undefined. exceptions invalidstateerror the connection is not open. ...
...e connection is not open. example this example adds a video track to a connection and sets up a listener on a close button which removes the track when the user clicks the button. var pc, sender; navigator.getusermedia({video: true}, function(stream) { pc = new rtcpeerconnection(); var track = stream.getvideotracks()[0]; sender = pc.addtrack(track, stream); }); document.getelementbyid("closebutton").addeventlistener("click", function(event) { pc.removetrack(sender); pc.close(); }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.removetrack()' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.setRemoteDescription() - Web APIs
ged without losing the connection if the change does not succeed. see pending and current descriptions in webrtc connectivity for more details on this process. exceptions the following exceptions are reported to the rejection handler for the promise returned by setremotedescription(): invalidaccesserror the content of the description is invalid. invalidstateerror the rtcpeerconnection is closed, or it's in a state which isn't compatible with the specified description's type. for example, if the type is rollback and the signaling state is one of stable, have-local-pranswer, or have-remote-pranswer, this exception is thrown, because you can't roll back a connection that's either fully established or is in the final stage of becoming connected. operationerror any errors that occur which...
...deprecated form of the method returns instantaneously without waiting for the actual setting to be done: in case of success, the successcallback will be called; in case of failure, the errorcallback will be called. exceptions when using the deprecated callback-based version of setremotedescription(), the following exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place. invalidsessiondescriptionerror the rtcsessiondescription specified by the sessiondescription parameter is invalid. example here we see a function which handles an offer received from the remote peer. this code is derived from the example and tutorial in the article signaling and video calling; take a...
ReadableStream.ReadableStream() - Web APIs
mple, a custom readablestream is created using a constructor (see our simple random stream example for the full code). the start() function generates a random string of text every second and enqueues it into the stream. a cancel() fuction is also provided to stop the generation if readablestream.cancel() is called for any reason. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement(...
... living standard initial d...
ReadableStream.pipeThrough() - Web APIs
ther. data writen to the writable stream can be read in some transformed state by the readable stream. for example, a textdecoder, has bytes written to it and strings read from it, while a video decoder has encoded bytes written to it and uncompressed video frames read from it. options optional the options that should be used when piping to the writable stream. available options are: preventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. the method will return a fulfilled promise once this process completes, unless an error is encountered while closing the destination in which case it will be rejected with that error. preventabort: if this is set to true, errors in the source readablestream will no longer...
...rror, or with any error that occurs during aborting the destination. preventcancel: if this is set to true, errors in the destination writablestream will no longer cancel the source readablestream. in this case the method will return a promise rejected with the source’s error, or with any error that occurs during canceling the source. in addition, if the destination writable stream starts out closed or closing, the source readable stream will no longer be canceled. in this case the method will return a promise rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. signal: if set to an abortsignal object, ongoing pipe operations can then be aborted via the corresponding abortcontroller. return value the readable...
ReadableStream.pipeTo() - Web APIs
a stream will generally lock it for the duration of the pipe, preventing other readers from locking it. syntax var promise = readablestream.pipeto(destination[, options]); parameters destination a writablestream that acts as the final destination for the readablestream. options optional the options that should be used when piping to the writable stream. available options are: preventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. the method will return a fulfilled promise once this process completes, unless an error is encountered while closing the destination in which case it will be rejected with that error. preventabort: if this is set to true, errors in the source readablestream will no longer...
...rror, or with any error that occurs during aborting the destination. preventcancel: if this is set to true, errors in the destination writablestream will no longer cancel the source readablestream. in this case the method will return a promise rejected with the source’s error, or with any error that occurs during canceling the source. in addition, if the destination writable stream starts out closed or closing, the source readable stream will no longer be canceled. in this case the method will return a promise rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. signal: if set to an abortsignal object, ongoing pipe operations can then be aborted via the corresponding abortcontroller. return value a promise th...
ReadableStreamDefaultController.enqueue() - Web APIs
ated using a constructor (see our simple random stream example for the full code). the start() function generates a random string of text every second and enqueues it into the stream — see controller.enqueue(string). a cancel() function is also provided to stop the generation if readablestream.cancel() is called for any reason. when a button is pressed, the generation is stopped, the stream is closed using readablestreamdefaultcontroller.close(), and another function is run, which reads the data back out of the stream. const stream = new readablestream({ start(controller) { interval = setinterval(() => { let string = randomchars(); // add the string to the stream controller.enqueue(string); // show it on the screen let listitem = document.createelement(...
... living standard initial definiti...
ReadableStreamDefaultReader - Web APIs
the readablestreamdefaultreader interface of the streams api represents a default reader that can be used to read stream data supplied from a network (e.g. a fetch request). constructor readablestreamdefaultreader() creates and returns a readablestreamdefaultreader object instance. properties readablestreamdefaultreader.closed read only allows you to write code that responds to an end to the streaming process. returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors. methods readablestreamdefaultreader.cancel() cancels the stream, signaling a loss of interest in the stream by a consumer. the supplied reason argument will be given to the underlying source, which may or may not use it. readablestreamdefault...
...eam = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" return reader.read().then(({ done, value }) => { // is there no more data to read? ...
SVGAnimatedPathData - Web APIs
animatedpathseglist svgpathseglist provides access to the current animated contents of the 'd' attribute in a form which matches one-for-one with svg's syntax. if the given attribute or property is being animated, contains the current animated value of the attribute or property, and both the object itself and its contents are read only. ...
...ts contents are read only. normalizedpathseglist svgpathseglist provides access to the base (i.e., static) contents of the 'd' attribute in a form where all path data commands are expressed in terms of the following subset of svgpathseg types: svg_pathseg_moveto_abs (m), svg_pathseg_lineto_abs (l), svg_pathseg_curveto_cubic_abs (c) and svg_pathseg_closepath (z). pathseglist svgpathseglist provides access to the base (i.e., static) contents of the 'd' attribute in a form which matches one-for-one with svg's syntax. thus, if the d attribute has an "absolute moveto (m)" and an "absolute arcto (a)" command, then pathseglist will have two entries: a svg_pathseg_moveto_abs and a svg_pathseg_arc_abs. ...
SVGPathSeg - Web APIs
also implement none methods none properties unsigned short pathsegtype domstring pathsegtypeasletter constants pathseg_unknown = 0 pathseg_closepath = 1 pathseg_moveto_abs = 2 pathseg_moveto_rel = 3 pathseg_lineto_abs = 4 pathseg_lineto_rel = 5 pathseg_curveto_cubic_abs = 6 pathseg_curveto_cubic_rel = 7 pathseg_curveto_quadratic_abs = 8 pathseg_curveto_quadratic_rel = 9 pathseg_arc_abs = 10 pathseg_arc_rel = 11 ...
... constants name value description pathseg_unknown 0 the unit type is not one of predefined types. it is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. pathseg_closepath 1 corresponds to a "closepath" (z) path data command. pathseg_moveto_abs 2 corresponds to an "absolute moveto" (m) path data command. pathseg_moveto_rel 3 corresponds to a "relative moveto" (m) path data command. pathseg_lineto_abs 4 ...
ServiceWorkerGlobalScope: notificationclick event - Web APIs
cation() has been clicked. ...
...gth; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); or use the onnotificationclick event handler property: self.onnotificationclick = function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwi...
ShadowRoot.mode - Web APIs
Web › API › ShadowRoot › mode
the mode property of the shadowroot specifies its mode — either open or closed. this defines whether or not the shadow root's internal features are accessible from javascript. when the mode of a shadow root is "closed", the shadow root’s implementation internals are inaccessible and unchangeable from javascript—in the same way the implementation internals of, for example, the <video> element are inaccessible and unchangeable from javascript. syntax var mode = shadowroot.mode value a value defined in the shadowrootmode enum — either open or closed. ...
...ent are inaccessible and unchangeable from javascript. syntax var mode = shadowroot.mode value a value defined in the shadowrootmode enum — either open or closed. examples let customelem = document.queryselector('my-shadow-dom-element'); let shadow = customelem.shadowroot; // another way to check whether the shadow root is open; it will return null if not if(shadow) { // if it is open, close it to stop people stealing our secrets! shadow.mode = 'closed'; } specifications specification status comment domthe definition of 'shadowroot.mode' in that specification. living standard ...
Touch.radiusY - Web APIs
Web › API › Touch › radiusY
the value is in css pixels of the same scale as touch.screenx. this value, in combination with touch.radiusx and touch.rotationangle constructs an ellipse that approximates the size and shape of the area of contact between the user and the screen. this may be a large ellipse representing the contact between a fingertip and the screen or a small one representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. ...
...ertip and the screen or a small one representing the tip of a stylus, for example. note: this attribute has not been formally standardized. it is specified in the touch events – level 2 draft specification and not in touch events recommendation. this attribute is not widely implemented. syntax var yradius = touchitem.radiusy; return value yradius the y radius of the ellipse that most closely circumscribes the area of contact with the screen. example the touch.radiusx example includes an example of this property's usage. specifications specification status comment touch events – level 2 draft non-stable version. ...
Touch - Web APIs
Web › API › Touch
t on a touch-sensitive device. the contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. the touch.radiusx, touch.radiusy, and touch.rotationangle describe the area of contact between the user and the screen, the touch area. this can be helpful when dealing with imprecise pointing devices such as fingers. these values are set to describe an ellipse that as closely as possible matches the entire area of contact (such as the user's fingertip). note: many of the properties' values are hardware-dependent; for example, if the device doesn't have a way to detect the amount of pressure placed on the surface, the force value will always be 0. this may also be the case for radiusx and radiusy; if the hardware reports only a single point, these values will be ...
...enty, this value includes the vertical scroll offset, if any. touch.target read only returns the element on which the touch point started when it was first placed on the surface, even if the touch point has since moved outside the interactive area of that element or even been removed from the document. touch area touch.radiusx read only returns the x radius of the ellipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screenx. touch.radiusy read only returns the y radius of the ellipse that most closely circumscribes the area of contact with the screen. the value is in pixels of the same scale as screeny. touch.rotationangle read only returns the angle (in degrees) that the ellipse described by radiusx an...
Using Touch Events - Web APIs
y data indicates touch event support among mobile browsers is relatively broad, with desktop browser support lagging although additional implementations are in progress. some new features regarding a touch point's touch area - the area of contact between the user and the touch surface - are in the process of being standardized. the new features include the x and y radius of the ellipse that most closely circumscribes a touch point's contact area with the touch surface. the touch point's rotation angle - the number of degrees of rotation to apply to the described ellipse to align with the contact area - is also be standardized as is the amount of pressure applied to a touch point. what about pointer events? the introduction of new input mechanisms results in increased application complexity t...
...ified input model that can represent a contact point for a finger, pen/stylus or mouse. see the pointer events mdn article. the pointer event model can simplify an application's input processing since a pointer represents input from any input device. additionally, the pointer event types are very similar to mouse event types (for example, pointerdown pointerup) thus code to handle pointer events closely matches mouse handling code. the implementation status of pointer events in browsers is relatively high with chrome, firefox, ie11 and edge having complete implementations. examples and demos the following documents describe how to use touch events and include example code: touch events overview implement custom gestures introduction to touch events in javascript add touch screen suppo...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
ssion is to move data between two endpoints as efficiently as possible under current conditions. those conditions may be affected by everything from the underlying layers of the network stack to the physical network connection, the intervening networks, the performance of the remote endpoint, noise levels, traffic levels, and so forth. since rtp is simply a data transport, it is augmented by the closely-related rtp control protocol (rtcp), which is defined in rfc 3550, section 6. rtcp adds features including quality of service (qos) monitoring, participant information sharing, and the like. it isn't adequate for the purposes of fully managing users, memberships, permissions, and so forth, but provides the basics needed for an unrestricted multi-user communication session. the very fact that r...
... 3550, section 6. rtcp adds features including quality of service (qos) monitoring, participant information sharing, and the like. it isn't adequate for the purposes of fully managing users, memberships, permissions, and so forth, but provides the basics needed for an unrestricted multi-user communication session. the very fact that rtcp is defined in the same rfc as rtp is a clue as to just how closely-interrelated these two protocols are. capabilities of rtp rtp's primary benefits in terms of webrtc include: generally low latency. packets are sequence-numbered and time-stamped for reassembly if they arrive out of order. this lets data sent using rtp be delivered on transports that don't guarantee ordering or even guarantee delivery at all. this means rtp can be — but is not required...
Lifetime of a WebRTC session - Web APIs
er pigeon) to another device, entered into that device, and a response then output by that device to be returned on foot, and so forth, until the webrtc peer connection is open. it'd be very high latency but it could be done. information exchanged during signaling there are three basic types of information that need to be exchanged during signaling: control messages used to set up, open, and close the communication channel, and to handle errors. information needed in order to set up the connection: the ip addressing and port information needed for the peers to be able to talk to one another. media capability negotiation: what codecs and media data formats can the peers understand? these need to be agreed upon before the webrtc session can begin. only once signaling has been successfull...
..., for example. when this happens, the ice agent may choose to perform ice restart. this is a process by which the network connection is renegotiated, exactly the same way the initial ice negotiation is performed, with one exception: media continues to flow across the original network connection until the new one is up and running. then media shifts to the new network connection and the old one is closed. note: different browsers support ice restart under different sets of conditions. not all browsers will perform ice restart due to network congestion, for example. if you need to change the configuration of the connection in some way (such as changing to a different set of ice servers), you can do so before restarting ice by calling rtcpeerconnection.setconfiguration() with an updated rtccon...
WebRTC API - Web APIs
ntains information about a given contributing source (csrc) including the most recent time a packet that the source contributed was played out. events bufferedamountlow the amount of data currently buffered by the data channel—as indicated by its bufferedamount property—has decreased to be at or below the channel's minimum buffered data size, as specified by bufferedamountlowthreshold. close the data channel has completed the closing process and is now in the closed state. its underlying data transport is completely closed at this point. you can be notified before closing completes by watching for the closing event instead. closing the rtcdatachannel has transitioned to the closing state, indicating that it will be closed soon. you can detect the completion of the closing process ...
... connectionstatechange the connection's state, which can be accessed in connectionstate, has changed. datachannel a new rtcdatachannel is available following the remote peer opening a new data channel. this event's type is rtcdatachannelevent. error an rtcerrorevent indicating that an error occurred on the data channel. ...
Writing WebSocket client applications - Web APIs
s. this may happen if you attempt to use an insecure connection (most user agents now require a secure link for all websocket connections unless they're on the same device or possibly on the same network). connection errors if an error occurs while attempting to connect, first a simple event with the name error is sent to the websocket object (thereby invoking its onerror handler), and then the closeevent is sent to the websocket object (thereby invoking its onclose handler) to indicate the reason for the connection's closing. the browser may also output to its console a more descriptive error message as well as a closing code as defined in rfc 6455, section 7.4 through the closeevent. examples this simple example creates a new websocket, connecting to the server at wss://www.example.com/s...
...rite(text); document.getelementbyid("chatbox").contentwindow.scrollbypages(1); } }; here we use json.parse() to convert the json object back into the original object, then examine and act upon its contents. text data format text received over a websocket connection is in utf-8 format. closing the connection when you've finished using the websocket connection, call the websocket method close(): examplesocket.close(); it may be helpful to examine the socket's bufferedamount attribute before attempting to close the connection to determine if any data has yet to be transmitted on the network. if this value isn't 0, there's pending data still, so you may wish to wait before closing the connection. security considerations websockets should not be used in a mixed content environment; ...
Geometry and reference spaces in WebXR - Web APIs
how users can interact and explore it. a space will typically have foreground, mid-distance, and background elements. the right balance can create a unique presence and guide your user. the foreground includes objects and interfaces that you can interact with directly. the mid-distance includes objects you can interact with to some extent, or can approach in order to examine and engage with more closely. the background, on the other hand, is usually largely or entirely non-interactive, at least until and unless the user is able to approach it, bringing it into the mid-distance or foreground range. in webxr, the fundamental concept of a space—as in, a coordinate space in which a scene takes place—is represented by an instance of xrspace. the space is used to make determinations about the r...
...f -1.0 at the left edge of the space. the y-axis is positive extending upward from the origin toward the top of the screen, reaching +1.0 at the top of the world space. values of y less than 0 are found below the origin, extending toward the bottom of the screen and reaching -1.0 at the bottom of the world's space. the z-axis extends from the origin outward from the screen, reaching +1.0 at the closest point to the user in that direction. negative values of z extend away from the user further into the screen, with the farthest away point in the world having a z of -1.0. every object is, at the simplest level, a set of polygons defined by points in 3d space and an offset transform, indicating how to move and rotate the object to position it at the desired point in space. if the offset transf...
Using the Web Speech API - Web APIs
speech recognition service against a list of grammar (basically, the vocabulary you want to have recognised in a particular app.) when a word or phrase is successfully recognised, it is returned as a result (or list of results) as a text string, and further actions can be initiated as a result. the web speech api has a main controller interface for this — speechrecognition — plus a number of closely-related interfaces for representing grammar, results, etc. generally, the default speech recognition system available on the device will be used for the speech recognition — most modern oses have a speech recognition system for issuing voice commands. think about dictation on macos, siri on ios, cortana on windows 10, android speech, etc. note: on some browsers, like chrome, using speech re...
...tion(event) { diagnostic.textcontent = 'error occurred in recognition: ' + event.error; } speech synthesis speech synthesis (aka text-to-speech, or tts) involves receiving synthesising text contained within an app to speech, and playing it out of a device's speaker or audio output connection. the web speech api has a main controller interface for this — speechsynthesis — plus a number of closely-related interfaces for representing text to be synthesised (known as utterances), voices to be used for the utterance, etc. again, most oses have some kind of speech synthesis system, which will be used by the api for this task as available. demo to show simple usage of web speech synthesis, we've provided a demo called speak easy synthesis. this includes a set of form controls for entering t...
WorkerGlobalScope - Web APIs
e via the workerglobalscope.onoffline property. online fired when the browser has gained access to the network and the value of navigator.online switched to true. also available via the workerglobalscope.ononline property. languagechange fired at the global/worker scope object when the user's preferred languages change. also available via the workerglobalscope.onlanguagechange property. close is an eventhandler representing the code to be called when the close event is raised. also available via the workerglobalscope.onclose property. rejectionhandled an event handler for handled promise rejection events. also available via the workerglobalscope.onrejectionhandled property. unhandledrejection an event handler for unhandled promise rejection events. also available via t...
...x, sy) with width sw, and height sh. windoworworkerglobalscope.fetch() starts the process of fetching a resource from the network. windoworworkerglobalscope.setinterval() schedules a function to execute every time a given number of milliseconds elapses. windoworworkerglobalscope.settimeout() schedules a function to execute in a given amount of time. deprecated methods workerglobalscope.close() discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. in newer browser versions, close() is available on dedicatedworkerglobalscope and sharedworkerglobalscope instead. this change was made to stop close() being available on service workers, as it isn't supposed to be used there and always throws an exception when called (see bug 1336043). ...
WritableStreamDefaultWriter.ready - Web APIs
tablestreamdefaultwriter.ready; value a promise. example the following example shows two uses of the ready property. the first uses ready to ensure that the writablestream is done writing and thus able to receive data before sending a binary chunk. the second also checks whether the the writablestream is done writing, but this time because the writing must be finished before the writer can be closed. function sendmessage(message, writablestream) { // defaultwriter is of type writablestreamdefaultwriter var defaultwriter = writablestream.getwriter(); var encoder = new textencoder(); var encoded = encoder.encode(message, {stream: true}); encoded.foreach(function(chunk) { // make sure the stream and its writer are able to // receive data. defaultwriter.ready .then(...
...r.ready .then(function() { defaultwriter.write(chunk) .then(function() { console.log("chunk written to sink.); }) .catch(function(err) { console.log("chunk error: " + err); }); }); // call ready again to ensure that all chunks are written // before closing the writer. defaultwriter.ready .then(function() { defaultwriter.close() .then(function() { console.log("all chunks written"); }) .catch(function(err) { console.log("stream error: " + err); }); }); }); } specifications specification status comment streamsthe definition of 'ready' in that specification. living standard initial definition. browser compatibility the compatibility tabl...
Using XMLHttpRequest - Web APIs
); oreq.upload.addeventlistener("error", transferfailed); oreq.upload.addeventlistener("abort", transfercanceled); oreq.open(); note: progress events are not available for the file: protocol. note: starting in gecko 9.0, progress events can now be relied upon to come in for every chunk of data received, including the last chunk in cases in which the last packet is received and the connection closed before the progress event is fired. in this case, the progress event is automatically fired when the load event occurs for that packet. this lets you now reliably monitor progress by only watching the "progress" event. note: as of gecko 12.0, if your progress event is called with a responsetype of "moz-blob", the value of response is a blob containing the data received so far. one can also ...
...ans the request was not allowed to be performed. it was unsent. a likely cause for this is when the xmlhttprequest origin (at the creation of the xmlhttprequest) has changed when the xmlhttprequest is subsequently open(). this case can happen, for example, when one has an xmlhttprequest that gets fired on an onunload event for a window, the expected xmlhttprequest is created when the window to be closed is still there, and finally sending the request (in otherwords, open()) when this window has lost its focus and another window gains focus. the most effective way to avoid this problem is to set a listener on the new window's activate event which is set once the terminated window has its unload event triggered. workers setting overridemimetype does not work from a worker. see bug 678057 for mo...
XSL Transformations in Mozilla FAQ - Web APIs
discussion on bug #338621 for more information. it works in ie, but not in mozilla? there are even more differences. most come from what we suspect ie to do after the transformation. it (afaict) serializes and parses the output to generate what it actually renders. mozilla in contrast renders exactly the result of your transformation. can i do disable-output-escaping? this is actually pretty close to the question above. and in short, no. disabling output escaping requires us to add a parsing step to our output generation, which we don't. in most cases, there are pretty easy workarounds. the only use cases we have seen are bad xml or bad xslt. and rss feeds. the latter is pretty much the only issue to us, and we're sorry that we can't support it. but mixing parsing with xslt is brittle and ...
...-> </xsl:if> check system-properties.xml for the properties of your favorite system. msxml has an additional property. <xsl:if xmlns:msxsl="urn:schemas-microsoft-com:xslt" test="system-property('msxsl:version')=3"> <!-- msxml3 specific markup --> </xsl:if> what about media="print"? when printing a document, mozilla tries to render the page on paper as closely to what you see as possible. this includes stuff like text entered into textfields and other dynamic changes. this is achieved by printing the current dom tree. having xslt stylesheet specific to particular media would require to retransform the original xml source, which counteracts the expectations of the user. thus, using media in <?xml-stylesheet ?> is strongly discouraged. future builds mi...
Accessibility and Spacial Patterns - Accessibility
as animation. the mechanism for this is poorly understood, but is believed to be linked to "gamma oscillations" set up in the brain. these oscillations in the brain are a different kind of response than other kinds of neurological responses believed to cause photosensitive seizures. stripes and patterns are typical of the kinds of images that create problems, and stripes have been studied most closely. there's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. they can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. in 2005, arnold wilkins, john emmett, and graham harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. they revised the guideli...
...lustrator, for example, allows one to typeset ada braille for printing out. the ability to represent spatial patterns accurate to those who are blind is critical for accessibility. for example, knowing braille is not enough. the braille dots have to be spatially apart from one another so as to be readable in a "human" way. the human touch does distinguish with ease braille dots that are too close or too far apart from one another. space has to surround the braille character. a user of braille does not simply lay a finger on "top" of a braille character, the user has to move her finger over the character, in the way that a sighted person must move her eyes across text written on a page. the nature of space can change depending upon what mime type is being used, and its version. for e...
Perceivable - Accessibility
audio description tutorial is available yet. 1.2.2 provide captions for web-based video (a) you should provide captions for video presented on the web (e.g., html5 video). this is for the benefit of people who can't hear the audio part of the video. see video text tracks for html5 video captions, and other multimedia content for other technologies. see also add your own subtitles & closed captions (youtube). 1.2.3 provide text transcript or audio description for web-based video (a) you should provide text transcripts or audio descriptions for video presented on the web (e.g., html5 video. this is for the benefit of people who can't see the visual part of the video, and don't get the full content from the audio alone. see audio transcripts for transcript information...
...ing) to at least 0.12 times the font size word spacing to at least 0.16 times the font size understanding text spacing 1.4.13 content on hover or focus (aa) added in 2.1 while additional content may appear and disappear in coordination with hover and keyboard focus, this success criterion specifies three conditions that must be met: dismissable (can be closed/removed) hoverable (the additional content does not disappear when the pointer is over it) persistent (the additional content does not disappear without user action) understanding content on hover or focus note: also see the wcag description for guideline 1.4: distinguishable: make it easier for users to see and hear content including separating foreground from bac...
font-weight - CSS: Cascading Style Sheets
600 semi bold (demi bold) 700 bold 800 extra bold (ultra bold) 900 black (heavy) variable fonts most fonts have a particular weight which corresponds to one of the numbers in common weight name mapping. however some fonts, called variable fonts, can support a range of weights with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. for truetype or opentype variable fonts, the "wght" variation is used to implement varying weights. accessibility concerns people experiencing low vision conditions may have difficulty reading text set with a font-weight value of 100 (thin/hairline) or 200 (extra light), especially if the font has a low contrast color ratio. mdn understanding wcag,...
...st color ratio. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.8 | w3c understanding wcag 2.0 formal definition related at-rule@font-faceinitial valuenormalcomputed valueas specified formal syntax <font-weight-absolute>{1,2}where <font-weight-absolute> = normal | bold | <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[1,1000]> examples setting normal font weight in a @font-face rule the following finds a local open sans font or import it, and allows using the font for normal font weights. @font-face { font-family: "open sans"; src: local("open sans") format("woff2"), url("/fonts/opensans-regular-webfont.woff...
@import - CSS: Cascading Style Sheets
Web › CSS › @import
'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '...
...'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>where <mf-name> = <ident><mf-value> = <number> | <dimension> | <ident>...
@media - CSS: Cascading Style Sheets
Web › CSS › @media
'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '...
...'='? <mf-value> | <mf-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? <mf-value>where <mf-name> = <ident><mf-value> = <number> | <dimension> | <ident>...
Shapes from box values - CSS: Cascading Style Sheets
the outside of the border. you still have a border, even if you have not used the css border property. in this case it will be the same as padding-box, the shape defined by the outside padding edge. in the example below you can see how the text now follows the line created by the border. change the border size and the content follows it. padding-box the padding-box value defines the shape enclosed by the outside padding edge. this shape follows all of the normal border radius shaping rules for the inside of the border. if you have no padding then padding-box is the same as content-box. content-box the content-box value defines the shape enclosed by the outside content edge. each corner radius of this box is the larger of 0 or border-radius − border-width − padding. this means that...
...ed using the well-supported border-radius property. the examples shown above show one such use case. you can create a circular shape using border-radius and then curve text around it. you can create some interesting effects however with just this simple technique. in my final example of this section, i have floated two elements left and right, giving each a border-radius of 100% in the direction closest to the text. for more complex shapes you will need to use one of the basic shapes as a value, or define your shape from an image as covered in other guides in this section. ...
Overview of CSS Shapes - CSS: Cascading Style Sheets
they do have shapes support then the visual display is enhanced. basic shapes the value circle(50%) is an example of a basic shape. the specification defines four <basic-shape> values, which are: inset() circle() ellipse() polygon() using the value inset() wraps text around a rectangular shape however you are able to add offset values, thus pulling the line boxes of any wrapping content closer to the object than would otherwise happen. we have already seen how circle() creates a circular shape. an ellipse() is essentially a squashed circle. if none of these simple shapes do the trick you can create a polygon() and make the shape as complex as you want. in our guide to basic shapes we explore each of the possible basic shapes and how to create them. shapes from the box value shapes...
...ant. in our guide to basic shapes we explore each of the possible basic shapes and how to create them. shapes from the box value shapes can also be created around the box value, therefore you could create your shape on the: border-box padding-box content-box margin-box in the example below you can change the value border-box to any of the other allowed values to see how the shape moves closer or further away from the box. to explore the box values in more detail see our guide covering shapes from box values. shapes from images an interesting way to generate your path is to use an image with an alpha channel — the text will then wrap around the non-transparent parts of the image. this allows the overlay of wrapped content around an image, or the use of an image which is never d...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
div{ color: black; -moz-appearance: media-seek-back-button; -webkit-appearance: media-seek-back-button; } <div>lorem</div> safari edge media-seek-forward-button div{ color: black; -moz-appearance: media-seek-forward-button; -webkit-appearance: media-seek-forward-button; } <div>lorem</div> safari edge media-toggle-closed-captions-button div{ color: black; -webkit-appearance: media-toggle-closed-captions-button; } <div>lorem</div> chrome safari media-slider div{ color: black; -webkit-appearance: media-slider; } <div>lorem</div> chrome safari edge media-sliderthumb div{ color: black; -webkit-appearance: media-...
... 64. -moz-win-exclude-glass firefox removed in firefox 64. -moz-win-glass firefox removed in firefox 64. -moz-win-media-toolbox firefox removed in firefox 64. -moz-window-button-box firefox removed in firefox 64. -moz-window-button-box-maximized firefox removed in firefox 64. -moz-window-button-close firefox removed in firefox 64. -moz-window-button-maximize firefox removed in firefox 64. -moz-window-button-minimize firefox removed in firefox 64. -moz-window-button-restore firefox removed in firefox 64. -moz-window-frame-bottom firefox removed in firefox 64. -moz-window-frame-left firefox ...
background-image - CSS: Cascading Style Sheets
ne or more background images on an element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the background images are drawn on stacking context layers on top of each other. the first layer specified is drawn as if it is closest to the user. the borders of the element are then drawn on top of them, and the background-color is drawn beneath them. how the images are drawn relative to the box and its borders is defined by the background-clip and background-origin css properties. if a specified image cannot be drawn (for example, when the file denoted by the specified uri cannot be loaded), browsers handle it as they wou...
... [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
<basic-shape> - CSS: Cascading Style Sheets
<string>) the optional <fill-rule> represents the filling rule used to determine the interior of the path. possible values are nonzero and evenodd. default value when omitted is nonzero. the required <string> is an svg path string encompassed in quotes the arguments not defined above are defined as follows: <shape-arg> = <length> | <percentage> <shape-radius> = <length> | <percentage> | closest-side | farthest-side defines a radius for a circle or ellipse. if omitted it defaults to closest-side. closest-side uses the length from the center of the shape to the closest side of the reference box. for circles, this is the closest side in any dimension. for ellipses, this is the closest side in the radius dimension. farthest-side uses the length from the center of the shape to the farth...
...ow are applied. the values in the shape functions interpolate as a simple list. the list values interpolate as <length>, <percentage>, or calc() where possible. if list values are not one of those types but are identical, those values do interpolate. both shapes must use the same reference box. if both shapes are the same type, that type is ellipse() or circle(), and none of the radii use the closest-side or farthest-side keywords, interpolate between each value in the shape functions. if both shapes are of type inset(), interpolate between each value in the shape functions. if both shapes are of type polygon(), both polygons have the same number of vertices, and use the same <fill-rule>, interpolate between each value in the shape functions. if both shapes are of type path(), both paths...
font-weight - CSS: Cascading Style Sheets
bold 800 extra bold (ultra bold) 900 black (heavy) 950 extra black (ultra black) variable fonts most fonts have a particular weight which corresponds to one of the numbers in common weight name mapping. however some fonts, called variable fonts, can support a range of weights with a more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. for truetype or opentype variable fonts, the "wght" variation is used to implement varying widths. for the example below to work, you'll need a browser that supports the css fonts level 4 syntax in which font-weight can be any number between 1 and 1000. html <header> <input type="range" id="weight" name="weight" min="1" max="1000" /> <labe...
...lements. ...
list-style-type - CSS: Cascading Style Sheets
tibetan * example trad-chinese-formal traditional chinese formal numbering. e.g. 壹萬壹仟壹佰壹拾壹 trad-chinese-informal traditional chinese informal numbering. e.g. 一萬一千一百一十一 upper-armenian * example disclosure-open symbol indicating that a disclosure widget such as <details> is opened. disclosure-closed symbol indicating that a disclosure widget, like <details> is closed. non-standard extensions a few more predefined types are provided by mozilla (firefox), blink (chrome and opera) and webkit (safari) to support list types in other languages. see the compatibility table to check which browsers supports which extension. -moz-ethiopic-halehame example -moz-ethiopic-ha...
...ounter-style rules. defines using @counter-style the usual style types: hebrew, cjk-ideographic, hiragana, hiragana-iroha, katakana, katakana-iroha, japanese-formal, japanese-informal, simp-chinese-formal, trad-chinese-formal, simp-chinese-formal, trad-chinese-formal,korean-hangul-formal, korean-hanja-informal, korean-hanja-formal, cjk-decimal, ethiopic-numeric, disclosure-open and disclosure-closed. extends <counter-style> with the symbols() functional notation. css lists module level 3the definition of 'list-style-type' in that specification. working draft modify syntax to support for identifiers used in @counter-style rules to keywords. support for a simple <string>. css level 2 (revision 1)the definition of 'list-style-type' in that specification. reco...
mask - CSS: Cascading Style Sheets
Web › CSS › mask
ask positioned 40px from the top and 20px from the left */ mask: url(masks.svg#star) 0 0/50px 50px; /* element within svg graphic used as mask with a width and height of 50px */ mask: url(masks.svg#star) repeat-x; /* element within svg graphic used as horizontally repeated mask */ mask: url(masks.svg#star) stroke-box; /* element within svg graphic used as mask extending to the box enclosed by the stroke */ mask: url(masks.svg#star) exclude; /* element within svg graphic used as mask and combined with background using non-overlapping parts */ /* global values */ mask: inherit; mask: initial; mask: unset; /* multiple masks */ mask: url(masks.svg#star) left / 16px repeat-y, /* element within svg graphic is used as a mask on the left-hand side with a width of 16px */ ...
... [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<angular-color-stop-list> = [ <angular-color-stop> [, <angular-color-hint>]? ]# , <angular-color-stop>where <alpha-value> = <number> | <percentage><hue> = <number> | <angle><linear-color-stop> = <color> <color-stop-length>?<linear-color-hint> = <length-percentage><angular-color-stop> = <color> && <color-s...
offset - CSS: Cascading Style Sheets
Web › CSS › offset
ired for animating an element along a defined path. note: early versions of the spec called this property motion. ...
...n */ offset: auto; offset: 10px 30px; offset: none; /* offset path */ offset: ray(45deg closest-side); offset: path('m 100 100 l 300 100 l 200 300 z'); offset: url(arc.svg); /* offset path with distance and/or rotation */ offset: url(circle.svg) 100px; offset: url(circle.svg) 40%; offset: url(circle.svg) 30deg; offset: url(circle.svg) 50px 20deg; /* including offset anchor */ offset: ray(45deg closest-side) / 40px 20px; offset: url(arc.svg) 2cm / 0.5cm 3cm; offset: url(arc.svg) 30deg / 50px 100px; formal definition initial valueas each of the properties of the shorthand:offset-position: autooffset-path: noneoffset-distance: 0offset-anchor: autooffset-rotate: autoapplies totransformable elementsinheritednopercentagesas each of the properties of the shorthand:offset-position: refertosizeofc...
Rich-Text Editing in Mozilla - Developer guides
ocus(); } function printdoc() { if (!validatemode()) { return; } var oprntwin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oprntwin.document.open(); oprntwin.document.write("<!doctype html><html><head><title>print<\/title><\/head><body onload=\"print();\">" + odoc.innerhtml + "<\/body><\/html>"); oprntwin.document.close(); } </script> <style type="text/css"> .intlink { cursor: pointer; } img.intlink { border: 0; } #toolbar1 select { font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overflow: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body o...
... note: if you want to see how to standardize the creation and the insertion of your editor in your page, please see our more complete rich-text editor example. resources mozilla.org's rich-text editing specification mozilla.org's rich-text editing demo converting an app using document.designmode from ie to mozilla at mozilla.org designmode msdn: how to create an html editor application a closed source, cross-browser rich-text editing demo xbdesignmode; a javascript helper class for easier cross-browser development using designmode. firefox 3 and contenteditable original document information author(s): doron rosenberg, netscape communications published: 04 apr 2003 revised: 01 jul 2003 revised: 24 apr 2005, joel coreson revised: 28 nov 2006, ken kuhns, computronicsusa revis...
Date and time formats used in HTML - HTML: Hypertext Markup Language
y 4 but not by 100. although the calendar year is normally 365 days long, it actually takes the planet earth approximately 365.2422 days to complete a single orbit around the sun. leap years help to adjust the calendar to keep it synchronized with the actual position of the planet in its orbit. adding a day to the year every four years essentially makes the average year 365.25 days long, which is close to correct. the adjustments to the algorithm (taking a leap year when the year can be divided by 400, and skipping leap years when the year is divisible by 100) help to bring the average even closer to the correct number of days (365.2425 days). scientists occasionally add leap seconds to the calendar (seriously) to handle the remaining three ten-thousandths of a day and to compensate for the gr...
...ne in which it occurs. a valid global date and time string is the same format as a local date and time string, except it has a time zone string appended to the end, following the time. time zone offset string a time zone offset string specifies the offset in either a positive or a negative number of hours and minutes from the standard time base. there are two standard time bases, which are very close to the same, but not exactly the same: for dates after the establishment of coordinated universal time (utc) in the early 1960s, the time base is z and the offset indicates a particular time zone's offset from the time at the prime meridian at 0º longitude (which passes through the royal observatory at greenwich, england). for dates prior to utc, the time base is instead expressed in terms o...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
ss html { font-family: sans-serif; } canvas { background: #fff; border: 1px dashed; } a { display: inline-block; background: #69c; color: #fff; padding: 5px 10px; } javascript var canvas = document.queryselector('canvas'), c = canvas.getcontext('2d'); c.fillstyle = 'hotpink'; function draw(x, y) { if (isdrawing) { c.beginpath(); c.arc(x, y, 10, 0, math.pi*2); c.closepath(); c.fill(); } } canvas.addeventlistener('mousemove', event => draw(event.offsetx, event.offsety) ); canvas.addeventlistener('mousedown', () => isdrawing = true); canvas.addeventlistener('mouseup', () => isdrawing = false); document.queryselector('a').addeventlistener('click', event => event.target.href = canvas.todataurl() ); result security and privacy <a> elements can hav...
...h as a touchscreen. a minimum size of 44×44 css pixels is recommended. text-only links in prose content are exempt from this requirement, but it’s still a good idea to make sure enough text is hyperlinked to be easily activated. understanding success criterion 2.5.5: target size target size and 2.5.5 quick test: large touch targets proximity interactive elements, like links, placed in close visual proximity should have space separating them. spacing helps people with motor control issues, who may otherwise accidentally activate the wrong interactive content. spacing may be created using css properties like margin. hand tremors and the giant-button-problem specifications specification status comment referrer policythe definition of 'referrer attribu...
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
f align is not set to char, this attribute is ignored. charoff this attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. valign this attribute specifies the vertical alignment of the text within each cell of the column. ...
...bute specifies the vertical alignment of the text within each cell of the column. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. note: do not try to set the vertical-align property on a selector giving a <col> element. because <td> elements are not descendant of the <col> element, they won't inherit it. if the table doesn't use a cols...
<colgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › colgroup
the <col> which are members of this column group. charoff this attribute is used to indicate the number of characters to offset the column data from the alignment character specified by the char attribute. valign this attribute specifies the vertical alignment of the text within each cell of the column. ...
...bute specifies the vertical alignment of the text within each cell of the column. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. note: do not try to set the vertical-align property on a selector giving a <colgroup> element. because <td> elements are not descendant of the <colgroup> element, they won't inherit it. if the table doesn't...
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
dance."></textarea> </div> <input type="submit" value="send request"> </form> our <form> contains one <input> of type email for the user's e-mail address, a <textarea> to enter their message for it into, and an <input> of type "submit", which creates a button to submit the form. each text entry box has a <label> associated with it to let the user know what's expected of them. let's take a closer look at the e-mail address entry box. its size and maxlength attributes are both set to 64 in order to show room for 64 characters worth of e-mail address, and to limit the number of characters actually entered to a maximum of 64. the required attribute is specified, making it mandatory that a valid e-mail address be provided. an appropriate placeholder is provided—username@beststartupever.co...
...we want to go one step farther: we want to make sure that the e-mail address is in fact in the form "username@beststartupever.com". this is where we'll use pattern. we set pattern to .+@beststartupever.com. this simple regular expression requests a string that consists of at least one character of any kind, then an "@" followed by the domain name "beststartupever.com". note that this is not even close to an adequate filter for valid e-mail addresses; it would allow things such as " @beststartupever.com" (note the leading space) or "@@beststartupever.com", neither of which is valid. however, the browser runs both the standard e-mail address filter and our custom pattern against the specified text. as a result, we wind up with a validation which says "make sure this resembles a valid e-mail addr...
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. the default stepping value for number inputs is 1, allowing only integers to be entered—unless the stepping base is not an integer. using number inputs <input type="number"> elements can help simplify your work when building the user interface and logic for entering numbers into a form. when you create a number input with the proper type value, number, you get automatic validation...
......
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
Web › HTML › Element › kbd
verride your css. examples basic example <p>use the command <kbd>help mycommand</kbd> to view documentation for the command "mycommand".</p> representing keystrokes within an input to describe an input comprised of multiple keystrokes, you can nest multiple <kbd> elements, with an outer <kbd> element representing the overall input and each individual keystroke or component of the input enclosed within its own <kbd>. unstyled first, let's look at what this looks like as just plain html. html <p>you can also create a new document using the keyboard shortcut <kbd><kbd>ctrl</kbd>+<kbd>n</kbd></kbd>.</p> this wraps the entire key sequence in an outer <kbd> element, then each individual key within its own, in order to denote the components of the sequence. note: you don't need to do a...
... the "file" menu using html that looks like this: <p>to create a new file, choose the menu option <kbd><kbd><samp>file</samp></kbd>⇒<kbd><samp>new document</samp></kbd></kbd>.</p> <p>don't forget to click the <kbd><samp>ok</samp></kbd> button to confirm once you've entered the name of the new file.</p> this does some interesting nesting. for the menu option description, the entire input is enclosed in a <kbd> element. then, inside that, both the menu and menu item names are contained within both <kbd> and <samp>, indicating an input which is selected from a screen widget. result specifications specification status comment html living standardthe definition of '<kbd>' in that specification. living standard html5the definition of '<kbd>' in t...
<summary>: The Disclosure Summary element - HTML: Hypertext Markup Language
Web › HTML › Element › summary
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... dom interface htmlelement attributes this element only includes the global attributes. usage notes the <summary> element's contents can be any heading content, plain text, or html that can be used within a paragraph. a <summary> element may only be used as the first child of a <details> element. when the user clicks on the summary, the parent <details> element is toggled open or closed, and then a toggle event is sent to the <details> element, which can be used to let you know when this state change occurs. default label text if a <details> element's first child is not a <summary> element, the user agent will use a default string (typically "details") as the label for the disclosure box. default style per the html specification, the default style for <summary> elements inc...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
et to char, this attribute is ignored. charoff this attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. valign this attribute specifies the vertical alignment of the text within each row of cells of the table header. ...
... the vertical alignment of the text within each row of cells of the table header. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. as this attribute is deprecated, use the css vertical-align property instead. usage notes if the table includes a <thead> block (to semantically identify header rows), the <tbody> block must come after it. ...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
om the alignment characters specified by the char attribute. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. valign deprecated since html4obsolete since html5 this attribute specifies the vertical alignment of the text within each row of cells of the table header. ...
... the vertical alignment of the text within each row of cells of the table header. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the text as close to the top of the cell as it is possible. note: do not use this attribute as it is obsolete (and not supported) in the latest standard: instead set the css vertical-align property on it. examples please see the <table> page for examples on <tfoot>. s...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
the column data from the alignment characters specified by the char attribute. note: do not use this attribute as it is obsolete (and not supported) in the latest standard. valign in html 4, in html5 this attribute specifies the vertical alignment of the text within each row of cells of the table header. ...
... the vertical alignment of the text within each row of cells of the table header. possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. if characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; top, which will put the text as close to the top of the cell as it is possible. note: do not use this attribute as it is obsolete (and not supported) in the latest standard: instead set the css vertical-align property on it. examples see <table> for examples on <thead>. specifications ...
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
ly aligned on the decimal points, with the number of cents properly displayed to the right of the decimal point. this attribute is obsolete, and was never widely supported anyway. valignobsolete since html5 a domstring specifying the vertical alignment of the text within each cell in the row. possible values for this attribute are: baseline aligns each cell's content text as closely as possible to the bottom of the cell, handling alignment of different fonts and font sizes by aligning the characters along the baseline of the font(s) used in the row. if all of the characters in the row are the same size, the effect is the same as bottom. bottom, draws the text in each of the row's cells as closely as possible to the bottom edge of those cells. middle each cell's tex...
... don't use the obsolete valign attribute. ...
Connection - HTTP
connection-specific header fields such as connection and keep-alive are prohibited in http/2. chrome and firefox ignore them in http/2 responses, but safari conforms to the http/2 spec requirements and won’t load any response which contains them. ...
...p-by-hop headers used by the message must be listed in the connection header, so that the first proxy knows it has to consume them and not forward them further. standard hop-by-hop headers can be listed too (it is often the case of keep-alive, but this is not mandatory). header type general header forbidden header name yes syntax connection: keep-alive connection: close directives close indicates that either the client or the server would like to close the connection. this is the default on http/1.0 requests. any comma-separated list of http headers [usually keep-alive only] indicates that the client would like to keep the connection open. having a persistent connection is the default on http/1.1 requests. the list of headers are the name of the header t...
Forwarded - HTTP
deploying this header. header type request header forbidden header name no syntax forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https> directives <identifier> an identifier disclosing the information that is altered or lost when using a proxy. this can be either: an ip address (v4 or v6, optionally with a port, and ipv6 quoted and enclosed in square brackets), an obfuscated identifier (such as "_hidden" or "_secret"), or "unknown" when the preceding entity is not known (and you still want to indicate that forwarding of the request was made). by=<identifier> the interface where the request came in to the proxy server. for=<identifier> the client that initiated the request and subsequent proxies in a chain of proxies. h...
... x-forwarded-for: 123.34.567.89 forwarded: for=123.34.567.89 x-forwarded-for: 192.0.2.43, "[2001:db8:cafe::17]" forwarded: for=192.0.2.43, for="[2001:db8:cafe::17]" specifications specification title rfc 7239, section 4: forwarded forwarded http extension ...
Index - HTTP
Web › HTTP › Headers › Index
with the requesting website. it allows web developers to have more control over the data stored locally by a browser for their origins. 21 connection http, headers, reference, web the connection general header controls whether or not the network connection stays open after the current transaction finishes. if the value sent is keep-alive, the connection is persistent and not closed, allowing for subsequent requests to the same server to be done. 22 content-disposition http, reference, header in a multipart/form-data body, the http content-disposition general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to. the subpart is delimited by the boundary defined in the content-type header...
...g when served with a 3xx (redirection) or 201 (created) status response. 87 origin http, reference, header the origin request header indicates where a fetch originates from. it doesn't include any path information, but only the server name. it is sent with cors requests, as well as with post requests. it is similar to the referer header, but, unlike this header, it doesn't disclose the whole path. 88 pragma caching, deprecated, http, header, request the pragma http/1.0 general header is an implementation-specific header that may have various effects along the request-response chain. it is used for backwards compatibility with http/1.0 caches where the cache-control http/1.1 header is not yet present. 89 proxy-authenticate http, http heade...
Link - HTTP
Web › HTTP › Headers › Link
the http link entity-header field provides a means for serialising one or more links in http headers. it is semantically equivalent to the html <link> element. syntax link: < uri-reference >; param1=value1; param2="value2" <uri-reference> the uri reference, must be enclosed between < and >. parameters the link header contains parameters, which are separated with ; and are equivalent to attributes of the <link> element. ...
... in http headers. it is semantically equivalent to the html <link> element. syntax link: < uri-reference >; param1=value1; param2="value2" <uri-reference> the uri reference, must be enclosed between < and >. parameters the link header contains parameters, which are separated with ; and are equivalent to attributes of the <link> element. ...
Set-Cookie - HTTP
http-date timestamp. see date for the required formatting. if unspecified, the cookie becomes a session cookie. a session finishes when the client shuts down, and session cookies will be removed. warning: many web browsers have a session restore feature that will save all tabs and restore them next time the browser is used. session cookies will also be restored, as if the browser was never closed. when an expires date is set, the deadline is relative to the client the cookie is being set on, not the server. max-age=<number> optional number of seconds until the cookie expires. a zero or negative number will expire the cookie immediately. if both expires and max-age are set, max-age has precedence. domain=<domain-value> optional host to which the cookie will be sent. if omitt...
...s needed to be sent cross-origin, opt out of the samesite restriction using the none value. the none value requires the secure attribute. examples session cookie session cookies are removed when the client shuts down. cookies are session cookies if they don't specify the expires or max-age attributes. set-cookie: sessionid=38afes7a8 permanent cookie instead of expiring when the client is closed, permanent cookies expire at a specific date (expires) or after a specific length of time (max-age). set-cookie: id=a3fwa; expires=wed, 21 oct 2015 07:28:00 gmt set-cookie: id=a3fwa; max-age=2592000 invalid domains a cookie for a domain that does not include the server that set it should be rejected by the user agent. the following cookie will be rejected if set by a server hosted on origi...
Network Error Logging - HTTP
ed by previous errors (e.g. servfail) dns.address_changed for security reasons, if the server ip address that delivered the original report is different to the current server ip address at time of error generation, the report data will be downgraded to only include information about this problem and the type set to dns.address_changed. ...
...vfail) dns.address_changed for security reasons, if the server ip address that delivered the original report is different to the current server ip address at time of error generation, the report data will be downgraded to only include information about this problem and the type set to dns.address_changed. ...
An overview of HTTP - HTTP
Web › HTTP › Overview
tcp standard, which is connection-based. before a client and server can exchange an http request/response pair, they must establish a tcp connection, a process which requires several round-trips. the default behavior of http/1.0 is to open a separate tcp connection for each http request/response pair. this is less efficient than sharing a single tcp connection when multiple requests are sent in close succession. in order to mitigate this flaw, http/1.1 introduced pipelining (which proved difficult to implement) and persistent connections: the underlying tcp connection can be partially controlled using the connection header. http/2 went a step further by multiplexing messages over a single connection, helping keep the connection warm and more efficient. experiments are in progress to design ...
...ttp/1.1 host: developer.mozilla.org accept-language: fr read the response sent by the server, such as: http/1.1 200 ok date: sat, 09 oct 2010 14:28:02 gmt server: apache last-modified: tue, 01 dec 2009 20:18:22 gmt etag: "51142bc1-7449-479b075b2891b" accept-ranges: bytes content-length: 29769 content-type: text/html <!doctype html... (here comes the 29769 bytes of the requested web page) close or reuse the connection for further requests. if http pipelining is activated, several requests can be sent without waiting for the first response to be fully received. http pipelining has proven difficult to implement in existing networks, where old pieces of software coexist with modern versions. http pipelining has been superseded in http/2 with more robust multiplexing requests within a fra...
Regular expression syntax cheatsheet - JavaScript
er is preceded by the minus sign. groups and ranges if you are looking to contribute to this document, please also edit the original article characters meaning x|y matches either "x" or "y". for example, /green|red/ matches "green" in "green apple" and "red" in "red apple". [xyz] [a-c] a character set. matches any one of the enclosed characters. you can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. it is also possible to include a character class in a character set. for example, [abcd] is the same as [a-d]. they match the "b" in "brisket", ...
...p". for example, [abcd-] and [-abcd] match the "b" in "brisket", the "c" in "chop", and the "-" (hyphen) in "non-profit". for example, [\w-] is the same as [a-za-z0-9_-]. they both match the "b" in "brisket", the "c" in "chop", and the "n" in "non-profit". [^xyz] [^a-c] a negated or complemented character set. that is, it matches anything that is not enclosed in the brackets. you can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. for example, [^abc] is the same as [^a-c]. they initially match "o" in "bacon" and "h" in "chop". the ^ character may also indicate th...
Groups and ranges - JavaScript
ps and ranges of expression characters. types the following section is also duplicated on this cheatsheet. do not forget to edit it as well, thanks! characters meaning x|y matches either "x" or "y". for example, /green|red/ matches "green" in "green apple" and "red" in "red apple". [xyz] [a-c] a character set. matches any one of the enclosed characters. you can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. it is also possible to include a character class in a character set. for example, [abcd] is the same as [a-d]. they match the "b" in "brisket", ...
...p". for example, [abcd-] and [-abcd] match the "b" in "brisket", the "c" in "chop", and the "-" (hyphen) in "non-profit". for example, [\w-] is the same as [a-za-z0-9_-]. they both match the "b" in "brisket", the "c" in "chop", and the "n" in "non-profit". [^xyz] [^a-c] a negated or complemented character set. that is, it matches anything that is not enclosed in the brackets. you can specify a range of characters by using a hyphen, but if the hyphen appears as the first or last character enclosed in the square brackets it is taken as a literal hyphen to be included in the character set as a normal character. for example, [^abc] is the same as [^a-c]. they initially match "o" in "bacon" and "h" in "chop". the ^ character may also indicate th...
Regular expressions - JavaScript
e also objects. these patterns are used with the exec() and test() methods of regexp, and with the match(), matchall(), replace(), replaceall(), search(), and split() methods of string. this chapter describes javascript regular expressions. creating a regular expression you construct a regular expression in one of two ways: using a regular expression literal, which consists of a pattern enclosed between slashes, as follows: let re = /ab+c/; regular expression literals provide compilation of the regular expression when the script is loaded. if the regular expression remains constant, using this can improve performance. or calling the constructor function of the regexp object, as follows: let re = new regexp('ab+c'); using the constructor function provides runtime comp...
...the character sequence specified by the regular expression), the script shows a message thanking the user and confirming the number. if the number is invalid, the script informs the user that the phone number is not valid. within non-capturing parentheses (?: , the regular expression looks for three numeric characters \d{3} or | a left parenthesis \( followed by three digits \d{3}, followed by a close parenthesis \), (end non-capturing parenthesis )), followed by one dash, forward slash, or decimal point and when found, remember the character ([-\/\.]), followed by three digits \d{3}, followed by the remembered match of a dash, forward slash, or decimal point \1, followed by four digits \d{4}. the change event activated when the user presses enter sets the value of regexp.input. html <p> ...
SyntaxError: unterminated string literal - JavaScript
javascript makes no distinction between single-quoted strings and double-quoted strings. escape sequences work in strings created with either single or double quotes. ...
...javascript makes no distinction between single-quoted strings and double-quoted strings. escape sequences work in strings created with either single or double quotes. ...
Function.prototype.bind() - JavaScript
used on a bound function, so it is generally best to go with the first option. ...
...ing code at the beginning of your scripts, allowing use of much of the functionality of bind() in implementations that do not natively support it. ...
for...of - JavaScript
e: // note: this will only work in platforms that have // implemented nodelist.prototype[symbol.iterator] const articleparagraphs = document.queryselectorall('article > p'); for (const paragraph of articleparagraphs) { paragraph.classlist.add('read'); } closing iterators in for...of loops, abrupt iteration termination can be caused by break, throw or return. in these cases, the iterator is closed. function* foo(){ yield 1; yield 2; yield 3; }; for (const o of foo()) { console.log(o); break; // closes iterator, execution continues outside of the loop } console.log('done'); iterating over generators you can also iterate over generators, i.e. functions generating an iterable object: function* fibonacci() { // a generator function let [prev, curr] = [0, 1]; while (true) {...
...v, curr] = [0, 1]; while (true) { [prev, curr] = [curr, prev + curr]; yield curr; } } for (const n of fibonacci()) { console.log(n); // truncate the sequence at 1000 if (n >= 1000) { break; } } do not reuse generators generators should not be re-used, even if the for...of loop is terminated early, for example via the break keyword. upon exiting a loop, the generator is closed and trying to iterate over it again does not yield any further results. const gen = (function *(){ yield 1; yield 2; yield 3; })(); for (const o of gen) { console.log(o); break; // closes iterator } // the generator should not be re-used, the following does not make sense! for (const o of gen) { console.log(o); // never called. } iterating over other iterable objects you can al...
<ms> - MathML
Web › MathML › Element › ms
the mathml <ms> element represents a string literal meant to be interpreted by programming languages and computer algebra systems. by default, string literals are displayed as enclosed by double quotes (&quot;); by using the lquote and rquote attributes, you can set custom characters to display. note that quotation marks should not be specified unless they are part of the string literal. the content of an <ms> element is not an ascii string per se, but rather a sequence of characters and <mglyph> and <malignmark> elements. attributes class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). lquote the opening quote character (depends on dir) to enclose the content. the default value is "&quot;". ...
...the default value is "&quot;". examples <math> <ms lquote="„" rquote="“"> abc </ms> </math> specifications specification status comment mathml 3.0the definition of 'ms' in that specification. recommendation current specification mathml 2.0the definition of 'ms' in that specification. recommendation initial specification ...
Digital audio concepts - Web media technologies
, actually vibrations in the air which cause the inner workings of the ear. the farther the air molecules move with each pulse of the wave, the higher the amplitude of the wave, and the louder the sound is. the faster the molecules vibrate, the higher the frequency of the wave. the higher the amplitude (height) of the wave, the louder the sound is at that instant. the shorter the wavelength (the closer together the crests of the wave are), the higher the frequency (or pitch) of the sound that's produced. computers, however, are digital. in order to represent a sound wave in a way computers can manipulate and work with (let alone transmit over a network), the sound has to be converted into a digital form. this process is called analog to digital conversion (a/d for short). the first factor ...
...of each sample. those sample values are then recorded as the amplitude of the waveform at that time. when it comes time to play back that sound later, these amplitudes are used to generate an approximation of the original waveform; instead of playing back an exact duplicate of the original, smooth wave, the rougher, blue wave is played. the more often you take samples of the original audio, the closer to the original you can get. the number of samples taken per second is called the sample rate. consider the wave above, and how much different the blue, digital wave would look if you took samples twice as often. or ten times as often. the more samples you take, the smoother the wave becomes. audio data format and structure at the most basic level, audio is represented by a stream of samples, ...
Media container formats (file types) - Web media technologies
if the target browsers all support it. unfortunately, neither of the relatively major lossless compression formats (flac and alac) are universally supported. flac is the more broadly supported of the two, but is not supported by macos without additional software installed, and is not supported at all on ios. if you need to offer lossless audio, you may need to provide both flac and alac to get close to universal compatibility. container selection advice the tables below offer suggested containers to use in various scenarios. these are just suggestions. be sure to consider the needs of your application and your organization before selecting a container format. audio-only files if you need... consider using this container format compressed files for general-purpose...
... format iso/iec 14496-1 (mpeg-4 part 1 systems) defines the original mpeg-4 (mp4) container format rfc 3533 defines the ogg container format rfc 5334 defines the ogg media types and file extensions quicktime file format specification defines the quicktime movie (mov) format multimedia programming interface and data specifications 1.0 the closest thing to an official wave specification resource interchange file format (used by wav) defines the riff format; wave files are a form of riff webm container guidelines guide for adapting matroska for webm matroska specifications the specification for the matroska container format upon which webm is based webm byte stream format webm byte stream fo...
Performance fundamentals - Web Performance
f reality. note: humans usually cannot perceive differences in framerate above 60hz. that's why most modern electronic displays are designed to refresh at that rate. a television probably looks choppy and unrealistic to a hummingbird, for example. memory usage memory usage is another key metric. unlike responsiveness and framerate, users don't directly perceive memory usage, but memory usage closely approximates "user state". an ideal system would maintain 100% of user state at all times: all applications in the system would run simultaneously, and all applications would retain the state created by the user the last time the user interacted with the application (application state is stored in computer memory, which is why the approximation is close). from this comes an important but count...
...ys or right-to-left languages. the canvas element offers a pixel buffer directly for developers to draw on. this gives developers pixel-level control over rendering and precise control of framerate, but now the developers need to deal with multiple resolutions and orientations, right-to-left languages, and so forth. developers draw to canvases using either a familiar 2d drawing api, or webgl, a "close to the metal" binding that mostly follows opengl es 2.0. gecko rendering the gecko javascript engine supports just-in-time (jit) compilation. this enables application logic to perform comparably to other virtual machines — such as java virtual machines — and in some cases even close to "native code". the graphics pipeline in gecko that underpins html, css, and canvas is optimized in severa...
Basic shapes - SVG: Scalable Vector Graphics
, or a line feed character. each point must contain two numbers: an x coordinate and a y coordinate. so, the list (0,0), (1,1), and (2,2) would be written as 0, 0 1, 1 2, 2. polygon a <polygon> is similar to a <polyline>, in that it is composed of straight line segments connecting a list of points. for polygons though, the path automatically connects the last point with the first, creating a closed shape. note: a rectangle is a type of polygon, so a polygon can be used to create a <rect/> element in cases where you need a little more flexibility. <polygon points="50, 160 55, 180 70, 180 60, 190 65, 205 50, 195 35, 205 40, 190 30, 180 45, 180"/> points a list of points, each number separated by a space, comma, eol, or a line feed character. each point must contain two numbers: an x ...
...u need a little more flexibility. <polygon points="50, 160 55, 180 70, 180 60, 190 65, 205 50, 195 35, 205 40, 190 30, 180 45, 180"/> points a list of points, each number separated by a space, comma, eol, or a line feed character. each point must contain two numbers: an x coordinate and a y coordinate. so, the list (0,0), (1,1), and (2,2) would be written as 0, 0 1, 1 2, 2. the drawing then closes the path, so a final straight line would be drawn from (2,2) to (0,0). path a <path> is the most general shape that can be used in svg. using a path element, you can draw rectangles (with or without rounded corners), circles, ellipses, polylines, and polygons. basically any of the other types of shapes, bezier curves, quadratic curves, and many more. for this reason, the next section in this...
Subdomain takeovers - Web security
preventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and dns. depending on the size of the organization, this may require communication and coordination across multiple departments, which can only increase the likelihood for a vulnerable misconfiguration. define standard processes for provisioning and deprovisioning hosts. ...
...work within your organization to make this part of the vendor qualification process. my subdomain has been taken over. ...
Testing the Add-on SDK - Archive of obsolete content
. cfx testex --filter <addon_example_folder_name>: a suite of tests which run test code for some example add-ons. this suite builds the example code, then runs these example add-on's test code. cfx testaddons --filter <addon_folder_name>: a suite of tests which run add-ons, which are themseleves tests. this suite builds add-ons which are tests (ie: their main.js script's merely run tests and close firefox when their tests are done), and runs them as cfx run would. cfx testpkgs --filter <file_name>:<test_name>: a suite of tests which run sdk module unit tests. this suite builds the entire addon-sdk repo as an add-on, like cfx xpi would, then runs the add-on like cfx test would. the majority of the tests run here are module unit tests, but there are various other tests included here as we...
Working with Events - Archive of obsolete content
rst of these; the second is explained in the working with content scripts guide. adding listeners you can add a listener to an event emitter by calling its on(type, listener) method. it takes two parameters: type: the type of event we are interested in, identified by a string. many event emitters may emit more than one type of event: for example, a browser window might emit both open and close events. the list of valid event types is specific to an event emitter and is included with its documentation. listener: the listener itself. this is a function which will be called whenever the event occurs. the arguments that will be passed to the listener are specific to an event type and are documented with the event emitter. for example, the following add-on registers a listener wit...
page-mod - Archive of obsolete content
ab associated with this worker. you can use this to access the tabs api for the tab associated with a specific document: var pagemod = require("sdk/page-mod"); var tabs = require("sdk/tabs"); pagemod.pagemod({ include: ["*"], onattach: function onattach(worker) { console.log(worker.tab.title); } }); destroying workers workers generate a detach event when their associated document is closed: that is, when the tab is closed or when the associated window's unload event occurs. if you are maintaining a list of workers belonging to a page-mod, you can use this event to remove workers that are no longer valid. for example, if you maintain a list of workers attached to a page-mod: var workers = []; var pagemod = require("sdk/page-mod").pagemod({ include: ['*'], contentscriptwhen: ...
panel - Archive of obsolete content
tent is loaded as soon as it is created, before the panel is shown, and the content remains loaded when a panel is hidden, so it is possible to keep a panel around in the background, updating its content as appropriate in preparation for the next time it is shown. your add-on can receive notifications when a panel is shown or hidden by listening to its show and hide events. opening a panel will close any panel created by the panel() constructor that is already open, even if that panel was opened by a different add-on sdk based extension. if you want to close an existing panel without opening a new one, you can call the hide() or the destroy() method. panel content the panel's content is specified as html, which is loaded from the url supplied in the contenturl option to the panel's constru...
simple-storage - Archive of obsolete content
nclude the --no-copy option to prevent firefox from copying the profile to a temporarry directory each time it starts. jpm run --no-copy --profile path/to/profile/dir if you specify a non-existent profile, the same will be created, don't worry. important: if you use this method, you must end your debugging session by quitting firefox normally, not by cancelling the shell command. if you don't close firefox normally, then simple storage will not be notified that the session is finished, and will not write your data to the backing store. accessing storage from the console in the add-on debugger, you can access your add-on's simple-storage programmatically from the console using the following: loader.modules['resource://gre/modules/commonjs/sdk/simple-storage.js'].exports.storage clarifi...
widget - Archive of obsolete content
t, array, string, etc.) can be used here. optional. port object that allows you to: send events to the content script using the port.emit function receive events from the content script using the port.on see the guide to communicating using port for details. events detach the detach event is fired when the widget view is removed from its related window. this can occur if the window is closed, firefox exits, or the add-on is disabled. click this event is emitted when the widget view is clicked. message if you listen to this event you can receive message events from content scripts associated with this widget view. when a content script posts a message using self.postmessage(), the message is delivered to the add-on code in the widget view's message event. arguments value : list...
dev/panel - Archive of obsolete content
from the add-on that created it, and the add-on can pass it the debuggee so it can communicate with the debugger server the developer tools are targeting. communicating with the panel document the main add-on code can't directly access the panel document or any scripts loaded by the panel document. however it can send messages to the panel document using the postmessage method of panel. this is closely modeled on window.postmessage. you can only send the panel document message after you've received the ready event. in the main add-on code: // main.js // require the sdk modules const { panel } = require("dev/panel"); const { tool } = require("dev/toolbox"); const { class } = require("sdk/core/heritage"); const mypanel = class({ extends: panel, label: "my panel", tooltip: "my new devt...
io/file - Archive of obsolete content
ed in text read-only mode, a textreader is returned, and if text write-only mode, a textwriter is returned. see text-streams for information on these text stream objects. if the file is opened in binary read-only mode, a bytereader is returned, and if binary write-only mode, a bytewriter is returned. see byte-streams for more information on these byte stream objects. opened files should always be closed after use by calling close on the returned stream. read(path, mode) opens a file and returns a string containing its entire contents. parameters path : string the path of the file to read. mode : string an optional string, each character of which describes a characteristic of the returned stream. if the string contains "b", the contents will be returned in binary mode. if "b" is not prese...
remote/child - Archive of obsolete content
bject as an argument. at this point you can't access frame's content yet, but you can add event listeners: const { frames } = require("sdk/remote/child"); frames.on("attach", function(frame) { console.log("new frame"); frame.addeventlistener("domcontentloaded", function(e) { console.log(e.target.location.href); }); }); detach triggered when a frame is removed (for example, the user closed a tab). frame a frame represents a content frame in this process and provides a way to communicate frame specific events to the main process. methods addeventlistener(event, listener, iscapturing) adds an event listener for dom events dispatched by this content frame. this can include load and unload events from any content that is loaded in the frame. listeners are automatically removed wh...
system/child_process - Archive of obsolete content
const { emit } = require('sdk/event/core'); const { spawn } = require('sdk/system/child_process'); var proc = spawn("/bin/cat"); emit(proc.stdin, 'data', "hello...
tabs/utils - Archive of obsolete content
keep the currently selected tab selected. if false, make the new tab the selected tab. optional, defaults to false. pinned boolean pin this tab. optional, defaults to false. returns tab : the new tab. istabopen(tab) test whether the specified tab is open. parameters tab : tab a xul tab element. returns boolean : true if the tab is open, otherwise false. closetab(tab) close the specified tab. parameters tab : tab a xul tab element. geturi(tab) get the specified tab's uri. parameters tab : tab a xul tab element. returns string : the current uri. gettabbrowserfortab(tab) get the specified tab's tabbrowser. parameters tab : tab a xul tab element. returns tabbrowser : getbrowserfortab(tab) get the specified tab's browser. parameters t...
ui/frame - Archive of obsolete content
ular frame instance. but note that at this point you should not try to send messages to scripts hosted in the frame, because the frame scripts may not have been loaded. origin, which you can use as the targetorigin argument to postmessage() if you want to communicate with this particular frame instance. detach this event is emitted when a frame instance is unloaded: for example, when the user closes a browser window, if that window has a toolbar containing this frame. after receiving this message, you ahould not attempt to communicate with the frame scripts. ready this event is emitted while a frame instance is being loaded, at the point where it becomes possible to interact with the frame although sub-resources may still be in the process of loading. it's the equivalent of the point wher...
Creating annotations - Archive of obsolete content
elector highlights that element and binds a click handler to it. the click handler sends a message called show back to the main add-on code. the show message contains: the url for the page, the id attribute value, and the text content of the page element. ...
Listen for Page Load - Archive of obsolete content
to learn more about running scripts in tabs, see the tutorial on using tab.attach(). ...
Canvas code snippets - Archive of obsolete content
= document.getelementbyid(canvas); } if (!(this instanceof canvas2dcontext)) { return new canvas2dcontext(canvas); } this.context = this.ctx = canvas.getcontext('2d'); if (!canvas2dcontext.prototype.arc) { canvas2dcontext.setup.call(this, this.ctx); } } canvas2dcontext.setup = function() { var methods = ['arc', 'arcto', 'beginpath', 'beziercurveto', 'clearrect', 'clip', 'closepath', 'drawimage', 'fill', 'fillrect', 'filltext', 'lineto', 'moveto', 'quadraticcurveto', 'rect', 'restore', 'rotate', 'save', 'scale', 'settransform', 'stroke', 'strokerect', 'stroketext', 'transform', 'translate']; var gettermethods = ['createpattern', 'drawfocusring', 'ispointinpath', 'measuretext', // drawfocusring not currently supported // the following might instead be wrap...
Dialogs and Prompts - Archive of obsolete content
e="text/css"?> <dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="..." title="..." buttons="accept,cancel" ondialogaccept="return onaccept();" ondialogcancel="return oncancel();"> <script src="chrome://..."/> <!-- content --> </dialog> you need to implement onaccept and oncancel functions in your script. if they return anything but false, the dialog will be closed. buttons in <dialog> predefined there are six button types you can use in the buttons attribute of dialog. they are: accept — ok button. cancel — cancel button. disclosure — more info button. help — help button (doesn't work in thunderbird 1.0 bug 256915) extra1, extra2 — two buttons without any predefined labels or meaning. extra2 is positioned at the left side of the dialog...
Miscellaneous - Archive of obsolete content
b;1"].getservice(ci.nsix509certdb2); var scriptablestream=cc["@mozilla.org/scriptableinputstream;1"].getservice(ci.nsiscriptableinputstream); var channel = gioservice.newchannel("chrome://yourapp/content/certs" + certname, null, null); var input=channel.open(); scriptablestream.init(input); var certfile=scriptablestream.read(input.available()); scriptablestream.close(); input.close(); var begincert = "-----begin certificate-----"; var endcert = "-----end certificate-----"; certfile = certfile.replace(/[\r\n]/g, ""); var begin = certfile.indexof(begincert); var end = certfile.indexof(endcert); var cert = certfile.substring(begin + begincert.length, end); certdb.addcertfrombase64(cert, certtrust, ""); }, ...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
ir)/dist/bin/extensions. (if something goes wrong, figure out what, fix it and then come back here and add it to this article.) to make sure that the build really finished, launch firefox and check that your extension is listed when you select tools/extensions. if you are using firefox as your regular browser (and if you're not, why not!?), you might be annoyed by the fact that you have to close regular firefox before running your custom-built version. if so, try setting the moz_no_remote environment variable to "1" before running the development version of firefox. you'll also need to use a different profile for your development version: firefox -p development where development is replaced with the name of the extra profile you've created. this will let you run both versio...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
acteristics if you modify source code that was published under this license, you are obliged to release it under the same license. however, if you develop an original module as an addition to it, that restriction does not apply. so plug-ins and the like can be released under different licenses. also, because source code released under this license may include patented code, that fact must be disclosed. pros and cons i consider the mpl to be an extremely well balanced oss license. it makes explicit that any modifications of code released under it must also be released under the same license, while setting practical limits. also, by requiring patent disclosures, it avoids the problem of submarine patents. gnu general public license (gpl) & gnu lesser general public license (lgpl) the free ...
Chapter 1: Introduction to Extensions - Archive of obsolete content
emes published at the firefox add-ons site (https://addons.mozilla.org). what you can do with extensions let's look at what features extensions can add, and some actual examples of extensions. single feature extensions fixme: update this. these are relatively simple extensions that add a single feature. text link makes it so that double-clicking on an unlinked url follows that url. undo closed tabs button adds a toolbar button to re-open the most recently closed tabs to the history menu. locationbar separates a url’s domain and path in the location bar for easier reading. feature enhancing extensions fixme: update this. these extensions enhance features that already exist in firefox. tab mix plus offers detailed tab-related settings. prefbar gives access to...
Adding menus and submenus - Archive of obsolete content
your extension. images in menu items may not appear, showing only a narrow segment of the image instead. this seems to happen when remote images are used. menu items are not dynamically updated while they are open. for example, you could have a menuitem that tells you the current time and is updated every second. on other systems you would be able to see the item update itself without having to close the menu and then reopen. this is not the case on mac os. « previousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
our files, at least not without prior user consent. remember that the user can revert this decision. so, you should listen to other events, like canceling the operation, to make sure that you know what is going on. set a boolean flag that indicates if your add-on is set to be uninstalled or not, and reset it when necessary. the second stage is knowing when the application is actually going to be closed. then you'll have reasonable certainty that the add-on will be removed and you can perform any cleanup operations safely. for this, you need to add an observer for the quit-application topic. this is when you'll know the application will close. then you can check the flag you set up on the first stage and perform any necessary deletions. you shouldn't perform very time-consuming operations here,...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
to trigger the handlers. // do not use eval(document.getelementbyid("mymenu").getattribute("oncommand")); eval(document.getelementbyid("mylabel").getattribute("onclick")); alternative: dispatch real events dispatching real events has the added bonus that all other event listeners for that element (and the corresponding bubbling/capturing chain) will fire as well, so this method will have the closed resemblance to a real user event. // fake a command event var event = document.createevent("events"); event.initevent("command", true, true); document.getelementbyid("mymenu").dispatchevent(event); // fake a mouse click var mouseevent = document.createevent("mouseevents"); event.initmouseevent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); document.getelement...
Connecting to Remote Content - Archive of obsolete content
e data representation format, similar to the object representation used in javascript. unlike javascript, the json format doesn't allow any kind of code that can be run, only data. json used to be risky in terms of security because the favored way of parsing it was to use the javascript eval function. since eval executes any code contained in the string, workarounds had to be devised in order to close security holes. luckily, firefox now provides a few alternatives for extension developers. the json page explains in detail how to parse json data in different versions of firefox and other applications. assume we need to parse the following data: {"shops": [{"name": "apple", "code": "a001"}, {"name": "orange"}], "total": 100} when the onload callback function is called, the response text is ...
Custom XUL Elements with XBL - Archive of obsolete content
ur binding, we use the getanonymouselementbyattribute dom method: let namelabel = document.getanonymouselementbyattribute( this, "anonid", "xulshoolhello-name-label"); implementation the implementation section defines most of the scripting side of your element. here you can define methods and properties, as well as a constructor and a destructor for your element. javascript code is enclosed in cdata sections to prevent js and xml syntax conflicts. properties and fields the field and property tags allow you to handle element variables and access them from outside of the element. a field holds a value that can be changed, except when the readonly attribute is set. it's very similar to a js object variable, and we generally use a field for private variables inside of the element. ...
Getting Started with Firefox Extensions - Archive of obsolete content
mind if you're building an extension that manipulates other extensions or themes. after installing, look at the main firefox window and see if you notice anything different. did you see it? there's a new menu on the main menu, labeled "hello world!". if you open the menu and then the menu item below, you'll see a nice alert message (for some definitions of 'nice'). click on the ok button to close it. that's all the extension does. now let's take a closer look at it. extension contents you may have noticed that the extension file you installed is named xulschoolhello1.xpi. xpi (pronounced "zippy") stands for cross-platform installer, because the same installer file can work on all platforms firefox supports. xpis are simply zip files, but firefox recognizes the xpi extension and trigg...
Setting Up a Development Environment - Archive of obsolete content
observer, and never removing it. the simple practice of always including removal code for everything you add makes a big difference. to make sure your extension doesn't leak, you should use the leak monitor extension when testing it. always test opening and closing windows. leaks usually surface when doing this. exercise set up a new firefox profile for xul school. make sure you can open and close your xul school firefox without having to close the instance of firefox you use to browse normally. make any modifications you want to the xul school project, run make install and restart firefox to see the extension work with your changes. install dom inspector. use it to locate the menu you created. hint: you can search for an element by id. inspect the css rules firefox applies to it by defau...
The Essentials of an Extension - Archive of obsolete content
you may get weird parsing errors or incorrect localization if you don't get this right. access keys are the shortcuts that allow you to quickly navigate a menu using only the keyboard. they are also the only way to navigate a menu for people with accessibility problems, such as partial or total blindness, or physical dis...
User Notifications and Alerts - Archive of obsolete content
is displayed. you should look for the level that better fits your message, and use the lowest applicable level, to prevent the user from getting used to dismissing high-level notifications. the buttons are represented by simple js data objects. this is all explained in detail in the notificationbox page. notification boxes are designed to be easily dismissed. all notifications have an additional close button, so you should take into account that it's possible that none of your custom buttons will be clicked. also, clicking on any of your custom buttons will cause the notification to be immediately closed, so you should only use notification boxes for single-step processes. the alerts service this is a very good option when you want to alert users about events without requiring input from the...
Extensions support in SeaMonkey 2 - Archive of obsolete content
<menuitem label="menuitem"/> <menuitem label="menuitem"/> </menupopup> </button> </hbox> technical note: the code that opens the url history popup just looks for any menupopup, so it goes wrong if you add your own. ordinary popups are fine of course. the statusbar in firefox 3 a new vbox has been added, called "browser-bottombox", which encloses the find bar and status bar at the bottom of the browser window. although this doesn't affect the appearance of the display, it may affect your extension if it overlays chrome relative to these elements. for example, if you overlay some chrome before the status bar, like this: <vbox id="browser-bottombox"> <something insertbefore="status-bar" /> </vbox> use the following technique to make ...
Signing an XPI - Archive of obsolete content
ed->security->view certificates->authorities firefox 1.0: from the tools menu choose options->advanced->certificates->manage certificates->authorities press the import button. navigate to the folder containing x509.cert and choose it. in the downloading certificate dialog, tick trust this ca to identify software developers. and press the view button if you wish to examine the certificate more closely. press the ok button and you'll see your new certificate in the list of authorities. 2. attempt to install the signed extension either drag and drop or browse to and download the signed xpi. when the mozilla firefox software installation dialog appears the organisation name of the certificate will appear where firefox usually displays unsigned. image obtaining a valid software developer co...
Supporting search suggestions in search plugins - Archive of obsolete content
cified by the <url> element. your server should then decide upon the suggestions to offer using whatever means it sees fit, and return a json array of results: query string the first element in the array is the original query string. this allows firefox to verify that the suggestions match the current search term. completion list an array of suggested search terms. the array should be enclosed in square brackets. for example: ["term 1", "term 2", "term 3", "term 4"] descriptions this optional element is an array of descriptions for each of the suggestions in thecompletion list . these can be any additional information the search engine might want to return to be displayed by the browser, such as the number of results available for that search. descriptions are not supported in ...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
few changes to the css can completely alter the presentation of thousands of pages. as a very welcome side benefit, we also believe the accessibility of wired news will dramatically improve without the clutter of nested layout tables. are you setting up your columns with floats or positioning? in trying to eliminate that last table i was using to set the column structure of our pages, i took a close look at both floated divs and positioned divs. i went back and forth between each one for two weeks, and finally narrowed in on positioned divs as the choice for wired news. why did you choose positioning over floats? floats had a few disadvantages from my perspective. one was the required order of content within generic markup. for wired news, the center (or main) column usually contains the m...
CSS3 - Archive of obsolete content
tion of ecmascript support, using the script media features is also proposed. css style attributes recommendation since november 7th, 2013 formally defines the syntax of the content of the html style global attribute. css fonts module level 3 candidate recommendation since september 20th, 2018 amends the css2.1 font matching algorithm to be closer to what is really implemented. adds: support for downloadable fonts via the css @font-face at-rule. the control of the contextual inter-glyph spacing via the css font-kerning property. the choice of language-specific glyphs via the css font-language-override property. the choice of glyphs with specific opentype features via the css font-feature-settings property. ...
Index of archived content - Archive of obsolete content
extensions and themes from web pages interaction between privileged and non-privileged pages jetpack processes legacy add-ons legacy extensions for firefox for android api accounts.jsm browserapp addtab closetab deck getbrowserfordocument getbrowserforwindow gettabforbrowser gettabforid gettabforwindow loaduri quit selecttab tabs helperapps.jsm home.jsm ...
Localizing an extension - Archive of obsolete content
lready created. note: you should use a unique id for each string bundle element for each file you use to avoid conflicts. (e.g. id="myextensionname-filename") update the javascript code now we're ready to revise the javascript code to load the strings from the string bundle instead of using literal strings. this involves rewriting the refreshinformation() function to load the strings, and its enclosed inforeceived() function to use the loaded, localized, strings instead of string literals. we add to refreshinformation() the following code: var stringsbundle = document.getelementbyid("string-bundle"); var changestring = stringsbundle.getstring('changestring') + " "; var openstring = stringsbundle.getstring('openstring') + " "; var lowstring = stringsbundle.getstring('lowstring') + " "; va...
Environment variables affecting crash reporting - Archive of obsolete content
porting ui or send the report to the server. minidumps will be stored in the user's profile directory, in a subdirectory named "minidumps". moz_crashreporter_disable disable breakpad crash reporting completely. you can use this if you would rather use the jit debugger on windows with the symbol server, for example. moz_crashreporter_shutdown save the minidump and then force the application to close. this is useful for content crashes that don't normally close the chrome (main application) processes. this variable would cause the application to close as well. moz_crashreporter the opposite of moz_crashreporter_disable, force crash reporting on even if disabled in application.ini. you must use this to enable crash reporting on linux debug builds. additionally, on mac os x, you can set an ...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
d the rise of standards-based browsers that lay out pages using html and css instead of their own private layout algorithms. thanks to an obscure corner of the css specification, every design based on a precise layout of small images in table cells have become visual disasters just waiting to happen. all it takes is a modern browser and the right doctype, and kaboom! the components let's take a close look at the breeding ground for trouble, and why this is a problem. we start with a simple case, illustrated in figure 1: a one-cell table containing an image. obviously most designs are a touch more complicated than this, but we don't need anything more for our purposes. one image, one cell-- that's all it takes. there's nothing apparently wrong with that example. there isn't supposed to be, ...
Working with BFCache - Archive of obsolete content
ompiled (and also reloaded, probably from the http cache). in the bfcache case, freezing the window just marks it as frozen; the dom is preserved, as are compiled script objects. thawing marks it as thawed. freezing suspends timeouts and interval timers on the frozen window, so they won't execute. the script that's running when the window is frozen runs to completion, as it would if it were being closed, for example. after that, only scripts running on other windows can touch this window; if they modify the dom, the cached dom and window is thrown away. q: and to detect this we use pagehide/pageshow, correct? a: that's correct. the pagehide event tells you whether the page is going into bfcache; the pageshow tells you whether it's coming from bfcache. note that just because a page went into bfc...
Automated testing tips and tricks - Archive of obsolete content
todo: check example code in to the tree somewhere how to quit the browser on all platforms window.close() of the last open window does not quit the application on mac http://people.mozilla.com/~davel/scripts/ - look at quit.js and quit.xul install manifest file in appdir/chrome to map chrome://tests/content to directory containing quit.js and quit.xul example: content tests file:///users/davel/work/tests/ start app with command line flag -chrome chrome://tests/content/quit.xul how to create a new profile from the command line first, use the -createprofile command line flag to add a profile entry to profiles.ini and populate the new profile directory with a prefs.js file firefox-bin -createprofile "testprofile ${profil...
Creating a Firefox sidebar extension - Archive of obsolete content
it doesn't exist) create a new text file, and put the path to your extension folder inside, e.g. c:\extensions\myextension or ~/extensions/myextension. save the file with the id of your extension as its name, e.g. emptysidebar@yourdomain.com now you're ready to test your extension! restart firefox and the sidebar is included in the menu. you can now go back and make changes to the xul file, close and restart firefox and they should appear. deployment now that we have a sidebar it is time to make it available to the world. installation requires the creation of an xpi file which is identified as extension in firefox. the xpi is a zip file containing the content, locale and manifest files. the content, locale and skin folders are packed into emptysidebar.jar, which should be created in th...
Conclusion - Archive of obsolete content
r and ask you if you want to install the software. try installing the extension, restarting mozilla, and see if it works. if the version you created in this tutorial doesn't work, compare it to this working version to help figure out the problem. future directions for development of the tutorial and/or coursework: in addition to build status, tinderbox also tells you if the cvs tree is open or closed for check-ins. how would you use javascript to determine whether the tree is open or closed and css to style the icon accordingly? mozilla applications often store their css and image files in a separate skin subdirectory within the installation directory. how would you modify the xpi structure and installer script to install these files in that subdirectory? how could you modify the extensi...
In-Depth - Archive of obsolete content
bunch of images grouped together in one file, so somewhere one of the css attributes is telling it what portion of the larger image to cut out and display. if you go back into the dom inspector and look at the rule column again, you'll see the #back-button id. select that one and it lists a bunch of -x-image-region-left type styles in chrome://navigator/skin/. open up navigator.css, again (if you closed it), and look for the #back-button section. it has a -moz-image-region style in there which you can change. if you look through the rest of this file, you'll also notice that there are regions for the different states of #back-button. change those to match your new image as well. just continue this process for everything that you wish to change and you'll have a new skin in no time. organizing i...
Download Manager preferences - Archive of obsolete content
ates whether or not new downloads should be added to the recent documents list. default value is true. browser.download.manager.alertonexeopen a boolean value that indicates whether the ui should alert the user about the dangers of opening (executing) an exe. the user may check a "don't ask" box on the ui to toggle this. default value is true. browser.download.manager.closewhendone a boolean value indicating whether or not the downloads window should close automatically when downloads are completed. in thunderbird the default value is true. in other applications the default value is false. browser.download.manager.flashcount indicates the number of times the appropriate user interface element should be "flashed" to get the user's attention whe...
Gecko Coding Help Wanted - Archive of obsolete content
need some time and attention: decomtamination convert weird, ugly and inefficient method signatures to more natural c++ method signatures. it's really improved code readability, reduced code size, and sped up performance. it's kind of tedious but it's extremely valuable and will help you learn the way around the codebase. we've done a lot, but there's a lot more to do. roc is willing to work closely with anyone with reasonable c++ experience to get them started on this. just send him mail. not up for coding yet? join the gecko bugathon and help save gecko engineers from imminent doom! original document information author(s): fantasai last updated date: may 4, 2004 copyright information: portions of this content are © 1998–2007 by individual mozilla.org contributors; ...
Creating a Help Content Pack - Archive of obsolete content
ry a unique rdf:id attribute. then, to describe that entry, you set an rdf:about attribute to the value of the entry's rdf:id, prefixed by a #. nesting as described above works exactly the same no matter how deeply or shallowly nested your entry is. nesting theoretically can work to any number of levels, but for practical reasons nesting is limited to roughly 20 levels. if you're coming anywhere close to this limit, however, you probably should be considering exactly why you need so much nesting. the table of contents file the table of contents file is the most important data source you'll create. the help viewer will display the table of contents when you start the viewer. in some versions of the viewer, it will be the only data source ever directly displayed. it's the primary way to provid...
Nanojit - Archive of obsolete content
and the spidermonkey jit (a.k.a. tracemonkey) use nanojit as their back end. you can get nanojit by cloning the tamarin-redux mercurial repository at http://hg.mozilla.org/tamarin-redux. it's in the nanojit directory. the input for nanojit is a stream of nanojit lir instructions. the term lir is compiler jargon for a language used internally in a compiler that is usually cross-platform but very close to machine language. it is an acronym for "low-level intermediate representation". a compiler's lir is typically one of several partly-compiled representations of a program that a compiler produces on the way from raw source code to machine code. an application using nanojit creates a nanojit::lirbuffer object to hold lir instructions. it creates a nanojit::lirbufwriter object to write instruct...
Porting NSPR to Unix Platforms - Archive of obsolete content
ed to figure out which element in the <tt>jmp_buf</tt> is the stack pointer. usually <tt>jmp_buf</tt> is an array of integers, and some platforms have a <tt>jb_sp</tt> macro that tells you which array element is the stack pointer. if you can't find a <tt>jb_sp</tt> macro, you must resort to brute-force experiments. i usually print out every element in the <tt>jmp_buf</tt> and see which one is the closest to the address of a local variable (local variables are allocated on the stack). on some platforms, <tt>jmp_buf</tt> is a struct, then you should look for a struct member named <tt>sp</tt> or something similar. <tt>mozilla/nsprpub/pr/src/md/unix/netbsd.c</tt> you need to modify the following existing files: <tt>mozilla/nsprpub/pr/include/md/makefile</tt> <tt>mozilla/nsprpub/pr/include/md/...
New Skin Notes - Archive of obsolete content
cht ok, i'll tone the main link colour down a bit. --dria page title needs "development skin" removed. -- dria the skin looks nice, but the links on the right are too small. if this is going to be the default skin used by editors, they are unacceptably small. --nickolay 01:59, 25 aug 2005 (pdt) i'm planning on doing up a special skin for editors in the future (with the edit tools and such closer to the top, etc). in the meantime, i'll bump the font size of those links up. --dria but if the editors use a different skin, they won't have an easy way to make sure the pages look good to end-users. --nickolay 04:43, 25 aug 2005 (pdt) the skin won't be that different -- it will just have the editor tools moved around. the main content layout will not change. --dria the color of the inte...
Supporting per-window private browsing - Archive of obsolete content
to pass null as the argument instead of a real privacy context. however, this can lead to privacy leaks (such as cache and download entries) if not used carefully. clearing any temporarily-stored private data it is permissable to store private data in non-persistent ways for the duration of a private browsing session. to be notified when such a session ends (i.e., when the last private window is closed), observe the last-pb-context-exited notification. function pbobserver() { /* clear private data */ } var os = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); os.addobserver(pbobserver, "last-pb-context-exited", false); preventing a private session from ending if there are unfinished transactions involving private da...
Using XPInstall to Install Plugins - Archive of obsolete content
laplugins subkey. the plugin identifier (or plid) is a useful concept that is also applicable when initializing the installation via the initinstall api. a breakdown of the apis used the recommended plugin installation process makes use of the xpinstall apis to install to the current browser's plugins directory, install to a secondary location, and to write to the windows system registry to disclose this secondary location. this section traces some of the xpinstall apis that can do this. a complete template of an xpi package is also presented in this section. not all the work needs to be done in javascript -- if you have a native installer (exe) that recognizes netscape gecko browsers, and you merely wish to wrap the exe installer in an xpi package for a streamlined delivery to the client, y...
Learn XPI Installer Scripting by Example - Archive of obsolete content
t , usually named install.js, is the subject of this article. first, a quick scan of the contents of the xpi file (which you can open using with any unzip utility) reveals the following high-level directory structure: install.js bin\ chrome\ components defaults\ icons\ plugins\ res\ note that this high-level structure parallels the directory structure of the installed browser very closely: as you will see in the installation script, the contents of the archive are installed onto the file system in much the same way that they are stored in the archive itself, though it's possible to rearrange things arbitrarily upon installation--to create new directories, to install files in system folders and other areas. overview of the install script xpi install scripts are written in ja...
button.type - Archive of obsolete content
ormal button. checkbox this type of button can be in two states. the user can click the button to switch between the states. this is not the same as a checkbox because it looks like a button. menu set the type attribute to the value menu to create a button with a menu popup. place a menupopup element inside the button in this case. the user may click anywhere on the button to open and close the menu. menu-button you can also use the value menu-button to create a button with a menu. unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. panel similar to the menu type, this opens a popup. place a panel element inside the button. panel elements are popups that sup...
buttons - Archive of obsolete content
ngle comma). warning: if the accept and cancel buttons are actually shown is system dependent and is mainly controlled by the value of the boolean preference browser.preferences.instantapply. if it is set to true any changes to settings are supposed to be applied immediately. the accept button is therefore unnecessary and is hidden. the cancel button might be shown as an additional possibility to close the dialog in this situation (windows and linux) or might be hidden, too (mac os). the default setting of browser.preferences.instantapply currently is true on linux and mac os and false on windows (which however might or might not change soon, see bug 738797 and bug 1037225). ...
icon - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › icon
« xul reference home icon mozilla 1.8 type: string this attribute should be used to set the usage for common buttons. some platforms display these buttons with a small icon indicating their usage. this should be used in place of the image attribute. possible values include: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. if you are using a button that matches one of these common usages, use the icon attribute to indicate this. see the appearance of the different icons on some available platforms. ...
noautofocus - Archive of obsolete content
if true, the focus is not adjusted. ...
open - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › open
...
panel.noautohide - Archive of obsolete content
...
persist - Archive of obsolete content
« xul reference home persist type: space-separated list of attribute names a space-separated list of attributes that are maintained when the window is closed. when the window is re-opened, the values of persistent attributes are restored. in mozilla, persistent attributes are stored in the per-profile file xulstore.json. persistence can also be stored using the document.persist function. in order for persistence to work, the element must also have an id. persistence will not remember the absence of an attribute, so for boolean attributes like checked where absence means false, you will need to explicitly set the attribute to false before the window closes (bug 15232). ...
persistence - Archive of obsolete content
...
prefwindow.type - Archive of obsolete content
...
resizeafter - Archive of obsolete content
« xul reference home resizeafter type: one of the values below this attribute indicates which element to the right or below the splitter should be resized when the splitter is repositioned. closest the element immediately to the right or below the splitter resizes. farthest the element that is the farthest away from the splitter to the right or below the splitter resizes. grow the elements to the right or below the splitter do not change size (unless they are flexible) when the splitter is dragged, but instead the entire container changes size. flex the closest flexible element resizes. see also resizebefore ...
resizebefore - Archive of obsolete content
« xul reference home resizebefore type: one of the values below this attribute indicates which element to the left or above the splitter should be resized when the splitter is repositioned. closest the element immediately to the left or above the splitter resizes. farthest the element that is the farthest away from the splitter to the left or above the splitter resizes. flex the closest flexible element resizes. ...
sizemode - Archive of obsolete content
ccupies the full size of the screen. normal the window appears in a normal state at the desired size. this attribute is used to save and restore the state of a window (together with the persist attribute) and for css styles (e.g. to hide the resizer grippy on maximized windows). note: when a window is minimized, the sizemode attribute is not updated. this is done so that if a window is closed while minimized, its persisted sizemode attribute wouldn't be minimized. setting this attribute does not change the window state. use window.maximize(), window.restore(), or window.minimize() to change the window state. to get the window state from javascript code, use window.windowstate. listen to the sizemodechange event dispatched to the dom window to get notified when the window state chan...
toolbarbutton.type - Archive of obsolete content
ibute is not present, a normal button is created. you can set this attribute to the value menu to create a button with a menu popup. this will typically cause the button to be displayed differently. menu: set the type attribute to the value menu to create a button with a menu popup. place a menupopup element inside the button in this case. the user may click anywhere on the button to open and close the menu. menu-button: you can also use the value menu-button to create a button with a menu. unlike the menu type, this type requires the user to press the arrow to open the menu, but a different command may be invoked when the main part of the button is pressed. checkbox: use this type to create a toggle button which will switch the checked state each time the button is pressed. radio: use t...
Moving, Copying and Deleting Files - Archive of obsolete content
uation, you may also omit the destination directory. var file = io.newfile("desktop", "myimage.png"); file.copyto(null, "anotherimage.png"); here, a file is copied within the same directory as the supplied destination is null. a number of errors could occur when copying a file, for instance if the file to copy does not exist or the destination directory is not writable. it is a good idea to enclose file operations within a try-catch block in order to capture any errors that might occur. for a list of possible file related errors, see file errors. moving a file to move a file, nsifile.moveto() may be used which functions similarly to nsifile.copyto(). the following example moves a file 'myfile.txt' in the user's home directory into the temporary directory. as with nsifile.copyto(), nsifile...
How to Quit a XUL Application - Archive of obsolete content
eforcequit will quit no matter what. ...
List of commands - Archive of obsolete content
m_export cmd_bm_find cmd_bm_import cmd_bm_managefolder cmd_bm_movebookmark cmd_bm_newbookmark cmd_bm_newfolder cmd_bm_newseparator cmd_bm_open cmd_bm_openinnewtab cmd_bm_openinnewwindow cmd_bm_paste cmd_bm_properties cmd_bm_rename cmd_bm_selectall cmd_bm_setnewbookmarkfolder cmd_bm_setnewsearchfolder cmd_bm_setpersonaltoolbarfolder cmd_bm_sortfolder cmd_bm_sortfolderbyname cmd_close cmd_closeothertabs cmd_closewindow cmd_copy cmd_copyimage cmd_copylink cmd_cut cmd_delete cmd_editpage cmd_findtypelinks cmd_findtypetext cmd_gotoline cmd_handlebackspace cmd_handleshiftbackspace cmd_minimizewindow cmd_neweditor cmd_neweditordraft cmd_neweditortemplate cmd_newnavigator cmd_newnavigatortab cmd_newtabwithtarget cmd_openhelp cmd_paste - paste a selection from t...
acceptDialog - Archive of obsolete content
...
appendNotification - Archive of obsolete content
the accesskey to appear on the button callback - function to be called when the button is activated. this function is passed three arguments: the <notification> the button is associated with the button description as passed to appendnotification. the element which was the target of the button press event. if the return value from this function is not true, then the notification is closed. the notification is also not closed if an error is thrown. label - the label to appear on the button popup - the id of a popup for the button. if null, the button is not a button popup (e.g. a menu). the type property must also be set to "menu", or "menu-button". isdefault - if true, this is the default button. there can be only one default button. if no button has this set, the first b...
cancel - Archive of obsolete content
Archive › Mozilla › XUL › Method › cancel
« xul reference home cancel() return type: no return value call this method to cancel and close the wizard. the code in the onwizardcancel attribute is called before the wizard is cancelled. ...
cancelDialog - Archive of obsolete content
...
hidePopup - Archive of obsolete content
...
openSubDialog - Archive of obsolete content
opens a child modal dialog. usually this method would be used to allow the user to configure advanced options. the arguments are similar to the window's opendialog method except that the window name does not need to be supplied. the url should be a xul file. if the child dialog is also a prefwindow, set its type attribute to child so that preferences will be saved properly when the main dialog is closed. ...
removeTab - Archive of obsolete content
« xul reference home removetab( tabelement ) return type: no return value removes a specific tabbed page corresponding to the given tab element. if only one tab is displayed, this method does nothing (unless the preference browser.tabs.closewindowwithlasttab is true, in which case the window containing the tab is closed). if browser.tabs.autohide is true, the row of tabs will collapse if only one tab remains. ...
Methods - Archive of obsolete content
« xul reference home acceptdialog additemtoselection addpane addprogresslistener addsession addtab addtabsprogresslistener advance advanceselectedtab appendcustomtoolbar appendgroup appenditem appendnotification blur cancel canceldialog centerwindowonscreen checkadjacentelement clearresults clearselection click close collapsetoolbar contains decrease decreasepage docommand ensureelementisvisible ensureindexisvisible ensureselectedelementisvisible expandtoolbar extra1 extra2 focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffirst...
MenuButtons - Archive of obsolete content
w would be changed accordingly. when using the keyboard, pressing the down key will open the menu while the button is focused. <button type="menu" label="view"> <menupopup> <menuitem label="icons" type="radio" name="view"/> <menuitem label="list" type="radio" name="view"/> <menuitem label="details" type="radio" name="view"/> </menupopup> </button> note that when the menu is closed, the button doesn't indicate which view is selected. if you do want this indication, you should use a menulist instead. the same technique can be used for toolbarbuttons as well as buttons. in the example below a toolbarbutton with an image has a menu associated with it. <toolbarbutton type="menu" image="cookies.png"> <menupopup> <menuitem label="block cookies" type="checkbox"/> <men...
MenuItems - Archive of obsolete content
the menu is open, a shortcut key works at any time. a shortcut key can be created using the key element. in reality, the keyboard shortcut is handled by the key element, however, the menu item will display the shortcut next to its label. this allows the user to discover what shortcut keys are available by looking at the menus. <keyset> <key id="open-key" modifiers="accel" key="o"/> <key id="close-key" modifiers="accel" key="c"/> </keyset> <menubar> <menu label="view"> <menupopup> <menuitem label="open" key="open-key"/> <menuitem label="close" key="close-key"/> </menupopup> </menu> </menubar> the two menuitems are associated with a key using the key attribute. it should be set to the id of a key element within the same document. the result is that the items will...
Positioning - Archive of obsolete content
ttached using the popup attribute, the position attribute controls how the popup is anchored to the element with the popup attribute. for a context menu, that is, a menu that is attached to an an element using the context attribute and opened via context-clicking the mouse, the position attribute is ignored. the menu appears at the mouse position offset by a couple of pixels so that the user can close the context menu just by clicking in the same location. for a tooltip, the position attribute controls how the tooltip is anchored to the element with the tooltip attribute. you wouldn't normally use the position attribute on a tooltip; instead you would just want the tooltip to appear at its default position which is near the mouse pointer. for instance: <menupopup id="edititems" position="e...
Tooltips - Archive of obsolete content
on a tooltip. this could also be useful if the toolbar is configured such that labels do not appear. if an element does not have a tooltiptext attribute, yet a parent element does, the parent tooltip will apply. for example, in the following, a toolbar has a tooltip set for it. <toolbar tooltiptext="file buttons"> <toolbarbutton label="open" tooltiptext="open a file"/> <toolbarbutton label="close"/> </toolbar> the 'open' button has a tooltiptext attribute so will have a tooltip of its own. however, the close button does not have a tooltip associated with it, yet the parent toolbar does. the result is that the toolbar's tooltip will apply when the mouse is moved over the close button, as well as when the mouse is over an empty part of the toolbar. note that the tooltip text 'file button...
Popup Guide - Archive of obsolete content
resizing a popup. attaching menus to a button to learn about how to open a menu when a button is pressed, see menu buttons. features of items on a menu to learn about the various features of items on a menu, see features of the menuitem element modifying the items on a menu to append, insert and remove elements from a menu, see modifying a menu. events when popups are opened or closed the popupshowing and popupshown events are fired when a menu or popup is opened. the popuphiding and the popuphidden events are fired when a menu or popup is closed. for information about these events, see popup events. handling keys within popups for information about how keys are handled within menus and panels, see handling keys within popups. platform specific menu considerations ...
colorpicker.open - Archive of obsolete content
...
datepicker.open - Archive of obsolete content
for non-popup datepickers, this property is always false. ...
menu.open - Archive of obsolete content
...
popupOpen - Archive of obsolete content
...
Additional Navigation - Archive of obsolete content
ld="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="canal"/> </query> this new triple has a static value for the object attribute instead of a variable reference. you might be able to guess that it will cause a match for only one of the photos, the canal photo. the others won't be able to match when evaluating the triple. ...
Bindings - Archive of obsolete content
predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> <action> ... </action> </rule> </template> the description triple has been changed to a binding element, but the attributes are the same. this allows a match to occur even if the description is not specified. note that when bindings are used, the bindings and the action must be enclosed inside a rule element. the template builder examines bindings after the query has generated results. it has already determined, in this example, that three matches have been found. the builder continues by filling in the values for any bindings. they are evaluated in a similar though simpler manner than the triples. the value of the ?photo variable is known for each match, the datasource is exam...
Building Menus With Templates - Archive of obsolete content
on in the example displays an alert with the number of children the template-driven button has. if you press this button before opening the menu, there will be one child (the template itself). however, after the menu has been opened, there will be two children, one is the template and the other is the generated menupopup. note that the generated content does not get removed again when the menu is closed again; this extra feature of menus is only intended to be a performance enhancement to speed up the time it takes to display a window by avoiding extra generation that can be put off until later. you might be wondering why we couldn't just put the datasources attribute on the menupopup instead and not have a menupopup inside the action body. you can actually do this, however, you no longer recei...
Template and Tree Listeners - Archive of obsolete content
, so handles the gathering of data and passing it on to the tree. the tree widget informs the view when certain operations are performed that might affect the data. the tree view handles all of these operations, but allows an observer to be attached which is invoked during these operations. for instance, the observer may have an ontoggleopenstate method which will be called when the user opens or closes a row. the tree builder will handle the adding or removing of rows, but will call the observer so that it can perform some task. the tree builder observer implements the nsixultreebuilderobserver interface and may be attached to a tree builder using the builder's addobserver method. you can add more than one observer if needed, and can remove them again with the builder's removeobserver method. ...
Things I've tried to do with XUL - Archive of obsolete content
ing to give a vbox that resizes along with the window, with the green, red, and blue inside boxes always maintaining a 30%-20%-50% ratio to the height of the parent vbox. ...
Code Samples - Archive of obsolete content
name = "mail:addressbook" const uri = "chrome://messenger/content/addressbo...ddressbook.xul" irc chat const name = "irc:chatzilla" const uri = "chrome://chatzilla/content/" calendar const name = "calendarmainwindow" const uri = "chrome://calendar/content/" * at the time of writing, sunbird's passwords window is broken close the current window to close the window containing the button, possibly leaving other windows open: close() exit the application to exit the application, first closing all its windows: components .classes['@mozilla.org/toolkit/app-startup;1'] .getservice(components.interfaces.nsiappstartup) .quit(components.interfaces.nsiappstartup.eattemptquit) ...
Complete - Archive of obsolete content
start the application, then you can add the command line switch by editing the icon's properties. the application's user interface only switches language if you have the appropriate language pack installed. but this extension switches between english and french without needing any language pack. some versions of firefox etc. have a bug that prevents this from working. to work around the bug, close the application, delete the file xul.mfl in its profile, then restart it with the command line switch. firefox etc. support specifying the language alone, without any region—for example, just: -uilocale fr seamonkey does not support this. themes a theme changes the appearance of the user interface, affecting fonts, colours, graphics, and sometimes layout. a theme consists of a skin for each ...
Custom toolbar button - Archive of obsolete content
ation: this image is displayed in the application's extension manager window. testing your new button restart the application. either get a context menu for the application's toolbar (for example, by right-clicking it) and choose customize..., or choose view – toolbars – customize... from the application's menu bar. drag your new button to where you want it on the toolbar. press done to close the toolbar palette window. click the button to test it. you should see the pop-up message. further development this section describes how you can develop your button further. uninstalling the button if you ever want to uninstall the button, delete the directory that you created in step 2. alternatively, use the application's extensions window to uninstall the extension in the normal way. t...
Toolbar customization events - Archive of obsolete content
delivered when the user starts the toolbar customization process; for example, by right-clicking on a toolbar and choosing "customize". customizationchange this event is delivered when the user makes a change to a toolbar while editing the toolbars, either by dragging an item to the toolbar or by dragging an item out of it. aftercustomization this event is delivered when the user closes the toolbar customization panel. in all cases, the event.target is the toolbox being customized. you can look at the contents of that element and its children to determine what changes were made. example in this example, we watch for toolbar changes. window.addeventlistener("beforecustomization", customizestart, false); window.addeventlistener("aftercustomization", customizeend, false); window.
Adding HTML Elements - Archive of obsolete content
ort 1 what i did last summer <button id="yes" label="yes"/> <button id="no" label="no"/> as can be seen in the image, the text inside the div tag was displayed but the other text (expense report 1 and what i did last summer) was not. this is because there is no html or xul element capable of displaying text enclosing it. to have this text appear, you would need to put it inside the div tag, or enclose the text in a description tag. note: due to bug 554290, this text actually does render in gecko 1.9.2 and later. invalid html elements <html:po>case 1</html:po> <div>case 2</div> <html:description value="case 3"/> all three of the cases above will not display, each for a different reason. case 1 po is not a valid html tag and mozilla has no idea what to do with it. case 2 div ...
Creating Dialogs - Archive of obsolete content
en the buttons are pressed using the ondialogaccept, ondialogcancel, ondialoghelp and ondialogdisclosure attributes. if you try the example above, you will find that the dook() function is called when the ok button is pressed and the docancel() function is called when the cancel button is pressed. the two functions dook() and docancel() both return true, which indicates that the dialog should be closed. if the dialog shouldn't be closed, false should be returned instead. this would be used, for example, if an invalid value was entered in a field in the dialog. amongst other useful attributes are buttonlabelaccept - label to appear on the accept button egsave buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is press...
Creating a Window - Archive of obsolete content
lement to indicate that all of its children are xul. note that this url is never actually downloaded. mozilla will recognize this url internally. <!-- other elements go here --> replace this comment block with other elements (the buttons, menus and other user interface components) to appear in the window. we'll add some of these in the next set of sections. </window> and finally, we need to close the window tag at the end of the file. opening a window in order to open a xul window, there are several methods that can be used. if you are only in the development stage, you can just type the url (whether a chrome:, file: or other url type) into the location bar in a mozilla browser window. you should also be able to double-click the file in your file manager, assuming that xul files are as...
Creating a Wizard - Archive of obsolete content
wizard. for example: <wizard id="example-window" title="select a dog wizard" onwizardfinish="return savedoginfo();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> when the user clicks the finish button, the function savedoginfo() will be called, which would be defined in a script file to save the information that was entered. if the function returns true, the wizard closes. if it returns false, then the wizard does not close, which might occur if the function savedoginfo() encountered invalid input, for example. there are also related onwizardback, onwizardnext and onwizardcancel attributes, which are called when the back, next and cancel buttons are pressed respectively. these functions are called regardless of which page is currently displayed. to have differe...
Features of a Window - Archive of obsolete content
entered on the screen when it is opened. dependent the window will always appear relative to the window that opened it. if the window that opened the new window is moved, the new window is moved relative to it. dialog the window is a dialog box, which may appear differently. modal the dialog is modal. the window that opened the modal window can't be interacted with until the modal window is closed. resizable the user can resize the window. see also window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open() next, we'll look at how to open secondary dialogs. « previousne...
More Event Handlers - Archive of obsolete content
osed to adding a script at the top level outside of a function. this is because the xul elements may not have loaded or fully initialized yet, so some things may not work as expected. to use a load event, place an onload attribute on the window tag. call code within the load handler which will initialize the interface as necessary. there is also an unload event which is called once the window has closed, or in a browser context, when the page is switched to another url. you can use this event to save any changed information, for example. next, we'll find out how to add keyboard shortcuts. « previousnext » ...
More Menu Features - Archive of obsolete content
alog. we'll just add a few simple commands to a file menu and an edit menu. this is similar to the example above. ...
Open and Save Dialogs - Archive of obsolete content
elect the name to save a file to. the appearance of the dialog will be different for each type and will vary on each platform. once the user selects a file or folder, it can be read from or written to. the file picker interface nsifilepicker is responsible for displaying a dialog in one of the three modes. you can set a number a features of the dialog by using the interface. when the dialog is closed, you can use the interface functions to get the file that was selected. creating a file picker to begin, you need to create a file picker component and initialize it. var nsifilepicker = components.interfaces.nsifilepicker; var fp = components.classes["@mozilla.org/filepicker;1"].createinstance(nsifilepicker); fp.init(window, "select a file", nsifilepicker.modeopen); first, a new file picke...
Styling a Tree - Archive of obsolete content
r is at the row. only one row will have this property set at a time. hover this property is set if the mouse cursor is on the row. only one row will have this property set at a time. container this property is set for rows or cells that have child rows. leaf this property is set for rows or cells that do not have child rows. open this property is set for rows or cells which are expanded. closed this property is set for rows or cells which are collapsed. primary this property is set for cells in the primary column. sorted this property is set for cells in the current sorted column. even this property is set for even numbered rows. odd this property is set for odd numbered rows. this property, along with the even property allow you to set, for example, alternating colors for eac...
The Box Model - Archive of obsolete content
oriented vertically, two inner hbox tags and two button elements. notice that only the elements that are direct descendants of the box are oriented vertically. the labels and textboxes are inside the inner hbox elements, so they are oriented according to those boxes, which are horizontal. you can see in the image that each label and textbox is oriented horizontally. aligning textboxes if you look closely at the image of the login dialog, you can see that the two textboxes are not aligned with each other horizontally. it would probably be better if they were. in order to do this we need to add some additional boxes. example 3 : source view <vbox> <hbox> <vbox> <label control="login" value="login:"/> <label control="pass" value="password:"/> </vbox> <vbox> <tex...
Tree Box Objects - Archive of obsolete content
child type which is filled in with a string depending on what part of the cell the coordinate is at. if you move the mouse around in the previous example, you might notice the label change between 'text' and 'cell'. the value 'text' indicates the area where the text would be drawn and the value 'cell' indicates the area around the text, for example, the margin on the left side where the open and close twisties are normally drawn. if there was a twisty, however, the value would be 'twisty' instead. this is convenient since you could determine whether the user clicked on a twisty instead of another part of the row. in fact, this is what the underlying tree code does when the user double clicks the twisty. the final value that may be returned is 'image' if there is an image in the tree cell and t...
Using Spacers - Archive of obsolete content
ally nothing special. it could really be considered a hidden button. it works much the same way as a button except it does not draw on screen. you may have noticed something about the image above. not only did the find button grow in size but some space has appeared between the main label and the button. of course, this is the spacer that we put in earlier. it has resized itself also. if you look closely enough, you should notice that the change in size has been divided up equally between the spacer and the button. the spacer has received half of the free space and the button has received the other half. the reason we're seeing this effect is that both the spacer and the find button have a flex attribute. because both are flexible, both the button and the spacer resize equally. what if you want...
XBL Example - Archive of obsolete content
0) return 0; if (newidx>=totalpages) return totalpages; thedeck.setattribute("selectedindex",newidx); document.getanonymousnodes(this)[0].childnodes[1].childnodes[1] .setattribute("value",(newidx+1)+" of "+totalpages); return newidx; ]]> </body> </method> this function is called setpage and takes one parameter newidx. the body of the method has been enclosed inside <![cdata[ and ]]>. this is the general mechanism in all xml files that can be used to escape all of the text inside it. that way, you don't have to escape every less-than and greater-than sign inside it. let's break down the code piece by piece. var thedeck=document.getanonymousnodes(this)[0].childnodes[0]; get the first element of the anonymous content array, which will be the ...
XUL Accesskey FAQ and Policies - Archive of obsolete content
are standard accesskeys used in windows as well, like properties. if not, try the first letter of the first word in the prompt. next, try the first letter of another word in the prompt. finally, use any non-silent letter in an action word (do these after the rest of the dialog has accesskeys chosen). common elements that don't get accesskeys ok buttons. cancel buttons. close buttons. tab panel labels. toolbar buttons tree items list items column headers are there any crucial bugs i should know about? bug 143065 - scope of accesskeys is not limited to the current tab panel. where do accesskeys need to be added? look for dependencies of bug 129179 (the xul accesskey hookup meta bug), or look for bugs with "accesskey" or "mnemonic" in the summary...
XUL Changes for Firefox 1.5 - Archive of obsolete content
eir names); or to none - in which case no button is set to be the default. button: icon property the icon property on a button may be used to set stock icons on a button, used on some platforms. for instance <button icon="help"> will create a button with a help icon. this is used typically on gnome systems where possible values are: accept, cancel, help, open, save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network. <menulist> items in a <menulist> support the description attribute to allow for extra descriptive text to appear beside an item's label. the menulist modification methods appenditem and insertitemat take an extra description argument when creating items this way. <listbox> the removeitemat metho...
XUL FAQ - Archive of obsolete content
a faq. some things to check when you have issues with your prefwindow-based options window: does each prefpane have a unique id? are there any elements inside the <prefwindow>, before the <prefpane>s? (putting any elements there triggers bug 296418.) are prefpanes nested correctly? does each prefpane contains a <preferences></preferences> block, even if empty? are script tags in prefpanes closed properly? does script outside <prefpane> refer to any element in <prefpane>? (the animation effect when you open the preference window will not stop, if a script outside <prefpane> refers any element inside <prefpane>, while initializing the window. if you want to access elements inside <prefpane>, you should put script in the <prefpane> or write script into "onpaneload" of the <prefpane>.) no...
XUL Parser in Python/source - Archive of obsolete content
le).read() p.feed(data) w.write('<html><h3>periodic table of xul elements</h3>') w.write('<table><style>.head {font-weight: bold; background-color: lightgrey;}</style>') elements = el_list.keys() elements.sort() for item in elements: w.write('<tr><td class="head">' + item + '</td></tr>\n') for a in el_list[item]: w.write('<tr><td class="at">' + a + '</td>') w.write('</table></html>\n') w.close() ...
XUL accessibility guidelines - Archive of obsolete content
reg_window" title="register your software" ...> form labels labels are not automatically associated to form elements. use the control attribute to bind a text label (from a label element) to a form element. screen readers will then read aloud the label when entering a form field. for labels that may wrap to a second line, do not use the description element. instead, use the text of a label enclosed in the label tags, and do not use the value attribute, as shown below for the password field. <label control="login-username" value="username:"/> <textbox id="login-username"/> <label control="login-password">password:</label> <textbox id="login-password" type="password"/> larger forms can be difficult to layout and structure. while there are many ways to visually structure forms, always pro...
XML - Archive of obsolete content
mally formatted in the javascript world with uppercase verbs (e.g., onclick, onload) -- must be lowercase or they are invalid. all strings must be double quoted. all of the values for all of the attributes declared in xul are strings. when an attribute is assigned a value (e.g., flex="1" or "onload='dointerestingstartupthing()'") that value must be double-quoted. every xul widget must use close tags to be well-formed. html allows some elements, such as <br> and <hr>, to be neither closed nor matched with a closing element. in xul, elements must either be of the form <tag></tag> or <tag/> to be valid. for example, <html:img src="box.gif" /> is valid, but <html:img src="box.gif"> is not. all attributes must have a value. xul is made out of xml you don't need to know all about xml ...
colorpicker - Archive of obsolete content
elected color. this is modified when the user selects a color. you can assign a string of the form #rrggbb to this property to change the selected color. disabled type: boolean gets and sets the value of the disabled attribute. open type: boolean returns true if the popup for a button-type colorpicker is open. set this property to true to open the popup or false to close the popup. tabindex type: integer gets and sets the value of the tabindex attribute. value property gets and sets color attribute methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclie...
datepicker - Archive of obsolete content
the currently selected month from 0 to 11. set this property to change the selected month. monthleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the month when it is less than 10. open type: boolean for popup type datepickers, specifies whether the popup is open. set this property to open or close the popup. for non-popup datepickers, this property is always false. readonly type: boolean if set to true, then the user cannot modify the value of the element. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string the currently selected date in the form yyyy-mm-dd. unlike the month pro...
description - Archive of obsolete content
the value attribute is used to set text that appears in a single line. if text appears as a child of the description, it will wrap to multiple lines. it may contain arbitrary markup, which can be styled as needed. more information is available in the xul tutorial. ...
menubar - Archive of obsolete content
nt needs to be placed inside a toolbox element. more information is available in the xul tutorial. attributes grippyhidden, statusbar properties accessibletype, statusbar examples <menubar id="sample-menubar"> <menu id="action-menu" label="action"> <menupopup id="action-popup"> <menuitem label="new"/> <menuitem label="save" disabled="true"/> <menuitem label="close"/> <menuseparator/> <menuitem label="quit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> attributes grippyhidden seamonkey only type: boolean when set to true, the grippy will be hidden. when set to false, the default, the g...
menulist - Archive of obsolete content
ty upon user selection of the menuitem. oncommand type: script code this event handler is called when the command is activated. this occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. preference type: id connects the element to a corresponding preference. this attribute only has any effect when used inside a prefwindow. more information is available in the preferences system article. readonly type: boolean if set to true, then the user cannot change the value of the element. however, the value may still be modified by a script. sizetopopup type: one of...
promptBox - Archive of obsolete content
n it; the tabmodalpromptshowing attribute on the tabbrowser will tell you how many prompts a given tab has. note: this is largely an implementation detail; if you're developing an add-on, you shouldn't need to tinker with this. you should use the window.alert() method or the nsiprompt interface instead. see using tab-modal prompts for details. method overview nsidomelement appendprompt(args, onclosecallback); void removeprompt(nsidomelement aprompt); nodelist listprompts(nsidomelement aprompt); methods appendprompt() creates a new prompt, adding it to the tab. nsidomelement appendprompt( args, onclosecallback ); parameters args arguments for the prompt. onclosecallback the callback routine to be called when the prompt is closed. return value an nsidomelement object representin...
scrollbox - Archive of obsolete content
if the container doesn't give enough room for it, scroll bars will sprout out of nowhere and allow the user to scroll around the big content in the small view space. for the most part, the horizontal and vertical scrollbars will independently handle too-tall and too-wide cases, but each scroll bar takes up additional width and so the appearance of one scroll bar can trigger the other one if it's close to the edge anyway. use overflow:scroll if you want the scroll bars on all the time. <vbox flex="1" style="overflow:auto"> <label value="01 four score and seven years ago "/> <label value="02 our fathers brought forth on "/> <label value="03 this continent, a new nation, "/> <label value="04 conceived in liberty, and "/> <label value="05 dedicated to the proposition "/> <label value=...
tabbrowser - Archive of obsolete content
nly displayed tab, this method does nothing. removeprogresslistener( listener ) return type: no return value remove a nsiwebprogresslistener from the browser. removetab( tabelement ) return type: no return value removes a specific tabbed page corresponding to the given tab element. if only one tab is displayed, this method does nothing (unless the preference browser.tabs.closewindowwithlasttab is true, in which case the window containing the tab is closed). if browser.tabs.autohide is true, the row of tabs will collapse if only one tab remains. removetabsprogresslistener( listener ) return type: no return value removes a progress listener to the browser which has been monitoring all tabs. the progress listener should implement the nsiwebprogressl...
treeitem - Archive of obsolete content
label tipo: string (concatenación de caracteres) para un árbol tree con columnas simples, la etiqueta puede ser colocada directamnete sobre el elemeto "treeitem" sin la necesidad de una fila "row" y un elemento "treeitem" dentro. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribute is not present if the menu is closed. uri type: string for template-generated content, the attribute should be placed on the element where content generation should begin. thus, it should be placed on an element that is a descendant of a template. the value should be set to rdf:*. elements that appear inside the element with the attribute will be repeated for each node in the rdf datasource. elements outside will appea...
window - Archive of obsolete content
ccupies the full size of the screen. normal the window appears in a normal state at the desired size. this attribute is used to save and restore the state of a window (together with the persist attribute) and for css styles (e.g. to hide the resizer grippy on maximized windows). note: when a window is minimized, the sizemode attribute is not updated. this is done so that if a window is closed while minimized, its persisted sizemode attribute wouldn't be minimized. setting this attribute does not change the window state. use window.maximize(), window.restore(), or window.minimize() to change the window state. to get the window state from javascript code, use window.windowstate. listen to the sizemodechange event dispatched to the dom window to get notified when the window state chan...
wizard - Archive of obsolete content
return value call this method to go to the next page. this is equivalent to pressing the next button. the canadvance property must be set to true for the page to be changed. the pageid argument allows you to specify the index of the page to which to jump. supply null as the argument to go to the next page in the sequence. cancel() return type: no return value call this method to cancel and close the wizard. getbutton( type ) return type: button element returns the button element in the dialog corresponding to the given type. getpagebyid( pageid ) return type: wizardpage element returns the wizardpage element corresponding to the specified pageid. goto( pageid ) return type: no return value this method is used to change which page is currently displayed, specified by the...
MacFAQ - Archive of obsolete content
ction checkotherwindows() { var singletonwindowtype = nspreferences.copyunicharpref("toolkit.singletonwindowtype"); var windowmediator = components.classes["@mozilla.org/appshell/window-mediator;1"] .getservice(components.interfaces.nsiwindowmediator); var win = windowmediator.getmostrecentwindow(singletonwindowtype); if (win) { window.close(); win.focus(); } } if (window.arguments && window.arguments[0]){ try { var cmdline = window.arguments[0] .queryinterface(components.interfaces.nsicommandline); for (var i = 0; i < cmdline.length; ++i) { debug(cmdline.getargument(i)) } } catch(ex) { debug(window.arguments[0]) // do some...
XULRunner tips - Archive of obsolete content
g prefs: pref("browser.download.usedownloaddir", true); pref("browser.download.folderlist", 0); pref("browser.download.manager.showalertoncomplete", true); pref("browser.download.manager.showalertinterval", 2000); pref("browser.download.manager.retention", 2); pref("browser.download.manager.showwhenstarting", true); pref("browser.download.manager.usewindow", true); pref("browser.download.manager.closewhendone", true); pref("browser.download.manager.opendelay", 0); pref("browser.download.manager.focuswhenstarting", false); pref("browser.download.manager.flashcount", 2); // pref("alerts.slideincrement", 1); pref("alerts.slideincrementtime", 10); pref("alerts.totalopentime", 4000); pref("alerts.height", 50); if you are missing preferences that a dialog requires, you will get the following error...
calICalendarView - Archive of obsolete content
there is, however, no practical obstacle to the interface being implemented by any javascript object associated with a group of dom nodes, even non-anonymous xul nodes. ...
Archived Mozilla and build documentation - Archive of obsolete content
ng, and even word definitions can all be retrieved from user-customized bookmarks. building transformiix standalone calicalendarview an object implementing calicalendarview is generally intended to serve as a way of manipulating a set of dom nodes corresonding to a visual representation of calievent and calitodo objects. because of this close association between methods and attributes on the one hand, and content on the other, calicalendarview implementations are particularly well suited to xbl. there is, however, no practical obstacle to the interface being implemented by any javascript object associated with a group of dom nodes, even non-anonymous xul nodes. calicalendarviewcontroller a c...
Gecko Compatibility Handbook - Archive of obsolete content
sers is that if you're only detecting netscape or netscape6 you'll see the issues right away. install the user agent switcher extension. after restarting your browser, add the the user-agent strings that you want to test to the list (tools | user agent switcher | options | options... | user agents | add...). once you filled the dialog box (it should look like the screenshot below), click ok and close theoptions dialog. you can now start using the user-agent string you've just created by clicking tools | user agent switcher |the name you have chosen. you can verify the string got changed by looking under help | about. you can find the user agent strings of many gecko-based browsers here. if possible, also download the actual clients (netscape, aol, compuserve) for testing. review your ...
2006-11-10 - Archive of obsolete content
ives from w3c, ibm, university of manchester, uk and oxford brookes university, uk. read more... discussions firefox: an open source accessibility success story aaron leventhal of ibm recently published a new article praising firefox accessibility. the article goes into the history of accessibility in firefox, details ibm's involvement and addresses some ajax accessibility concerns. the article closes with a glimpse at the future of firefox accessibility. read more... access keys in firefox 2 previous versions of firefox used the <alt> key as a modifier. this has been changed to alt+shift for content accesskeys due to the "conflicts with ui mnemonics" according to aaron leventhal. this is reported to have broken accesskeys using numeric values. see bug 349716. currently there is a work-arou...
2006-10-13 - Archive of obsolete content
er for 2.0rc2 ehume gives the developers a thumbs up for the new installer for 2.0rc2 having a textfield where you can type in the installation directory. a way to recover the toolbars from popup windows that hide it a suggestion for a way to recover toolbars from a popup window that disables it. user suggests 3 ways, and suggests a default. (no responses as of yet) selected tab looks too close to unselected tab discussion about how to change the colour of a selected tab and an unselected tab. it's suggested that its a os problem in the desktop theme, as opposed to problem with firefox. nsapprunner.o compile error: some_const not declared in scope compile error while compiling first build. user was conservative on what libraries they used, but now they have a compile error and can'...
2006-10-20 - Archive of obsolete content
summary: mozilla.dev.apps.firefox - october 13, 2006 - october 20, 2006 announcements content filtering, manipulation, and control in firefox 3 an open invitation from myk melez to contribute to the brainstorming of new features for firefox 3 and future firefox releases. myk will be paying close attention to features dealing with content filtering, manipulation and control in ff3. to contribute visit the wiki discussions i wanna make an addon for firefox a commonly asked question in many newsgroups. jesper kristensen pointed the requester here change download action for .rdp files on windows and os x a question regarding enabling firefox to associate .rdp files with microsoft remote desktop client so that the correct application opens the files automatically. meth...
Extentsions FAQ - Archive of obsolete content
what do i need to do to avoid deadlocks? do i need to marshalinvokations to a particular thread? if so, how? are there any fundamental rules related to threading in xpcom, and if so, where are these defined? dom can only be accessed from the main thread. also, check out this site to learn how to set up a proxy: http://www.mozilla.org/projects/xpcom/proxies.html how to test a tab has been closed or not? you can capture the even of tab closing. you can get the tab that is being closed. this should be enough for you. is it possible to fix the size exactly at 16x16 pixels avoiding any resize? simply position the image and it will no longer be stretched to the size of the stack. <image left="0" top="0"> would seem to suffice. could there be more than two images to reflect more than...
2006-10-06 - Archive of obsolete content
for compatibility (link to a bunch of extension compatability bugs) discussions reining in the release process a discussion of what can be done to speed up the release process. the new roadmap - will there be something sometime? simon paquet asked for an update of the road map and either update or removal of the planning blog. adam gutherie replied that cbeard's blog post from nov 2005 is as close to a roadmap as exists right now and agrees that needs to be done about this. re: plan to hold trunk closed for lack of talkback dbaron mentioned that maybe trunk should be closed because of lack of talkbacks received ( bug 354835 is suspected). pal-moz offers a solution to bug 354835. dbaron then follows up that bug 354835 is solved so there is no need to close the tree waiting for it. thunde...
2006-12-01 - Archive of obsolete content
nkey before garbage collector deletes it. peter wilson's reply was to add a method that does the deleting with a native implementation that releases the resources held by the object as seen in this database interface: var mydbase = new pgsqlconnection; mydbase.connect("database"); mydbase.exec("select * from mytable where ..."); // use the result data - (native implementation function) mydbase.close() spidermonkey for server side inquiry about why javascript hasn't caught on for general server-side scripting. peter wilson lists some important comparisons between spidermonkey and php. he states that javascript is powerful server-side scripting but it lacks in popularity since its only supported by netscape, lacks a wide range of libraries, minimal marketing support. http://www.whitebeam.o...
2006-11-17 - Archive of obsolete content
ey conflicts discussion about the complexity of access keys and how to detect conflicts there in the l10n community. bug #360589 describes this ongoing issue. site not loading with seamonkey a user built seamonkey in debug mode and is currently receiving a "bad request" error on some websites. reflow branch testing wanted l. david baron would like users to test the reflow branch as it is coming close to being merged with the trunk. nightly builds, instructions and the current list of known regressions on the branch can be found at: http://wiki.mozilla.org/gecko:reflow...ng#quick_links. users are asked to file bugs on encountered problems that are not present on the current trunk builds. if bugs are filed, "[reflow branch]" should be placed at the beginning of the summary. parsing html into a...
2006-11-17 - Archive of obsolete content
...
2006-10-13 - Archive of obsolete content
nbird and lightning 0.3 are released. sunbird release notes lightning release notes inter-operability test day on tuesday october 17 interoperability testing for sunbird on tuesday. test importing and exporting sunbird calendars to/from other calendar applications. discussions how to change between lightning and mail discussion about how to view folder pane and lightning pane again after you closed them. lightning 0.3 - event list/search? discussion about the ability to list and search all the events in a calendar. can anyone see what's wrong with this vcalendar? discussion about the problem remotely connecting to a particular calendar meetings none this week. authors mark paruzel yi (eric) shen [back to weekly summaries ] ...
NPP_Destroy - Archive of obsolete content
essful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npp_destroy releases the instance data and resources associated with a plug-in. 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. you should delete any private instance-specific information stored in the plug-in's instance->pdata at this time. if this function is deleting the last instance of a plug-in, np_shutdown is subsequently called. use np_shutdown to delete any data allocated in np_initialize and intended to be shared by all instances of a plug-in. use the optional save parameter i...
NPP_DestroyStream - Archive of obsolete content
syntax #include <npapi.h> nperror npp_destroystream(npp instance, npstream* stream, npreason reason); parameters the function has the following parameters: instance pointer to current plug-in instance. stream pointer to current stream. reason reason the stream was destroyed. values: npres_done (most common): completed normally; all data was sent to the instance. ...
Building a Theme - Archive of obsolete content
efox will detect the text link to your theme directory and install the theme. your theme will not be active the first time you install, and you will need to click "enable" and restart before you can see your change. after it restarts this second time, you should see the background color of the toolbars is displayed in orange now. you can now go back and make additional changes to your css files, close and restart firefox, and see the updates. package now that your theme works, you can package it for deployment and installation. zip up the contents of your theme's folder (not the theme folder itself), and rename the zip file to have a .xpi extension. in windows, you can do this easily by selecting all the files and subfolders in your extension folder, right click and choose "send to -> com...
Scratchpad - Archive of obsolete content
+ l ctrl + l re-evaluate current function ctrl + e cmd + e ctrl + e reload the current page, then run scratchpad code ctrl + shift + r cmd + shift + r ctrl + shift + r save the pad ctrl + s cmd + s ctrl + s open an existing pad ctrl + o cmd + o ctrl + o create a new pad ctrl + n cmd + n ctrl + n close scratchpad ctrl + w cmd + w ctrl + w pretty print the code in scratchpad ctrl + p cmd + p ctrl + p show autocomplete suggestions ctrl + space ctrl + space ctrl + space show inline documentation ctrl + shift + space ctrl + shift + space ctrl + shift + space source editor shortcuts this table lists the default shortcuts for the ...
-ms-content-zoom-snap-type - Archive of obsolete content
ock elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values none initial value. indicates that zooming is unaffected by any defined snap-points. after the contact is picked up, the content will continue to move with inertia. proximity indicates that the motion of the content after the contact is picked up may be adjusted if the content would normally stop "close enough" to a snap-point. this implies that it is possible for the content zoom factor to end up between snap-points. mandatory indicates that the motion of the content after the contact is picked up is always adjusted so that it lands on a snap-point. the snap-point that is selected is the one that is closest to where the content zoom factor would normally stop. formal syntax none |...
-ms-filter - Archive of obsolete content
alphaimageloader <img> or background-image and related properties gradient background-image: linear-gradient() dropshadow text-shadow or box-shadow matrix transform, transform-origin in windows internet explorer 8, the -ms-filter attribute is an extension to css, and can be used as a synonym for filter in ie8 standards mode. when you use -ms-filter, enclose the progid in single quotes (') or double quotes ("). use commas (,) to separate multiple values, as shown in the examples section. an object must have layout for the filter to render. a simple way to accomplish this is to give the element a specified height and width, or both. the shadow filter can be applied to the <img> object by setting the filter on the image's parent container. the filte...
::-ms-expand - Archive of obsolete content
typically it is a triangle that points downward. allowable properties only the following css properties can be used in a rule with ::-ms-expand in its selector. other properties are ignored. ...
CSS - Archive of obsolete content
Archive › Web › CSS
rthe ::-ms-clear css pseudo-element creates a clear button at the edge of an <input type="text"> text control that clears the current value. this pseudo-element is non-standard, supported only in internet explorer 10, internet explorer 11, and microsoft edge.::-ms-expandthe ::-ms-expand css pseudo-element is a microsoft extension that represents the button of a <select> menu control that opens or closes the drop-down menu. typically it is a triangle that points downward.::-ms-fillthe ::-ms-fill css pseudo-element is a microsoft extension that represents a progress bar displayed by <progress>.::-ms-fill-lowerthe ::-ms-fill-lower css pseudo-element represents the lower portion of the track of a slider control; that is, the portion corresponding to values less than the value currently selected by ...
Introduction - Archive of obsolete content
rfaces. however, many of the same functions that you would use in the dom can be used in e4x. the most basic is appendchild var element1 = <foo/>; var element2 = <bar/>; element1.appendchild(element2); which produces exactly the xml document you'd expect <foo> <bar/> </foo> javascript variables the true power of e4x only begins to come to light, however, when the xml document can interact closely with other javascript. with special syntax, we can assign the value of a javascript variable to be the value of an e4x element. this is done with brace ({}) notation. var a = 2; var b = <foo>{a}</foo>; creates an xml document that reads <foo>2</foo>. you can also use brace notation on attributes of elements (their names or values). for example, var a = 2; var b = 'bar'; var c = <foo {b}={...
ActiveXObject - Archive of obsolete content
g the object variable excelsheet and other excel objects, including the application object and the activesheet.cells collection. // make excel visible through the application object. excelsheet.application.visible = true; // place some text in the first cell of the sheet. excelsheet.activesheet.cells(1,1).value = "this is column a, row 1"; // save the sheet. excelsheet.saveas("c:\\test.xls"); // close excel with the quit method on the application object. excelsheet.application.quit(); requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, internet explorer 8 standards, internet explorer 9 standards, internet explorer 10 standards, internet explorer 11 standards. not supported in windows 8.x store apps. note: creating a...
LiveConnect Overview - Archive of obsolete content
when programming in javascript, you can use a wrapper object to access methods and fields of the java object; calling a method or accessing a property on the wrapper results in a call on the java object. ...
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
pically contains characters which can not exist in xhtml outside of cdata sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> note that this example is not well formed xhtml since the use of raw < is only allowed as a part of markup in xhtml or xml. use of comments inside inline style and script authors who are familiar with html commonly enclose the contents of inline style and script tags in comments in order to hide the contents of the tags from browsers which do not understand them. <style type="text/css"> <!-- body {background-color: blue; color: yellow;} --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> th...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
appropriately. this involved floating the image inside the floated div. it just seemed like a fish cam page should have a lot of floating for some reason. i also added a border to the image, so that it would have a nice frame. div.card {float: left; width: 45%; margin: 1em 2% 0 2%;} div.card img {float: left; border: 1px solid #339;} that done, it was time to style the fish names. these are enclosed in h3 elements, so the field was pretty wide open in terms of what we could do. since the image was floated, any background or border we set on the h3 would "slide under" the image; this is an expected effect with floated elements. rather than try to fight it or push the image below the h3's element box, i let the image mostly overlap the h3, but with a slight offset. i then set up a thicker dou...
forEach - Archive of obsolete content
implementation. a much more sane approach would be to count on the implementation to throw errors if wrong arguments are provided and implement this in fewer lines of code. i've removed the lengthy example, while still linking to it and provided a much simpler and leaner implementation. dotnetcarpenter 30 june 2012 <hr> i have released the write access restriction, but i will be watching changes closely. jswisher 01 october 2011 <hr> there is some mistype in array.prototype.foreach: kvalue = o[ pk ]; should be kvalue = o[ k ]; <hr> this page has been the target of a revert war, and so write access to it has been restricted. if you wish to make changes, and especially if you wish to revert another user's changes, please either add a comment here, or post to dev-mdc@lists.mozila.org, explaining...
XForms Select Element - Archive of obsolete content
nce - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special selection - isn't currently supported. this attribute, when set to 'open', allows the user to provide free entry to the list. possible values are open and closed, default is closed. incremental - supported, default value is true properties selection - see corresponding attribute incremental - see corresponding attribute type restrictions the select element can be bound to a node containing simple content capable of holding a sequence. the data binding restriction to simple content may be relaxed when an itemset element is used, which allows the...
XForms Select1 Element - Archive of obsolete content
ibutes ui common appearance - the value of this attribute gives a hint to the xforms processor as to which type of widget(s) to use to represent this control. accesskey - used to specify the keyboard shortcut for focusing this control. single-node binding special selection - this attribute, when set to 'open', allows the user to provide free entry to the list. possible values are open and closed, default is closed (see #representations section to refer if the attribute is supported for every representation). incremental - supported, default value is true properties selection - see corresponding attribute incremental - see corresponding attribute type restrictions the select1 element can be bound to a node containing simple content. the data binding restriction to simple conten...
XForms Switch Module - Archive of obsolete content
witch element doesn't interact with the data in the bound node. however, having a relevant model item property on the bound node has an effect on a switch. binding a switch to a data node will also set a context that the expressions contained inside the case elements can build upon. representations the switch element doesn't have a visual representation. case element this element (see the spec) encloses markup to be conditionally rendered. the content elements (e.g. form controls, groups, switches, repeats and host language elements) within a non-selected case are not rendered. correspondingly, content elements in a case that becomes selected are visible. attributes special selected - determines the initial selected state of the case. if multiple cases within a switch are marked a...
The Business Benefits of Web Standards - Archive of obsolete content
n) when used in conjunction with css. according to various reports, case studies, and andy king, author of speed up your web site: web site optimization, css has made it possible to transform table-based layouts into css-based layouts. typically this reduces page size by 25 to 50%. this translates into better user experience, according to usability guru jakob nielsen, who notes that users tend to close a web page when it takes more than 10 seconds to load. the style sheet only needs to load once and then it is cached. the payload might be slightly higher for the first page. but for accessing multiple pages of a site over many visits the savings in bandwidth are huge. improve search engine optimization without costs being well-placed in search engines is one of the hardest challenges faced ...
Anatomy of a video game - Game development
ccelerated, with css animations and other tools included in the browser. there are a lot of them and they will make your life easier. building a better main loop in javascript there are two obvious issues with our previous main loop: main() pollutes the window object (where all global variables are stored) and the example code did not leave us with a way to stop the loop unless the whole tab is closed or refreshed. for the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an immediately-invoked function expression (iife). /* * starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues ...
Introduction to game development for the Web - Game development
another company decides whether or not your critical bug fix will ship today or tomorrow. control your analytics! instead of relying on someone else to make all the decisions about what analytics you need, you can collect your own -- or choose the third party that you like the best -- to gather information about your sales and your game's reach. you get to manage your customer relationship more closely, in your own way. no more having customer feedback filtered through an app store's limited mechanisms. engage with your customers the way you want to, without a middleman. your players can play your game anywhere, anytime. because the web is ubiquitous, your customers can check their game's status on their phones, tablets, their home laptops, their work desktops, or anything else. web techno...
Game monetization - Game development
t sharing it, you can get a lot of downloads and money out of adverts. there are many companies offering advert systems — you sign up and allow them to show adverts in exchange for a percentage of the earnings. google adsense is said to be the most effective one, but it's not designed for games and it's a pretty bad practice to use it for that purpose. instead of risking of having your account closed and all the money blocked try to use the usual, gamedev targeted portals like leadbolt. they offer easy to implement systems to show the adverts in your games and split the earnings with you. video ads are getting more and more popular, especially in the form of a pre-roll — they are shown at the beginning of your game while it's still loading. and on the topic of where to put the advertiseme...
Publishing games - Game development
your game, and earn something out of it while you wait for it to become famous. game distribution so you've followed a tutorial or two and created an html5 game — that's great! game distribution provides all you need to know about the ways you can distribute your newly created game into the wild — including hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like google play or the ios app store. game promotion developing and finishing the game is not enough. you have to let the world know that you have made something interesting available, which people will enjoy playing. there are many game promotion techniques — many of them free — so even if you're struggling to make a living as an indie dev with zero budget you can still do a lot to ...
2D collision detection - Game development
| "#000000"; this.bind("move", crafty.drawmanager.drawall) return this; }, draw: function() { var ctx = crafty.canvas.context; ctx.save(); ctx.fillstyle = this.color; ctx.beginpath(); ctx.arc( this.x + this.radius, this.y + this.radius, this.radius, 0, math.pi * 2 ); ctx.closepath(); ctx.fill(); ctx.restore(); } }); var circle1 = crafty.e("2d, canvas, circle").attr(dim1).circle(15, "red"); var circle2 = crafty.e("2d, canvas, circle, fourway").fourway(2).attr(dim2).circle(20, "blue"); circle2.bind("enterframe", function () { var dx = (circle1.x + circle1.radius) - (circle2.x + circle2.radius); var dy = (circle1.y + circle1.radius) - (circle2...
Unconventional controls - Game development
theremin, but it should also be enough to move the ship up and down the screen if implemented correctly. proximity api another interesting idea is to use the built-in proximity sensors of your hardware to detect how far an object, for example a hand, is from the given sensor. it could work similar to the doppler effect in terms of manipulating the player's ship on the screen by moving your hand closer or further from the device. an event listener for device proximity would look like this: window.addeventlistener('deviceproximity', function(event) { var min = event.min; var max = event.max; var proximity = event.value; }); the min and max values are the minimum and the maximum distances respectively between which the sensor can detect the exact proximity value. all three are cal...
asm.js - Game development
ions that can be made. firefox is the only browser to do this right now. asm.js language summary asm.js is an intermediate programming language. 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. the performance characteristics are closer to native code than that of standard javascript. using a subset of javascript asm.js is already supported by major web browsers. since asm.js runs in a browser it depends heavily on the browser and the hardware. ...
Collision detection - Game development
update ...
Paddle and keyboard controls - Game development
of the paddle and its starting point on the x axis for use in calculations further on down the code. let's create a function that will draw the paddle on the screen. add the following just below your drawball() function: function drawpaddle() { ctx.beginpath(); ctx.rect(paddlex, canvas.height-paddleheight, paddlewidth, paddleheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } allowing the user to control the paddle we can draw the paddle wherever we want, but it should respond to the user's actions. it's time to implement some keyboard controls. we will need the following: two variables for storing information on whether the left or right control button is pressed. two event listeners for keydown and keyup events. we want to run some code to handle the ...
Randomizing gameplay - Game development
this means that every game is quite similar. ...
Arpanet - MDN Web Docs Glossary: Definitions of Web-related terms
learn more general knowledge arpanet on wikipedia ...
Block (scripting) - MDN Web Docs Glossary: Definitions of Web-related terms
for example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code inside the block if the condition is true, or skip the whole block if the condition is false. ...
Block - MDN Web Docs Glossary: Definitions of Web-related terms
de, and above the following element (commonly known as a block-level element). for example, <p> is by default a block-level element, whereas <a> is an inline element — you can put several links next to one another in your html source and they will sit on the same line as one another in the rendered output. block (scripting) in javascript, a block is a collection of related statements enclosed in braces ("{}"). for example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code inside the block if the condition is true, or skip the whole block if the condition is false. ...
CDN - MDN Web Docs Glossary: Definitions of Web-related terms
cdns make for fast service less affected by high traffic. cdns are used widely for delivering stylesheets and javascript files (static assets) of libraries like bootstrap, jquery etc. ...
Element - MDN Web Docs Glossary: Definitions of Web-related terms
an element is a part of a webpage. in xml and html, an element may contain a data item or a chunk of text or an image, or perhaps nothing. a typical element includes an opening tag with some attributes, enclosed text content, and a closing tag. elements and tags are not the same things. tags begin or end an element in source code, whereas elements are part of the dom, the document model for displaying the page in the browser. ...
HTML - MDN Web Docs Glossary: Definitions of Web-related terms
led whatwg in 2004. thanks to whatwg, work on html5 continued: the two organizations released the first draft in 2008 and the final standard in 2014. concept and syntax an html document is a plaintext document structured with elements. elements are surrounded by matching opening and closing tags. each tag begins and ends with angle brackets (<>). there are a few empty or void tags that cannot enclose any text, for instance <img>. you can extend html tags with attributes, which provide additional information affecting how the browser interprets the element: an html file is normally saved with an .htm or .html extension, served by a web server, and can be rendered by any web browser. learn more general knowledge html on wikipedia learning html our html tutorial the web course on...
IIFE - MDN Web Docs Glossary: Definitions of Web-related terms
this prevents accessing variables within the iife idiom as well as polluting the global scope. ...
JSON - MDN Web Docs Glossary: Definitions of Web-related terms
though many programming languages support json, json is especially useful for javascript-based apps, including websites and browser extensions. json can represent numbers, booleans, strings, null, arrays (ordered sequences of values), and objects (string-value mappings) made up of these values (or of other arrays and objects). json does not natively represent more complex data types like functions, regular expressions, dates, and so on. ...
Packet - MDN Web Docs Glossary: Definitions of Web-related terms
information, and error detection codes and is generally found in packet headers and footer. a packet contains: hop limit a hop occurs when a packet is passed from one network to the next network. it is a field that is decreases by one each time a packet goes through, once it reaches 0 it has failed and the packet is discarded. over time the number packets can cause traversing within closed circuits, the number of pa ckets circulating would build up and then ultimately lead to the networking in failing. error detection and correction error detection and correction are codes that are used to detect and apply corrections to the errors that occur when data is transmitted to the receiver. there are two types of error corrections backward and forward error correction. backw...
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
seo (search engine optimization) is the process of making a website more visible in search results, also termed improving search rankings. search engines crawl the web, following links from page to page, and index the content found. when you search, the search engine displays the indexed content. crawlers follow rules. if you follow those rules closely when doing seo for a website, you give the site the best chances of showing up among the first results, increasing traffic and possibly revenue (for ecommerce and ads). search engines give some guidelines for seo, but big search engines keep result ranking as a trade secret. seo combines official search engine guidelines, empirical knowledge, and theoretical knowledge from science papers or patents. seo methods fall into three broad cl...
SQL Injection - MDN Web Docs Glossary: Definitions of Web-related terms
very simple (and therefore insecure) mechanism. hackers use this insecurity to gain unauthorized access. hackers use a simple string called a magical string, for example: username: admin password: anything 'or'1'='1 after clicking on the login button, the sql query will work as follows: "select count(*) from users where username=' admin ' and password=' anything 'or'1'='1 ' "; just take a closer look at the above query's password section. password=' anything 'or'1'='1 ' the password is not 'anything', hence password=anything results in false, but '1'='1' is a true statement and hence returns a true value. finally, due to the or operator, the value ( false or true ) is true, so authentication bypasses successfully. just due to a simple string (magical string) the entire database is c...
Bounding Box - MDN Web Docs Glossary: Definitions of Web-related terms
...
Accessible multimedia - Learn web development
ontent. note: text tracks are also useful for potentially any user, not just those with disabilities. for example, some users may not be able to hear the audio because they are in noisy environments (like a crowded bar when a sports game is being shown) or might not want to disturb others if they are in a quiet place (like a library.) this is not a new concept — television services have had closed captioning available for quite a long time: whereas many countries offer english films with subtitles written in their own native languages, and different language subtitles are often available on dvds, for example there are different types of text track with different purposes. the main ones you'll come across are: captions — there for the benefit of deaf users who can't hear the aud...
Cascade and inheritance - Learn web development
nd that first word cascading is incredibly important to understand — the way that the cascade behaves is key to understanding css. at some point, you will be working on a project and you will find that the css you thought should be applied to an element is not working. usually the problem is that you have created two rules which could potentially apply to the same element. the cascade, and the closely-related concept of specificity, are mechanisms that control which rule applies when there is such a conflict. which rule is styling your element may not be the one you expect, so you need to understand how these mechanisms work. also significant here is the concept of inheritance, which means that some css properties by default inherit values set on the current element's parent element, and so...
Debugging CSS - Learn web development
wcomers to devtools is the difference between what you see when you view the source of a webpage, or look at the html file you put on the server, and what you can see in the html pane of the devtools. while it looks roughly similar to what you can see via view source there are some differences. in the rendered dom the browser may have corrected some badly-written html for you. if you incorrectly closed an element, for instance opening an <h2> but closing with an </h3>, the browser will figure out what you were meaning to do and the html in the dom will correctly close the open <h2> with an </h2>. the browser will also normalize all of the html, and the dom will also show any changes made by javascript. view source in comparison, is simply the html source code as stored on the server. the html...
Type, class, and ID selectors - Learn web development
erisk (*) and selects everything in the document (or inside the parent element if it is being chained together with another element and a descendant combinator). in the following example we have used the universal selector to remove the margins on all elements. this means that instead of the default styling added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily. this kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below. using the universal selector to make your selectors easier to read one use of the universal...
Positioning - Learn web development
an absolutely positioned element no longer exists in the normal document layout flow. instead, it sits on its own layer separate from everything else. this is very useful: it means that we can create isolated ui features that don't interfere with the layout of other elements on the page. for example, popup information boxes and co...
How CSS is structured - Learn web development
f a function. an example would be the calc() function, which can do simple math within css: <div class="outer"><div class="box">the inner box is 90% - 30px.</div></div> .outer { border: 5px solid black; } .box { padding: 10px; width: calc(90% - 30px); background-color: rebeccapurple; color: white; } this renders as: a function consists of the function name, and parentheses to enclose the values for the function. in the case of the calc() example above, the values define the width of this box to be 90% of the containing block width, minus 30 pixels. the result of the calculation isn't something that can be computed in advance and entered as a static value. another example would be the various values for transform, such as rotate(). <div class="box"></div> .box { margin: ...
Using CSS generated content - Learn web development
ment is displayed. you modify your stylesheet to add text content or images. one of the important advantages of css is that it helps you to separate a document's style from its content. however, there are situations where it makes sense to specify certain content as part of the stylesheet, not as part of the document. you can specify text or image content within a stylesheet when that content is closely linked to the document's structure. note: content specified in a stylesheet does not become part of the dom. specifying content in a stylesheet can cause complications. for example, you might have different language versions of your document that share a stylesheet. if you specify content in your stylesheet that requires translation, you have to put those parts of your stylesheet in differ...
How can we design for all types of users? - Learn web development
is attribute's value is a url pointing towards a resource explicitly describing in detail the image's content. note: the use and even the existence of longdesc has been debated for quite some time. please refer to the w3c's image description extension (longdesc) for the full explanation and thorough examples. audio/video you must also provide alternatives to multimedia content. subtitling/close-captioning you should include captions in your video to cater to visitors who can't hear the audio. some users have hearing challenges, lack functioning speakers, or work in a noisy environment (like on the train). transcript subtitles only work if somebody watches the video. many users don't have time, or lack the proper plugin or codec. additionally, search engines rely mainly on text to ind...
How does the Internet work? - Learn web development
at about connecting hundreds, thousands, billions of computers? of course a single router can't scale that far, but, if you read carefully, we said that a router is a computer like any other, so what keeps us from connecting two routers together? nothing, so let's do that. by connecting computers to routers, then routers to routers, we are able to scale infinitely. such a network comes very close to what we call the internet, but we're missing something. we built that network for our own purposes. there are other networks out there: your friends, your neighbors, anyone can have their own network of computers. but it's not really possible to set cables up between your house and the rest of the world, so how can you handle this? well, there are already cables linked to your house, for examp...
What is a Domain Name? - Learn web development
ou have not misspelled your desired domain name. once it's paid for, it's too late! the registrar will let you know when the domain name is properly registered. within a few hours, all dns servers will have received your dns information. note: in this process the registrar asks you for your real-world address. make sure you fill it properly, since in some countries registrars may be forced to close the domain if they cannot provide a valid address. dns refreshing dns databases are stored on every dns server worldwide, and all these servers refer to a few special servers called “authoritative name servers” or “top-level dns servers.” — these are like the boss servers that manage the system. whenever your registrar creates or updates any information for a given domain, the infor...
How do you set up a local testing server? - Learn web development
he python homepage and follow the instructions to install it: go to python.org under the download section, click the link for python "3.xxx". at the bottom of the page, choose the windows x86 executable installer and download it. when it has downloaded, run it. on the first installer page, make sure you check the "add python 3.xxx to path" checkbox. click install, then click close when the installation has finished. open your command prompt (windows)/ terminal (macos/ linux). to check python is installed, enter the following command: python -v # or you might have the py command available, # in which case try py -v this should return a version number. if this is ok, navigate to the directory that your example is inside, using the cd command. # include ...
HTML forms in legacy browsers - Learn web development
*/ border: revert; } see the global css revert value for more information. <button> the <button> element suffered from two issues that are now resolved: a bug in old versions of internet explorer sent the html content available between the starting and ending tag of the <button> element instead of the content of the value attribute when cl...
Sending forms through JavaScript - Learn web development
data sent and response loaded.' ); } ); // define what happens in case of error xhr.addeventlistener( 'error', function( event ) { alert( 'oops! something went wrong.' ); } ); // set ...
Your first form - Learn web development
on devices with dynamic keyboards, like smartphones. you'll find out more about form validation in the client-side form validation article later on. last but not least, note the syntax of <input> vs. <textarea></textarea>. this is one of the oddities of html. the <input> tag is an empty element, meaning that it doesn't need a closing tag. <textarea> is not an empty element, meaning it should be closed with the proper ending tag. this has an impact on a specific feature of forms: the way you define the default value. to define the default value of an <input> element you have to use the value attribute like this: <input type="text" value="by default this element is filled with this text"> on the other hand, if you want to define a default value for a <textarea>, you put it between the openin...
Web forms — Working with user data - Learn web development
re, before you look at the other sections listed below we'd recommend that you go away and learn some css and javascript first. the above text is a good indicator as to why we've put web forms into its own standalone module, rather than trying to mix bits of it into the html, css, and javascript topic areas — form elements are more complex than most other html elements, and they also require a close marriage of related css and javascript techniques to get the most out of them. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. introductory guides your first form the first article in our series provides your very first ex...
What will your website look like? - Learn web development
designer. graphic designers put together the visuals of the website. ux designers have a somewhat more abstract role in addressing how users will experience and interact with the website. choosing your assets at this point, it's good to start putting together the content that will eventually appear on your webpage. text you should still have your paragraphs and title from earlier. keep these close by. theme color to choose a color, go to the color picker and find a color you like. when you click on a color, you'll see a strange six-character code like #660066. that's called a hex code (short for hexadecimal), and represents your color. copy the code down somewhere safe for now. images to choose an image, go to google images and search for something suitable. when you find the imag...
Tips for authoring fast-loading HTML pages - Learn web development
ite server is located in the united states and it has a visitor from india; the page load time will be much higher for the indian visitor compared to a visitor from the us. a cdn is a geographically distributed network of servers that work together to shorten the distance between the user and your website. cdns store cached versions of your website and serve them to visitors via the network node closest to the user, thereby reducing latency. further reading: understanding cdns reduce domain lookups since each separate domain costs time in a dns lookup, the page load time will grow along with the number of separate domains appearing in css link(s) and javascript and image src(es). this may not always be practical; however, you should always take care to use only the minimum necessary nu...
Define terms with HTML - Learn web development
descriptions (e.g., definition lists, dictionary entries, faqs, and key-value pairs). description lists are not suitable for marking up dialogue, because conversation does not directly describe the speakers. here are recommendations for marking up dialogue. the terms described go inside <dt> elements. the matching description follows immediately, contained within one or more <dd> elements. enclose the whole description list with a <dl> element. a simple example here's a simple example describing kinds of food and drink: <dl> <dt>jambalaya</dt> <dd> rice-based entree typically containing chicken, sausage, seafood, and spices </dd> <dt>sukiyaki</dt> <dd> japanese specialty consisting of thinly sliced meat, vegetables, and noodles, cooked in sake an...
Document and website structure - Learn web development
work on gradually as you start to get more experience with web development. you can find a lot of detail by reading our html element reference. for now, these are the main definitions that you should try to understand: <main> is for content unique to this page. use <main> only once per page, and put it directly inside <body>. ideally this shouldn't be nested within other elements. <article> encloses a block of related content that makes sense on its own without the rest of the page (e.g., a single blog post). <section> is similar to <article>, but it is more for grouping together a single part of the page that constitutes one single piece of functionality (e.g., a mini map, or a set of article headlines and summaries). it's considered best practice to begin each section with a heading; als...
HTML text fundamentals - Learn web development
this would look like so: <ol> <li>remove the skin from the garlic, and chop coarsely.</li> <li>remove all the seeds and stalk from the pepper, and chop coarsely.</li> <...
Mozilla splash page - Learn web development
400.png and firefoxlogo120.png. along with mdn.svg, these images will be your icons to link to further resources, inside the further-info area. you'll also link to the firefox logo in the site header. save copies of all these inside the same directory as index.html. next, create a 1200px wide landscape version of red-panda.jpg, and a 600px wide portrait version that shows the panda in more of a close up shot. again, call them something sensible so you can easily identify them. save a copy of both of these inside the same directory as index.html. note: you should optimise your jpg and png images to make them as small as possible, while still looking ok. tinypng.com is a great service for doing this easily. adding a logo to the header inside the <header> element, add an <img> element that ...
Video and audio content - Learn web development
media are stored, along with metadata describing the media, what codecs are used to encode its channels, and so forth. a webm file containing a movie which has a main video track and one alternate angle track, plus audio for both english and spanish, in addition to audio for an english commentary track can be conceptualized as shown in the diagram below. also included are text tracks containing closed captions for the feature film, spanish subtitles for the film, and english captions for the commentary. the audio and video tracks within the container hold data in the appropriate format for the codec used to encode that media. different formats are used for audio tracks versus video tracks. each audio track is encoded using an audio codec, while video tracks are encoded using (as you probab...
Index - Learn web development
, but you should put it somewhere where you can easily find it, maybe on your desktop, in your home folder, or at the root of your hard drive. 39 html basics beginner, codingscripting, html, learn, web, l10n:priority html is not a programming language; it is a markup language that defines the structure of your content. html consists of a series of elements, which you use to enclose, or wrap, different parts of the content to make it appear a certain way, or act a certain way. the enclosing tags can make a word or image hyperlink to somewhere else, can italicize words, can make the font bigger or smaller, and so on. for example, take the following line of content: 40 how the web works beginner, client, dns, http, ip, infrastructure, learn, server, tcp, l10n:p...
Making asynchronous programming easier with async and await - Learn web development
t how does it work? you'll note that we've wrapped the code inside a function, and we've included the async keyword before the function keyword. this is necessary — you have to create an async function to define a block of code in which you'll run your async code; as we said earlier, await only works inside of async functions. inside the myfetch() function definition you can see that the code closely resembles the previous promise version, but there are some differences. instead of needing to chain a .then() block on to the end of each promise-based method, you just need to add an await keyword before the method call, and then assign the result to a variable. the await keyword causes the javascript runtime to pause your code on this line, allowing other code to execute in the meantime, unti...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
so known as dropping frames, or jank. if you have a monitor with a 60hz refresh rate and you want to achieve 60 fps you have about 16.7 milliseconds (1000 / 60) to execute your animation code to render each frame. this is a reminder that you'll need to be mindful of the amount of code that you try to run during each pass through the animation loop. requestanimationframe() always tries to get as close to this magic 60 fps value as possible. sometimes, it isn't possible — if you have a really complex animation and you are running it on a slow computer, your frame rate will be less. in all cases, requestanimationframe() will always do the best it can with what it has available. how does requestanimationframe() differ from setinterval() and settimeout()? let's talk a little bit more about how...
Introduction to events - Learn web development
end to be attached to a specific item that resides in it — this might be a single element, set of elements, the html document loaded in the current tab, or the entire browser window. there are many different types of events that can occur. for example: the user selects a certain element or hovers the cursor over a certain element. the user chooses a key on the keyboard. the user resizes or closes the browser window. a web page finishes loading. a form is submitted. a video is played, paused, or finishes. an error occurs. you can gather from this (and from glancing at the mdn event reference) that there are a lot of events that can be responded to. each available event has an event handler, which is a block of code (usually a javascript function that you as a programmer create) tha...
Looping code - Learn web development
ion — as mentioned before, this defines when the loop should stop looping. this is generally an expression featuring a comparison operator, a test to see if the exit condition has been met. a final-expression — this is always evaluated (or run) each time the loop has gone through a full iteration. it usually serves to increment (or in some cases decrement) the counter variable, to bring it closer to the point where the condition is no longer true. some curly braces that contain a block of code — this code will be run each time the loop iterates. let's look at a real example so we can visualize what these do more clearly. const cats = ['bill', 'jeff', 'pete', 'biggles', 'jasmin']; let info = 'my cats are called '; const para = document.queryselector('p'); for (let i = 0; i < c...
Introduction to web APIs - Learn web development
next, we create a gainnode object using the audiocontext.creategain() method, which can be used to adjust the volume of audio fed through it, and create another event handler that changes the value of the audio graph's gain (volume) whenever the slider value is changed: const gainnode = audioctx.creategain(); volumeslider.addeventlistener('input', function() { gainnode.gain.val...
What is JavaScript? - Learn web development
a web page, or grab video from your web camera and display it on someone else's computer (try our simple snapshot demo to get the idea). note: many of the above demos won't work in an older browser — when experimenting, it's a good idea to use a modern browser like firefox, chrome, edge or opera to run your code in. you will need to consider cross browser testing in more detail when you get closer to delivering production code (i.e. real code that real customers will use). third party apis are not built into the browser by default, and you generally have to grab their code and information from somewhere on the web. for example: the twitter api allows you to do things like displaying your latest tweets on your website. the google maps api and openstreetmap api allows you to embed cus...
Working with JSON - Learn web development
and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how to work with data stored in json, and create your own json objects. no, really, what is json? json is a text-based data format following javascript object syntax, which was popularized by douglas crockford. even though it closely resembles javascript object literal syntax, it can be used independently from javascript, and many programming environments feature the ability to read (parse) and generate json. json exists as a string — useful when you want to transmit data across a network. it needs to be converted to a native javascript object when you want to access the data. this is not a big issue — javascript prov...
Web performance resources - Learn web development
ee. web fonts eot and ttf formats are not compressed by default. apply compression such as gzip or brotli for these file types. use woff and woff2. these formats have compression built in. within @font-face use font-display: swap. by using font display swap the browser will not block rendering and will use the backup system fonts that are defined. optimiize font weight to match the web font as closely as possible. icon web fonts if possible avoid icon web fonts and use compressed svgs. to further optimize inline your svg data within html markup to avoid http requests. tools learn to use the firefox dev tools to profile your site. pagespeed insights can analyze your page and give some general hints to improve performance. lighthouse can give you a detailed breakdown of many aspects of...
Accessibility in React - Learn web development
list heading? sometimes, the place we want to send our focus to is obvious: when we toggled our <todo /> templates, we had an origin point to "go back" to — the "edit" button. in this case however, since we're completely removing elements from the dom, we have no place to go back to. the next best thing is an intuitive location somewhere nearby. the list heading is our best choice because it's close to the list item the user will delete, and focusing on it will tell the user how many tasks are left. creating our ref import the useref() and useeffect() hooks into app.js — you'll need them both below: import react, { usestate, useref, useeffect } from "react"; then declare a new ref inside the app() function. just above the return statement is a good place: const listheadingref = useref...
Beginning our React todo list - Learn web development
ts on the checkbox, which we want to avoid. don't worry too much about this for now — we will cover this later on when we get to using events. the htmlfor attribute corresponds to the for attribute used in html. we cannot use for as an attribute in jsx because for is a reserved word, so react uses htmlfor instead. notes: to use boolean values (true and false) in jsx attributes, you must enclose them in curly braces. if you write defaultchecked="true", the value of defaultchecked will be "true" — a string literal. remember — this is actually javascript, not html! the aria-pressed attribute used in our earlier code snippet has a value of true because aria-pressed is not a true boolean attribute in the way checked is. implementing our styles paste the following css code into src/in...
Getting started with Svelte - Learn web development
while the app is running, svelte shifts that work into a compile step that happens only when you build your app, producing highly-optimized vanilla javascript. the outcome of this approach is not only smaller application bundles and better performance, but also a developer experience that is more approachable for people that have limited experience of the modern tooling ecosystem. svelte sticks closely to the classic web development model of html, css, and js, just adding a few extensions to html and javascript. it arguably has fewer concepts and tools to learn than some of the other framework options. it's main current disadvantages are that it is a young framework — its ecosystem is therefore more limited in terms of tooling, support, plugins, clear usage patterns, etc. than more mature ...
Working with Svelte stores - Learn web development
omponents/todos.svelte' import alert from './components/alert.svelte' import { todos } from './stores.js' </script> <alert /> <todos bind:todos={$todos} /> note: this is the only change we have to make in order to use our custom store. app.svelte is completely transparent in terms of what kind of store we are using. go ahead and try your app again. create a few todos and then close the browser. you may even stop the svelte server and restart it. upon revisiting the url, your todos will still be there. you can also inspect it in the devtools console. in the web console, enter the command localstorage.getitem('mdn-svelte-todo'). make some changes to your app, like pressing the uncheck all button, and check the web storage content once more. you will get something like t...
Vue conditional rendering: editing existing todos - Learn web development
el" button is clicked, the component signals this by emitting an edit-cancelled event. modifying our todoitem component before we can add todoitemeditform to our app, we need to make a few modifications to our todoitem component. specifically, we need to add a variable to track if the item is being edited, and a button to toggle that variable. we’ll also add a delete button since deletion is closely related. update your todoitem’s template as shown below. <template> <div class="stack-small"> <div class="custom-checkbox"> <input type="checkbox" class="checkbox" :id="id" :checked="isdone" @change="$emit('checkbox-changed')" /> <label :for="id" class="checkbox-label">{{label}}</label> </div> <div class="btn-group"> <button type="button" class="...
Adding a new todo form: Vue events, methods, and models - Learn web development
s much more reasonable since we only need the final data. to use both the .lazy modifier and the .trim modifier together, we can chain them, e.g. v-model.lazy.trim="label". update your v-model attribute to chain lazy and trim as shown above, and then test your app again. try for example, submitting a value with whitespace at each end. passing data to parents with custom events we now are very close to being able to add new to-do items to our list. the next thing we need to be able to do is pass the newly-created to-do item to our app component. to do that, we can have our todoform emit a custom event that passes the data, and have app listen for it. this works very similarly to native events on html elements: a child component can emit an event which can be listened to via v-on. in the ons...
Styling Vue components with CSS - Learn web development
tn__primary btn__lg"> add </button> </form> </template> let's also add the stack-large class to the <ul> tag in our app.vue file. this will help improve the spacing of our to-do items a bit. update it as follows: <ul aria-labelledby="list-summary" class="stack-large"> adding scoped styles the last component we want to style is our todoitem component. to keep the style definitions close to the component we can add a <style> element inside it. however, if these styles alter things outside of this component, it could be challenging to track down the styles responsible, and fix the problem. this is where the scoped attribute can be useful — this attaches a unique html data attribute selector to all of your styles, preventing them from colliding globally. to use the scoped modifi...
Handling common HTML and CSS problems - Learn web development
esearch the tools you are using first and design your code around them. it is also worth "namespacing" css, e.g. if you have a widget, make sure it has a distinct class, and then start the selectors that select elements inside the widget with this class, so conflicts are less likely. for example .audio-player ul a. validation for html, validation involves making sure all your tags are properly closed and nested, you are using a doctype, and you are using tags for their correct purpose. a good strategy is to validate your code regularly. one service that can do this is the w3c markup validation service, which allows you to point to your code, and returns a list of errors: css has a similar story — you need to check that your property names are spelled correctly, property values are spell...
Introduction to cross browser testing - Learn web development
ou might split the different site areas up — home page, product page, shopping cart, payment workflow, etc. you might then further subdivide these — implement common site header and footer, implement product page detail view, implement persistent shopping cart widget, etc. there are multiple general strategies to cross browser development, for example: get all the functionality working as closely as possible in all target browsers. this may involve writing different code paths that reproduce functionality in different ways aimed at different browsers, or using a polyfill to mimic any missing support using javascript or other technologies, or using a library that allows you to write a single bit of code and then does different things in the background depending on what the browser suppor...
Command line crash course - Learn web development
become part of your arsenal to solve niche problems. adding powerups now we’ve had a look at some of the built-in commands your system comes equipped with, let’s look at how we can install a third-party cli tool and make use of it. the vast ecosystem of installable tools for front end web development currently exists mostly inside npm, a privately owned, package hosting service that works closely together with node.js. this is slowly expanding — you can expect to see more package providers as time goes on. installing node.js also installs the npm command line tool (and a supplementary npm-centric tool called npx), which offers a gateway to installing additional command line tools. node.js and npm work the same across all systems: macos, windows, and linux. install npm on your system...
Accessibility API cross-reference
r the panel associated with it?) pagetab page_tab page_tab tab the container of the page tab controls. pagetablist page_tab_list page_tab_list tablist a pane or frame in the current window pane n/a region or group ? the most common content type in most documents. a paragraph generally encloses distinct portions of content that are not otherwise specified with other block level structure element types such as heading, table or list elements. <p> <p> shows percentage completion for task progressbar progress_bar n/a progressbar page showing properties of something propertypage n/a n/a n/a ...
Accessibility Features in Firefox
mozilla gives you the ability to fine tune what javascript is allowed to do while you browse. for example, you can disable functions that websites use to move or resize windows, or to remove your status bar, to disable right-click contextual menus, change the status bar text, etc. you can furthermore control javascript capabilities to remove scrollbars, toolbars or system buttons like minimize, close and maximize by editing the about:config related properties or by editing accordingly the user.js file as explained in this "disable other javascript window features" document. moving back and forward by web page (alt+left and alt+right) occurs near-instantaneously the download manager provides keyboard access to all of your recent downloads operating system "look and feel" support: mozilla's ...
Accessibility information for UI designers and developers
rs, you could offer a setting to turn off animations, or wrap the css in the prefers-reduce-motion media query. see also: understanding success criterion 2.3.3: animation from interactions content on hover or focus if content is revealed on hover or focus, for example in tooltips, there are some things to keep in mind: if the extra content obscures existing content, there should be a way to close it without moving focus if the extra content is opened on hover, hovering the additional content itself should not cause it to disappear consistent navigation navigation should be consistent across different pages on your site. it does not need to be exactly the same, it is fine to have a different current menu item or different subnavigation links. do make sure they appear in the same place...
CSUN Firefox Materials
everyone! ie tab allows you to embed internet explorer into firefox tabs. this extension is useful for making ie specific sites, or site that read better in ie, open directly in firefox, while using the internet explorer engine tab mix plus completely enhances firefox's tab browsing capabilities. it includes such features as duplicating tabs, controlling tab focus, tab clicking options, undo closed tabs and windows, plus much more. it also includes a full-featured session manager with crash recovery that can save and restore combinations of opened tabs and windows. fire vox is a screen reader extension built just for firefox which can read mathml the accessibility extension, from the university of illinois, provides new menus and keyboard shortcuts for accessing every feature of a web ...
Mozilla Plugin Accessibility
st problems can be solved. problem planned solution owner targeted completion 1. all browser keys unavailable when plugin has focus focused plugins currently have no choice but to consume all keyboard events. the new plugin api will allow plugins to bubble unused keypresses to the browser. this will allow keyboard users to still access menus, close the current page, scroll, move back and forward in history, etc. if the plugin needs those keystrokes, the can consume them and not pass them on. see the plugin keyboard navigation proposal for the implementation plan. the same solution will be used for bug 140566 (full page plugins) and bug 78414 (partial page plugins), as well as the linux-specific bug 84159 and mac-specific bug 180426. ?
Mozilla’s UAAG evaluation report
rt. (p2) c when focus and/or selection changes they are in the viewport 5.5 confirm form submission. (p2) p only allows confirmation if the information is not secure? this is also under preferences, security, ssl, "sending form data from unencrypted page to unencrypted page" 5.6 confirm fee links. (p2) ni no support of fee links 5.7 manual viewport close only. (p3) c just fixed! see bug 32571 for more information. guideline 6. implement interoperable application programming interfaces. checkpoint title status notes/plans 6.1 dom read access. (p1) vg the dom is available in-process, but not via an out-of-process (com) interface. out-of-process access is needed for it to be truly useful for assi...
Adding a new CSS property
custom parsing code for a shorthand, you'll need to ensure that any successful parse sets all of the subproperties of the shorthand (since that's the way shorthands work in css). some common mistakes to watch out for when writing custom parsing code (which might go away if we redesign the parser along the lines described in css3-syntax): make sure to call skipuntil() to look for the matching close parentheses, braces, or brackets whenever you hit an error inside of them. make sure to call ungettoken() if you have called gettoken() but the result is unexpected. this is particularly important in case the unexpected token is a parenthesis or something else that requires matching the other half of a pair. if you're adding a preference-controlled property to a non-preference-controlled short...
Simple Instantbird build
ip or virtualenv because of os access denied errors, where access is denied not because of permission problems, but because the paths being accessed have been truncated, and so do not exist). having the source deep in a filesystem hierarchy can also cause problems with pymake builds on windows. if you run into seemingly arbitrary problems in building and the source is deeply nested, try moving it close to the root of your machine and re-building. get the latest source code from mozilla's comm-central mercurial code repository: hg clone http://hg.mozilla.org/comm-central then, get all the repositories it depends on. the comm-central repository includes a script to do just that. this may take a while, it's a lot of code! first, cd into the comm-central subdirectory (created automatically by t...
pymake
ly type in pymake -f client.mk from within the mingw32 shell. while in the shell type cd ~ (without quotes). type touch .profile using any appropriate text editor open .profile and add the following line in the file (assuming your mozilla-central is at c:/mozilla-central, if not, adjust your path accordingly.) alias pymake=c:/mozilla-central/build/pymake/make.py save your .profile edit and close the shell, then restart the shell. try typing just pymake into the shell and press enter. this should come back with "no makefile found." if it does, your pymake alias is connected and you are ready to type in pymake -f client.mk to start the build. unlike gmake on windows, pymake is capable of doing parallel builds, so you can set a moz_make_flags=-jn in your .mozconfig without risk of deadlo...
Gecko Logging
foolog("foo"); logging interface a basic interface is provided in the form of 2 macros and an enum class. mozilla logging macros moz_log(module, level, message) outputs the given message if the module has the given log level enabled. module - the log module to use. level - the log level of the message. message - a printf-style message to output. must be enclosed in parentheses. moz_log_test(module, level) checks if the module has the given level enabled. module - the log module to use. level - the output level of the message. log level numeric value purpose mozilla logging levels disabled 0 indicates logging is disabled. this should not be used directly in code.
Reviewer Checklist
va, memory leaks are largely due to singletons holding on to caches and collections, or observers sticking around, or runnables sitting in a queue. in c++, cycle-collect as needed. if javascript can see your object, it probably needs to be cycle-collected. [fennec: if your custom view does animations, it's better to clean up runnables in ondetachfromwindow().] ensure all file handles and other closeable resources are closed appropriately. [fennec: when writing tests that use paintedsurface, ensure the paintedsurface is closed when you're done with it.] performance impact check for main-thread io [fennec: android may warn about this with strictmode]. remove debug logging that is not needed in production. threading issues enormous: correct use of locking and volatility; livelock an...
Displaying Places information using views
vhistoryquery objects. options an nsinavhistoryqueryoptions object. selectitems() selects the first node in the tree that matches each given item id. it will open any parent nodes that it needs to in order to show the selected items. void selectitems( array aids, array aopencontainers ); parameters aids an array of item ids. aopencontainers if true or undefined, folders that are closed are also searched. they are not searched otherwise. optional. selectnode() causes a particular node to be selected in the tree, resulting in all containers above the node in the hierarchy to be opened so that the node is visible. void selectnode( nsinavhistorynode node ); parameters node the nsinavhistoryresultnode to select. selectplaceuri() causes a particular node represented b...
Multiple Firefox profiles
profile manager window in which you can make your selection. hit return. here is a complete example terminal command from steps 2-3: /applications/firefox.app/contents/macos/firefox -profile /users/suzie/library/application\ support/firefox/profiles/r99d1z7c.default if the profile manager window does not open, firefox may have been running in the background, even though it was not visible. close all instances of firefox, or restart the computer, and then try again. if you want to do this frequently and more easily, you may wish to create an automator application, as explained in this tutorial. creating a profile creating a profile through the profile manager these instructions should be the same for all operating systems. to start the create profile wizard, click "create profile...
Frame script environment
is that work in the chrome process will not work in a frame script. see limitations of frame scripts for more details. events besides the regular dom events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload fires when the frame script environment is shut down, i.e. when a tab gets closed. if you use a capturing event listener on the contentframemessagemanager, you should verify that its event.target is set to the contentframemessagemanager global object in order to avoid handling unload events from content. does not bubble. domwindowcreated fires when a new content object is created. this can be used if a framescript needs to interact wi...
Communicating with frame scripts
es: var messagemanagers = []; ... ...
Frame script environment
ocess do not work in a frame script. see limitations of frame scripts for more details. events besides the regular dom events being captured/bubbling up from content the current content object the following additional events get fired in a frame script environment: unload bubbles no fires when the frame script environment is shut down, i.e. when a tab gets closed. if you use a capturing event listener on the contentframemessagemanager, you should verify that its event.target is set to the contentframemessagemanager global object to avoid handling unload events from content. domwindowcreated fires when a new content object is created. this can be used if a framescript needs to interact with individual dom windows inste...
Process scripts
apis are the same: sendasyncmessage() is available in both directions, while sendsyncmessage() is available from content to chrome only process scripts are system-privileged, and have access to the components object. however, process scripts are subject to the same kinds of limitations as frame scripts (for example, no file system access). process scripts stay loaded until their host process is closed. the environment for process scripts is similar to that for frame scripts. however, you don't get access to web content or dom events from a process script. retrieving the content frame message manager for a content window when an observer notification in a process script contains a content document or window it can be useful to not use talk through the child/parent process message managers ...
Performance best practices for Firefox front-end engineers
uestanimationframe() has a high probability of causing a synchronous reflow. other useful methods below you'll find some suggestions for other methods which may come in handy when you need to do things without incurring synchronous reflow. these methods generally return the most-recently-calculated value for the requested value, which means the value may no longer be current, but may still be "close enough" for your needs. unless you need precisely accurate information, they can be valuable tools in your performance toolbox. nsidomwindowutils.getboundswithoutflushing() getboundswithoutflushing() does exactly what its name suggests: it allows you to get the bounds rectangle for a dom node contained in a window without flushing layout. this means that the information you get is potentially o...
Firefox UI considerations for web developers
also known as rich icons—are specified by setting the rel attribute to one of: apple-touch-icon apple-touch-icon-precomposed fluid-icon the size of each icon is taken from the size attribute specified on the <link>, if it's provided. apple-touch-icon and apple-touch-icon-precomposed icons with no size attribute are assumed to be the standard classic iphone size of 57x57 pixels. the icon closest in size to 96 pixels is selected. firefox does its best to avoid having to scale the images, which can result in fuzzy or distorted images, especially at smaller sizes. providing a top sites ready icon the simple rule is to provide an icon which is at least 96x96 pixels in size, using a <link> element whose rel attribute is a reference to a file containing an icon of a supported type. <link ...
mozbrowseractivitydone
at indicates whether the activity has completed successfully (true) or not (false). ...
mozbrowserasyncscroll
means that the value retrieved through the event object can be different than the real current position of the scroll when the event is processed. ...
mozbrowseraudioplaybackchange
bubbles or not. cancelable read only boolean whether the event is cancellable or not. details read only boolean indicates whether audio is playing in the browser. ...
mozbrowsercaretstatechanged
currently-selected text content. senddocommandmsg a method allowing you to issue a command via an anonymouse function, i.e. function(command). possible values are cut, copy, paste and selectall. ...
mozbrowsercontextmenu
lected. items an array of further menu objects, which indicate the menu options available in a menu, if the context menu being accessed is a menu. ...
mozbrowsererror
deniedportaccess proxyresolvefailure proxyconnectfailure contentencodingfailure remotexul unsafecontenttype corruptedcontenterror certerror other example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsererror", function( event ) { console.log("an error occurred:" + event.detail); }); related events mozbrowserasyncscroll mozbrowserclose mozbrowsercontextmenu mozbrowsericonchange mozbrowserloadend mozbrowserloadstart mozbrowserlocationchange mozbrowseropenwindow mozbrowsersecuritychange mozbrowsershowmodalprompt mozbrowsertitlechange mozbrowserusernameandpasswordrequired ...
mozbrowsericonchange
also be used, to represent "any size." rel a domstring representing the rel attribute value from the <link> element used to link to the icon. ...
mozbrowserloadend
83, 159). ...
mozbrowserloadstart
e used to change the icon shown on the stop/reload button between stop (x) and reload (r), as appropriate. ...
mozbrowserlocationchange
ssible to go forward in the navigation history (true) or not (false). example this example updates the url bar so that it will always display the correct url for the current location. ...
mozbrowseropensearch
owing properties: title a domstring representing the title of the search engine. href a domstring representing url of the search engine. ...
mozbrowseropentab
us javascript object with the following properties: url a domstring representing the url of the new document loaded. ...
mozbrowseropenwindow
res, see window.open(). frameelement an object representing the new browser <iframe> that will embed the new content. ...
mozbrowserresize
viewport, in device pixels. height a number representing the new height of the <iframe> viewport, in device pixels. ...
mozbrowserscroll
oll position of the <iframe> viewport — in css pixels — from the left of the viewport. ...
mozbrowserscrollareachanged
t a number representing the new scroll area height of the <iframe> viewport, in css pixels. ...
mozbrowserscrollviewchange
llowing properties: state a domstring representing the current state of scrolling in the viewport — available values are started and stopped. ...
mozbrowsersecuritychange
nt on the current page (true) or not (false). mixedcontent a boolean indicating if mixed content is present on the current page (true) or not (false). ...
mozbrowserselectionstatechanged
. states the current state of the selection. ...
mozbrowsershowmodalprompt
message. for that event, it's always showmodalprompt. initialvalue a string representing the initial value for the window.prompt() methods. ...
mozbrowsertitlechange
cancelable read only boolean whether the event is cancellable or not. detail read only string the title of the document. ...
mozbrowserusernameandpasswordrequired
wo parameters — the username and password to authenticate. cancel() a function that is called to cancel the authentication. ...
mozbrowservisibilitychange
that indicates whether the browser iframe is visible (true) or not (false). ...
Browser API
consumed by the receiving app. mozbrowserasyncscroll sent when the browser <iframe> content scrolls (the apcz version.) see also mozbrowserscroll. note that this is obsolete. mozbrowseraudioplaybackchange sent when audio starts or stops playing within the browser <iframe> content. mozbrowsercaretstatechanged sent when the text selected inside the browser <iframe> content changes. mozbrowserclose sent when window.close() is called within a browser <iframe>. mozbrowsercontextmenu sent when a browser <iframe> tries to open a context menu. this allows handling of the <menuitem> element available within the browser <iframe>'s content. mozbrowserdocumentfirstpaint sent when a new paint occurs on any document in the browser <iframe>. mozbrowsererror sent when an error occurs while tryin...
Embedding the editor
lients get at the editorshell (or its replacement, post-embedding work) from the window. ensure that focus changes between editors update the window's notion of the "current" editor. if we continue to use window.editorshell, then this needs to be updated on focus changes. ensure that each editor is properly constructed on window setup, and torn down on window destruction. ensure that window close tests (e.g. calling window.trytoclose) appropriately consult each editor for state. insulating editor from the chrome composer needs to not know anything about the ui that is driving it. the plan is to insulate composer from the ui via a new interface that the embedder implements. any ui that is now thrown up by composer should go through this interface. use a new interface, nsieditoruserinte...
How to add a build-time test
lone executables, if one sets up the right variables, then the rules.mk file will do lots of magic and most of the heavy lifting. a simple example of adding a test is in . note that the following variables are supplied by the rules.mk file: cppsrcs, simple_programs, run_test_program. xpcshell tests here are the simple guidelines for adding an xpcshell test to the build system. for now, enclose your test-related code (in the makefile) with ifdef enable_tests run the test program from the "check" target in the makefile. (example to run the testcookie program) in the test program: if the test fails, exit with a non-zero status and/or print the string "fail" to stdout if the test passes, exit with a zero status and don't print the string "fail" (bonus points for printing "pa...
How to get a stacktrace with WinDbg
event caused by flash player, and record a log of loaded modules. you will also want to open a log file to save data you collect. to do this, enter these four commands, pressing enter after each one. .logopen /t c:\temp\firefox-debug.log .childdbg 1 .tlist sxn gp lm if you see firefox.exe listed in the output from .tlist more than once, then you are already running the application and need to close the running instance first before you start debugging, otherwise you won't get useful results. now run firefox by opening the debug menu and clicking go. while firefox is running, you will not be able to type any commands into the debugger. after it starts, try to reproduce the crash or hanging issue that you are seeing. if firefox fails to start, and you see lines of text followed by a command...
How to investigate Disconnect failures
this article will guide you on how to investigate disconnect failures. an example of such a failure disconnect failures happens when one side is closing the connection and mozmill is unable to send the information over the bridge or when firefox crashes. usually disconnects happens when a modal dialog freezes and we cannot close it sp we close firefox with the modal frozen. we cannot investigate failures via mozmill, because we do not catch the crashes, so the crashes' information is not logged; we have to go to ci machines and investigate directly. check if firefox crashed: windows: [user]/appdata\roaming\mozilla\firefox\crash reports ubuntu: [user/home]/.mozilla/firefox/crash reports and there we can check by timestamp if firefox crashed when we had the disconnect. che...
Introduction to Layout in Mozilla
pl object, which is returned as nsicontentviewer back to the docshell documentviewerimpl creates pres context and pres shell content model construction content arrives from network via nsistreamlistener::ondataavailable parser tokenizes & processes content; invokes methods on nsicontentsink with parser node objects some buffering and fixup occurs here opencontainer, closecontainer, addleaf content sink creates and attaches content nodes using nsicontent interface content sink maintains stack of “live” elements more buffering and fixup occurs here insertchildat, appendchildto, removechildat frame construction content sink uses nsidocument interface to notify of Δs in content model contentappended, contentinser...
NetUtil.jsm
euri) string readinputstreamtostring(ainputstream, acount, aoptions) attributes attribute type description ioservice nsiioservice returns a reference to nsiioservice. methods asynccopy() the asynccopy() method performs a simple asynchronous copy of data from a source input stream to a destination output stream. both streams are automatically closed when the copy operation is completed. nsiasyncstreamcopier asynccopy( asource, asink, acallback ); parameters asource the input stream from which to read the source data. this must be an nsiinputstream based object. asink the output stream to which to copy the data. this must be an nsioutputstream based object. acallback an optional function that will be called when the copy ope...
PopupNotifications.jsm
will appear when the user clicks the anchor. eventcallback a javascript function to be invoked when the notification changes state. the callback's first parameter is a string identifying the state change that occurred. see notification events below. nevershow notifications with this parameter set to true will be removed when they would have otherwise been dismissed (i.e. any time the popup is closed due to user interaction). removeondismissal notifications with this parameter set to true will be removed when they would have otherwise been dismissed (that is, any time the popup is closed due to user interaction). popupiconurl a string specifying the url of the image to be displayed in the popup. this is normally specified in css using list-style-image and the .popup-notification-icon[po...
Webapps.jsm
atehandler: function(ahandler) notifyupdatehandlers: function(aapp, amanifest, azippath) _getappdir: function(aid) _writefile: function(apath, adata) dogetlist: function() doexport: function(amsg, amm) doimport: function(amsg, amm) doextractmanifest: function(amsg, amm) dolaunch: function (adata, amm) launch: function launch(amanifesturl, astartpoint, atimestamp, aonsuccess, aonfailure) close: function close(aapp) canceldownload: function canceldownload(amanifesturl, aerror) startofflinecachedownload: function(amanifest, aapp, aprofiledir, aisupdate) computemanifesthash: function(amanifest) updateapphandlers: function(aoldmanifest, anewmanifest, aapp) checkforupdate: function(adata, amm) doinstall: function doinstall(adata, amm) doinstallpackage: function doinstallpackage(adata...
Application Translation with Mercurial
com> merge = internal:merge [alias] qexport = export -g -r qtip qexportall = diff -r qparent [defaults] commit = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = progress = [hooks] put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded. save the file and close it. enabling mercurial queues (revertable patches) some time will pass between the moment in which you start the localization, finish it, test it, improve it, upload it for review and get review (maybe not approved on first try). other localizers will likely have done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts. this can cause confl...
Index
ool from the create a new localization document, an interested localizer can follow a technical step-by-step process that starts the localization process by focusing on how to localize two of the primary types of localization files (dtd and properties) used in the mozilla source code. with that document, users can see immediately two localized files in their user interface by following closely and carefully the steps to create a language pack or a binary file that is ready for installation. repeating the process allows a localizer to create a testable package to see his or her work as they progress to a final version. 28 mozilla l10n style guide localization cultural references, idioms, and slang require a full understanding of these references between the cultur...
L10n Checks
-importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities removed and added with a similar name. the file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper. the output closes with a summary, giving the total counts of missing and obsolete strings and some statistics on how many strings are changed or not, excluding access and command keys. that gives localizers an idea on how thorough the localization is. this number won't reach 100% in general; mid 80s should be the target, though. options reference locale in the source and xpi modes you can change the default refer...
L10n testing with xcode
into the project by adding them to the project folder and replacing the existing strings. next, you need to configure the ios app simulator to run the app in your locale. choose product > scheme > edit scheme from the toolbar menu. in the edit scheme screen, select run from the left pane and then navigate to the options tab. select your language from the application language menu and click close. tah dah! you're ready to test your localization of firefox on ios. launching & testing your firefox on ios localization the ios simulator is fairly easy to use once you launch your app. to perform the next steps, you'll need to be familiar with how user gestures and hardware interactions work in the simulator. this guide should help. press the run button in the upper left-hand co...
Localization content best practices
is this a noun or a verb? using meaningful ids could also help in these cases. strings are used in a specific context. for example accessibility (a11y) strings: in this case space is less important than clarity, since these strings are not displayed in the ui but used by tools like screen readers. there is an established format for localization comments: it's important to follow the format as closely as possible, since there are a number of automated tools that parse these comments for easier access and use by localizers. dtd files <!-- localization note (entity name): {{privacy}} will be replaced at run-time by an active link. the string 'privacy-link' will be used as text for this link. --> properties files # localization note(privacy-text): {{privacy}} will be replaced at run-t...
Localization notes
localizers usually work on the localizable files without the context of the source files including the localized strings; it is important to add comments to the localizable files themselves, too. these comments are generally referred to as localization notes. there is an established format for those, which is described in this document. it's important to follow the format as closely as possible. there are a number of automated tools that parse these comments for easier access and use by localizers. dtd files <!-- localization note (entity name): comment --> properties files # localization note (key): comment file-wide comments should use the same format, be at the top of the file (after the license header, though) and just drop the (entity name/key) reference. ...
Fonts for Mozilla 2.0's MathML engine
tical characters. starting in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), mozilla can also use the glyphs contained in that font for stretchy operators. starting in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10), mathjax fonts are used as the default fonts for mathematical text and symbol stretching. these fonts are freely available under the apache license. they are close to latex rendering and should look more familiar to scientists. mathjax fonts also improves support for mathvariant attribute (e.g. to write double-struck, script or fraktur text). all the fonts mentioned above may already be installed by default on your system or can easily be installed via your software manager. for convenience we provide a zip archive of mathml fonts. the fonts may be installe...
MathML Torture Test
>)</mo></mrow><mi>&#x1ee1d;</mi></msup></mrow><mo>=</mo><mn>1</mn></math></td> <td><math dir="rtl" display="block" xmlns="http://www.w3.org/1998/math/mathml"><mrow><munder><mo lspace="0em" rspace="0em" mathcolor="red">lim</mo><mrow><mi>&#x1ee1d;</mi><mo stretchy="false">←</mo><mo>+</mo><mn>∞</mn></mrow></munder><mfrac><msqrt><mrow><mn>٢</mn><mi>π</mi><mi>&#x1ee1d;</mi></mrow></msqrt><menclose notation="madruwb"><mi>&#x1ee1d;</mi></menclose></mfrac><msup><mrow><mo>(</mo><mfrac><mi>&#x1ee1d;</mi><mi>e</mi></mfrac><mo>)</mo></mrow><mi>&#x1ee1d;</mi></msup></mrow><mo>=</mo><mn>1</mn></math></td> <td><math display="block" xmlns="http://www.w3.org/1998/math/mathml"><mrow><munder><mo lspace="0em" rspace="0em">&#x1eef1;</mo><mrow><mi>n</mi><mo stretchy="false">→</mo><mo>+</mo><mn>∞</m...
Mozilla MathML Status
emented. msqrt implemented. mroot implemented. mstyle implemented. we are only interested in supporting attributes "inherited from the surrounding context", which are those effectively used in practice. see bug 838509. merror implemented. mpadded implemented. mphantom implemented. mfenced implemented. menclose implemented. script and limit schemata element [- attribute] notes msub implemented. msup implemented. msubsup implemented. munder implemented. mover implemented. munderover implemented. mmultiscripts implemented. tabular math element [- attribute] notes mtable im...
Mozilla DOM Hacking Guide
lls registerclassprotos and registerclassnames. this process might be described in a later document. finally, sisinitialized is set to true. init() returns ns_ok if everything went fine. nsdomclassinfo::getclassinfoinstance() there are two versions of this function. the first one takes an id as argument, the second takes a data struct as argument. this function is very important so let's take a closer look at it. here is the function definition. nsiclassinfo* nsdomclassinfo::getclassinfoinstance(nsdomclassinfoid aid) { if(!sisinitialized) { nsresult rv = init(); } if(!sclassinfodata[aid].mcachedclassinfo) { nsdomclassinfodata &data = sclassinfodata[aid]; data.mcachedclassinfo = data.u.mconstructorfptr(&data); ns_addref(data.mcachedclassinfo); } return sclassinfodata[aid].mcachedclassinfo; ...
Leak-hunting strategies and tips
ection -- when a js object is used to implement an xpcom interface and be used transparently by native code. the nsxpcwrappedjs object creates a gc root that exists as long as the wrapper does. the wrapper itself is just a normal reference-counted object, so a leaked nsxpcwrappedjs can be debugged using the normal refcount-balancer tools. if you really need to debug leaks that involve js objects closely, you can get detailed printouts of the paths js uses to mark objects when it is determining the set of live objects by using the functions added in bug 378261 and bug 378255. (more documentation of this replacement for gc_mark_debug, the old way of doing it, would be useful. it may just involve setting the xpc_shutdown_heap_dump environment variable to a file name, but i haven't tested that.) ...
Profiling with Xperf
uilds, add c:\path\to\objdir\dist\bin to _nt_symbol_path. as with all windows paths, the symbol path uses semicolons (;) as separators. make sure you select the trace -> load symbols menu option in the windows performance analyzer (xperfview). there seems to be a bug in xperf and symbols; it is very sensitive to when the symbol path is edited. if you change it within the program, you'll have to close all summary tables and reopen them for it to pick up the new symbol path data. you'll have to agree to a eula for the microsoft symbols -- if you're not prompted for this, then something isn't configured right in your symbol path. (again, make sure that the directories exist; if they don't, it's a silent error.) quick start all these tools will live, by default, in c:\program files\microsoft wi...
TraceMalloc
any buffered log events for all log files. tracemallocenable() - turn on tracing. tracemallocopenlogfile(filename) - open a new log file and return its log file descriptor (or -1 on error). tracemallocchangelogfd(logfd) - change the current log file to the one identified by logfd, returning the previous fd (so you can maintain a number of open files; keep their fds in a js array!). tracemalloccloselogfd(logfd) - close the log file identified by logfd, flushing its buffer of any events first. if logfd identifies the current log file, change the current log file to the default log file given by the --trace-malloc command line argument. tracemalloclogtimestamp(caption) - log a timestamp event to the current log file, annotating the log even with the caption string. tracemallocdumpallocations...
Phishing: a short definition
y disguising as a trustworthy entity online. a relatively simple, yet effective, phishing scheme is sending an email with a fake invoice of a person’s favorite shopping site. this email will usually contain a link pretending to lead to the original service, but in reality, taking the victim to an attacker-controlled website. the login portal might resemble the trusted website's login page very closely, and convince users to enter their credentials, letting others hijack their account. past and current countermeasures various technical, and social approaches, exist to combat phishing attacks. none of these are sufficient by themselves, so we see a mix of these deployed by various services. the following is a non-exhaustive list of the most common approaches. shifting blame to users some q...
Patches and pushes
uests), fix those before committing. also, no new patch attachment will be needed. commit the patch to your aurora repo. only commit the changes you have reviewed. use a commit message that mentions the bug number, describes the change, and mentions the reviewer. for example: hg ci -m "bug 654321, copied the comment from the doc without reading, r=nobody" path-to-changed-files close the bug, copying the url to your change in the closing comment. write up something like this for your comment: landed this on aurora, http://hg.mozilla.org/releases/l10n/mozilla-aurora/ab-cd/rev/adfe1234feac, marking fixed. update your sign-offs on the l10n dashboard to include the change into the next release. and that's it! it can be considered a bit complicated at first, but after you do ...
Profile Manager
wn as locked in the main window. such profiles are currently being used by an instance of firefox. if you attempt to perform any operation on a locked profile, you'll get a warning; if you choose to continue despite the warning, you may encounter errors or corrupt a profile. it's strongly recommended to avoid operations on locked profiles. if you need to do something with a locked profile, close the instance of firefox which is using the profile first. backing up and restoring profiles profile manager offers two different mechanisms for backing up and restoring profiles. backup folder profile manager has a local backup folder where it can manage profile backups. this is the easiest way to backup and restore profiles. to backup a profile: select the profile you want to backup,...
Emscripten
ies in their sites. practically any portable c or c++ codebase can be compiled into javascript using emscripten, ranging from high performance games that need to render graphics, play sounds, and load and process files, through to application frameworks like qt. emscripten generates fast code — its default output format is asm.js , a highly optimizable subset of javascript that can execute at close to native speed in many cases. note: sound interesting? read more about emscripten and try some demos, then get started with using it. other articles of interest on mdn our games zone contains some useful content related to games development, which is a common area of use for emscripten. our emscripten techniques page is a place to store useful emscripten-related ideas that haven't made i...
Leak Monitor
leak monitor is a firefox extension by l. david baron that helps extension and chrome developers to find memory leaks. it will pop-up an alert when a window is closed and javascript still links to that window (for example, an observer that is not cleared when the window closes). obtain the extension on amo (addons.mozilla.org) view more information on leak monitor on david baron's page ...
Leak And Bloat Tests
ged. provide reasonable coverage for the normal activities that a user performs. method current method: measure leaks and bloats, in a similar way to firefox (using xpcom_mem_leak_log and --trace-malloc). the method of testing memory bloat and leaks will be the same sequence of events, using the same set of test data. startup main mail window open address book and message composition windows close address book and message composition windows quit the application future improvements will be discussed on the discussion page of the mozilla wiki. 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. there are curren...
Creating a Cookie Log
type "export nspr_log_modules=cookie:4" and press return. run firefox by typing "./firefox-bin" and pressing return (note that firefox will launch behind windows for other applications). creating the log now that you have firefox running with logging enabled, please try to replicate the bug using the steps to reproduce from the bug report. once you have reproduced the bug, shut down firefox. close out of the command prompt/shell/terminal, and then launch firefox normally. finally, attach the cookie-log.txt file to the bug where it was requested (by clicking on create new attachment). it should be in c:\temp on windows, your home directory on linux, or the desktop on mac os x. thanks for helping us make firefox better! original document information author(s): mike connor last updated...
NSPR Contributor Guide
onventions can be found in nspr naming conventions in the nspr reference. see also: xxx ownership of your contribution when you contribute something to nspr, you must have intellectual property rights to that contribution. this means that you cannot give us something you snatched from somewhere else;. it must be your own invention, free and clear of encumberment of anyone or anything else; pay close attention to the rights of your "day-job" employer. if you snatched it from somewhere else, tell us where; show us where the right to incorporate it into nspr exists. license under mpl or gpl when you contribute material to nspr, you agree to allow your contribution to be licensed under the mpl or gpl. bugfixes use bugzilla to track bugs. document the bug or use an existing report. be verbo...
Nonblocking IO In NSPR
unctions <tt>pr_fd_nset</tt>, <tt>pr_fd_nclr</tt>, <tt>pr_fd_nisset</tt> do not work. pr_available() when <tt>pr_available()</tt> returns 0, it may mean one of two things: there is no data available for reading on that socket. i.e., <tt>pr_recv()</tt> would block (a blocking socket) or fail with <tt>pr_would_block_error</tt> (a nonblocking socket). the tcp connection on that socket has been closed (end of stream). these two cases can be distinguished by <tt>pr_poll()</tt>. if <tt>pr_poll()</tt> reports that the socket is readable (i.e., <tt>pr_poll_read</tt> is set in <tt>out_flags</tt>), and <tt>pr_available()</tt> returns 0, this means that the socket connection is closed. current status implemented across all supported platforms. original document information author: wan-teh c...
Optimizing Applications For NSPR
cking) of a socket cannot be changed at will once the socket has been used. also, the new socket created by an <tt>pr_accept()</tt> call on a listening socket inherits the mode of the listening socket, and cannot be changed. a file descriptor is not usable after an io operation on it fails with either <tt>pr_io_timeout_error</tt> or <tt>pr_io_interrupt_error</tt>. the only thing you can do is to close the file descriptor. see the faq article for more info. there is no current workaround. you must write your program with this restriction in mind. pr_interrupt is implemented except for <tt>pr_connect()</tt>. irix the irix (classic) implementation has a known race condition in creating new threads. if the spawned thread establishes and exits before the parent thread is resumed, the parent wi...
Condition Variables
the association between a condition and a monitor is established when a condition variable is created, and the association persists for its life. ...
Dynamic Library Linking
ollows. prlibrary *lib; void *funcptr; funcptr = pr_findsymbolandlibrary("functionname", &lib); when pr_findsymbolandlibrary returns, funcptr is the value of the function pointer you want to look up, and the variable lib references the main executable program. you can then call pr_findsymbol on lib to look up other symbols defined in the main program. remember to call pr_unloadlibrary(lib) to close the library handle when you are done. platform notes to use the dynamic library loading functions on some platforms, certain environment variables must be set at run time, and you may need to link your executable programs using special linker options. this section summarizes these platform idiosyncrasies. for more information, consult the man pages for ld and dlopen (or shl_load on hp-ux) for ...
IPC Semaphores
this chapter describes the nspr api for using interprocess communication semaphores. nspr provides an interprocess communication mechanism using a counting semaphore model similar to that which is provided in unix and windows platforms. note: see also named shared memory ipc semaphore functions ipc semaphore functions pr_opensemaphore pr_waitsemaphore pr_postsemaphore pr_closesemaphore pr_deletesemaphore ...
Introduction to NSPR
uld another thread (or the same thread) already have the lock held, the calling thread blocks, waiting for the situation to improve. that blocked state is not interruptible, nor is it timed. condition variables condition variables facilitate communication between threads. the communication available is a semantic-free notification whose context must be supplied by the programmer. conditions are closely associated with a single monitor. the association between a condition and a monitor is established when a condition variable is created, and the association persists for the life of the condition variable. in addition, a static association exists between the condition and some data within the monitor. this data is what will be manipulated by the program under the protection of the monitor. a t...
PRDir
with directory i/o functions. syntax #include <prio.h> typedef struct prdir prdir; description the opaque structure prdir represents an open directory in the file system. the function pr_opendir opens a specified directory and returns a pointer to a prdir structure, which can be passed to pr_readdir repeatedly to obtain successive entries (files or subdirectories in the open directory). to close the directory, pass the prdir pointer to pr_closedir. ...
PRFileMap
type returned by pr_createfilemap and passed to pr_memmap and pr_closefilemap. syntax #include <prio.h> typedef struct prfilemap prfilemap; description the opaque structure prfilemap represents a memory-mapped file object. before actually mapping a file to memory, you must create a memory-mapped file object by calling pr_createfilemap, which returns a pointer to prfilemap. then sections of the file can be mapped into memory by passing the prfilemap pointer to pr_memmap. the memory-mapped file object is closed by passing the prfilemap pointer to pr_closefilemap. ...
PRSockOption
etolive, pr_sockopt_iptypeofservice, pr_sockopt_addmember, pr_sockopt_dropmember, pr_sockopt_mcastinterface, pr_sockopt_mcasttimetolive, pr_sockopt_mcastloopback, pr_sockopt_nodelay, pr_sockopt_maxsegment, pr_sockopt_last } prsockoption; enumerators the enumeration has the following enumerators: pr_sockopt_nonblocking nonblocking i/o. pr_sockopt_linger time to linger on close if data is present in the socket send buffer. pr_sockopt_reuseaddr allow local address reuse. pr_sockopt_keepalive periodically test whether connection is still alive. pr_sockopt_recvbuffersize receive buffer size. pr_sockopt_sendbuffersize send buffer size. pr_sockopt_iptimetolive ip time-to-live. pr_sockopt_iptypeofservice ip type-of-service and precedence. pr_sockopt_addmember jo...
PRSocketOptionData
locking nonblocking (network) i/o. reuse_addr allow local address reuse. keep_alive periodically test whether connection is still alive. mcast_loopback ip multicast loopback. no_delay disable nagle algorithm. don't delay send to coalesce packets. max_segment tcp maximum segment size. recv_buffer_size receive buffer size. send_buffer_size send buffer size. linger time to linger on close if data are present in socket send buffer. add_member join an ip multicast group. drop_member leave an ip multicast group. mcast_if ip multicast interface address. description prsocketoptiondata is a name-value pair for a socket option. the option field (of enumeration type prsockoption) specifies the name of the socket option, and the value field (a union of all possible values) specifi...
PR_CreatePipe
pr_success. if the pipe is not successfully created, pr_failure. the error code can be retrieved via pr_geterror. description pr_createpipe creates an anonymous pipe. data written into the write end of the pipe can be read from the read end of the pipe. pipes are useful for interprocess communication between a parent and a child process. when the pipe is no longer needed, both ends should be closed with calls to pr_close. pr_createpipe is currently implemented on unix, linux, mac os x, and win32 only. ...
PR_DestroyPollableEvent
syntax nspr_api(prstatus) pr_destroypollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure previously created via a call to pr_newpollableevent. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. ...
PR_GetSpecialFD
...
PR_Interrupt
s. file i/o is considered instantaneous, so file i/o functions cannot be interrupted. unfortunately the standard input, output, and error streams are treated as files by nspr, so a pr_read call on pr_stdin cannot be interrupted even though it may block indefinitely. in the nt implementation, pr_connect cannot be interrupted. in the nt implementation, a file descriptor is not usable and must be closed after an i/o function on the file descriptor is interrupted. see the memo using io timeout and interrupt on nt for details. ...
PR_NewTCPSocket
nd server may send and receive data between each other. to receive data, one can call pr_read or pr_recv. to send data, one can call pr_write, pr_writev, pr_send, or pr_transmitfile. pr_acceptread is suitable for use by the server to accept a new client connection and read the client's first request in one function call. a tcp connection can be shut down by pr_shutdown, and the sockets should be closed by pr_close. see also pr_newtcpsocket is deprecated because it is hardcoded to create an ipv4 tcp socket. new code should use pr_opentcpsocket instead, which allows the address family (ipv4 or ipv6) of the new tcp socket to be specified. ...
PR_NewUDPSocket
datagram protocol) is a connectionless, unreliable datagram protocol of the tcp/ip protocol suite. udp datagrams may be lost or delivered in duplicates or out of sequence. pr_newudpsocket creates a new udp socket. the socket may be bound to a well-known port number with pr_bind. datagrams can be sent with pr_sendto and received with pr_recvfrom. when the socket is no longer needed, it should be closed with a call to pr_close. see also pr_newudpsocket is deprecated because it is hardcoded to create an ipv4 udp socket. new code should use pr_openudpsocket instead, which allows the address family (ipv4 or ipv6) of the new udp socket to be specified. ...
PR_Open
roth 0004 read permission, others pr_iwoth 0002 write permission, others pr_ixoth 0001 execute/search permission, others returns the function returns one of the following values: if the file is successfully opened, a pointer to a dynamically allocated prfiledesc for the newly opened file. the prfiledesc should be freed by calling pr_close. if the file was not opened successfully, a null pointer. description pr_open creates a file descriptor (prfiledesc) for the file with the pathname name and sets the file status flags of the file descriptor according to the value of flags. if a new file is created as a result of the pr_open call, its file mode bits are set according to the mode parameter. ...
PR_OpenDir
e function returns a pointer to it. if the directory cannot be opened, the function returns null. 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. the prdir pointer should eventually be closed by a call to pr_closedir. ...
PR_PushIOLayer
wapped into another container, including the reference to the object's destructor. if the original container was allocated using a different mechanism than used by the runtime, the default calling of the layer's destructor by the runtime will fail pr_createiolayerstub is provided to allocate layer objects and template implementations). the destructor will be called on all layers when the stack is closed (see pr_close). if the containers are allocated by some method other than pr_createiolayerstub, it may be required that the stack have the layers popped off (in reverse order that they were pushed) before calling pr_close. ...
PR_Read
e following parameters: fd a pointer to a prfiledesc object for the file or socket. buf a pointer to a buffer to hold the data read in. on output, the buffer contains the data. amount the size of buf (in bytes). returns one of the following values: a positive number indicates the number of bytes actually read in. the value 0 means end of file is reached or the network connection is closed. the value -1 indicates a failure. to get the reason for the failure, call pr_geterror. description the thread invoking pr_read blocks until it encounters an end-of-stream indication, some positive number of bytes (but no more than amount bytes) are read in, or an error occurs. ...
PR_ReadDir
if the end of the directory is reached, pr_readdir returns null, and pr_geterror returns pr_no_more_files_error. see also pr_opendir ...
PR_Recv
er to a buffer to hold the data received. amount the size of buf (in bytes). flags must be zero or pr_msg_peek. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_recv blocks until some positive number of bytes are transferred, a timeout occurs, or an error occurs. no more than amount bytes will be transferred. ...
PR_RecvFrom
ro. addr a pointer to the prnetaddr object that will be filled in with the address of the sending peer on return. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. description pr_recvfrom receives up to a specified number of bytes from socket, which may or may not be connected. the operation blocks until one or more bytes are transferred, a timeout has occurred, or there is an error. no more than amount bytes will be transferred. pr_recvfrom is usually...
JSS FAQ
Mozilla › Projects › NSS › JSS › JSS FAQ
the using jss document describes how to set up your environment to run jss. the only other documentation is the javadoc. ...
NSS 3.12.4 release notes
bug 470500: firefox 3.1b2 crash report [[@ nssutil3.dll@0x34c0 ] bug 482742: enable building util independently of the rest of nss bug 483653: unable to build certutil.exe for fennec/wince bug 485145: miscellaneous crashes in signtool on windows bug 485155: n...
NSS 3.15.1 release notes
.15.1 bug 856060 - enforce name constraints on the common name in libpkix when no subjectaltname is present. bug 875156 - add const to the function arguments of sec_certnicknameconflict. bug 877798 - fix ssltap to print the certificate_status handshake message correctly. bug 882829 - on windows, nss initialization fails if nss cannot call the rtlgenrandom function. bug 875601 - secmod_closeuserdb/secmod_openuserdb fails to reset the token delay, leading to spurious failures. bug 884072 - fix a typo in the header include guard macro of secmod.h. bug 876352 - certutil now warns if importing a pem file that contains a private key. bug 565296 - fix the bug that shlibsign exited with status 0 even though it failed. the nss_survive_double_bypass_failure build option is removed. b...
NSS 3.28.1 release notes
:5c:60:1a:4e:9b:18:de:dc:ea:08:e7:da:aa:07:81:5f:f0 the version number of the updated root ca list has been set to 2.11 a misleading assertion/alert has been removed, when nss tries to flush data to the peer but the connection was already reset. bugs fixed in nss 3.28.1 bug 1296697 - december 2016 batch of root ca changes bug 1322496 - internal error assert when the other side closes connection before reading eoed compatibility nss 3.28.1 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.28.1 shared libraries without recompiling or relinking. furthermore, applications that restrict their use of nss apis to the functions listed in nss public functions will remain compat...
NSS 3.41 release notes
ibution information the hg tag is nss_3_41_rtm. nss 3.41 requires nspr 4.20 or newer. nss 3.41 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_41_rtm/src/ new in nss 3.41 new functionality bug 1252891 - implemented eku handling for ipsec ike. bug 1423043 - enable half-closed states for tls. bug 1493215 - enabled the following ciphersuites by default: tls_ecdhe_ecdsa_with_aes_256_gcm_sha384 tls_ecdhe_rsa_with_aes_256_gcm_sha384 tls_dhe_rsa_with_aes_256_gcm_sha384 tls_rsa_with_aes_256_gcm_sha384 new functions none notable changes in nss 3.41 the following ca certificates were added: cn = certigna root ca sha-256 fingerprint: d48d3d2...
FC_GetSessionInfo
ssion, i.e., no role is assumed, the user role is assumed, or the crypto officer role is assumed flags: bit flags that define the type of session ckf_rw_session (0x00000002): true if the session is read/write; false if the session is read-only. ckf_serial_session (0x00000004): this flag is provided for backward compatibility and is always set to true. return value examples see also fc_closesession, nsc_opensession ...
FC_Logout
name fc_logout - log a user out from a token. ...
FC_OpenSession
o a session handle. ...
NSS tools : cmsutil
ient2, ..." certificate-only example cmsutil -o [-i infile] [-o outfile] [-d dbdir] [-p password] -r "cert1,cert2, . . ." sign message example cmsutil -s [-i infile] [-o outfile] [-d dbdir] [-p password] -n nickname[-tgp] [-y ekprefnick] see also certutil(1) see also additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [2]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: pki-devel@redhat.com and pki-users@redhat.com irc: freenode at #dogtag-pki authors the nss tools...
NSS tools : crlutil
eting crl from db: crlutil -d -n nickname [-d keydir] [-p dbprefix] * erasing crls from db: crlutil -e [-d keydir] [-p dbprefix] * import crl from file: crlutil -i -i crl [-t crltype] [-u url] [-d keydir] [-p dbprefix] [-b] see also certutil(1) see also additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [2]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: pki-devel@redhat.com and pki-users@redhat.com irc: freenode at #dogtag-pki authors the n...
NSS_3.12.3_release_notes.html
bug 464406: fix signtool regressions bug 465270...
NSS Tools certutil
for example: -t "tcu,cu,tuw" use the -l option to see a list of the current certificates and trust attributes in a certificate database. -u certusage specify a usage context to apply when validating a certificate with the -v option. the contexts are the following: c (as an ssl client) v (as an ssl server) s (as an email s...
NSS Tools modutil
of the certificate and key databases is not recommended. -libfile library-file specify a path to the dll or other library file containing the implementation of the pkcs #11 interface module that is being added to the database. -ciphers cipher-enable-list enable specific ciphers in a module that is being added to the database. the cipher-enable-list is a colon-delimited list of cipher names. enclose this list in quotation marks if it contains spaces. the following cipher is currently available: fortezza. -mechanisms mechanism-list specify the security mechanisms for which a particular module will be flagged as a default provider. the mechanism-list is a colon-delimited list of mechanism names. enclose this list in quotation marks if it contains spaces. the module becomes a default provider...
NSS tools : cmsutil
Mozilla › Projects › NSS › tools › cmsutil
te-only example cmsutil -o [-i infile] [-o outfile] [-d dbdir] [-p password] -r "cert1,cert2, . . ." sign message example cmsutil -s [-i infile] [-o outfile] [-d dbdir] [-p password] -n nickname[-tgp] [-y ekprefnick] see also certutil(1) see also additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [2]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: pki-devel@redhat.com and pki-users@redhat.com irc: freenode at #dogtag-pki ...
NSS tools : crlutil
Mozilla › Projects › NSS › tools › crlutil
nickname [-d keydir] [-p dbprefix] * erasing crls from db: crlutil -e [-d keydir] [-p dbprefix] * import crl from file: crlutil -i -i crl [-t crltype] [-u url] [-d keydir] [-p dbprefix] [-b] see also certutil(1) see also additional resources nss is maintained in conjunction with pki and security-related projects through mozilla dn fedora. the most closely-related project is dogtag pki, with a project wiki at [1]http://pki.fedoraproject.org/wiki/. for information specifically about nss, the nss project wiki is located at [2]http://www.mozilla.org/projects/security/pki/nss/. the nss site relates directly to nss code changes and releases. mailing lists: pki-devel@redhat.com and pki-users@redhat.com irc: freenode at #dogtag-pki ...
Scripting Java
cting a method that may be a better match for each call, it does have an impact on performance since more work is done at each call. in practice this performance cost hasn't been noticeable in real applications. because overload resolution occurs at runtime, it can fail at runtime. for example, if we call overload's method g with two integers we get an error because neither form of the method is closer to the argument types than the other: js> o.g(3,4) js:"<stdin>", line 2: the choice of java method overload.g matching javascript argument types (number,number) is ambiguous; candidate methods are: class java.lang.string g(java.lang.string,int) class java.lang.string g(int,java.lang.string) see java method overloading and liveconnect 3 for a more precise definition of overloading semantics. ...
Creating JavaScript jstest reftests
h will cause the test to fail). reportcompare reportcompare(expected, actual, description) is somewhat like asserteq(actual, expected, description) except that the first two arguments are swapped, failures are reported via stdout rather than by throwing exceptions, and the matching is fuzzy in an unspecified way. for example, reportcompare sometimes considers numbers to be the same if they are "close enough" to each other, even if the == operator would return false. expected = 3; actual = 1 + 2; reportcompare(expected, actual, '3==1+2'); comparesource comparesource(expected, actual, description) is used to test if the decompilation of a javascript object (conversion to source code) matches an expected value. note that tests which use comparesource should be located in the decompilation ...
Creating JavaScript tests
utomated javascript tests for details. in which test suite does your new test belong? jit-tests are intended to test the implementation of the jit. only add tests to these suites which test jit correctness or functionality. jstests is intended for tests of language-visible functionality. please put tests of functionality into jstests even if related tests are in jit-tests, since jstests are closer to (and more easily converted to) test262 tests. (in fact, the test262 test suite is run as part of jstests.) practical differences between the two test suites: jstest new jstest files should be put the code in the appropriate subdirectory of js/src/tests/non262/, or, under some scenarios, contributed directly to the test262 repository. jstests run in both the shell and the browser (al...
Future directions
and of course, the idea of the future is always evolving in time as things change and we learn more. ...
Functions
ext::display caches the enclosing function's stack frame.) if that function is also algol-like, its child can read locals and variables from the next enclosing function, and so on. the compiler detects these cases and makes such functions null closures too. flat closures. suppose a function reads some variables from enclosing functions but is not algol-like. if the function does not assign to any closed-on vars/args, and it only reads closed-on local variables and arguments that never change value after the function is created, then the function can be implemented as a flat closure. when a flat closure is created, all the closed-on values are copied from the stack into reserved slots of the function object. to evaluate a name, instead of walking the scope chain, we just take the value from the ...
Tracing JIT
mode. the monitor also keeps track of how many times it has attempted to record a trace starting at each pc value, so if a particular pc causes too many aborted recordings, the monitor blacklists the pc and will not attempt recording it any longer. if the recorder completes recording at a backward branch back to the initial pc value that triggered recording mode, it is said to have successfully closed the loop. a closed loop is passed through the nanojit assembler and thereby compiled to native machine code. the associated fragment is placed in the monitor's fragment table and the monitor returns to monitoring mode, with a high likelihood of immediately transitioning to executing mode on the next bytecode interpreted. the compiled fragment of code returned to the monitor on successful loop-cl...
JIT Optimization Outcomes
tion either has too many parameters or is called with too many arguments. these thresholds are subject to change. cantinlinerecursive unable to inline function call. the interpreted callee function recurs for more than one level. the first level of recursion is inlinable. cantinlineheavyweight unable to inline function call. the interpreted callee function contains variables bindings that are closed over. for example, function f() { var x; return function () { x++; } } closes over x in f. cantinlineneedsargsobj unable to inline function call. the interpreted callee function requires an arguments object to be created. cantinlinedebuggee unable to inline function call. the interpreted callee function is being debugged by the debugger api. cantinlineunknownprops unable to inline function...
JSAPI User Guide
elocalrootscope to keep those values alive for the duration of the function. to keep a value alive permanently, store it in a gc root. still, gc bugs do occur. these two functions, both available only in debug builds, are especially useful for debugging gc-related crashes: use js_setgczeal to enable extra garbage collection. gc zeal usually causes a gc-related crash to occur much sooner (closer to its cause) and more reliably. it's for development and debugging only, because the extra garbage collection makes js very slow. use js_dumpheap to dump the spidermonkey heap or specific interesting parts of it. see spidermonkey garbage collection internals for more details. gc performance overly frequent garbage collection can be a performance issue. some applications can reduce the f...
JS::CloneFunctionObject
n's scope chain. description js::clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj. if scopechain is supplied, it uses scopechain as its enclosing scope. if scopechain is omitted, it creates a new function object in cx's global. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created global object. the new object's prototype is function.prototype; js_newobject : choosing a default prototype explains exactly how this is computed. js::clonefunctionobject takes care to choose a prototype that shares a global object with the given parent whenever possible. funobj must be a pointer to a javascript function object (see js_objectisfunction). on success, js::cl...
JS_CloneFunctionObject
context. funobj jsobject * the function to clone. parent jsobject * the new function's parent. description js_clonefunctionobject creates a new function object from funobj. the new object has the same code and argument list as funobj, but uses parent as its enclosing scope. this can be helpful if funobj is an extant function that you wish to use as if it were enclosed by a newly-created global object. the new object's prototype is function.prototype; js_newobject: choosing a default prototype explains exactly how this is computed. js_clonefunctionobject takes care to choose a prototype that shares a global object with the given parent whenever possible. funobj must be a pointer to a javascript function object (see js_objectisfunction). on success, js_clonefun...
JS_CompileUTF8FileHandle
or null. description js_compileutf8filehandle reads a script from a stdio file handle and compiles the script for execution by the javascript engine. js_compileutf8filehandleforprincipals is a version of the function for use with spidermonkey's security features. filename is the name of the file containing the script to compile. file is the file handle. js_compileutf8filehandle does not close the file handle. if principals is non-null, it points to a jsprincipals object that is associated with the new script and any functions it creates. on success, js_compileutf8filehandle reads file to eof and returns an object representing the newly compiled script. if an error occurs during compilation, js_compileutf8filehandle stops reading from the file and returns null. js_compileutf8filehan...
JS_SetGCZeal
tiple slices. 11 verify post write barriers between instructions. 12 verify post write barriers between paints. 13 check internal hashtables on minor gc. 14 perform a shrinking collection every frequency allocations. with gc zeal enabled, gc-related crashes are much easier to reproduce (they happen more reliably) and debug (they happen sooner, closer to the source of the bug). the drawback is that gc zeal can cause javascript code to run extremely slowly. regularly running your test suite with gc zeal enabled at level 2 is a good practice. this function is available only in debug builds. to enable this function in an optimized build, define the macro js_gc_zeal building spidermonkey. (in a debug build of gecko, you can also set the current g...
SpiderMonkey 1.8
ck. two new functions, js_setgczeal and js_dumpheap, aim to help developers debug gc-related problems. these functions are only present in debug builds. js_setgczeal is especially helpful. when gc zeal is enabled, gc happens extremely frequently. this makes gc-related problems easier to reproduce, reveals gc problems that you may not have noticed before, and causes gc-safety bugs to surface much closer to their cause. js_dumpheap dumps parts of the gc heap and can help detect leaks. a new gc parameter, jsgc_stackpool_lifespan, controls how eagerly spidermonkey returns unused memory back to the system. the new function js_setextragcroots provides another way to protect values from garbage collection. there is a new set of apis for integrating spidermonkey's garbage collector with other memor...
Shell global objects
ook(hook, fun) set this js runtime's lazy source retrieval hook (that is, the hook used to find sources compiled with compileoptions::lazy_source) to hook; call fun with no arguments; and then restore the runtime's original hook. return or throw whatever fun did. hook gets passed the requested code's url, and should return a string. notes: spidermonkey may assert if the returned code isn't close enough to the script's real code, so this function is not fuzzer-safe. the runtime can have only one source retrieval hook active at a time. if fun is not careful, hook could be asked to retrieve the source code for compilations that occurred long before it was set, and that it knows nothing about. the reverse applies as well: the original hook, that we reinstate after the call to fun completes...
Split object
ly running. by convention, the context's global object is returned in this case. for consistency with the rule, if that global object is an outer object, spidermonkey returns the inner object instead. inner and outer objects are in certain other respects the same object: if object.hasownproperty is called on an inner object, and the named property is found on an outer object, that's considered close enough and hasownproperty returns true. note that none of the rules listed here affects ordinary property accesses. spidermonkey's split object support, by itself, does not cause inner object properties to appear on the outer object or vice versa. split objects that need this behavior must implement it in custom jsclass hooks. in the case of window, each half has custom hooks. ...
Zest
intended to be used in web oriented security tools. the language is written in json, but we do not expect people to write zest in this format - it is designed to be a visual language. the core language does not define any graphical representation - that is expected to be defined by the tools that integrate zest. it is completely free, open source and can be included in any tool whether open or closed, free or commercial. zest is still at a very early stage of development, but is has been made available so that anyone can play around with it. all constructive feedback is very welcome. anyone can contribute to the onward development of zest, and teams or individuals who develop security tools are especially welcome to join and help shape zest's future. zest topics usecases report...
compare-locales
-importfromfile.label +importfromhtmlfile.accesskey +importfromhtmlfile.label you can assume changed strings when you see entities removed and added with a similar name. the file names will be shown in a hierarchical form, so in the example above, your files are browser.dtd in ab-cd/browser/chrome/browser and migration.dtd in another directory level deeper. the output closes with a summary, giving the total counts of missing and obsolete strings and words, and some statistics on how many strings are changed or not, excluding access- and commandkeys. that gives localizers an idea on how thorough the localization is. this number won't reach 100% in general, mid 80s should be the target, though. pass --json to get just the summary in json format. ...
The Rust programming language
ors. it prevents segmentation faults and guarantees thread safety, all with an easy-to-learn syntax. in addition, rust offers zero-cost abstractions, move semantics, guaranteed memory safety, threads with no data races, trait-based generics, pattern matching, type inference, and efficient c bindings, with a minimum runtime size. to learn more about rust, you can: watch the videos below for a closer look at the power and benefits rust provides. read the book the rust programming language online. download the rust compiler, check out examples, and learn everything you could possibly wish to know at the rust official web site. rust and the future of systems programming unlocking the power of parallelism with rust rust for web developers safe systems programming with rust growi...
Exploitable crashes
isn't part of the program. these crashes are almost always exploitable to run arbitrary code. look at the crash reason, which will usually be something like "kern_protection_failure (0x0002) at 0x00000000". this is typically located right above the stack trace. the last number, in this case 0x00000000, is the memory address firefox was prevented from accessing. if the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. these bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. most crashes fall into this category. check the length of the stack trace. if it's over 300 functions long, it's likely to be a too-much-recursion crash. like null dereferences, these crashes are not exploitable. any other c...
Secure Development Guidelines
nter or null, but null by itself is a valid address checking return values int main() { int fds[2]; pipe(fds); write(fds[0], "data", 4); } the pipe() return value is not checked if pipe() fails, fds is not initialized write to un-initialized file descriptor checking return values check all return values—no matter how unlikely the api failure for example: close() can fail and leak file descriptor setuid() can fail and privileges don’t get dropped snprintf() can fail and result in return value -1 tmp = realloc(tmp, size) — realloc could fail and leak tmp writing secure code: exception handling double freeing pointers double frees can occur in exception handling they free data in try block and then free it again in the catch block...
Setting up an update server
want to start by deleting any pending updates to ensure that no previously found updates interfere with installing the desired update. you can use this command with firefox's browser console to determine the update directory: const {fileutils} = chromeutils.import("resource://gre/modules/fileutils.jsm"); fileutils.getdir("updrootd", [], false).path once you have determined the update directory, close firefox, browse to the directory and remove the subdirectory called updates. next, you need to change the update url to point to the local xml file. this can be done most reliably with an enterprise policy. the policy file location depends on the operating system you are using. windows/linux: <install dir>/distribution/policies.json macos: <install dir>/contents/resources/distribution/policies...
Places utilities for JavaScript
ationsforitem(int aitemid, array object aannos) parameters aitemid the identifier of the item for which annotations are to be set aannotations array of objects, each containing the following properties: name, flags, expires, type, mimetype (only used for binary annotations) value. other other functions that i'm not sure how to file. getviewfornode() returns the closet ancestor places view for the given dom node getviewfornode(anode) parameters anode a dom node return type return the closet ancestor places view if exists, null otherwsie. markpageastyped() by calling this before we visit a url, we will use transition_typed as the transition for the visit to that url (if we don't have a referrer). this is used when visiting pages from the history me...
Using the Places history service
basic browser like marking pages as typed in the url bar, and removing pages as from the history interface. nsinavhistoryservice: complex query functions, more fine-grained getters and setters. nsiautocompletesearch: url-bar autocomplete from history from 1.9.1 (firefox3.1) on, don't use any places service on (or after) quit-application has been notified, since the database connection will be closed to allow the last sync, and changes will most likely be lost. use quit-application-granted instead. differences from previous implementations the previous nsglobalhistory service stored one entry for each page in history. this entry contained the url, title, visit count, last visit date, first visit date, host name, last referrer, flags for typed, hidden, and gecko flags (gecko flags is trunk ...
places.sqlite Database Troubleshooting
g actions to deal with a broken places.sqlite database. how to (try to) recover from a corrupt places.sqlite sometimes after a firefox/aurora/nightly upgrade, history disappears, but bookmarks are at their place. in the profile folder a places.sqlite-corrupt file has been created. in some cases, this procedure may allow you to recover the corrupt file along with all of its contents (history). close firefox and ensure it's done closing in your task manager. before you proceed, make a backup of the firefox profile folder, in any case. create a folder to use temporarily for this work, such as my_work_folder. copy places.sqlite-corrupt from the firefox profile folder to the work folder. download the latest precompiled binary sqlite command-line shell from: https://www.sqlite.org/download...
Avoiding leaks in JavaScript XPCOM components
browser. tabbrowser is an xbl binding that wraps browsers in tabs, creating and destroying them as needed. but the browsers are themselves xbl bindings, and much of the memory associated with the page displayed in the tab is reachable from the javascript properties of the browser element. this means that without some workaround, all of the browsers will remain in memory until the parent window is closed. the workaround is simple: we have a destroy method on browser that tabbrowser can call when it's done with a browser. this destroy method assigns null to the problematic properties so that the large objects are no longer reachable from the wrapper of the browser element (which will still leak until the window containing the tabbrowser is closed, but it's a much smaller leak). further reading ...
An Overview of XPCOM
ated. using a freely available public initialization method, as the example below suggests, can cause problems. someclass class initialization class someclass { public: // constructor someclass(); // virtual destructor virtual ~someclass(); // init method void init(); void dosomethinguseful(); }; for this system to work properly, the client programmer must pay close attention to whatever rules the component programmer has established. this is the contractual agreement of this unencapsulated class: a set of rules that define when each method can be called and what it is expected to do. one rule might specify that dosomethinguseful may only be called after a call to init(). the dosomethinguseful method may do some kind of checking to ensure that the condition ...
Component Internals
as autoregistration. you should always know what the installation and registration requirements are for the applications that will be using your component. the shutdown process when the application is ready to shutdown xpcom, it calls ns_shutdownxpcom. when that method is called, the following sequence of events occurs: xpcom fires a shutdown notification to all registered observers. xpcom closes down the component manager, the service manager and associated services. xpcom frees all global services. ns_shutdownxpcom returns and the application may exit normally. the unstoppable shutdown note that shutdown observation is unstoppable. in other words, the event you observe cannot be used to implement something like a "are you sure you want to quit?" dialog. rather, the shutdown event...
Creating the Component Code
nsifile* location, nsimodule** result); xpcom expects a successful call to nsgetmodule to return an implementation of the interface nsimodule. when you write a xpcom component, you implement nsimodule to do all of the necessary registration, unregistration, and object creation. nsimodule has four methods that must be implemented. the registration methods two closely related registration methods are declared below. ns_imethod registerself(nsicomponentmanager *acompmgr, nsifile *alocation, const char *aloaderstr, const char *atype) = 0; ns_imethod unregisterself(nsicomponentmanager *acompmgr, nsifile *alocation, const char *aloaderstr...
Preface
ter they are cited, or else the reader is referred to a section in the book where they are described in detail. link references to other sections and to figures and tables are links to those sections. acknowledgements thanks to peter lubczynski, john gaunt, ellen evans, and alec flett for technical reviews. a special thanks goes to darin fisher for his very acute observations, close reading, and attention to detail. next » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or...
Using XPCOM Utilities to Make Things Easier
the macro to the number of interfaces you support and list the interfaces, separated by commas. for example: ns_impl_isupports2(classname, interface1, interface2) ns_impl_isupportsn(classname, interface1, ..., interfacen) these macros automatically add the nsisupports entry for you, so you don't need to do something like this: ns_impl_isupports2(classname, interface1, nsisupports) take a close look at the above example. note that it uses the actual name of the interface and not an iid. inside the macro, the interface name expands to ns_get_iid(), which is another macro that extracts the iid from the generated header of the interface. when an interface is written in xpidl, the headers include static declarations of their iids. on any interface that is generated by xpidl, you can call ns...
XPCshell Test Manifest Expressions
dd conditions to tests in order to control when tests get run. the conditions accept a simple boolean expression syntax, described here. operators in order of decreasing precedence: () == != && || literal values booleans: the literal strings true and false. integers: a series of contiguous digits. only decimal integers are supported. strings: any series of characters enclosed in double quotes " or single quotes '. no escape sequences are supported. variables variables are supported as a series of letters, digits or underscores beginning with a letter or an underscore. there are a fixed set of variables provided by the test harness via mozinfo.py, with many of the values initialized at configure time by writemozinfo.py which writes mozinfo.json into the root of t...
nsAutoRefTraits
derived from nspointerreftraits<t>, so that only definitions of the release(t*) static method and possibly the addref(t*) static method need to be added. addref(t*) is necessary for nscountedref<t> but not for nsautoref<t>. for example: ns_specialize_template class nsautoreftraits<prfiledesc> : public nspointerreftraits<prfiledesc> { public: static void release(prfiledesc *ptr) { pr_close(ptr); } }; or ns_specialize_template class nsautoreftraits<fcpattern> : public nspointerreftraits<fcpattern> { public: static void release(fcpattern *ptr) { fcpatterndestroy(ptr); } static void addref(fcpattern *ptr) { fcpatternreference(ptr); } }; nsautoreftraits is described in xpcom/base/nsautoref.h. see also nsautoref, nscountedref ...
imgIDecoder
modules/libpr0n/public/imgidecoder.idlscriptable base class for a decoder that reads an image from an input stream and sends it to an imgiloader object. inherits from: nsisupports last changed in gecko 1.7 this interface is the base class for decoders for specific image formats. method overview void close(); void flush(); void init(in imgiload aload); unsigned long writefrom(in nsiinputstream instr, in unsigned long count); methods close() closes the stream. void close(); parameters none. flush() flushes the stream. void flush(); parameters none. init() initializes an image decoder. void init( in imgiload aload ); parameters aload an imgiload object to receive the decoded image data. this object also implements the imgideco...
mozIStorageStatement
in mozistorageconnection adbconnection, in autf8string asqlstatement ); parameters adbconnection a mozistorageconnection database connection. asqlstatement string key representing the sql statement. finalize() finalizes a statement which releases all resources that were allocated for it. you must call this method on every active statement before you try to call mozistorageconnection.close(). void finalize(); note: this method does not need to be used from native callers because you have to release the statement in order to not leak. finalize will be called for you when the reference count on the statement goes to zero. clone() creates a copy of the statement whose state will be mozistoragestatement.moz_storage_statement_ready. mozistoragestatement clone(); return value a m...
nsIAuthPrompt2
t the connection is otherwise insecure. level_secure 2 the connection, both for password and data, is secure. methods asyncpromptauth() asynchronously prompt the user for a username and password. this has largely the same semantics as nsiauthprompt.promptusernameandpassword(), but must return immediately after calling and return the entered data in a callback. if the user closes the dialog using a cancel button or similar, the callback's nsiauthpromptcallback.onauthcancelled() method must be called. calling nsicancelable.cancel() on the returned object should close the dialog and must call nsiauthpromptcallback.onauthcancelled() on the provided callback. this implementation may: coalesce identical prompts. this means prompts that are guaranteed to want the same auth...
nsIContentSecurityPolicy
when the content security policy has been read in and parsed and is ready to enforce. this is a barrier for the nsdocument so it doesn't load any sub-content until either it knows that a content security policy is ready or will not be used. policy astring a read-only string version of the policy for debugging. read only. reportonlymode boolean when set to true, content load-blocking and fail-closed are disabled: content security policy will only send reports, and not modify behavior. methods permitsancestry() verifies ancestry as permitted by the policy. calls to this may trigger violation reports when queried, so this value should not be cached. boolean permitsancestry( in nsidocshell docshell ); parameters docshell containing the protected resource. return value true if the frame...
nsIDBChangeListener
r the caller who added the header. this can be used to filter out events that you yourself started. ainstigator may also be null. onevent() generic notification for extensibility. common events should be documented here so we have a hope of keeping the documentation up to date. current events are: dbopened when a pending listener becomes real. this can happen when the existing db is force closed and a new one opened. only registered pending listeners are notified. void onevent(in nsimsgdatabase adb, in string aevent); parameters adb the nsimsgdatabase that is changing. astring the type of event. ...
nsIDOMNSHTMLDocument
the width of the body element. read only. obsolete since gecko 6.0 methods captureevents() provided for compatibility with netscape 4.x, but does not actually do anything. void captureevents( in long eventflags ); parameters eventflags clear() used to reset a document to blank, but deprecated since gecko 1.0 and provided for compatibility with netscape 4.x; use open() and close() instead. void clear(); parameters none. execcommand() boolean execcommand( in domstring commandid, in boolean doshowui, in domstring value ); parameters commandid the name of the command to execute. see rich-text editing in mozilla for a list of supported commands. doshowui this is not implemented in gecko. value some commands require an argument. you can pass n...
nsIDOMWindowUtils
r process, return the corresponding dom element object. nsidomelement findelementwithviewid( in nsviewid aid ); parameters aid the id of the view for which to retrieve the corresponding nsidomelement object. return value the nsidomelement object for the html element drawn by the specified view id. note: for scrollable frames containing documents (that is, <frame> and <iframe>), the enclosed document's root element is returned. focus() focus the element aelement. the element should be in the same document that the window is displaying. pass null to blur the element, if any, that currently has focus, and focus the document. cannot be accessed from unprivileged context (not content-accessible) will throw a dom security error if called without universalxpconnect privileges. do not ...
nsIDiskCacheStreamInternal
netwerk/cache/nsidiskcachestreaminternal.idlscriptable please add a summary to this article. 1.0 66 introduced gecko 2.0 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) method overview void closeinternal(); methods closeinternal() we use this method internally to close nsdiskcacheoutputstream under the cache service lock. void closeinternal(); parameters none. ...
nsIFile
when you convert to a string. do not pass to use with nspr or stdlib! read only. exceptions thrown ns_error_file_invalid_path indicates that this nsifile does not reference a symbolic link. constants constant value description normal_file_type 0 a normal file. directory_type 1 a directory/folder. delete_on_close 0x80000000 optional parameter used by opennsprfiledesc methods append() this function is used for constructing a descendant of the current nsifile. note: this method does not return a new nsifile; it modifies the object it was called on. if the old nsifile should be retained, use clone(). void append( in astring node ); parameters node a string which is intended to be a...
nsIFilePicker
save 1 save a file. modegetfolder 2 select a folder/directory. modeopenmultiple 3 load multiple files. return value constants these values are returned by show() or passed as an argument to open()'s callback, indicating the result of the file picker activity. constant value description returnok 0 the file picker dialog was closed by the user hitting 'ok' returncancel 1 the file picker dialog was closed by the user hitting 'cancel' returnreplace 2 the user chose an existing file and acknowledged that they want to overwrite the file filter constants these constants are used to create filters for commonly-used file types. for the most up to date list see filepicker.properties. ...
nsIHttpActivityObserver
quest headers in aextrastringdata activity_subtype_request_body_sent 0x5002 the http request's body has been sent. activity_subtype_response_start 0x5003 the http response has started to arrive. activity_subtype_response_header 0x5004 the http response header has arrived. activity_subtype_response_complete 0x5005 the complete http response has been received. activity_subtype_transaction_close 0x5006 the http transaction has been closed. methods observeactivity() called when activity occurs on the http transport. you should implement this method to perform whatever tasks you wish to perform when http activity occurs. void observeactivity( in nsisupports ahttpchannel, in pruint32 aactivitytype, in pruint32 aactivitysubtype, in prtime atimestamp, in pruint64 aextrasizedata, ...
nsIHttpServer
...
nsIInputStreamCallback
xpcom/io/nsiasyncinputstream.idlscriptable this is a companion interface for nsiasyncinputstream.asyncwait(). inherits from: nsisupports last changed in gecko 1.7 method overview void oninputstreamready(in nsiasyncinputstream astream); methods oninputstreamready() called to indicate that the stream is either readable or closed. void oninputstreamready( in nsiasyncinputstream astream ); parameters astream the stream whose nsiasyncinputstream.asyncwait() method was called. see also nsiasyncinputstream.asyncwait() ...
nsIMenuBoxObject
see also nsiboxobject menu ...
nsIMsgSearchScopeTerm
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgsearchscopeterm.idl [scriptable, uuid(934672c3-9b8f-488a-935d-87b4023fa0be)] interface nsimsgsearchscopeterm : nsisupports { nsiinputstream getinputstream(in nsimsgdbhdr ahdr); void closeinputstream(); readonly attribute nsimsgfolder folder; readonly attribute nsimsgsearchsession searchsession; }; ...
nsINavBookmarksService
t is extremely important that you call endupdatebatch() for each call to beginupdatebatch. if you do not do this, certain parts of the ui will not get updated and any changes to bookmarks will not get written to disk. from c++ code inside the places component, use nsbookmarksupdatebatcher defined in nsnavbookmarks.h to scope batches. for js or from other components, just please be very careful to close the batch, especially when encountering an error and returning early. void beginupdatebatch(); parameters none. changebookmarkuri() this method changes the bookmarked uri for a bookmark. it changes which "place" the bookmark points at, which means all annotations, and so on are carried along. void changebookmarkuri( in nsiuri olduri, obsolete since gecko 1.9 in long long aitemid, in ...
nsINavHistoryResult
s you access to all the results in the tree. note: keep in mind that you need to open containers for their results to be valid. when a result goes out of scope it will continue to observe changes till it is cycle collected. while the result waits to be collected it will stay in memory, and continue to update itself, potentially causing unwanted additional work. when you close the root node the result will stop observing changes, so it is good practice to close the root node when you are done with a result, since that will avoid unwanted performance hits. read only. sortingannotation autf8string the annotation to use in sort_by_annotation_* sorting modes; you must set this value before setting the sortingmode attribute. sort...
nsINavHistoryResultViewObserver
e if it isn't. ondrop() called when the user drops something onto the view being observed. void ondrop( in long row, in long orientation ); parameters row the row at which the drop occurred. orientation drop_before, drop_on, or drop_after, indicating whether the drop destination is before, on, or after the target row. ontoggleopenstate() called when an item is opened or closed. void ontoggleopenstate( in long index ); parameters index the item being toggled. oncycleheader() called when a header is clicked. void oncycleheader( in nsitreecolumn column ); parameters column the column whose header was clicked. oncyclecell() called when a cell in a non-selectable cycling column (such as unread or flagged in thunderbird) is clicked. void onc...
nsIOutputStreamCallback
xpcom/io/nsiasyncoutputstream.idlscriptable this is a companion interface for nsiasyncoutputstream.asyncwait. inherits from: nsisupports last changed in gecko 1.7 method overview void onoutputstreamready(in nsiasyncoutputstream astream); methods onoutputstreamready() called to indicate that the stream is either writable or closed. void onoutputstreamready( in nsiasyncoutputstream astream ); parameters astream the stream whose nsiasyncoutputstream.asyncwait() method was called. ...
nsIPromptService
is used for a button, the string parameter for that button will be used. if the value for a button position is zero, the button will not be shown. the following example creates a dialog with an ok button and a custom button description. abuttonflags = (button_pos_0) * (button_title_ok) + (button_pos_1) * (button_title_is_string) + button_pos_1_default; confirmex always returns 1 if the user closes the window using the close button in the titlebar! bug 345067 print32 confirmex( in nsidomwindow aparent, in wstring adialogtitle, in wstring atext, in unsigned long abuttonflags, in wstring abutton0title, in wstring abutton1title, in wstring abutton2title, in wstring acheckmsg, inout boolean acheckstate ); parameters aparent the parent window for the dialog. if set ...
nsIRequest
n load_anonymous 1 << 14 when set, this flag indicates that no user-specific data should be added to the request when opened. this means that things like authorization tokens or cookie headers should not be added. note: this will prevent proxy authentications from working, so use this flag with caution. methods cancel() cancels the current request. this will close any open input or output streams and terminate any async requests. users should normally pass ns_binding_aborted, although other errors may also be passed. the error passed in will become the value of the status attribute. implementations must not send any notifications (for example via nsirequestobserver) synchronously from this function. similarly, removal from the load group (if any) must als...
nsIServerSocketListener
ected socket transport. onstoplistening() this method is called when the listening socket stops for some reason. the server socket is effectively dead after this notification. void onstoplistening( in nsiserversocket aserv, in nsresult astatus ); parameters aserv the server socket. astatus the reason why the server socket stopped listening. if the server socket was manually closed, then this value will be ns_binding_aborted. see also nsiserversocket nsisockettransport ...
nsITaskbarWindowPreview
itaskbarwindowpreview for the corresponding window is automatically hidden. this is not reflected by the visible attribute. note that even while the preview is hidden, its thumbnails and/or previews may still be requested by other parts of the operating system through the nsitaskbarwindowpreview's controller. note: this interface will never invoke the controller's nsitaskbarpreviewcontroller.onclose() or nsitaskbarpreviewcontroller.onactivate() methods, since handling them may conflict with other internal gecko state management. there is existing infrastructure in place to let clients handle those events. window preview toolbars window previews may have a toolbar with up to seven buttons. the array of buttons may be accessed by calling getbutton(); each button is an nsitaskbarpreviewbutton ...
nsITransferable
sertions in debug builds. void init( in nsiloadcontext acontext ); parameters acontext the load context associated with the transferable object. this can be set to null if a load context is not available. remarks the load context is used to track whether the transferable is storing privacy-sensitive information. for example, we try to delete data that you copy to the clipboard when you close a private browsing window. to get the appropriate load context in javascript callers, one needs to get to the document that the transferable corresponds to, and then get the load context from the document like this: var loadcontext = doc.defaultview.queryinterface(ci.nsiinterfacerequestor) .getinterface(ci.nsiwebnavigation) .queryinterface(ci.nsiloadcontext);...
nsIWebBrowserChrome
teners etc. constants constant value description status_script 1 flag for setstatus() status_script_default 2 flag for setstatus() status_link 3 flag for setstatus() chrome_default 1 value for the chromeflags attribute. chrome_window_borders 2 value for the chromeflags attribute. chrome_window_close 4 value for the chromeflags attribute. chrome_window_resize 8 value for the chromeflags attribute. chrome_menubar 16 value for the chromeflags attribute. chrome_toolbar 32 value for the chromeflags attribute. chrome_locationbar 64 value for the chromeflags attribute. chrome_statusbar 128 value for the chromeflags att...
nsIXPConnect
arameters ajscontext missing description ascope missing description anewparent missing description acomobj missing description return value missing description exceptions thrown missing exception missing description restorewrappednativeprototype() restore an old prototype for wrapped natives of type aclassinfo. this should be used only when restoring an old scope into a state close to where it was prior to being reinitialized. void restorewrappednativeprototype( in jscontextptr ajscontext, in jsobjectptr ascope, in nsiclassinfo aclassinfo, in nsixpconnectjsobjectholder aprototype ); parameters ajscontext missing description ascope missing description aclassinfo missing description aprototype missing description exceptions thrown missing exception ...
nsIXULTemplateBuilder
ement the root element from which to derive the data. native code only!createcontents invoked lazily by a xul element that needs its child content built. [noscript] void createcontents( in nsicontent aelement, in boolean aforcecreation ); parameters aelement the element whose contents need to be built. aforcecreation if true, the contents of the element are generated even if the element is closed; this behavior is used with menus. if false, the element's contents are only generated if it's open. addlistener() adds a listener to this template builder. the template builder holds a strong reference to the listener. void addlistener( in nsixulbuilderlistener alistener ); parameters alistener an nsixulbuilderlistener object representing the listener to add to the template builder. remov...
nsIXULWindow
movechildwindow() tell this window that it has lost a child xul window. note that xul windows do not currently track child xul windows. void removechildwindow( in nsixulwindow achild ); parameters achild the child window being removed. showmodal() shows the window as a modal window. that is, ensures that it is visible and runs a local event loop, exiting only once the window has been closed. void showmodal(); parameters none. ...
nsIZipReaderCache
ameters zipfile the zip file. zipentry the zip entry. return value the nsizipreader for the given zip file. getzip() returns a (possibly shared) cached nsizipreader for a zip file. if the zip reader for the given file is not in the cache, a new nsizipreader is opened (see nsizipreader.open()). otherwise the previously created nsizipreader is returned. note: if nsizipreader.close has been called on the shared nsizipreader, this method will return the closed nsizipreader nsizipreader getzip( in nsifile zipfile ); parameters zipfile the zip file. return value the nsizipreader for the given zip file. init() initializes a new zip reader cache. void init( in unsigned long cachesize ); parameters cachesize the number of released entries to maintain befo...
nsMsgMessageFlags
dicates whether or not the message has been flagged/starred expunged 0x00000008 indicates whether or not the message is deleted (but not compacted) hasre 0x00000010 indicates whether or not 're: ' should be added to the head of the subject to get the proper subject. elided 0x00000020 indicates whether or not the thread rooted at this message is open or closed in the ui. offline 0x00000080 indicates whether or not we have this message in the offline cache. watched 0x00000100 indicates whether or not this thread is being watched. senderauthed 0x00000200 partial 0x00000400 indicates whether or not the body we have is a complete message. queued 0x00000800 indicates whether or no...
Storage
ting to give your database a name ending in '.sdb' for sqlite database, but this is not recommended. this extension is treated specially by windows as a known extension for an 'application compatibility database' and changes are backed up by the system automatically as part of system restore functionality. this can result in significantly higher overhead file operation. closing a connection to close a connection on which only synchronous transactions were performed, use the mozistorageconnection.close() method. if you performed any asynchronous transactions, you should instead use the mozistorageconnection.asyncclose() method. the latter will allow all ongoing transactions to complete before closing the connection, and will optionally notify you via callback when the connection is closed. s...
Troubleshooting XPCOM components registration
the component was successfully registered and this is the wrong page. load failure of binary components on the mozilla trunk (firefox 3, xulrunner 1.9), components that fail to load will print an error to the error console. chrome errors must be enabled. if the error appears, you can use nspr logging to see additional information about the failure by running firefox from a command prompt: rem close all firefox windows! set nspr_log_modules=nsnativemoduleloader:5 set nspr_log_file=c:\path\to\logfile "c:\program files\mozilla firefox\firefox.exe" examining this log for warning and errors may provide valuable clues why the component failed to load. if using firefox 4 / xulrunner 2.0, make sure that your extension is unpacked and you declared the binary component in your chrome.manifest. see...
Xptcall Porting Status
<font color="white">done</font> os/2 john fairhurst <mjf35@cam.ac.uk> i never heard exactly who did what. but mozilla has been working on os/2 for a long time now. <font color="white">done</font> openvms alpha colin r. blake <colin@theblakes.com> colin says this is passing all the tests on openvms alpha! <font color="white">done</font> nt alpha bob meader <bob@guiduck.com> bob writes: enclosed is xptcall for alpha/nt target.. it is a variation of the iris port (only targeted for win32). notice the last 2 files (the change to mozilla\xpcom\build\makefile.win and mozilla\xpcom\build) are needed because i was unable to figure how to do a "declspecexport" from the assembler asaxp ... if some knows how to do that then those last 2 files won't be needed. i have had someone look over this co...
XPIDL
e specifications. xpidl is expected to converge towards webidl in the future. note: starting in gecko 9.0, the older xpidl utility, which was previously used to generate c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now the older tool has been fully retired. writing xpidl interface files xpidl closely resembles omg idl, with extended syntax to handle iids and additional types. some examples are in the xpcom/base and xpcom/ds directories of the mozilla tree. xpidl:syntax (now up to date again) xpidl syntax (out of date) xpidl author's guide (not as out of date) explanation of idl semantics a full guide to the syntax can be found at xpidl:syntax, which is written in an abnf form. an x...
Events
that can be fired in mail code. some of these are standard events, such as those created by the dom. others are internal to gecko or other parts of mozilla application code. this reference will help you track those events down and learn how to use them. composition event name event type fired when... compose-send-message a message gets sent compose-window-close a compose window gets closed compose-window-init a compose window has been opened compose-window-reopen a cached compose window has been reopened. no load event is fired in this case. folders event name event type fired when... msgcreatedbview onactivecreatedview onactivemessagesloaded ...
Using tab-modal prompts
/* exception: prompt aborted by user undefined:425 */ ...
Using COM from js-ctypes
this example uses ipropertystore::setvalue to change the system.usermodelapp.id of an open firefox window. ishellitem ifileoperation ishelllink & ipersistfile - create shortcut files. example a - based on bugzilla :: bug 738501 - attachement 60853...
Using Objective-C from js-ctypes
el_registername("startspeakingstring:"); objc_msgsend(synth, startspeakingstring, text); let isspeaking = sel_registername("isspeaking"); // wait until start speaking. while (!objc_msgsend_bool(synth, isspeaking)) {} // wait while speaking. 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. reading the apple developer :: programming with objective-c - working with blocks you can learn more about blocks. to create a block with js-ctypes, use the function: function createblock(afunctypeptr) { /** * creates a c block instance from a js function. * blocks are regular objective-c objec...
ctypes.open
nix.so'); var jarpath_mylib = jarpath_folder + 'mysubfolder/mycfunctionsforunix.so'; } this can then be opened and the c functions within can be used from js-ctypes. ...
js-ctypes reference
predefined types that correspond to primitives and common typedefs in c. working with libraries to load a library, use ctypes.open(). the library object is used mostly to declare native functions provided by the library so that js-ctypes knows how to call them. see library.declare() for instructions on how to declare these functions. once you have finished working with a library, call library.close(). calling conventions see abi. types and data to use js-ctypes effectively, it is important to understand the different kinds of objects that the module provides. there are three major categories: types these represent a type in c, and are thus represented by ctype objects. these objects have two main purposes. first, they provide a concrete representation of different data types, allowing...
Browser Side Plug-in API - Plugins
the plug-in. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. netscape plug-in method summary « previousnext » npn_destroystream closes and deletes a stream. npn_forceredraw forces a paint message for a windowless plug-in. npn_getauthenticationinfo this function is called by plug-ins to get http authentication information from the browser. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets notification of t...
Plug-in Side Plug-in API - Plugins
gin with npp_ to indicate that they are implemented by the plug-in and called by the browser. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. plugin method summary npp_destroy deletes a specific instance of a plug-in. npp_destroystream tells the plug-in that a stream is about to be closed or destroyed. np_getentrypoints undocumented. np_getmimedescription registers the mime types supported by the plug-in (unix, mac os). npp_getvalue allows the browser to query the plug-in for information. np_getvalue allows the browser to query the plug-in for information. npp_handleevent delivers a platform-specific window event to the instance. np_initialize provides global initiali...
URLs - Plugins
d payload. if a request is not completed successfully (for example, because the url is invalid or an http server is down), the browser should call npp_urlnotify as soon as possible. if a request completes successfully, and the target is non-null, the browser calls npp_urlnotify after it has finished loading the url. if the target is null, it calls npp_urlnotify after calling npp_destroystream to close the stream. both the npn_geturlnotify and npn_posturlnotify functions call the npp_urlnotify method to notify the plug-in of the result of a request. both functions pass the notifydata value to npp_urlnotify, which tells the plug-in that the url request was completed and the reason for completion. void npp_urlnotify(npp instance, const char* url, npreason reason, void* notif...
Gecko Plugin API Reference - Plugins
indicate that they are implemented by the browser and called by the plug-in. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. npn_destroystream closes and deletes a stream. npn_forceredraw forces a paint message for a windowless plug-in. npn_getauthenticationinfo this function is called by plug-ins to get http authentication information from the browser. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of the specified url; gets notification of th...
Accessibility Inspector - Firefox Developer Tools
lity in the tools > web developer menu. select the accessibility tab in the developer tools toolbox. right-click in the main browser window, and choose inspect accessibility properties in the context menu. right-click an item in the html pane of the page inspector, and choose show accessibility properties in the context menu. once activated, the accessibility engine remains running until you close the developer tools toolbox. if you don't wish to allow the accessibility features to be automatically enabled, you can use the configuration editor (also known as about:config) to define the preference devtools.accessibility.auto-init.enabled, and set it to false. if you don't wish to use the accessibility features at all, you can use the configuration editor to set the preference devtools.acc...
Introduction to DOM Inspector - Firefox Developer Tools
menupopup to select it for inspection. when you inspect a web page with this method, a browser pane at the bottom of the dom inspector window will open up, displaying the web page. this allows you to use the dom inspector without having to use a separate browser window, or without embedding a browser in your application at all. if you find that the browser pane takes up too much space, you may close it, but you will not be able to observe any of the visual consequences of your actions. using the dom inspector once you've opened the document for the page or chrome you are interested in, you'll see that it loads the dom nodes viewer in the document pane and the dom node viewer in the object pane. in the dom nodes viewer, there should be a structured, hierarchical view of the dom. by clicking...
Browser Toolbox - Firefox Developer Tools
isable this behavior. click the toolbox menu and select disable popup auto-hide. now when you open any popup, it will stay open until you press the esc key. you can use the inspector's node picker to select that panel, and examine and modify its content: you can use the same technique to debug popups created by add-ons. note: this change is not persistent across browser restarts. when you close the browser toolbox, the setting will be cleared. ...
Step through code - Firefox Developer Tools
advance to the next line in the same function. step in: advance to the next line in the function, unless on a function call, in which case enter the function being called step out: run to the end of the current function, in which case, the debugger will skip the return value from a function, returning execution to the caller split console when paused, you can press the esc key to open and close the split console to gain more insight into errors and variables: pause on breakpoints overlay since firefox 70, when your code is paused on a breakpoint an overlay appears on the viewport of the tab you are debugging. this lets you know what kind of breakpoint the code is paused on (breakpoint, event breakpoint, etc.), and also provides a step button and a play button. the thinking here i...
UI Tour - Firefox Developer Tools
step out (shift-f11): runs the script until the current function exits. a button that deactivates all breakpoints. a settings menu that contains: disable javascript: disables javascript for this tab. this option enables you to see how your web page looks if the user has disabled javascript via an extension or a configuration setting. the setting is reset when the developer tools are closed (except in firefox 77, see bug 1640318). inline variable preview: enabled by default, this option displays variable values within the source pane when the debugger is paused. source maps: enabled by default, this option directs the debugger to load the original versions of files, and map them to the generated ones loaded in a page, to ease debugging of translformed sources. see use a sourc...
Index - Firefox Developer Tools
ment a debugger.environment instance represents a lexical environment, associating names with variables. each debugger.frame instance representing a debuggee frame has an associated environment object describing the variables in scope in that frame; and each debugger.object instance representing a debuggee function has an environment object representing the environment the function has closed over. 20 debugger.frame a debugger.frame instance represents a visible stack frame. given a debugger.frame instance, you can find the script the frame is executing, walk the stack to older frames, find the lexical environment in which the execution is taking place, and so on. 21 debugger.memory the debugger api can help tools observe the debuggee’s m...
Basic operations - Firefox Developer Tools
take a snapshot of the heap, click the "take snapshot" button, or the camera icon on the left: the snapshot will occupy the large pane on the right-hand side. on the left, you'll see an entry for the new snapshot, including its timestamp, size, and controls to save or clear this snapshot: clearing a snapshot to remove a snapshot, click the "x" icon: saving and loading snapshots if you close the memory tool, all unsaved snapshots will be discarded. to save a snapshot click "save": you'll be prompted for a name and location, and the file will be saved with an .fxsnapshot extension. to load a snapshot from an existing .fxsnapshot file, click the import button, which looks like a rectangle with an arrow rising from it (before firefox 49, this button was labeled with the text "import...
Dominators view - Firefox Developer Tools
arrays as the top three gc roots, each retaining about 23% of the total memory usage: if you expand an array, you'll see the objects (monsters) it contains. each monster has a relatively small shallow size of 160 bytes. this includes the integer eye- and tentacle-counts. each monster has a bigger retained size, which is accounted for by the string used for the monster's name: all this maps closely to the memory graph we were expecting to see. one thing you might be wondering, though, is: where's the top-level object that retains all three arrays? if we look at the retaining paths panel for one of the arrays, we'll see it: here we can see the retaining object, and even that this particular array is the array of fierce monsters. but the array is also rooted directly, so if the object we...
Migrating from Firebug - Firefox Developer Tools
ls. for the latest developer tools and features, try firefox developer edition. download firefox developer edition general activation firebug's activation is url based respecting the same origin policy. that means that when you open a page on the same origin in a different tab, firebug gets opened automatically. and when you open a page of a different origin in the same tab, it closes automatically. the devtools' activation on the other hand is tab based. that means, that when you open the devtools in a tab, they stay open even when you switch between different websites. when you switch to another tab, though, they're closed. open the tools firebug can be opened by pressing f12. to open it to inspect an element it is possible to press ctrl+shift+c / cmd+opt+c. the devtools ...
Inspecting web sockets - Firefox Developer Tools
ist. the following filters are available: all displays all messages (by default, except control messages). sent displays only messages sent by the browser (by default, except control messages). received displays only messages received from the server (by default, except control messages). control (available starting in firefox 76). displays messages for control frames (ping, pong, or close). this filter can be combined with the others, to display, for example, only messages for control frames sent by the browser. columns in the response pane in the response pane, you can choose to show the following information about each frame: data size time opcode maskbit finbit the data and time columns are visible by default, but you can customize the interface to see more columns...
Network request details - Firefox Developer Tools
ight not include some functionality. the tabs at the top of this pane enable you to switch between the following pages: headers messages (only for websocket items) cookies params response cache timings security (only for secure pages) stack trace (only when the request has a stack trace, e.g. a script called by another script). clicking the icon at the right-hand end of the toolbar closes the details pane and returns you to the list view. headers tab the headers tab has a toolbar, followed by three main sections. this includes: information about the request status: the response status code for the request; click the "?" icon to go to the reference page for the status code. version: the version of http used. transferred: the amount of data transferred for the req...
Examine and edit CSS - Firefox Developer Tools
rules view, you can press ctrl / cmd + f to focus the search field. once you've typed in a filter, you can press esc to remove it again. strict search by default, the search box highlights all declarations which contain any part of the string. for example, searching for "color" will highlight declarations containing border-bottom-color and background-color as well as just color.: if you enclose the search query in backticks, like this: `color`, the search is restricted to exact matches: expanding shorthand properties shorthand properties can be expanded to display their related longhand properties by clicking the arrow besides them. displaying pseudo-elements the rule view displays the following pseudo-elements, if they are applied to the selected element: ::after ::backdrop ::...
Work with animations - Firefox Developer Tools
he name of the browser appears. click the icon again to reverse the effect. these animations are made using the web animations api. let's use the animation inspector to see what's going on in this example. right-click in the box and select "inspect element" make sure the selected element is the <div class="channel"> switch over to the "animations" tab play the animation let's take a closer look at the contents of the animation inspector here: it shows a synchronized timeline for every animation applied to the selected element or its children. the timeline starts at the start of the first animation, ends at the end of the last animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently displayed). animation bars eac...
Intensive JavaScript - Firefox Developer Tools
the profile. then there are three solid blocks of orange, representing javascript execution, one for each time we pressed the button. the bottom half, which is correlated with the timeline summary in time, shows frame rate. we can see that frame rate is pretty healthy for most of the recording, but collapses completely whenever we press the button. we can select one of these periods and have a closer look at it in the main waterfall view: here, when we pressed the button, the browser ran a javascript function, or series of functions, that blocked the main thread for 71.73ms, or more than four times our frame budget. which function, though? by switching to the flame chart view we can find out: this shows us the js call stack at this point in the execution. at the top of the stack is a ...
Rich output - Firefox Developer Tools
sole it has a right-pointing triangle next to it, indicating that it can be expanded. click on the triangle, and the object will be expanded to show its contents: starting with firefox 67 (available now in firefox developer) you can use the arrow keys on your keyboard to navigate through objects displayed in the console. the right-arrow key opens the details of an object and the left-arrow key closes open objects. examining request details similar to examining object details, you can see the details about a network request directly in the console. click on the arrow next to the request and a details panel will open that is equivalent to the headers panel in the network monitor tool. export output to the clipboard once you have output in the console window, you can save it to the clipbo...
Split console - Firefox Developer Tools
you can use the console alongside other tools. while you're in another tool in the toolbox, just press esc or select the "show split console" command in the toolbar menu. the toolbox will now appear split, with the original tool above and the web console underneath. you can close the split console by pressing esc again, or by selecting the "hide split console" menu command. as usual, $0 works as a shorthand for the element currently selected in the inspector: when you use the split console with the debugger, the console's scope is the currently executing stack frame. so if you hit a breakpoint in a function, the scope will be the function's scope. you'll get autocomplete for objects defined in the function, and can easily modify them on the fly: ...
Web Console remoting - Firefox Developer Tools
so use the webconsoleclient.getpreferences(prefs, onresponse). the prefs argument is an array of preferences you want to get their values for, by name. private browsing the browser console can be used while the user has private windows open. each page error, console api message and network request is annotated with a private flag. private messages are cleared whenever the last private window is closed. the console actor provides the lastprivatecontextexited notification: { "from": "conn0.console19", "type": "lastprivatecontextexited" } this notification is sent only when your client is attached to the global console actor, it does not make sense for tab console actors. this notification has been introduced in firefox 24. send http requests starting with firefox 25 you can send an ...
Firefox Developer Tools
te: this feature is not turned on by default and must be enabled in settings before the icon will appear.) toggles responsive design mode. opens the menu that includes docking options, the ability to show or hide the split console, and developer tools settings. the menu also includes links to the documentation for firefox web tools and the mozilla community. closes the developer tools page inspector view and edit page content and layout. visualise many aspects of the page including the box model, animations, and grid layouts. web console see messages logged by a web page and interact with the page using javascript. javascript debugger stop, step through, examine, and modify the javascript running in a page. network monitor s...
AudioContext.resume() - Web APIs
t interface resumes the progression of time in an audio context that has previously been suspended. this method will cause an invalid_state_err exception to be thrown if called on an offlineaudiocontext. syntax completepromise = audiocontext.resume(); parameters none. return value a promise that resolves when the context has resumed. the promise is rejected if the context has already been closed. example the following snippet is taken from our audiocontext states demo (see it running live.) when the suspend/resume button is clicked, the audiocontext.state is queried — if it is running, suspend() is called; if it is suspended, resume() is called. in each case, the text label of the button is updated as appropriate once the promise resolves. susresbtn.onclick = function() { if(audi...
AudioContext - Web APIs
diocontext.baselatency read only returns the number of seconds of processing latency incurred by the audiocontext passing the audio from the audiodestinationnode to the audio subsystem. audiocontext.outputlatency read only returns an estimation of the output latency of the current audio context. methods also inherits methods from its parent interface, baseaudiocontext. audiocontext.close() closes the audio context, releasing any system audio resources that it uses. audiocontext.createmediaelementsource() creates a mediaelementaudiosourcenode associated with an htmlmediaelement. this can be used to play and manipulate audio from <video> or <audio> elements. audiocontext.createmediastreamsource() creates a mediastreamaudiosourcenode associated with a mediastream representing a...
AudioListener.dopplerFactor - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.forwardX - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.forwardY - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.forwardZ - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.positionX - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.positionY - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.positionZ - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.setOrientation() - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.setPosition() - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.speedOfSound - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.upX - Web APIs
Web › API › AudioListener › upX
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.upY - Web APIs
Web › API › AudioListener › upY
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener.upZ - Web APIs
Web › API › AudioListener › upZ
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioListener - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
AudioParam.setTargetAtTime() - Web APIs
c time, you can use audioparam.exponentialramptovalueattime(). however, for mathematical reasons, that method does not work if the current value or the target value is 0. choosing a good timeconstant as mentioned above, the value changes exponentially, with each timeconstant bringing you another 63.2% toward the target value. you don't have to worry about reaching the target value; once you are close enough, any further changes will be imperceptible to a human listener. depending on your use case, getting 95% toward the target value may already be enough; in that case, you could set timeconstant to one third of the desired duration. for more details, check the following table on how the value changes from 0% to 100% as the time progresses. time since starttime value ...
AudioParam.value - Web APIs
Web › API › AudioParam › value
a result, the value you read from the value property may not always exactly equal what you set it to. consider this example: const source = new audiobuffersourcenode(...); const rate = 5.3; source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); the log output will be false, because the playback rate parameter, rate, was converted to the 32-bit floating-point number closest to 5.3, which yields 5.300000190734863. one solution is to use the math.fround() method, which returns the single-precision value equivalent to the 64-bit javascript value specified—when setting value, like this: const source = new audiobuffersourcenode(...); const rate = math.fround(5.3); source.playbackrate.value = rate; console.log(source.playbackrate.value === rate); in this case, the l...
BaseAudioContext.createPanner() - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
BaseAudioContext.state - Web APIs
the state read-only property of the baseaudiocontext interface returns the current state of the audiocontext. syntax baseaudiocontext.state; value a domstring. possible values are: suspended: the audio context has been suspended (with the audiocontext.suspend() method.) running: the audio context is running normally. closed: the audio context has been closed (with the audiocontext.close() method.) example the following snippet is taken from our audiocontext states demo (see it running live.) the audiocontext.onstatechange hander is used to log the current state to the console every time it changes. audioctx.onstatechange = function() { console.log(audioctx.state); } specifications specification status comment web audio apithe definition of 'state' in...
BaseAudioContext - Web APIs
ocontext cannot be changed. baseaudiocontext.state read only returns the current state of the audiocontext. event handlers baseaudiocontext.onstatechange an event handler that runs when an event of type statechange has fired. this occurs when the audiocontext's state changes, due to the calling of one of the state change methods (audiocontext.suspend, audiocontext.resume, or audiocontext.close). methods also implements methods from the interface eventtarget. baseaudiocontext.createanalyser() creates an analysernode, which can be used to expose audio time and frequency data and for example to create data visualisations. baseaudiocontext.createbiquadfilter() creates a biquadfilternode, which represents a second order filter configurable as several different common filter types: ...
BatteryManager.chargingTime - Web APIs
syntax var time = battery.chargingtime on return, time is the remaining time in seconds until the battery, which is a batterymanager object, is fully charged, or 0 if the battery is already fully charged. if the battery is currently discharging, this value is infinity. ...
BatteryManager.dischargingTime - Web APIs
syntax var time = battery.dischargingtime on return, time is the remaining time in seconds until the battery, which is a batterymanager object, is fully discharged and the system will suspend. ...
BeforeUnloadEvent - Web APIs
target objects defaultview interface event examples window.addeventlistener("beforeunload", function( event ) { event.returnvalue = "\o/"; }); // is equivalent to window.addeventlistener("beforeunload", function( event ) { event.preventdefault(); }); webkit-derived browsers don't follow the spec for the dialog box. an almost-cross-browser working example would be close to the below example. window.addeventlistener("beforeunload", function (e) { var confirmationmessage = "\o/"; (e || window.event).returnvalue = confirmationmessage; // gecko + ie return confirmationmessage; /* safari, chrome, and other * webkit-derived browsers */ }); specifications ...
Body.body - Web APIs
Web › API › Body › body
d('target'); // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) .then(body => { const reader = body.getreader(); return new readablestream({ start(controller) { return pump(); function pump() { return reader.read().then(({ done, value }) => { // when no more data needs to be consumed, close the stream if (done) { controller.close(); return; } // enqueue the next data chunk into our target stream controller.enqueue(value); return pump(); }); } } }) }) .then(stream => new response(stream)) .then(response => response.blob()) .then(blob => url.createobjecturl(blob)) .then(url => console.log(im...
BroadcastChannel.name - Web APIs
annel() constructor at creation time and is therefore read-only. note: this feature is available in web workers. syntax var str = channel.name; examples // connect to a channel var bc = new broadcastchannel('test_channel'); // more operations (like postmessage, …) // log the channel name to the console console.log(bc.name); // "test_channel" // when done, disconnect from the channel bc.close(); specifications specification status comment html living standardthe definition of 'broadcastchannel.name' in that specification. living standard initial definition. ...
BroadcastChannel - Web APIs
channel.onmessageerror an eventhandler called when a messageevent of type messageerror is fired—that is, when it receives a message that cannot be deserialized. methods this interface also inherits methods from its parent, eventtarget. broadcastchannel.postmessage() sends the message, of any type of object, to each broadcastchannel object listening to the same channel. broadcastchannel.close() closes the channel object, indicating it won't get any new messages, and allowing it to be, eventually, garbage collected. events message fired when when a message arrives on the channel. also available via the onmessage property. messageerror fired when a message arrives that can't be deserialized. also available via the onmessageerror property. specifications specificat...
Broadcast Channel API - Web APIs
pect and what to do with them. receiving a message when a message is posted, a message event is dispatched to each broadcastchannel object connected to this channel. a function can be run for this event with the onmessage event handler: // a handler that only logs the event to the console: bc.onmessage = function (ev) { console.log(ev); } disconnecting a channel to leave a channel, call the close() method on the object. this disconnects the object from the underlying channel, allowing garbage collection. // disconnect the channel bc.close(); conclusion the broadcast channel api's self-contained interface allows cross-context communication. it can be used to detect user actions in other tabs within a same origin, like when the user logs in or out. the messaging protocol is not defined...
Using the CSS Typed Object Model - Web APIs
we've created a blue button with a magic wand background image. we grab our stylepropertymapreadonly with the following javascript: const allcomputedstyles = document.queryselector('button').computedstylemap(); the following examples reference allcomputedstyles: cssunparsedvalue the cssunparsedvalue represents custom properties: // cssunparsedvalue let unit = allcomputedstyles...
CanvasRenderingContext2D.clearRect() - Web APIs
, 10). the cleared area has a width of 120 and a height of 100. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw yellow background ctx.beginpath(); ctx.fillstyle = '#ff6'; ctx.fillrect(0, 0, canvas.width, canvas.height); // draw blue triangle ctx.beginpath(); ctx.fillstyle = 'blue'; ctx.moveto(20, 20); ctx.lineto(180, 20); ctx.lineto(130, 130); ctx.closepath(); ctx.fill(); // clear part of the canvas ctx.clearrect(10, 10, 120, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.clearrect' in that specification. living standard ...
CanvasRenderingContext2D.fill() - Web APIs
y default (with the "nonzero" rule), the hole would also be filled. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create path let region = new path2d(); region.moveto(30, 90); region.lineto(110, 20); region.lineto(240, 130); region.lineto(60, 130); region.lineto(190, 20); region.lineto(270, 90); region.closepath(); // fill path ctx.fillstyle = 'green'; ctx.fill(region, 'evenodd'); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.fill' in that specification. living standard ...
Basic animations - Web APIs
.s; this.x = m.x + math.cos(this.theta) * this.t; this.y = m.y + math.sin(this.theta) * this.t; c.beginpath(); c.linewidth = this.r; c.strokestyle = this.cc; c.moveto(ls.x, ls.y); c.lineto(this.x, this.y); c.stroke(); c.closepath(); } } function anim() { requestanimationframe(anim); c.fillstyle = "rgba(0,0,0,0.05)"; c.fillrect(0, 0, cn.width, cn.height); a.foreach(function(e, i) { e.dr(); }); } </script> <style> #cw { posit...
Channel Messaging API - Web APIs
sent, cannot be used anymore by the original context. the other browsing context can listen for the message using messageport.onmessage, and grab the contents of the message using the event's data attribute. you could then respond by sending a message back to the original document using messageport.postmessage. when you want to stop sending messages down the channel, you can invoke messageport.close to close the ports. find out more about how to use this api in using channel messaging. channel messaging interfaces messagechannel creates a new message channel to send messages across. messageport controls the ports on the message channel, allowing sending of messages from one port and listening out for them arriving at the other. portcollection an array of messageports; an experiment...
Client.postMessage() - Web APIs
amples sending a message from a service worker to a client: addeventlistener('fetch', event => { event.waituntil(async function() { // exit early if we don't have access to the client. // eg, if it's cross-origin. if (!event.clientid) return; // get the client. const client = await clients.get(event.clientid); // exit early if we don't get the client. // eg, if it closed. if (!client) return; // send a message to the client. client.postmessage({ msg: "hey i just got a fetch from you!", url: event.request.url }); }()); }); receiving that message: navigator.serviceworker.addeventlistener('message', event => { console.log(event.data.msg, event.data.url); }); specifications specification status comment ...
Client.url - Web APIs
Web › API › Client › url
the url read-only property of the client interface returns the url of the current service worker client. syntax var clienturl = client.url; value a usvstring. ...
ConstrainDOMString - Web APIs
h must be the value of the property, or an array of domstring objects one of which must be the property's value. if the property can't be set to one of the listed values, matching will fail. ideal either a single domstring or an arrray of domstrings specifying ideal values for the property. if possible, one of the listed values will be used, but if it's not possible, the user agent will use the closest possible match. specifications specification status comment media capture and streamsthe definition of 'constraindomstring' in that specification. candidate recommendation initial definition technically, constraindomstring is actually based on an intermediary dictionary named constraindomstringparameters, which adds exact and ideal to domstring. however,...
ConvolverNode.buffer - Web APIs
for example, if you want to model the reverb in your bathroom, you might set up a microphone near the door to record the sound of a balloon pop or synthesized impulse from the sink. ...
CountQueuingStrategy.CountQueuingStrategy() - Web APIs
non-negative integer defining the total number of chunks that can be contained in the internal queue before backpressure is applied. return value an instance of the countqueuingstrategy object. exceptions none. examples const queuingstrategy = new countqueuingstrategy({ highwatermark: 1 }); const writablestream = new writablestream({ // implement the sink write(chunk) { ... }, close() { ... }, abort(err) { console.log("sink error:", err); } }, queuingstrategy); var size = queuingstrategy.size(); specifications specification status comment streamsthe definition of 'countqueuingstrategy()' in that specification. living standard initial definition. ...
CountQueuingStrategy.size() - Web APIs
he countqueuingstrategy interface always returns 1, so that the total queue size is a count of the number of chunks in the queue. syntax var size = countqueuingstrategy.size(); parameters none. return value 1. examples const queuingstrategy = new countqueuingstrategy({ highwatermark: 1 }); const writablestream = new writablestream({ // implement the sink write(chunk) { ... }, close() { ... }, abort(err) { console.log("sink error:", err); } }, queuingstrategy); var size = queuingstrategy.size(); specifications specification status comment streamsthe definition of 'size' in that specification. living standard initial definition. ...
CountQueuingStrategy - Web APIs
ategy that can be used when constructing streams. constructor countqueuingstrategy() creates a new countqueuingstrategy object instance. properties none. methods countqueuingstrategy.size() returns 1. examples const queueingstrategy = new countqueuingstrategy({ highwatermark: 1 }); const writablestream = new writablestream({ // implement the sink write(chunk) { ... }, close() { ... }, abort(err) { console.log("sink error:", err); } }, queueingstrategy); var size = queueingstrategy.size(); specifications specification status comment streamsthe definition of 'countqueuingstrategy' in that specification. living standard initial definition. browser compatibility the compatibility table on this page is generated fr...
CustomEvent - Web APIs
this method does nothing. this interface inherits methods from its parent, event: event.createevent() creates a new event, which must then be initialized by calling its initevent() method. event.composedpath() returns the event’s path (objects on which listeners will be invoked). this does not include nodes in shadow trees if the shadow root was created with its shadowroot.mode closed. event.initevent() initializes the value of an event created. if the event has already been dispatched, this method does nothing. event.preventdefault() cancels the event (if it is cancelable). event.stopimmediatepropagation() for this particular event, prevent all other listeners from being called. this includes listeners attached to the same element as well as those attached to elem...
DOMPointInit - Web APIs
te. this is the vertical coordinate, and barring any transforms applied to the coordinate system, positive values are downward and negative values upward toward the top of the screen. the default is 0. dompointinit.z an unrestricted floating-point value which gives the point's z-coordinate, which is (assuming no transformations that alter the situation) the depth coordinate; positive values are closer to the user and negative values retreat back into the screen. the default value is 0. dompointinit.w the point's w perspective value, given as an unrestricted floating-point number. the default is 1. example this example creates a new dompoint representing the top-left corner of the current window, with a z component added to move the point closer to the user. this same code will work to cr...
DedicatedWorkerGlobalScope - Web APIs
the worker.postmessage method.) dedicatedworkerglobalscope.onmessageerror is an eventhandler representing the code to be called when the messageerror event is raised. methods this interface inherits methods from the workerglobalscope interface, and its parent eventtarget, and therefore implements methods from windowtimers, windowbase64, and windoweventhandlers. dedicatedworkerglobalscope.close() discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. dedicatedworkerglobalscope.postmessage() sends a message — which can consist of any javascript object — to the parent document that first spawned the worker. inherited from workerglobalscope workerglobalscope.dump() writes a message to the console. workerglobalscope.import...
Document.createProcessingInstruction() - Web APIs
syntax pinode = document.createprocessinginstruction(target, data) parameters pinode is the resulting processinginstruction node. target is a string containing the first part of the processing instruction (i.e., <?target … ?>) data is a string containing any information the processing instruction should carry, after the target. the data is up to you, but it can't contain ?>, since that closes the processing instruction. exceptions dom_invalid_character throws if either of the following are true: the processing instruction target is invalid — it should be a valid xml name that doesn't contain "xml", "xml", or any case combination of the two, other than standardized ones such as <?xml-stylesheet ?>. the closing processing instruction sequence (?>) is part of the data. ...
Document.domain - Web APIs
Web › API › Document › domain
e domain suffix of it) the document-domain feature-policy is enabled examples getting the domain for the uri http://developer.mozilla.org/docs/web, this example sets currentdomain to the string "developer.mozilla.org". const currentdomain = document.domain; closing a window if a document, such as www.example.xxx/good.html, has the domain of "www.example.xxx", this example attempts to close the window. const baddomain = "www.example.xxx"; if (document.domain === baddomain) { // just an example: window.close() sometimes has no effect window.close(); } specifications specification status comment html living standardthe definition of 'document.domain' in that specification. living standard ...
Document.open() - Web APIs
Web › API › Document › open
the document. syntax document.open(); parameters none. return value a document object instance. examples the following simple code opens the document and replaces its content with a number of different html fragments, before closing it again. document.open(); document.write("<p>hello world!</p>"); document.write("<p>i am a fish</p>"); document.write("<p>the number is 42</p>"); document.close(); notes an automatic document.open() call happens when document.write() is called after the page has loaded. for years firefox and internet explorer additionally erased all javascript variables, etc., in addition to removing all nodes. this is no longer the case.document non-spec'ed parameters to document.open gecko-specific notes starting with gecko 1.9, this method is subject to the same...
Element.attachShadow() - Web APIs
t); parameters shadowrootinit a shadowrootinit dictionary, which can contain the following fields: mode a string specifying the encapsulation mode for the shadow dom tree. this can be one of: open: elements of the shadow root are accessible from javascript outside the root, for example using element.shadowroot: element.shadowroot; // returns a shadowroot obj closed: denies access to the node(s) of a closed shadow root from javascript outside it: element.shadowroot; // returns null delegatesfocus a boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability. when a non-focusable part of the shadow dom is clicked, the first focusable part is given focus, and the shadow host is given any...
Element: mousedown event - Web APIs
working draft document object model (dom) level 3 events specificationthe definition of 'mousedown' in that specification. obsolete ...
Element: mousemove event - Web APIs
working draft document object model (dom) level 3 events specificationthe definition of 'mousemove' in that specification. obsolete ...
Element: mouseup event - Web APIs
working draft document object model (dom) level 3 events specificationthe definition of 'mouseup' in that specification. obsolete ...
Element.scrollIntoViewIfNeeded() - Web APIs
element.scrollintoview() method. syntax todo parameters opt_center is an optional boolean value with a default value of true: if true, the element will be aligned so it is centered within the visible area of the scrollable ancestor. if false, the element will be aligned to the nearest edge of the visible area of the scrollable ancestor. depending on which edge of the visible area is closest to the element, either the top of the element will be aligned to the top edge of the visible area, or the bottom edge of the element will be aligned to the bottom edge of the visible area. example var element = document.getelementbyid("my-el"); element.scrollintoviewifneeded(); element.scrollintoviewifneeded(true); // centers the element in the visible area specifications not part of...
Element.shadowRoot - Web APIs
(see element.attachshadow() for further details). ...
EventSource.readyState - Web APIs
the readystate read-only property of the eventsource interface returns a number representing the state of the connection. syntax var myreadystate = eventsource.readystate; value a number representing the state of the connection. possible values are: 0 — connecting 1 — open 2 — closed examples var evtsource = new eventsource('sse.php'); console.log(evtsource.readystate); note: you can find a full example on github — see simple sse demo using php. specifications specification status comment html living standardthe definition of 'readystate' in that specification. living standard initial definition ...
Introduction to the File and Directory Entries API - Web APIs
for more storage and manage your storage quota. sample use cases the following are just a few examples of how you can use the file and directory entries api: apps with persistent uploader when a file or directory is selected for upload, you can copy the file into a local sandbox and upload a chunk at a time. the app can restart uploads after an interruption, such as the browser being closed or crashing, connectivity getting interrupted, or the computer getting shut down. video game or other apps with lots of media assets the app downloads one or several large tarballs and expands them locally into a directory structure. the app pre-fetches assets in the background, so the user can go to the next task or game level without waiting for a download. audio or photo edito...
GlobalEventHandlers.onanimationcancel - Web APIs
rner of the content box to the bottom-right corner. @keyframes slidebox { from { left:0; top:0; } to { left:calc(100% - var(--boxwidth)); top:calc(100% - var(--boxwidth)) } } since the animation is described as taking place an infinite number of times, alternating direction each time, the box will glide back and forth between the two corners until stopped or the page is closed. javascript before we get to the animation code, we define a function which logs information to a box on the user's screen. we'll use this to show information about the events we receive. note the use of animationevent.animationname and animationevent.elapsedtime to get information about the event which occurred. function log(msg, event) { let logbox = document.getelementbyid("log"); log...
GlobalEventHandlers - Web APIs
raised. globaleventhandlers.oncanplaythrough is an eventhandler representing the code to be called when the canplaythrough event is raised. globaleventhandlers.onchange is an eventhandler representing the code to be called when the change event is raised. globaleventhandlers.onclick is an eventhandler representing the code to be called when the click event is raised. globaleventhandlers.onclose is an eventhandler representing the code to be called when the close event is raised. globaleventhandlers.oncontextmenu is an eventhandler representing the code to be called when the contextmenu event is raised. globaleventhandlers.oncuechange is an eventhandler representing the code to be called when the cuechange event is raised. globaleventhandlers.ondblclick is an eventhandler represen...
HTMLCanvasElement.mozFetchAsStream() - Web APIs
stream (chrome context only) this technique also converts it to ico, however it will not work in windows xp as winxp cannot convert from png to ico. it saves to the desktop it uses fileutils.jsm. ...
HTMLDetailsElement - Web APIs
a boolean reflecting the open html attribute, indicating whether or not the element’s contents (not counting the <summary>) is to be shown to the user. methods no specific method; inherits methods from its parent, htmlelement. events listen to this event using addeventlistener() or by assigning an event listener to the oneventname property of this interface. toggle fired when the open/closed state of a <details> element is toggled. specifications specification status comment html living standardthe definition of 'htmldetailselement' in that specification. candidate recommendation ...
HTMLElement.offsetLeft - Web APIs
ffsetheight describe the dimensions of the bounding border box (use element.getboundingclientrect() to get its position). therefore, a box with the left, top, width and height of offsetleft, offsettop, offsetwidth and offsetheight will not be a bounding box for a span with wrapped text. syntax left = element.offsetleft; left is an integer representing the offset to the left in pixels from the closest relatively positioned parent element. example var colortable = document.getelementbyid("t1"); var toleft = colortable.offsetleft; if (toleft > 5) { // large left offset: do something here } this example shows a 'long' sentence that wraps within a div with a blue border, and a red box that one might think should describe the boundaries of the span. <div style="width: 300px; border-colo...
HTMLElement.offsetParent - Web APIs
if there is no positioned ancestor element, the nearest ancestor td, th, table will be returned, or the body if there are no ancestor table elements either. note: offsetparent returns null in the following situations: the element or its parent element has the display property set to none. the element has the position property set to fixed (firefox returns <body>). the element is <body> or <html>. offsetparent is useful because offsettop and offsetleft are relative to its padding edge. ...
HTMLElement.offsetTop - Web APIs
the htmlelement.offsettop read-only property returns the distance of the current element relative to the top of the offsetparent node. syntax toppos = element.offsettop; parameters toppos is the number of pixels from the top of the closest relatively positioned parent element. example var d = document.getelementbyid("div1"); var toppos = d.offsettop; if (toppos > 10) { // object is offset more // than 10 pixels from its parent } specification specification status comment css object model (cssom) view modulethe definition of 'offsettop' in that specification. working draft browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out h...
HTMLImageElement.alt - Web APIs
scelerisque sit amet. ut nunc neque, porta eu auctor at, tempor et arcu.</p> </div> </div> css the css for this example simply sets up the styles for the layout as shown in the result below. they're not crucial to the concept shown in the html above, but you may expand the view below if you wish to read the css used. view the css editors: if you change the css below, please be sure to close the details box using the toggle at the top of the css view before saving. otherwise, readers will find it open by default, which is not the intent here. body { margin: 0; padding: 0; } p { margin-block-start: 0; margin-block-end: 1em; margin-top: 0; margin-bottom: 1em; } .container { width: 100vh; height: 95vh; font: 16px arial,helvetica,sans-serif; } .left-margin { backg...
HTMLTrackElement - Web APIs
the htmltrackelement interface represents an html <track> element within the dom. this element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/eventtarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignm...
The HTML DOM API - Web APIs
interact with an app and its content, but also to support messaging between windows or apps. broadcastchannel dedicatedworkerglobalscope messagechannel messageevent messageport sharedworker sharedworkerglobalscope worker workerglobalscope workerlocation workernavigator websocket interfaces these interfaces, defined by the html specification, are used by the websockets_api. closeevent websocket server-sent events interfaces the eventsource interface represents the source which sent or is sending server-sent events. eventsource examples in this example, an <input> element's input event is monitored in order to update the state of a form's "submit" button based on whether or not a given field currently has a value. javascript const namefield = document.getele...
IDBCursor.continuePrimaryKey() - Web APIs
the continueprimarykey() method of the idbcursor interface advances the cursor to the to the item whose key matches the key parameter as well as whose primary key matches the primary key parameter. a typical use case, is to resume the iteration where a previous cursor has been closed, without having to compare the keys one by one. calling this method more than once before new cursor data has been loaded - for example, calling continueprimarykey() twice from the same onsuccess handler - results in an invalidstateerror being thrown on the second call because the cursor’s got value flag has been unset. this method is only valid for cursors coming from an index. using it for cursors coming from an object store will throw an error. note: this feature is available in web workers. syntax curs...
IDBDatabase.onversionchange - Web APIs
recommendation indexed database api draftthe definition of 'onversionchange' in that specification. recommen...
IDBDatabase.transaction() - Web APIs
is currently experimental, and can only be used if the dom.indexeddb.experimental pref is set to true in about:config. details optional dictionary of other settings, supported only by chrome: return value an idbtransaction object. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the close() method has previously been called on this idbdatabase instance. notfounderror an object store specified in in the storenames parameter has been deleted or removed. typeerror the value for the mode parameter is invalid. invalidaccesserror the function was called with an empty list of store names. example in this example we open a database con...
IDBKeyRange.bound() - Web APIs
Web › API › IDBKeyRange › bound
note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.bound(lower, upper); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen); var myidbkeyrange = idbkeyrange.bound(lower, upper, loweropen, upperopen); parameters lower specifies the lower bound of the new key range. ...
IDBKeyRange.lowerBound() - Web APIs
note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.lowerbound(lower); var myidbkeyrange = idbkeyrange.lowerbound(lower, open); parameters lower specifies the lower bound of the new key range. open optional indicates whether the lower bound excludes the endpoint value. the default is false. return value idbkeyrange: the newly created key range. ...
IDBKeyRange.upperBound() - Web APIs
note: this feature is available in web workers. syntax var myidbkeyrange = idbkeyrange.upperbound(upper[, open=false]) parameters bound specifies the upper bound of the new key range. open indicates whether the upper bound excludes the endpoint value. the default is false. optional return value idbkeyrange: the newly created key range. ...
IDBKeyRange - Web APIs
u can limit the range using lower and upper bounds. for example, you can iterate over all values of a key in the value range a–z. a key range can be a single value or a range with upper and lower bounds or endpoints. if the key range has both upper and lower bounds, then it is bounded; if it has no bounds, it is unbounded. a bounded key range can either be open (the endpoints are excluded) or closed (the endpoints are included). to retrieve all keys within a certain range, you can use the following code constructs: range code all keys ≥ x idbkeyrange.lowerbound(x) all keys > x idbkeyrange.lowerbound(x, true) all keys ≤ y idbkeyrange.upperbound(y) all keys < y idbkeyrange.upperbound(y, true) all keys ≥ x && ≤ y ...
IDBOpenDBRequest.onblocked - Web APIs
note: this feature is available in web workers. syntax idbopendbrequest.onblocked = function(event) { ... ...
IIRFilterNode - Web APIs
d this interface useful if you don't need automation, or for other reasons. once the node has been created, you can't change its coefficients. iirfilternodes have a tail-time reference; they continue to output non-silent audio with zero input. as an iir filter, the non-zero input continues forever, but this can be limited after some finite time in practice, when the output has approached zero closely enough. the actual time that takes depends on the filter coefficients provided. constructor iirfilternode() creates a new instance of an iirfilternode object. properties this interface has no properties of its own; however, it inherits properties from its parent, audionode. methods inherits methods from its parent, audionode. it also has the following additional methods: getfreq...
ImageBitmap - Web APIs
eimagebitmap() factory method. imagebitmap provides an asynchronous and resource efficient pathway to prepare textures for rendering in webgl. properties imagebitmap.height read only is an unsigned long representing the height, in css pixels, of the imagedata. imagebitmap.width read only is an unsigned long representing the width, in css pixels, of the imagedata. methods imagebitmap.close() disposes of all graphical resources associated with an imagebitmap. specifications specification status comment html living standardthe definition of 'imagebitmap' in that specification. living standard ...
ImageCapture.getPhotoSettings() - Web APIs
bject containing the current photo configuration settings. syntax const settingspromise = imagecapture.getphotosettings() return value a promise that resolves with a photosettings object containing the following properties: filllightmode: the flash setting of the capture device, one of "auto", "off", or "on". imageheight: the desired image height as an integer. the user agent selects the closest width value to this setting if it only supports discrete heights. imagewidth: the desired image width as an integer. the user agent selects the closest width value to this setting if it only supports discrete widths. redeyereduction: a boolean indicating whether the red-eye reduction should be used if it is available. example the following example, extracted from chrome's image capture / p...
ImageCapture.takePhoto() - Web APIs
h a blob containing the data. syntax const blobpromise = imagecaptureobj.takephoto([photosettings]) parameters photosettings optional an object that sets options for the photo to be taken. the available options are: filllightmode: the flash setting of the capture device, one of "auto", "off", or "flash". imageheight: the desired image height as an integer. the user agent selects the closest height value to this setting if it only supports discrete heights. imagewidth: the desired image width as an integer. the user agent selects the closest width value to this setting if it only supports discrete widths. redeyereduction: a boolean indicating whether the red-eye reduction should be used if it is available. return value a promise that resolves with a blob. example this ...
Browser storage limits and eviction criteria - Web APIs
d. we term them "quota clients" in this context: indexeddb asm.js caching cache api cookies note: in firefox, web storage will soon start to use the same storage management tools too, as described in this document. note: in private browsing mode, most data storage is not supported. local storage data and cookies are still stored, but they are ephemeral — the data is deleted when you close the last private browsing window. the "last access time" of origins is updated when any of these are activated/deactivated — origin eviction will delete data for all these quota clients. in chrome/opera, the quota management api handles quota management for appcache, indexeddb, websql, and file system api. different types of data storage even in the same browser, using the same storage met...
IntersectionObserver.rootMargin - Web APIs
of the rectangle represented by rootmargin is added to the corresponding side in the root element's bounding box before the intersection test is performed. this lets you, for example, adjust the bounds outward so that the target element is considered 100% visible even if a certain number of pixels worth of width or height is clipped away, or treat the target as partially hidden if an edge is too close to the edge of the root's bounding box. see the root element and root margin in intersection observer api for a more in-depth look at the root margin and how it works with the root's bounding box. syntax var marginstring = intersectionobserver.rootmargin; value a string, formatted similarly to the css margin property's value, which contains offsets for one or more sides of the root's boundi...
KeyboardEvent.code - Web APIs
ode property represents a physical key on the keyboard (as opposed to the character generated by pressing the key). in other words, this property returns a value that isn't altered by keyboard layout or the state of the modifier keys. if the input device isn't a physical keyboard, but is instead a virtual keyboard or accessibility device, the returned value will be set by the browser to match as closely as possible to what would happen with a physical keyboard, to maximize compatibility between physical and virtual input devices. this property is useful when you want to handle keys based on their physical positions on the input device rather than the characters associated with those keys; this is especially common when writing code to handle input for games that simulate a gamepad-like enviro...
MSCandidateWindowHide - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. mscandidatewindowhide fires after the input method editor (ime) candidate window closes and is fully hidden. this proprietary method is specific to internet explorer. general info synchronous no bubbles no cancelable no note windows 8.1 and windows 7 imes for certain languages on internet explorer for the desktop might not support this event. on internet explorer in the new windows ui, this event is supported in windows 8.1 imes of all languages. syntax event property objec...
MSCandidateWindowShow - Web APIs
developers could listen to them and shift the suggestion ui accordingly. see also microsoft api extensions ime handling guide for gecko ...
MediaDevices.getDisplayMedia() - Web APIs
straints. the go-ahead permission to use getdisplaymedia() cannot be persisted for reuse. the user must be prompted for permission every time. the call to getdisplaymedia() must be made from code which is running in response to a user action, such as in an event handler. browsers are encouraged to provide a warning to users about sharing displays or windows that contain browsers, and to keep a close eye on what other content might be getting captured and shown to other users. example in the example below, a startcapture() method is created which initiates screen capture given a set of options specified by the displaymediaoptions parameter. the options are specified in the form of a mediastreamconstraints object which specifies the preferred stream configuration and the display surface fro...
MediaSource.MediaSource() - Web APIs
...
MediaSource.addSourceBuffer() - Web APIs
live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeven...
MediaSource.endOfStream() - Web APIs
live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeven...
MediaSource.isTypeSupported() - Web APIs
live, or download the source for further investigation.) var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource; //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeven...
MediaStream Recording API - Web APIs
the mediastream recording api makes it possible to capture the data generated by a mediastream or htmlmediaelement object for analysis, processing, or saving to disk. it's also surprisingly easy to work with. basic concepts the mediastream recording api is comprised of a single major interface, mediarecorder, which does all the work of taking the data from a mediastream and delivering it to you for processing. ...
MediaTrackConstraints.aspectRatio - Web APIs
lue a constraindouble describing the acceptable or required value(s) for a video track's aspect ratio. the value is the width divided by the height and is rounded to ten decimal places. for example, the standard high-definition video aspect ratio of 16:9 can be computed as 1920/1080, or 1.7777777778. if this value is a number, the user agent will attempt to obtain media whose aspect ratio is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required aspect ratio (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser i...
MediaTrackConstraints.channelCount - Web APIs
count as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { channelcount: constraint }; constraintsobject.channelcount = constraint; value if this value is a number, the user agent will attempt to obtain media whose channel count is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required channel count (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. the channel count is 1 for monaural sound, 2 ...
MediaTrackConstraints.frameRate - Web APIs
ince browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { framerate: constraint }; constraintsobject.framerate = constraint; value a constraindouble describing the acceptable or required value(s) for a video track's frame rate, in frames per second. if this value is a number, the user agent will attempt to obtain media whose frame rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required frame rate (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in ...
MediaTrackConstraints.height - Web APIs
portedconstraints.height as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { height: constraint }; constraintsobject.height = constraint; value if this value is a number, the user agent will attempt to obtain media whose height is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required height (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabi...
MediaTrackConstraints.latency - Web APIs
and the data being made available to the next step in the audio input or output process. in most cases, low latency is desirable for performance and user experience purposes, but when power consumption is a concern, or delays are otherwise acceptable, higher latency might be acceptable. if this property's value is a number, the user agent will attempt to obtain media whose latency tends to be as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required latency (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. latency is always prone to some variation due to...
MediaTrackConstraints.sampleRate - Web APIs
.samplerate as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplerate: constraint }; constraintsobject.samplerate = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample rate is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample rate (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in c...
MediaTrackConstraints.sampleSize - Web APIs
call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { samplesize: constraint }; constraintsobject.samplesize = constraint; value if this value is a number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required sample size (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. since this property can only represent linear ...
MediaTrackControls.volume - Web APIs
they're unfamiliar with. syntax var constraintsobject = { volume: constraint }; constraintsobject.volume = constraint; value a constraindouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. if this value is a number, the user agent will attempt to obtain media whose volume is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constraindouble will guide the user agent in its efforts to provide an exact match to the required volume (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. any constraint set which only permits values outsi...
MediaTrackConstraints.width - Web APIs
ksupportedconstraints.width as returned by a call to mediadevices.getsupportedconstraints(). however, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. syntax var constraintsobject = { width: constraint }; constraintsobject.width = constraint; value if this value is a number, the user agent will attempt to obtain media whose width is as close as possible to this number given the capabilities of the hardware and the other constraints specified. otherwise, the value of this constrainlong will guide the user agent in its efforts to provide an exact match to the required width (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. example see example: constraint exerciser in capabil...
MediaTrackConstraints - Web APIs
ow a script to establish a set of exact (required) values or ranges and/or preferred values or ranges of values for the track, and the most recently-requested set of custom constraints can be retrieved by calling getconstraints(). for each constraint, you can typically specify an exact value you need, an ideal value you want, a range of acceptable values, and/or a value which you'd like to be as close to as possible. the specifics vary somewhat depending on the type of the constrainable property. to learn more about how constraints work, see capabilities, constraints, and settings. properties some combination—but not necessarily all—of the following properties will exist on the object. this may be because a given browser doesn't support the property, or because it doesn't apply. for exa...
MediaTrackSettings - Web APIs
to learn more about how constraints and settings work, see capabilities, constraints, and settings. ...
MessagePort - Web APIs
other. note: this feature is available in web workers. methods inherits methods from its parent, eventtarget postmessage() sends a message from the port, and optionally, transfers ownership of objects to other browsing contexts. start() starts the sending of messages queued on the port (only needed when using eventtarget.addeventlistener; it is implied when using messageport.onmessage.) close() disconnects the port, so it is no longer active. event handlers inherits event handlers from its parent, eventtarget onmessage an eventlistener called when messageevent of type message is fired on the port—that is, when the port receives a message. onmessageerror an eventlistener called when a messageevent of type messageerror is fired—that is, when it receives a message that cann...
NotificationAction - Web APIs
s to perform this common task from the notification without having to open the website. the user can also click the main body of the notification to open their inbox instead. ...
NotificationEvent.action - Web APIs
on. the notification id is set during the creation of the notification via the actions array attribute and can't be modified unless the notification is replaced. returns a domstring object. example self.registration.shownotification("new articles available", { actions: [{action: "get", title: "get now."}] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'get') { synchronizereader(); } else { clients.openwindow("/reader"); } }, false); specifications specification status comment notifications apithe definition of 'action' in that specification. living standard living standard. ...
NotificationEvent.notification - Web APIs
returns a notification object. example self.addeventlistener('notificationclick', function(event) { console.log('on notification click'); // data can be attached to the notification so that you // can process it in the notificationclick handler. ...
NotificationEvent - Web APIs
than an action button, or the notification does not have a button. methods inherits methods from its parent, extendableevent. extendableevent.waituntil() extends the lifetime of the event. tells the browser that work is ongoing. ...
Page Visibility API - Web APIs
is throttling behavior. in these cases, you can use the page visibility api to reduce the tabs' performance impact while they're hidden. tabs which are playing audio are considered foreground and aren’t throttled. tabs running code that's using real-time network connections (websockets and webrtc) go unthrottled in order to avoid closing these connections timing out and getting unexpectedly closed. indexeddb processes are also left unthrottled in order to avoid timeouts. example view live example (video with sound). the example, which pauses the video when you switch to another tab and plays again when you return to its tab, was created with the following code: // set the name of the hidden property and the change event for visibility var hidden, visibilitychange; if (typeof documen...
PannerNode.distanceModel - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
PannerNode.maxDistance - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
PannerNode.panningModel - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
PannerNode.setOrientation() - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
PannerNode.setPosition() - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
PannerNode.setVelocity() - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
PannerNode - Web APIs
nernode would be used to control audio spatialisation. generally you will define the position in 3d space that your audio listener and panner (source) occupy initially, and then update the position of one or both of these as the application is used. you might be moving a character around inside a game world for example, and wanting delivery of audio to change realistically as your character moves closer to or further away from a music player such as a stereo. in the example you can see this being controlled by the functions moveright(), moveleft(), etc., which set new values for the panner position via the positionpanner() function. to see a complete implementation, check out our panner-node example (view the source code) — this demo transports you to the 2.5d "room of metal", where you can ...
Path2D - Web APIs
Web › API › Path2D
h that can then be used on a canvasrenderingcontext2d object. the path methods of the canvasrenderingcontext2d interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. constructors path2d() path2d constructor. creates a new path2d object. methods path2d.addpath() adds a path to the current path. path2d.closepath() causes the point of the pen to move back to the start of the current sub-path. it tries to draw a straight line from the current point to the start. if the shape has already been closed or has only one point, this function does nothing. path2d.moveto() moves the starting point of a new sub-path to the (x, y) coordinates. path2d.lineto() connects the last point in the subpath to the (x,...
PaymentResponse.retry() - Web APIs
is valid and acceptable, call complete("success") to finalize the payment and proces it. if show() is rejected, the payment request failed, usually because either there's already one being processed, because the user agent doesn't support any of the specified payment methods, or because of a security issue. see the list of exceptions for show() for further details. call complete("fail") to close the payment request. async function handlepayment() { const payrequest = new paymentrequest(methoddata, details, options); try { let payresponse = await payrequest.show(); while (payresponse has errors) { /* let the user edit the payment information, wait until they submit */ await response.retry(); } await payresponse.complete("success"); } catch(er...
PaymentResponse - Web APIs
able error), this method allows a merchant to request that the user retry the payment. the method takes an object as argument, which is used to signal to the user exactly what is wrong with the payment response so they can try to correct any issues. paymentresponse.complete() secure context notifies the user agent that the user interaction is over. this causes any remaining user interface to be closed. this method should only be called after the promise returned by the paymentrequest.show() method. events listen to this event using addeventlistener() or by assigning an event listener to the oneventname property of this interface. payerdetailchange secure context fired during a retry when the user makes changes to their personal information while filling out a payment request form. al...
Using the Payment Request API - Web APIs
er has no apps demo for the full code. showing additional user interface after successful payments if the merchant desires to collect additional information not part of the api (e.g., additional delivery instructions), the merchant can show a page with additional <input type="text"> fields after the checkout. request.show() .then(function(paymentresponse) { // process payment here. // close the ui: paymentresponse.complete('success').then(function() { // request additional shipping address details. const additionaldetailscontainer = document.getelementbyid('additional-details-container'); additionaldetailscontainer.style.display = 'block'; window.scrollto(additionaldetailscontainer.getboundingclientrect().x, 0); }).catch(function(error) { ...
PerformanceNavigationTiming.toJSON() - Web APIs
the tojson() method is a serializer - it returns a json representation of the performancenavigationtiming object. syntax json = resourceperfentry.tojson(); arguments none return value json a json object that is the serialization of the performancenavigationtiming object as a map with entries from the closest inherited interface and with entries for each of the serializable attributes. example // get a resource performance entry var perfentries = performance.getentriesbytype("navigation"); var entry = perfentries[0]; // get the json and log it var json = entry.tojson(); var s = json.stringify(json); console.log("performancenavigationtiming.tojson() = " + s); specifications specification status comment navigation timing level 2the definitio...
PerformanceResourceTiming.toJSON() - Web APIs
the tojson() method is a serializer that returns a json representation of the performanceresourcetiming object. syntax json = resourceperfentry.tojson(); arguments none return value json a json object that is the serialization of the performanceresourcetiming object as a map with entries from the closest inherited interface and with entries for each of the serializable attributes. example // get a resource performance entry var perfentries = performance.getentriesbytype("resource"); var entry = perfentries[0]; // get the json and log it var json = entry.tojson(); var s = json.stringify(json); console.log("performanceentry.tojson = " + s); specifications specification status comment resource timing level 2the definition of 'tojson' in that specifica...
PerformanceResourceTiming - Web APIs
starts requesting the resource from the server. performanceresourcetiming.responsestartread only a domhighrestimestamp immediately after the browser receives the first byte of the response from the server. performanceresourcetiming.responseendread only a domhighrestimestamp immediately after the browser receives the last byte of the resource or immediately before the transport connection is closed, whichever comes first. performanceresourcetiming.transfersizeread only a number representing the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body. performanceresourcetiming.encodedbodysizeread only a number representing the size (in octets) received from the fetch (http or cache), of the payload body, before removing any...
PerformanceTiming.responseEnd - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.responseend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server from a cache or from a local resource. syntax time = performancetiming.responseend; specifications specification status comment navigation timingthe definition of 'performancetiming.responseend' in that specification. recommendation initial definition. ...
PerformanceTiming - Web APIs
uest and the connection is reopened, this property will be set to the time corresponding to the new request. performancetiming.responsestart read only when the browser received the first byte of the response, from the server from a cache, or from a local resource. performancetiming.responseend read only when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server, the cache, or from a local resource. performancetiming.domloading read only when the parser started its work, that is when its document.readystate changes to 'loading' and the corresponding readystatechange event is thrown. performancetiming.dominteractive read only when the parser finished its work on the main document, that is when its docum...
Pinch zoom gestures - Web APIs
ing gestures to an application can significantly improve the user experience. there are many types of gestures, from the simple single-touch swipe gesture to the more complex multi-touch twist gesture, where the touch points (aka pointers) move in different directions. this example shows how to detect the pinch/zoom gesture, which uses pointer events to detect whether the user moves two pointers closer or farther apart from each other. a live version of this application is available on github. the source code is available on github; pull requests and bug reports are welcome. example in this example, you use the pointer events to simultaneously detect two pointing devices of any type, including fingers, mice, and pens. the pinch in (zoom out) gesture, which moves the two pointers toward eac...
Pointer events - Web APIs
produce further events. for example, a pen that is a down state is considered active because it can produce additional events when the pen is lifted or moved. digitizer a sensing device with a surface that can detect contact. most commonly, the sensing device is a touch-enabled screen that can sense input from an input device such as a pen, stylus, or finger. some sensing devices can detect the close proximity of the input device, and the state is expressed as a hover following the mouse. hit test the process the browser uses to determine a target element for a pointer event. typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. pointer a hardware-agnostic representation of input devices that can target a ...
PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() - Web APIs
ator is available. as of today (march 2019), this is basically indicating if windows hello may be used with the web authentication api and that the user has accepted its use. note: this is a static method which is directly called on the publickeycredential interface and not on an instance. note: in earlier versions of the specification, the boolean also conveyed the consent of the user to disclose such an authenticator existed. examples publickeycredential.isuserverifyingplatformauthenticatoravailable() .then(function(available){ if(available){ // we can proceed with the creation of a publickeycredential // with this authenticator } else { // use another kind of authenticator or a classical login/password // workflow } }).catch(function(err){ ...
PublicKeyCredentialCreationOptions.attestation - Web APIs
ty of the publickeycredentialcreationoptions dictionary. this is a string whose value indicates the preference regarding the attestation transport, between the authenticator, the client and the relying party. the attestation is a mean for the relying party to verify the origin of the authenticator with an attestation certificate authority. the information contained in the attestation may thus disclose some information about the user (e.g. which device they are using). syntax attestation = publickeycredentialcreationoptions.attestation value a string which may be "none": the relying party is not interested in this attestation. this avoids making a check with the attestation certificate authority and asking the user consent for sharing identifying information. "indirect": the client may ...
RTCConfiguration.bundlePolicy - Web APIs
for an rtcpeerconnection specifies how the ice agent should handle negotiation if the remote peer isn't compatible with the sdp bundle standard. if the remote peer is bundle compatible, the policy is moot and all media tracks and the data channel are bundled onto a single rtcdtlstransport at the completion of the negotiation process. any other transports that were used during negotiation are then closed. in technical terms, an sdp bundle lets all of the media tracks (identified in the sdp from the m= lines) stream between two peers across a single 5-tuple, that is, from a single ip and port on one peer to a single ip and port on another peer, all using the same rtcdtlstransport. the goal of bundling is to optimize performance by reducing the overhead of having multiple transports in play. the...
RTCConfiguration - Web APIs
ndle-aware" (compatible with the sdp bundle standard for bundling multiple media streams on a single transport link). all browser implementations are bundle-aware. if the remote endpoint is bundle-aware, all media tracks and data channels are bundled onto a single transport at the completion of negotiation, regardless of policy used, and any superfluous transports that were created initially are closed at that point. note: in technical terms, a bundle lets all media flow between two peers flow across a single 5-tuple; that is, from a single ip and port on one peer to a single ip and port on the other peer, using the same transport protocol. constant description "balanced" the ice agent initially creates one rtcdtlstransport for each type of content added: audio,...
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
there's room to buffer them. listeners may be added with onbufferedamountlow or addeventlistener(). the user agent may implement the process of actually sending data in any way it chooses; this may be done periodically during the event loop or truly asynchronously. as messages are actually sent, this value is reduced accordingly. bufferedamountlow events are not fired after the data channel is closed. syntax var threshold = adatachannel.bufferedamountlowthreshold; adatachannel.bufferedamountlowthreshold = threshold; value the number of queued outgoing data bytes below which the buffer is considered to be "low." example in this snippet of code, bufferedamountlowthreshold is set to 64kb, and a handler for the bufferedamountlow event is established by setting the rtcdatachannel.onbuffe...
RTCDataChannelEvent.channel - Web APIs
remote peer. example the first line of code in the datachannel event handler shown below takes the channel from the event object and saves it locally for use by the code handling data traffic. pc.ondatachannel = function(event) { inbounddatachannel = event.channel; inbounddatachannel.onmessage = handleincomingmessage; inbounddatachannel.onopen = handlechannelopen; inbounddatachannel.onclose = handlechannelclose; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannelevent.channel' in that specification. candidate recommendation initial specification. ...
RTCDataChannelEvent - Web APIs
p to save the data channel reference and set up handlers for the events which need to be monitored. the channel property provides the rtcdatachannel representing the connection to the other peer. pc.ondatachannel = function(event) { inbounddatachannel = event.channel; inbounddatachannel.onmessage = handleincomingmessage; inbounddatachannel.onopen = handlechannelopen; inbounddatachannel.onclose = handlechannelclose; } see a simple rtcdatachannel sample for another, more complete, example of how to use data channels. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcdatachannelevent' in that specification. candidate recommendation initial definition. ...
RTCIceCandidateStats.deleted - Web APIs
d by the rtcicecandidatestats object is no longer under consideration. dthe exact meaning varies depending on the type of candidate: local candidate a value of true means the candidate has been deleted as described by rfc 5245: 8.3. host candidate a value of true indicates that the candidate's network resources have been released. this generally mean sthat any associated socket(s) have been closed and released. remote (turn) candidate a value of true means the candidate's turn allocation is no longer active. the net result is the same; the candidate is no longer under consideration if this value is true. example in this example, setinterval() is used to set up a function that runs periodically to display the latest statistics for candidates. only candidates which have not been delet...
RTCIceTransport.onselectedcandidatepairchange - Web APIs
e = candidatepairhandler; value this propoerty should be set to reference an event handler function to be called by the ice agent when it discovers a new candidate pair that the rtcicetransport will be using for communication with the remote peer. this event will occur at least once, and may occur more than once if the ice agent continues to identify candidate pairs that will work better, more closely match the requested parameters, and so forth. the event handler can determine the current state by calling the transport's getselectedcandidatepair() method, which returns a rtcicecandidatepair whose rtcicecandidatepair.local and rtcicecandidatepair.global properties specify rtcicecandidate objects describing the local and remote candidates that are currently being used. example in this exam...
RTCIceTransport.state - Web APIs
e for additional details. "failed" the rtcicetransport has finished the gathering process, has received the "no more candidates" notification from the remote peer, and has finished checking pairs of candidates, without successfully finding a pair that is both valid and for which consent can be obtained. this is a terminal state, indicating that the connection cannot be achieved or maintained. "closed" the transport has shut down and is no longer responding to stun requests. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcicetransportstate' in that specification. candidate recommendation initial definition. ...
RTCIceTransportState - Web APIs
e for additional details. "failed" the rtcicetransport has finished the gathering process, has received the "no more candidates" notification from the remote peer, and has finished checking pairs of candidates, without successfully finding a pair that is both valid and for which consent can be obtained. this is a terminal state, indicating that the connection cannot be achieved or maintained. "closed" the transport has shut down and is no longer responding to stun requests. usage notes if an ice restart occurs, the candidate gathering and connectivity check process is started over again; this will cause a transition from the "connected" state if the restart occurred while the state was "completed". if the restart occured during a transient "disconnected" state, the state transitions to ...
RTCPeerConnection.addStream() - Web APIs
if the signalingstate is set to stable, the event negotiationneeded is sent on the rtcpeerconnection to indicate that ice negotiation must be repeated to consider the new stream. ...
RTCPeerConnection.addTrack() - Web APIs
th an rtcrtpreceiver to make up an rtcrtptransceiver. the associated receiver is muted (indicating that it is not able to deliver packets) until and unless one or more streams are added to the receiver by the remote peer. exceptions invalidaccesserror the specified track (or all of its underlying streams) is already part of the rtcpeerconnection. invalidstateerror the rtcpeerconnection is closed. usage notes adding tracks to multiple streams after the track parameter, you can optionally specify one or more mediastream objects to add the track to. only tracks are sent from one peer to another, not streams. since streams are specific to each peer, specifying one or more streams means the other peer will create a corresponding stream (or streams) automatically on the other end of the c...
RTCPeerConnection: connectionstatechange event - Web APIs
alls an app-defined function called setonlinestatus() to update a status display. pc.onconnectionstatechange = ev => { switch(pc.connectionstate) { case "new": case "checking": setonlinestatus("connecting..."); break; case "connected": setonlinestatus("online"); break; case "disconnected": setonlinestatus("disconnecting..."); break; case "closed": setonlinestatus("offline"); break; case "failed": setonlinestatus("error"); break; default: setonlinestatus("unknown"); break; } } you can also create a handler for connectionstatechange by using addeventlistener(): pc.addeventlistener("connectionstatechange", ev => { switch(pc.connectionstate) { /* ... */ } }, false); specifications ...
RTCPeerConnection.createDataChannel() - Web APIs
figured using the rtcdatachannelinit dictionary represent the script-settable subset of the properties on the rtcdatachannel interface. return value a new rtcdatachannel object with the specified label, configured using the options specified by options if that parameter is included; otherwise, the defaults listed above are established. exceptions invalidstateerror the rtcpeerconnection is closed. typeerror this can happen in a couple of situations: the label and/or protocol string is too long; these cannot be longer than 65,535 bytes (bytes, rather than characters). the id is 65535. while this is a valid unsigned 16-bit value, it's not a permitted value for id. syntaxerror values were specified for both the maxpacketlifetime and maxretransmits options. you may only specify...
RTCPeerConnection.createOffer() - Web APIs
o the rtcsessiondescriptioninit dictionary which contains the sdp describing the generated offer. that received offer should be delivered through the signaling server to a remote peer. exceptions these exceptions are returned by rejecting the returned promise. your rejection handler should examine the received exception to determine which occurred. invalidstateerror the rtcpeerconnection is closed. notreadableerror no certificate or set of certificates was provided for securing the connection, and createoffer() was unable to create a new one. since all webrtc connections are required to be secured, that results in an error. operationerror examining the state of the system to determine resource availability in order to generate the offer failed for some reason. example here we see a...
RTCPeerConnection.getIdentityAssertion() - Web APIs
the method returns immediately. if the assertion cannot be generated, an idpassertionerror will be sent to the object. it is not expected for the application dealing with the rtcpeerconnection: this is automatically done; an explicit call only allows to anticipate the need. syntax pc.getidentityassertion(); there is neither parameter nor return value for this method. ...
RTCPeerConnection.iceConnectionState - Web APIs
"disconnected" checks to ensure that components are still connected failed for at least one component of the rtcpeerconnection. this is a less stringent test than "failed" and may trigger intermittently and resolve just as spontaneously on less reliable networks, or during temporary disconnections. when the problem resolves, the connection may return to the "connected" state. "closed" the ice agent for this rtcpeerconnection has shut down and is no longer handling requests. example var pc = new rtcpeerconnection(); var state = pc.iceconnectionstate; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.iceconnectionstate' in that specification. candidate...
RTCPeerConnection.onconnectionstatechange - Web APIs
the peer connection's connectionstate property to determine what the new state is. example pc.onconnectionstatechange = function(event) { switch(pc.connectionstate) { case "connected": // the connection has become fully connected break; case "disconnected": case "failed": // one or more transports has terminated unexpectedly or in an error break; case "closed": // the connection has been closed break; } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.onconnectionstatechange' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection.oniceconnectionstatechange - Web APIs
he new state is. example the example below watches the state of the ice agent for a failure or unexpected closure and takes appropriate action, such as presenting an error message or attempting to restart the ice agent. pc.oniceconnectionstatechange = function(event) { if (pc.iceconnectionstate === "failed" || pc.iceconnectionstate === "disconnected" || pc.iceconnectionstate === "closed") { // handle the failure } }; of course, "disconnected" and "closed" don't necessarily indicate errors; these can be the result of normal ice negotiation, so be sure to handle these properly (if at all). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.oniceconnectionstatech...
RTCPeerConnection.onicegatheringstatechange - Web APIs
peerconnection.onicegatheringstatechange property is an eventhandler which specifies a function to be called when the icegatheringstatechange event is sent to an rtcpeerconnection instance. this happens when the ice gathering state—that is, whether or not the ice agent is actively gathering candidates—changes. you don't need to watch for this event unless you have specific reasons to want to closely monitor the state of ice gathering. syntax rtcpeerconnection.onicegatheringstatechange = eventhandler; value a function you provide which is passed a single parameter: an event object containing the icegatheringstatechange event. you can determine the new state of ice gathering by looking at the value of the rtcpeerconnection.icegatheringstate property. example this example updates statu...
RTCPeerConnection.setConfiguration() - Web APIs
.credentials is missing). this prevents successful login to the server. invalidmodificationerror the configuration includes changed identity information, but the connection already has identity information specified. this happens if configuration.peeridentity or configuration.certificates is set and their values differ from the current configuration. invalidstateerror the rtcpeerconnection is closed. syntaxerror one or more of the urls provided in the configuration.iceservers list is invalid. example in this example, it has already been determined that ice restart is needed, and that negotiation needs to be done using a different ice server. var restartconfig = { iceservers: [{ urls: "turn:asia.myturnserver.net", username: "allie@oop...
RTCPeerConnection.setIdentityProvider() - Web APIs
syntax pc.setidentityprovider(domainname [, protocol] [, username]); there is no return value for this method. ...
RTCPeerConnection.setLocalDescription() - Web APIs
form of the method returns instantaneously without waiting for the actual setting to be done: in case of success, the successcallback will be called; in case of failure, the errorcallback will be called. deprecated exceptions when using the deprecated callback-based version of setlocaldescription(), the following exceptions may occur: invalidstateerror the connection's signalingstate is "closed", indicating that the connection is not currently open, so negotiation cannot take place. invalidsessiondescriptionerror the rtcsessiondescription specified by the sessiondescription parameter is invalid. examples implicit descriptions one of the advantages of the parameter-free form of setlocaldescription() is that it lets you simplify your negotiation code substantially. this is all yo...
RTCPeerConnection.signalingState - Web APIs
iption(). this provisional answer describes the supported media formats and so forth, but may not have a complete set of ice candidates included. further candidates will be delivered separately later. "have-remote-pranswer" a provisional answer has been received and successfully applied in response to an offer previously sent and established by calling setlocaldescription(). "closed" the connection is closed. note: this value moved into the rtcpeerconnectionstate enum in the may 13, 2016 draft of the specification, as it reflects the state of the rtcpeerconnection, not the signaling connection. you now detect a closed connection by checking for connectionstate to be "closed" instead. example var pc = new rtcpeerconnection(configuration);...
RTCRtpSender.setStreams() - Web APIs
sender.setstreams([mediastream...]); parameters mediastream or [mediastream...] optional an mediastream object—or an array of multiple mediastream objects—identifying the streams to which the rtcrtpsender's track belongs. if this parameter isn't specified, no new streams will be associated with the track. return value none. exceptions invalidstateerror the sender's connection is closed. description setstreams() is purely additive. it doesn't remove the track from any streams; it simply adds it to new ones. if you specify streams to which the track already belongs, that stream is unaffected. once the track has been added to all of the streams, renegotiation of the connection will be triggered by the negotiationneeded event being dispatched to the rtcpeerconnection to which ...
RTCRtpTransceiver.direction - Web APIs
ast one active encoding, the user agent gets its parameters using rtcrtpsender.getparameters(), then looks at the parameters' encodings property; if any of the listed encodings has its active property set to true, the sender has an active encoding. exceptions when setting the value of direction, the following exceptions can occur: invalidstateerror either the receiver's rtcpeerconnection is closed or the rtcrtpreceiver is stopped. usage notes setting the direction when you change the value of direction, an invalidstateerror exception will occur if the connection is closed or the receiver is stopped. if the new value of direction is in fact different from the existing value, renegotiation of the connection is required, so a negotiationneeded event is sent to the rtcpeerconnection. ef...
RTCRtpTransceiver.stop() - Web APIs
property has been deprecated and will be removed at some point. instead, check the value of currentdirection. if it's stopped, the transceiver has been stopped. this method does nothing if the transceiver is already stopped. syntax rtcrtptransceiver.stop() paramters none. return value undefined exceptions invalidstateerror the rtcpeerconnection of which the transceiver is a member is closed. usage notes when you call stop() on a transceiver, the sender immediately stops sending media and each of its rtp streams are closed using the rtcp "bye" message. the receiver then stops receiving media; the receiver's track is stopped, and the transceiver's direction is changed to stopped, and renegotiation is triggered by sending a negotiationneeded event to the rtcpeerconnection. the neg...
RTCSctpTransport.state - Web APIs
provides information which describes a stream control transmission protocol (sctp) transport state. syntax var mystate = sctptransport.state; value a string whose value is taken from the rtcsctptransportstate enumerated type. its value is one of the following: connecting the initial state when the connection is being estabilished. connected the connection is open for data transmission. closed the connection is closed and can no longer be used. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsctptransport.state' in that specification. candidate recommendation initial definition. ...
Range.commonAncestorContainer - Web APIs
ner read-only property returns the deepest — or furthest down the document tree — node that contains both boundary points of the range. this means that if range.startcontainer and range.endcontainer both refer to the same node, this node is the common ancestor container. since a range need not be continuous, and may also partially select nodes, this is a convenient way to find a node which encloses a range. this property is read-only. to change the ancestor container of a node, consider using the various methods available to set the start and end positions of the range, such as range.setstart() and range.setend(). syntax rangeancestor = range.commonancestorcontainer; example in this example, we create an event listener to handle pointerup events on a list. the listener gets the common...
ReadableByteStreamController - Web APIs
. constructor none. readablebytestreamcontroller instances are created automatically during readablestream construction. properties readablebytestreamcontroller.byobrequest read only returns the current byob pull request. readablebytestreamcontroller.desiredsize read only returns the desired size required to fill the stream's internal queue. methods readablebytestreamcontroller.close() closes the associated stream. readablebytestreamcontroller.enqueue() enqueues a given chunk in the associated stream. readablebytestreamcontroller.error() causes any future interactions with the associated stream to error. examples tbd. specifications specification status comment streamsthe definition of 'readablebytestreamcontroller' in that specification. ...
ReadableStream.cancel() - Web APIs
e underlying source, which may or may not use it. cancel is used when you've completely finished with the stream and don't need any more data from it, even if there are chunks enqueued waiting to be read. that data is lost after cancel is called, and the stream is not readable any more. to read those chunks still and not completely get rid of the stream, you'd use readablestreamdefaultcontroller.close(). syntax var promise = readablestream.cancel(reason); parameters reason a domstring providing a human-readable reason for the cancellation. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to cancel is not a readablestream, or it is locked. examples in jake archibald's cancelling a fetch example,...
ReadableStream - Web APIs
nst stream = new readablestream({ start(controller) { // the following function handles each data chunk function push() { // "done" is a boolean and value a "uint8array" reader.read().then(({ done, value }) => { // is there no more data to read? ...
ReadableStreamBYOBReader.read() - Web APIs
eue. syntax var promise = readablestreambyobreader.read(view); parameters view the view to be read into. return value a promise, which fulfills/rejects with a result depending on the state of the stream. the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk, done: false }. if the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined, done: true }. if the stream becomes errored, the promise will be rejected with the relevant error. exceptions typeerror the source object is not a readablestreambyobreader, the stream has no owner, the view is not an object or has become detached, or the view's length is 0. examples tbd. specifications ...
ReadableStreamBYOBReader.releaseLock() - Web APIs
the releaselock() method of the readablestreambyobreader interface releases the reader's lock on the stream. after the lock is released, the reader is no longer active. if the associated stream is errored when the lock is released, the reader will appear errored in that same way subsequently; otherwise, the reader will appear closed. a reader’s lock cannot be released while it still has a pending read request, i.e., if a promise returned by the reader’s readablestreambyobreader.read() method has not finished. this will result in a typeerror being thrown. syntax readablestreambyobreader.releaselock(); parameters none. return value undefined. exceptions typeerror the source object is not a readablestreambyobreader, or a read request is pending. examples tbd. specification...
ReadableStreamBYOBReader - Web APIs
the readablestreambyobreader interface of the streams api represents a byob ("bring your own buffer") reader that can be used to read stream data supplied by the developer (e.g. a custom readablestream() constructor). constructor readablestreambyobreader() creates and returns a readablestreambyobreader object instance. properties readablestreambyobreader.closed read only allows you to write code that responds to an end to the streaming process. returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors. methods readablestreambyobreader.cancel() cancels the stream, signaling a loss of interest in the stream by a consumer. the supplied reason argument will be given to the underlying source, which may or may n...
ReadableStreamDefaultReader.cancel() - Web APIs
e underlying source, which may or may not use it. cancel is used when you've completely finished with the stream and don't need any more data from it, even if there are chunks enqueued waiting to be read. that data is lost after cancel is called, and the stream is not readable any more. to read those chunks still and not completely get rid of the stream, you'd use readablestreamdefaultcontroller.close(). note: if the reader is active, the cancel() method behaves the same as that for the associated stream (readablestream.cancel()). syntax var promise = readablestreamdefaultreader.cancel(reason); parameters reason optional a domstring providing a human-readable reason for the cancellation. return value a promise, which fulfills with the value given in the reason parameter. exceptions...
ReadableStreamDefaultReader.read() - Web APIs
nk in the stream's internal queue. syntax var promise = readablestreamdefaultreader.read(); parameters none. return value a promise, which fulfills/rejects with a result depending on the state of the stream. the different possibilities are as follows: if a chunk is available, the promise will be fulfilled with an object of the form { value: thechunk, done: false }. if the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined, done: true }. if the stream becomes errored, the promise will be rejected with the relevant error. exceptions typeerror the source object is not a readablestreamdefaultreader, or the stream has no owner. examples example 1 - simple example this example shows the basic api usage, but doesn't try to deal with ...
ReadableStreamDefaultReader.releaseLock() - Web APIs
a reader’s lock cannot be released while it still has a pending read request, i.e., if a promise returned by the reader’s readablestreamdefaultreader.read() method has not finished. this will result in a typeerror being thrown. ...
SVGPathElement - Web APIs
rdinates in user space utilizing the browser's distance-along-a-path algorithm. note: in svg 2 this method was moved to the svggeometryelement interface, from which this interface inherits it. svgpathelement.getpathsegatlength() returns an unsigned long representing the index within the pathseglist utilizing the user agent's distance-along-a-path algorithm. svgpathelement.createsvgpathsegclosepath() returns a stand-alone, parentless svgpathsegclosepath object. svgpathelement.createsvgpathsegmovetoabs() returns a stand-alone, parentless svgpathsegmovetoabs object. svgpathelement.createsvgpathsegmovetorel() returns a stand-alone, parentless svgpathsegmovetorel object. svgpathelement.createsvgpathseglinetoabs() returns a stand-alone, parentless svgpathseglinetoabs object. ...
The 'X' property - Web APIs
s syntax is the same as that for <length> // rect draws a rectangle with upper left-hand corner at x,y, with width w, and height h, with optional style // standard reference: http://www.w3.org/tr/svg11/shapes.html#rectelement func (svg *svg) rect(x float64, y float64, w float64, h float64, s ...string) { svg.printf(`<rect %s %s`, dim(x, y, w, h, svg.decimals), endstyle(s, emptyclose)) } ​ ...
SVGSVGElement - Web APIs
responding attributes for the given <view> element the values for transform and viewtarget within currentview will be null if the initial view was a link into another element (i.e., other than a <view>), then: the values for viewbox, preserveaspectratio and zoomandpan within currentview will match the values for the corresponding dom attributes that are on svgsvgelement directly for the closest ancestor <svg> element the values for transform within currentview will be null the viewtarget within currentview will represent the target of the link if the initial view was a link into the svg document fragment using an svg view specification fragment identifier (i.e., #svgview(…)), then: the values for viewbox, preserveaspectratio, zoomandpan, transform and viewtarget within c...
Using server-sent events - Web APIs
ng when problems occur (such as a network timeout or issues pertaining to access control), an error event is generated. you can take action on this programmatically by implementing the onerror callback on the eventsource object: evtsource.onerror = function(err) { console.error("eventsource failed:", err); }; closing event streams by default, if the connection between the client and server closes, the connection is restarted. the connection is terminated with the .close() method. evtsource.close(); event stream format the event stream is a simple stream of text data which must be encoded using utf-8. messages in the event stream are separated by a pair of newline characters. a colon as the first character of a line is in essence a comment, and is ignored. note: the comment line can b...
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
notification object itself. note: trying to create a notification inside the serviceworkerglobalscope using the notification() constructor will throw an error. syntax serviceworkerglobalscope.onnotificationclick = function(notificationevent) { ... ...
ServiceWorkerGlobalScope - Web APIs
es to service workers. the service worker can optionally send a response back via the messageport exposed in event.data.port, corresponding to the controlled page. also available via the serviceworkerglobalscope.onmessage property. notificationclick occurs when a user clicks on a displayed notification. also available via the serviceworkerglobalscope.onnotificationclick property. notificationclose occurs — when a user closes a displayed notification. also available via the serviceworkerglobalscope.onnotificationclose property. push occurs when a server push notification is received. also available via the serviceworkerglobalscope.onpush property. pushsubscriptionchange occurs when a push subscription has been invalidated, or is about to be invalidated (e.g. when a push service set...
Service Worker API - Web APIs
etc. for development purposes. hooks for background services. custom templating based on certain url patterns. performance enhancements, for example pre-fetching resources that the user is likely to need in the near future, such as the next few pictures in a photo album. in the future, service workers will be able to do a number of other useful things for the web platform that will bring it closer towards native app viability. interestingly, other specifications can and will start to make use of the service worker context, for example: background synchronization: start up a service worker even when no users are at the site, so caches can be updated, etc. reacting to push messages: start up a service worker to send users a message to tell them new content is available. reacting to a p...
ShadowRoot - Web APIs
d only returns a boolean that indicates whether delegatesfocus was set when the shadow was attached (see element.attachshadow()). shadowroot.host read only returns a reference to the dom element the shadowroot is attached to. shadowroot.innerhtml sets or returns a reference to the dom tree inside the shadowroot. shadowroot.mode read only the mode of the shadowroot — either open or closed. this defines whether or not the shadow root's internal features are accessible from javascript. properties included from documentorshadowroot the shadowroot interface includes the following properties defined on the documentorshadowroot mixin. note that this is currently only implemented by chrome; other browsers still implement them on the document interface. documentorshadowroot.activee...
SharedWorkerGlobalScope - Web APIs
senting the code to be called when the connect event is raised — that is, when a messageport connection is opened between the associated sharedworker and the main thread. methods this interface inherits methods from the workerglobalscope interface, and its parent eventtarget, and therefore implements methods from windowtimers, windowbase64, and windoweventhandlers. sharedworkerglobalscope.close() discards any tasks queued in the sharedworkerglobalscope's event loop, effectively closing this particular scope. inherited from workerglobalscope workerglobalscope.close() discards any tasks queued in the workerglobalscope's event loop, effectively closing this particular scope. workerglobalscope.dump() allows you to write a message to stdout — i.e. in your terminal. this is the...
Slottable: assignedSlot - Web APIs
the assignedslot read-only property of the slottable interface returns an htmlslotelement representing the <slot> element the node is inserted in. syntax var slotelement = elementinstance.assignedslot value an htmlslotelement instance, or null if the element is not assigned to a slot, or if the associated shadow root was attached with its mode set to closed (see element.attachshadow for further details). examples in our simple-template example (see it live), we create a trivial custom element example called <my-paragraph> in which a shadow root is attached and then populated using the contents of a template that contains a slot named my-text. when <my-paragraph> is used in the document, the slot is populated by a slottable element by including it inside the element with a slot attribute...
SourceBuffer - Web APIs
igation.) var video = document.queryselector('video'); var asseturl = 'frag_bunny.mp4'; // need to be specific for blink regarding codecs // ./mp4info frag_bunny.mp4 | grep codec var mimecodec = 'video/mp4; codecs="avc1.42e01e, mp4a.40.2"'; if ('mediasource' in window && mediasource.istypesupported(mimecodec)) { var mediasource = new mediasource(); //console.log(mediasource.readystate); // closed video.src = url.createobjecturl(mediasource); mediasource.addeventlistener('sourceopen', sourceopen); } else { console.error('unsupported mime type or codec: ', mimecodec); } function sourceopen (_) { //console.log(this.readystate); // open var mediasource = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeven...
Touch() - Web APIs
Web › API › Touch › Touch
ype double, that is the horizontal position of the touch on the client window of user's screen, including any scroll offset. "pagey", optional and defaulting to 0, of type double, that is the vertical position of the touch on the client window of the user's screen, including any scroll offset. "radiusx", optional and defaulting to 0, of type float, that is the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis indicated by rotationangle, in css pixels of the same scale as screenx; 0 if no value is known. the value must not be negative. "radiusy", optional and defaulting to 0, of type float, that is the the radius of the ellipse which most closely circumscribes the touching area (e.g. finger, stylus) along the axis perpendicular to...
TransformStream - Web APIs
his).decoder.ignorebom} } chaining multiple readablestreams together this is a useful one, where multiple streams can be conjoined. examples include building a pwa with progressive loading and progressive streaming. let responses = [ /* conjoined response tree */ ] let {readable, writable} = new transformstream responses.reduce( (a, res, i, arr) => a.then(() => res.pipeto(writable, {preventclose: (i+1) !== arr.length})), promise.resolve() ) note that this is not resilient to other influences. specifications specification status comment streamsthe definition of 'transformstream' in that specification. living standard initial definition ...
USBDevice - Web APIs
Web › API › USBDevice
mise that resolves when a halt condition is cleared. usbdevice.controltransferin() returns a promise that resolves with a usbtransferinresult when a command or status operation has been transmitted to the usb device. usbdevice.controltransferout() returns a promise that resolves with a usbtransferoutresult when a command or status operation has been transmitted from the usb device. usbdevice.close() returns a promise that resolves when all open interfaces are released and the device session has ended. usbdevice.isochronoustransferin() returns a promise that resolves with a usbisochronousintransferresult when time sensitive information has been transmitted to the usb device. usbdevice.isochronoustransferout() returns a promise that resolves with a usbisochronousouttransferresult when t...
UserProximityEvent.near - Web APIs
the near property tell if there is an object close to the device (true) or not (false). syntax var near = userproximityevent.near; value a boolean ...
WebGLRenderingContext.generateMipmap() - Web APIs
it starts with the resolution of the texture image and halves the resolution until a 1x1 dimension texture image is created. ...
Matrix math for the web - Web APIs
[ cos(a), -sin(a), 0, 0, sin(a), cos(a), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; view on jsfiddle here are a set of functions that return rotation matrices for rotating around each of the three axes. one big note is that there is no perspective applied, so it might not feel very 3d yet. the flatness is equivalent to when a camera zooms in really close onto an object in the distance — the sense of perspective disappears. function rotatearoundxaxis(a) { return [ 1, 0, 0, 0, 0, cos(a), -sin(a), 0, 0, sin(a), cos(a), 0, 0, 0, 0, 1 ]; } function rotatearoundyaxis(a) { return [ cos(a), 0, sin(a), 0, 0, 1, 0, 0, -sin(a), 0, cos(a), ...
WebGL: 2D and 3D graphics for the web - Web APIs
Web › API › WebGL API
this conformance makes it possible for the api to take advantage of hardware graphics acceleration provided by the user's device. ...
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. this value resets to zero once all queued data has been sent. this value does not reset to zero when the connection is closed; if you keep calling send(), this will continue to climb. syntax var bufferedamount = awebsocket.bufferedamount; value an unsigned long. specifications specification status comment html living standardthe definition of 'websocket: bufferedamount' in that specification. living standard initial definition ...
WebSocket: error event - Web APIs
the error event is fired when a connection with a websocket has been closed due to an error (some data couldn't be sent for example). bubbles no cancelable no interface event event handler property onerror examples // create websocket connection const socket = new websocket('ws://localhost:8080'); // listen for possible errors socket.addeventlistener('error', function (event) { console.log('websocket error: ', event); }); specifications specification status html living standardthe definition of 'websocket error' in that specification. living standard ...
WebSocket.readyState - Web APIs
socket connection. syntax var readystate = awebsocket.readystate; value one of the following unsigned short values: value state description 0 connecting socket has been created. the connection is not yet open. 1 open the connection is open and ready to communicate. 2 closing the connection is in the process of closing. 3 closed the connection is closed or couldn't be opened. specifications specification status comment html living standardthe definition of 'websocket: readystate' in that specification. living standard initial definition ...
WebSocket.send() - Web APIs
Web › API › WebSocket › send
syntax websocket.send("hello server!"); parameters data the data to send to the server. ...
Writing a WebSocket server in C# - Web APIs
cument.queryselector("#output"), textarea = document.queryselector("textarea"), // wsuri = "ws://echo.websocket.org/", wsuri = "ws://127.0.0.1/", websocket = new websocket(wsuri); button.addeventlistener("click", onclickbutton); websocket.onopen = function (e) { writetoscreen("connected"); dosend("websocket rocks"); }; websocket.onclose = function (e) { writetoscreen("disconnected"); }; websocket.onmessage = function (e) { writetoscreen("<span>response: " + e.data + "</span>"); }; websocket.onerror = function (e) { writetoscreen("<span class=error>error:</span> " + e.data); }; function dosend(message) { writetoscreen("sent: " + message); websocket.send(message); ...
Writing a WebSocket server in Java - Web APIs
0x3)th byte of key example in java: byte[] decoded = new byte[6]; byte[] encoded = new byte[] { (byte) 198, (byte) 131, (byte) 130, (byte) 182, (byte) 194, (byte) 135 }; byte[] key = new byte[] { (byte) 167, (byte) 225, (byte) 225, (byte) 210 }; for (int i = 0; i < encoded.length; i++) { decoded[i] = (byte) (encoded[i] ^ key[i & 0x3]); } } } finally { s.close(); } } finally { server.close(); } } } related writing websocket servers ...
The WebSocket API (WebSockets) - Web APIs
r. with this api, you can send messages to a server and receive event-driven responses without having to poll the server for a reply. note: while a websocket connection is functionally somewhat similar to standard unix-style sockets, they are not related. interfaces websocket the primary interface for connecting to a websocket server and then sending and receiving data on the connection. closeevent the event sent by the websocket object when the connection closes. messageevent the event sent by the websocket object when a message is received from the server. guides writing websocket client applications writing websocket servers writing a websocket server in c# writing a websocket server in java tools humblenet: a cross-platform networking library that works in the brows...
Web Video Text Tracks Format (WebVTT) - Web APIs
own. we can also place comments in our .vtt file, to help us remember important information about the parts of our file. these should be on separate lines, starting with the string note. you'll find more about these in the below section. it is important to not use "extra" blank lines within a cue, for example between the timings line and the cue payload. webvtt is line based; a blank line will close the cue. webvtt comments comments are an optional component that can be used to add information to a webvtt file. comments are intended for those reading the file and are not seen by users. comments may contain newlines but cannot contain a blank line, which is equivalent to two consecutive newlines. a blank line signifies the end of a comment. a comment cannot contain the string "-->", the am...
Using bounded reference spaces - Web APIs
e boundaries. it's also useful because the user may be engrossed in gameplay or other activity, not realize they're approaching the boundary, and could become confused or distressed if they wander out of tracking range (especially if doing so causes them to lose a game). the easiest solution is to just treat the each boundary segment as if it were an object to hit test against. as the user grows close to the boundary, you might warn them by displaying a message, flashing a warning indicator, playing an audio warning, or the like. and if the user actually collides with the boundary, don't let them continue past it. <<<--- example --->>> creating a bounded reference space before creating a project that relies on bounded reference spaces, it's important to keep in mind that not all xr devices ...
Rendering and the WebXR frame animation callback - Web APIs
pare the framebuffer so the browser can paint the next frame of your scene, the function you provided to requestanimationframe() is invoked. it receives as input the time at which the frame being drawn and an xrframe object providing details about the state of the scene for the frame you need to render. ideally, you want this code to be fast enough that it can maintain a 60 fps frame rate, or as close to that as possible, remembering that there's more going on than just your code in this one function. you need to make sure that the main thread doesn't need to run for more time per frame than the duration of the frame itself. a basic renderer in this version of the webxr renderering callback, we use a very straightforward approach that works great for relatively simple projects. this pseudoco...
Starting up and shutting down a WebXR session - Web APIs
loves and other feedback devices. when the user connects or disconnects a webxr controller device, the inputsourceschange event is dispatched to the xrsession. this is an opportunity to notify the user of the device's availability, begin to monitor it for inputs, offer configuration options, or whatever you need to do with it. ending the webxr session when the user's vr or ar session draws to a close, the session ends. the shutdown of an xrsession can happen either due to the session itself deciding it's time to shut down (such as if the user turns off their xr device), because the user has clicked a button to end the session, or some other situation as appropriate for your application. here we discuss both how to request a shutdown of the webxr session and how to detect when the session has...
Using the Web Animations API - Web APIs
...
Web Animations API Concepts - Web APIs
r time—animation. the timing model keeps track of how far along a set timeline we've come. the animation model determines what the animated object should look like at any given time. timing the timing model is the backbone of working with the waapi. each document has a master timeline, document.timeline, which stretches from the moment the page is loaded to infinity — or until the window is closed. spread along that timeline according to their durations are our animations. each animation is anchored to a point in the timeline by its starttime, representing the moment along the document’s timeline when the animation starts playing. all the animation's playback relies on this timeline: seeking the animation moves the animation’s position along the timeline; slowing down or speeding up ...
Web Audio API best practices - Web APIs
ted event, normally a click event. browser vendors decided that web audio contexts should not be allowed to automatically play audio; they should instead be started by a user. this is because autoplaying audio can be really annoying and obtrusive. but how do we handle this? when you create an audio context (either offline or online) it is created with a state, which can be suspended, running, or closed. when working with an audiocontext, if you create the audio context from inside a click event the state should automatically be set to running. here is a simple example of creating the context from inside a click event: const button = document.queryselector('button'); button.addeventlistener('click', function() { const audioctx = new audiocontext(); }, false); if however, you create the ...
Using the Web Storage API - Web APIs
t the pitfalls associated with using plain objects as key-value stores. the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores). localstorage does the same thing, but persists even when the browser is closed and reopened. these mechanisms are available via the window.sessionstorage and window.localstorage properties (to be more precise, in supporting browsers the window object implements the windowlocalstorage and windowsessionstorage objects, which the localstorage and sessionstorage properties are members of) — invoking one of these will create an instance of the storage object, through which ...
Web Storage API - Web APIs
sing cookies. web storage concepts and usage the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores) stores data only for a session, meaning that the data is stored until the browser (or tab) is closed. data is never transferred to the server. storage limit is larger than a cookie (at most 5mb). localstorage does the same thing, but persists even when the browser is closed and reopened. stores data with no expiration date, and gets cleared only through javascript, or clearing the browser cache / locally stored data. storage limit is the maximum amongst the three. th...
Functions and classes available to Web Workers - Web APIs
unknown no postmessage() yes, on dedicatedworkerglobalscope no no unknown no apis available in workers function functionality support in gecko (firefox) support in ie support in blink (chrome and opera) support in webkit (safari) broadcast ch...
Window: afterprint event - Web APIs
the afterprint event is fired after the associated document has started printing or the print preview has been closed. bubbles no cancelable no interface event event handler property onafterprint examples using addeventlistener(): window.addeventlistener('afterprint', (event) => { console.log('after print'); }); using the onafterprint event handler property: window.onafterprint = (event) => { console.log('after print'); }; specifications specification status html living standard living standard ...
Window.alert() - Web APIs
Web › API › Window › alert
both produce: notes the alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message. the following text is shared between this article, dom:window.prompt and dom:window.confirm dialog boxes are modal windows - they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). specification specification status comment html living standardthe definition of 'alert()' in that specification. living standard ...
Window.confirm() - Web APIs
Web › API › Window › confirm
he returned value is always false. example if (window.confirm("do you really want to leave?")) { window.open("exit.html", "thanks for visiting!"); } produces: notes the following text is shared between this article, dom:window.prompt and dom:window.alert dialog boxes are modal windows — they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). regardless, there are good reasons to avoid using dialog boxes for confirmation. specification specification status comment html living standardthe definition of 'confirm()' in that specification. living standard ...
Window.history - Web APIs
Web › API › Window › history
ble via the history object, in the browser's dropdowns next to the back and forward buttons. for security reasons the history object doesn't allow the non-privileged code to access the urls of other pages in the session history, but it does allow it to navigate the session history. there is no way to clear the session history or to disable the back/forward navigation from unprivileged code. the closest available solution is the location.replace() method, which replaces the current item of the session history with the provided url. specifications specification status comment html living standardthe definition of 'the history interface' in that specification. living standard html5the definition of 'the history interface' in that specification. recomm...
Window.innerHeight - Web APIs
nnerheight and innerwidth are available on any window or any object that behaves like a window, such as a tab or frame. example assuming a frameset var intframeheight = window.innerheight; // or var intframeheight = self.innerheight; // will return the height of the frame viewport within the frameset var intframesetheight = parent.innerheight; // will return the height of the viewport of the closest frameset var intouterframesetheight = top.innerheight; // will return the height of the viewport of the outermost frameset fixme: link to an interactive demo here to change the size of a window, see window.resizeby() and window.resizeto(). to get the outer height of a window, i.e. the height of the whole browser window, see window.outerheight. graphical example the following figure shows...
Window.innerWidth - Web APIs
Web › API › Window › innerWidth
lientwidth property instead. the innerwidth property is available on any window or object that behaves like a window, such as a frame or tab. example // this will return the width of the viewport var intframewidth = window.innerwidth; // this will return the width of the frame viewport within a frameset var intframewidth = self.innerwidth; // this will return the width of the viewport of the closest frameset var intframesetwidth = parent.innerwidth; // this will return the width of the viewport of the outermost frameset var intouterframesetwidth = top.innerwidth; specification specification status comment css object model (cssom) view modulethe definition of 'window.innerwidth' in that specification. working draft initial definition ...
Window.localStorage - Web APIs
the read-only localstorage property allows you to access a storage object for the document's origin; the stored data is saved across browser sessions. localstorage is similar to sessionstorage, except that while data stored in localstorage has no expiration time, data stored in sessionstorage gets cleared when the page session ends — that is, when the page is closed. (data in a localstorage object created in a "private browsing" or "incognito" session is cleared when the last "private" tab is closed.) data stored in either localstorage is specific to the protocol of the page. in particular, data stored by a script on a site accessed with http (e.g., http://example.com) is put in a different localstorage object from the same site accessed with https (e.g., https://example.com). the keys and...
Window.ondeviceproximity - Web APIs
the ondeviceproximity property of the window interface specifies an eventhandler to receive deviceproximity events. these events occur when the device sensor detects that an object becomes closer to or farther from the device. syntax window.onuserproximity = funcref where funcref is a function to be called when the deviceproximity event occurs. these events are of type deviceproximityevent. ...
window.postMessage() - Web APIs
used to transmit a password, it would be absolutely critical that this argument be a uri whose origin is the same as the intended receiver of the message containing the password, to prevent interception of the password by a malicious third party. always provide a specific targetorigin, not *, if you know where the other window's document should be located. failing to provide a specific target discloses the data you send to any interested malicious site. transfer optional is a sequence of transferable objects that are transferred with the message. the ownership of these objects is given to the destination side and they are no longer usable on the sending side. the dispatched event otherwindow can listen for dispatched messages by executing the following javascript: window.addeventlistener...
Window.prompt() - Web APIs
Web › API › Window › prompt
e on os x): notes a prompt dialog contains a single-line textbox, a cancel button, and an ok button, and returns the (possibly empty) text the user entered into that textbox. the following text is shared between this article, dom:window.confirm and dom:window.alert dialog boxes are modal windows; they prevent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). please note that result is a string. that means you should sometimes cast the value given by the user. for example, if their answer should be a number, you should cast the value to number. const anumber = number(window.prompt("type a number", "")); specification specification status...
WindowClient.focus() - Web APIs
existing windowclient. syntax windowclient.focus().then(function(windowclient) { // do something with your windowclient once it has been focused }); parameters none. return value a promise that resolves to the existing windowclient. ...
WindowClient.focused - Web APIs
the focused read-only property of the windowclient interface is a boolean that indicates whether the current client has focus. syntax var myfocused = windowclient.focused; value a boolean. ...
WindowClient - Web APIs
lient.focused read only a boolean that indicates whether the current client has focus. windowclient.visibilitystate read only indicates the visibility of the current client. this value can be one of "hidden", "visible", or "prerender". ...
WritableStream.abort() - Web APIs
mise = writablestream.abort(reason); parameters reason a domstring providing a human-readable reason for the abort. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to abort is not a writablestream, or it is locked. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... // abort the stream later on, when required writablestream.abort(); specifications specification status comment streamsthe definition of 'abort()' in that specification. living standard initial definition. ...
WritableStream.locked - Web APIs
the locked read-only property of the writablestream interface returns a boolean indicating whether the writablestream is locked to a writer. syntax var locked = writablestream.locked; value a boolean indicating whether or not the writable stream is locked. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); writablestream.locked // should return true, as the stream has been locked to a writer specifications specification status comment streamsthe definition of 'locked' in that specification. living standard initial definition. ...
WritableStreamDefaultController.error() - Web APIs
error you want future interactions to fail with. return value undefined. exceptions typeerror the stream you are trying to error is not a writablestream. examples const writablestream = new writablestream({ start(controller) { // do stuff with controller // error stream if necessary controller.error('my error is broken'); }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }); specifications specification status comment streamsthe definition of 'error()' in that specification. living standard initial definition. ...
WritableStreamDefaultController - Web APIs
eam construction. properties none. methods writablestreamdefaultcontroller.error() causes any future interactions with the associated stream to error. examples const writablestream = new writablestream({ start(controller) { // do stuff with controller // error stream if necessary controller.error('my stream is broken'); }, write(chunk, controller) { ... }, close(controller) { ... }, abort(err) { ... } }); specifications specification status comment streamsthe definition of 'writablestreamdefaultcontroller' in that specification. living standard initial definition. ...
WritableStreamDefaultWriter.abort() - Web APIs
ultwriter.abort(reason); parameters reason optional a domstring representing a human-readable reason for the abort. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the stream you are trying to abort is not a writablestream, or it is locked. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); ... // abort the stream when desired writer.abort.then((reason) => { console.log(reason); }) specifications specification status comment streamsthe definition of 'abort()' in that specification. living standard initial definition. ...
WritableStreamDefaultWriter.desiredSize - Web APIs
defaultwriter interface returns the desired size required to fill the stream's internal queue. syntax var desiredsize = writablestreamdefaultwriter.desiredsize; value an integer. note that this can be negative if the queue is over-full. the value will be null if the stream cannot be successfully written to (due to either being errored, or having an abort queued up), and zero if the stream is closed. exceptions typeerror the writer’s lock is released. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); ... // return stream's desired size let size = writer.desiredsize; specifications specification status comment ...
WritableStreamDefaultWriter.releaseLock() - Web APIs
the releaselock() method of the writablestreamdefaultwriter interface releases the writer's lock on the corresponding stream. after the lock is released, the writer is no longer active. if the associated stream is errored when the lock is released, the writer will appear errored in the same way from now on; otherwise, the writer will appear closed. syntax writablestreamdefaultwritere.releaselock() parameters none. return value undefined. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); ... // release writer's lock on the stream when desired writer.releaselock(); specifications specification status comment ...
XRRenderState - Web APIs
om the viewer. the far clip plane is the plane which is parallel to the display beyond which rendering of the scene no longer takes place. this, essentially, specifies the maximum distance the user can see. depthnear read only the distance, in meters, of the near clip plane from the viewer. the near clip plane is the plane, parallel to the display, at which rendering of the scene begins. any closer to the viewer than this, and no portions of the scene are drawn. inlineverticalfieldofview read only the default vertical field of view, defined in radians, to use when the session is in inline mode. null for all immersive sessions. specifications specification status comment webxr device apithe definition of 'xrrenderstate' in that specification. working d...
XRSession - Web APIs
Web › API › XRSession
reality module, which has not been completed. inputsources read only returns a list of this session's xrinputsources, each representing an input device used to control the camera and/or scene. renderstate read only an xrrenderstate object which contains options affecting how the imagery is rendered. this includes things such as the near and far clipping planes (distances defining how close and how far away objects can be and still get rendered), as well as field of view information. visibilitystate read only a domstring whose value is one of those found in the xrvisibilitystate enumerated type, indicating whether or not the session's imagery is visible to the user, and if so, if it's being visible but not currently the target for user events. methods xrsession provides the f...
XRView - Web APIs
Web › API › XRView
a 3d world. properties eye read only which of the two eyes (left) or (right) for which this xrview represents the perspective. this value is used to ensure that any content which is pre-rendered for presenting to a specific eye is distributed or positioned correctly. the value can also be none if the xrview is presenting monoscopic data (such as a 2d image, a full-screen view of text. or a close-up view of something that doesn't need to appear in 3d). projectionmatrix read only the projection matrix that will transform the scene to appear correctly given the point-of-view indicated by eye. this matrix should be used directly in order to avoid presentation distortions that may lead to potentially serious user discomfort. transform read only an xrrigidtransform which describes the cu...
Web APIs
Web › API
ssstylesheet cssstylevalue csssupportsrule cssunitvalue cssunparsedvalue cssvalue cssvaluelist cssvariablereferencevalue cache cachestorage canvascapturemediastreamtrack canvasgradient canvasimagesource canvaspattern canvasrenderingcontext2d caretposition channelmergernode channelsplitternode characterdata childnode client clients clipboard clipboardevent clipboarditem closeevent comment compositionevent constantsourcenode constrainboolean constraindomstring constraindouble constrainulong contentindex contentindexevent convolvernode countqueuingstrategy crashreportbody credential credentialscontainer crypto cryptokey cryptokeypair customelementregistry customevent d domconfiguration domerror domexception domhighrestimestamp domimplementation domimpleme...
Using the alertdialog role - Accessibility
en an accessible name (through aria-labelledby or aria-label) , and in most cases the alert text will have to be marked up as the alert dialog's accessible description (using aria-describedby). unlike regular alerts, an alert dialog must have at least one focusable control and focus must be moved to that control when the alert dialog appears. generally alert dialogs have at least a confirmation, close or cancel button that can be used to move focus to. additionally, alert dialogs can have other interactive controls such as text fields, tabs or checkboxes. which particular control focus should be moved to depends on the purpose of the dialog. the tab order inside the alert dialog must wrap. the difference with regular dialogs is that the alertdialog role should only used when an alert, error...
Using the aria-label attribute - Accessibility
mited to elements that have an aria role assigned. value string possible effects on user agents and assistive technology note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: multiple labels in the example below, a button is styled to look like a typical "close" button, with an x in the middle. since there is nothing indicating that the purpose of the button is to close the dialog, the aria-label attribute is used to provide the label to any assistive technologies. <button aria-label="close" onclick="mydialog.close()">x</button> notes the most common accessibility api mapping for a label is the accessible name property. attributes, including ar...
ARIA: alert role - Accessibility
description one of the five live region roles, the alert role is used to provide the user with important, and usually time-sensitive, information, and often to tell the user an element has been dynamically updated. ...
ARIA: article role - Accessibility
fic use cases. if an article is part of a feed, it can have the aria-posinset and aria-setsize attributes set to indicate which position within the feed this particular article represents. inside an application or other widget that causes screen readers and other assistive technologies to be in pass-through mode, an article can be used to indicate that these should switch back to treating the enclosed content as regular web content. instead of including the article role on a non-semantic element, the <article> element should be used. user agents translate this to the appropriate accessibility information just like the article role. using the <article> element also helps search engines better discover the structure of a page. examples of appropriate uses of the role="article", or preferably <...
ARIA: document role - Accessibility
or applications, the document role can inform assistive technologies to switch context to a reading mode: the document role tells assistive technologies with reading or browse modes to use the document mode to read the content contained within this element. <div role="dialog"> ... <div id="infotext" role="document" tabindex="0"> <p>some informational text goes here.</p> </div> ... <button>close</button> </div> this example shows a dialog widget with some controls and a section with some informational text that the assistive technology user can read when tabbing to it. description by default, web pages are treated as documents; assistive technologies (at) enter browse or read mode when entering a new web page. this mode can be altered through various roles, including the widget and a...
ARIA: button role - Accessibility
e appropriate, so the the aria-pressed attribute would be omitted. keyboard interactions key function enter activates the button. space activates the button following button activation, focus is set depending on the type of action the button performs. for example, if clicking the button opens a dialog, the focus should move to the dialog. if the button closes a dialog, focus should returns to the button that opened the dialog unless the function performed in the dialog context logically leads to a different element. if the button alters the current context, then focus typically remains on the button, such as muting and unmuting an audio file. required javascript features required event handlers buttons can be operated by mouse, touch, and keyboard...
WAI-ARIA Roles - Accessibility
this page lists reference pages covering all the wai-aria roles discussed on mdn. for a full list of roles, see using aria: roles, states, and properties aria: alert rolethe alert role can be used to tell the user an element has been dynamically updated. screen readers will instantly start reading out the updated content when the role is added. if the user is expected to close the alert, then the alertdialog role should be used instead.aria: application rolethe application role indicates to assistive technologies that an element and all of its children should be treated similar to a desktop application, and no traditional html interpretation techniques should be used. this role should only be used to define very dynamic and desktop-like web applications.aria: article rolethe article ro...
Cognitive accessibility - Accessibility
e, also provide things like icons and colors. also, provide feedback on when there is a successful form submission. provide instructions for user input start the form with text instructions on how to operate it. include labels or instructions when users need to input information, using the <label>, <fieldset>, and <legend> elements to do so. labels should be descriptive and positioned close to the input they relate to. when requiring a specific format for input, provide an example formatted in the proper way. additionally, consider performing server-side validation to help format input data, to aid in the ease of user input. if a form control is required, indicate it both visually and via code. if a form control changes context, describe what will happen in a way that the user will...
HTML To MSAA - Accessibility
_ selectionadd if selected event_object_ selectionremove if unselected select @size > 1 role_system_ list n/a n/a state_system_ multiselectable if multiselectable n/a n/a n/a select @size = 1 role_system_ combobox n/a name of focused option state_system_ expanded if combobox open state_system_ collapsed if combobox is collapsed state_system_ haspopup state_system_ focusable n/a "open"/"close" depending on state event_object_ valuechange when selected option is changed table role_system_ table from @summary attribute n/a described_by (0x100e) points to caption element n/a n/a td, th role_system_ cell n/a n/a n/a n/a n/a n/a thead role_system_ columnheader n/a n/a n/a n/a n/a n/a abbr, acronym, blockquote, form, frame, h1-h6, iframe bstr role n/a n/a n/a n/a n/a n...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
tion for quirkiness. it is not "plug and play", and will take a lot of testing/refinement before your solution works with any product. here are some of it's quirks and some solutions/workarounds: msaa can be crash prone problem: many of msaa's crash occur because more than one process is refcounting the same objects, and because pointers are being shared between processes. when your application closes, different signals are typically broadcast. for example, the application window closes and the window is blurred. it is impossible to know if and when the 3rd party assistive technology will use one of these signals to release the objects of yours that is is refcounting. this can lead to crashes where it releases something and the wrong time, when some of your dll's are unloaded but not others, ...
Accessibility documentation index - Accessibility
ould be used on an element that wraps an element with an insertion role, and one with a deletion role. 51 aria: alert role aria, aria role, aria alert, aria widget, reference the alert role can be used to tell the user an element has been dynamically updated. screen readers will instantly start reading out the updated content when the role is added. if the user is expected to close the alert, then the alertdialog role should be used instead. 52 aria: application role aria, aria role, aria widget, reference, role application the application role indicates to assistive technologies that an element and all of its children should be treated similar to a desktop application, and no traditional html interpretation techniques should be used. this role should o...
Web Accessibility: Understanding Colors and Luminance - Accessibility
0000 also has a saturation of 100%. not all saturated reds may be represented well in the rgb spectrum, or other spectrums commonly used in web development. according to wikipedia's page on "shades of red", the color "carmine" is a saturated red in which, in its pigment form, mostly contains the red light with wavelengths longer than 600nm; the article makes the special note that "carmine" is close to the extreme spectrum. this places it far beyond standard gamuts (both rgb and cmyk), and its given rgb value is a poor approximation only." saturated red flashing: in addition to a red environment affecting the cognitive function of those with traumatic brain injury, color in the red spectrum wavelength requires special attention and tests. dr. gregg vanderheiden, when testing the photosens...
Operable - Accessibility
build in custom functionality where needed. see ui controls and building keyboard accessibility back in 2.1.2 no keyboard trap (a) when entering a section of functionality using the keyboard, you should be able to get out of that section again using *only* the keyboard. for example, if you press enter/return on a focused button to open an options window, you should be able to close that window again and return to the main content using the keyboard. this is very important so that keyboard users do not get trapped on specific sections of your apps. 2.1.3 keyboard — all functionality (aaa) this is a further step beyond criterion 2.1.1. to achieve aaa conformance, all functionality should be accessible using keyboard controls — with no exceptions. ...
-webkit-box-reflect - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
element, but only when not preceded by other content (such as images or inline tables). /* selects the first letter of a <p> */ p::first-letter { font-size: 130%; } the first letter of an element is not always trivial to identify: punctuation that precedes or immediately follows the first letter is included in the match. punctuation includes any unicode character defined in the open (ps), close (pe), initial quote (pi), final quote (pf), and other punctuation (po) classes. some languages have digraphs that are always capitalized together, like the ij in dutch. in these cases, both letters of the digraph should be matched by the ::first-letter pseudo-element. (this is poorly supported by browsers; see the browser compatibility table below.) a combination of the ::before pseudo-element ...
::placeholder - CSS: Cascading Style Sheets
placeholder text with sufficient color contrast may be interpreted as entered input. placeholder text will also disappear when a person enters content into an <input> element. both of these circumstances can interfere with successful form completion, especially for people with cognitive concerns. an alternate approach to providing placeholder information is to include it outside of the input in close visual proximity, then use aria-describedby to programmatically associate the <input> with its hint. with this implementation, the hint content is available even if information is entered into the input field, and the input appears free of preexisting input when the page is loaded. most screen reading technology will use aria-describedby to read the hint after the input's label text is announced...
:scope - CSS: Cascading Style Sheets
Web › CSS › :scope
seudo-class represents elements that are a reference point for selectors to match against. /* selects a scoped element */ :scope { background-color: lime; } currently, when used in a stylesheet, :scope is the same as :root, since there is not at this time a way to explicitly establish a scoped element. when used from a dom api such as queryselector(), queryselectorall(), matches(), or element.closest(), :scope matches the element on which the method was called. syntax :scope examples identity match in this simple example, we demonstrate that using the :scope pseudo-class from the element.matches() method matches the element on which it's called. javascript let paragraph = document.getelementbyid("para"); let output = document.getelementbyid("output"); if (paragraph.matches(":scope")...
additive-symbols - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
negative - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
pad - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
prefix - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
suffix - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
symbols - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
system - CSS: Cascading Style Sheets
html <ul class="list"> <li>one</li> <li>two</li> <li>three</li> <li>four</li> <li>five</li> </ul> css @counter-style alpha-modified { system: extends lower-alpha; prefix: "("; suffix: ") "; } ul { list-style: alpha-modified; } result specifications specification status comment css counter ...
@document - CSS: Cascading Style Sheets
Web › CSS › @document
which matches if the document url is on the domain provided (or a subdomain of it). media-document(), with the parameter of video, image, plugin or all. regexp(), which matches if the document url is matched by the regular expression provided. the expression must match the entire url. the values provided to the url(), url-prefix(), domain(), and media-document() functions can be optionally enclosed by single or double quotes. the values provided to the regexp() function must be enclosed in quotes. escaped values provided to the regexp() function must additionally be escaped from the css. for example, a . (period) matches any character in regular expressions. to match a literal period, you would first need to escape it using regular expression rules (to \.), then escape that string using c...
font-stretch - CSS: Cascading Style Sheets
normal 100% semi-expanded 112.5% expanded 125% extra-expanded 150% ultra-expanded 200% variable fonts most fonts have a particular width which corresponds to one of the keyterm values. however some fonts, called variable fonts, can support a range of stretching with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. for this, percentage ranges are useful. for truetype or opentype variable fonts, the "wdth" variation is used to implement varying glyph widths. accessibility concerns people with dyslexia and other cognitive conditions may have difficulty reading fonts that are too condensed, especially if the font has a low contrast color ratio. mdn understanding...
src - CSS: Cascading Style Sheets
Web › CSS › @font-face › src
at denote well-known font formats. if a user agent doesn't support the specified formats, it skips downloading the font resource. if no format hints are supplied, the font resource is always downloaded. <font-face-name> specifies the name of a locally-installed font face using the local() function, which uniquely identifies a single font face within a larger family. the name can optionally be enclosed in quotes. description the value of this descriptor is a prioritized, comma-separated list of external references or locally-installed font face names. when a font is needed the user agent iterates over the set of references listed using the first one it can successfully activate. fonts containing invalid data or local font faces that are not found are ignored and the user agent loads the nex...
max-height - CSS: Cascading Style Sheets
syntax /* keyword value */ max-height: auto; /* <length> values */ max-height: 400px; max-height: 50em; max-height: 20cm; /* <percentage> value */ max-height: 75%; values auto the used value is calculated from the other css descriptors' values. <length> a non-negative absolute or relative length. ...
max-width - CSS: Cascading Style Sheets
syntax /* keyword value */ max-width: auto; /* <length> values */ max-width: 600px; max-width: 80em; max-width: 15cm; /* <percentage> value */ max-width: 75%; values auto the used value is calculated from the other css descriptors' values. <length> a non-negative absolute or relative length. ...
min-height - CSS: Cascading Style Sheets
syntax /* keyword value */ min-height: auto; /* <length> values */ min-height: 120px; min-height: 20em; min-height: 10cm; /* <percentage> value */ min-height: 25%; values auto the used value is calculated from the other css descriptors' values. <length> a non-negative absolute or relative length. ...
min-width - CSS: Cascading Style Sheets
syntax /* keyword value */ min-width: auto; /* <length> values */ min-width: 320px; min-width: 40em; min-width: 5cm; /* <percentage> value */ min-width: 25%; values auto the used value is calculated from the other css descriptors' values. <length> a non-negative absolute or relative length. ...
Using CSS animations - CSS: Cascading Style Sheets
determine which kind of animation event occurred, then adds an appropriate note to the <ul> (unordered list) we’re using to log these events. the output, when all is said and done, looks something like this: started: elapsed time is 0 new loop started at time 3.01200008392334 new loop started at time 6.00600004196167 ended: elapsed time is 9.234000205993652 note that the times are very close to, but not exactly, those expected given the timing established when the animation was configured. note also that after the final iteration of the animation, the animationiteration event isn’t sent; instead, the animationend event is sent. the html just for the sake of completeness, here’s the html that displays the page content, including the list into which the script inserts information...
Color picker tool - CSS: Cascading Style Sheets
ant; } #canvas .sample .resize-handle { display: none; } #canvas .sample .pick { width: 10px; height: 10px; margin: 5px; background: url('https://mdn.mozillademos.org/files/6079/pick.png') center no-repeat; position: absolute; top: 0; left: 0; display: none; } #canvas .sample .delete { width: 10px; height: 10px; margin: 5px; background: url('https://mdn.mozillademos.org/files/6069/close.png') center no-repeat; position: absolute; top: 0; right: 0; display: none; } /** * canvas controls */ #canvas .toggle-bg { width: 16px; height: 16px; margin: 5px; background: url("images/canvas-controls.png") center left no-repeat; position: absolute; top: 0; right: 0; } #canvas .toggle-bg:hover { cursor: pointer; } #canvas[data-bg='true'] { background: none; } #canvas[data...
CSS Multi-column Layout - CSS: Cascading Style Sheets
column to column, gap sizes between columns, and column dividing lines (known as column rules) along with their appearance. basic example in the following example the column-count property has been applied to the element with a class of container. as the value of column-count is 3, the content is arranged into 3 columns of equal size. relationship to fragmentation multiple-column layout is closely related to paged media, in that each column box becomes a fragment, much like a printed page becomes a fragment of an overall document. therefore the properties now defined in the css fragmentation specification are required in order to control how content breaks between columns. reference multiple-column layout properties column-count column-fill column-gap column-rule column-rule-c...
Variable fonts guide - CSS: Cascading Style Sheets
width width (represented by the wdth tag) defines the design axis of how narrow or wide (condensed or extended, in typographic terms) the letterforms can be. this is typically set in css using the font-stretch property, with values expressed as a percentage above or below ‘normal’ (100%), any number greater than 0 is technically valid—though it is far more likely that the range would fall closer to the 100% mark, such as 75%-125%. if a number value supplied is outside the range encoded in the font, the browser should render the font at the closest value allowed. note: the % symbol is not used when utilizing font-variation-settings. font-stretch: 115%; font-variation-settings: 'wdth' 115; the following live example's css can be edited to allow you to play with font width values. ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
tems. these are created if you have a string of text inside your grid container, that is not wrapped in any other element. in the example below we have three grid items, assuming you had set the parent with a class of grid to display: grid. the first is an anonymous item as it has no enclosing markup, this item will always be dealt with via the auto-placement rules. the other two are grid items enclosed in a div, they might be auto-placed or you could place these with a positioning method onto your grid. <div class="grid"> i am a string and will become an anonymous item <div>a grid item</div> <div>a grid item</div> </div> anonymous items are always auto-placed because there is no way to target them. therefore if you have some unwrapped text for some reason in your grid, be aware that i...
Grid template areas - CSS: Cascading Style Sheets
see very quickly why we sometimes call this the ascii-art method of grid layout! naming a grid area you have already encountered the grid-area property. this is the property that can take as a value all four of the lines used to position a grid area. .box1 { grid-area: 1 / 1 / 4 / 2; } what we are doing here when defining all four lines, is defining the area by specifying the lines that enclose that area. we can also define an area by giving it a name and then specify the location of that area in the value of the grid-template-areas property. you can choose what you would like to name your area. for example, if i wish to create the layout shown below i can identify four main areas. a header a footer a sidebar the main content with the grid-area property i can assign each of...
Subgrid - CSS: Cascading Style Sheets
ur grid and then position items based on those names rather than the line number. the line names on the parent grid are passed into the subgrid, and you can place items using them. in the below example i have named lines on the parent col-start and col-end and then used those to place the subitem. you can also specify line names on the subgrid. this is achieved by adding a list of line names enclosed in square brackets after the subgrid keyword. if you have four lines in your subgrid, to name them all you could use the syntax grid-template-columns: subgrid [line1] [line2] [line3] [line4] lines specified on the subgrid are added to any lines specified on the parent so you can use either or both. to demonstrate this, i have positioned one item in the example below using the parent lines, and ...
Using z-index - CSS: Cascading Style Sheets
sents the position of the element along the z-axis. if you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a number. layers are rendered in numerical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... top layer (closest to the observer) notes: when no z-index property is specified, elements are rendered on the default rendering layer 0 (zero). if several elements share the same z-index value (i.e., they are placed on the same layer), stacking rules explained in the section stacking without the z-index property apply. in the following example, the layers' stacking order is rearranged using z-index. th...
Understanding CSS z-index - CSS: Cascading Style Sheets
one on top of the other. z-axis positions are particularly relevant when boxes overlap visually. (from css 2.1 section 9.9.1 - layered presentation) this means that css style rules allow you to position boxes on layers in addition to the normal rendering layer (layer 0). the z position of each layer is expressed as an integer representing the stacking order for rendering. greater numbers mean closer to the observer. z position can be controlled with the css z-index property. using z-index appears extremely easy: a single property, assigned a single integer number, with an easy-to-understand behaviour. however, when z-index is applied to complex hierarchies of html elements, its behaviour can be hard to understand or predict. this is due to complex stacking rules. in fact a dedicated sectio...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
cause problems if the content is larger than you expect — users may find themselves in the frustrating position of never being able to scroll and view a certain point in the content. therefore, use of mandatory should be carefully considered and only used in situations where you know how much content is on the screen at any one time. the proximity value will only snap to a position when it is close by, the exact distance being left to the browser to decide. in the example below you can change the value between mandatory and proximity to see the effect this has on the scroll experience. using scroll-snap-align the scroll-snap-align property can take a value of start, end, or center — indicating the point the content should snap to in the scroll container. in the below example you can c...
Comments - CSS: Cascading Style Sheets
Web › CSS › Comments
th single and multiline comments. there is no other way to specify comments in external style sheets. however, when using the <style> element, you may use <!-- --> to hide css from older browsers, although this is not recommended. as with most programming languages that use the /* */ comment syntax, comments cannot be nested. in other words, the first instance of */ that follows an instance of /* closes the comment. specifications css 2.1 syntax and basic data types #comments ...
Mozilla CSS extensions - CSS: Cascading Style Sheets
tbox menuarrow menucheckbox menuimage menuitem menuitemtext menulist menulist-button menulist-text menulist-textfield menupopup menuradio menuseparator -moz-mac-unified-toolbar -moz-win-borderless-glass -moz-win-browsertabbar-toolbox -moz-win-communications-toolbox -moz-win-glass -moz-win-media-toolbox -moz-window-button-box -moz-window-button-box-maximized -moz-window-button-close -moz-window-button-maximize -moz-window-button-minimize -moz-window-button-restore -moz-window-titlebar -moz-window-titlebar-maximized progressbar progresschunk radio radio-container radio-label radiomenuitem resizer resizerpanel scale-horizontal scalethumb-horizontal scalethumb-vertical scale-vertical scrollbarbutton-down scrollbarbutton-left scrollbarbutton-right scrollbarb...
Value definition syntax - CSS: Cascading Style Sheets
called non-terminal data types, are also surrounded by '<' and '>'. non-terminal data types are of two kinds: data types sharing the same name of a property, put between quotes. in this case, the data type shares the same set of values as the property. they are often used in the definition of shorthand properties. data type not sharing the same name of a property. these data types are very close to the basic data types. they only differ from the basic data types in the physical location of their definition. in this case, the definition is usually physically very close to the definition of the property using them. component value combinators brackets brackets enclose several entities, combinators, and multipliers, then transform them as a single component. they are used to group compo...
WebKit CSS extensions - CSS: Cascading Style Sheets
ols ::-webkit-media-controls-current-time-display ::-webkit-media-controls-enclosure ::-webkit-media-controls-fullscreen-button ::-webkit-media-controls-mute-button ::-webkit-media-controls-overlay-enclosure ::-webkit-media-controls-panel ::-webkit-media-controls-play-button ::-webkit-media-controls-timeline ::-webkit-media-controls-time-remaining-display ::-webkit-media-controls-toggle-closed-captions-button ::-webkit-media-controls-volume-control-container ::-webkit-media-controls-volume-control-hover-background ::-webkit-media-controls-volume-slider ::-webkit-meter-bar ::-webkit-meter-even-less-good-value ::-webkit-meter-inner-element ::-webkit-meter-optimum-value ::-webkit-meter-suboptimum-value -webkit-media-text-track-container ::-webkit-outer-spin-button ::-webkit-pr...
animation-timing-function - CSS: Cascading Style Sheets
ents, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-posit...
animation - CSS: Cascading Style Sheets
Web › CSS › animation
imation-direction> = normal | reverse | alternate | alternate-reverse<single-animation-fill-mode> = none | forwards | backwards | both<single-animation-play-state> = running | paused<keyframes-name> = <custom-ident> | <string>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-posit...
background - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
border-image-source - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
clip-path - CSS: Cascading Style Sheets
Web › CSS › clip-path
<'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? )<ellipse()> = ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )<polygon()> = polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )<path()> = path( [ <fill-rule>, ]? <string> )<shape-box> = <box> | margin-boxwhere <length-percentage> = <length> | <percentage><shape-radius> = <length-percentage> | closest-side | farthest-side<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<fill-rule> = nonzero | evenodd<box> = border-box | padding-box | content-box examples comparison of html and svg <sv...
cross-fade() - CSS: Cascading Style Sheets
[ at <position> ]? , <color-stop-list> )<conic-gradient()> = conic-gradient( [ from <angle> ]? [ at <position> ]?, <angular-color-stop-list> )<alpha-value> = <number> | <percentage><hue> = <number> | <angle>where <side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
<custom-ident> - CSS: Cascading Style Sheets
gana, hiragana-iroha, japanese-formal, japanese-informal, kannada, katakana, katakana-iroha, khmer, korean-hangul-formal, korean-hanja-formal, korean-hanja-informal, lao, lower-armenian, malayalam, mongolian, myanmar, oriya, persian, simp-chinese-formal, simp-chinese-informal, tamil, telugu, thai, tibetan, trad-chinese-formal, trad-chinese-informal, upper-armenian, disclosure-open, and disclosure-close. grid-row-start grid-row-end grid-column-start grid-column-end forbids the span value. will-change forbids the global css values (unset, initial, and inherit), as well as the values will-change, auto, scroll-position, and contents. examples valid identifiers nono79 a mix of alphanumeric characters and numbers ground-level a mix of alphanumeric characters and a dash -tes...
<easing-function> - CSS: Cascading Style Sheets
...
font-style - CSS: Cascading Style Sheets
ts a font that is classified as oblique. if no oblique version of the face is available, one classified as italic is used instead. if neither is available, the style is artificially simulated. oblique <angle> selects a font classified as oblique, and additionally specifies an angle for the slant of the text. if one or more oblique faces are available in the chosen font family, the one that most closely matches the specified angle is chosen. if no oblique faces are available, the browser will synthesize an oblique version of the font by slanting a normal face by the specified amount. valid values are degree values of -90deg to 90deg inclusive. if an angle is not specified, an angle of 14 degrees is used. positive values are slanted to the end of the line, while negative values are slanted towa...
letter-spacing - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. ...
line-height-step - CSS: Cascading Style Sheets
/* point values */ line-height-step: 18pt; syntax the line-height-step property is specified as any one of the following: a <length>. values <length> the specified <length> is used in the calculation of the line box height step. ...
margin-bottom - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. ...
margin-left - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the vertical margins of two adjacent boxes may fuse. this is called margin collapsing. ...
margin-right - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the vertical margins of two adjacent boxes may fuse. this is called margin collapsing. ...
margin-top - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. this property has no effect on non-replaced inline elements, such as <span> or <code>. ...
margin - CSS: Cascading Style Sheets
Web › CSS › margin
vertical | horizontal */ margin: 5% auto; /* top | horizontal | bottom */ margin: 1em auto 2em; /* top | right | bottom | left */ margin: 2px 1em 0 auto; /* global values */ margin: inherit; margin: initial; margin: unset; the margin property may be specified using one, two, three, or four values. each value is a <length>, a <percentage>, or the keyword auto. negative values draw the element closer to its neighbors than it would be by default. when one value is specified, it applies the same margin to all four sides. when two values are specified, the first margin applies to the top and bottom, the second to the left and right. when three values are specified, the first margin applies to the top, the second to the right and left, the third to the bottom. when four values are specifie...
mask-border-source - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
mask-image - CSS: Cascading Style Sheets
[ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )<side-or-corner> = [ left | right ] | [ top | bottom ]<color-stop-list> = [ <linear-color-stop> [, <linear-color-hint>]? ]# , <linear-color-stop><ending-shape> = circle | ellipse<size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<angular-color-stop-list> = [ <angular-color-stop>...
position - CSS: Cascading Style Sheets
Web › CSS › position
page layout is the same as if position were static. this value creates a new stacking context when the value of z-index is not auto. its effect on table-*-group, table-row, table-column, table-cell, and table-caption elements is undefined. absolute the element is removed from the normal document flow, and no space is created for the element in the page layout. it is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. its final position is determined by the values of top, right, bottom, and left. this value creates a new stacking context when the value of z-index is not auto. the margins of absolutely positioned boxes do not collapse with other margins. fixed the element is removed from the normal document flow,...
shape-image-threshold - CSS: Cascading Style Sheets
is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. any pixels whose alpha component's value is greater than the threshold are considered to be part of the shape for the purposes of determining its boundaries. for example, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque. /* <number> value */ shape-image-threshold: 0.7; /* global values */ shape-image-threshold: inherit; shape-image-threshold: initial; shape-image-threshold: unset; syntax values <alpha-value> sets the threshold used for extracting a shape from an image. the shape is defined by the pixels whose alpha value is greater than the threshold. values ...
text-decoration-skip-ink - CSS: Cascading Style Sheets
ration-skip-ink: all; /* global keywords */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; values none underlines and overlines are drawn across the full length of the text content, including parts that cross over glyph descenders and ascenders. auto the default — the browser may interrupt underlines and overlines so that they do not touch or closely approach a glyph. that is, they are interrupted where they would otherwise cross over a glyph. all the browser must interrupt underlines and overlines so that they do not touch or closely approach a glyph. this can be helpful with certain chinese, japanese, or korean (cjk) fonts, where the auto behavior might not create interruptions. formal definition initial valueautoapplies toall elem...
text-transform - CSS: Cascading Style Sheets
conventions (such as skipping articles in english). the capitalize keyword was under-specified in css 1 and css 2.1. this resulted in differences between browsers in the way the first letter was calculated (firefox considered - and _ as letters, but other browsers did not. both webkit and gecko incorrectly considered letter-based symbols like ⓐ to be real letters. internet explorer 9 was the closest to the css 2 definition, but with some weird cases.) by precisely defining the correct behavior, css text level 3 cleans this mess up. the capitalize line in the browser compatibility table contains the version the different engines started to support this now precisely-defined behavior. uppercase is a keyword that converts all characters to uppercase. lowercase is a keyword that converts...
transition-timing-function - CSS: Cascading Style Sheets
ents, ::before and ::after pseudo-elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <timing-function>#where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-posit...
transition - CSS: Cascading Style Sheets
tion> = [ none | <single-transition-property> ] | <time> | <timing-function> | <time>where <single-transition-property> = all | <custom-ident><timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>)<step-timing-function> = step-start | step-end | steps(<integer>[, <step-position>]?)where <step-posit...
visibility - CSS: Cascading Style Sheets
d not-visible. one of the start or ending values must therefore be visible or no interpolation can happen. the value is interpolated as a discrete step, where values of the timing function between 0 and 1 map to visible and other values of the timing function (which occur only at the start/end of the transition or as a result of cubic-bezier() functions with y values outside of [0, 1]) map to the closer endpoint. notes support for visibility: collapse is missing or partially incorrect in some modern browsers. it may not be correctly treated like visibility: hidden on elements other than table rows and columns. visibility: collapse may change the layout of a table if the table has nested tables within the cells that are collapsed, unless visibility: visible is specified explicitly on nested...
WAI ARIA Live Regions/API Support - Developer guides
eate/destroy at the request of screen reader vendors, who avoid those events because they cause crashes on some important system -- show/hide are the equivalent of those events. ...
Adding captions and subtitles to HTML5 video - Developer guides
nother complete video player that also support video captions, albeit only in srt format. leanback player yet another video player that supports webvtt captions as well as providing other standard player functionality. sublimevideo this player also supports captions through webvtt and srt files. video.js supports webvtt video subtitles. radiant media player supports multi-languages webvtt closed captions note: you can find an excellent list of html5 video players and their current "state" at html5 video player comparison. ...
Creating a cross-browser video player - Developer guides
used to control the video. the control set most browser's default video controls have the following functionality: play/pause mute volume control progress bar skip ahead go fullscreen the custom control set will also support this functionality, with the addition of a stop button. once again the html is quite straightforward, using an unordered list with list-style-type:none set to enclose the controls, each of which is a list item with float:left. for the progress bar, the progress element is taken advantage of, with a fallback provided for browsers that don't support it (e.g. ie8 and ie9). this list is inserted after the <video> element, but inside the <figure> element (this is important for the fullscreen functionality, which is explained later on). <ul id="video-controls" clas...
Mouse gesture events - Developer guides
rom taking place as well, be sure to call the event's preventdefault() method. types of gesture events mozswipegesture the mozswipegesture event is sent when the user uses three fingers to "swipe" the trackpad. mozmagnifygesturestart the mozmagnifygesturestart event is sent when the user begins performing a "pinch" gesture, by using two fingers as the corners of a rectangle and moving them either closer together or farther apart. this is typically used to zoom in and out on content (this is the default behavior in firefox, for example). mozmagnifygestureupdate the mozmagnifygestureupdate event is sent periodically while processing a magnify gesture, to provide updated status information. the event's delta value represents the amount by which the gesture has moved since the mozmagnifygesturestar...
Making content editable - Developer guides
ocus(); } function printdoc() { if (!validatemode()) { return; } var oprntwin = window.open("","_blank","width=450,height=470,left=400,top=100,menubar=yes,toolbar=no,location=no,scrollbars=yes"); oprntwin.document.open(); oprntwin.document.write("<!doctype html><html><head><title>print<\/title><\/head><body onload=\"print();\">" + odoc.innerhtml + "<\/body><\/html>"); oprntwin.document.close(); } </script> <style type="text/css"> .intlink { cursor: pointer; } img.intlink { border: 0; } #toolbar1 select { font-size:10px; } #textbox { width: 540px; height: 200px; border: 1px #000000 solid; padding: 12px; overflow: scroll; } #textbox #sourcetext { padding: 0; margin: 0; min-width: 498px; min-height: 200px; } #editmode label { cursor: pointer; } </style> </head> <body o...
HTML5 - Developer guides
Web › Guide › HTML › HTML5
nd webvtt the <track> element allows subtitles and chapters. webvtt is a text track format. 2d/3d graphics and effects canvas tutorial learn about the new <canvas> element and how to draw graphs and other objects in firefox. html5 text api for <canvas> elements the html5 text api is now supported by <canvas> elements. webgl webgl brings 3d graphics to the web by introducing an api that closely conforms to opengl es 2.0 that can be used in html5 <canvas> elements. svg an xml-based format of vectorial images that can directly be embedded in the html. performance and integration web workers allows delegation of javascript evaluation to background threads, allowing these activities to prevent slowing down interactive events. xmlhttprequest level 2 allows fetching asynchronous...
HTML attribute: size - HTML: Hypertext Markup Language
Web › HTML › Attributes › size
, and the form control will be the default width based on the user agent. if css targets the element with properties impacting the width, css takes precedence. the size attribute has no impact on constraint validation. examples by adding size on some input types, the width of the input can be controlled. adding size on a select changes the height, definining how many options are visible in the closed state. <label for="fruit">enter a fruit</label> <input type="text" size="15" id="fruit"> <label for="vegetable">enter a vegetable</label> <input type="text" id="vegetable"> <select name="fruits" size="5"> <option>banana</option> <option>cherry</option> <option>strawberry</option> <option>durian</option> <option>blueberry</option> </select> <select name="vegetables" size="5"> <option...
<address>: The Contact Address element - HTML: Hypertext Markup Language
Web › HTML › Element › address
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the contact information provided by an <address> element's contents can take whatever form is appropriate for the context, and may include any type of contact information that is needed, such as a physical address, url, email address, phone number, social media handle, geographic coordinates, and so forth. ...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
Web › HTML › Element › applet
age relative to content that might flow around it. the html 4.01 specification defines values of bottom, left, middle, right, and top, whereas microsoft and netscape also might support absbottom, absmiddle, baseline, center, and texttop. alt this attribute causes a descriptive text alternate to be displayed on browsers that do not support java. page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive this attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce download time. code this attribute specifies the url of the applet's class file to be loaded and executed. applet filenames are identified by a .class filename extension. the url specifie...
<big>: The Bigger Text element - HTML: Hypertext Markup Language
Web › HTML › Element › big
the size is capped at the browser's maximum permitted font size. usage note: as it was purely presentational, this element has been removed in html5 and shouldn't be used anymore. instead web developers should use the css font-size property to adjust the font size. attributes this element has no other attributes than the global attributes, common to all elements. examples here we see examples showing the use of <big> followed by an example showing how to accomplish the same results using modern css syntax instead. ...
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › blink
do not use this element as it is obsolete and is bad design practice. blinking text is frowned upon by several accessibility standards and the css specification allows browsers to ignore the <blink> element. dom interface this element is unsupported and thus implements the htmlunknownelement interface. example <blink>why would somebody use this?</blink> result (toned down!) specification this element is non-standard and not part of any specification. if you don't believe us, see for yourself in the html spec. ...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
usually, this is rendered visually by indentation (see notes for how to change it). a url for the source of the quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, sectioning root, palpable content. permitted content flow content. ...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
s and people using non-precise forms of input such as a stylus or fingers. a minimum interactive size of 44×44 css pixels is recommended. understanding success criterion 2.5.5: target size | w3c understanding wcag 2.1 target size and 2.5.5 | adrian roselli quick test: large touch targets - the a11y project proximity large amounts of interactive content — including buttons — placed in close visual proximity to each other should have space separating them. this spacing is beneficial for people who are experiencing motor control issues, who may accidentally activate the wrong interactive content. spacing may be created using css properties such as margin. hand tremors and the giant-button-problem - axess lab firefox firefox will add a small dotted border on a focused button. th...
<dl>: The Description List element - HTML: Hypertext Markup Language
Web › HTML › Element › dl
common uses for this element are to implement a glossary or to display metadata (a list of key-value pairs). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <dl> element's children include one name-value group, palpable content. ...
<footer> - HTML: Hypertext Markup Language
Web › HTML › Element › footer
. implicit aria role contentinfo, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region permitted aria roles group, presentation or none dom interface htmlelement attributes this element only includes the global attributes. usage notes enclose information about the author in an <address> element that can be included into the <footer> element. the <footer> element is not sectioning content and therefore doesn't introduce a new section in the outline. examples <footer> some copyright info or perhaps some author info for an &lt;article&gt;? </footer> accessibility concerns the voiceover screen reader has an issue where the foot...
<form> - HTML: Hypertext Markup Language
Web › HTML › Element › form
s on <button>, <input type="submit">, or <input type="image"> elements. method the http method to submit the form with. possible (case insensitive) values: post: the post method; form data sent as the request body. get: the get method; form data appended to the action url with a ? separator. use this method when the form has no side-effects. dialog: when the form is inside a <dialog>, closes the dialog on submission. this value is overridden by formmethod attributes on <button>, <input type="submit">, or <input type="image"> elements. novalidate this boolean attribute indicates that the form shouldn't be validated when submitted. if this attribute is not set (and therefore the form is validated), it can be overridden by a formnovalidate attribute on a <button>, <input type="...
<frame> - HTML: Hypertext Markup Language
Web › HTML › Element › frame
ccessibility for users with screen readers. instead of the <frame> element, <iframe> may be preferred. attributes like all other html elements, this element supports the global attributes. src this attribute specifies the document that will be displayed by the frame. name this attribute is used for labeling frames. without labeling, every link will open in the frame that it’s in – the closest parent frame. see the target attribute for more information. noresize this attribute prevents resizing of frames by users. scrolling this attribute defines the existence of a scrollbar. if this attribute is not used, the browser adds a scrollbar when necessary. there are two choices: "yes" for forcing a scrollbar even when it is not necessary and "no" for forcing no scrollbar even when it i...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
png" alt="mdn logo" srcset="/static/external/6c/6c98485e5d8acac9fecd7824ce30c9587f0d8548b946ee9fb1293d2eccdb6cf1.png 2x"> using the srcset and sizes attributes the src attribute is ignored in user agents that support srcset when w descriptors are included. when the (max-width: 600px) media condition matches, the 200 pixel-wide image will load (it is the one that matches 200px most closely), otherwise the other image will load. <img src="/files/16864/clock-demo-200px.png" alt="clock" srcset="/files/16864/clock-demo-200px.png 200w, /files/16797/clock-demo-400px.png 400w" sizes="(max-width: 600px) 200px, 50vw"> to see the resizing in action, view the example on a separate page, so you can actually resize the content area. security and privacy con...
<input type="color"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › color
demonstrating the use of the <code>&lt;input type="color"&gt;</code> control.</p> <label for="colorwell">color:</label> <input type="color" value="#ff0000" id="colorwell"> <p>watch the paragraph colors change when you adjust the color picker. as you make changes in the color picker, the first paragraph's color changes, as a preview (this uses the <code>input</code> event). when you close the color picker, the <code>change</code> event fires, and we detect that to change every paragraph to the selected color.</p> javascript first, there's some setup. here we establish some variables, setting up a variable that contains the color we'll set the color well to when we first load up, and then setting up a load handler to do the main startup work once the page is fully loaded. ...
<input type="date"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › date
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. for date inputs, the value of step is given in days; and is treated as a number of milliseconds equal to 86,400,000 times the step value (the underlying numeric value is in milliseconds). the default value of step is 1, indicating 1 day. specifying any as the value for step has the same effect as 1 for date inputs. using date inputs date inputs sound convenient — they provide an...
<input type="datetime-local"> - HTML: Hypertext Markup Language
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. for datetime-local inputs, the value of step is given in seconds, with a scaling factor of 1000 (since the underlying numeric value is in milliseconds). the default value of step is 60, indicating 60 seconds (or 1 minute, or 60,000 milliseconds). at this time, it's unclear what a value of any means for step when used with datetime-local inputs. this will be updated as soon as that inf...
<input type="image"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › image
ethod works well for simple forms that contain only ascii characters and have no side effects. this is the default value. post the form's data is included in the body of the request that is sent to the url given by the formaction or action attribute using an http post request. this method supports complex data and file attachments. dialog this method is used to indicate that the button simply closes the dialog with which the input is associated, and does not transmit the form data at all. this attribute is also available on <input type="submit"> and <button> elements. formnovalidate a boolean attribute which, if present, specifies that the form should not be validated before submission to the server. this overrides the value of the novalidate attribute on the element's owning form. thi...
<input type="month"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › month
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. for month inputs, the value of step is given in months, with a scaling factor of 1 (since the underlying numeric value is also in months). the default value of step is 1 month. using month inputs date-related inputs (including month) sound convenient at first glance; they promise an easy ui for choosing dates, and they normalize the data format sent to the server, regardless of the u...
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. the default stepping value for range inputs is 1, allowing only integers to be entered, unless the stepping base is not an integer; for example, if you set min to -10 and value to 1.5, then a step of 1 will allow only values such as 1.5, 2.5, 3.5,... in the positive direction and -0.5, -1.5, -2.5,... in the negative direction. see the html step attribute. non standard attributes ...
<input type="submit"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › submit
method works well for simple forms that contain only ascii characters and have no side effects. this is the default value. post the form's data is included in the body of the request that is sent to the url given by the formaction or action attribute using an http post method. this method supports complex data and file attachments. dialog this method is used to indicate that the button simply closes the dialog with which the input is associated, and does not transmit the form data at all. this attribute is also available on <input type="image"> and <button> elements. formnovalidate a boolean attribute which, if present, specifies that the form should not be validated before submission to the server. this overrides the value of the novalidate attribute on the element's owning form. this...
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. for time inputs, the value of step is given in seconds, with a scaling factor of 1000 (since the underlying numeric value is in milliseconds). the default value of step is 60, indicating 60 seconds (or 1 minute, or 60,000 milliseconds). at this time, it's unclear what a value of any means for step when used with time inputs. this will be updated as soon as that information is determin...
<input type="week"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › week
ult value if neither of those is provided) are valid. a string value of any means that no stepping is implied, and any value is allowed (barring other constraints, such as min and max). note: when the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options. for week inputs, the value of step is given in weeks, with a scaling factor of 604,800,000 (since the underlying numeric value is in milliseconds). the default value of step is 1, indicating 1week. the default stepping base is -259,200,000, which is the beginning of the first week of 1970 ("1970-w01"). at this time, it's unclear what a value of "any" means for step when used with week...
<nextid>: The NeXT ID element (Obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › nextid
of these would produce an entry in the table of contents like this: <a name="z0" href="#z4">first section name</a> and the section header would be marked like this: <h2><a name="z4">first section name</a></h2>. this continues for the next three sections, z5, z6, and z7 (and table of contents entries named z1, z2, and z3), each automatically given anchors with these names. the user then saves and closes the document. next would then add, within the header of the html document, a special tag, <nextid n="z8">, to inform where to continue its naming convention. imagine the web author opens the document for further editing. they want to add a couple new sections after the second section, appending four more sections at the end. when opening the document, the next editor finds and reads this <nextid...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ol
r roman numerals. for example, to start numbering elements from the letter "d" or the roman numeral "iv," use start="4". type sets the numbering type: a for lowercase letters a for uppercase letters i for lowercase roman numerals i for uppercase roman numerals 1 for numbers (default) the specified type is used for the entire list unless a different type attribute is used on an enclosed <li> element. note: unless the type of the list number matters (like legal or technical documents where items are referenced by their number/letter), use the css list-style-type property instead. usage notes typically, ordered list items display with a preceding marker, such as a number or letter. the <ol> and <ul> elements may nest as deeply as desired, alternating between <ol> and ...
<p>: The Paragraph element - HTML: Hypertext Markup Language
Web › HTML › Element › p
the html <p> element represents a paragraph. paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but html paragraphs can be any structural grouping of related content, such as images or form fields. paragraphs are block-level elements, and notably will automatically close if another block-level element is parsed before the closing </p> tag. see “tag omission” below. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, palpable content. permitted content phrasing conten...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
Web › HTML › Element › q
most modern browsers implement this by surrounding the text in quotation marks. this element is intended for short quotations that don't require paragraph breaks; for long quotations use the <blockquote> element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. ...
<rp>: The Ruby Fallback Parenthesis element - HTML: Hypertext Markup Language
Web › HTML › Element › rp
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. ...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
Web › HTML › Element › samp
its contents are typically rendered using the browser's default monospaced font (such as courier or lucida console). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. ...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
Web › HTML › Element › strong
elements in html5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (although some older browsers actually underline <strong>). each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the css font-weight property. the intended meaning or purpose of the enclosed text should be what determines which element you use. communicating meaning is what semantics are all about. <em> vs. <strong> adding to the confusion is the fact that while html 4 defined <strong> as simply indicating a stronger emphasis, html 5 defines <strong> as representing "strong importance for its contents." this is an important distinction to make. while <em> is used to change the me...
<track>: The Embed Text Track element - HTML: Hypertext Markup Language
Web › HTML › Element › track
: subtitles subtitles provide translation of content that cannot be understood by the viewer. for example dialogue or text that is not english in an english language film. subtitles may contain additional content, usually extra background information. for example the text at the beginning of the star wars films, or the date, time, and location of a scene. captions closed captions provide a transcription and possibly a translation of audio. it may include important non-verbal information such as music cues or sound effects. it may indicate the cue's source (e.g. music, text, character). suitable for users who are deaf or when the sound is muted. descriptions textual description of the video content. suitable for users who are blind or...
<var>: The Variable element - HTML: Hypertext Markup Language
Web › HTML › Element › var
in this example, variable names are rendered using bold courier if it's available, otherwise it falls back to the default monospace font. css var { font: bold 15px "courier", "courier new", monospace; } html <p>the variables <var>minspeed</var> and <var>maxspeed</var> control the minimum and maximum speed of the apparatus in revolutions per minute (rpm).</p> this html uses <var> to enclose the names of two variables. result specifications specification status comment html living standardthe definition of '<var>' in that specification. living standard html5the definition of '<var>' in that specification. recommendation ...
Global attributes - HTML: Hypertext Markup Language
attributes, the following global attributes also exist: xml:lang and xml:base — these are inherited from the xhtml specifications and deprecated, but kept for compatibility purposes. the multiple aria-* attributes, used for improving accessibility. ...
Link types - HTML: Hypertext Markup Language
form. although recognized, the rev attribute on <a>, <area> or<link> elements with a link type of made is incorrect and should be replaced by the rel attribute with this link type. <a>, <area>, <link> <form> bookmark indicates that the hyperlink is a permalink for the nearest ancestor <article> element. if none, it is a permalink for the section that the element is most closely associated to. this allows for bookmarking a single article in a page containing multiple articles, such as on a monthly summary blog page, or a blog aggregator. <a>, <area> <link>, <form> canonical from wikipedia, the free encyclopedia: canonical_link_element a canonical link element is an html element that helps webmasters prevent duplicate content issues by spe...
Evolution of HTTP - HTTP
nsmission layer on top of it: ssl. ssl 1.0 was never released outside the company, but ssl 2.0 and its successor ssl 3.0 allowed for the creation of e-commerce web sites by encrypting and guaranteeing the authenticity of the messages exchanged between the server and client. ssl was put on the standards track and eventually became tls, with versions 1.0, 1.1, 1.2, and 1.3 appearing successfully to close vulnerabilities. during the same time, the need for an encrypted transport layer raised: the web left the relative trustiness of a mostly academic network, to a jungle where advertisers, random individuals or criminals compete to get as much private information about people, try to impersonate them or even to replace data transmitted by altered ones. as the applications built over http became mo...
HTTP caching - HTTP
Web › HTTP › Caching
ching is a technique that stores a copy of a given resource and serves it back when requested. when a web cache has a requested resource in its store, it intercepts the request and returns its copy instead of re-downloading from the originating server. this achieves several goals: it eases the load of the server that doesn’t need to serve all clients itself, and it improves performance by being closer to the client, i.e., it takes less time to transmit the resource back. for a web site, it is a major component in achieving high performance. on the other side, it has to be configured properly as not all resources stay identical forever: it is important to cache a resource only until it changes, not longer. there are several kinds of caches: these can be grouped into two main categories: priva...
Cross-Origin Resource Policy (CORP) - HTTP
expressed via a response header, the actual request is not prevented—rather, the browser prevents the result from being leaked by stripping the response body. history the concept was originally proposed in 2012 (as from-origin), but resurrected in q2 of 2018 and implemented in safari and chromium. in early 2018, two side-channel hardware vulnerabilities known as meltdown and spectre were disclosed. these vulnerabilities allowed sensitive data disclosure due to a race condition which arose as part of speculative execution functionality, designed to improve performance. in response, chromium shipped cross-origin read blocking, which automatically protects certain resources (of content-type html, json and xml) against cross-origin reads. if the application does not serve a no-sniff directiv...
Age - HTTP
Web › HTTP › Headers › Age
if it is age: 0, it was probably just fetched from the origin server; otherwise it is usually calculated as a difference between the proxy's current date and the date general header included in the http response. header type response header forbidden header name no syntax age: <delta-seconds> directives <delta-seconds> a non-negative integer, representing time in seconds the object has been in a proxy cache. ...
Origin - HTTP
Web › HTTP › Headers › Origin
note: the origin header is not set on fetch requests with a method of head or get (this behavior was corrected in firefox 65 — see bug 1508661). ...
PUT - HTTP
Web › HTTP › Methods › PUT
sponses if the target resource does not have a current representation and the put request successfully creates one, then the origin server must inform the user agent by sending a 201 (created) response. http/1.1 201 created content-location: /new.html if the target resource does have a current representation and that representation is successfully modified in accordance with the state of the enclosed representation, then the origin server must send either a 200 (ok) or a 204 (no content) response to indicate successful completion of the request. http/1.1 204 no content content-location: /existing.html specifications specification title rfc 7231, section 4.3.4: put hypertext transfer protocol (http/1.1): semantics and content ...
Proxy servers and tunneling - HTTP
arding client information through proxies proxies can make requests appear as if they originated from the proxy's ip address. this can be useful if a proxy is used to provide client anonymity, but in other cases information from the original request is lost. the ip address of the original client is often used for debugging, statistics, or generating location-dependent content. a common way to disclose this information is by using the following http headers: the standardized header: forwarded contains information from the client-facing side of proxy servers that is altered or lost when a proxy is involved in the path of the request. or the de-facto standard versions: x-forwarded-for identifies the originating ip addresses of a client connecting to a web server through an http proxy...
A typical HTTP session - HTTP
Web › HTTP › Session
in client-server protocols, like http, sessions consist of three phases: the client establishes a tcp connection (or the appropriate connection if the transport layer is not tcp). the client sends its request, and waits for the answer. the server processes the request, sending back its answer, providing a status code and appropriate data. as of http/1.1, the connection is no longer closed after completing the third phase, and the client is now granted a further request: this means the second and third phases can now be performed any number of times. establishing a connection in client-server protocols, it is the client which establishes the connection. opening a connection in http means initiating a connection in the underlying transport layer, usually this is tcp. with tcp the defau...
203 Non-Authoritative Information - HTTP
Web › HTTP › Status › 203
the 203 response is similar to the value 214, meaning transformation applied, of the warning header code, which has the additional advantage of being applicable to responses with any status code. ...
408 Request Timeout - HTTP
Web › HTTP › Status › 408
the hypertext transfer protocol (http) 408 request timeout response status code means that the server would like to shut down this unused connection. it is sent on an idle connection by some servers, even without any previous request by the client. a server should send the "close" connection header field in the response, since 408 implies that the server has decided to close the connection rather than continue waiting. this response is used much more since some browsers, like chrome, firefox 27+, and ie9, use http pre-connection mechanisms to speed up surfing. note: some servers merely shut down the connection without sending this message. status 408 request timeout specifications specification title rfc 7231, section 6.5.7: 408 request timeout hypertext transf...
413 Payload Too Large - HTTP
Web › HTTP › Status › 413
the http 413 payload too large response status code indicates that the request entity is larger than limits defined by server; the server might close the connection or return a retry-after header field. status 413 payload too large specifications specification title rfc 7231, section 6.5.11: 413 payload too large hypertext transfer protocol (http/1.1): semantics and content ...
HTTP response status codes - HTTP
Web › HTTP › Status
e resources that have been deleted with this status code. 411 length required server rejected the request because the content-length header field is not defined and the server requires it. 412 precondition failed the client has indicated preconditions in its headers which the server does not meet. 413 payload too large request entity is larger than limits defined by server; the server might close the connection or return an retry-after header field. 414 uri too long the uri requested by the client is longer than the server is willing to interpret. 415 unsupported media type the media format of the requested data is not supported by the server, so the server is rejecting the request. 416 range not satisfiable the range specified by the range header field in the request can't be fulfi...
A re-introduction to JavaScript (JS tutorial) - JavaScript
. alternatively, such values can be called "truthy" and "falsy", respectively. boolean operations such as && (logical and), || (logical or), and ! (logical not) are supported; see below. variables new variables in javascript are declared using one of three keywords: let, const, or var. let allows you to declare block-level variables. the declared variable is available from the block it is enclosed in. let a; let name = 'simon'; the following is an example of scope with a variable declared with let: // myletvariable is *not* visible out here for (let myletvariable = 0; myletvariable < 5; myletvariable++) { // myletvariable is only visible in here } // myletvariable is *not* visible out here const allows you to declare variables whose values are never intended to change. the vari...
Closures - JavaScript
in other words, a closure gives you access to an outer function’s scope from an inner function. in javascript, closures are created every time a function is created, at function creation time. lexical scoping consider the following example code: function init() { var name = 'mozilla'; // name is a local variable created by init function displayname() { // displayname() is the inner function, a closure alert(name); // use variable declared in the parent function } displayname(); } init(); init() creates a local variable called name and a function called displayname(). ...
Assertions - JavaScript
mplemented character sets when used within groups. let fruits = ["apple", "watermelon", "orange", "avocado", "strawberry"]; // selecting fruits that dose not start by 'a' by a /^[^a]/ regex. // in this example, two meanings of '^' control symbol are represented: // 1) matching begining of the input // 2) a negated or complemented character set: [^a] // that is, it matches anything that is not enclosed in the brackets. let fruitsstartswithnota = fruits.filter(fruit => /^[^a]/.test(fruit)); console.log(fruitsstartswithnota); // [ 'watermelon', 'orange', 'strawberry' ] matching a word boundary let fruitswithdescription = ["red apple", "orange orange", "green avocado"]; // select descriptions that contains 'en' or 'ed' words endings: let enedselection = fruitswithdescription.filter(descr => ...
Text formatting - JavaScript
string value. repeat returns a string consisting of the elements of the object repeated the given times. trim trims whitespace from the beginning and end of the string. multi-line template literals template literals are string literals allowing embedded expressions. you can use multi-line strings and string interpolation features with them. template literals are enclosed by the back-tick (` `) (grave accent) character instead of double or single quotes. template literals can contain place holders. these are indicated by the dollar sign and curly braces (${expression}). multi-lines any new line characters inserted in the source are part of the template literal. using normal strings, you would have to use the following syntax in order to get multi-line strings: ...
Working with objects - JavaScript
ing it a value. for example, let's create an object named mycar and give it properties named make, model, and year as follows: var mycar = new object(); mycar.make = 'ford'; mycar.model = 'mustang'; mycar.year = 1969; the above example could also be written using an object initializer, which is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}): var mycar = { make: 'ford', model: 'mustang', year: 1969 }; unassigned properties of an object are undefined (and not null). mycar.color; // undefined properties of javascript objects can also be accessed or set using a bracket notation (for more details see property accessors). objects are sometimes called associative arrays, since each property is associa...
SyntaxError: invalid regular expression flag "x" - JavaScript
expression literal, are not one of g, i, m, s, u, or y. message syntaxerror: syntax error in regular expression (edge) syntaxerror: invalid regular expression flag "x" (firefox) syntaxerror: invalid regular expression flags (chrome) error type syntaxerror what went wrong? there are invalid regular expression flags in the code. in a regular expression literal, which consists of a pattern enclosed between slashes, the flags are defined after the second slash. they can also be defined in the constructor function of the regexp object (second parameter). regular expression flags can be used separately or together in any order, but there are only six of them in ecmascript. to include a flag with the regular expression, use this syntax: var re = /pattern/flags; or var re = new regexp('pat...
SyntaxError: missing ) after condition - JavaScript
condition must appear in parenthesis after the if keyword, like this: if (condition) { // do something if the condition is true } examples missing parenthesis it might just be an oversight, carefully check all you parenthesis in your code. if (3 > math.pi { console.log("wait what?"); } // syntaxerror: missing ) after condition to fix this code, you would need to add a parenthesis that closes the condition. if (3 > math.pi) { console.log("wait what?"); } misused is keyword if you are coming from another programming language, it is also easy to add keywords that don't mean the same or have no meaning at all in javascript. if (done is true) { console.log("we are done!"); } // syntaxerror: missing ) after condition instead you need to use a correct comparison operator. for exa...
Arrow function expressions - JavaScript
unction growup() { // in non-strict mode, the growup() function defines `this` // as the global object (because it's where growup() is executed.), // which is different from the `this` // defined by the person() constructor. this.age++; }, 1000); } var p = new person(); in ecmascript 3/5, the this issue was fixable by assigning the value in this to a variable that could be closed over. function person() { var that = this; that.age = 0; setinterval(function growup() { // the callback refers to the `that` variable of which // the value is the expected object. that.age++; }, 1000); } alternatively, a bound function could be created so that a preassigned this value would be passed to the bound target function (the growup() function in the example above...
Functions - JavaScript
) an arrow function expression has a shorter syntax and lexically binds its this value (see arrow functions for details): ([param[, param]]) => { statements } param => expression param the name of an argument. zero arguments need to be indicated with (). for only one argument, the parentheses are not required. (like foo => 1) statements or expression multiple statements need to be enclosed in brackets. a single expression requires no brackets. the expression is also the implicit return value of the function. the function constructor note: using the function constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizations and can also cause other problems. as all other objects, function objects can ...
FinalizationRegistry.prototype.unregister() - JavaScript
ter(this, label, this.#file); // target −−−−−^^^^ ^^^^^^^^^^−−−−− unregister token } /** * releases resources held by this `thingy` instance. */ release() { if (this.#file) { this.#registry.unregister(this.#file); // ^^^^^^^^^^−−−−− unregister token file.close(this.#file); this.#file = null; } } } specifications specification weakrefsthe definition of 'finalizationregistry.prototype.unregister' in that specification. ...
JSON.stringify() - JavaScript
r" }) //'{"baz":"quux","foo":"bar"}' console.log(a !== b) // true // some memoization functions use json.stringify to serialize arguments, // which may cause a cache miss when encountering the same object like above example of using json.stringify() with localstorage in a case where you want to store an object created by your user and allowing it to be restored even after the browser has been closed, the following example is a model for the applicability of json.stringify(): // creating an example of json var session = { 'screens': [], 'state': true }; session.screens.push({ 'name': 'screena', 'width': 450, 'height': 250 }); session.screens.push({ 'name': 'screenb', 'width': 650, 'height': 350 }); session.screens.push({ 'name': 'screenc', 'width': 750, 'height': 120 }); session.screens...
Math.log() - JavaScript
specifications specification ecmascript (ecma-262)the definition of 'math.log' in that specification. ...
Math.log1p() - JavaScript
ss than -1, nan is returned. description for very small values of x, adding 1 can reduce or eliminate precision. the double floats used in js give you about 15 digits of precision. 1 + 1e-15 = 1.000000000000001, but 1 + 1e-16 = 1.000000000000000 and therefore exactly 1.0 in that arithmetic, because digits past 15 are rounded off. when you calculate log(1 + x), you should get an answer very close to x, if x is small (that's why these are called 'natural' logarithms). if you calculate math.log(1 + 1.1111111111e-15) you should get an answer close to 1.1111111111e-15. instead, you will end up taking the logarithm of 1.00000000000000111022 (the roundoff is in binary so sometimes it gets ugly), so you get the answer 1.11022...e-15, with only 3 correct digits. if, instead, you calculate mat...
Math.pow() - JavaScript
...
Number.MIN_VALUE - JavaScript
github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of number.min_value writable no enumerable no configurable no description the min_value property is the number closest to 0, not the most negative number, that javascript can represent. min_value has a value of approximately 5e-324. values smaller than min_value ("underflow values") are converted to 0. because min_value is a static property of number, you always use it as number.min_value, rather than as a property of a number object you created. examples using min_value the following code divides two nume...
Number - JavaScript
ic properties number.epsilon the smallest interval between two representable numbers. number.max_safe_integer the maximum safe integer in javascript (253 - 1). number.max_value the largest positive representable number. number.min_safe_integer the minimum safe integer in javascript (-(253 - 1)). number.min_value the smallest positive representable number—that is, the positive number closest to zero (without actually being zero). number.nan special "not a number" value. number.negative_infinity special value representing negative infinity. returned on overflow. number.positive_infinity special value representing infinity. returned on overflow. number.prototype allows the addition of properties to the number object. static methods number.isnan() determine whether the p...
Promise - JavaScript
ing the button several times in a short amount of time, you'll even see the different promises being fulfilled one after another. loading an image with xhr another simple example using promise and xmlhttprequest to load an image is available at the mdn github js-examples repository. you can also see it in action. each step is commented and allows you to follow the promise and xhr architecture closely. specifications specification ecmascript (ecma-262)the definition of 'promise' in that specification. ...
RegExp() constructor - JavaScript
code code points. (see also binary strings). y (sticky) matches only from the index indicated by the lastindex property of this regular expression in the target string. does not attempt to match from any later indexes. examples literal notation and constructor there are two ways to create a regexp object: a literal notation and a constructor. the literal notation's parameters are enclosed between slashes and do not use quotation marks. the constructor function's parameters are not enclosed between slashes but do use quotation marks. the following three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the express...
RegExp - JavaScript
the regexp object is used for matching text with a pattern. for an introduction to regular expressions, read the regular expressions chapter in the javascript guide. description literal notation and constructor there are two ways to create a regexp object: a literal notation and a constructor. the literal notation's parameters are enclosed between slashes and do not use quotation marks. the constructor function's parameters are not enclosed between slashes but do use quotation marks. the following three expressions create the same regular expression: /ab+c/i new regexp(/ab+c/, 'i') // literal notation new regexp('ab+c', 'i') // constructor the literal notation results in compilation of the regular expression when the expression is evaluated. use literal notation when the regular e...
eval() - JavaScript
consider switching to json, which allows the string to use a subset of javascript syntax to represent data. see also downloading json and javascript in extensions. note that since json syntax is limited compared to javascript syntax, many valid javascript literals will not parse as json. for example, trailing commas are not allowed in json, and property names (keys) in object literals must be enclosed in quotes. be sure to use a json serializer to generate strings that will be later parsed as json. pass data instead of code for example, an extension designed to scrape contents of web-pages could have the scraping rules defined in xpath instead of javascript code. run code with limited privileges if you must run the code, consider running it with reduced privileges. this advice applies mai...
Lexical grammar - JavaScript
iterals see also object and object initializer for more information. var o = { a: 'foo', b: 'bar', c: 42 }; // shorthand notation. new in es2015 var a = 'foo', b = 'bar', c = 42; var o = {a, b, c}; // instead of var o = { a: a, b: b, c: c }; array literals see also array for more information. [1954, 1974, 1990, 2014] string literals a string literal is zero or more unicode code points enclosed in single or double quotes. unicode code points may also be represented by an escape sequence. all code points may appear literally in a string literal except for these closing quote code points: u+005c \ (backslash), u+000d <cr>, and u+000a <lf>. prior to the proposal to make all json text valid ecma-262, u+2028 <ls> and u+2029 <ps>, were also disallowed from appearing unescaped in strin...
Object initializer - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
yield* - JavaScript
he interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax yield* expression; expression the expression which returns an iterable object. description the yield* expression iterates over the operand and yields each value returned by it. the value of yield* expression itself is the value returned by that iterator when it's closed (i.e., when done is true). 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(). function* g1() { yield 2; yield 3; yield 4; } function* g2() { yield 1; yield* g1(); yield 5; } const iterator = g2(); console.log(iterator.next()); // {value: 1, done: false} console.log(iterato...
for - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax for ([initialization]; [condition]; [final-expression]) statement initialization an expression (including assignment expressions) or variable declaration evaluated once before the loop begins. typically used to initialize a counter variable. ...
var - JavaScript
closing function and functions declared within it, or, for variables declared outside any function, global. duplicate variable declarations using var will not trigger an error, even in strict mode, and the variable will not lose its value, unless another assignment is performed. 'use strict'; function foo() { var x = 1; function bar() { var y = 2; console.log(x); // 1 (function `bar` closes over `x`) console.log(y); // 2 (`y` is in scope) } bar(); console.log(x); // 1 (`x` is in scope) console.log(y); // referenceerror in strict mode, `y` is scoped to `bar` } foo(); variables declared using var are created before any code is executed in a process known as hoisting. their initial value is undefined. 'use strict'; console.log(x); // undefined (note: not...
Statements and declarations - JavaScript
s. return specifies the value to be returned by a function. class declares a class. iterations do...while creates a loop that executes a specified statement until the test condition evaluates to false. the condition is evaluated after executing the statement, resulting in the specified statement executing at least once. for creates a loop that consists of three optional expressions, enclosed in parentheses and separated by semicolons, followed by a statement executed in the loop. for each...in iterates a specified variable over all values of object's properties. for each distinct property, a specified statement is executed. for...in iterates over the enumerable properties of an object, in arbitrary order. for each distinct property, statements can be executed. for...of itera...
Strict mode - JavaScript
sometimes be made to run faster than identical code that's not strict mode. prohibits some syntax likely to be defined in future versions of ecmascript. see transitioning to strict mode, if you want to change your code to work in the restricted variant of javascript. invoking strict mode strict mode applies to entire scripts or to individual functions. it doesn't apply to block statements enclosed in {} braces; attempting to apply it to such contexts does nothing. eval code, function code, event handler attributes, strings passed to windowtimers.settimeout(), and related functions are entire scripts, and invoking strict mode in them works as expected. strict mode for scripts to invoke strict mode for an entire script, put the exact statement "use strict"; (or 'use strict';) before any o...
Template literals (Template strings) - JavaScript
re string literals allowing embedded expressions. you can use multi-line strings and string interpolation features with them. they were called "template strings" in prior editions of the es2015 specification. syntax `string text` `string text line 1 string text line 2` `string text ${expression} string text` tag`string text ${expression} string text` description template literals are enclosed by the backtick (` `) (grave accent) character instead of double or single quotes. template literals can contain placeholders. these are indicated by the dollar sign and curly braces (${expression}). the expressions in the placeholders and the text between the backticks (` `) get passed to a function. the default function just concatenates the parts into a single string. if there is an express...
Web app manifests
o fetch - the crossorigin attribute must be set to use-credentials, even if the manifest file is in the same origin as the current page. splash screens in chrome 47 and later, a splash screen is displayed for sites launched from a homescreen. this splashscreen is auto-generated from properties in the web app manifest, specifically: name background_color the icon in the icons array that is closest to 128dpi for the device. specifications specification status comment web app manifest working draft initial definition. ...
<math> - MathML
Web › MathML › Element › math
ith stylesheets. dir overall directionality of formulas. possible values are either ltr (left to right) or rtl (right to left). href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color. you can use #rgb, #rrggbb and html color names. display this enumerated attribute specifies how the enclosed mathml markup should be rendered. it can have one of the following values: block, which means that this element will be displayed outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text; inline, which means that this element will be displayed inside the current span of text, and cannot be moved out of it without changing the mea...
<mo> - MathML
Web › MathML › Element › mo
t. allowed values are true or false. class, id, style provided for use with stylesheets. dir the text direction. possible values are either ltr (left to right) or rtl (right to left). fence there is no visual effect for this attribute, but it specifies whether the operator is a fence (such as parentheses). allowed values are true or false. form specifies the role of the operator in an enclosed expression, which affects spacing and other default properties. for ordinary operators (+, -, etc. ) you usually do not need to specify this attribute explicitly. possible values are: prefix, for opening fences. (it is the default value if the operator is the first argument in a <mrow> element with more than one argument.) infix, for separators. (it is the default value if the operator is...
<mover> - MathML
Web › MathML › Element › mover
if false (default value) the over-script is a limit over the base expression. align the alignment of the over-script. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with stylesheets. ...
<mpadded> - MathML
attributes class, id, style provided for use with stylesheets. depth sets or increments the depth. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . height sets or increments the height. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . href used to set a hyperlink to a specified uri. lspace sets or increments the horizontal position. possible values: any length or an increment/decrement (a length prefixed with "+" or "-") . ...
<munder> - MathML
Web › MathML › Element › munder
if false (default value), the element is a limit under the base expression. align the alignment of the underscript. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. ...
<munderover> - MathML
the mathml <munderover> element is used to attach accents or limits both under and over an expression. it uses the following syntax: <munderover> base underscript overscript </munderover> attributes accent if true, the overscript is an accent, which is drawn closer to the base expression. if false (default value), the overscript is a limit over the base expression. accentunder if true, the underscript is an accent, which is drawn closer to the base expression. if false (default value), the underscript is a limit under the base expression. align the alignment of both underscript and overscript. possible values are: left, center, and right. this attribute is deprecated and will be removed in the future. use css text-align instead. class, id, style provided for use with styleshee...
OpenSearch description format
overed plugin. if the error message isn't be helpful, the following tips could help you find the problem. your server should serve opensearch plugins using content-type: application/opensearchdescription+xml. be sure that your search plugin xml is well formed. you can check by loading the file directly into firefox. ampersands (&) in the template url must be escaped as &amp;, and tags must be closed with a trailing slash or matching end tag. the xmlns attribute is important — without it you could get the error message "firefox could not download the search plugin". you must include a text/html url — search plugins including only atom or rss url types (which is valid, but firefox doesn't support) will also generate the "could not download the search plugin" error. remotely fetched fav...
CSS and JavaScript animation performance - Web Performance
ps. running the performance test initially in the test seen below, a total of 1000 <div> elements are transformed by css animation. the animation can be switched to requestanimationframe() by clicking the toggle button. try running them both now, comparing the fps for each (the first purple box.) you should see that the performance of css animations and requestanimationframe() are very close. off main thread animation even given the test results above, we'd argue that css animations are the better choice. but how? the key is that as long as the properties we want to animate do not trigger reflow/repaint (read css triggers for more information), we can move those sampling operations out of the main thread. the most common property is the css transform. if an element is promoted as a...
Navigation and resource timings - Web Performance
sport layer fails after the start of the request and the connection is reopened, this property will be set to the time corresponding to the new request. responsestart when the browser received the first byte of the response, from the server from a cache, or from a local resource. responseend when the browser received the last byte of the response, or when the connection is closed if this happened first, from the server, the cache, or from a local resource. domloading when the parser started its work, that is when its document.readystate changes to 'loading' and the corresponding readystatechange event is thrown. unloadeventstart when the unload> event has been thrown, indicating the time at which the previous document in the window began to unload...
Performance budgets - Web Performance
cs will translate into file-size budgets. a default baseline to reduce bounce rate is to achieve time to interactive under 5 seconds in 3g/4g, and under 2 seconds for subsequent loads. however, based on the specific goals and content of your site, you might choose to focus on other metrics. for a text-heavy site such as a blog or a news site, the first contentful paint metric could reflect more closely the user behavior. (i.e. how fast can users start reading), which will inform file specific budgets (e.g. font size), and their optimizations. (e.g. using font-display to improve perceived performance). the ultimate value of a performance budget is to correlate the impact of performance on business or product goals. when defining metrics, you should focus on user experience, which will dictate...
Progressive web app structure - Progressive web apps (PWAs)
mentation of the actual pwa features. the css the css is also as plain as possible: it uses @font-face to load and use a custom font, and it applies some simple styling of the html elements. the overall approach is to have the design look good on both mobile (with a responsive web design approach) and desktop devices. the main app javascript the app.js file does a few things we will look into closely in the next articles. first of all it generates the content based on this template: var template = "<article>\n\ <img src='data/img/slug.jpg' alt='name'>\n\ <h3>#pos. name</h3>\n\ <ul>\n\ <li><span>author:</span> <strong>author</strong></li>\n\ <li><span>twitter:</span> <a href='https://twitter.com/twitter'>@twitter</a></li>\n\ <li><span>website:</span> <a href='http://...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
t any client-side intervention, and its operation is handled by the app's service worker. notifications can be used by the service worker to show new information to the user, or at least alert them when something has been updated. they work outside of the browser window, just like service workers, so updates can be pushed and notifications can be shown when the app's page is out of focus or even closed. notifications let's start with notifications — they can work without push, but are very useful when combined with them. let’s look at them in isolation to begin with. request permission to show a notification, we have to request permission to do so first. instead of showing the notification immediately though, best practice dictates that we should show the popup when the user requests i...
Media - Progressive web apps (PWAs)
y reading this on a device with a display. but you might also want to project it to a big screen for a large audience, or you might want to print it. these different media have different characteristics. css has the capacity to present content according to the media type. to specify rules that are specific to a type of media, use @media followed by the media type, followed by curly braces that enclose the rules. example a document on a website has a navigation area that contains the primary site menu. in the markup language, the navigation area's parent element has the id nav-area. (in html5, this can be marked up with the <nav> element instead of <div> with an id attribute.) when printing the document, the navigation area has no purpose. this css (below) removes the navigation area when ...
Structural overview of progressive web apps - Progressive web apps (PWAs)
and it applies some simple styling of the html elements. the overall approach is to have the design look good on both mobile (with a responsive web design approach) and desktop devices. app.js: the main app javascript the file app.js is run when the app is first loaded; its job is primarily to initialize the app, though it c can do other things as well. we'll look at how the app functions more closely in later articles in this guide. the first thing it does is to generate the app's displayed content using the following template: var template = "<article>\n\ <img src='data/img/slug.jpg' alt='name'>\n\ <h3>#pos. name</h3>\n\ <ul>\n\ <li><span>author:</span> <strong>author</strong></li>\n\ <li><span>twitter:</span> <a href='https://twitter.com/twitter'> @twitter</a...
SVG Event Attributes - SVG: Scalable Vector Graphics
Web › SVG › Attribute › Events
vent attributes are available on a case by case basis for each elements. all event attribute are not animatable. ...
glyph-orientation-horizontal - SVG: Scalable Vector Graphics
entation attribute, it can be applied to any element but it has effect only on the following five elements: <altglyph>, <textpath>, <text>, <tref>, and <tspan> context notes value <angle> default value 0deg animatable no <angle> the value of the angle is restricted to 0, 90, 180, and 270 degrees. if another angle is specified, it is rounded to the closest of the permitted values. a value of 0deg indicates that all glyphs are set with the top of the glyphs oriented towards the reference orientation. a value of 90deg indicates an orientation of 90 degrees clockwise from the reference orientation. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyp...
glyph-orientation-vertical - SVG: Scalable Vector Graphics
ilar context-driven variations.) the determination of which characters should be auto-rotated may vary across user agents. the determination is based on a complex interaction between country, language, script, character properties, font, and character context. <angle> the value of the angle is restricted to 0, 90, 180, and 270 degrees. if another angle is specified, it is rounded to the closest of the permitted values. a value of 0deg indicates that all glyphs are set with the top of the glyphs oriented towards the reference orientation. a value of 90deg indicates an orientation of 90 degrees clockwise from the reference orientation. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'glyp...
in - SVG: Scalable Vector Graphics
Web › SVG › Attribute › in
ovided and this is the first filter primitive, then this filter primitive will use sourcegraphic as its input. if no value is provided and this is a subsequent filter primitive, then this filter primitive will use the result from the previous filter primitive as its input. if the value for result appears multiple times within a given <filter> element, then a reference to that result will use the closest preceding filter primitive with the given value for attribute result. fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecomponenttransfer>, <fecomposite>, <feconvolvematrix>, <fediffuselighting>, <fedisplacementmap>, <fedropshadow>, <fegaussianblur>, <femergenode>, <femorphology>, <feoffset>, <fespecularlighting>, <fetile> usage notes value sourcegraphic ...
marker-end - SVG: Scalable Vector Graphics
the marker-end attribute defines the arrowhead or polymarker that will be drawn at the final vertex of the given shape. for all shape elements, except <polyline> and <path>, the last vertex is the same as the first vertex. in this case, if the value of marker-start and marker-end are both not none, then two markers will be rendered on that final vertex. for <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-end is only rendered on the final vertex of the path data. note: as a presentation attribute, marker-end can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, sv...
marker-start - SVG: Scalable Vector Graphics
the marker-start attribute defines the arrowhead or polymarker that will be drawn at the first vertex of the given shape. for all shape elements, except <polyline> and <path>, the last vertex is the same as the first vertex. in this case, if the value of marker-start and marker-end are both not none, then two markers will be rendered on that final vertex. for <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-start is only rendered on the first vertex of the path data. note: as a presentation attribute, marker-start can be used as a css property. as a presentation attribute, it can be applied to any element but it has effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, bo...
order - SVG: Scalable Vector Graphics
Web › SVG › Attribute › order
ransform: translatex(220px);" /> </svg> usage notes value <number-optional-number> default value 3 animatable yes <number-optional-number> this value indicates the number of cells in each dimension for the kernel matrix. the values provided must be <integer>s greater than zero. values that are not integers will be truncated, i.e. rounded to the closest integer value towards zero. the first number, indicates the number of columns in the matrix. the second number, indicates the number of rows in the matrix. if no second number is not provided, it defaults to the first number. it is recommended that only small values (e.g., 3) be used; higher values may result in very high cpu overhead and usually do not produce results that justify the impact...
panose-1 - SVG: Scalable Vector Graphics
the panose-1 attribute indicates the panose-1 number of a font face. panose-1 is an industry standard truetype font classification and matching technology. the panose system consists of a set of ten numbers that categorize the key attributes of a latin typeface, a classification procedure for creating those numbers, and mapper software that determines the closest possible font match given a set of typefaces. only one element is using this attribute: <font-face> usage notes value <integer>{10} default value 0 0 0 0 0 0 0 0 0 0 animatable no <integer>{10} this value specifies a panose-1 number and consists of ten decimal integers, separated by whitespace. the initial value zero for each panose digit means "any", i.e. all fonts will match the pan...
requiredExtensions - SVG: Scalable Vector Graphics
will not be rendered. note: if a given extension reference contains white space within itself, that white space must be escaped. requiredextensions is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several extension reference objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. it is thus recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. if the attribute is not present, then it implicitly evaluates to "true". if a null string or empty string value is given, the attribute evaluates to "false". the iri names for th...
result - SVG: Scalable Vector Graphics
Web › SVG › Attribute › result
lt value none animatable yes <filter-primitive-reference> this value is a <custom-ident> and defines the name for the filter primitive. it is only meaningful within a given <filter> element and thus has only local scope. it is legal for the same <filter-primitive-reference> to appear multiple times within the same <filter> element. when referenced, this value will use the closest preceding filter primitive with the given result. specifications specification status comment filter effects module level 1the definition of 'result' in that specification. working draft clarifies that the value is a <custom-ident>. scalable vector graphics (svg) 1.1 (second edition)the definition of 'result' in that specification. recommendation...
shape-rendering - SVG: Scalable Vector Graphics
p edges. this option will sometimes cause the user agent to turn off shape anti-aliasing. crispedges this value indicates that the user agent shall attempt to emphasize the contrast between clean edges of artwork over rendering speed and geometric precision. to achieve crisp edges, the user agent might turn off anti-aliasing for all lines and curves or possibly just for straight lines which are close to vertical or horizontal. also, the user agent might adjust line positions and line widths to align edges with device pixels. geometricprecision indicates that the user agent shall emphasize geometric precision over speed and crisp edges. specifications specification status comment scalable vector graphics (svg) 2the definition of 'shape-rendering' in that specif...
systemLanguage - SVG: Scalable Vector Graphics
<language-tags> the value is a set of comma-separated tokens, each of which must be a language-tag value, as defined in bcp 47. systemlanguage is often used in conjunction with the <switch> element. if the attribute is used in other situations, then it represents a simple switch on the given element whether to render the element or not. note: if several alternative language objects are enclosed in a <switch> and none of them matches, this may lead to situations where no content is displayed. it is thus recommended to include a "catch-all" choice at the end of such a <switch> which is acceptable in all cases. the attribute evaluates to "true" if one of the language tags indicated by user preferences is a case-insensitive match or prefix (followed by a "-") of one of the language tags g...
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
ation value attributes calcmode, values, keytimes, keysplines, from, to, by, autoreverse, accelerate, decelerate animation addition attributes additive, accumulate event attributes animation event attributes onbegin, onend, onrepeat document event attributes onabort, onerror, onresize, onscroll, onunload global event attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, o...
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
the last point is connected to the first point. for open shapes, see the <polyline> element. html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <!-- example of a polygon with the default fill --> <polygon points="0,100 50,25 50,75 100,0" /> <!-- example of the same polygon shape with stroke and no fill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. ...
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
the <polyline> svg element is an svg basic shape that creates straight lines connecting several points. typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. for closed shapes see the <polygon> element. html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <!-- example of a polyline with the default fill --> <polyline points="0,100 50,25 50,75 100,0" /> <!-- example of the same polyline shape with stroke and no fill --> <polyline points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> attributes points this attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polyline value type: <number>+ ; default ...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
html,body,svg { height:100% } <svg viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <!-- to hide the path, it is usually wrapped in a <defs> element --> <!-- <defs> --> <path id="mypath" fill="none" stroke="red" d="m10,90 q90,90 90,45 q90,10 50,10 q10,10 10,40 q10,70 45,70 q70,70 75,50" /> <!-- </defs> --> <text> <textpath href="#mypath"> quick brown fox jumps over the lazy dog. </textpath> </text> </svg> attributes href the url to the path or basic shape on which to render the text. if the path attribute is set, href has no effect. ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
deprecated xml:space attribute implementation status unknown kerning property removed implementation status unknown path attribute for <textpath> implemented (bug 1446617) reference basic shapes to <textpath> implementation status unknown side attribute for <textpath> implemented (bug 1446650) render characters for one loop of a single closed path, effected by the startoffset attribute and text-anchor property implementation status unknown <tref> removed implementation status unknown <altglyph>, <altglyphdef>, <altglyphitem> and <glyphref> removed <altglyph>, <altglyphdef> and <altglyphitem> removed (bug 1260032), <glyphref> never really implemented (bug 1302693) svgtextcontentelement.selectsubstri...
SVG animation with SMIL - SVG: Scalable Vector Graphics
a blue circle bounces between the left and right edges of a black box, over and over again, indefinitely. the animation here is handled by the <animatemotion> element. in this case, we're establishing a path consisting of a moveto command to establish the starting point for the animation, then the horizontal-line command to move the circle 300 pixels to the right, followed by the z command, which closes the path, establishing a loop back to the beginning. by setting the value of the repeatcount attribute to indefinite, we indicate that the animation should loop forever, as long as the svg image exists. <svg xmlns="http://www.w3.org/2000/svg" width="300" height="100"> <title>svg smil animate with path</title> <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" /> <c...
Fills and Strokes - SVG: Scalable Vector Graphics
ecap="round"/> </svg> the stroke-width property defines the width of this stroke. strokes are drawn centered around the path. in the example above, the path is shown in pink, and the stroke in black. the second attribute affecting strokes is the stroke-linecap property, demonstrated above. this controls the shape of the ends of lines. there are three possible values for stroke-linecap: butt closes the line off with a straight edge that's normal (at 90 degrees) to the direction of the stroke and crosses its end. square has essentially the same appearance, but stretches the stroke slightly beyond the actual path. the distance that the stroke goes beyond the path is half the stroke-width. round produces a rounded effect on the end of the stroke. the radius of this curve is also controlled ...
Paths - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Paths
s only. <svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"> <path d="m 10 10 h 90 v 90 h 10 l 10 10"/> <!-- points --> <circle cx="10" cy="10" r="2" fill="red"/> <circle cx="90" cy="90" r="2" fill="red"/> <circle cx="90" cy="10" r="2" fill="red"/> <circle cx="10" cy="90" r="2" fill="red"/> </svg> we can shorten the above path declaration a little bit by using the "close path" command, called with z. this command draws a straight line from the current position back to the first point of the path. it is often placed at the end of a path node, although not always. there is no difference between the uppercase and lowercase command. z (or) z so our path above could be shortened to: <path d="m 10 10 h 90 v 90 h 10 z" fill="transparent" stroke="black"/> the r...
SVG fonts - SVG: Scalable Vector Graphics
h, which allows for great effects in supporting user agents. there are two further elements that can be defined inside font: <hkern> and <vkern>. each carries references to at least two characters (attributes u1 and u2) and an attribute k that determines how much the distance between those characters should be decreased. the below example instructs user agents to place the "a" and "v" characters closer together the standard distance between characters. <hkern u1="a" u2="v" k="20" /> referencing a font when you have put together your font declaration as described above, you can just use a simple font-family attribute to actually apply the font to some svg text: <font> <font-face font-family="super sans" /> <!-- and so on --> </font> <text font-family="super sans">my text uses super sa...
Tools for SVG - SVG: Scalable Vector Graphics
fop batik can transform svg to pdf. other renderers several projects exist that can create a raster image from an svg source. imagemagick is one of the most famous command-line image processing tools. the gnome library rsvg is used by the wikipedia to raster their svg graphics. usage of headless browsers such as slimerjs and phantomjs are also popular for this purpose, as the image produced is closer to what the svg will look like in the browser. raphael js url: raphaeljs.com this is a javascript library, that acts as an abstraction layer between browser implementations. notably older versions of internet explorer are supported by generating vml, a vector markup language, that is one of two ancestors of svg and exists since ie 5.5. snap.svg url: snapsvg.io a newer javascript abstractio...
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
adapted from jeff schiller's comment in bug 303581. 1. try and open a local .svg file using mozilla and when the "opening ..." dialog comes up, select the "open with" radio button and choose any .exe except firefox.exe/mozilla.exe. 2. make sure the "do this automatically for files like this from now on" checkbox is checked. 3. click ok, and when the program you chose tries to open the file, just close it. 4. in firefox, go to tools > options... > downloads > view & edit actions... to open the download actions window. 5. select the svg entry, click the remove action button and then click close to close the download actions window. 6. try and load a local .svg file and this scripting across embed demo. if the files you attempt to load in step 6 work, then your problem was mimetypes.rdf corruptio...
Same-origin policy - Web security
hese references provide very limited access to window and location objects, as described in the next two sections. to communicate between documents from different origins, use window.postmessage. specification: html living standard § cross-origin objects. window the following cross-origin access to these window properties is allowed: methods window.blur window.close window.focus window.postmessage attributes window.closed read only. window.frames read only. window.length read only. window.location read/write. window.opener read only. window.parent read only. window.self read only. window.top read only. window.wind...
Web Components
the event interface related to shadow dom: event.composed: returns a boolean which indicates whether the event will propagate across the shadow dom boundary into the standard dom (true), or not (false). event.composedpath: returns the event’s path (objects on which listeners will be invoked). this does not include nodes in shadow trees if the shadow root was created with shadowroot.mode closed. html templates <template> contains an html fragment that is not rendered when a containing document is initially loaded, but can be displayed at runtime using javascript, mainly used as the basis of custom element structures. the associated dom interface is htmltemplateelement. <slot> a placeholder inside a web component that you can fill with your own markup, which lets you create ...
translate - XPath
g of characters used for replacement. the first character in xyz will replace every occurrence of the first character in abc that appears in string. returns the translated string. notes xpath notes that the translate function is not a sufficient solution for case conversion in all languages. a future version of xpath may provide additional functions for case conversion. however, this is the closest we have at present to a function that can convert a string to uppercase or lowercase. example <xsl:value-of select="translate('the quick brown fox.', 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz')" /> output the quick brown fox. if abc is longer than xyz, then every occurrence of characters in abc that do not have a corresponding character in xyz will be removed. example...
onunload - XUL
« xul reference home onunload type: script code specifies a set of scripts to execute when the browser window is closed by the user. this code is used by some programmers to annoyingly pop up alert boxes preventing the users from leaving the page. closing the window calls this eventhandler on the prefwindow. ...