Search completed in 1.18 seconds.
Using XMLHttpRequest - Web APIs
in this guide, we'll take a look at how to use xm
lhttprequest to issue http requests in order to exchange data between the web site and a server.
... examples of both common and more obscure use cases for xm
lhttprequest are included.
... to send an http request, create an xm
lhttprequest object, open a url, and send the request.
...And 42 more matches
XMLHttpRequest - Web APIs
xm
lhttprequest (xhr) objects are used to interact with servers.
...xm
lhttprequest is used heavily in ajax programming.
..."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" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/xm
lhttprequesteventtarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xm
lhttprequesteventtarget</text></a><polyline points="401,25 411,20 411,30 401,25" stroke="#d4dde4" fill="none"...
...And 39 more matches
HTMLHyperlinkElementUtils - Web APIs
the htm
lhyperlinkelementutils mixin defines utility methods and properties to work with htmlanchorelement and htmlareaelement.
... htm
lhyperlinkelementutils.href this a stringifier property that returns a usvstring containing the whole url, and allows the href to be updated.
... htm
lhyperlinkelementutils.protocol this is a usvstring containing the protocol scheme of the url, including the final ':'.
...And 12 more matches
HTML in XMLHttpRequest - Web APIs
the w3c xm
lhttprequest specification adds html parsing support to xm
lhttprequest, which originally supported only xml parsing.
... this feature allows web apps to obtain an html resource as a parsed dom using xm
lhttprequest.
... to get an overview of how to use xm
lhttprequest in general, see using xm
lhttprequest.
...And 12 more matches
HTMLHRElement - Web APIs
the htm
lhrelement interface provides special properties (beyond those of the htmlelement interface it also has available to it by inheritance) for manipulating <hr> elements.
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htm
lhrelement" target="_top"><rect x="361" y="65" width="130" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="426" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htm
lhrelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits pro...
... htm
lhrelement.align is a domstring, an enumerated attribute indicating alignment of the rule with respect to the surrounding context.
...And 8 more matches
XMLHttpRequestEventTarget - Web APIs
xm
lhttprequesteventtarget is the interface that describes the event handlers you can implement in an object that will handle events for an xm
lhttprequest.
..."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" alignment-baseline="middle">eventtarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#d4dde4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/xm
lhttprequesteventtarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">xm
lhttprequesteventtarget</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} ...
...properties xm
lhttprequesteventtarget.onabort contains the function to call when a request is aborted and the abort event is received by this object.
...And 7 more matches
nsIGlobalHistory3
docshell/base/nsigloba
lhistory3.idlscriptable this interface provides information about global history to gecko.
... 1.0 66 introduced gecko 1.8 obsolete gecko 9.0 inherits from: nsigloba
lhistory2 last changed in gecko 1.9 (firefox 3) this interface was originally created as part of nsigloba
lhistory2, but was split off during the transition to places.
...this function is preferred if nsigloba
lhistory3 is available.
...And 6 more matches
HTMLHtmlElement - Web APIs
the htm
lhtmlelement interface serves as the root node for a given html document.
... you can retrieve the htm
lhtmlelement object for a given document by reading the value of the document.documentelement property.
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htm
lhtmlelement" target="_top"><rect x="341" y="65" width="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htm
lhtmlelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits...
...And 6 more matches
nsIXMLHttpRequest
nsixm
lhttprequest along with nsijsxm
lhttprequest and nsixm
lhttprequesteventtarget are mozilla's implementation details of the dom xm
lhttprequest object.
... note: if you're a web developer or a mozilla add-on developer, please refer to the xm
lhttprequest documentation instead.
... the interface definition: //github.com/realityripple/uxp/blob/master/dom/xhr/nsixm
lhttprequest.idl elevated privileges as mentioned in the "non-standard properties" the property of channel was read-only.
...And 5 more matches
HTMLHeadElement - Web APIs
the htm
lheadelement interface contains the descriptive information, or metadata, for a document.
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htm
lheadelement" target="_top"><rect x="341" y="65" width="150" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htm
lheadelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits...
... htm
lheadelement.profile is a domstring representing the uris of one or more metadata profiles (white space separated).
...And 5 more matches
Element.scrollHeight - Web APIs
the element.scrol
lheight read-only property is a measurement of the height of an element's content, including content not visible on the screen due to overflow.
... the scrol
lheight value is equal to the minimum height the element would require in order to fit all the content in the viewport without using a vertical scrollbar.
...if the element's content can fit without a need for vertical scrollbar, its scrol
lheight is equal to clientheight this property will round the value to an integer.
...And 4 more matches
HTMLHeadingElement - Web APIs
the htm
lheadingelement interface represents the different heading elements, <h1> through <h6>.
...naco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlelement</text></a><polyline points="491,25 501,20 501,30 491,25" stroke="#d4dde4" fill="none"/><line x1="501" y1="25" x2="509" y2="25" stroke="#d4dde4"/><line x1="509" y1="25" x2="509" y2="90" stroke="#d4dde4"/><line x1="509" y1="90" x2="492" y2="90" stroke="#d4dde4"/><a xlink:href="/docs/web/api/htm
lheadingelement" target="_top"><rect x="311" y="65" width="180" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="401" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htm
lheadingelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties in...
... htm
lheadingelement.align is a domstring representing an enumerated attribute indicating alignment of the heading with respect to the surrounding context.
...And 4 more matches
XMLHttpRequest.responseType - Web APIs
the xm
lhttprequest property responsetype is an enumerated string value specifying the type of data contained in the response.
... syntax var type = xm
lhttprequest.responsetype; xm
lhttprequest.responsetype = type; value a string taken from the xm
lhttprequestresponsetype enum which specifies what type of data the response contains.
...see html in xm
lhttprequest to learn more about using xhr to fetch html content.
...And 4 more matches
XMLHttpRequest.send() - Web APIs
the xm
lhttprequest method send() sends the request to the server.
... syntax xm
lhttprequest.send(body) parameters body optional a body of data to be sent in the xhr request.
... an xm
lhttprequestbodyinit, which per the fetch spec can be a blob, buffersource, formdata, urlsearchparams, or usvstring object.
...And 4 more matches
HTMLImageElement.naturalHeight - Web APIs
the htmlimageelement interface's natura
lheight property is a read-only value which returns the intrinsic (natural), density-corrected height of the image in css pixels.
... syntax let natura
lheight = htmlimageelement.natura
lheight; value an integer value indicating the intrinsic height, in css pixels, of the image.
... if the intrinsic height is not available—either because the image does not specify an intrinsic height or because the image data is not available in order to obtain this information, natura
lheight returns 0.
...And 3 more matches
Screen.availHeight - Web APIs
the read-only screen interface's avai
lheight property returns the height, in css pixels, of the space available for web content on the screen.
... since screen is exposed on the window interface's window.screen property, you access avai
lheight using window.screen.avai
lheight.
... syntax let avai
lheight = window.screen.avai
lheight; value a numeric value indicating the number of css pixels tall the screen's available space is.
...And 3 more matches
XMLHttpRequest() - Web APIs
the xm
lhttprequest() constructor creates a new xm
lhttprequest.
... for details about how to use xm
lhttprequest, see using xm
lhttprequest.
... syntax const request = new xm
lhttprequest(); parameters none.
...And 3 more matches
Navigator.registerProtocolHandler() - Web APIs
the navigator method registerprotoco
lhandler() lets web sites register their ability to open or handle particular url schemes (aka protocols).
... syntax navigator.registerprotoco
lhandler(scheme, url, title); note: recently updated to navigator.registerprotoco
lhandler(scheme, url), but no browsers currently support this version.
... permitted schemes for security reasons, registerprotoco
lhandler() restricts which schemes can be registered.
...And 2 more matches
XMLHttpRequest.getAllResponseHeaders() - Web APIs
the xm
lhttprequest method getallresponseheaders() returns all the response headers, separated by crlf, as a string, or returns null if no response has been received.
... syntax var headers = xm
lhttprequest.getallresponseheaders(); parameters none.
... example this example examines the headers in the request's readystatechange event handler, xm
lhttprequest.onreadystatechange.
...And 2 more matches
XMLHttpRequest.overrideMimeType() - Web APIs
the xm
lhttprequest method overridemimetype() specifies a mime type other than the one provided by the server to be used instead when interpreting the data being transferred in a request.
... syntax xm
lhttprequest.overridemimetype(mimetype) parameters mimetype a domstring specifying the mime type to use instead of the one specified by the server.
... if the server doesn't specify a type, xm
lhttprequest assumes "text/xml".
...And 2 more matches
XMLHttpRequest.response - Web APIs
the xm
lhttprequest response property returns the response's body content as an arraybuffer, blob, document, javascript object, or domstring, depending on the value of the request's responsetype property.
... syntax var body = xm
lhttprequest.response; value an appropriate object based on the value of responsetype.
...see html in xm
lhttprequest to learn more about using xhr to fetch html content.
...And 2 more matches
XMLHttpRequest.responseText - Web APIs
the read-only xm
lhttprequest property responsetext returns the text received from a server following a request being sent.
... syntax var resulttext = xm
lhttprequest.responsetext; value a domstring which contains either the textual data received using the xm
lhttprequest or null if the request failed or "" if the request has not yet been sent by calling send().
... you know the entire content has been received when the value of readystate becomes xm
lhttprequest.done (4), and status becomes 200 ("ok").
...And 2 more matches
XMLHttpRequest.timeout - Web APIs
the xm
lhttprequest.timeout property is an unsigned long representing the number of milliseconds a request can take before automatically being terminated.
...timeout shouldn't be used for synchronous xm
lhttprequests requests used in a document environment or it will throw an invalidaccesserror exception.
... example var xhr = new xm
lhttprequest(); xhr.open('get', '/server', true); xhr.timeout = 2000; // time in milliseconds xhr.onload = function () { // request finished.
...And 2 more matches
PLHashNumber
syntax #include <p
lhash.h> typedef pruint32 p
lhashnumber; #define pl_hash_bits 32 description p
lhashnumber is an unsigned 32-bit integer.
... p
lhashnumber is the data type of the return value of a hash function.
... the macro pl_hash_bits is the size (in bits) of the p
lhashnumber data type and has the value of 32.
... see also p
lhashfunction ...
nsIGlobalHistory2
docshell/base/nsigloba
lhistory2.idlscriptable this interface provides information about global history to gecko.
... it was split off from nsigloba
lhistory during the transition to toolkit interfaces.
... inherits from: nsisupports last changed in gecko 1.7 this interface replaces and deprecates nsigloba
lhistory method overview void adduri(in nsiuri auri, in boolean aredirect, in boolean atoplevel, in nsiuri areferrer); boolean isvisited(in nsiuri auri); void setpagetitle(in nsiuri auri, in astring atitle); methods adduri() add a uri to global history.
... see also nsigloba
lhistory3 ...
nsIProtocolHandler
netwerk/base/nsiprotoco
lhandler.idlscriptable this interface is used to implement protocol handlers.
...if the protocol supports transparent proxying, the handler should implement the nsiproxiedprotoco
lhandler interface.
... if the protocol only supports http proxying, it doesn't need to support nsiproxiedprotoco
lhandler, but should instead set the allows_proxy_http flag.
... see also nsiproxiedprotoco
lhandler adding a new protocol to mozilla writing a firefox protocol handler custom about: urls - similar to adding new protocol but adding onto the existing about: protocol ...
XMLHttpRequest.abort() - Web APIs
the xm
lhttprequest.abort() method aborts the request if it has already been sent.
... when a request is aborted, its readystate is changed to xm
lhttprequest.unsent (0) and the request's status code is set to 0.
... syntax xm
lhttprequest.abort() parameters none.
... var xhr = new xm
lhttprequest(), method = "get", url = "https://developer.mozilla.org/"; xhr.open(method, url, true); xhr.send(); if (oh_noes_we_need_to_cancel_right_now_or_else) { xhr.abort(); } specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequest.getResponseHeader() - Web APIs
the xm
lhttprequest method getresponseheader() returns the string containing the text of a particular header's value.
... syntax var myheader = xm
lhttprequest.getresponseheader(headername); parameters headername a bytestring indicating the name of the header you want to return the text value of.
...if the content-type isn't the desired value, the xm
lhttprequest is canceled by calling abort().
... var client = new xm
lhttprequest(); client.open("get", "unicorns-are-teh-awesome.txt", true); client.send(); client.onreadystatechange = function() { if(this.readystate == this.headers_received) { var contenttype = client.getresponseheader("content-type"); if (contenttype != my_expected_type) { client.abort(); } } } specifications specification status comment xm
lhttprequestthe definition of 'getresponseheader()' in that specification.
XMLHttpRequest.onreadystatechange - Web APIs
the xm
lhttprequest.onreadystatechange property contains the event handler to be called when the readystatechange event is fired, that is every time the readystate property of the xm
lhttprequest changes.
... syntax xm
lhttprequest.onreadystatechange = callback; values callback is the function to be executed when the readystate changes.
... examples const xhr = new xm
lhttprequest(), method = "get", url = "https://developer.mozilla.org/"; xhr.open(method, url, true); xhr.onreadystatechange = function () { // in local files, status is 0 upon success in mozilla firefox if(xhr.readystate === xm
lhttprequest.done) { var status = xhr.status; if (status === 0 || (status >= 200 && status < 400)) { // the request has been completed successfully console.log(xhr.responsetext); } else { // oh no!
... } } }; xhr.send(); specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequest.readyState - Web APIs
the xm
lhttprequest.readystate property returns the state an xm
lhttprequest client is in.
... unsent the xm
lhttprequest client has been created, but the open() method hasn't been called yet.
... example var xhr = new xm
lhttprequest(); console.log('unsent', xhr.readystate); // readystate will be 0 xhr.open('get', '/api', true); console.log('opened', xhr.readystate); // readystate will be 1 xhr.onprogress = function () { console.log('loading', xhr.readystate); // readystate will be 3 }; xhr.onload = function () { console.log('done', xhr.readystate); // readystate will be 4 }; xhr.send(null); specificat...
...ions specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequest.responseXML - Web APIs
the xm
lhttprequest.responsexml read-only property returns a document containing the html or xml retrieved by the request; or null if the request was unsuccessful, has not yet been sent, or if the data can't be parsed as xml or html.
... if the server doesn't specify the content-type as "text/xml" or "application/xml", you can use xm
lhttprequest.overridemimetype() to parse it as xml anyway.
... syntax var data = xm
lhttprequest.responsexml; value a document from parsing the xml or html received using xm
lhttprequest, or null if no data was received or if the data is not xml/html.
... example var xhr = new xm
lhttprequest; xhr.open('get', '/server'); // if specified, responsetype must be empty string or "document" xhr.responsetype = 'document'; // force the response to be parsed as xml xhr.overridemimetype('text/xml'); xhr.onload = function () { if (xhr.readystate === xhr.done && xhr.status === 200) { console.log(xhr.response, xhr.responsexml); } }; xhr.send(); specifications specification status comment xm
lhttprequestthe definition of 'responsexml' in that specification.
XMLHttpRequest.sendAsBinary() - Web APIs
the obsolete xm
lhttprequest method sendasbinary() is a variant of the send() method that sends binary data.
... syntax xm
lhttprequest.sendasbinary(binarystring); parameters binarystring a domstring which encodes the binary content to be sent.
... /*\ |*| |*| :: xm
lhttprequest.prototype.sendasbinary() polyfill :: |*| |*| https://developer.mozilla.org/docs/dom/xm
lhttprequest#sendasbinary() |*| \*/ if (!xm
lhttprequest.prototype.sendasbinary) { xm
lhttprequest.prototype.sendasbinary = function (sdata) { var nbytes = sdata.length, ui8data = new uint8array(nbytes); for (var nidx = 0; nidx < nbytes; nidx++) { ui8data[nidx] = sdata.charcodeat(nidx) & 0xff; ...
...however, on google chrome, when you try to send an arraybuffer, the following warning message will appear: arraybuffer is deprecated in xm
lhttprequest.send().
XMLHttpRequest.upload - Web APIs
the xm
lhttprequest upload property returns an xm
lhttprequestupload object that can be observed to monitor an upload's progress.
... it is an opaque object, but because it's also an xm
lhttprequesteventtarget, event listeners can be attached to track its process.
... timeout ontimeout the upload timed out because a reply did not arrive within the time interval specified by the xm
lhttprequest.timeout.
... specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequest.withCredentials - Web APIs
the xm
lhttprequest.withcredentials property is a boolean that indicates whether or not cross-site access-control requests should be made using credentials such as cookies, authorization headers or tls client certificates.
...xm
lhttprequest from a different domain cannot set cookie values for their own domain unless withcredentials is set to true before making the request.
... note: xm
lhttprequest responses from a different domain cannot set cookie values for their own domain unless withcredentials is set to true before making the request, regardless of access-control- header values.
... example var xhr = new xm
lhttprequest(); xhr.open('get', 'http://example.com/', true); xhr.withcredentials = true; xhr.send(null); specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onabort - Web APIs
the xm
lhttprequesteventtarget.onabort is the function called when an xm
lhttprequest transaction is aborted, such as when the xm
lhttprequest.abort() function is called.
... syntax xm
lhttprequest.onabort = callback; values callback is the function to be executed when the transaction is aborted.
... example var xm
lhttp = new xm
lhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xm
lhttp.open(method, url, true); xm
lhttp.onabort = function () { console.log('** the request was aborted'); }; xm
lhttp.send(); //..
... xm
lhttp.abort(); // this will invoke our onabort handler above specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onload - Web APIs
the xm
lhttprequesteventtarget.onload is the function called when an xm
lhttprequest transaction completes successfully.
... syntax xm
lhttprequest.onload = callback; values callback is the function to be executed when the request completes successfully.
...the context) is the same xm
lhttprequest this callback is related to.
... example var xm
lhttp = new xm
lhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xm
lhttp.open(method, url, true); xm
lhttp.onload = function () { // do something with the retrieved data ( found in xm
lhttp.response ) }; xm
lhttp.send(); specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequestResponseType - Web APIs
the xm
lhttprequestresponsetype type is an enumerated set of strings which are used to specify the type of data contained in the response of an xm
lhttprequest.
...see html in xm
lhttprequest to learn more about using xhr to fetch html content.
... deprecated values moz-chunked-arraybuffer a firefox-only value which instructs xm
lhttprequest to deliver arraybuffer objects containing chunks of the incoming data.
... specifications specification status comment xm
lhttprequest unknown live standard, latest version ...
PLHashComparator
syntax #include <p
lhash.h> typedef printn (pr_callback *p
lhashcomparator)( const void *v1, const void *v2); description p
lhashcomparator is a function type that compares two values of an unspecified type.
...p
lhashcomparator defines the meaning of equality for the unspecified type.
... remark the return value of p
lhashcomparator functions should be of type prbool.
PLHashEntry
syntax #include <p
lhash.h> typedef struct p
lhashentry p
lhashentry; description p
lhashentry is a structure that represents an entry in the hash table.
... an entry has a key and a value, represented by the following fields in the p
lhashentry structure.
... warning: there are other fields in the p
lhashentry structure besides key and value.
PLHashEnumerator
syntax #include <p
lhash.h> typedef printn (pr_callback *p
lhashenumerator)(p
lhashentry *he, printn index, void *arg); /* return value */ #define ht_enumerate_next 0 /* continue enumerating entries */ #define ht_enumerate_stop 1 /* stop enumerating entries */ #define ht_enumerate_remove 2 /* remove and free the current entry */ #define ht_enumerate_unhash 4 /* just unhash the current entry */ description p
lhashenumerator is a function type used in the enumerating a hash table.
... when all the table entries are enumerated, each entry is passed to a user-specified function of type p
lhashenumerator with the hash table entry, an integer index, and an arbitrary piece of user data as argument.
...the entries are unlinked from the table, they are not freed, but the entry count (the nentries field of the p
lhashtable structure) is not decremented.
nsIExternalURLHandlerService
uriloader/exthandler/nsiexternalur
lhandlerservice.idlscriptable the external url handler service is used for finding platform-specific applications for handling particular urls.
... 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 nsihandlerinfo getur
lhandlerinfofromos(in nsiuri aurl, out boolean afound); methods getur
lhandlerinfofromos() given a url, looks up the handler info from the operating system.
...nsihandlerinfo getur
lhandlerinfofromos( in nsiuri aurl, out boolean afound ); parameters aurl the url we are looking for.
HTMLHyperlinkElementUtils.toString() - Web APIs
the htm
lhyperlinkelementutils.tostring() stringifier method returns a usvstring containing the whole url.
... it is a read-only version of htm
lhyperlinkelementutils.href.
... syntax string = object.tostring(); examples // let's imagine an <a id="myanchor" href="https://developer.mozilla.org/docs/htm
lhyperlinkelementutils/tostring"> element is in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.tostring(); // returns: 'https://developer.mozilla.org/docs/htm
lhyperlinkelementutils/tostring' specifications specification status comment html living standard living standard ...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
here is a an example javascript function that prints the security details of an xm
lhttprequest sent over ssl.
... the function is passed the channel property of an xm
lhttprequest to extract the following information: was the connection secure?
...ganization + "\n"); dump("\tsha1 fingerprint = " + cert.sha1fingerprint + "\n"); var validity = cert.validity.queryinterface(ci.nsix509certvalidity); dump("\tvalid from " + validity.notbeforegmt + "\n"); dump("\tvalid until " + validity.notaftergmt + "\n"); } } catch(err) { alert(err); } } function test(url) { var req = cc["@mozilla.org/xmlextras/xm
lhttprequest;1"].createinstance(); req.open('get', url, true); req.addeventlistener("error", function(e) { var error = createtcperrorfromfailedxhr(req); dumpsecurityinfo(req, error); }, false); req.onload = function(e) { dumpsecurityinfo(req); }; req.send(); } then test("https://addons.mozilla.org"); produced the following output in my console: connection s...
Using XMLHttpRequest in IE6 - Web APIs
xm
lhttprequest was first introduced by microsoft in internet explorer 5.0 as an activex control.
... however, in ie7 and other browsers xm
lhttprequest is a native javascript object.
... in all modern browsers, you can create a new xm
lhttprequest object using the following code: var request = new xm
lhttprequest() however, if you need to also support internet explorer 6 and older, you need to extend your code like this: if (window.xm
lhttprequest) { //firefox, opera, ie7, and other browsers will use the native object var request = new xm
lhttprequest(); } else { //ie 5 and 6 will use the activex control var request = new activexobject("microsoft.xm
lhttp"); } see also using xm
lhttprequest ...
XMLHttpRequest: abort event - Web APIs
the abort event is fired when a request has been aborted, for example because the program called xm
lhttprequest.abort().
...function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xm
lhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xm
lhttprequest living standard ...
XMLHttpRequest: load event - Web APIs
the load event is fired when an xm
lhttprequest transaction completes successfully.
...function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xm
lhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xm
lhttprequest living standard ...
XMLHttpRequest.open() - Web APIs
the xm
lhttprequest method open() initializes a newly-created request, or re-initializes an existing one.
... syntax xm
lhttprequest.open(method, url[, async[, user[, password]]]) parameters method the http request method to use, such as "get", "post", "put", "delete", etc.
... specifications specification status comment xm
lhttprequestthe definition of 'open()' in that specification.
XMLHttpRequest.setRequestHeader() - Web APIs
the xm
lhttprequest method setrequestheader() sets the value of an http request header.
... syntax xm
lhttprequest.setrequestheader(header, value) parameters header the name of the header whose value is to be set.
... specifications specification status comment xm
lhttprequestthe definition of 'setrequestheader()' in that specification.
XMLHttpRequest.status - Web APIs
the read-only xm
lhttprequest.status property returns the numerical http status code of the xm
lhttprequest's response.
...browsers also report a status of 0 in case of xm
lhttprequest errors.
... example var xhr = new xm
lhttprequest(); console.log('unsent: ', xhr.status); xhr.open('get', '/server'); console.log('opened: ', xhr.status); xhr.onprogress = function () { console.log('loading: ', xhr.status); }; xhr.onload = function () { console.log('done: ', xhr.status); }; xhr.send(); /** * outputs the following: * * unsent: 0 * opened: 0 * loading: 200 * done: 200 */ specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequest.statusText - Web APIs
the read-only xm
lhttprequest.statustext property returns a domstring containing the response's status message as returned by the http server.
... unlike xm
lhttprequest.status which indicates a numerical status code, this property contains the text of the response status, such as "ok" or "not found".
... example var xhr = new xm
lhttprequest(); console.log('0 unsent', xhr.statustext); xhr.open('get', '/server', true); console.log('1 opened', xhr.statustext); xhr.onprogress = function () { console.log('3 loading', xhr.statustext); }; xhr.onload = function () { console.log('4 done', xhr.statustext); }; xhr.send(null); /** * outputs the following: * * 0 unsent * 1 opened * 3 loading ok * 4 done ok */ specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onerror - Web APIs
the xm
lhttprequesteventtarget.onerror is the function called when an xm
lhttprequest transaction fails due to an error.
... syntax xm
lhttprequest.onerror = callback; values callback is the function to be executed when the request fails.
... example var xm
lhttp = new xm
lhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xm
lhttp.open(method, url, true); xm
lhttp.onerror = function () { console.log("** an error occurred during the transaction"); }; xm
lhttp.send(); specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onloadstart - Web APIs
the xm
lhttprequesteventtarget.onloadstart is the function called when an xm
lhttprequest transaction starts transferring data.
... syntax xm
lhttprequest.onloadstart = callback; values callback is the function to be called when the transaction begins to transfer data.
... example var xm
lhttp = new xm
lhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xm
lhttp.open(method, url, true); xm
lhttp.onloadstart = function () { console.log("download underway"); }; xm
lhttp.send(); specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
XMLHttpRequestEventTarget.onprogress - Web APIs
the xm
lhttprequesteventtarget.onprogress is the function called periodically with information when an xm
lhttprequest before success completely.
... syntax xm
lhttprequest.onprogress = callback; values callback is the function to be called periodically before the request is completed.
... xm
lhttprequest.onprogress = function (event) { event.loaded; event.total; }; example var xm
lhttp = new xm
lhttprequest(), method = 'get', url = 'https://developer.mozilla.org/'; xm
lhttp.open(method, url, true); xm
lhttp.onprogress = function () { //do something }; xm
lhttp.send(); specifications specification status comment xm
lhttprequest living standard whatwg living standard ...
PLHashTable
syntax #include <p
lhash.h> typedef struct p
lhashtable p
lhashtable; description the opaque p
lhashtable structure represents a hash table.
... entries in the table have the type p
lhashentry and are organized into buckets.
JS::NullHandleValue
syntax const js::handlevalue js::nul
lhandlevalue; description js::nul
lhandlevalue is a js::handlevalue constant that represents the javascript value null.
... see also mxr id search for js::nul
lhandlevalue js::undefinedhandlevalue js::truehandlevalue js::falsehandlevalue bug 865969 ...
nsIExternalHelperAppService
uriloader/exthandler/nsiexterna
lhelperappservice.idlscriptable the external helper app service is used for finding and launching platform specific external applications for a given mime content type.
...to access this service, use: var externa
lhelperappservice = components.classes["@mozilla.org/uriloader/external-helper-app-service;1"] .getservice(components.interfaces.nsiexterna
lhelperappservice); method overview boolean applydecodingforextension(in autf8string aextension, in acstring aencodingtype); nsistreamlistener docontent(in acstring amimecontenttype, in nsirequest arequest, in nsiinterfacerequestor awindowcontext, in boolean aforcesave); methods applydecodingforextension() determines whether or not data whose filename has the specified extension should be decoded from the specified encoding type befor...
nsIFileProtocolHandler
netwerk/protocol/file/nsifileprotoco
lhandler.idlscriptable this interface provides methods to convert between nsifile and nsiuri.
... inherits from: nsiprotoco
lhandler last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) method overview nsifile getfilefromurlspec(in autf8string url); autf8string geturlspecfromactualfile(in nsifile file); autf8string geturlspecfromdir(in nsifile file); autf8string geturlspecfromfile(in nsifile file); nsiuri newfileuri(in nsifile afile); nsiuri readurlfile(in nsifile file); methods getfilefromurlspec() converts the url string into the corresponding nsifile if possible.
nsIXMLHttpRequestEventTarget
content/base/public/nsixm
lhttprequest.idlscriptable this interface provides access to the event listeners used when uploading data using the xm
lhttprequest object.
...see also using xm
lhttprequest xm
lhttprequest nsixm
lhttprequest nsidomprogressevent ...
nsIXMLHttpRequestUpload
content/base/public/nsixm
lhttprequest.idlscriptable this interface provides access to the features needed when uploading data using nsixm
lhttprequest.
...monkey 2.0) attributes attribute type description onabort nsidomeventlistener onerror nsidomeventlistener onload nsidomeventlistener onloadstart nsidomeventlistener onprogress nsidomeventlistener see also nsixm
lhttprequest nsixm
lhttprequesteventtarget xm
lhttprequest using xm
lhttprequest ...
HTMLHyperlinkElementUtils.hash - Web APIs
the htm
lhyperlinkelementutils.hash property returns a usvstring containing a '#' followed by the fragment identifier of the url.
... syntax string = object.hash; object.hash = string; examples <a id="myanchor" href="/docs/htm
lhyperlinkelementutils.href#examples">examples</a> <script> var anchor = document.getelementbyid("myanchor"); console.log(anchor.hash); // returns '#examples' </script> specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.hash' in that specification.
HTMLHyperlinkElementUtils.host - Web APIs
the htm
lhyperlinkelementutils.host property is a usvstring containing the host, that is the hostname, and then, if the port of the url is nonempty, a ':', and the port of the url.
... syntax string = object.host; object.host = string; examples var anchor = document.createelement("a"); anchor.href = "https://developer.mozilla.org/htm
lhyperlinkelementutils.host" anchor.host == "developer.mozilla.org" anchor.href = "https://developer.mozilla.org:443/htm
lhyperlinkelementutils.host" anchor.host == "developer.mozilla.org" // the port number is not included because 443 is the scheme's default port anchor.href = "https://developer.mozilla.org:4097/htm
lhyperlinkelementutils.host" anchor.host == "developer.mozilla.org:4097" specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.host' in that specification.
HTMLHyperlinkElementUtils.hostname - Web APIs
the htm
lhyperlinkelementutils.hostname property is a usvstring containing the domain of the url.
... syntax string = object.hostname; object.hostname = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org/docs/htm
lhyperlinkelementutils.hostname"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.hostname; // returns:'developer.mozilla.org' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.hostname' in that specification.
HTMLHyperlinkElementUtils.href - Web APIs
the htm
lhyperlinkelementutils.href property is a stringifier that returns a usvstring containing the whole url, and allows the href to be updated.
... syntax string = object.href; object.href = string; examples // lets imagine an <a id="myanchor" href="https://developer.mozilla.org/htm
lhyperlinkelementutils/href"> element is in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.href; // returns: 'https://developer.mozilla.org/htm
lhyperlinkelementutils/href' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.href' in that specification.
HTMLHyperlinkElementUtils.origin - Web APIs
the htm
lhyperlinkelementutils.origin read-only property is a usvstring containing the unicode serialization of the origin of the represented url; that is: for url using the http or https, the scheme followed by '://', followed by the domain, followed by ':', followed by the port (the default port, 80 and 443 respectively, if explicitely specified); for url using file: scheme, the value is browser dependant; for url using the blob: scheme, the origin of the url following blob:.
... syntax string = object.origin; examples // on this page, returns the origin var result = window.location.origin; // returns:'https://developer.mozilla.org' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.origin' in that specification.
HTMLHyperlinkElementUtils.password - Web APIs
the htm
lhyperlinkelementutils.password property is a usvstring containing the password specified before the domain name.
... syntax string = object.password; object.password = string; examples // let's <a id="myanchor" href="https://anonymous:flabada@developer.mozilla.org/docs/htm
lhyperlinkelementutils.username"> be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.password; // returns:'flabada' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.password' in that specification.
HTMLHyperlinkElementUtils.pathname - Web APIs
the htm
lhyperlinkelementutils.pathname property is a usvstring containing an initial '/' followed by the path of the url (or the empty string if there is no path).
... syntax string = object.pathname; object.pathname = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org/docs/htm
lhyperlinkelementutils.pathname"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.pathname; // returns:'/docs/htm
lhyperlinkelementutils.pathname' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.pathname' in that specification.
HTMLHyperlinkElementUtils.port - Web APIs
the htm
lhyperlinkelementutils.port property is a usvstring containing the port number of the url.
... syntax string = object.port; object.port = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org:443/docs/htm
lhyperlinkelementutils.port"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.port; // returns:'443' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.port' in that specification.
HTMLHyperlinkElementUtils.protocol - Web APIs
the htm
lhyperlinkelementutils.protocol property is a usvstring representing the protocol scheme of the url, including the final ':'.
... syntax string = object.protocol; object.protocol = string; examples // let's an <a id="myanchor" href="https://developer.mozilla.org/htm
lhyperlinkelementutils.protocol"> element be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.protocol; // returns:'https:' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.protocol' in that specification.
HTMLHyperlinkElementUtils.search - Web APIs
the htm
lhyperlinkelementutils.search property is a search string, also called a query string, that is usvstring containing a '?' followed by the parameters of the url.
... syntax string = object.search; object.search = string; examples // let an <a id="myanchor" href="https://developer.mozilla.org/docs/htm
lhyperlinkelementutils.search?q=123"> element be in the document var anchor = document.getelementbyid("myanchor"); var querystring = anchor.search; // returns:'?q=123' // further parsing: let params = new urlsearchparams(querystring); let q = parseint(params.get("q")); // is the number 123 specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.search' in that specification.
HTMLHyperlinkElementUtils.username - Web APIs
the htm
lhyperlinkelementutils.username property is a usvstring containing the username specified before the domain name.
... syntax string = object.username; object.username = string; examples // let's <a id="myanchor" href="https://anonymous:flabada@developer.mozilla.org/docs/htm
lhyperlinkelementutils.username"> be in the document var anchor = document.getelementbyid("myanchor"); var result = anchor.username; // returns:'anonymous' specifications specification status comment html living standardthe definition of 'htm
lhyperlinkelementutils.username' in that specification.
XMLHttpRequest: error event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xm
lhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xm
lhttprequest living standard ...
XMLHttpRequest: loadend event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xm
lhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xm
lhttprequest living standard ...
XMLHttpRequest: loadstart event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xm
lhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xm
lhttprequest living standard ...
XMLHttpRequest: progress event - Web APIs
function addlisteners(xhr) { xhr.addeventlistener('loadstart', handleevent); xhr.addeventlistener('load', handleevent); xhr.addeventlistener('loadend', handleevent); xhr.addeventlistener('progress', handleevent); xhr.addeventlistener('error', handleevent); xhr.addeventlistener('abort', handleevent); } function runxhr(url) { log.textcontent = ''; const xhr = new xm
lhttprequest(); addlisteners(xhr); xhr.open("get", url); xhr.send(); return xhr; } xhrbuttonsuccess.addeventlistener('click', () => { runxhr('https://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg'); }); xhrbuttonerror.addeventlistener('click', () => { runxhr('https://somewhere.org/i-dont-exist'); }); xhrbuttonabort.addeventlistener('click', () => { runxhr('https...
...://mdn.mozillademos.org/files/16553/dgszyjnxcaipwzy.jpg').abort(); }); result specifications specification status comment xm
lhttprequest living standard ...
Index - Web APIs
requests are guaranteed to be initiated before a page is unloaded and they are run to completion, without requiring a blocking request (for example xm
lhttprequest).
... 1008 document: readystatechange event event, reference, xm
lhttprequest, interactive the readystatechange event is fired when the readystate attribute of a document has changed.
... 1117 element.getboundingclientrect() api, boundary, bounding, bounds, cssom view, client, containing, dom, element, enclosing, method, minimum, rectangle, reference, smallest, clientheight, getboundingclientrect, getclientrects, offsetheight, scrol
lheight the element.getboundingclientrect() method returns the size of an element and its position relative to the viewport.
...And 103 more matches
The Essentials of an Extension - Archive of obsolete content
if we open the chrome.manifest file (again, any text editor will do), we see that the same 3 sections are mentioned: content xulschoo
lhello content/ skin xulschoo
lhello classic/1.0 skin/ locale xulschoo
lhello en-us locale/ the chrome.manifest file tells firefox where to look for chrome files.
...if our extension needed to look differently on different systems, we could change the manifest file so that it looks like this: content xulschoo
lhello content/ skin xulschoo
lhello classic/1.0 skin/unix/ skin xulschoo
lhello classic/1.0 skin/mac/ os=darwin skin xulschoo
lhello classic/1.0 skin/win/ os=winnt locale xulschoo
lhello en-us locale/ this way we can have separate skins for windows, mac os x, and linux (plus other unix-like systems), each defined in a separate directory.
...this is what a chrome uri looks like: chrome://packagename/section/path/to/file so, for instance, if i want to access the file browseroverlay.xul in the extension, the chrome uri would be chrome://xulschoo
lhello/content/browseroverlay.xul.
...And 17 more matches
HTMLAnchorElement - Web APIs
ll="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="406" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlanchorelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement, and implements those from htm
lhyperlinkelementutils.
... htm
lhyperlinkelementutils.hash is a usvstring representing the fragment identifier, including the leading hash mark ('#'), if any, in the referenced url.
... htm
lhyperlinkelementutils.host is a usvstring representing the hostname and port (if it's not the default port) in the referenced url.
...And 13 more matches
HTMLAreaElement - Web APIs
fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="416" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlareaelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement, and implements those from htm
lhyperlinkelementutils.
... htm
lhyperlinkelementutils.hash is a usvstring containing the fragment identifier (including the leading hash mark (#)), if any, in the referenced url.
... htm
lhyperlinkelementutils.host is a usvstring containing the hostname and port (if it's not the default port) in the referenced url.
...And 13 more matches
Getting Started - Developer guides
in a nutshell, it is the use of the xm
lhttprequest object to communicate with servers.
...this is where xm
lhttprequest comes in.
... its predecessor originated in internet explorer as an activex object called xm
lhttp.
...And 12 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
an example of a cross-origin request: the front-end javascript code served from https://domain-a.com uses xm
lhttprequest to make a request for https://domain-b.com/data.json.
...for example, xm
lhttprequest and the fetch api follow the same-origin policy.
...modern browsers use cors in apis such as xm
lhttprequest or fetch to mitigate the risks of cross-origin http requests.
...And 12 more matches
Synchronous and asynchronous requests - Web APIs
xm
lhttprequest supports both synchronous and asynchronous communications.
... asynchronous request if you use an asynchronous xm
lhttprequest, you receive a callback when the data has been received.
... example: send a file to the console log this is the simplest usage of asynchronous xm
lhttprequest.
...And 11 more matches
Sending forms through JavaScript - Learn web development
but forms can also prepare an http request to send via javascript, for example via xm
lhttprequest.
... the xm
lhttprequest (xhr) dom object can build http requests, send them, and retrieve their results.
... historically, xm
lhttprequest was designed to fetch and send xml as an exchange format, which has since been superceded by json.
...And 10 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
an implementation can also use other transport technologies such as soap-based remote procedure calls, xm
lhttprequest interfaces, or dom 3 load.
...this implementation uses xm
lhttprequest.
...there are basically two steps in this process: data load: acquisition of information data acquisition can be implemented using javascript and remote procedure calls using soap-based rpc mechanism or using interfaces like xm
lhttprequest (currently offered in netscape 7 and internet explorer 6).
...And 9 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
i'll also cover nonstandard technologies, such as xm
lhttprequest and rich text editing, that mozilla does support because no w3c equivalent existed at the time.
...it also supports some non-standard internet explorer extensions, such as xm
lhttprequest.
... xm
lhttprequest internet explorer allows you to send and retrieve xml files using msxml's xm
lhttp class, which is instantiated through activex using new activexobject("msxml2.xm
lhttp") or new activexobject("microsoft.xm
lhttp").
...And 9 more matches
Fetching data from the server - Learn web development
this seemingly small detail has had a huge impact on the performance and behavior of sites, so in this article, we'll explain the concept and look at technologies that make it possible, such as xm
lhttprequest and the fetch api.
... this is achieved by using apis like xm
lhttprequest or — more recently — the fetch api.
... note: in the early days, this general technique was known as asynchronous javascript and xml (ajax), because it tended to use xm
lhttprequest to request xml data.
...And 9 more matches
Index
512 nsidomprogressevent interfaces, interfaces:scriptable, reference, xm
lhttprequest, xpcom interface reference, nsidomprogressevent, progress the nsidomprogressevent is used in the media elements (<video> and <audio>) to inform interested code of the progress of the media download.
... 592 nsiextensionmanager disambiguation, needscontent, needshelp, xpcom, xpcom interface reference unfortunately, at the time of this writing there are two nsiextensionmanager interfaces: 593 nsiexterna
lhelperappservice interfaces, mime implemented by: @mozilla.org/uriloader/external-helper-app-service;1.
... 595 nsiexternalur
lhandlerservice interfaces, interfaces:scriptable given a url, looks up the handler info from the operating system.
...And 9 more matches
nsIExternalProtocolService
uriloader/exthandler/nsiexternalprotocolservice.idlscriptable the external protocol service is used for finding and launching web handlers (a la registerprotoco
lhandler in the html5 draft) or platform-specific applications for handling particular protocols.
...method overview boolean externalprotoco
lhandlerexists(in string aprotocolscheme); astring getapplicationdescription(in autf8string ascheme); nsihandlerinfo getprotoco
lhandlerinfo(in acstring aprotocolscheme); nsihandlerinfo getprotoco
lhandlerinfofromos(in acstring aprotocolscheme, out boolean afound); boolean isexposedprotocol(in string aprotocolscheme); void loaduri(in nsiuri auri, [optional] in nsiinterfacerequestor awindowcontext); void loadurl(in nsiuri aurl); void setprotoco
lhandlerdefaults(in nsihandlerinfo ahandlerinfo, in boolean aosh...
...andlerexists); methods externalprotoco
lhandlerexists() check whether a handler for a specific protocol exists.
...And 9 more matches
<color> - CSS: Cascading Style Sheets
-moz-cel
lhighlight background color for selected item in a tree widget.
... should be used with the -moz-cel
lhighlighttext foreground color.
... see also -moz-html-cel
lhighlight.
...And 9 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
<overlay id="xulschoo
lhello-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <toolbarpalette id="browsertoolbarpalette"> <toolbarbutton id="xulschoo
lhello-hello-world-button" class="toolbarbutton-1 chromeclass-toolbar-additional" label="&xulschoo
lhello.helloworld.label;" tooltiptext="&xulschoo
lhello.helloworld.tooltip;" oncommand="xulschoolchrome.bro...
... setting the image for a toolbar button is done with css: #xulschoo
lhello-hello-world-button { list-style-image: url("chrome://xulschoo
lhello/skin/hello-world.png"); } it's not really that simple to set the image for a toolbar button, because we need to consider the appearance of the button on different systems, and also consider the different button states, but we'll get into that further ahead.
...the way to include the file in the manifest is to add this line: style chrome://global/content/customizetoolbar.xul chrome://xulschoo
lhello/skin/toolbar.css if you are using xbl bindings (explained way ahead) for your toolbar items, you'll have to include the css files for those as well, each in a new line like the one above.
...And 8 more matches
Sending and Receiving Binary Data - Web APIs
receiving binary data using javascript typed arrays the responsetype property of the xm
lhttprequest object can be set to change the expected response type from the server.
... var oreq = new xm
lhttprequest(); oreq.open("get", "/myfile.png", true); oreq.responsetype = "arraybuffer"; oreq.onload = function (oevent) { var arraybuffer = oreq.response; // note: not oreq.responsetext if (arraybuffer) { var bytearray = new uint8array(arraybuffer); for (var i = 0; i < bytearray.bytelength; i++) { // do something with each byte in the array } } }; oreq.send(null); you...
... var oreq = new xm
lhttprequest(); oreq.open("get", "/myfile.png", true); oreq.responsetype = "blob"; oreq.onload = function(oevent) { var blob = oreq.response; // ...
...And 8 more matches
Observer Notifications - Archive of obsolete content
this example code shows you what an implementation of the nsiobserver interface looks like: let testobserver = { observe : function(asubject, atopic, adata) { if (atopic == "xulschoo
lhello-test-topic") { window.alert("data received: " + adata); } } } in order for this observer to work, you need to use the observer service that provides methods for you to add, remove, notify and enumerate observers.
... getservice(components.interfaces.nsiobserverservice); observerservice.addobserver(testobserver, "xulschoo
lhello-test-topic", false); you should come up with a notification topic that is unique so you know it will not conflict with firefox or other extensions topics.
... observerservice.removeobserver(testobserver, "xulschoo
lhello-test-topic"); after you have registered some observers to listen to a notification topic, you can then use the notifyobservers method to send a notification to all of them.
...And 7 more matches
nsIIOService
inherits from: nsisupports last changed in gecko 1.2 this interface duplicates many of the nsiprotoco
lhandler methods in a protocol handler independent way (for example newuri() inspects the scheme in order to delegate creation of the new uri to the appropriate protocol handler).
...lla.org/network/io-service;1 as a service: var ioservice = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); method overview boolean allowport(in long aport, in string ascheme); acstring extractscheme(in autf8string urlstring); unsigned long getprotocolflags(in string ascheme); nsiprotoco
lhandler getprotoco
lhandler(in string ascheme); nsichannel newchannel(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri); obsolete since gecko 48 nsichannel newchannel2(in autf8string aspec, in string aorigincharset, in nsiuri abaseuri, in nsidomnode aloadingnode, in nsiprincipal aloadingprincipal, in nsiprincipal atriggeringprincipal, in uint32_t asecurityflags, i...
... is similar to nsiprotoco
lhandler.allowport().
...And 7 more matches
Index - Archive of obsolete content
95 net/xhr provides access to xm
lhttprequest functionality.
... 189 html to dom code snippets, dom, guide, html, intermediate, needsupdate although you can now natively parse html using domparser and xm
lhttprequest, this is a new feature that is not yet supported by all browsers in use in the wild.
... 230 displaying web content in an extension without security issues extensions, security, xm
lhttprequest, xul one of the most common security issues with extensions is execution of remote code in privileged context.
...And 6 more matches
Using the Places history service
the places history service ("navhistory") implements these history interfaces: nsigloba
lhistory2: basic add page, is visited functionality used by the docshell when visiting and rendering pages.
... nsigloba
lhistory3: adds extra functions for dealing with redirects and hints for rendering (gecko flags).
... differences from previous implementations the previous nsgloba
lhistory service stored one entry for each page in history.
...And 6 more matches
Rich-Text Editing in Mozilla - Developer guides
this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option value="red">red</option> <option value="green">green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" onclick="if(validatemode()&&confirm('are you sure?')){odoc.innerhtml=sdeftxt};" src="data:image/gif;base64,r0lgod
lhfgawaiqbad04ktrlyzfrjlldzl9vj1dusy14wyodhpwibbsvfy6o7ioxw5qbms+wubcztca0ccs4kddqjdtltmrl1o3yitha7opcsd/f4pfvrvdv8pv5xv///////////////////yh5baekab8alaaaaaawabyaaav84ceozgmeakqubmteyzk547qobcfwtm/jgshq4rhmloxfiehqqsawr+z4iayaj0kegtfolizlwre4ocqwrxototaihmcz0tvgmbqkzhayyfewev14eq8if
lhnehmfdqkaiskqci2pdc4qbg+oajc0ewadncogo6anqkkoiqa7" /> <img class="intlink" title="print" onclick="printdoc();" src="d...
...aaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaalewaacxmbajqcgaaaaad0su1fb9oebxczfmgboiwaaaaidevydenvbw1lbnqa9sywvwaaaufjrefuomvtlutsjfeux//n3nn0ydpbh1abrpt4lfqtqkc3jrkkneisiiribbehjjpklivo4m1rrmkkjqirmjruqudkpt71qpipirkpaqdf55tv5vvuszjqtjolseukd3xu/3dpzusc/22wtu2wrn+jg5so/ocdh8ycmjdflehmlkjkvk7kuyn+ufza/rtth76zavocdptrxzqtni3mrwupc+6cktlxz/sddp2uu9uxlmyxz6qm8v4tz8
lhf1h+zdqxt7s8olmxtbf4e8qafhjj3kbp2mzkkthpitjp9vh6ihia+whtasx5brpwuemgdondf/2a4m7ukds1jw662+xkqtkeuoqjktojm2h53yfl15psj04zc94wdtibr26fxlc2mzrvbccebz2kirfd414tkmlezbvgt33+qcohgha81swysew0r1uzfnylmtpx80pngqq91lwvk2jgvgnfvzg6ycyrat16gftw5kkkfo1eqltfh5q2ett0biwf+aitq4fdbk+imyo1oxvgf03wafjqvbckvdffryetxqiffygazths0zwagd7fg5tnnyntp8/fzvgwjofmgg7gox0sakkgqgdmgkbi0njgmeimpgdk5+wacewed0ywb
lhguz4hw5oduekrblt7...
...ncee4euyv4pwcpswypw0uhdybkswu1nyjendreqtkjwn2+zvttc1vmstb/mvev/weyslasslimcohobjxw+n3ap/sjefnl5gepzmpu4kg7opr1+tofpyuu3becwykcwqcdfmwfkauo90fhkdinbcamvqnymgqueagqwcohbdc1rjv9pild8ibvkz6qyviibqgtjpx4k0xpigezorn1da0cij4vfr0ta3wvbxh/rjdcufv6r2zpgph/e4pxsbcpeatqprjniso203/5s/za171mv8+w1loaaaaaelftksuqmcc"> <img class="intlink" title="undo" onclick="formatdoc('undo');" src="data:image/gif;base64,r0lgod
lhfgawaomkadljwlie33morpgjuykl8aezxqpd+7/i19dv3nha7p///////////////////////yh5baekaa8alaaaaaawabyaaarr8mljq7046807tkayejjbnes4eeujvigapwyac0csocq7sdlwjkakca6tomywiargqf3mrqviejkksvlibsfewhdrih4fh/dzmice3/c4nbqbads=" /> <img class="intlink" title="redo" onclick="formatdoc('redo');" src="data:image/gif;base64,r0lgod
lhfgawamihab1chdljwl9vj1ie34kl8apd+7/i1////yh5baekaacalaaaaaawabyaaankelrc/jdksesyphi7s...
...And 6 more matches
Making content editable - Developer guides
this.selectedindex].value);this.selectedindex=0;"> <option class="heading" selected>- background -</option> <option value="red">red</option> <option value="green">green</option> <option value="black">black</option> </select> </div> <div id="toolbar2"> <img class="intlink" title="clean" onclick="if(validatemode()&&confirm('are you sure?')){odoc.innerhtml=sdeftxt};" src="data:image/gif;base64,r0lgod
lhfgawaiqbad04ktrlyzfrjlldzl9vj1dusy14wyodhpwibbsvfy6o7ioxw5qbms+wubcztca0ccs4kddqjdtltmrl1o3yitha7opcsd/f4pfvrvdv8pv5xv///////////////////yh5baekab8alaaaaaawabyaaav84ceozgmeakqubmteyzk547qobcfwtm/jgshq4rhmloxfiehqqsawr+z4iayaj0kegtfolizlwre4ocqwrxototaihmcz0tvgmbqkzhayyfewev14eq8if
lhnehmfdqkaiskqci2pdc4qbg+oajc0ewadncogo6anqkkoiqa7" /> <img class="intlink" title="print" onclick="printdoc();" src="d...
...aaabyaaaawcayaaadetgw7aaaabgdbtueaalgpc/xhbqaaaazis0deap8a/wd/ol2nkwaaaalwsflzaaalewaacxmbajqcgaaaaad0su1fb9oebxczfmgboiwaaaaidevydenvbw1lbnqa9sywvwaaaufjrefuomvtlutsjfeux//n3nn0ydpbh1abrpt4lfqtqkc3jrkkneisiiribbehjjpklivo4m1rrmkkjqirmjruqudkpt71qpipirkpaqdf55tv5vvuszjqtjolseukd3xu/3dpzusc/22wtu2wrn+jg5so/ocdh8ycmjdflehmlkjkvk7kuyn+ufza/rtth76zavocdptrxzqtni3mrwupc+6cktlxz/sddp2uu9uxlmyxz6qm8v4tz8
lhf1h+zdqxt7s8olmxtbf4e8qafhjj3kbp2mzkkthpitjp9vh6ihia+whtasx5brpwuemgdondf/2a4m7ukds1jw662+xkqtkeuoqjktojm2h53yfl15psj04zc94wdtibr26fxlc2mzrvbccebz2kirfd414tkmlezbvgt33+qcohgha81swysew0r1uzfnylmtpx80pngqq91lwvk2jgvgnfvzg6ycyrat16gftw5kkkfo1eqltfh5q2ett0biwf+aitq4fdbk+imyo1oxvgf03wafjqvbckvdffryetxqiffygazths0zwagd7fg5tnnyntp8/fzvgwjofmgg7gox0sakkgqgdmgkbi0njgmeimpgdk5+wacewed0ywb
lhguz4hw5oduekrblt7...
...ncee4euyv4pwcpswypw0uhdybkswu1nyjendreqtkjwn2+zvttc1vmstb/mvev/weyslasslimcohobjxw+n3ap/sjefnl5gepzmpu4kg7opr1+tofpyuu3becwykcwqcdfmwfkauo90fhkdinbcamvqnymgqueagqwcohbdc1rjv9pild8ibvkz6qyviibqgtjpx4k0xpigezorn1da0cij4vfr0ta3wvbxh/rjdcufv6r2zpgph/e4pxsbcpeatqprjniso203/5s/za171mv8+w1loaaaaaelftksuqmcc"> <img class="intlink" title="undo" onclick="formatdoc('undo');" src="data:image/gif;base64,r0lgod
lhfgawaomkadljwlie33morpgjuykl8aezxqpd+7/i19dv3nha7p///////////////////////yh5baekaa8alaaaaaawabyaaarr8mljq7046807tkayejjbnes4eeujvigapwyac0csocq7sdlwjkakca6tomywiargqf3mrqviejkksvlibsfewhdrih4fh/dzmice3/c4nbqbads=" /> <img class="intlink" title="redo" onclick="formatdoc('redo');" src="data:image/gif;base64,r0lgod
lhfgawamihab1chdljwl9vj1ie34kl8apd+7/i1////yh5baekaacalaaaaaawabyaaankelrc/jdksesyphi7s...
...And 6 more matches
Using files from web applications - Web APIs
function fileupload(img, file) { const reader = new filereader(); this.ctrl = createthrobber(img); const xhr = new xm
lhttprequest(); this.xhr = xhr; const self = this; this.xhr.upload.addeventlistener("progress", function(e) { if (e.lengthcomputable) { const percentage = math.round((e.loaded * 100) / e.total); self.ctrl.update(percentage); } }, false); xhr.upload.addeventlistener("load", function(e){ self.ctrl.update(100); const canvas = self.
...open("post", "http://demos.hacks.mozilla.org/paul/demos/resources/webservices/devnull.php"); xhr.overridemimetype('text/plain; charset=x-user-defined-binary'); reader.onload = function(evt) { xhr.send(evt.target.result); }; reader.readasbinarystring(file); } the fileupload() function shown above creates a throbber, which is used to display progress information, and then creates an xm
lhttprequest to handle uploading the data.
... before actually transferring the data, several preparatory steps are taken: the xm
lhttprequest's upload progress listener is set to update the throbber with new percentage information so that as the upload progresses the throbber will be updated based on the latest information.
...And 5 more matches
Event reference
abort progressevent progress and xm
lhttprequest progression has been terminated (not due to an error).
... error progressevent progress and xm
lhttprequest progression has failed.
... load progressevent progress and xm
lhttprequest progression has been successful.
...And 5 more matches
Ajax - Developer guides
asynchronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together, including html or xhtml, css, javascript, dom, xml, xslt, and most importantly the xm
lhttprequest object.
... using the xm
lhttprequest api the xm
lhttprequest api is the core of ajax.
...it will seem familiar to anyone who has used xm
lhttprequest, but this api provides a more powerful and flexible feature set.
...And 5 more matches
net/xhr - Archive of obsolete content
provides access to xm
lhttprequest functionality.
... usage security concerns by default, the xm
lhttprequest object grants full access to any protocol scheme, which means that it can be used to read from (but not write to) the host system's entire filesystem.
... threat model the xm
lhttprequest object can be used by an add-on to "phone home" and transmit potentially sensitive user data to third parties.
...And 4 more matches
Adding Events and Commands - Archive of obsolete content
another way to attach event handlers, just like html, is to place the handler in the xul code: <overlay id="xulschoo
lhello-browser-overlay" onload="xulschoolchrome.browseroverlay.init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> we prefer the first method because it keeps a better separation of content and behavior.
...for example: <button label="&xulschoo
lhello.defaultgreeting.label;" oncommand="xulschoolchrome.browseroverlay.changegreeting(event);" /> then on the javascript code you would have something like this: changegreeting : function(aevent) { // more stuff aevent.target.setattribute("label", somenewgreeting); } the target in this example is the button element, so clicking on it will change its text.
... <broadcasterset id="xulschoo
lhello-broadcasterset"> <broadcaster id="xulschoo
lhello-online-broadcaster" /> </broadcasterset> these elements are completely invisible, so you can put them anywhere.
...And 4 more matches
Appendix D: Loading Scripts - Archive of obsolete content
javascript files or urls may be loaded in this manner by first retrieving their contents into memory using an xm
lhttprequest.
... in addition to compile time, reading files synchronously from disk has its own overhead, and xm
lhttprequests have significantly more overhead than native loading methods.
... const xm
lhttprequest = components.constructor("@mozilla.org/xmlextras/xm
lhttprequest;1", "nsixm
lhttprequest", "open"); function loadscript(name, context) { // create the sandbox let sandbox = components.utils.sandbox(context, { sandboxprototype: context, wantxrays: false }); // get t...
...And 4 more matches
Handling Preferences - Archive of obsolete content
there are a couple of additions in the makefiles, to include the preference file xulschoo
lhello.js.
...pref("extensions.xulschoo
lhello.message.count", 0); this defines a preference we'll use to keep track of the amount of times we have displayed a greeting message to the user.
...get count() { return this._prefservice.getintpref("extensions.xulschoo
lhello.message.count"); }, increment : function() { let currentcount = this._prefservice.getintpref("extensions.xulschoo
lhello.message.count"); this._prefservice.setintpref("extensions.xulschoo
lhello.message.count", currentcount + 1); } one important thing to keep in mind is that the "get" methods of the service can throw an exception if the preference is not found.
...And 4 more matches
XML Extras
feature status feature status xmlserializer available xm
lhttprequest available domparser (string and stream input source) available web services with soap and wsdl no longer available from gecko 1.9/firefox 3.
... qa and testing there are some online tests for mainly exercising the http get method via xm
lhttprequest.
... for xm
lhttprequest object you can mostly rely on the microsoft xm
lhttprequest documentation, with some caveats: all functions and property names begin with a lower case letter and the object creation is different.
...And 4 more matches
nsIWebContentHandlerRegistrar
embeddor.implemented/web-content-handler-registrar;1 as a service: var nsiwchr = cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"] .getservice(ci.nsiwebcontenthandlerregistrar); method overview void registercontenthandler(in domstring mimetype, in domstring uri, in domstring title, in nsidomwindow contentwindow) void registerprotoco
lhandler(in domstring protocol,in domstring uri, in domstring title, in nsidomwindow contentwindow) methods registercontenthandler summary of registercontenthandler void registercontenthandler( in domstring mimetype, in domstring uri, in domstring title, in nsidomwindow contentwindow ); parameters mimetype...
... registerprotoco
lhandler summary of registerprotoco
lhandler void registerprotoco
lhandler( in domstring protocol, in domstring uri, in domstring title, in nsidomwindow contentwindow ); parameters protocol the protocol the site wishes to handle, specified as a string.
... } } else { //adomwindow is a popup window if (adomwindow.location.hostname == myurihostname) { htmlcontentwindow = adomwindow; break; } } } // this section here is long and daunting, but its just finding a suitable contentwindow if (!htmlcontentwindow) { throw new error('no suitable content window found, will not reigsterprotoco
lhandler.
...And 4 more matches
Web Console remoting - Firefox Developer Tools
send http requests starting with firefox 25 you can send an http request using the console actor: { "to": "conn0.console9", "type": "sendhttprequest", "request": { "url": "http://loca
lhost", "method": "get", "headers": [ { name: "header-name", value: "header value", }, // ...
... ], }, } the response packet is a network event actor grip: { "to": "conn0.console9", "eventactor": { "actor": "conn0.netevent14", "starteddatetime": "2013-08-26t19:50:03.699z", "url": "http://loca
lhost", "method": "get" "isxhr": true, "private": false } } you can also use the webconsoleclient.sendhttprequest(request, onresponse) method.
... the pageerror packet is: { "from": "conn0.console9", "type": "pageerror", "pageerror": { "errormessage": "referenceerror: foo is not defined", "sourcename": "http://loca
lhost/~mihai/mozilla/test.js", "linetext": "", "linenumber": 6, "columnnumber": 0, "category": "content javascript", "timestamp": 1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } the packet is similar to nsiscripterror - for simplicity.
...And 4 more matches
Using FormData Objects - Web APIs
the formdata object lets you compile a set of key/value pairs to send using xm
lhttprequest.
...var blob = new blob([content], { type: "text/xml"}); formdata.append("webmasterfile", blob); var request = new xm
lhttprequest(); request.open("post", "http://foo.com/submitform.php"); request.send(formdata); note: the fields "userfile" and "webmasterfile" both contain a file.
... this example builds a formdata instance containing values for fields named "username", "accountnum", "userfile" and "webmasterfile", then uses the xm
lhttprequest method send() to send the form's data.
...And 4 more matches
Proxy Auto-Configuration (PAC) file - HTTP
(of course, the javascripts must be edited to reflect your site's domain name and/or subnets.) predefined functions and environment these functions can be used in building the pac file: hostname based conditions isplainhostname() dnsdomainis() loca
lhostordomainis() isresolvable() isinnet() related utility functions dnsresolve() convert_addr() myipaddress() dnsdomainlevels() url/hostname based conditions shexpmatch() time based conditions weekdayrange() daterange() timerange() logging utility alert() there was one associative array (object) already defined, because at t...
... examples dnsdomainis("www.mozilla.org", ".mozilla.org") // true dnsdomainis("www", ".mozilla.org") // false loca
lhostordomainis() syntax loca
lhostordomainis(host, hostdom) parameters host the hostname from the url.
... examples loca
lhostordomainis("www.mozilla.org" , "www.mozilla.org") // true (exact match) loca
lhostordomainis("www" , "www.mozilla.org") // true (hostname match, domain not specified) loca
lhostordomainis("www.google.com" , "www.mozilla.org") // false (domain name mismatch) loca
lhostordomainis("home.mozilla.org", "www.mozilla.org") // false (hostname mismatch) isresolvable() syntax isresolvable(host) parameters host is the hostname from the url.
...And 4 more matches
jpm - Archive of obsolete content
jpm post --post-url http://loca
lhost:8888/ see using post and watchpost for more information.
... -v --verbose verbose operation: jpm post --post-url http://loca
lhost:8888/ -v jpm watchpost this command packages the add-on as an xpi file then posts it to some url whenever a file in the current working directory changes.
... jpm watchpost --post-url http://loca
lhost:8888/ see using post and watchpost for more information.
...And 3 more matches
Adding menus and submenus - Archive of obsolete content
the toolbox should be positioned near the top of the xul document, and the code should be similar to this: <toolbox> <menubar id="xulschoo
lhello-menubar"> <menu id="xulschoo
lhello-greeting-menu" label="&xulschoo
lhello.greeting.label;"> <menupopup> <menuitem label="&xulschoo
lhello.greet.short.label;" oncommand="xulschoolchrome.greetingdialog.greetingshort(event);" /> <menuitem label="&xulschoo
lhello.greet.medium.label;" oncommand="xulschoolchrome.greetingdialog.greetingmedium(event);" /> ...
... <menuitem label="&xulschoo
lhello.greet.long.label;" oncommand="xulschoolchrome.greetingdialog.greetinglong(event);" /> <menuseparator /> <menuitem label="&xulschoo
lhello.greet.custom.label;" oncommand="xulschoolchrome.greetingdialog.greetingcustom(event);" /> </menupopup> </menu> </menubar> </toolbox> this code displays a simple menu with options for 3 different types of greetings, a menuseparator, and finally an option to show a custom greeting.
...menus require a menupopup element as a container for its children, which are usually menuitem elements, but can also be menuseparator, or menu in order to have multiple nesting levels: <toolbox> <menubar id="xulschoo
lhello-menubar"> <menu id="xulschoo
lhello-greeting-menu" label="&xulschoo
lhello.greeting.label;"> <menupopup> <menu id="xulschoo
lhello-greeting-sizes-menu" label="&xulschoo
lhello.greetingsizes.label;"> <menupopup> <menuitem label="&xulschoo
lhello.greet.short.label;" oncommand="xulschoolchrome.greetingdialog.greetingshort(event);" /> <...
...And 3 more matches
Connecting to Remote Content - Archive of obsolete content
« previousnext » using xm
lhttprequest xm
lhttprequest is an api for transferring xml between a local script and a remote server via http.
... let url = "http://www.example.com/"; let request = components.classes["@mozilla.org/xmlextras/xm
lhttprequest;1"] .createinstance(components.interfaces.nsixm
lhttprequest); request.onload = function(aevent) { window.alert("response text: " + aevent.target.responsetext); }; request.onerror = function(aevent) { window.alert("error status: " + aevent.target.status); }; request.open("get", url, true); request.send(null); in this example we demonstrate how to make a xm
lhttprequest call in asynchronous mode.
... you can see that an instance of the xm
lhttprequest class is created and it holds all functionality for making a request.
...And 3 more matches
No Proxy For configuration - Archive of obsolete content
new profiles contain the values "loca
lhost, 127.0.0.1", by default.
... limitations a domain, including sub-domains domain suffix "mozilla.org" does not block domains that end in the same string (amozilla.org) sub-domains domain suffix, starting with a dot ".mozilla.org" does not block the main domain (mozilla.org) a hostname (without domain) hostname-only (see problems below) "loca
lhost" also blocks any possible domains that start with the entry ("www.otherdomain.loca
lhost") a hostname (with domain) domain name "www.mozilla.org" does not block hostnames or domains that end in the same string (other-www.mozilla.org) an ip address ip address "1.2.3.4" does not block hostnames that resolve to the ip address ("127.0.0.1" does not block "loca...
...
lhost") a network network w/ cidr block "10.0.0.0/8" does not block hostnames that resolve to the ip address range (10.0.0.0/8 is not "no proxy for intranet hostnames") optional - port-specific (optional) ":" + port number "<filter>:81" only black-lists port.
...And 3 more matches
jspage - Archive of obsolete content
!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].tolowercase()},features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.queryselector)},plugins:{},engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getelementsbyclassname)?950:925)); },trident:function(){return(!window.activexobject)?false:((window.xm
lhttprequest)?((document.queryselectorall)?6:5):4);},webkit:function(){return(navigator.taintenabled)?false:((browser.features.xpath)?((browser.features.query)?525:420):419); },gecko:function(){return(!document.getboxobjectfor&&window.mozinnerscreenx==null)?false:((document.getelementsbyclassname)?19:18);}}},browser||{});browser.platform[browser.platform.name]=true; browser.detect=function(){for(var...
... b in this.engines){var a=this.engines[b]();if(a){this.engine={name:b,version:a};this.engine[b]=this.engine[b+a]=true; break;}}return{name:b,version:a};};browser.detect();browser.request=function(){return $try(function(){return new xm
lhttprequest();},function(){return new activexobject("msxml2.xm
lhttp"); },function(){return new activexobject("microsoft.xm
lhttp");});};browser.features.xhr=!!(browser.request());browser.plugins.flash=(function(){var a=($try(function(){return navigator.plugins["shockwave flash"].description; },function(){return new activexobject("shockwaveflash.shockwaveflash").getvariable("$version");})||"0 r0").match(/\d+/g);return{version:parseint(a[0]||0+"."+a[1],10)||0,build:parseint(a[2],10)||0}; })();function $exec(b){if(!b){return b;}if(window.execscript){window.execscri...
...(@, @, @)";});(function(){element.implement({scrollto:function(h,i){if(b(this)){this.getwindow().scrollto(h,i); }else{this.scrollleft=h;this.scrolltop=i;}return this;},getsize:function(){if(b(this)){return this.getwindow().getsize();}return{x:this.offsetwidth,y:this.offsetheight}; },getscrollsize:function(){if(b(this)){return this.getwindow().getscrollsize();}return{x:this.scrollwidth,y:this.scrol
lheight};},getscroll:function(){if(b(this)){return this.getwindow().getscroll(); }return{x:this.scrollleft,y:this.scrolltop};},getscrolls:function(){var i=this,h={x:0,y:0};while(i&&!b(i)){h.x+=i.scrollleft;h.y+=i.scrolltop;i=i.parentnode; }return h;},getoffsetparent:function(){var h=this;if(b(h)){return null;}if(!browser.engine.trident){return h.offsetparent;}while((h=h.parentnode)&&!b(h)){if(d(h,"p...
...And 3 more matches
Using workers in extensions - Archive of obsolete content
how this differs from previous versions this version of the stock ticker extension moves the xm
lhttprequest call that fetches updated stock information into a worker thread, which then passes that information back to the main body of the extension's code to update the display in the status bar.
... this demonstrates not only how to use workers in an extension, but also how to perform xm
lhttprequest in a worker, and how workers and main thread code can pass data back and forth.
... the worker the worker thread's job in this example is to issue the xm
lhttprequest calls that fetch the updated stock information.
...And 3 more matches
Detailed XPCOM hashtable guide
p
lhashtable - low-level c api; entry class pointers are constant; more efficient for large entry structures; often wastes memory making many small heap allocations.
...if you need entry pointers to remain constant, you may want to consider using p
lhashtable instead.
... p
lhashtable p
lhashtable is a part of nspr.
...And 3 more matches
nsIProtocolProxyService
if the protocol handler for the given uri supports nsiproxiedprotoco
lhandler, then the nsiproxyinfo instance returned from resolve may be passed to the nsiproxiedprotoco
lhandler.newproxiedchannel() method to create a nsichannel to the given uri that uses the specified proxy.
... however, if the nsiproxyinfo type is "http", then it means that the given uri should be loaded using the http protocol handler, which also supports nsiproxiedprotoco
lhandler.
...see nsiproxiedprotoco
lhandler.newproxiedchannel().
...And 3 more matches
Activity Manager examples
"no junk found", process.starttime, // start time date.now()); // completion time event.contexttype = process.contexttype; // optional event.contextobj = process.contextobj; // optional gactivitymanager.addactivity(event); showing a user-defined activity with cancel capability (javascript) this sample improves the previous one by providing an nsiactivitycance
lhandler to allow the user to cancel the process.
... // step 1: create a nsiactivitycance
lhandler implementation function canceljunkprocess() { // user stuff here..
...cel // the junk processing for given folder if (initiator.cancelfolderop(folder)) { aactivity.state = components.interfaces.nsiactivityprocess.state_canceled; gactivitymanager.removeactivity(aactivity.id); return cr.ns_success; } } return cr.ns_failure; } } // step 2: modify the previous sample to add initiator, subject // and associate a nsiactivitycance
lhandler component ...
...And 3 more matches
Adding sidebars - Archive of obsolete content
<menupopup id="viewsidebarmenu"> <menuitem id="xulschoo
lhello-sidebar" label="&xulschoo
lhello.sidebar.title;" accesskey="&xulschoo
lhello.sidebar.accesskey;" type="checkbox" autocheck="false" group="sidebar" sidebarurl="chrome://xulschoo
lhello/content/sidebar.xul" sidebartitle="&xulschoo
lhello.sidebar.title;" oncommand="togglesidebar('xulschoo
lhello-sidebar');" /> </menupopup> the example in the mdc page includes a shortcut key...
... creating a tabbed view is simple: <tabbox id="xulschoo
lhello-tabbox"> <tabs> <tab label="&xulschoo
lhello.maintab.label;" /> <tab label="&xulschoo
lhello.advancedtab.label;" /> </tabs> <tabpanels> <tabpanel> <!-- content for the main panel.
...one common use for a stack is to have an image background that stretches horizontally and vertically depending on the size of the foreground object: <stack> <hbox flex="1"> <image src="chrome://xulschoo
lhello/skin/stack-bg.png" flex="1" /> </hbox> <hbox> <!-- some content here.
...And 2 more matches
Adding windows and dialogs - Archive of obsolete content
window.open( "chrome://xulschoo
lhello/content/somewindow.xul", "xulschoo
lhello-some-window", "chrome,centerscreen"); the first argument is the url to open, the second is an id to identify the window, and the last is an optional comma-separated list of features, which describe the behavior and appearance of the window.
... let somevalue = 2; let returnvalue = { accepted : false , result : "" }; window.opendialog( "chrome://xulschoo
lhello/content/somedialog.xul", "xulschoo
lhello-some-dialog", "chrome,centerscreen", somevalue, returnvalue); // you can send as many extra parameters as you need.
... <dialog id="xulschoo
lhello-hello-dialog" title="&xulschoo
lhello.hellodialog.title;" buttons="accept,cancel" ondialogaccept="return xulschoolchrome.hellodialog.accept();" ondialogcancel="return xulschoolchrome.hellodialog.cancel();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> carefully read the specification of the dialog element.
...And 2 more matches
JavaScript Object Management - Archive of obsolete content
*/ init : function(aevent) { this._stringbundle = document.getelementbyid("xulschoo
lhello-string-bundle"); // you can make changes to the window dom here.
...if you really need to do something like this anyway, one way to do it is to have a timeout execute the code after a delay: init : function(aevent) { let that = this; this._stringbundle = document.getelementbyid("xs-hw-string-bundle"); window.settimeout( function() { window.alert(that._stringbundle.getstring("xulschoo
lhello.greeting.label")); }, 0); } the settimeout function executes the function in the first parameter, after a delay in miliseconds specified by the second parameter.
...the first thing you need to do is add an entry in the chrome.manifest file: resource xulschoo
lhello modules/ javascript code modules are accessed with the resource protocol, which is very similar to the chrome protocol.
...And 2 more matches
Promises - Archive of obsolete content
config.indexstats = processor.stats; yield os.file.writeatomic(configpath, json.stringify(config), { tmppath: configpath + "." + math.random(), encoding: "utf-8" }) timestamp = new date; }); http requests http requests should, in nearly all circumstances, be made via the standard xm
lhttprequest api.
...moreover, many third-party wrappers for the xm
lhttprequest api now support promises out of the box.
... let resp = yield new promise((resolve, reject) => { let xhr = new xm
lhttprequest; xhr.onload = resolve; xhr.onerror = reject; xhr.open("get", dataurl); xhr.responsetype = "json"; xhr.send(); }); let data = resp.target.response; // use the response to construct form data object for the // second request.
...And 2 more matches
Animations and tweens - Game development
applying the animation when the ball hits the paddle in the arcade.collide() method call that handles the collision between the ball and the paddle (the first line inside update(), see below) we can add an extra parameter that specifies a function to be executed every time the collision happens, in the same fashion as the bal
lhitbrick() function.
... update the first line inside update() as shown below: function update() { game.physics.arcade.collide(ball, paddle, bal
lhitpaddle); game.physics.arcade.collide(ball, bricks, bal
lhitbrick); paddle.x = game.input.x || game.world.width*0.5; } then we can create the bal
lhitpaddle() function (having ball and paddle as default parameters), playing the wobble animation when it is called.
... add the following function just before your closing </script> tag: function bal
lhitpaddle(ball, paddle) { ball.animations.play('wobble'); } the animation is played every time the ball hits the paddle.
...And 2 more matches
Package management basics - Learn web development
in your terminal, run the following command: parcel index.html you should see something like this printed to your terminal: server running at http://loca
lhost:1234 ✨ built in 193ms.
...for a start, there is now a local web server running at http://loca
lhost:1234.
... in the index.js file, add the following code and save it: import { formatdistancetonow } from 'date-fns' const date = '1996-09-13 10:00:00'; document.body.textcontent = formatdistancetonow(new date(date)) + ' ago'; go back to http://loca
lhost:1234 and you'll see how long ago it is since the author turned 18.
...And 2 more matches
How Mozilla determines MIME Types
file uris for file: uris, mozilla will ask the externa
lhelperappservice for a mime type.
... if the file starts with <?xml, asks the externa
lhelperappservice for a mime type for the uri.
... the uri is handed to the externa
lhelperappservice for mime type guessing if all else fails, the buffer (i.e.
...And 2 more matches
Assert.jsm
actual, expected, message); undefined deepequal(actual, expected, message); undefined notdeepequal(actual, expected, message); undefined strictequal(actual, expected, message); undefined notstrictequal(actual, expected, message); undefined throws(block, expected, message); promise rejects(promise, expected, message); undefined greater(
lhs, rhs, message); undefined greaterorequal(
lhs, rhs, message); undefined less(
lhs, rhs, message); undefined lessorequal(
lhs, rhs, message); undefined setreporter(reporterfunc); undefined report(failed, actual, expected, message, operator); constructor creates a new assert object.
... undefined greater(
lhs, rhs, message ); parameters
lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result greaterorequal() the greater or equal than assertion tests two numbers with the >= operator.
... undefined greaterorequal(
lhs, rhs, message ); parameters
lhs the left hand side of the operator rhs the right hand side of the operator message short explanation of the expected result less() the lesser than assertion tests two numbers with the < operator.
...And 2 more matches
JS_NewGlobalObject
syntax jsobject * js_newglobalobject(jscontext *cx, const jsclass *clasp, jsprincipals *principals, js::onnewgloba
lhookoption hookoption, const js::compartmentoptions &options = js::compartmentoptions()); name type description cx jscontext * the context in which to create the new global object.
... hookoption js::onnewgloba
lhookoption see debugger api hook added in spidermonkey 31 options const js::compartmentoptions & the option for new compartment (passed to jscompartment constructor).
... if callers have no additional state on the global to set up, they may pass fireonnewgloba
lhook to js_newglobalobject, which causes that function to fire the hook as its final act before returning.
...And 2 more matches
Places Developer Guide
while nsinavhistory is the main interface for history, there are a couple of other interfaces available for legacy and context-specific uses: nsibrowserhistory - detailed page addition and removal methods nsigloba
lhistory2 - simple page detection and addition nsigloba
lhistory3 - for adding document redirects adding to history places provides a couple of interfaces for adding to, and editing the browsing history.
...other interfaces that provide specialized abilities are nsibrowserhistory and nsigloba
lhistory.
...var browserhistory = histsvc.queryinterface(ci.nsibrowserhistory); var oururi = uri("http://www.mozilla.com"); var pagetitle = "mozilla"; var visitdate = date.now() * 1000; // in microseconds browserhistory.addpagewithdetails(oururi, "mozilla", visitdate); // add a visit to a url, with extended behavior information // via nsigloba
lhistory3.
...And 2 more matches
XPCOM Interface Reference by grouping
sidownloadprogresslistener element internal nsiworker nsiworkerglobalscope nsiworkermessageevent nsiworkermessageport nsiworkerscope tree nsitreeboxobject nsitreecolumn nsitreecolumns nsitreecontentview nsitreeselection nsitreeview xform nsixformsmodelelement nsixformsnsinstanceelement nsixformsnsmodelelement xm
lhttprequest nsixm
lhttprequesteventtarget favicon nsifavicondatacallback nsifaviconservice frame nsichromeframemessagemanager nsiframeloader nsiframeloaderowner nsiframemessagelistener nsiframemessagemanager interface nsijsxm
lhttprequest jetpack nsijetpack nsijetpackservice offlinestorage nsiapplicationcache ...
...nt32 nsisupportsprint64 nsisupportspriority nsisupportsprtime nsisupportspruint16 nsisupportspruint32 nsisupportspruint64 nsisupportspruint8 nsisupportsstring nsisupportsvoid nsisupportsweakreference nsivariant do not use nsienumerator nsiinprocesscontentframemessagemanager nsiscriptableio nsixpcscriptable future nsixm
lhttprequestupload obsolete nsixmlrpcclient nsixmlrpcfault security auth nsiauthmodule nsiauthprompt nsiauthpromptprovider nsiauthpromptwrapper nsiasyncverifyredirectcallback content nsicontentpolicy credentials nsilogininfo nsiloginmanager using n...
...siloginmanager nsiloginmanagerstorage nsiloginmetainfo history nsigloba
lhistory nsigloba
lhistory2 nsigloba
lhistory3 ssl nsibadcertlistener2 system action nsicancelable application application nsiapplicationupdateservice nsiappshell nsiappshellservice nsiappstartup xul nsixulappinfo nsixulruntime nsixultemplatebuilder nsixultemplatequeryprocessor nsixultemplateresult bookmark livemark nsilivema...
...And 2 more matches
Using Service Workers - Web APIs
in order to facilitate local development, loca
lhost is considered a secure origin by browsers as well.
...(see our promises test example for the source code, or look at it running live.) note: a real service worker implementation would use caching and onfetch rather than the xm
lhttprequest api.
... const imgload = (url) => { return new promise((resolve, reject) => { var request = new xm
lhttprequest(); request.open('get', url); request.responsetype = 'blob'; request.onload = () => { if (request.status == 200) { resolve(request.response); } else { reject(error('image didn\'t load successfully; error code:' + request.statustext)); } }; request.onerror = () => { reject(error('there was a network error.')); }; request.send(); }); } we return a new promise using the promise() constructor, which takes as an argument a callback function with resolve and reject parameters.
...And 2 more matches
HTML to DOM - Archive of obsolete content
although you can now natively parse html using domparser and xm
lhttprequest, this is a new feature that is not yet supported by all browsers in use in the wild.
... safely parsing simple html to dom when using xm
lhttprequest to get the html of a remote webpage, it is often advantageous to turn that html string into dom for easier manipulation.
... parsing complete html to dom loading an html document seems much simpler if it's loaded using the xm
lhttprequest object.
... for that matter, we're going to load our html document first: var request = xm
lhttprequest(); request.open("get", "http://example.org/file.html", false); request.send(null); our next step is to create the document object that will represent the dom into which we'll insert our newly-retrieved html: var doc = document.implementation.createhtmldocument("example"); doc.documentelement.innerhtml = request.responsetext; after this any manipulation that we might want to do will be something as simple as the following: doc.body.textcontent = "this is inside the body!"; using a hidden iframe element to parse html to a window's dom sample code may need more work.
The Box Model - Archive of obsolete content
here's a typical usage of the label element: <label control="xulschoo
lhello-greeting-textbox" value="&xulschoo
lhello.typegreeting.label;" /> <textbox id="xulschoo
lhello-greeting-textbox" /> the label says something like "type a greeting message", and the textbox next to it allows the user to type the message.
...in order to have wrapping descriptions, you need to set the text as a child node instead of using the value attribute: <description>&xulschoo
lhello.description.label;</description> even then, the text will extend as much as it can in a single line, so you need to add some css limits in order to make it wrap inside a xul dialog or window.
...one possibility is to use special markup in a locale property so that the link can be easily recognized: xulschoo
lhello.linkedtext.label = go to <a>our site</a> for more information the syntax is similar to html because it's easier to read this way, but string bundles won't do anything special with it.
... xulschoo
lhello.linkedtext.label = go to <html:a onclick="%s">our site</html:a> for more information to include html in a xul document, you need to add the namespace for it in the document root: <overlay id="xulschoo
lhello-browser-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> then you can have an html:p (paragraph) element where you insert the result of parsing the property string.
Enabling the behavior - retrieving tinderbox status - Archive of obsolete content
var gxm
lhttprequest; function loadtinderboxstatus() { gxm
lhttprequest = new xm
lhttprequest(); gxm
lhttprequest.onload = updatetinderboxstatus; gxm
lhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxm
lhttprequest.send(null); } xm
lhttprequest is an interface in mozilla for retrieving documents via http.
... xm
lhttprequest is easy to use in the simple case we have here.
... xm
lhttprequest will retrieve the document located at the given url and call the updatetinderboxstatus() function when it is done.
... notice that we defined the instance of xm
lhttprequest as a global variable.
WAI-ARIA basics - Learn web development
via xm
lhttprequest, or dom apis.
...content that updates without the entire page reloading via a mechanism like xm
lhttprequest, fetch, or dom apis.
...in this example we have a simple random quote box: <section> <h1>random quote</h1> <blockquote> <p></p> </blockquote> </section> our javascript loads a json file via xm
lhttprequest containing a series of random quotes and their authors.
... note: most browsers will throw a security exception if you try to do an xm
lhttprequest call from a file:// url, e.g.
How do you set up a local testing server? - Learn web development
you can go to this server by going to the url loca
lhost:8000 in your web browser.
...you can then access your content at loca
lhost:7800.
...at this point you should be able to run the python flask examples using for example python3 python-example.py, then navigating to loca
lhost:5000 in your browser.
... to run php server-side code, launch php's built-in development server: $ cd path/to/your/php/code $ php -s loca
lhost:8000 ...
Introduction to web APIs - Learn web development
apis that make this possible include xm
lhttprequest and the fetch api.
... to provide another example, instances of the xm
lhttprequest object (each one represents an http request to the server to retrieve a new resource of some kind) has a number of events available on them, for example, the load event is fired when a response has been successfully returned containing the requested resource, and it is now available.
... the following code provides a simple example of how this would be used: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; let request = new xm
lhttprequest(); request.open('get', requesturl); request.responsetype = 'json'; request.send(); request.onload = function() { const superheroes = request.response; populateheader(superheroes); showheroes(superheroes); } note: you can see this code in action in our ajax.html example (see it live also).
... the first five lines specify the location of the resource we want to fetch, create a new instance of a request object using the xm
lhttprequest() constructor, open an http get request to retrieve the specified resource, specify that the response should be sent in json format, then send the request.
Handling common JavaScript problems - Learn web development
this is supposed to be fetched from an external .json file using the following xm
lhttprequest call: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; let request = new xm
lhttprequest(); request.open('get', requesturl); request.send(); let superheroes = request.response; populateheader(superheroes); showheroes(superheroes); but this fails.
...this settles it — our xm
lhttprequest call is returning the json as text, not json.
...to give you a clue, you can either tell the xm
lhttprequest object explicitly to return json format, or convert the returned text to json after the response arrives.
...as an example, the fetch api (a modern equivalent to xm
lhttprequest) uses promises to fetch resources across the network and make sure that the response has been returned before they are used (for example, displaying an image inside an <img> element).
PL_NewHashTable
syntax #include <p
lhash.h> p
lhashtable *pl_newhashtable( pruint32 numbuckets, p
lhashfunction keyhash, p
lhashcomparator keycompare, p
lhashcomparator valuecompare, const p
lhashallocops *allocops, void *allocpriv ); parameters the function has the following parameters: numbuckets the number of buckets in the hash table.
... allocops a pointer to a p
lhashallocops structure that must exist throughout the lifetime of the new hash table.
...the arguments keycompare and valuecompare are functions of type p
lhashcomparator that the hash table library functions use to compare the keys and the values of entries.
... the argument allocops points to a p
lhashallocops structure that must exist throughout the lifetime of the new hash table.
How to embed the JavaScript engine
jsautorequest ar(cx); // in practice, you would want to exit this any // time you're spinning the event loop js::rootedobject global(cx, js_newglobalobject(cx, &global_class, nullptr, js::fireonnewgloba
lhook)); if (!global) return 1; js::rootedvalue rval(cx); { // scope for jsautocompartment jsautocompartment ac(cx, global); js_initstandardclasses(cx, global); const char *script = "'hello'+'world, it is '+new date()"; const char *filename = "noname"; int lineno = 1; bool ok = js_evaluatescript(cx, global, script, strlen...
... jsautorequest ar(cx); // in practice, you would want to exit this any // time you're spinning the event loop js::rootedobject global(cx, js_newglobalobject(cx, &global_class, nullptr, js::fireonnewgloba
lhook)); if (!global) return 1; js::rootedvalue rval(cx); { // scope for jsautocompartment jsautocompartment ac(cx, global); js_initstandardclasses(cx, global); const char *script = "'hello'+'world, it is '+new date()"; const char *filename = "noname"; int lineno = 1; js::compileoptions opts(cx); opts.setfileandli...
... jsautorequest ar(cx); // in practice, you would want to exit this any // time you're spinning the event loop js::rootedobject global(cx, js_newglobalobject(cx, &global_class, nullptr, js::fireonnewgloba
lhook)); if (!global) return 1; js::rootedvalue rval(cx); { // scope for jsautocompartment jsautocompartment ac(cx, global); js_initstandardclasses(cx, global); const char *script = "'hello'+'world, it is '+new date()"; const char *filename = "noname"; int lineno = 1; js::compileoptions opts(cx); opts.setfileandli...
... jsautorequest ar(cx); // in practice, you would want to exit this any // time you're spinning the event loop js::compartmentoptions options; js::rootedobject global(cx, js_newglobalobject(cx, &global_class, nullptr, js::fireonnewgloba
lhook, options)); if (!global) return 1; js::rootedvalue rval(cx); { // scope for jsautocompartment jsautocompartment ac(cx, global); js_initstandardclasses(cx, global); const char *script = "'hello'+'world, it is '+new date()"; const char *filename = "noname"; int lineno = 1; js::compileoptions opts(cx); opts.set...
nsIMsgMessageService
n nsimsgwindow amsgwindow, in nsiurllistener aurllistener, out nsiuri aurl); void search(in nsimsgsearchsession asearchsession, in nsimsgwindow amsgwindow, in nsimsgfolder amsgfolder, in string asearchuri); nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in boolean aconvertdata, in string aadditiona
lheader); nsiuri streamheaders(in string amessageuri, in nsistreamlistener aconsumer, in nsiurllistener aurllistener [optional] in boolean alocalonly); boolean ismsginmemcache(in nsiuri aurl, in nsimsgfolder afolder, out nsicacheentrydescriptor acacheentry); nsimsgdbhdr messageuritomsghdr(in string uri); methods copymessage() pass in the uri for the message you wa...
...it will also tack aadditiona
lheader onto the url (e.g., header=filter).
... nsiuri streammessage(in string amessageuri, in nsisupports aconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in boolean aconvertdata, in string aadditiona
lheader); parameters amessageuri uri of message to stream aconsumer generally, a stream listener listening to the message.
... aadditiona
lheader header added to the uri.
nsIUpdateCheckListener
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 oncheckcomplete(in nsixm
lhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount); void onerror(in nsixm
lhttprequest request, in nsiupdate update); void onprogress(in nsixm
lhttprequest request, in unsigned long position, in unsigned long totalsize); methods oncheckcomplete() called when the update check is completed.
... void oncheckcomplete( in nsixm
lhttprequest request, [array, size_is(updatecount)] in nsiupdate updates, in unsigned long updatecount ); parameters request the nsixm
lhttprequest object handling the update check.
...void onerror( in nsixm
lhttprequest request, in nsiupdate update ); parameters request the nsixm
lhttprequest object handling the update check.
...void onprogress( in nsixm
lhttprequest request, in unsigned long position, in unsigned long totalsize ); parameters request the nsixm
lhttprequest object handling the update check.
XPCOM Interface Reference
lernsidragservicensidragsessionnsidroppedlinkhandlernsidroppedlinkitemnsidynamiccontainernsieditornsieditorboxobjectnsieditordocshellnsieditorimesupportnsieditorloggingnsieditormailsupportnsieditorobservernsieditorspellchecknsieffectivetldservicensienumeratornsienvironmentnsierrorservicensieventlistenerinfonsieventlistenerservicensieventsourcensieventtargetnsiexceptionnsiextensionmanagernsiexterna
lhelperappservicensiexternalprotocolservicensiexternalur
lhandlerservicensiftpchannelnsiftpeventsinknsifactorynsifavicondatacallbacknsifaviconservicensifeednsifeedcontainernsifeedelementbasensifeedentrynsifeedgeneratornsifeedpersonnsifeedprocessornsifeedprogresslistenernsifeedresultnsifeedresultlistenernsifeedtextconstructnsifilensifileinputstreamnsifileoutputstreamnsifilepickernsifileprotoco
lhandler...
...nsifilespecnsifilestreamsnsifileurlnsifileutilitiesnsifileviewnsifocusmanagernsiformhistory2nsiframeloadernsiframeloaderownernsiframemessagelistenernsiframemessagemanagernsiframescriptloadernsigsettingscollectionnsigsettingsservicensigeolocationprovidernsigeolocationupdatensigloba
lhistorynsigloba
lhistory2nsigloba
lhistory3nsihtmleditornsihttpheaderlistenernsihapticfeedbacknsihttpactivitydistributornsihttpactivityobservernsihttpchannelnsihttpchannelinternalnsihttpheadervisitornsihttpservernsihttpupgradelistenernsiidnservicensiiframeboxobjectnsiiniparsernsiiniparserfactorynsiiniparserwriternsiioservicensiidleservicensiinprocesscontentframemessagemanagernsiinputstreamnsiinputstreamcallbacknsiinstalllocationnsiinterfacerequestornsijscidnsijsidnsijsiidnsijsonnsijetpacknsijetpackservicensijumplistb...
...portexportservicensiplacesviewnsipluginhostnsiprefbranch2nsipreflocalizedstringnsiprefservicensiprincipalnsiprinterenumeratornsiprintingpromptnsiprivatebrowsingservicensiprocessnsiprocess2nsiprocessscriptloadernsiprofilensiprofilelocknsiprofileunlockernsiprogramminglanguagensiprogresseventsinknsipromptnsipromptservicensipropertiesnsipropertynsipropertybagnsipropertybag2nsipropertyelementnsiprotoco
lhandlernsiprotocolproxycallbacknsiprotocolproxyfilternsiprotocolproxyservicensiproxyinfonsipushmessagensipushservicensipushsubscriptionnsiradiointerfacelayernsirandomgeneratornsirequestnsirequestobservernsiresumablechannelnsirunnablensishentrynsishistorynsishistorylistenernsisockssocketinfonsisslerrorlistenernsisslsocketcontrolnsiscreennsiscreenmanagernsiscripterrornsiscripterror2nsiscriptableionsi...
...rtnsiwifiaccesspointnsiwifilistenernsiwifimonitornsiwinaccessnodensiwinapphelpernsiwintaskbarnsiwindowcreatornsiwindowmediatornsiwindowwatchernsiwindowsregkeynsiwindowsshellservicensiworkernsiworkerfactorynsiworkerglobalscopensiworkermessageeventnsiworkermessageportnsiworkerscopensiwritablepropertybagnsiwritablepropertybag2nsixformsmodelelementnsixformsnsinstanceelementnsixformsnsmodelelementnsixm
lhttprequestnsixm
lhttprequesteventtargetnsixm
lhttprequestuploadnsixpcexceptionnsixpcscriptablensixpconnectnsixsltexceptionnsixsltprocessornsixsltprocessorobsoletensixulappinfonsixulbrowserwindownsixulbuilderlistenernsixulruntimensixulsortservicensixultemplatebuildernsixultemplatequeryprocessornsixultemplateresultnsixulwindownsixmlrpcclientnsixmlrpcfaultnsizipentrynsizipreadernsizipreadercachensizipw...
Autoconfiguration in Thunderbird
in the apache configuration files, that means something like: listen 10.2.3.4:80 (of course, you use a public ip address that you own) <virtua
lhost 10.2.3.4:80> #must be the first and only virtual host with this ip!
... documentroot /var/www/autoconfig/ servername autoconfig.hoster.com <directory /var/www/autoconfig> order allow,deny allow from all </directory> </virtua
lhost> place the configuration file at the url /mail/config-v1.1.xml on that host.
... you can add a rewriterule in the default virtual host (on debian /etc/apache2/sites-enabled/000-default) to match all autoconfig.* subdomains: <virtua
lhost *:80> #must be the first virtual host serveradmin webmaster@hoster.com servername www documentroot /var/www rewriteengine on rewritecond %{http_host} ^autoconfig\.
...</virtua
lhost> <virtua
lhost *:80> documentroot /var/www/autoconfig/ servername autoconfig.hoster.com <directory /var/www/autoconfig> order allow,deny allow from all </directory> </virtua
lhost> if you use nginx, you can easily add a subdomain to all your domains, which does the same as above.
Beacon API - Web APIs
requests are guaranteed to be initiated before a page is unloaded and they are run to completion, without requiring a blocking request (for example xm
lhttprequest).
... user agents will typically ignore asynchronous xm
lhttprequests made in an unload handler.
... to solve this problem, analytics and diagnostics code will typically make a synchronous xm
lhttprequest in an unload or beforeunload handler to submit the data.
... the synchronous xm
lhttprequest forces the browser to delay unloading the document, and makes the next navigation appear to be slower.
Web-based protocol handlers - Web APIs
basically, the web application uses registerprotoco
lhandler() to register itself with the browser as a potential handler for a given protocol.
... for example: navigator.registerprotoco
lhandler("web+burger", "http://www.google.co.uk/?uri=%s", "burger handler"); where the parameters are: the protocol.
... example <!doctype html public "-//w3c//dtd html 4.01//en"> <html lang="en"> <head> <title>web protocol handler sample - register</title> <script type="text/javascript"> navigator.registerprotoco
lhandler("web+burger", "http://www.google.co.uk/?uri=%s", "burger handler"); </script> </head> <body> <h1>web protocol handler sample</h1> <p>this web page will install a web protocol handler for the <code>web+burger:</code> protocol.</p> </body> </html> activating now, anytime the user activates a link that uses the regist...
...the data sent:</p> <textarea> <?php echo(htmlspecialchars($value, ent_quotes, 'utf-8')); ?> </textarea> </body> </html> references http://www.w3.org/tr/2011/wd-html5-20110525/timers.html#custom-handlers see also window.navigator.registercontenthandler nsiprotoco
lhandler (xul only) registerprotoco
lhandler enhancing the federated web at mozilla webdev register a custom protoco
lhandler at google developers.
Navigator.sendBeacon() - Web APIs
ensuring that data has been sent during the unloading of a document has traditionally been difficult, because user agents typically ignore asynchronous xm
lhttprequests made in an unload handler.
... historically, this was addressed with some of the following workarounds to delay the page unload long enough to send data to some url: submitting the data with a blocking synchronous xm
lhttprequest call in unload or beforeunload event handlers.
... the following example shows theoretical analytics code that attempts to submit data to a server with a synchronous xm
lhttprequest in an unload handler.
... window.addeventlistener("unload", function logdata() { var xhr = new xm
lhttprequest(); xhr.open("post", "/log", false); // third parameter of `false` means synchronous xhr.send(analyticsdata); }); this is what sendbeacon() replaces.
msCachingEnabled - Web APIs
the mscachingenabled method gets the current caching state for an xm
lhttprequest.
... syntax var cachestate = xm
lhttprequest.mscachingenabled(); parameters cachestate[out, retval] type = boolean.
... if true, xm
lhttprequest is cached to disk.
...if true, xm
lhttprequest is cached to disk.
Loading and running WebAssembly code - WebAssembly
using xm
lhttprequest xm
lhttprequest is somewhat older than fetch, but can still be happily used to get a typed array.
... again, assuming our module is called simple.wasm: create a new xm
lhttprequest() instance, and use its open() method to open a request, setting the request method to get, and declaring the path to the file we want to fetch.
... next, send the request using xm
lhttprequest.send().
... the final code looks like this: request = new xm
lhttprequest(); request.open('get', 'simple.wasm'); request.responsetype = 'arraybuffer'; request.send(); request.onload = function() { var bytes = request.response; webassembly.instantiate(bytes, importobject).then(results => { results.instance.exports.exported_func(); }); }; note: you can see an example of this in action in xhr-wasm.html.
Cross-domain Content Scripts - Archive of obsolete content
in particular, they can't: access content hosted in an iframe, if that content is served from a different domain make cross-domain xm
lhttprequests however, you can enable these features for specific domains by adding them to your add-on's package.json under the "cross-domain-content" key, which itself lives under the "permissions" key: "permissions": { "cross-domain-content": ["http://example.org/", "http://example.com/"] } the domains listed must include the scheme and fully qualified domain name, and these must exactly match the domains serving the content - so in the example above, the content script will not be allowed to access content served from https://example.com/.
... cross-domain xm
lhttprequest the following add-on creates a panel whose content is the summary weather forecast for shetland.
...ire("sdk/ui/button/action").actionbutton({ id: "get-forecast", label: "get the forecast", icon: "./icon-16.png", onclick: function() { forecast_panel.show(); } }); the "panel.html" just includes a <div> block for the forecast: <!doctype html> <!-- panel.html --> <html> <head></head> <body> <div id="forecast_summary"></div> </body> </html> the "panel-script.js" uses xm
lhttprequest to fetch the latest forecast: // panel-script.js var url = "http://datapoint.metoffice.gov.uk/public/data/txt/wxfcs/regionalforecast/json/500?key=your-api-key"; self.port.on("show", function () { var request = new xm
lhttprequest(); request.open("get", url, true); request.onload = function () { var jsonresponse = json.parse(request.responsetext); var summary = getsummary...
Custom XUL Elements with XBL - Archive of obsolete content
<content> <xul:hbox> <xul:image class="xulshoo
lhello-person-image" xbl:inherits="src=image" /> <xul:vbox flex="1"> <xul:label xbl:inherits="value=name" /> <xul:description xbl:inherits="value=greeting" /> </xul:vbox> <xul:vbox> <xul:button label="&xulshoo
lhello.remove.label;" accesskey="&xulshoo
lhello.remove.accesskey;" oncommand="document.getbindingparent(this).remove(event);" /> </xul:vbox> ...
...in order to work around this problem, the anonid attribute is used instead: <xul:label anonid="xulshoo
lhello-name-label" xbl:inherits="value=name" /> and then, in order to get a reference to the node from the js code in your binding, we use the getanonymouselementbyattribute dom method: let namelabel = document.getanonymouselementbyattribute( this, "anonid", "xulshoo
lhello-name-label"); implementation the implementation section defines most of the scripting side of your element.
...all you need is to use the extends attribute of the binding element: <binding id="manager" extends="chrome://xulschoo
lhello/content/person.xml#person"> this gives you an exact copy of the "person" binding that you can override as you please.
Getting Started with Firefox Extensions - Archive of obsolete content
extension contents you may have noticed that the extension file you installed is named xulschoo
lhello1.xpi.
...issue the following command to unzip the file on linux or mac os x: unzip xulschoo
lhello1.xpi -d xulschoo
lhello1 on windows, you can change the file extension from xpi to zip, or open the file directly, then unzip it, using a zip tool.
... you should see the following directory structure: xulschoo
lhello1 chrome.manifest install.rdf content browseroverlay.xul browseroverlay.js skin browseroverlay.css locale en-us browseroverlay.dtd browseroverlay.properties that's lots of files for something so simple!
User Notifications and Alerts - Archive of obsolete content
notification boxes are very easy to create, and are very customizable: let nb = gbrowser.getnotificationbox(); let acceptbutton = new object(); let declinebutton = new object(); let message = this._bundle.getstring("xulschoo
lhello.friendmessage.label"); let that = this; acceptbutton.label = this._bundle.getstring("xulschoo
lhello.acceptbutton.label"); acceptbutton.accesskey = this._bundle.getstring("xulschoo
lhello.acceptbutton.accesskey"); acceptbutton.popup = null; acceptbutton.callback = function() { that.acceptrequest(); }; // similarly for decline button.
... nb.appendnotification( message, "xulschoo
lhello-friend-notification", "chrome://xulschoo
lhello/skin/friend-notification.png", nb.priority_info_high, [ acceptbutton, declinebutton ]); all browser tabs have a notification box by default, so you don't need to do any overlaying.
...on the other hand, alerts are displayed only temporarily using the alerts service is similar to using notification boxes: let alertsservice = cc["@mozilla.org/alerts-service;1"].getservice(ci.nsialertsservice); let title = this._bundle.getstring("xulschoo
lhello.greeting.title"); let message = this._bundle.getstring("xulschoo
lhello.greeting.label"); alertsservice.showalertnotification( "chrome://xulschoo
lhello/skin/hello-notification.png", title, message, true, "", this, "xulschool hello message"); we pass this as an argument, assuming that this is an object that implements nsiobserver.
Creating a dynamic status bar extension - Archive of obsolete content
httprequest = new xm
lhttprequest(); httprequest.open('get', fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } the httprequest variable will contain an xm
lhttprequest object.
...the first thing we do is create a new xm
lhttprequest object to use for processing our request.
...we then fetch the result returned by the web server into the variable output from the xm
lhttprequest.responsetext property.
JXON - Archive of obsolete content
if you have already have a dom tree from using xm
lhttprequest, skip to the next paragraph.
... note: if you are using an instance of xm
lhttprequest in order to retrieve your xml file, please use the yourrequest.responsexml property to get a parsed xml document.
... alert((new xmlserializer()).serializetostring(newdoc)); }; var oreq = new xm
lhttprequest(); oreq.onload = reqlistener; oreq.open("get", "example.xml", true); oreq.send(); jxon.build syntax jxon.build(document[, verbosity[, freeze[, nesteattributes]]]) jxon.build description returns a javascript object based on the given xml document.
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
nsiexterna
lhelperappservice if we can't do anything else with a load, we give it to the nsiexterna
lhelperappservice and let it look for a helper app, put up the "what do i do now?" dialog, and so forth.
... bird's eye view <map id="loaddiagrammap" name="loaddiagrammap"><area alt="(13) docontent()" coords="534,239,715,300" href="#nsiexterna
lhelperappservice::docontent"> <area alt="(10) getcategoryentry()" coords="575,418,821,418,821,455,629,455,629,484,575,484" href="#categorymanager" shape="poly"> <area alt="(12)" coords="539,133,583,163" href="#stream-converter"> <area alt="(11)" coords="485,133,537,163" href="#contenthandler"> <area alt="(9)" coords="445,132,484,165" href="#nsdocumentopeninfo::dispatchcontent"> <area alt="(8)" coords="405,133,439,162" href="#onstartrequest-innards"> <area alt="(7) onstartrequest()" coords="639,129,703,129,703,165,833,165,833,204,639,204" href="#onstartrequest" shape="poly"> <area alt="(6) asyncopen()" coords="637,121,709,121,709,96,783,96,783,58,637,58" hre...
...="#openuri-innards"> <area alt="(0) registercontentlistener()" coords="37,474,346,474,346,505,88,505,88,535,37,535" href="#registercontentlistener" shape="poly"> <area alt="(3) openuri() (nsuriloader)" coords="5,207,312,269" href="#openuri"> <area alt="(2)" coords="102,114,139,148" href="#internalload"> <area alt="(1) loaduri/onlinkclick" coords="77,5,449,59" href="#loaduri"> <area alt="nsiexterna
lhelperappservice" coords="527,305,839,339" href="#nsiexterna
lhelperappservice"> <area alt="category manager" coords="683,467,807,527" href="#nscategorymanager"> <area alt="nsdocumentopeninfo" coords="371,71,635,185" href="#nsdocumentopeninfo"> <area alt="necko" coords="721,113,821,157" href="#necko"> <area alt="nsuriloader" coords="23,335,215,455" href="#nsuriloader"> <area coords="227,515,485,575"...
Helper Apps (and a bit of Save As) - Archive of obsolete content
when this fails, uriloader asks an nsiexterna
lhelperappservice to handle the load.
... the nsexterna
lhelperappservice looks up the nsimimeinfo for the load and creates an nsihelperapplauncher to manage the load.
... launching a helper application this is delegated to the nspiexternalapplauncher (also implemented by the nsexterna
lhelperapphandler): windows: launch either directly via nsiprocess or via the ::shellexecute() method depending on where the mimeinfo came from.
Uploading and Downloading Files - Archive of obsolete content
this operation can also be performed via a script using the xm
lhttprequest object.
...the formdata object can then simply be passed to xm
lhttprequest: function upload(posturl, fieldname, filepath) { var formdata = new formdata(); formdata.append(fieldname, new file(filepath)); var req = new xm
lhttprequest(); req.open("post", posturl); req.onload = function(event) { alert(event.target.responsetext); }; req.send(formdata); } http put you can also upload a file using an http put operation.
... function uploadput(posturl, filepath) { var req = new xm
lhttprequest(); req.open("put", posturl); req.setrequestheader("content-type", "text/plain"); req.onload = function(event) { alert(event.target.responsetext); } req.send(new file(filepath)); } in this example, a new input stream is created for a file, and is passed to the xm
lhttprequest's send method.
Collision detection - Game development
first, add a new line inside your update() function that checks for collision detection between ball and bricks, as shown below: function update() { game.physics.arcade.collide(ball, paddle); game.physics.arcade.collide(ball, bricks, bal
lhitbrick); paddle.x = game.input.x || game.world.width*0.5; } the ball's position is calculated against the positions of all the bricks in the group.
... the third, optional parameter is the function executed when a collision occurs — bal
lhitbrick().
... create this new function as the bottom of your code, just before the closing </script> tag, as follows: function bal
lhitbrick(ball, brick) { brick.kill(); } and that's it!
Index - MDN Web Docs Glossary: Definitions of Web-related terms
14 ajax ajax, codingscripting, glossary, infrastructure, l10n:priority ajax, which initially stood for asynchronous javascript and xml, is a programming practice of building complex, dynamic webpages using a technology known as xm
lhttprequest.
... 391 spa (single-page application) glossary, spa, single-page app an spa (single-page application) is a web app implemention that loads only a single web document, and then updates the body content of that single document via javascript apis such as xm
lhttprequest and fetch when different content is to be shown.
... 507 xhr (xm
lhttprequest) api, beginner, codingscripting, glossary, xm
lhttprequest xm
lhttprequest (xhr) is a javascript api to create ajax requests.
Introducing asynchronous JavaScript - Learn web development
let's look at another example that loads a resource via the xm
lhttprequest api (run it live, and see the source): function loadasset(url, type, callback) { let xhr = new xm
lhttprequest(); xhr.open('get', url); xhr.responsetype = type; xhr.onload = function() { callback(xhr.response); }; xhr.send(); } function displayimage(blob) { let objecturl = url.createobjecturl(blob); let image = document.createelement('img'); image.src = objectu...
...it uses xm
lhttprequest (often abbreviated to "xhr") to fetch the resource at the given url, then pass the response to the callback to do something with.
...a good example is the fetch() api, which is basically like a modern, more efficient version of xm
lhttprequest.
Working with JSON - Learn web development
we are going to load it into our page, and use some nifty dom manipulation to display it, like this: obtaining the json to obtain the json, we use an api called xm
lhttprequest (often called xhr).
...add the following at the bottom of your javascript code: let requesturl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; to create a request, we need to create a new request object instance from the xm
lhttprequest constructor, using the new keyword.
... add the following below your last line: let request = new xm
lhttprequest(); now we need to open the request using the open() method.
Getting started with Svelte - Learn web development
it will start a local server at loca
lhost:5000.
... you can see this in action by opening loca
lhost:5000 in a new browser tab, right/ctrl-clicking on the hello world!
... at this point you can try updating your app.svelte component — for example change the <h1> element on line 6 of app.svelte so that it reads like this: <h1>hello {name} from mdn!</h1> just save your changes and the app running at loca
lhost:5000 will be automatically updated.
Setting up your own test automation environment - Learn web development
you can use any url to point to your resource, including a file:// url to test a local document: driver.get('file:///users/chrismills/git/learning-area/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html'); or driver.get('http://loca
lhost:8888/fake-div-buttons.html'); but it is better to use a remote server location so the code is more flexible — when you start using a remote server to run your tests (see later on), your code will break if you try to use local paths.
... the server will run on http://loca
lhost:4444/wd/hub — try going there now to see what you get.
... update the second code block (which starts with let driver = ...) like so let driver = new webdriver.builder() .forbrowser('firefox') .usingserver('http://loca
lhost:4444/wd/hub') .build(); run your test, and you should see it run as expected; this time however you will be runing it on the standalone server: node google_test_remote.js so this is pretty cool.
IPDL Tutorial
generated c++ code when pplugin.ipdl is compiled, the headers ppluginparent.h, and ppluginchild.h will be generated in the ipc/ipdl/_ipd
lheaders/ directory of the build tree.
...g); foo(entry.name(), entry.value()); // named accessor functions return references to the members arrays ipdl has simple syntax for arrays: invokemethod(nscstring[] args); in c++ this is translated into a nstarray reference: virtual bool recvinvokemethod(nstarray<nscstring>& args); ipdl's generated data structures can be used in several protocols if they are defined in a separate .ipd
lh file.
...to use the structures defined in foo.ipd
lh, include it as follows.
Building NSS
run the standard suite by: host=loca
lhost domsuf=localdomain use_64=1 nss/tests/all.sh unit test configuration nss tests are configured using environment variables.
...replace loca
lhost and localdomain with the hostname and domain suffix for your host.
... if you don't have a domain suffix you can add an entry to /etc/hosts (on windows, c:\windows\system32\drivers\etc\hosts) as follows: 127.0.0.1 loca
lhost.localdomain validate this opening a command shell and typing: ping loca
lhost.localdomain.
Components.utils.importGlobalProperties
system scopes such as jsms and frame scripts don't have certain objects, such as indexeddb and xm
lhttprequest, that are available to dom window globals.
... atob blob btoa crypto css fetch file nsidomfile indexeddb nodefilter firefox 60 nsidomnodefilter obsolete since gecko 60 rtcidentityprovider textdecoder textencoder url urlsearchparams xm
lhttprequest nsixm
lhttprequest obsolete since gecko 60 for string/object in table without a minimum firefox version, it is not exactly known since when it was available, however it is guranteed available from firefox 28 and up.
... var domfile = services.appshell.hiddendomwindow.file('/path/to/file'); xpcom components some objects have an xpcom alternative, which typically allows more flexibility then the dom version here is an example of how to use the dom xm
lhttprequest through xpcom interface of nsixm
lhttprequest: var oreq = cc["@mozilla.org/xmlextras/xm
lhttprequest;1"].createinstance(ci.nsixm
lhttprequest); ...
nsIAppShellService
boolean createstartupstate(in long awindowwidth, in long awindowheight); obsolete since gecko 1.8 nsixulwindow createtoplevelwindow(in nsixulwindow aparent, in nsiuri aurl, in pruint32 achromemask, in long ainitialwidth, in long ainitia
lheight, in nsiappshell aappshell); nsiwebnav createwindowlessbrowser (in bool aischrome) void destroyhiddenwindow(); void doprofilestartup(in nsicmdlineservice acmdlineservice, in boolean caninteract); obsolete since gecko 1.8 void ensure1window(in nsicmdlineservice acmdlineservice); obsolete since gecko 1.8 void enterlastwindowclosingsurvivalarea(); ob...
... nsixulwindow createtoplevelwindow( in nsixulwindow aparent, in nsiuri aurl, in boolean ashowwindow, in boolean aloaddefaultpage, in pruint32 achromemask, in long ainitialwidth, in long ainitia
lheight, in nsiappshell aappshell ); parameters aparent the parent window.
... ainitia
lheight height, in pixels, of the window.
nsIAuthPrompt
for example, ldap://loca
lhost/dc=test.
...for example, ldap://loca
lhost/dc=test.
...for example, ldap://loca
lhost/dc=test.
nsISelectionController
; short getdisplayselection(); nsiselection getselection(in short type); void intralinemove(in boolean forward, in boolean extend); void linemove(in boolean forward, in boolean extend); void pagemove(in boolean forward, in boolean extend); void repaintselection(in short type); void scrol
lhorizontal(in boolean left); void scrollline(in boolean forward); void scrollpage(in boolean forward); void scrollselectionintoview(in short type, in short region, in short flags); void selectall(); void setcaretenabled(in boolean enabled); void setcaretreadonly(in boolean readonly); void...
... scrol
lhorizontal() will scroll left or right dependent on the boolean.
... void scrol
lhorizontal( in boolean left ); parameters left if true will scroll left.
BaseAudioContext.decodeAudioData() - Web APIs
in this case the arraybuffer is loaded from xm
lhttprequest and filereader.
... syntax older callback syntax: baseaudiocontext.decodeaudiodata(arraybuffer, successcallback, errorcallback); newer promise-based syntax: promise<decodeddata> baseaudiocontext.decodeaudiodata(arraybuffer); parameters arraybuffer an arraybuffer containing the audio data to be decoded, usually grabbed from xm
lhttprequest, windoworworkerglobalscope.fetch() or filereader.
...// then we put the buffer into the source function getdata() { source = audioctx.createbuffersource(); var request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { source.buffer = buffer; source.connect(audioctx.destination); source.loop = true; }, function(e){ console.log("error with decoding a...
GlobalEventHandlers.onpointercancel - Web APIs
syntax targetelement.onpointercancel = cance
lhandler; var cance
lhandler = targetelement.onpointercancel; value cance
lhandler the pointercancel event handler for element targetelement.
... <html> <script> function cance
lhandler(ev) { // process the pointercancel event } function init() { var el = document.getelementbyid('target1'); el.onpointercancel = cance
lhandler; } </script> <body onload="init();"> <div id="target1"> touch me ...
... </div> <div id="target2" onpointercancel="cance
lhandler(event)"> touch me ...
ProgressEvent - Web APIs
the progressevent interface represents events measuring progress of an underlying process, like an http request (for an xm
lhttprequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>).
... examples the following example adds a progressevent to a new xm
lhttprequest and uses it to display the status of the request.
... var progressbar = document.getelementbyid("p"), client = new xm
lhttprequest() client.open("get", "magical-unicorns") client.onprogress = function(pe) { if(pe.lengthcomputable) { progressbar.max = pe.total progressbar.value = pe.loaded } } client.onloadend = function(pe) { progressbar.value = pe.loaded } client.send() specifications specification status comment xm
lhttprequestthe definition of 'progressevent' in that specification.
SubtleCrypto.importKey() - Web APIs
ybuffer-to-and-from-string */ function str2ab(str) { const buf = new arraybuffer(str.length); const bufview = new uint8array(buf); for (let i = 0, strlen = str.length; i < strlen; i++) { bufview[i] = str.charcodeat(i); } return buf; } const pemencodedkey = `-----begin private key----- miievqibadanbgkqhkig9w0baqefaascbkcwggsjageaaoibaqdd0tpv/du2vftjvxj1t/gxtk39snbvroaeb/jkzxae+xa0h+3
lhzaqiqnmfacibsgifzuvegb+7tqxwqpolofr/r7mvgwcsk98jyrvtved8zmzyyitsy7m2hcasqafikyoouv5vzyre87/leyzzbpf3bqq4idaqu+k9hj5fkuu6rroeohsdnjc+vddqlschxvmolz9vtt+ok9j4/tolwr4cg8khdlburcby6gpclo3dpu09sw+6ctx2cx4mkxx6o/0mmdtmacr/vu50kdrmlefezyowpaehhmfywybtuzbipvizvp8wfcsknmbfi1s9a9pdbqnebwwhhx3/hsebt2bagmbaaecggeabei1p6nf6zs7mjlybdv+pfl5rjl2coqly6tovvzvblmkcppjyfunipdk2tk2i897zaxfhpdbikmllm2hq6jzqkb110oantpdg...
...0jxzmiihps32s1d/ki
lhjgff4hjd4nxp1l1dp8bupollorr2tym2x6dccgfw9
lhtr8o03qp4hjn84vjgiwadyck83mgs4nrsnhkdiqynwx1ajkly51yek6rcrdmi0th2rxrrinoc35svv+apt2rkomgi52rwtesea1kzgfrxjq61rejif6p2vxecvhex6cwlx014lgk43z6q28p6hgeevefijyqcuea5du/myb/qsrscosxlxbqwqkbgqd1+fdc9zimrvi+km7nx2ckbn8rjrdmuh5sbxn2myjdrud8bynnzkcgkmgxvxsvjrbmvorby2txoiqudzkk5md3e5o/qzwpwqlgru8ueynpobax9nrgnfz7rzd+81vh5mfzixfuzouzv29izhu0oqyz9y75ehkldrernkwyoe5auqkbgqdlzapdi1nxkbgsj9iio4kua7jvd4jjrqfy4zhj/jbqvlvm0f/ufp7sxvchgx4r11c+6icbhx4u+zuu0hgjt4d+hnxmggyxr8fiuvxolotdkvja5sobzk73/9/mbekusdmjprhalzqfmujrwioevdmhfg3tw/rbj5ryatp2dtvumqkbgds8yr52drmt+bwxofwwawb0nhyhsfz/c8v4d4ip5dj5m5kuqquxjwksysgqa40sbqnd05fbqovplu48hfgr/zghn9hujbcsozovozr4srw0uztbva+7jzoz1hkaoywiulr6vca0yurnlj6g5r56+srnkioetupi2dlczcqb0poxaogazynhvtlvizn4igsrjz5qkm4liwb...
... = 0, strlen = str.length; i < strlen; i++) { bufview[i] = str.charcodeat(i); } return buf; } const pemencodedkey = `-----begin public key----- miibijanbgkqhkig9w0baqefaaocaq8amiibcgkcaqeay3xo3u13dc+xojwqywojlcboq5fovy8llnqcjm1w1bftxihoajwohihuirmctv7dzx47tllmarskvtrjd0df92jx/xy20lz+dxp8yl5yuwafga3xko3lsjgeoex10nb8jfkmgsb7qiudtvvbbudfd5fwibmctacwwx7nyewwdb7a9cfxj7ejrdrdak3ux/tom
lhfxvlqsl341tkcf4zqoz96rfpugpplofvn0x66cm1pqckdhzje6u5xge964zkkyuppsy6dcie4obhw4vdjgumlzv0z7ud010rlineugde2fqbfy/c+uwignpbpkkq+bv/uigs6dhqtcved5wgybqidaqab -----end public key-----`; function importrsakey(pem) { // fetch the part of the pem string between header and footer const pemheader = "-----begin public key-----"; const pemfooter = "-----end public key-----"; const pemconten...
Web Authentication API - Web APIs
- the server is connected by https or is the loca
lhost), and will not be available for use if the browser is not operating in a secure context.
...typically, server communications would be rest over https (probably using xm
lhttprequest or fetch), but they could also be soap, rfc 2549 or nearly any other protocol provided that the protocol is secure.
...typically, server communications would be rest over https (probably using xm
lhttprequest or fetch), but they could also be soap, rfc 2549 or nearly any other protocol provided that the protocol is secure.
Functions and classes available to Web Workers - Web APIs
8 (8) no support no support no support formdata formdata objects provide a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the xm
lhttprequest send() method.
... basic implementation (yes) appcodename, product, taintenabled(): 28 (28) online: 29 (29) navigatorlanguage: (yes) appname, appversion, online, platform, useragent: 10.0 other: no support (yes) (yes) xm
lhttprequest creates and returns a new xm
lhttprequest object; this mimics the behavior of the standard xm
lhttprequest() constructor.
... note that the responsexml and channel attributes on xm
lhttprequest always return null.
Using Web Workers - Web APIs
in addition, they can perform i/o using xm
lhttprequest (although the responsexml and channel attributes are always null).
...in addition, workers may use xm
lhttprequest for network i/o, with the exception that the responsexml and channel attributes on xm
lhttprequest always return null.
... functions and interfaces available in workers you can use most standard javascript features inside a web worker, including: navigator xm
lhttprequest array, date, math, and string windowtimers.settimeout and windowtimers.setinterval the main thing you can't do in a worker is directly affect the parent page.
Border-radius generator - CSS: Cascading Style Sheets
"> </div> <div id="radius-ui-sliders"> <div id="tlr" class="ui-input-slider" data-topic="top-left" data-unit=" px" data-sensivity="2"></div> <div id="tlw" class="ui-input-slider" data-topic="top-left-w" data-unit=" px" data-sensivity="2"></div> <div id="t
lh" class="ui-input-slider" data-topic="top-left-h" data-unit=" px" data-sensivity="2"></div> <div id="trr" class="ui-input-slider" data-topic="top-right" data-unit=" px" data-sensivity="2"></div> <div id="trw" class="ui-input-slider" data-topic="top-right-w" data-unit=" px" data-sensi...
... data-unit=" px" data-sensivity="2"></div> <div id="blr" class="ui-input-slider" data-topic="bottom-left" data-unit=" px" data-sensivity="2"></div> <div id="blw" class="ui-input-slider" data-topic="bottom-left-w" data-unit=" px" data-sensivity="2"></div> <div id="b
lh" class="ui-input-slider" data-topic="bottom-left-h" data-unit=" px" data-sensivity="2"></div> </div> </div> </div> </div> <div id="controls" class="group section"> <div class="group section"> <div id="dimensions"> <div class="ui-input-slider" data-topic="width" data-info="width" ...
...order-bottom-left-radius: 100%; bottom: 0; } /* input sliders */ #preview .ui-input-slider { margin: 10px; position: absolute; z-index: 10; } #radius-ui-sliders { width: 100%; height: 100%; min-height: 75px; min-width: 150px; padding: 20px 50px; top: -20px; left: -50px; position: relative; } #tlr { top: -30px; left: -50px; display: none; } #tlw { top: -30px; left: 30px; } #t
lh { top: 20px; left: -50px; } #trr { top: -30px; right: -50px; display: none; } #trw { top: -30px; right: 30px; } #trh { top: 20px; right: -50px; } #brr { bottom: -30px; right: -50px; display: none; } #brw { bottom: -30px; right: 30px; } #brh { bottom: 20px; right: -50px; } #blr { bottom: -30px; left: -50px; display: none; } #blw { bottom: -30px; left: 30px; } #b
lh { ...
CSS values and units - CSS: Cascading Style Sheets
lh line height of the element.
... r
lh line height of the root element.
... specifications specification status comment css values and units module level 4 editor's draft adds the vi, vb, ic, cap,
lh and r
lh units.
<length> - CSS: Cascading Style Sheets
lh equal to the computed value of the line-height property of the element on which it is used, converted to an absolute length.
... r
lh equal to the computed value of the line-height property on the root element (typically <html>), converted to an absolute length.
... editor's draft adds the vi, vb, ic,
lh, and r
lh units.
Index - Developer guides
2 ajax ajax, dom, json, javascript, references, xm
lhttprequest asynchronous javascript and xml, while not a technology in itself, is a term coined in 2005 by jesse james garrett, that describes a "new" approach to using a number of existing technologies together 3 community ajax if you know of useful mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here.
... 4 getting started ajax, api, advanced, javascript, webmechanics, xm
lhttprequest this article guides you through the ajax basics and gives you some simple hands-on examples to get you started.
... 37 parsing and serializing xml ajax, add-ons, dom, dom parsing, document, extensions, guide, htmldocument, json, parsing, parsing xml, serializing, serializing xml, xml, xmldocument, xm
lhttprequest in this article, we'll look at the objects provided by the web platform to make the common tasks of serializing and parsing xml easy.
Parsing and serializing XML - Developer guides
xm
lhttprequest loads content from a url; xml content is returned as an xml document object with a dom tree built from the xml itself.
..."error while parsing" : odom.documentelement.nodename); parsing url-addressable resources into dom trees using xm
lhttprequest here is sample code that reads and parses a url-addressable xml file into a dom tree: var xhr = new xm
lhttprequest(); xhr.onload = function() { dump(xhr.responsexml.documentelement.nodename); } xhr.onerror = function() { dump("error while getting xml."); } xhr.open("get", "example.xml"); xhr.responsetype = "document"; xhr.send(); the value returned in the xhr object's responsexm...
...alternatively, use a dom tree obtained from xm
lhttprequest.
Basic Example - XSLT: Extensible Stylesheet Language Transformations
select="@company" /> </b> </xsl:if> <br /> </xsl:template> <xsl:template match="myns:body"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> the example loads using synchronous xm
lhttprequest both the .xsl (xslstylesheet) and the .xml (xmldoc) files into memory.
... figure 6 : example var xslstylesheet; var xsltprocessor = new xsltprocessor(); var mydom; var xmldoc; function init(){ // load the xslt file, example1.xsl var myxm
lhttprequest = new xm
lhttprequest(); myxm
lhttprequest.open("get", "example1.xsl", false); myxm
lhttprequest.send(null); xslstylesheet = myxm
lhttprequest.responsexml; xsltprocessor.importstylesheet(xslstylesheet); // load the xml file, example1.xml myxm
lhttprequest = new xm
lhttprequest(); myxm
lhttprequest.open("get", "example1.xml", false); myxm
lhttprequest.send(null); xmldoc = m...
...yxm
lhttprequest.responsexml; var fragment = xsltprocessor.transformtofragment(xmldoc, document); document.getelementbyid("example").innerhtml = ""; mydom = fragment; document.getelementbyid("example").appendchild(fragment); } ...
request - Archive of obsolete content
for more advanced usage, check out the net/xhr module, based on the browser's xm
lhttprequest object.
...this option sets the mozanon property in the underlying xm
lhttprequest object.
Getting started (cfx) - Archive of obsolete content
for example: while true ; do cfx xpi ; wget --post-file=codesy.xpi http://loca
lhost:8888/ ; sleep 5 ; done note that the logging level defined for the console is different when you use this method, compared to the logging level used when an add-on is run using cfx run.
... another example using grunt and grunt-shell: module.exports = function(grunt) { 'use strict'; require('matchdep').filterdev('grunt-!(cli)').foreach(grunt.loadnpmtasks); grunt.initconfig({ shell: { xpi: { command: [ 'cd pluginpath', 'cfx xpi', 'wget --post-file=pluginname.xpi http://loca
lhost:8888/ || echo>/dev/null' ].join('&&') } }, watch: { xpi: { files: ['pluginpath/**'], tasks: ['shell:xpi'] } } }); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-shell'); grunt.registertask('default', ['watch']); }; ...
Twitter - Archive of obsolete content
in fact it's hardly more than syntactic sugar for doing xm
lhttprequests.
... error(xm
lhttprequest, textstatus, errorthrown) xm
lhttprequest is the xhr used in the request.
slideBar - Archive of obsolete content
jetpack.future.import("slidebar"); methods append(iconurihtm
lhtml/xmlurluriwidthintpersistboolautoreloadboolonclickfunctiononselectfunctiononreadyfunction)this is a list of options to specify modifications to your slidebar instance.
... iconhref oficon to show in the slidebaruri htm
lhtml content for the featurehtml/xml urlurl to load content for the featureuri widthwidth of the content area and the selected slide sizeint persistdefault slide behavior when being selectedbool autoreloadautomatically reload content on selectbool onclickcallback when the icon is clickedfunction onselectcallback when the feature is selectedfunction onreadycallback when featured is loadedfunction an example: jetpack.slidebar.append({ url: "http://mozilla.com", width: 150, onclick: function(slide){ slide.icon.src = "chrome://branding/content/icon48.png"; }}); ...
Plug-n-Hack Phase1 - Archive of obsolete content
for example: var manifest = {"detail":{"url":"http://loca
lhost:8080/manifest"}}; var evt = new customevent('configuresectool', manifest); it is suggested that browsers wishing to support pnh restrict handling of customevents such that they’re ignored where the event happens outside of user initiated actions.
... an example manifest (for owasp zap) is: { "toolname":"owasp zap", "protocolversion":"0.2", "features":{ "proxy":{ "pac":"http://loca
lhost:8080/proxy.pac", "cacert":"http://loca
lhost:8080/other/core/other/rootcert/" }, "commands":{ "prefix":"zap", "manifest":"http://loca
lhost:8080/other/mitm/other/service/" } } } the top level manifest includes optional links to a proxy pac and a root ca certificate.
Supporting per-window private browsing - Archive of obsolete content
var channel = services.io.newchannel("http://example.org", null, null); channel.queryinterface(components.interfaces.nsiprivatebrowsingchannel); channel.setprivate(true); // force the channel to be loaded in private mode similarly, xm
lhttprequest objects created via createinstance(ci.nsixm
lhttprequest) will often require explicit adjustment, since they have no context from which to derive a privacy status.
... var xhr = components.classes["@mozilla.org/xmlextras/xm
lhttprequest;1"].createinstance(components.interfaces.nsixm
lhttpreqeust); var channel = xhr.channel.queryinterface(components.interfaces.nsiprivatebrowsingchannel); channel.setprivate(true); ...
URIs and URLs - Archive of obsolete content
this means that it should be possible to add new protocols to necko just by implementing nsiprotoco
lhandler and nsichannel.
...which one has to be used is defined by the implementation of nsiprotoco
lhandler for the scheme in question.
Property - Archive of obsolete content
ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist persistence placeholder pmindicator popup popupboxobject popupopen position predicate preferenceelements preferencepanes preferences priority radiogroup readonly readonly ref resource resultspopup scrollboxobject scrollincrement scrol
lheight scrollwidth searchbutton searchcount searchlabel searchparam searchsessions second secondleadingzero securityui selected selectedbrowser selectedcount selectedindex selecteditem selecteditems selectedpanel selectedtab selectionend selectionstart selstyle seltype sessioncount sessionhistory showcommentcolumn showpopup size smoothscroll ...
...hild dom:element.lastchild dom:element.lastelementchild dom:element.localname dom:element.namespaceuri dom:element.nextelementsibling dom:element.nextsibling dom:element.nodename dom:element.nodetype dom:element.nodevalue dom:element.ownerdocument dom:element.parentnode dom:element.prefix dom:element.previouselementsibling dom:element.previoussibling dom:element.scrol
lheight dom:element.scrollleft dom:element.scrolltop dom:element.scrollwidth dom:element.tagname dom:element.textcontent ...
XUL Structure - Archive of obsolete content
http://loca
lhost/~username/ ), regardless of whether they are html or xul or another document type, are limited in the type of operations they can perform, for security reasons.
... if you are going to use xul on a web site, you can just put the xul file on the web site as you would an html file, and then load its url in a browser http://loca
lhost/xul.php.
browser - Archive of obsolete content
attributes autocompleteenabled, autocompletepopup, autoscroll, disablehistory, disablegloba
lhistory, disablesecurity, droppedlinkhandler, homepage, showcaret, src, type properties accessibletype, cangoback, cangoforward, contentdocument, contentprincipal, contenttitle, contentvieweredit, contentviewerfile, contentwindow, currenturi, docshell, documentcharsetinfo, homepage, markupdocumentviewer, messagemanager, preferences, securityui, sessionhistory, webbrowserfind, webnavigation, we...
... disablegloba
lhistory type: boolean disables global history for the docshell attached to the browser while keeping session history active.
dialog - Archive of obsolete content
attributes buttonaccesskeyaccept, buttonaccesskeycancel, buttonaccesskeydisclosure, buttonaccesskeyextra1, buttonaccesskeyextra2, buttonaccesskeyhelp, buttonalign, buttondir, buttondisabledaccept, buttonlabelaccept, buttonlabelcancel, buttonlabeldisclosure, buttonlabelextra1, buttonlabelextra2, buttonlabe
lhelp, buttonorient, buttonpack, buttons, defaultbutton, title properties buttons, defaultbutton methods acceptdialog, canceldialog, centerwindowonscreen, getbutton, movetoalertposition examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeep...
... buttonlabe
lhelp type: string the label to appear on the "help" button.
CommandLine - Archive of obsolete content
define your own command line handler component: components/c
lh.js const nsisupports = components.interfaces.nsisupports; const nsicategorymanager = components.interfaces.nsicategorymanager; const nsicomponentregistrar = components.interfaces.nsicomponentregistrar; const nsicommandline = components.interfaces.nsicommandline; const nsicommandlinehandler = components.interfaces.nsicommandlinehandler; const nsifactory ...
... = components.interfaces.nsifactory; const nsimodule = components.interfaces.nsimodule; const class_id = components.id("178cfbb6-503c-11dc-8314-0800200c9a66"); const class_name = "applicationnamec
lh"; const contract_id = "@example.com/applicationname/c
lh;1"; const cld_category = "m-applicationname"; var apphandler = { /* nsisupports */ queryinterface : function c
lh_qi(aiid) { if (aiid.equals(nsicommandlinehandler) || aiid.equals(nsifactory) || aiid.equals(nsisupports)) return this; throw components.results.ns_error_no_interface; }, /* nsicommandlinehandler */ handle : function c
lh_handle(acmdline) { var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservic...
Windows Media in Netscape - Archive of obsolete content
in particular, the xm
lhttp object is a popular one for establishing dynamic channel communication.
... netscape 7.1 offers its own xm
lhttprequest object; here is a snippet of cross-browser code that can be used: if (window.activexobject) { req = new activexobject("microsoft.xm
lhttp"); } else if (window.xm
lhttprequest) { req = new xm
lhttprequest(); } // req can be used in a cross-browser way -- the actual objects are similar // caveat emptor: look out for the case of methods and properties -- ie uses // capital letters where gecko uses lowercase other popular uses of microsoft's msxml objects are for in-memory manipulation of xml documents via xslt, perhaps to construct dynamic data for the windows media player.
Randomizing gameplay - Game development
making rebounds more random we can change the ball's velocity depending on the exact spot it hits the paddle, by modifying the x velocity each time the bal
lhitpaddle() function is run using a line along the lines of the below.
... function bal
lhitpaddle(ball, paddle) { ball.animations.play('wobble'); ball.body.velocity.x = -1*5*(paddle.x-ball.x); } it's a little bit of magic — the new velocity is higher, the larger the distance between the center of the paddle and the place where the ball hits it.
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
var j; var xincludeparent = xinclude.parentnode; try { netscape.security.privilegemanager.enableprivilege('universalxpconnect universalbrowserread'); // necessary with file:///-located files trying to reach external sites if (href !== null) { var response, responsetype; var request = new xm
lhttprequest(); request.open('get', href, false); request.setrequestheader('if-modified-since', 'thu, 1 jan 1970 00:00:00 gmt'); request.setrequestheader('cache-control', 'no-cache'); if (accept) { request.setrequestheader('accept', accept); } if (acceptlang...
...2]; } else { encodingtype = 'utf-8'; } // need to make a whole new request apparently since cannot convert the encoding after receiving it (to know what the encoding was) var request2 = new xm
lhttprequest(); request2.overridemimetype('text/plain; charset='+encodingtype); request2.open('get', href, false); request2.setrequestheader('if-modified-since', 'thu, 1 jan 1970 00:00:00 gmt'); request2.setrequestheader('cache-control', 'no-cache'); ...
Index - Learn web development
59 fetching data from the server api, article, beginner, codingscripting, fetch, json, javascript, learn, promises, server, xhr, xml, xm
lhttprequest, data, request this article shows how to start working with both xhr and fetch to fetch data from the server.
...but forms can also prepare an http request to send via javascript, for example via xm
lhttprequest.
Getting started with Ember - Learn web development
starting the development server you may start the app in development mode by typing the following command in your terminal, while inside the todomvc directory: ember server this should give you an output similar to the following: build successful (190ms) – serving on http://loca
lhost:4200/ slowest nodes (totaltime >= 5%) | total (avg) -----------------------------------------+----------- broccolimergetrees (17) | 35ms (2 ms) package /assets/vendor.js (1) | 13ms concat: vendor styles/assets/vend...
... (1) | 12ms the development server launches at http://loca
lhost:4200, which you can visit in your browser to check out what your work looks like so far.
Ember app structure and componentization - Learn web development
--}} {{outlet}} <welcomepage /> is a component provided by an ember addon that renders the default welcome page we saw in the previous article, when we first navigated to our server at loca
lhost:4200.
... type="button" class="clear-completed"> clear completed </button> </footer> finally, the contents of application.hbs should be updated so that they call the appropriate components, like so: <section class="todoapp"> <h1>todos</h1> <header /> <todolist /> <footer /> </section> with these changes made, run npm start in your terminal again, then head over to http://loca
lhost:4200 to ensure that the todo app still looks as it did before the refactor.
Getting started with React - Learn web development
the scripts installed by create-react-app will start being served at a local server at loca
lhost:3000, and open the app in a new browser tab.
...you'll notice that this change is immediately rendered in the development server running at http://loca
lhost:3000 in your browser.
Getting started with Vue - Learn web development
98% after emitting copyplugin done compiled successfully in 18121ms app running at: - local: <http://loca
lhost:8080/> - network: <http://192.168.1.9:8080/> note that the development build is not optimized.
... if you navigate to the “local” address in a new browser tab (this should be something like http://loca
lhost:8080 as stated above, but may vary based on your setup), you should see your app.
Introducing a complete toolchain - Learn web development
to start parcel off in the background, go to your terminal and run the following command: npx parcel src/index.html you should see an output like this (once the dependencies have been installed): server running at http://loca
lhost:1234 ✨ built in 129ms.
... the server is now running on the url that was printed (in this case loca
lhost:1234).
mozbrowserasyncscroll
scrol
lheight the total content height in css pixels of the document within the browser <iframe>.
... note: top + height may be larger than scrol
lheight.
ChromeWorker
addons that wish to use file:// urls must first register a resource replacement path, using code like this: var fileuri = services.io.newfileuri(file); services.io.getprotoco
lhandler('resource').
... queryinterface(ci.nsiresprotoco
lhandler).
Hash Tables
the hash table library functions are declared in the header file p
lhash.h.
... hash table types and constants hash table functions hash table types and constants p
lhashentry p
lhashtable p
lhashnumber p
lhashfunction p
lhashcomparator p
lhashenumerator p
lhashallocops hash table functions pl_newhashtable pl_hashtabledestroy pl_hashtableadd pl_hashtableremove pl_hashtablelookup pl_hashtableenumerateentries pl_hashstring pl_comparestrings pl_comparevalues see also xpcom hashtable guide ...
Index
wfpbjeembwga1ueaxmvq2vydglmawnhdgugqxv0ag9yaxr5mb4xdtew mdqyotixnty1ofoxdteymdqxodixnty1ofowotexmbuga1uechmorxhhbxbszsbe b21haw4xhjacbgnvbamtfunlcnrpzmljyxrlief1dghvcml0etccasiwdqyjkozi hvcnaqebbqadggepadccaqocggebao/bquli2kwqxfkmmmg93kn1sanzntxa/vlf tmrih3hqgjvr1ktiy9ag6cb7dskwmthp/+p4pucmql4zrsgt901qxkepyz2dymm2 rnelk+seuipiutozadhndiyse/yude8vqwj0vhcvl0w72qfucsq/wzt7fcrnuiui udewnopsun70g
lhcj/lvxl7k9bhyd4sq5czktwytfwliiwv+zy/fl6jgbgaqyqb2 bp4irmflogqsxgub1evwvdf1hagpfdspgmnepslg3/3dxn+hdjbz29eu8/xkzqeb 3v0ahkbu80zglllet2zx/wdirgjen9ymfgkfpcml+bvirsmh0vscaweaaaobqzcb qdafbgnvhsmegdawgbqatgxhqyrufkiztdp55bzlfr+tfzapbgnvhrmbaf8ebtad aqh/ma4ga1uddweb/wqeawibxjadbgnvhq4efgquae4mr0mkvhyigbxaeew2zra/ rrcwrqyikwybbquhaqeeota3mdugccsgaqufbzabhilodhrwoi8vbg9jywxob3n0 lmxvy2fszg9tywluojk...
...xodavy2evb2nzcdanbgkqhkig9w0baqufaaocaqeai8gk l3xo43u7/tdoeeswpmq+jzsdz3gz85ajt3krolwekvzzza2e2hnsvf2uxbk5amke lrxdserh9g85pv4ky7z8xz71nri3+k3uwmnqkc6t0hhyb1mw/gx8oaaoluqx3bix jbdxji73cf7xuopp
lhbjjiwygijuo8bezj5l+tf4p38mjz1snltzzpeax5bl0u76 bfu/tzfwbbe8yawytkctmcalbpj6jn2wd3m01kgozw4mmbvsj1crb9hnsgsqyhcu u0ujll1h/rwcjn607+ctekh9jlmuqciqpjnoa+kq/6f7nhnrriuzasibzc30bz5a ni7q5n1usm3ewqlvxw== -----end certificate----- listing keys keys are the original material used to encrypt certificate data.
nss tech note2
for example, 1024[805ef10]: c_findobjectsinit 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: ptemplate = 0xbffff410 1024[805ef10]: ulcount = 3 1024[805ef10]: cka_label = loca
lhost.nyc.rr.com [20] 1024[805ef10]: cka_token = ck_true [1] 1024[805ef10]: cka_class = cko_certificate [4] 1024[805ef10]: rv = 0x0 1024[805ef10]: c_findobjects 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: phobject = 0x806d810 1024[805ef10]: ulmaxobjectcount = 16 1024[805ef10]: pulobjectcount = 0xbffff38c 1024[805ef10]: *pulobjectcount = 0x1 1024[805ef10]: phobject[0] = 0...
... 0xbffff2d0 1024[805ef10]: ulcount = 2 1024[805ef10]: cka_token = 0 [1] 1024[805ef10]: cka_label = 0 [20] 1024[805ef10]: rv = 0x0 1024[805ef10]: c_getattributevalue 1024[805ef10]: hsession = 0x1000001 1024[805ef10]: hobject = 0xf6457d04 1024[805ef10]: ptemplate = 0xbffff2d0 1024[805ef10]: ulcount = 2 1024[805ef10]: cka_token = ck_true [1] 1024[805ef10]: cka_label = loca
lhost.nyc.rr.com [20] 1024[805ef10]: rv = 0x0 4.
NSS tools : certutil
wfpbjeembwga1ueaxmvq2vydglmawnhdgugqxv0ag9yaxr5mb4xdtew mdqyotixnty1ofoxdteymdqxodixnty1ofowotexmbuga1uechmorxhhbxbszsbe b21haw4xhjacbgnvbamtfunlcnrpzmljyxrlief1dghvcml0etccasiwdqyjkozi hvcnaqebbqadggepadccaqocggebao/bquli2kwqxfkmmmg93kn1sanzntxa/vlf tmrih3hqgjvr1ktiy9ag6cb7dskwmthp/+p4pucmql4zrsgt901qxkepyz2dymm2 rnelk+seuipiutozadhndiyse/yude8vqwj0vhcvl0w72qfucsq/wzt7fcrnuiui udewnopsun70g
lhcj/lvxl7k9bhyd4sq5czktwytfwliiwv+zy/fl6jgbgaqyqb2 bp4irmflogqsxgub1evwvdf1hagpfdspgmnepslg3/3dxn+hdjbz29eu8/xkzqeb 3v0ahkbu80zglllet2zx/wdirgjen9ymfgkfpcml+bvirsmh0vscaweaaaobqzcb qdafbgnvhsmegdawgbqatgxhqyrufkiztdp55bzlfr+tfzapbgnvhrmbaf8ebtad aqh/ma4ga1uddweb/wqeawibxjadbgnvhq4efgquae4mr0mkvhyigbxaeew2zra/ rrcwrqyikwybbquhaqeeota3mdugccsgaqufbzabhilodhrwoi8vbg9jywxob3n0 lmxvy2fszg9tywluojk...
...xodavy2evb2nzcdanbgkqhkig9w0baqufaaocaqeai8gk l3xo43u7/tdoeeswpmq+jzsdz3gz85ajt3krolwekvzzza2e2hnsvf2uxbk5amke lrxdserh9g85pv4ky7z8xz71nri3+k3uwmnqkc6t0hhyb1mw/gx8oaaoluqx3bix jbdxji73cf7xuopp
lhbjjiwygijuo8bezj5l+tf4p38mjz1snltzzpeax5bl0u76 bfu/tzfwbbe8yawytkctmcalbpj6jn2wd3m01kgozw4mmbvsj1crb9hnsgsqyhcu u0ujll1h/rwcjn607+ctekh9jlmuqciqpjnoa+kq/6f7nhnrriuzasibzc30bz5a ni7q5n1usm3ewqlvxw== -----end certificate----- listing keys keys are the original material used to encrypt certificate data.
sslfnc.html
syntax #include "ssl.h" secstatus ssl_handshakecallback( prfiledesc *fd, ss
lhandshakecallback cb, void *client_data); parameters this function has the following parameters: fd a pointer to the file descriptor for the ssl socket.
... description the callback function set by ssl_handshakecallback has the following prototype: typedef void (*ss
lhandshakecallback)( prfiledesc *fd, void *client_data); this callback function has the following parameters: fd a pointer to the file descriptor for the ssl socket.
certutil
wfpbjeembwga1ueaxmvq2vydglmawnhdgugqxv0ag9yaxr5mb4xdtew mdqyotixnty1ofoxdteymdqxodixnty1ofowotexmbuga1uechmorxhhbxbszsbe b21haw4xhjacbgnvbamtfunlcnrpzmljyxrlief1dghvcml0etccasiwdqyjkozi hvcnaqebbqadggepadccaqocggebao/bquli2kwqxfkmmmg93kn1sanzntxa/vlf tmrih3hqgjvr1ktiy9ag6cb7dskwmthp/+p4pucmql4zrsgt901qxkepyz2dymm2 rnelk+seuipiutozadhndiyse/yude8vqwj0vhcvl0w72qfucsq/wzt7fcrnuiui udewnopsun70g
lhcj/lvxl7k9bhyd4sq5czktwytfwliiwv+zy/fl6jgbgaqyqb2 bp4irmflogqsxgub1evwvdf1hagpfdspgmnepslg3/3dxn+hdjbz29eu8/xkzqeb 3v0ahkbu80zglllet2zx/wdirgjen9ymfgkfpcml+bvirsmh0vscaweaaaobqzcb qdafbgnvhsmegdawgbqatgxhqyrufkiztdp55bzlfr+tfzapbgnvhrmbaf8ebtad aqh/ma4ga1uddweb/wqeawibxjadbgnvhq4efgquae4mr0mkvhyigbxaeew2zra/ rrcwrqyikwybbquhaqeeota3mdugccsgaqufbzabhilodhrwoi8vbg9jywxob3n0 lmxvy2fszg9tywluojk...
...xodavy2evb2nzcdanbgkqhkig9w0baqufaaocaqeai8gk l3xo43u7/tdoeeswpmq+jzsdz3gz85ajt3krolwekvzzza2e2hnsvf2uxbk5amke lrxdserh9g85pv4ky7z8xz71nri3+k3uwmnqkc6t0hhyb1mw/gx8oaaoluqx3bix jbdxji73cf7xuopp
lhbjjiwygijuo8bezj5l+tf4p38mjz1snltzzpeax5bl0u76 bfu/tzfwbbe8yawytkctmcalbpj6jn2wd3m01kgozw4mmbvsj1crb9hnsgsqyhcu u0ujll1h/rwcjn607+ctekh9jlmuqciqpjnoa+kq/6f7nhnrriuzasibzc30bz5a ni7q5n1usm3ewqlvxw== -----end certificate----- listing keys keys are the original material used to encrypt certificate data.
Necko Interfaces Overview
nsiioservice central necko service manages protocol handlers thin layer over protocol handlers provides interface for creating uri objects from uri strings maps uri scheme to appropriate nsiprotoco
lhandler impl nsiuri (nsiurl, nsifileurl, nsistandardurl) represents an uri, with getters and setters for various uri parts (eg.
...channel is used to download the resource once) download initiated via nsichannel::asyncopen method can be canceled via nsirequest::cancel method at anytime after invocation of asyncopen method nsiprotoco
lhandler a service that manages a protocol, identified by it's uri scheme (eg.
Proxies in Necko
this means that callers can just create an nsichannel, not needing to worry about whether the channel will use a proxy or not the basic interfaces for proxies are: nsiproxyinfo, nsiprotocolproxyservice, and nsiproxiedprotoco
lhandler nsiproxyinfo is a simple helper which stores information about the type of the proxy, its host and its port.
...depending on the type of the proxy info, it either asks the http protocol handler or the protocol handler for the requested uri for a new channel with the nsiproxyinfo - if the channel supports nsiproxiedprotoco
lhandler.
JSAPI User Guide
the word javascript may bring to mind features such as event handlers (like onclick), dom objects, window.open, and xm
lhttprequest.
... rootedobject global(cx); global = js_newglobalobject(cx, &globalclass, nullptr, js::dontfireonnewgloba
lhook); if (!global) return 1; // enter the new global object's compartment.
Feed content access API
use an xm
lhttprequest to load the feed, then pass its string to an nsifeedprocessor to parse the feed.
...s["@mozilla.org/feed-processor;1"] .createinstance(components.interfaces.nsifeedprocessor); var listener = new feedtestresultlistener(); try { parser.listener = listener; parser.parsefromstring(data, uri); } catch(e) { alert("error parsing feed."); } } } httprequest = new xm
lhttprequest(); httprequest.open("get", feedurl, true); try { httprequest.onload = inforeceived; httprequest.send(null); } catch(e) { alert(e); } } the nsifeedprocessor interface lets you parse the feed data from several possible sources; in this case, we're loading a document into a string, then parsing that string using its parsefromstring() method.
nsIBrowserHistory
inherits from: nsigloba
lhistory2 last changed in gecko 22.0 (firefox 22.0 / thunderbird 22.0 / seamonkey 2.19) implemented by: @mozilla.org/browser/nav-history-service;1.
... see also places using the places history service nsigloba
lhistory2 ...
nsIDOMProgressEvent
dom/interfaces/events/nsidomprogressevent.idlscriptable this interface represents the events sent with progress information while uploading data using the xm
lhttprequest object.
... see also using xm
lhttprequest xm
lhttprequest nsixm
lhttprequesteventtarget nsixm
lhttprequest ...
nsIMimeHeaders
as a service: var mimeheaders = components.classes["@mozilla.org/????????????????????????????"] .createinstance(components.interfaces.nsimimeheaders); method overview string extractheader([const] in string headername, in boolean getallofthem); void initialize([const] in string al
lheaders, in long al
lheaderssize); attributes attribute type description al
lheaders string read only.
... methods extractheader() string extractheader( [const] in string headername, in boolean getallofthem ); parameters headername missing description getallofthem missing description return value missing description exceptions thrown missing exception missing description initialize() void initialize( [const] in string al
lheaders, in long al
lheaderssize ); parameters al
lheaders insert the complete message content al
lheaderssize length of the passed in content exceptions thrown missing exception missing description remarks see also ...
Index - Firefox Developer Tools
46 network monitor debugging, dev tools, firefox, guide, networking, tools, l10n:priority the network monitor shows you all the network requests firefox makes (for example, when it loads a page, or due to xm
lhttprequests), how long each request takes, and details of each request.
... 135 set an xhr breakpoint debugger, debugging, javascript, xhr breakpoint an xhr (xm
lhttprequest) breakpoint breaks code execution when an xhr request is dispatched so that you can examine the current state of the program.
Network request list - Firefox Developer Tools
iew of the image in a tooltip: security icons the network monitor displays an icon in the domain column: this gives you extra information about the security status of the request: icon meaning https weak https (for example, a weak cipher was used) failed https (for example, a certificate was invalid) http loca
lhost indicates that the url belongs to a known tracker that would be blocked with content blocking enabled.
... filtering requests you can filter requests by content type, by whether they are xm
lhttprequests or websocket requests, or by request properties.
Background Tasks API - Web APIs
function updatedisplay() { let scrolledtoend = logelem.scrol
lheight - logelem.clientheight <= logelem.scrolltop + 1; if (totaltaskcount) { if (progressbarelem.max != totaltaskcount) { totaltaskcountelem.textcontent = totaltaskcount; progressbarelem.max = totaltaskcount; } if (progressbarelem.value != currenttasknumber) { currenttasknumberelem.textcontent = currenttasknumber; progressbarelem.value = currenttasknumber; ...
... } } if (logfragment) { logelem.appendchild(logfragment); logfragment = null; } if (scrolledtoend) { logelem.scrolltop = logelem.scrol
lheight - logelem.clientheight; } statusrefreshscheduled = false; } first, scrolledtoend is set to true if the text in the log is scrolled to the bottom; otherwise it's set to false.
Determining the dimensions of elements - Web APIs
if you need to know the actual size of the content, regardless of how much of it is currently visible, you need to use the element.scrollwidth and element.scrol
lheight properties.
... for example, if a 600x400 pixel element is being displayed inside a 300x300 pixel scrollbox, scrollwidth will return 600 while scrol
lheight will return 400.
CanvasRenderingContext2D.drawImage() - Web APIs
for example, if you load an image and specify the optional size parameters in its constructor, you will have to use the naturalwidth and natura
lheight properties of the created instance to properly calculate things like crop and scale regions, rather than element.width and element.height.
.../ using optional size for image image.onload = drawimageactualsize; // draw when image has loaded // load an image of intrinsic size 300x227 in css pixels image.src = 'https://udn.realityripple.com/samples/db/f374e9c6fc.jpg'; function drawimageactualsize() { // use the intrinsic size of image in css pixels for the canvas element canvas.width = this.naturalwidth; canvas.height = this.natura
lheight; // will draw the image as 300x227, ignoring the custom size of 60x45 // given in the constructor ctx.drawimage(this, 0, 0); // to use the custom size we'll have to specify the scale parameters // using the element's width and height properties - lets draw one // on top in the corner: ctx.drawimage(this, 0, 0, this.width, this.height); } result specifications sp...
Element - Web APIs
element.scrol
lheight read only returns a number representing the scroll view height of an element.
... working draft added the following properties: scrolltop, scrollleft, scrollwidth, scrol
lheight, clienttop, clientleft, clientwidth, and clientheight.
Using Fetch - Web APIs
this kind of functionality was previously achieved using xm
lhttprequest.
...for example: if (window.fetch) { // run my fetch request here } else { // do something with xm
lhttprequest?
FormData - Web APIs
the formdata interface provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the xm
lhttprequest.send() method.
... specifications specification status comment xm
lhttprequestthe definition of 'formdata' in that specification.
FormDataEvent - Web APIs
this allows a formdata object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself when you wish to submit form data via a method like xm
lhttprequest (see using formdata objects).
...// construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xm
lhttprequest(); request.open("post", "/formhandler"); request.send(data); }); specifications specification status comment html living standardthe definition of 'formdataevent' in that specification.
HTMLImageElement.naturalWidth - Web APIs
the corresponding natura
lheight method returns the natural height of the image.
... javascript let output = document.queryselector(".output"); let image = document.queryselector("img"); window.addeventlistener("load", event => { output.innerhtml += `natural size: ${image.naturalwidth} x ` + `${image.natura
lheight} pixels<br>`; output.innerhtml += `displayed size: ${image.width} x ` + `${image.height} pixels`; }); the javascript code simply dumps the natural and as-displayed sizes into the <div> with the class output.
HTMLImageElement - Web APIs
htmlimageelement.natura
lheight read only returns an integer value representing the intrinsic height of the image in css pixels, if it is available; else, it shows 0.
... the following properties have been added: crossorigin, naturalwidth, natura
lheight, and complete.
Ajax navigation example - Web APIs
"&" + sviewkey + "=" + sviewmode : "").slice(1)).replace(rendqstmark, ""); } function getpage (spage) { if (bisloading) { return; } oreq = new xm
lhttprequest(); bisloading = true; oreq.onload = ajaxload; oreq.onerror = ajaxerror; if (spage) { opageinfo.url = filterurl(spage, null); } oreq.open("get", filterurl(opageinfo.url, "json"), true); oreq.send(); oloadingbox.parentnode || document.body.appendchild(oloadingbox); } function requestpage (surl) { if (history.pushstat...
...experimental)", 507: "insufficient storage", 508: "loop detected", 509: "unassigned", 510: "not extended", 511: "network authentication required" }; var oreq, bisloading = false, bupdateurl = false; oloadingbox.id = "ajax-loader"; ocover.onclick = abortreq; oloadingimg.src = "data:image/gif;base64,r0lgod
lheaaqapiaap///waaamlcwkjcqgaaagjiyokcgpkskih/c05fvfndqvbfmi4waweaaaah/hpdcmvhdgvkihdpdgggywphegxvywquaw5mbwah+qqjcgaaacwaaaaaeaaqaaadmwi63p4wyklre2mioggznadomgyjrbexwroumcg2lmdewnhqlvsyod2mbzkydadka+diaaah+qqjcgaaacwaaaaaeaaqaaadnai63p5ojcegg4qmu7dmikrxqlfuydezigbmrvsaqhwctxxf7weyb4ag1xjihkmzsiukkhiaifkecqoaaaasaaaaabaaeaaaazyiujijk8pbyjdmlfyvbovjha70gu7xsujhmktwhpakzlo9hmaokwjz7rf8aypddzkpzbqfvwqa...
Working with the History API - Web APIs
adding and modifying history entries using pushstate() changes the referrer that gets used in the http header for xm
lhttprequest objects created after you change the state.
... the referrer will be the url of the document whose window is this at the time of creation of the xm
lhttprequest object.
MediaSource - Web APIs
examples the following simple example loads a video with xm
lhttprequest, playing it as soon as it can.
...rce = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeventlistener('updateend', function (_) { mediasource.endofstream(); video.play(); //console.log(mediasource.readystate); // ended }); sourcebuffer.appendbuffer(buf); }); }; function fetchab (url, cb) { console.log(url); var xhr = new xm
lhttprequest; xhr.open('get', url); xhr.responsetype = 'arraybuffer'; xhr.onload = function () { cb(xhr.response); }; xhr.send(); }; specifications specification status comment media source extensionsthe definition of 'mediasource' in that specification.
Resource Timing API - Web APIs
an application can use the timing metrics to determine, for example, the length of time it takes to load a specific resource, such as an xm
lhttprequest, <svg>, image, or script.
... the initiatortype property returns the type of resource that initiated the performance entry such as "css" for a css resource, "xm
lhttprequest" for an xm
lhttprequest and "img" for an image (such as a jpeg).
SVGAElement - Web APIs
properties this interface also inherits properties from its parent, svggraphicselement, and implements properties from svgurireference and htm
lhyperlinkelementutils.
...not _blank"); } } specifications specification status comment scalable vector graphics (svg) 2 candidate recommendation replaced inheritance from svgelement by svggraphicselement and removed the interface implementations of svgtests, svglangspace, svgexternalresourcesrequired, svgstylable, and svgtransformable by htm
lhyperlinkelementutils scalable vector graphics (svg) 1.1 (second edition) recommendation initial definition ...
Migrating from webkitAudioContext - Web APIs
the example below shows old code which downloads an audio file over the network, and then decoded it using createbuffer(): var xhr = new xm
lhttprequest(); xhr.open("get", "/path/to/audio.ogg", true); xhr.responsetype = "arraybuffer"; xhr.send(); xhr.onload = function() { var decodedbuffer = context.createbuffer(xhr.response, false); if (decodedbuffer) { // decoding was successful, do something useful with the audio buffer } else { alert("decoding the audio buffer failed"); } }; converting this code to use decodeaudiod...
...ata() is relatively simple, as can be seen below: var xhr = new xm
lhttprequest(); xhr.open("get", "/path/to/audio.ogg", true); xhr.responsetype = "arraybuffer"; xhr.send(); xhr.onload = function() { context.decodeaudiodata(xhr.response, function onsuccess(decodedbuffer) { // decoding was successful, do something useful with the audio buffer }, function onfailure() { alert("decoding the audio buffer failed"); }); }; note that the decodeaudiodata() method is asynchronous, which means that it will return immediately, and then when the decoding finishes, one of the success or failure callback functions will get called depending on whether the audio decoding was successful.
Window.resizeTo() - Web APIs
see the screen.availwidth and screen.avai
lheight properties.
... function quarter() { window.resizeto( window.screen.availwidth / 2, window.screen.avai
lheight / 2 ); } specification specification status comment css object model (cssom) view modulethe definition of 'window.resizeto()' in that specification.
WorkerGlobalScope.location - Web APIs
example if you called the following in a document served at loca
lhost:8000 console.log(location); inside a worker (which would basically be the equivalent of self.console.log(self.location);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerlocation object written to the console — something like the following: workerlocation {hash: "", search: "", pathname: "/worker.js", port: "8000", hostname: "loca
lhost"…}...
... hash: "" host: "loca
lhost:8000" hostname: "loca
lhost" href: "http://loca
lhost:8000/worker.js" origin: "http://loca
lhost:8000" pathname: "/worker.js" port: "8000" protocol: "http:" search: "" __proto__: workerlocation you could use this location object to return more information about the document's location, as you might do with a normal location object.
Web APIs
ment htmlbrelement htmlbaseelement htmlbasefontelement htmlbodyelement htmlbuttonelement htmlcanvaselement htmlcollection htmlcontentelement htmldlistelement htmldataelement htmldatalistelement htmldetailselement htmldialogelement htmldivelement htmldocument htmlelement htmlembedelement htmlfieldsetelement htmlfontelement htmlformcontrolscollection htmlformelement htmlframesetelement htm
lhrelement htm
lheadelement htm
lheadingelement htm
lhtmlelement htm
lhyperlinkelementutils htmliframeelement htmlimageelement htmlinputelement htmlisindexelement htmlkeygenelement htmllielement htmllabelelement htmllegendelement htmllinkelement htmlmapelement htmlmarqueeelement htmlmediaelement htmlmenuelement htmlmenuitemelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelemen...
...shaderprecisionformat webglsync webgltexture webgltransformfeedback webgluniformlocation webglvertexarrayobject webkitcssmatrix websocket wheelevent window windowclient windoweventhandlers windoworworkerglobalscope worker workerglobalscope workerlocation workernavigator worklet writablestream writablestreamdefaultcontroller writablestreamdefaultwriter x xdomainrequest xmldocument xm
lhttprequest xm
lhttprequesteventtarget xm
lhttprequestresponsetype xmlserializer xpathevaluator xpathexception xpathexpression xpathnsresolver xpathresult xrboundedreferencespace xrenvironmentblendmode xreye xrframe xrframerequestcallback xrhandedness xrinputsource xrinputsourcearray xrinputsourceevent xrinputsourceeventinit xrinputsourceschangeevent xrinputsourceschangeeventinit xrpermissiondescri...
DOM onevent handlers - Developer guides
non-element objects event handlers can also be set with properties on non-element objects that generate events, like window, document, xm
lhttprequest, and others.
... for example, for the progress event on instances of xm
lhttprequest: const xhr = new xm
lhttprequest(); xhr.onprogress = function() { … }; html onevent attributes html elements have attributes named onevent which can be used to register a handler for an event directly within the html code.
HTML5 - Developer guides
xm
lhttprequest level 2 allows fetching asynchronously some parts of the page, allowing it to display dynamic content, varying according to the time and user actions.
... web-based protocol handlers you can now register web applications as protocol handlers using the navigator.registerprotoco
lhandler() method.
<a>: The Anchor element - HTML: Hypertext Markup Language
links are not restricted to http-based urls — they can use any url scheme supported by browsers: sections of a page with fragment urls pieces of media files with media fragments telephone numbers with tel: urls email addresses with mailto: urls while web browsers may not support other url schemes, web sites can with registerprotoco
lhandler() hreflang hints at the human language of the linked url.
... websites can make phone calls with registerprotoco
lhandler, such as web.skype.com.
Access-Control-Allow-Credentials - HTTP
the access-control-allow-credentials header works in conjunction with the xm
lhttprequest.withcredentials property or with the credentials option in the request() constructor of the fetch api.
... examples allow credentials: access-control-allow-credentials: true using xhr with credentials: var xhr = new xm
lhttprequest(); xhr.open('get', 'http://example.com/', true); xhr.withcredentials = true; xhr.send(null); using fetch with credentials: fetch(url, { credentials: 'include' }) specifications specification status comment fetchthe definition of 'access-control-allow-credentials' in that specification.
CSP: connect-src - HTTP
the apis that are restricted are: <a> ping, fetch, xm
lhttprequest, websocket, eventsource, and navigator.sendbeacon().
... examples violation cases given this csp header: content-security-policy: connect-src https://example.com/ the following connections are blocked and won't load: <a ping="https://not-example.com"> <script> var xhr = new xm
lhttprequest(); xhr.open('get', 'https://not-example.com/'); xhr.send(); var ws = new websocket("https://not-example.com/"); var es = new eventsource("https://not-example.com/"); navigator.sendbeacon("https://not-example.com/", { ...
Public-Key-Pins-Report-Only - HTTP
example public-key-pins-report-only: pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws="; pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6
lhkmjahkhpgpwe="; includesubdomains; report-uri="https://www.example.org/hpkp-report" in this example, pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws=" pins the server's public key used in production.
... the second pin declaration pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6
lhkmjahkhpgpwe=" also pins the backup key.
Public-Key-Pins - HTTP
public-key-pins: pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws="; pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6
lhkmjahkhpgpwe="; max-age=5184000; includesubdomains; report-uri="https://www.example.org/hpkp-report" in this example, pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws=" pins the server's public key used in production.
... the second pin declaration pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6
lhkmjahkhpgpwe=" also pins the backup key.
HTTP Index - HTTP
20 cross-origin resource sharing (cors) ajax, cors, cross-origin resource sharing, fetch, fetch api, http, http access controls, same-origin policy, security, xm
lhttprequest, l10n:priority cross-origin resource sharing (cors) is a mechanism that uses additional http headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin.
... 144 feature-policy: sync-xhr directive, feature policy, feature-policy, http, reference, xm
lhttprequest the http feature-policy header sync-xhr directive controls whether the current document is allowed to make synchronous xm
lhttprequest requests.
HTTP Public Key Pinning (HPKP) - HTTP
openssl s_client -servername www.example.com -connect www.example.com:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64 example hpkp header public-key-pins: pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws="; pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6
lhkmjahkhpgpwe="; max-age=5184000; includesubdomains; report-uri="https://www.example.org/hpkp-report" in this example, pin-sha256="cupctazwkaasuywhhnedttwpy3obake3h2+sozs7sws=" pins the server's public key used in production.
... the second pin declaration pin-sha256="m8hztczm3eluxkcjr2s5p4hhybnf6
lhkmjahkhpgpwe=" also pins the backup key.
Mixed content - Web security
active content examples this section lists some types of http requests which are considered active content: <script> (src attribute) <link> (href attribute) (this includes css stylesheets) <iframe> (src attribute) xm
lhttprequest requests fetch() requests all cases in css where a <url> value is used (@font-face, cursor, background-image, and so forth).
...chrome allows mixed content on http://127.0.0.1/ and http://loca
lhost/.
Introduction to using XPath in JavaScript - XPath
> <address street="1600 pennsylvania avenue" city="washington" country="usa"/> <phonenumber>202-456-1111</phonenumber> </person> <person> <name first="tony" last="blair" /> <address street="10 downing street" city="london" country="uk"/> <phonenumber>020 7925 0918</phonenumber> </person> </people> to make the contents of the xml document available within the extension, we create an xm
lhttprequest object to load the document synchronously, the variable xmldoc will contain the document as an xmldocument object against which we can use the evaluate method javascript used in the extensions xul/js documents.
... var req = new xm
lhttprequest(); req.open("get", "chrome://yourextension/content/peopledb.xml", false); req.send(null); var xmldoc = req.responsexml; var nsresolver = xmldoc.creatensresolver( xmldoc.ownerdocument == null ?
JavaScript/XSLT Bindings - XSLT: Extensible Stylesheet Language Transformations
this can be done via xm
lhttprequest or xmldocument.load().
... figure 1 : instantiating an xsltprocessor var xsltprocessor = new xsltprocessor(); // load the xsl file using synchronous (third param is set to false) xm
lhttprequest var myxm
lhttprequest = new xm
lhttprequest(); myxm
lhttprequest.open("get", "example.xsl", false); myxm
lhttprequest.send(null); var xslref = myxm
lhttprequest.responsexml; // finally import the .xsl xsltprocessor.importstylesheet(xslref); for the actual transformation, xsltprocessor requires an xml document, which is used in conjunction with the imported xsl file to produce the final result.
Understanding WebAssembly text format - WebAssembly
putting this together with what we have already learned, we can finally define a module containing our own simple function: (module (func (param $
lhs i32) (param $rhs i32) (result i32) local.get $
lhs local.get $rhs i32.add)) this function gets two parameters, adds them together, and returns the result.
... so our final module (for now) looks like this: (module (func $add (param $
lhs i32) (param $rhs i32) (result i32) local.get $
lhs local.get $rhs i32.add) (export "add" (func $add)) ) if you want to follow along with the example, save the above our module into a file called add.wat, then convert it into a binary file called add.wasm using wabt (see converting webassembly text format to wasm for details).
core/promise - Archive of obsolete content
lets see the implementation of readasync that we used in several of the examples above: const { defer } = require('sdk/core/promise'); function readasync(url) { var deferred = defer(); let xhr = new xm
lhttprequest(); xhr.open("get", url, true); xhr.onload = function() { deferred.resolve(xhr.responsetext); }; xhr.onerror = function(event) { deferred.reject(event); }; xhr.send(); return deferred.promise; } so defer returns an object that contains a promise and two resolve, reject functions that can be used to resolve / reject that promise.
system/child_process - Archive of obsolete content
child.stdin has no write() method (see example below for writing to child process stdin) examples adaption of node's documentation for spawn(): var child_process = require("sdk/system/child_process"); var ls = child_process.spawn('/bin/ls', ['-
lh', '/usr']); ls.stdout.on('data', function (data) { console.log('stdout: ' + data); }); ls.stderr.on('data', function (data) { console.log('stderr: ' + data); }); ls.on('close', function (code) { console.log('child process exited with code ' + code); }); writing to child process' stdin because the sdk implementation does not include a write() method for child processes, you must use the...
File I/O - Archive of obsolete content
var file = url.queryinterface(components.interfaces.nsifileurl).file; // file is a nsifile to load from file://, http://, chrome://, resource:// and other urls directly, use xm
lhttprequest or netutil.asyncfetch().
QuerySelector - Archive of obsolete content
ocument.queryselector, or following the jquery style of chaining by returning 'this' within each prototype method of $()): htmldocument.prototype.$ = function (selector) { // only for html return this.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.$('h1')); // [object htm
lheadingelement] </script> xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; example: <label value="test!"/> <script type="text/javascript"><![cdata[ xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; alert(document.$('label')); // [object xulelement] ]]></script> document.prototyp...
Rosetta - Archive of obsolete content
"" : odicts[smimetype](oscript.text); obaton.parentnode.insertbefore(ocompiled, obaton); } function reqerror (oerror) { throw new urierror("the script " + oerror.target.src + " is not accessible."); } function reqsuccess () { createscript(this.refscript, this); } function getsource (oscript) { var oreq = new xm
lhttprequest(); oreq.onload = reqsuccess; oreq.onerror = reqerror; oreq.refscript = oscript; oreq.open("get", oscript.src, true); oreq.send(null); } function parsescript (oscript) { if (oscript.hasattribute("type") && !rignoremimes.test(oscript.getattribute("type").tolowercase())) { oscript.hasattribute("src") ?
XML-related code snippets - Archive of obsolete content
how to create a dom tree using xm
lhttprequest parsing and serializing xml using xpath jxon (lossless javascript xml object notation) xsl transforms xlink xinclude xml:id xml:base support in old browsers xpointer svg namespaces, or why http://www.mozilla.org/keymaster/gat...re.is.only.xul is at the top of every xul document.
Displaying web content in an extension without security issues - Archive of obsolete content
so in the simplest case you would have: <iframe type="content" src="data:text/html,%3chtml%3e%3cbody%3e%3c/body%3e%3c/html%3e"/> but usually you don’t want to start with an empty document, you would rather want to load some template into the frame: var request = new xm
lhttprequest(); request.open("get", "chrome://foo/content/template.html", false); request.send(null); frame.setattribute("src", "data:text/html," + encodeuricomponent(request.responsetext)); that way you can have the template in your extension but still strip it off all privileges when it is loaded in a frame.
Jetpack Processes - Archive of obsolete content
these arbitrary properties are the primary means through which context can be provided for messages; for instance, if the handle is meant to represent a network request, an xm
lhttprequest instance can be attached to the handle on the chrome process.
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
the next command will import the source code: gonzui-import.exe mozilla once the import process is complete, type the following command to launch the gonzui server: gonzui-server.exe now you can access gonzui from your web browser by typing the following into your location bar : http://loca
lhost:46984 this lets you browse all packages, click on links to traverse them, and take traversed-link locations as search starting points (figure a).
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
.interfaces.nsiioservice); var url = ioservice.newfileuri(file); var fileurl = url.spec; alert(fileurl); // "file:///c:/temp/temp.txt" listing 12: converting a url to a local file path var url = 'file:///c:/temp/test.txt'; var ioservice = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); var filehandler = ioservice.getprotoco
lhandler('file') .queryinterface(components.interfaces.nsifileprotoco
lhandler); var file = filehandler.getfilefromurlspec(url); var path = file.path; alert(path); // "c:\temp\temp.txt" binary file i/o use streams, as in java, for file i/o in xpcom.
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
so, if we were to use fuel, we can do the following in the init function: init : function() { let firstrunpref = "extensions.xulschoo
lhello.firstrundone"; if (!application.prefs.getvalue(firstrunpref, false)) { application.prefs.setvalue(firstrunpref, true); // all the rest of the first run code goes here.
Adding preferences to an extension - Archive of obsolete content
var fieldarray = output.split(","); samplepanel.label = symbol + ": " + fieldarray[1]; samplepanel.tooltiptext = "chg: " + fieldarray[4] + " | " + "open: " + fieldarray[5] + " | " + "low: " + fieldarray[6] + " | " + "high: " + fieldarray[7] + " | " + "vol: " + fieldarray[8]; } } var httprequest = new xm
lhttprequest(); httprequest.open("get", fullurl, true); httprequest.onload = inforeceived; httprequest.send(null); } } note that we use stockwatcher.tickersymbol here instead of this.tickersymbol to get the stock symbol to watch.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
firefox 22 omni.jar archive file became omni.ja since http://blog.ffextensionguru.com/2011/11/16/omni-jar-to-become-omni-ja/ [root@loca
lhost firefox]# unzip -l /usr/lib/firefox/browser/omni.ja | grep defaults/pr warning [/usr/lib/firefox/browser/omni.ja]: 3598815 extra bytes at beginning or within zipfile (attempting to process anyway) error [/usr/lib/firefox/browser/omni.ja]: reported length of central directory is -3598815 bytes too long (atari stzip zipfile?
Enabling the behavior - updating the status bar panel - Archive of obsolete content
function updatetinderboxstatus() { var icon = document.getelementbyid('tinderbox-status'); if (gxm
lhttprequest.responsetext.match("ee0000")) icon.setattribute("status", "busted"); else if (gxm
lhttprequest.responsetext.match("ffaa00")) icon.setattribute("status", "testfailed"); else if (gxm
lhttprequest.responsetext.match("11dd11")) icon.setattribute("status", "success"); else icon.setattribute("status", ""); } updatetinderboxstatus() retrieves a reference to the statusbarpanel element then searches through the retrieved html document (stored in the responsetext property of the xm
lhttprequest instance) for one of several color references.
Enabling the behavior - updating the status periodically - Archive of obsolete content
function loadtinderboxstatus() { gxm
lhttprequest = new xm
lhttprequest(); gxm
lhttprequest.onload = updatetinderboxstatus; gxm
lhttprequest.open("get", "http://tinderbox.mozilla.org/seamonkey/panel.html"); gxm
lhttprequest.send(null); window.settimeout(loadtinderboxstatus, 60000); } window.settimeout(loadtinderboxstatus, 1000); window.settimeout schedules functions to run at some future time.
HTTP Class Overview - Archive of obsolete content
nshttphandler implements nsiprotoco
lhandler manages preferences owns the authentication cache holds references to frequently used services nshttpchannel implements nsihttpchannel talks to the cache initiates http transactions processes http response codes intercepts progress notifications nshttpconnection implements nsistreamlistener & nsistreamprovider talks to the socket transport service feeds data to its transaction object routes progress notifications nshttpconnectioninfo identif...
Me - Archive of obsolete content
onfirstrun() may be called anywhere in your jetpack, but if it is called as the result of some asynchronous operation such as a timeout or xm
lhttprequest, it is ignored.
Table Cellmap - Archive of obsolete content
the following routines seem to be hot spots performance wise: nscellmap::co
lhasspanningcells nscellmap::rowhasspanningcells nscellmap::rowisspannedinto users of nscellmap::getdataat outside nscellmap.cpp the border collapse code relies on the cellmap.
Using gdb on wimpy computers - Archive of obsolete content
(gdb) r starting program: /home/blizzard/src/mozilla/mozilla/dist/bin/./mozilla-bin breakpoint 1, main (argc=1, argv=0xbffff894) at nsapprunner.cpp:811 811 installunixsigna
lhandlers(argv[0]); (gdb) set auto-solib-add 0 (gdb) c continuing.
XML in Mozilla - Archive of obsolete content
outside supported xml w3c recommendations specification or technology documentation mozilla project xslt w3c recommendation xslt xpath w3c recommendation xslt xm
lhttprequest w3c recommendation xml extras request api (no longer supported) mozilla add-on sdk domparser and xmlserializer mozilla xml extras sax sax soap (no longer supported) w3c note web services xml-rpc (no longer supported) userland software ...
getLastError - Archive of obsolete content
example the following example calls getlasterror after a series of addfile calls: addfile("npplug", ...); addfile("/ms/shared/ctl3d.dll", ...); addfile("/nethelp/royalplug/roya
lhelp.html",...); err = getlasterror(); ...
Attribute (XUL) - Archive of obsolete content
autocompletesearch autocompletesearchparam autofill autofillaftermatch autoscroll beforeselected buttonaccesskeyaccept buttonaccesskeycancel buttonaccesskeydisclosure buttonaccesskeyextra1 buttonaccesskeyextra2 buttonaccesskeyhelp buttonalign buttondir buttondisabledaccept buttonlabelaccept buttonlabelcancel buttonlabeldisclosure buttonlabelextra1 buttonlabelextra2 buttonlabe
lhelp 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 ...
Providing Command-Line Options - Archive of obsolete content
entry: "m-myapp" }], queryinterface: xpcomutils.generateqi([ ci.nsicommandlinehandler ]), /* nsicommandlinehandler */ handle : function c
lh_handle(cmdline) { try { // changeme: change "viewapp" to your command line flag that takes an argument var uristr = cmdline.handleflagwithparam("viewapp", false); if (uristr) { // convert uristr to an nsiuri var uri = cmdline.resolveuri(uristr); openwindow(chrome_uri, uri); cmdline.preventdefault = true; } } catch (e) { c...
More Tree Features - Archive of obsolete content
reecol id="endtime" label="end time" flex="1" persist="width ordinal hidden" /> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joshua granville" /> <treecell label="vancouver" /> <treecell label="7:06:00" /> <treecell label="9:10:26" /> </treerow> </treeitem> <treeitem> <treerow> <treecell label="robert va
lhalla" /> <treecell label="seattle" /> <treecell label="7:08:00" /> <treecell label="9:15:51" /> </treerow> </treeitem> </treechildren> </tree> three attributes of the columns must be persisted, the width attribute to save the column widths, the ordinal attribute which holds the position of the column, and the hidden attribute which holds whether the colu...
stack - Archive of obsolete content
examples <stack> <hbox flex="1"> <image src="chrome://xulschoo
lhello/skin/stack-bg.png" flex="1"left="10"right="10" top="10" bottom="10"/> </hbox> <hbox> <!-- some content here.
Opening a Link in the Default Browser - Archive of obsolete content
this is how you do it: var extps = components.classes["@mozilla.org/uriloader/external-protocol-service;1"] .getservice(components.interfaces.nsiexternalprotocolservice); if (extps.externalprotoco
lhandlerexists("http")) { // handler for http:// urls exists } link within an iframe to enable a link inside an html document that is the "src" of an iframe to be opened in the default browser, setting the preference: pref("network.protocol-handler.expose-all", false); seems to work.
Using SOAP in XULRunner 1.9 - Archive of obsolete content
: soapclient.contenttype + "; charset=\"" + soapclient.charset + "\"", < beforesend: function(req) { < req.setrequestheader("method", "post"); < req.setrequestheader("content-length", soapclient.contentlength); < req.setrequestheader("soapserver", soapclient.soapserver); < req.setrequestheader("soapaction", soapreq.action); < } < }); --- > var xhr = new xm
lhttprequest(); > xhr.mozbackgroundrequest = true; > xhr.open('post', soapclient.proxy, true); > xhr.onreadystatechange = function() { > if (4 != xhr.readystate) { return; } > getresponse(xhr); > }; > var headers = { > 'method': 'post', > 'content-type': soapclient.contenttype + '; charset="' + > soapclient.charset + '"', > 'content-length': soapclient.content...
What XULRunner Provides - Archive of obsolete content
the following features are either already implemented or planned: gecko features xpcom networking gecko rendering engine dom editing and transaction support (no ui) cryptography xbl (xbl2 planned) xul svg xslt xml extras (xm
lhttprequest, domparser, etc.) web services (soap) auto-update support (not yet complete) type ahead find toolbar history implementation (the places implementation in the 1.9 cycle) accessibility support ipc services for communication between gecko-based apps (not yet complete) storage/sqlite interfaces user interface features the following user interface is supplied by xulrunner, and...
2006-10-27 - Archive of obsolete content
discussions evalinsandbox and xm
lhttprequest a discussion about writing something that calls a function defined by the page that the user is currently on chrome files and last modified date ways to retrieve the last modified date of a chrome file that may be in a jar or on the file system.
2006-11-10 - Archive of obsolete content
discussions developing an extension like xm
lhttprequest / nsidocument / mozilla_internal_api a discussion on how to develop an extension similar to xm
lhttprequest but for a different protocol than http, emulating the asynchronous aspect.
2006-12-08 - Archive of obsolete content
saving binary data from nsixm
lhttprequest a discussion on how to use nsixm
lhttprequest object to query data from a url in an extension implemented in javascript meetings none during this week.
Summary of Changes - Archive of obsolete content
http://www.w3.org/tr/2004/rec-dom-le...e3-textcontent ie5+ elemref.style.pixeltop dom level 2: parseint(elemref.style.top, 10) ie5+ elemref.style.pixelleft = x; elemref.style.pixeltop = y; dom level 2: elemref.style.left = x + "px"; elemref.style.top = y + "px"; ie5+ new activexobject("microsoft.xm
lhttp") new xm
lhttprequest() proprietary or deprecated feature w3c feature or recommended replacement ...
Using Web Standards in your Web Pages - Archive of obsolete content
contents benefits of using web standards making your page using web standards - how to using the w3c dom developing cross browser and cross platform pages using xm
lhttprequest summary of changes references original document information author(s): mike cowperthwaite, marcio galli, jim ley, ian oeschger, simon paquet, gérard talbot last updated date: may 29, 2008 copyright information: portions of this content are © 1998–2008 by individual mozilla.org contributors; content available under a creative commons license | details.
-ms-scroll-limit-y-max - Archive of obsolete content
initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete syntax values auto the maximum value for the scrolltop property is equal to element.scrol
lheight.
E4X - Archive of obsolete content
workaround: var response = xm
lhttprequest.responsetext; // bug 270553 response = response.replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>/, ""); // bug 336551 var e4x = new xml(response); resources e4x tutorial processing xml with e4x on mdc e4x for templating see the list of e4x-related pages on mdc ecma-357 standard brendan's presentation e4x at faqts.com e4x quick reference at rephrase.net ...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
listing 1 - querying a mysql database from rhino // import the java sql packages importpackage( java.sql ); // load the mysql driver java.lang.class.forname( "com.mysql.jdbc.driver" ); // create connection to the database var conn = drivermanager.getconnection( "jdbc:mysql://loca
lhost/rhino", "urhino", "prhino" ); // create a statement handle var stmt = conn.createstatement(); // get a resultset var rs = stmt.executequery( "select * from employee" ); // get the metadata from the resultset var meta = rs.getmetadata(); // loop over the records, dump out column names and values while( rs.next() ) { for( var i = 1; i <= meta.getcolumncount(); i++ ) { print( meta.getcolum...
Troubleshooting XForms Forms - Archive of obsolete content
if you are developing on your local machine using apache tomcat for example then add the following regular expression on a new line: ^http://loca
lhost:8080/.* use the xforms buddy to view instance data the xforms buddy extension allows you to dynamically view model instance data while the xforms is running in the firefox browser.
Mozilla's DOCTYPE sniffing - Archive of obsolete content
quirks mode the following trigger quirks mode (this list needs to be comprehensive to ensure that pages already existing on the web trigger quirks mode): the following sites have been useful in preparing this list: w3c html validator, htm
lhelp html validator.
Audio for Web games - Game development
loading your tracks with the web audio api you can load separate tracks and loops individually using xm
lhttprequest or the fetch api, which means you can load them synchronously or in parallel.
Buttons - Game development
to do that, adjust the update() function like so: function update() { game.physics.arcade.collide(ball, paddle, bal
lhitpaddle); game.physics.arcade.collide(ball, bricks, bal
lhitbrick); if(playing) { paddle.x = game.input.x || game.world.width*0.5; } } that way the paddle is immovable after everything is loaded and prepared, but before the start of the actual game.
The score - Game development
this can be done using the settext() method — add the two new lines seen below to the bal
lhitbrick() function: function bal
lhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); } that's it for now — reload your index.html and check that the score updates on every brick hit.
Win the game - Game development
add the following new code into your bal
lhitbrick() function: function bal
lhitbrick(ball, brick) { brick.kill(); score += 10; scoretext.settext('points: '+score); var count_alive = 0; for (i = 0; i < bricks.children.length; i++) { if (bricks.children[i].alive == true) { count_alive++; } } if (count_alive == 0) { alert('you won the game, congratulations!'); location.reload(); } } we l...
Visual typescript game engine - Game development
this.rtcserverport = 12034; this.rtc3serverport = 12034; this.connectorport = 1234; this.domain = "192.168.0.14"; this.masterserverkey = "multi-platformer-sever1.maximum"; this.protocol = "http"; this.issecure = false; this.appuseaccountssystem = true; this.appusevideochat = true; this.databasename = "masterdatabase"; this.databaseroot = "mongodb://loca
lhost:27017"; - the running server is easy : npm run rtc with this cmd: npm run rtc we run server.js and connector.ts websocket.
MDN Web Docs Glossary: Definitions of Web-related terms
wai wcag web performance web server web standards webassembly webdav webextensions webgl webidl webkit webm webp webrtc websockets webvtt whatwg whitespace world wide web wrapper x xforms xhr (xm
lhttprequest) xhtml xinclude xlink xml xpath xquery xslt other 404 502 alpn at-rule attack byte-order mark character set client cryptosystem debug digital signature execution flex-direction ...
Choosing the right approach - Learn web development
single delayed operation repeating operation multiple sequential operations multiple simultaneous operations no yes (recursive callbacks) yes (nested callbacks) no code example an example that loads a resource via the xm
lhttprequest api (run it live, and see the source): function loadasset(url, type, callback) { let xhr = new xm
lhttprequest(); xhr.open('get', url); xhr.responsetype = type; xhr.onload = function() { callback(xhr.response); }; xhr.send(); } function displayimage(blob) { let objecturl = url.createobjecturl(blob); let image = document.createelement('img'); image.src = objectu...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
try restarting the dev server and going to loca
lhost:4200 again, and you'll now see that we have a fully-operational battlestation “todos left” counter and clear button: if you're asking yourself why we're not just doing the toggle on the component, since the function is entirely self-contained and not at all needing anything from the service, then you are 100% right to ask that question!
Routing in Ember - Learn web development
in each case, replace {{outlet}} with <todolist /> so at this point, if you try the app again and visit any of the three routes loca
lhost:4200 loca
lhost:4200/active loca
lhost:4200/completed you'll see exactly the same thing.
Gecko info for Windows accessibility vendors
unique features role_table html: <table> dhtml: role="wairole:grid" (in this case state_focusable is set) accname is supported via <caption> first child of table or summary attribute role_columnheader xul: tree column headers html: <th> dhtml: role="wairole:co
lheader" role_rowheader dhtml: role="wairole:rowheader" role_column not supported.
Creating MozSearch plugins
the following xml is the bundled firefox 2 search plugin for searching using yahoo!: <searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"> <shortname>yahoo</shortname> <description>yahoo search</description> <inputencoding>utf-8</inputencoding> <image width="16" height="16">data:image/x-icon;base64,r0lgod
lheaaqajecap8aaaaaap///waaach5baeaaaialaaaaaaqabaaaaipli+py+0nogquybdened2khkffwuamezmpzsfmaihphrrguum/ft+uwaaow==</image> <url type="application/x-suggestions+json" method="get" template="http://ff.search.yahoo.com/gossip?output=fxjson&command={searchterms}" /> <url type="text/html" method="get" template="http://search.yahoo.com/search"> <param name="p" value="{searchterms}"/> <param n...
Makefile - variables
extra_components nsdefaultc
lh.manifest, javascript xpcomm files extra_dso_libs extra_dso_ldopts extra_js_modules extra_pp_components xpcomm files to pre-process before installation.
Limitations of chrome scripts
nsiprotoco
lhandler in multiprocess firefox, code which registers a custom protocol using nsiprotoco
lhandler must register the custom protocol in the child content process.
MozScrolledAreaChanged
note: while you can poll the values of document.scrollwidth and document.scrol
lheight to watch for changes to the document size, reading these properties can trigger document reflow, which can make them computationally expensive.
Overview of Mozilla embedding APIs
contract-id: ns_iunknowncontenttypehandler_contractid implemented interfaces: nsiunknowncontenttypehandler helperapp launch dialog contract-id: ns_externa
lhelperappservice_contractid implemented interfaces: nsiexterna
lhelperappservice preferences service the preferences service provides access to persistent data stored within a user's profile directory.
AddonScreenshot
thumbnai
lheight optional string the thumbnai
lheight of the screenshot.
DownloadSummary
method overview promise bindtolist(downloadlist alist); promise addview(object aview); promise removeview(object aview); properties attribute type description al
lhavestopped read only boolean indicates whether all the downloads are currently stopped.
Http.jsm
http.jsm http.jsm provides httprequest - a wrapper for xm
lhttprequest that provides convenient and simplified api for dealing with http requests.
OS.File for the main thread
var img = new image(); img.onload = function() { var canvas = document.createelementns('http://www.w3.org/1999/xhtml', 'canvas'); canvas.width = img.naturalwidth; canvas.height = img.natura
lheight; var ctx = canvas.getcontext('2d'); ctx.drawimage(img, 0, 0); (canvas.toblobhd || canvas.toblob).call(canvas, function(b) { var r = cc['@mozilla.org/files/filereader;1'].createinstance(ci.nsidomfilereader); //new filereader(); r.onloadend = function() { // r.result contains the arraybuffer.
Using JavaScript code modules
for example: // import services.jsm unless in a scope where it's already been imported components.utils.import("resource://gre/modules/services.jsm"); var resprot = services.io.getprotoco
lhandler("resource") .queryinterface(components.interfaces.nsiresprotoco
lhandler); var aliasfile = components.classes["@mozilla.org/file/local;1"] .createinstance(components.interfaces.nsilocalfile); aliasfile.initwithpath("/some/absolute/path"); var aliasuri = services.io.newfileuri(aliasfile); resprot.setsubstitution("myalias", aliasuri); // assum...
WebRequest.jsm
the following types are supported: "main_frame" "sub_frame" "stylesheet" "script" "image" "object" "xm
lhttprequest" http headers https headers are represented as objects with two properties, name and value: name type description name string header name, for example "content-type" value string header value, for example "image/png" chrome incompatibilities although this api is modeled on chrome's webrequest extension api, there are some...
JavaScript code modules
http.jsm a wrapper for xm
lhttprequest that provides convenient and simplified api for dealing with http requests.
Mozilla DOM Hacking Guide
there are two other similar macros: #define dom_classinfo_map_begin_no_primary_interface(_class) _dom_classinfo_map_begin(_class, nsnull, pr_true) this macro is used if the dom class (for example xm
lhttprequest) does not have any interface, yet you want the xm
lhttprequest object to be available from javascript.
Mozilla Quirks Mode Behavior
the scrollleft, scrolltop, scrollwidth, and scrol
lheight properties are relative to body in quirks mode (instead of html) (bug 211030).
Profiling with the Firefox Profiler
access cleopatra from your web browser by loading the page loca
lhost:8000, and upload run.symb.cleo to render the profile with most of the symbol information.
Patches and pushes
<searchplugin xmlns="http://www.mozilla.org/2006/browser/search/"> <shortname>yahoo</shortname> <description>yahoo search</description> <inputencoding>utf-8</inputencoding> <image width="16" height="16">data:image/x-icon;base64,r0lgod
lheaaqajecap8aaaaaap///waaach5baeaaaialaaaaaaqabaaaaipli+py+0nogquybdened2khkffwuamezmpzsfmaihphrrguum/ft+uwaaow==</image> ***this tag is optional***<url type="application/x-suggestions+json" method="get" template="http://ff.search.yahoo.com/gossip?output=fxjson&command={searchterms}" />*** <url type="text/html" method="get" template="http://search.yahoo.com/search"> <param name="p" value...
PL_CompareStrings
syntax #include <p
lhash.h> printn pl_comparestrings( const void *v1, const void *v2); description pl_comparestrings compares v1 and v2 as character strings using strcmp.
PL_CompareValues
syntax #include <p
lhash.h> printn pl_comparevalues(const void *v1, const void *v2); description pl_comparevalues compares the two void * values v1 and v2 numerically, i.e., it returns the value of the expression v1 == v2.
PL_HashString
syntax #include <p
lhash.h> p
lhashnumber pl_hashstring(const void *key); parameter the function has the following parameter: key a pointer to a character string.
PL_HashTableAdd
syntax #include <p
lhash.h> p
lhashentry *pl_hashtableadd( p
lhashtable *ht, const void *key, void *value); parameters the function has the following parameters: ht a pointer to the the hash table to which to add the entry.
PL_HashTableDestroy
syntax #include <p
lhash.h> void pl_hashtabledestroy(p
lhashtable *ht); parameter the function has the following parameter: ht a pointer to the hash table to be destroyed.
PL_HashTableEnumerateEntries
syntax #include <p
lhash.h> printn pl_hashtableenumerateentries( p
lhashtable *ht, p
lhashenumerator f, void *arg); parameters the function has the following parameters: ht a pointer to the hash table whose entries are to be enumerated.
PL_HashTableLookup
syntax #include <p
lhash.h> void *pl_hashtablelookup( p
lhashtable *ht, const void *key); parameters the function has the following parameters: ht a pointer to the hash table in which to look up the entry specified by key.
PL_HashTableRemove
syntax #include <p
lhash.h> prbool pl_hashtableremove( p
lhashtable *ht, const void *key); parameters the function has the following parameters: ht a pointer to the hash table from which to remove the entry.
NSS 3.21 release notes
new types in pkcs11t.h ck_tls12_master_key_derive_params{_ptr} - parameters {or pointer} for ckm_tls12_master_key_derive ck_tls12_key_mat_params{_ptr} - parameters {or pointer} for ckm_tls12_key_and_mac_derive ck_tls_kdf_params{_ptr} - parameters {or pointer} for ckm_tls_kdf ck_tls_mac_params{_ptr} - parameters {or pointer} for ckm_tls_mac in sslt.h ss
lhashtype - identifies a hash function sslsignatureandhashalg - identifies a signature and hash function sslpreliminarychannelinfo - provides information about the session state prior to handshake completion new macros in nss.h nss_rsa_min_key_size - used with nss_optionset and nss_optionget to set or get the minimum rsa key size nss_dh_min_key_size - used with nss_optionse...
Necko Architecture
there are a minimum of two interfaces you need to implement in order to fit into the necko architecture: nsiprotoco
lhandler, and nsichannel.
Pork Tools
then nuke the declaration // nsresult rv; // move outparam to
lhs var = getter(); // detect ns_ensure_success immediately following // and change it to an equivalent ns_ensure_true ns_ensure_true(var, ns_error_failure); // case 2 var = getter(); // case 3, eliminate rv2 decl given that it's not used elsewhere var = getter(); ns_ensure_true(var, ns_error_failure) } outparamdel also support rewriting getters such that they return...
Hacking Tips
one is to create a loca
lhost server and serving the files there.
Index
54 js::nul
lhandlevalue jsapi reference, reference, référence(2), spidermonkey js::nul
lhandlevalue is a js::handlevalue constant that represents the javascript value null.
JS::NullValue
see also mxr id search for js::nullvalue js::value js::nul
lhandlevalue ...
JS::TrueHandleValue
see also mxr id search for js::truehandlevalue mxr id search for js::falsehandlevalue js::nul
lhandlevalue js::undefinedhandlevalue bug 959787 ...
JS::UndefinedHandleValue
see also mxr id search for js::undefinedhandlevalue js::nul
lhandlevalue js::truehandlevalue js::falsehandlevalue bug 865969 ...
JS_SetFunctionCallback
note that debuggers should probably use js_setcal
lhook in preference to this function, because it is invoked when the javascript stack is guaranteed to be in a consistent state (and therefore it is valid to inspect and modify local variables, generate stack traces, and set breakpoints.) callback syntax typedef void (* jsfunctioncallback)(const jsfunction *fun,const jsscript *scr, const jscontext *cx, int entering); ...
JSAPI reference
added in spidermonkey 24 js::numbervalue added in spidermonkey 24 js::int32value added in spidermonkey 24 js::doublevalue added in spidermonkey 24 js::float32value added in spidermonkey 24 js::stringvalue added in spidermonkey 24 js::objectvalue added in spidermonkey 24 js::objectornullvalue added in spidermonkey 24 js::symbolvalue added in spidermonkey 38 js::value constants: js::nul
lhandlevalue added in spidermonkey 24 js::undefinedhandlevalue added in spidermonkey 24 js::truehandlevalue added in spidermonkey 38 js::falsehandlevalue added in spidermonkey 38 jsval constants: jsval_null obsolete since jsapi 42 jsval_void obsolete since jsapi 42 jsval_true obsolete since jsapi 42 jsval_false obsolete since jsapi 42 jsval_zero obsolete since jsapi 42 jsval_one obsolet...
JSDBGAPI
teinstackframe examining object properties typedef jspropertydesc jspd_enumerate jspd_readonly jspd_permanent jspd_alias jspd_argument jspd_variable jspd_exception jspd_error typedef jspropertydescarray js_propertyiterator js_getpropertydesc js_getpropertydescarray js_putpropertydescarray hooks js_setdebuggerhandler js_setsourcehandler js_setexecutehook js_setcal
lhook js_setobjecthook js_setthrowhook js_setdebugerrorhook js_setnewscripthook js_setdestroyscripthook js_getglobaldebughooks js_setcontextdebughooks memory usage js_getobjecttotalsize js_getfunctiontotalsize js_getscripttotalsize system objects js_issystemobject js_newsystemobject profiling these functions can be used to profile a spidermonkey application using the mac pr...
Web Replay
to prevent this from having an effect on iteration order (and execution behavior) in the table, the main table classes (for now p
lhashtable and pldhashtable) are instrumented so that they always iterate over elements in the order they were added when recording or replaying.
ROLE_COLUMNHEADER
interfaces nsiaccessnode nsiaccessible mapped to at-spi: role_table atk: atk_role_column_header ua: nsaccessibilitygrouprole msaa/ia2: role_system_columnheader used by aria: co
lheader xul: <listheader/> html: <th> ...
Places utilities for JavaScript
bookmarks nsinavbookmarksservice history nsinavhistoryservice globa
lhistory nsibrowserhistory livemarks nsilivemarkservice annotations nsiannotationservice favicons nsifaviconservice microsummaries nsimicrosummaryservice tagging nsitaggingservice rdf nsirdfservice ptm nsiplacestransactionsservice clipboard nsiclipboard urifixup nsiurifixup special places these are essentially references to the id's of special folders within places.
Aggregating the In-Memory Datasource
aresult) return ns_error_null_pointer; if (aiid.equals(nscomtypeinfo<nsimyinterface>::getiid()) || aiid.equals(nscomtypeinfo<nsisupports>::getiid())) { *aresult = ns_static_cast(nsigloba
lhistory*, this); } else if (aiid.equals(nscomtypeinfo<nsirdfdatasource>::getiid())) { return minner->queryinterface(aiid, aresult); } else { *aresult = nsnull; return ns_nointerface; } ns_addref(ns_static_cast(nsisupports*, aresult)); return ns_ok; } the only other thing that you'll need to be aware of is that you'll need to queryinterface() from nsisupports to nsirdfda...
Components.utils.Sandbox
the following objects are supported: -promise (removed in firefox 37) css indexeddb (web worker only) xm
lhttprequest textencoder textdecoder url urlsearchparams atob btoa blob file crypto rtcidentityprovider fetch (added in firefox 41) caches filereader for example: var sandboxscript = 'var encoded = btoa("hello");' + ...
HOWTO
top of your js file which you want to run in xpcshell { // <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> // <https://bugzilla.mozilla.org/show_bug.cgi?id=546628> let cc = components.classes; let ci = components.interfaces; // register resource://app/ uri let ios = cc["@mozilla.org/network/io-service;1"] .getservice(ci.nsiioservice); let reshandler = ios.getprotoco
lhandler("resource") .queryinterface(ci.nsiresprotoco
lhandler); let mozdir = cc["@mozilla.org/file/directory_service;1"] .getservice(ci.nsiproperties) .get("curprocd", ci.nsilocalfile); let mozdiruri = ios.newfileuri(mozdir); reshandler.setsubstitution("app", mozdiruri); // register chrome://* uris let cr = cc["@mozilla.org/chrome/chrome-registry;1"] .getservice(...
mozIThirdPartyUtil
if it cannot be determined because one or both uris do not have a base domain (for instance, in the case of ip addresses, host aliases such as 'loca
lhost', or a file:// uri), an exact string comparison on host is performed.
nsIAccessibilityService
rts aframe, in nsisupports abulletframe, in astring abullettext); nsiaccessible createhtmlcheckboxaccessible(in nsisupports aframe); nsiaccessible createhtmlcomboboxaccessible(in nsidomnode anode, in nsiweakreference apresshell); nsiaccessible createhtmlgenericaccessible(in nsisupports aframe); nsiaccessible createhtmlgenericaccessible(in nsisupports aframe); nsiaccessible createhtm
lhraccessible(in nsisupports aframe); nsiaccessible createhtmlimageaccessible(in nsisupports aframe); nsiaccessible createhtmllabelaccessible(in nsisupports aframe); nsiaccessible createhtmllabelaccessible(in nsidomnode anode, in nsiweakreference apresshell); nsiaccessible createhtmlobjectframeaccessible(in nsobjectframe aframe); nsiaccessible createhtmlradiobuttonaccessible(in nsisup...
nsICommandLineHandler
example: category entry value command-line-handler b-jsdebug @mozilla.org/venkman/c
lh;1 command-line-handler c-extensions @mozilla.org/extension-manager/c
lh;1 command-line-handler m-edit @mozilla.org/composer/c
lh;1 command-line-handler m-irc @mozilla.org/chatzilla/c
lh;1 command-line-handler y-final @mozilla.org/browser/c
lh-final;1 method overview ...
nsIDOMNSHTMLDocument
fgcolor domstring same as body.text head nsidomhtm
lheadelement returns the first child element of the html element that is a head element, or null if there is no html or head element.
nsIDocShell
all values from here upward are confident enough to be used for xm
lhttprequest.
nsIHttpServer
(not supported) * @param function callback optional callback */ listen: function(port, opt, callback) { if (arguments.length == 2 && "function" == typeof opt) { callback = opt; } if (callback) { this.registerprefixhandler("/", callback); } let host = "loca
lhost"; if (typeof port === "string" && port.indexof(':') != -1){ [host, port] = port.split(':'); port = parseint(port); server.identity.add('http', host, port); } server.wrappedjsobject._start(port, host); return true; }, registerfile: function(path, filepath) { var file = co...
nsIMsgFilterList
defined in comm-central/ mailnews/ base/ search/ public/ nsimsgfilterlist.idl attributes folder attribute nsimsgfolder nsimsgfilterlist::folder version readonly attribute short nsimsgfilterlist::version arbitraryheaders readonly attribute acstring nsimsgfilterlist::arbitraryheaders shoulddownloadal
lheaders readonly attribute boolean nsimsgfilterlist::shoulddownloadal
lheaders filtercount readonly attribute unsigned long nsimsgfilterlist::filtercount loggingenabled attribute boolean nsimsgfilterlist::loggingenabled defaultfile attribute nsilocalfile nsimsgfilterlist::defaultfile logstream attribute nsioutputstream nsimsgfilterlist::logstream logurl readonly attribute acstring nsimsgfilterlist::logurl methods getfilterat() nsimsgfilter nsimsgfilterlist::getfilterat (in unsign...
nsIMsgIncomingServer
rea
lhostname acstring real hostname of the server (if server name is changed it is stored here) realusername acstring real username of the server (if username is changed it is stored here) redirectortype string obsolete since gecko 1.9 rememberpassword boolean retentionsettings nsimsgretentionsettings rootfolder nsimsgfolder rootmsgfolder nsimsgfolder read only.
nsIPushSubscription
: cc, interfaces: ci, utils: cu } = components; const scriptsecuritymanager = cc["@mozilla.org/scriptsecuritymanager;1"] .getservice(ci.nsiscriptsecuritymanager); const pushservice = cc["@mozilla.org/push/service;1"] .getservice(ci.nsipushservice); function sendsubscriptiontoserver(subscription) { let request = cc["@mozilla.org/xmlextras/xm
lhttprequest;1"] .createinstance(ci.nsixm
lhttprequest); request.open("post", "https://example.com/register-for-push", true); request.addeventlistener("error", () => { cu.reporterror("error sending subscription to server"); }); request.send(json.stringify({ endpoint: subscription.endpoint, // base64-encode the key and authentication secret.
nsISocketTransportService
for more details on communicating information about proxies like socks (which are transparent to upper protocols), see nsiproxiedprotoco
lhandler , nsiprotocolproxyservice or proxies in necko.
nsITraceableChannel
to xm
lhttprequest or to the browser tab that made the request) with your own implementation (see "implementing nsistreamlistener" below).
Setting HTTP request headers
you can add your own http headers to any request the application makes, whether the request is initiated by your code explicitly opening an http channel, because of xm
lhttprequest activity, an <img> element in content, or even from css.
Mozilla
xm
lhttprequest changes for gecko1.8 this document describes some of the changes that have been made to gecko's xm
lhttprequest implementation since version 1.7 (i.e., the version of gecko that shipped with firefox 1.0).
Source map errors - Firefox Developer Tools
ressourcen-adresse: moz-extension://c7f0f003-4fcf-49fd-8ec0-c49361266581/background.js source-map-adresse: background.js.map the only workaround is to manually change the map url to a public one (http://loca
lhost:1234/file.map.js) and start a local webserver at this port.
Network Monitor - Firefox Developer Tools
the network monitor shows you all the network requests firefox makes (for example, when it loads a page, or due to xm
lhttprequests), how long each request takes, and details of each request.
Animation.oncancel - Web APIs
syntax var cance
lhandler = animation.oncancel; animation.oncancel = cance
lhandler; value a function to be executed when the animation is cancelled, or null if there is no cancel event handler.
AudioBufferSourceNode.loop - Web APIs
you can run the full example live (or view the source.) function getdata() { source = audioctx.createbuffersource(); request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source.connect(audioctx.destination); ...
AudioBufferSourceNode.loopEnd - Web APIs
function getdata() { source = audioctx.createbuffersource(); request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; songlength = buffer.duration; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; sour...
AudioBufferSourceNode.loopStart - Web APIs
function getdata() { source = audioctx.createbuffersource(); request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; songlength = buffer.duration; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source...
AudioBufferSourceNode.playbackRate - Web APIs
<input class="playback-rate-control" type="range" min="0.25" max="3" step="0.05" value="1"> <span class="playback-rate-value">1.0</span> function getdata() { source = audioctx.createbuffersource(); request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.playbackrate.value = playbackcontrol.value; source.connect(audioctx.destination); ...
AudioProcessingEvent - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function ...
BaseAudioContext.createConvolver() - Web APIs
// grab audio track via xhr for convolver node var soundsource, concerthallbuffer; ajaxrequest = new xm
lhttprequest(); ajaxrequest.open('get', 'concert-crowd.ogg', true); ajaxrequest.responsetype = 'arraybuffer'; ajaxrequest.onload = function() { var audiodata = ajaxrequest.response; audioctx.decodeaudiodata(audiodata, function(buffer) { concerthallbuffer = buffer; soundsource = audioctx.createbuffersource(); soundsource.buffer = concerthallbuffer; }, function(e){"error wit...
BaseAudioContext.createScriptProcessor() - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function ...
BaseAudioContext - Web APIs
in this case, the arraybuffer is usually loaded from an xm
lhttprequest's response attribute after setting the responsetype to arraybuffer.
CSS numeric factory functions - Web APIs
syntax css.number(number); css.percent(number); // <length> css.em(number); css.ex(number); css.ch(number); css.ic(number); css.rem(number); css.
lh(number); css.r
lh(number); css.vw(number); css.vh(number); css.vi(number); css.vb(number); css.vmin(number); css.vmax(number); css.cm(number); css.mm(number); css.q(number); css.in(number); css.pt(number); css.pc(number); css.px(number); // <angle> css.deg(number); css.grad(number); css.rad(number); css.turn(number); // <time> css.s(number); css.ms(number); // <frequency> css.hz(number); css.kh...
Using images - Web APIs
var img = new image(); // create new img element img.src = 'data:image/gif;base64,r0lgod
lhcwalaiaaaaaa3pn/zih5baeaaaealaaaaaalaasaaaiuha+hkcuo4lmnvindo7qyrixigbyaow=='; one advantage of data urls is that the resulting image is available immediately without another round trip to the server.
ConvolverNode.buffer - Web APIs
// grab audio track via xhr for convolver node var soundsource, concerthallbuffer; ajaxrequest = new xm
lhttprequest(); ajaxrequest.open('get', 'concert-crowd.ogg', true); ajaxrequest.responsetype = 'arraybuffer'; ajaxrequest.onload = function() { var audiodata = ajaxrequest.response; audioctx.decodeaudiodata(audiodata, function(buffer) { concerthallbuffer = buffer; soundsource = audioctx.createbuffersource(); soundsource.buffer = concerthallbuffer; }, function(e){"error wit...
ConvolverNode.normalize - Web APIs
// grab audio track via xhr for convolver node var soundsource, concerthallbuffer; ajaxrequest = new xm
lhttprequest(); ajaxrequest.open('get', 'concert-crowd.ogg', true); ajaxrequest.responsetype = 'arraybuffer'; ajaxrequest.onload = function() { var audiodata = ajaxrequest.response; audioctx.decodeaudiodata(audiodata, function(buffer) { concerthallbuffer = buffer; soundsource = audioctx.createbuffersource(); soundsource.buffer = concerthallbuffer; }, function(e){"error wit...
DOMParser - Web APIs
note: xm
lhttprequest can parse xml and html directly from a url-addressable resource, returning a document in its response property.
Document.height - Web APIs
syntax pixels = document.height example // alert document height alert(document.height); alternatives document.body.clientheight document.documentelement.clientheight document.documentelement.scrol
lheight specification html5 ...
Document.lastModified - Web APIs
(see: bug 4363 – document.lastmodified returns date in utc time, but should return it in local time) if you want to know whether an external page has changed, please read this paragraph about the xm
lhttprequest() api.
Document - Web APIs
for html documents, this is normally the htm
lhtmlelement object representing the document's <html> element.
How to create a DOM tree - Web APIs
dom trees can be queried using xpath expressions, converted to strings or written to a local or remote files using xmlserializer (without having to first convert to a string), posted to a web server (via xm
lhttprequest), transformed using xslt, xlink, converted to a javascript object through a jxon algorithm, etc.
Event.eventPhase - Web APIs
this process starts with the window, then document, then the htm
lhtmlelement, and so on through the elements until the target's parent is reached.
Fetch API - Web APIs
it will seem familiar to anyone who has used xm
lhttprequest, but the new api provides a more powerful and flexible feature set.
File - Web APIs
in particular, filereader, url.createobjecturl(), createimagebitmap(), and xm
lhttprequest.send() accept both blobs and files.
FileHandle API - Web APIs
for example, there are many apis that expect blob or file objects such as filereader (which can be easier to use to read the whole file) or xm
lhttprequest.
Introduction to the File and Directory Entries API - Web APIs
for example, you are likely to use one of the following: xm
lhttprequest (such as the send() method for file and blob objects) drag and drop api web workers (for the synchronous version of the file and directory entries api) the input element (to programmatically obtain a list of files from the element) the file and directory entries api is case sensitive the filesystem api is case-sensitive, and case-preserving.
FormData() - Web APIs
let myform = document.getelementbyid('myform'); let formdata = new formdata(myform); specifications specification status comment xm
lhttprequestthe definition of 'formdata()' in that specification.
FormData.append() - Web APIs
if the sent value is different than string or blob it will be automatically converted to string: formdata.append('name', true); formdata.append('name', 74); formdata.append('name', 'john'); formdata.getall('name'); // ["true", "74", "john"] specifications specification status comment xm
lhttprequestthe definition of 'append()' in that specification.
FormData.delete() - Web APIs
example the following line creates an empty formdata object and prepopulates it with key/value pairs from a form: var formdata = new formdata(myform); you can delete keys and their values using delete(): formdata.delete('username'); specifications specification status comment xm
lhttprequestthe definition of 'delete()' in that specification.
FormData.entries() - Web APIs
example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the key/value pairs for(var pair of formdata.entries()) { console.log(pair[0]+ ', '+ pair[1]); } the result is: key1, value1 key2, value2 specifications specification status comment xm
lhttprequestthe definition of 'entries() (as iterator<>)' in that specification.
FormData.get() - Web APIs
line creates an empty formdata object: var formdata = new formdata(); if we add two username values using formdata.append: formdata.append('username', 'chris'); formdata.append('username', 'bob'); the following get() function will only return the first username value appended: formdata.get('username'); // returns "chris" specifications specification status comment xm
lhttprequestthe definition of 'get()' in that specification.
FormData.getAll() - Web APIs
tes an empty formdata object: var formdata = new formdata(); if we add two username values using formdata.append: formdata.append('username', 'chris'); formdata.append('username', 'bob'); the following getall() function will return both username values in an array: formdata.getall('username'); // returns ["chris", "bob"] specifications specification status comment xm
lhttprequestthe definition of 'getall()' in that specification.
FormData.has() - Web APIs
mdata = new formdata(); the following snippet shows the results of testing for the existence of username in the formdata object, before and after appending a username value to it with formdata.append: formdata.has('username'); // returns false formdata.append('username', 'chris'); formdata.has('username'); // returns true specifications specification status comment xm
lhttprequestthe definition of 'has()' in that specification.
FormData.keys() - Web APIs
example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the keys for (var key of formdata.keys()) { console.log(key); } the result is: key1 key2 specifications specification status comment xm
lhttprequestthe definition of 'keys() (as iterator<>)' in that specification.
FormData.set() - Web APIs
// currently empty you can set key/value pairs on this using formdata.set: formdata.set('username', 'chris'); formdata.set('userpic', myfileinput.files[0], 'chris.jpg'); if the sent value is different than string or blob it will be automatically converted to string: formdata.set('name', 72); formdata.get('name'); // "72" specifications specification status comment xm
lhttprequestthe definition of 'set()' in that specification.
FormData.values() - Web APIs
example // create a test formdata object var formdata = new formdata(); formdata.append('key1', 'value1'); formdata.append('key2', 'value2'); // display the values for (var value of formdata.values()) { console.log(value); } the result is: value1 value2 specifications specification status comment xm
lhttprequestthe definition of 'values() (as iterator<>)' in that specification.
FormDataEvent.formData - Web APIs
// construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xm
lhttprequest(); request.open("post", "/formhandler"); request.send(data); }); specifications specification status comment html living standardthe definition of 'formdata' in that specification.
GlobalEventHandlers.onanimationcancel - Web APIs
syntax var animcance
lhandler = target.onanimationcancel; target.onanimationcancel = function value a function to be called when an animationcancel event occurs indicating that a css animation has begun on the target, where the target object is an html element (htmlelement), document (document), or window (window).
GlobalEventHandlers.onformdata - Web APIs
ntdefault(); // construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.onformdata = (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xm
lhttprequest(); request.open("post", "/formhandler"); request.send(data); }; specifications specification status comment html living standardthe definition of 'onformdata' in that specification.
GlobalEventHandlers.onload - Web APIs
the onload property of the globaleventhandlers mixin is an eventhandler that processes load events on a window, xm
lhttprequest, <img> element, etc.
GlobalEventHandlers.ontransitioncancel - Web APIs
syntax var transitioncance
lhandler = target.ontransitioncancel; target.ontransitioncancel = function value a function to be called when a transitioncancel event occurs indicating that a css transition has been cancelled on the target, where the target object is an html element (htmlelement), document (document), or window (window).
HTMLFormElement: formdata event - Web APIs
// construct a formdata object, which fires the formdata event new formdata(formelem); }); // formdata handler to retrieve data formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xm
lhttprequest(); request.open("post", "/formhandler"); request.send(data); }); the onformdata version would look like this: formelem.onformdata = (e) => { console.log('formdata fired'); // get the form data from the event object let data = e.formdata; for (var value of data.values()) { console.log(value); } // submit the data via xhr var request = new xm
lhttprequest(); req...
HTMLFormElement - Web APIs
="pet" value="dog"> dog</label></p> </fieldset> <fieldset> <legend>owned vehicles</legend> <p><label><input type="checkbox" name="vehicle" value="bike">i have a bike</label></p> <p><label><input type="checkbox" name="vehicle" value="car">i have a car</label></p> </fieldset> <p><button>submit</button></p> </form> </body> </html> submitting forms and uploading files using xm
lhttprequest if you want to know how to serialize and submit a form using the xm
lhttprequest api, please read this paragraph.
Image() - Web APIs
the intrinsic width and height of the image in css pixels are reflected through the properties htmlimageelement.naturalwidth and htmlimageelement.natura
lheight.
HTMLImageElement.height - Web APIs
otherwise, the image's height is represented using its natural (intrinsic) height, adjusted for the display density as indicated by natura
lheight.
HTMLTableElement.frame - Web APIs
"above" top side "below" bottom side "hsides" top and bottom only "vsides" right and left sides only "
lhs" left-hand side only "rhs" right-hand side only "box" all four sides "border" all four sides example // set the frame of tablea to 'border' var t = document.getelementbyid('tablea'); t.frame = "border"; t.border = "2px"; specification w3c dom 2 html specification ...
HTMLTableElement - Web APIs
it reflects the obsolete frame attribute and can take one of the following values: "void", "above", "below", "hsides", "vsides", "
lhs", "rhs", "box", or "border".
HTMLTextAreaElement - Web APIs
examples autogrowing textarea example make a textarea autogrow while typing: javascript function autogrow (ofield) { if (ofield.scrol
lheight > ofield.clientheight) { ofield.style.height = ofield.scrol
lheight + "px"; } } css textarea.noscrollbars { overflow: hidden; width: 300px; height: 100px; } html <form> <fieldset> <legend>your comments</legend> <p><textarea class="noscrollbars" onkeyup="autogrow(this);"></textarea></p> <p><input type="submit" value="send" /></p> </fieldset> </form> insert h...
The HTML DOM API - Web APIs
htmlanchorelement htmlareaelement htmlaudioelement htmlbrelement htmlbaseelement htmlbodyelement htmlbuttonelement htmlcanvaselement htmldlistelement htmldataelement htmldatalistelement htmldetailselement htmldialogelement htmldirectoryelement htmldivelement htmlelement htmlembedelement htmlfieldsetelement htmlformelement htm
lhrelement htm
lheadelement htm
lheadingelement htm
lhtmlelement htmliframeelement htmlimageelement htmlinputelement htmllielement htmllabelelement htmllegendelement htmllinkelement htmlmapelement htmlmediaelement htmlmenuelement htmlmetaelement htmlmeterelement htmlmodelement htmlolistelement htmlobjectelement htmloptgroupelement htmloptionelement htmloutputelement htmlparagraphe...
Using IndexedDB - Web APIs
*/ function addpublicationfromurl(biblioid, title, year, url) { console.log("addpublicationfromurl:", arguments); var xhr = new xm
lhttprequest(); xhr.open('get', url, true); // setting the wanted responsetype to "blob" // http://www.w3.org/tr/xm
lhttprequest2/#the-response-attribute xhr.responsetype = 'blob'; xhr.onload = function (evt) { if (xhr.status == 200) { console.log("blob retrieved"); var blob = xhr.response; console.log("blob:", blob); addpublication(biblioid, ...
Key Values - Web APIs
qt::key_togglecal
lhangup (0x01100007) keycode_headsethook (79) "lastnumberredial" the redial button.
Location - Web APIs
it is a synonym for htm
lhyperlinkelementutils.href, though it can't be used to modify the value.
MediaSource.endOfStream() - Web APIs
when you make an xm
lhttprequest call for a media chunk, and onabort or onerror triggers, you might want to call endofstream('network'), display a descriptive message in the ui, and maybe retry the network request immediately or wait until the network is back up (via some kind of polling.) decode: terminates playback and signals that a decoding error has occured.
Navigation Timing API - Web APIs
concepts and usage you can use the navigation timing api to gather performance data on the client side, which you can then transmit to a server using xm
lhttprequest or other techniques.
Navigator - Web APIs
navigator.registerprotoco
lhandler() allows web sites to register themselves as a possible handler for a given protocol.
Online and offline events - Web APIs
ckground: red; } and the corresponding htmlxxx when mochitests for this are created, point to those instead and update this example -nickolay <div id="status"></div> <div id="log"></div> <p>this is a test</p> here's the live result notes if the api isn't implemented in the browser, you can use other signals to detect if you are offline including using service workers and responses from xm
lhttprequest.
NonDocumentTypeChildNode.nextElementSibling - Web APIs
console.log('siblings of div-01:'); while (el) { console.log(el.nodename); el = el.nextelementsibling; } </script> this example outputs the following into the console when it loads: siblings of div-01: div script polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to add support to ie8: // source: https://github.com/a
lhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("nextelementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "nextelementsibling", { get: function(){ var e = this.nextsibling; while(e && 1 !== e.nodetype) e = e.nextsibling; return e; } }); } polyfill for internet explorer ...
NonDocumentTypeChildNode.previousElementSibling - Web APIs
div polyfills polyfill for internet explorer 8 this property is unsupported prior to ie9, so the following snippet can be used to add support to ie8: // source: https://github.com/a
lhadis/snippets/blob/master/js/polyfills/ie8-child-elements.js if(!("previouselementsibling" in document.documentelement)){ object.defineproperty(element.prototype, "previouselementsibling", { get: function(){ var e = this.previoussibling; while(e && 1 !== e.nodetype) e = e.previoussibling; return e; } }); } polyfill for internet explorer 9+ and safari // sour...
OfflineAudioContext.startRendering() - Web APIs
fline-audio-context-promise github repo (see the source code too.) // define online and offline audio context var audioctx = new audiocontext(); var offlinectx = new offlineaudiocontext(2,44100*40,44100); source = offlinectx.createbuffersource(); // use xhr to load an audio track, and // decodeaudiodata to decode it and offlineaudiocontext to render it function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.connect(offlinectx.destination); source.start(); //source.loop = true; offlinectx.s...
OfflineAudioContext - Web APIs
fline-audio-context-promise github repo (see the source code too.) // define online and offline audio context var audioctx = new audiocontext(); var offlinectx = new offlineaudiocontext(2,44100*40,44100); source = offlinectx.createbuffersource(); // use xhr to load an audio track, and // decodeaudiodata to decode it and offlineaudiocontext to render it function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; source.connect(offlinectx.destination); source.start(); //source.loop = true; offlinectx.s...
PerformanceResourceTiming - Web APIs
an application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an xm
lhttprequest, <svg>, image, or script.
Pointer events - Web APIs
<html> <script> function downhandler(ev) { let el = document.getelementbyid("target"); // element "target" will receive/capture further events el.setpointercapture(ev.pointerid); } function cance
lhandler(ev) { let el = document.getelementbyid("target"); // release the pointer capture el.releasepointercapture(ev.pointerid); } function init() { let el = document.getelementbyid("target"); // register pointerdown and pointercancel handlers el.onpointerdown = downhandler; el.onpointercancel = cance
lhandler; } </script> <body onload="init...
ProgressEvent() - Web APIs
specifications specification status comment xm
lhttprequestthe definition of 'progressevent()' in that specification.
ProgressEvent.lengthComputable - Web APIs
syntax flag = progressevent.lengthcomputable specifications specification status comment xm
lhttprequestthe definition of 'progressevent.lengthcomputable' in that specification.
ProgressEvent.loaded - Web APIs
syntax value = progressevent.loaded specifications specification status comment xm
lhttprequestthe definition of 'progressevent.loaded' in that specification.
ProgressEvent.total - Web APIs
syntax value = progressevent.total specifications specification status comment xm
lhttprequestthe definition of 'progressevent.lengthcomputable' in that specification.
PushManager.subscribe() - Web APIs
{ uservisibleonly: true, applicationserverkey: applicationserverkey }; serviceworkerregistration.pushmanager.subscribe(options).then( function(pushsubscription) { console.log(pushsubscription.endpoint); // the push subscription details needed by the application // server are now available, and can be sent to it using, // for example, an xm
lhttprequest.
PushManager - Web APIs
gator.serviceworker.register('serviceworker.js').then( function(serviceworkerregistration) { serviceworkerregistration.pushmanager.subscribe().then( function(pushsubscription) { console.log(pushsubscription.endpoint); // the push subscription details needed by the application // server are now available, and can be sent to it using, // for example, an xm
lhttprequest.
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
cketssent} packets ${timestring}.<br>` + `${framestring}` + `data size: ${bytessent} bytes.</div>`; statsbox.innerhtml += logentry; } else { statsbox.innerhtml += `<div class="stats-error">unable to find initial statistics for id ${endremoteoutbound.id}.</div>` } } statsbox.scrollto(0, statsbox.scrol
lheight); } } } here's what's going on in the networkteststop() function: after calling the rtcpeerconnection method getstats() to get the latest statistics report for the connection and storing it in endreport, this is an rtcstatsreport object, which maps strings taken from the rtcstatstype enumerated type to objects of the corresponding rtcstats-based type.
Using the Resource Timing API - Web APIs
an application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource such as an xm
lhttprequest, <svg>, image, script, etc.).
Screen.height - Web APIs
syntax var height = window.screen.height example if (window.screen.avai
lheight !== window.screen.height) { // something is occupying some screen real estate!
Screen - Web APIs
screen.avai
lheight specifies the height of the screen, in pixels, minus permanent or semipermanent user interface features displayed by the operating system, such as the taskbar on windows.
ScriptProcessorNode.bufferSize - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to ...
ScriptProcessorNode.onaudioprocess - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function ...
ScriptProcessorNode - Web APIs
eate audiocontext and buffer source var audioctx = new audiocontext(); source = audioctx.createbuffersource(); // create a scriptprocessornode with a buffersize of 4096 and a single input and output channel var scriptnode = audioctx.createscriptprocessor(4096, 1, 1); console.log(scriptnode.buffersize); // load in an audio track via xhr and decodeaudiodata function getdata() { request = new xm
lhttprequest(); request.open('get', 'viper.ogg', true); request.responsetype = 'arraybuffer'; request.onload = function() { var audiodata = request.response; audioctx.decodeaudiodata(audiodata, function(buffer) { mybuffer = buffer; source.buffer = mybuffer; }, function(e){"error with decoding audio data" + e.err}); } request.send(); } // give the node a function to ...
ServiceWorkerRegistration.pushManager - Web APIs
function(serviceworkerregistration) { serviceworkerregistration.pushmanager.subscribe().then( function(pushsubscription) { console.log(pushsubscription.subscriptionid); console.log(pushsubscription.endpoint); // the push subscription details needed by the application // server are now available, and can be sent to it using, // for example, an xm
lhttprequest.
SourceBuffer - Web APIs
urce = this; var sourcebuffer = mediasource.addsourcebuffer(mimecodec); fetchab(asseturl, function (buf) { sourcebuffer.addeventlistener('updateend', function (_) { mediasource.endofstream(); video.play(); //console.log(mediasource.readystate); // ended }); sourcebuffer.appendbuffer(buf); }); } function fetchab (url, cb) { console.log(url); var xhr = new xm
lhttprequest; xhr.open('get', url); xhr.responsetype = 'arraybuffer'; xhr.onload = function () { cb(xhr.response); }; xhr.send(); } specifications specification status comment media source extensionsthe definition of 'sourcebuffer' in that specification.
WebGL2RenderingContext.texImage3D() - Web APIs
gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_ap
lha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui width a glsizei specifying the width of the texture.
WebGL2RenderingContext.texStorage2D() - Web APIs
possible values: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rg8ui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb8_ap
lha8 gl.rgb5_a1 gl.rgba4 gl.rgba16f gl.rgba32f gl.rgba8ui unlike opengl 3.0, webgl 2 doesn't support the following etc2 and eac compressed texture formats (see section 5.37 in the webgl 2 spec).
WebGL2RenderingContext.texStorage3D() - Web APIs
possible values: gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_ap
lha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui gl.compressed_r11_eac gl.compressed_signed_r11_eac gl.compressed_rg11_eac gl.compressed_signed_rg11_eac gl.compressed_rgb8_etc2 gl.compressed_rgba8_etc2_eac gl.compressed_srgb8_etc2 gl.compressed_srgb8_alpha8_etc2_eac gl.compressed_rgb8_punchthrough_alpha1_etc2 gl.compressed_srgb8_punchthrough_alpha1_etc2 ...
WebGL2RenderingContext.texSubImage3D() - Web APIs
gl.r8 gl.r16f gl.r32f gl.r8ui gl.rg8 gl.rg16f gl.rg32f gl.rgui gl.rgb8 gl.srgb8 gl.rgb565 gl.r11f_g11f_b10f gl.rgb9_e5 gl.rgb16f gl.rgb32f gl.rgb8ui gl.rgba8 gl.srgb_ap
lha8 gl.rgb5_a1 gl.rgba4444 gl.rgba16f gl.rgba32f gl.rgba8ui type a glenum specifying the data type of the texel data.
Lifetime of a WebRTC session - Web APIs
in order to exchange signaling information, you can choose to send json objects back and forth over a websocket connection, or you could use xmpp or sip over an appropriate channel, or you could use xm
lhttprequest over https with polling, or any other combination of technologies you can come up with.
WebSocket: error event - Web APIs
bubbles no cancelable no interface event event handler property onerror examples // create websocket connection const socket = new websocket('ws://loca
lhost: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.
WebSocket: message event - Web APIs
const socket = new websocket('ws://loca
lhost:8080'); // listen for messages socket.addeventlistener('message', function (event) { console.log('message from server ', event.data); }); specifications specification status html living standardthe definition of 'websocket message' in that specification.
WebSocket: open event - Web APIs
const socket = new websocket('ws://loca
lhost:8080'); // connection opened socket.addeventlistener('open', (event) => { socket.send('hello server!'); }); specifications specification status html living standardthe definition of 'websocket open' in that specification.
WebSocket - Web APIs
const socket = new websocket('ws://loca
lhost:8080'); // connection opened socket.addeventlistener('open', function (event) { socket.send('hello server!'); }); // listen for messages socket.addeventlistener('message', function (event) { console.log('message from server ', event.data); }); specifications specification status html living standardthe definition of 'websocket' in that specification.
Web Workers API - Web APIs
in addition, workers may use xm
lhttprequest for network i/o, with the exception that the responsexml and channel attributes on xm
lhttprequest always return null.
Worker - Web APIs
workers may use xm
lhttprequest for network communication, but its responsexml and channel attributes are always null.
XDomainRequest - Web APIs
it was removed in internet explorer 10 in favor of using xm
lhttprequest with proper cors; if you are targeting internet explorer 10 or later, or wish to support any other browser, you need to use standard http access control.
XMLDocument.load() - Web APIs
as of at least gecko 1.9, this no longer supports cross-site loading of documents (use xm
lhttprequest or fetch() instead).
msCaching - Web APIs
the mscaching read/write property specifies whether stream data downloaded using xm
lhttprequestis cached to disk or not.
ARIA: form role - Accessibility
anything that is not a <form> cannot be submitted, therefore you would have to use javascript to build an alternative data submission mechanism, for example with xm
lhttprequest.
Mozilla CSS extensions - CSS: Cascading Style Sheets
border-style and outline-style -moz-bg-insetobsolete since gecko 1.9 -moz-bg-outsetobsolete since gecko 1.9 -moz-bg-solidobsolete since gecko 1.9 <color> keywords -moz-activehyperlinktext -moz-hyperlinktext -moz-visitedhyperlinktext -moz-buttondefault -moz-buttonhoverface -moz-buttonhovertext -moz-default-background-color -moz-default-color -moz-cel
lhighlight -moz-cel
lhighlighttext -moz-field -moz-fieldtext -moz-dialog -moz-dialogtext -moz-dragtargetzone -moz-mac-accentdarkestshadow -moz-mac-accentdarkshadow -moz-mac-accentface -moz-mac-accentlightesthighlight -moz-mac-accentlightshadow -moz-mac-accentregularhighlight -moz-mac-accentregularshadow -moz-mac-chrome-active -moz-mac-chrome-inactive -moz-mac-focusring -moz-mac-menus...
Linear-gradient Generator - CSS: Cascading Style Sheets
inputslidermanager.init();="" inputslidermanager.subscribe('point-position',="" k="0;" len="lg_axes.length;" len;="" lg_axes[i].shortcut.style.left="60" lg_axes[i].updateabsoluteposition();="" lg_axes[i].updateonresize();="" methods="" output="getelembyid('output');" output.children[index].children[1].textcontent="code;" output.children[index].style.height="output.children[index].children[1].scrol
lheight" output;="" point="" pre="" prefix)="" resizecontainer="function" resizecontainer()="" resizecontainer);="" resizecontainer,="" resizeend="function" resizeend()="" resizeend);="" return="" return;="" setaddaxisbutton();="" setaxisunit);="" setdeleteaxisbutton();="" setdeletebuttonstate="function" setdeletebuttonstate('disabled');="" setdeletebuttonstate(state)="" setdeletepointbutton="functi...
attr() - CSS: Cascading Style Sheets
)where <type-or-unit> = string | color | url | integer | number | length | angle | time | frequency | cap | ch | em | ex | ic |
lh | r
lh | rem | vb | vi | vw | vh | vmin | vmax | mm | q | cm | in | pt | pc | px | deg | grad | rad | turn | ms | s | hz | khz | % examples content property html <p data-foo="hello">world</p> css [data-foo]::before { content: attr(data-foo) " "; } result <color> value html <div class="background" data-background="lime">background expected to be red if your browser does not suppor...
Audio and Video Delivery - Developer guides
web audio api var context; var request; var source; try { context = new audiocontext(); request = new xm
lhttprequest(); request.open("get","http://jplayer.org/audio/mp3/riomez-01-sleep_together.mp3",true); request.responsetype = "arraybuffer"; request.onload = function() { context.decodeaudiodata(request.response, function(buffer) { source = context.createbuffersource(); source.buffer = buffer; source.connect(context.destination); // auto play ...
Overview of events and handlers - Developer guides
t kinds based on the object emitting the event including: the window object, such as due to resizing the browser, the window.screen object, such as due to changes in device orientation, the document object, including the loading, modification, user interaction, and unloading of the page, the objects in the dom (document object model) tree including user interactions or modifications, the xm
lhttprequest objects used for network requests, and the media objects such as audio and video, when the media stream players change state.
Developer guides
using formdata objects the formdata object lets you compile a set of key/value pairs to send using xm
lhttprequest.
MIME types (IANA media types) - HTTP
t/form-data; boundary=aboundarystring (other headers associated with the multipart document as a whole) --aboundarystring content-disposition: form-data; name="myfile"; filename="img.jpg" content-type: image/jpeg (data) --aboundarystring content-disposition: form-data; name="myfield" (data) --aboundarystring (more subparts) --aboundarystring-- the following <form>: <form action="http://loca
lhost:8000/" method="post" enctype="multipart/form-data"> <label>name: <input name="mytextfield" value="test"></label> <label><input type="checkbox" name="mycheckbox"> check</label> <label>upload file: <input type="file" name="myfile" value="test.txt"></label> <button>send the file</button> </form> will send this message: post / http/1.1 host: loca
lhost:8000 user-agent: mozilla/5.0 (macint...
Reason: CORS request not HTTP - HTTP
to fix this problem, simply make sure you use https urls when issuing requests involving cors, such as xm
lhttprequest, fetch apis, web fonts (@font-face), and webgl textures, and xsl stylesheets.
Using Feature Policy - HTTP
these features include: layout-inducing animations unoptimized (poorly compressed) images oversized images synchronous scripts synchronous xm
lhttprequest unsized media to avoid breaking existing web content, the default for such policy-controlled features is to allow the functionality to be used by all origins.
Feature Policy - HTTP
the features include: layout-inducing animations legacy image formats oversized images synchronous scripts synchronous xm
lhttprequest unoptimized images unsized media granular control over certain features the web provides functionality and apis that may have privacy or security risks if abused.
Feature-Policy: sync-xhr - HTTP
the http feature-policy header sync-xhr directive controls whether the current document is allowed to make synchronous xm
lhttprequest requests.
Feature-Policy - HTTP
sync-xhr controls whether the current document is allowed to make synchronous xm
lhttprequest requests.
POST - HTTP
text/plain when the post request is sent via a method other than an html form — like via an xm
lhttprequest — the body can take any type.
An overview of HTTP - HTTP
apis based on http the most commonly used api based on http is the xm
lhttprequest api, which can be used to exchange data between a user agent and a server.
Protocol upgrade mechanism - HTTP
in essence, then, this key simply confirms that "yes, i really mean to open a websocket connection." this header is automatically added by clients that choose to use it; it cannot be added using the xm
lhttprequest.setrequestheader() method.
Redirections in HTTP - HTTP
the mod_alias module has redirect and redirectmatch directives that set up 302 redirects by default: <virtua
lhost *:443> servername example.com redirect / https://www.example.com </virtua
lhost> the url https://example.com/ will be redirected to https://www.example.com/, as will any files or directories under it (https://example.com/some-page will be redirected to https://www.example.com/some-page) redirectmatch does the same, but takes a regular expression to define a collection of affected urls: re...
A typical HTTP session - HTTP
to work around this problem, web developers use several techniques: ping the server periodically via the xm
lhttprequest, fetch apis, using the websockets api, or similar protocols.
Object.freeze() - JavaScript
var employee = { name: "mayank", designation: "developer", address: { street: "rohini", city: "de
lhi" } }; object.freeze(employee); employee.name = "dummy"; // fails silently in non-strict mode employee.address.city = "noida"; // attributes of child object can be modified console.log(employee.address.city) // output: "noida" to make an object immutable, recursively freeze each property which is of type object (deep freeze).
Promise() constructor - JavaScript
lve, reject) => { // do something asynchronous which eventually calls either: // // resolve(somevalue) // fulfilled // or // reject("failure reason") // rejected }); making functions return a promise to provide a function with promise functionality, have it return a promise: function myasyncfunction(url) { return new promise((resolve, reject) => { const xhr = new xm
lhttprequest() xhr.open("get", url) xhr.onload = () => resolve(xhr.responsetext) xhr.onerror = () => reject(xhr.statustext) xhr.send() }); } specifications specification ecmascript (ecma-262)the definition of 'promise constructor' in that specification.
Promise - JavaScript
loading an image with xhr another simple example using promise and xm
lhttprequest to load an image is available at the mdn github js-examples repository.
encodeURI() - JavaScript
*'() console.log(encodeuri(set3)); // abc%20abc%20123 (the space gets encoded as %20) console.log(encodeuricomponent(set1)); // %3b%2c%2f%3f%3a%40%26%3d%2b%24%23 console.log(encodeuricomponent(set2)); // -_.!~*'() console.log(encodeuricomponent(set3)); // abc%20abc%20123 (the space gets encoded as %20) note that encodeuri() by itself cannot form proper http get and post requests, such as for xm
lhttprequest, because "&", "+", and "=" are not encoded, which are treated as special characters in get and post requests.
Destructuring assignment - JavaScript
function parseprotocol(url) { const parsedurl = /^(\w+)\:\/\/([^\/]+)\/(.*)$/.exec(url); if (!parsedurl) { return false; } console.log(parsedurl); // ["https://developer.mozilla.org/web/javascript", "https", "developer.mozilla.org", "en-us/web/javascript"] const [, protocol, ful
lhost, fullpath] = parsedurl; return protocol; } console.log(parseprotocol('https://developer.mozilla.org/web/javascript')); // "https" object destructuring basic assignment const user = { id: 42, is_verified: true }; const {id, is_verified} = user; console.log(id); // 42 console.log(is_verified); // true assignment without declaration a variable can be assigned its value with de...
import - JavaScript
the module: file.js function getjson(url, callback) { let xhr = new xm
lhttprequest(); xhr.onload = function () { callback(this.responsetext) }; xhr.open('get', url, true); xhr.send(); } export function getusefulcontents(url, callback) { getjson(url, data => callback(json.parse(data))); } the main program: main.js import { getusefulcontents } from '/modules/file.js'; getusefulcontents('http://www.example.com', data => { dosomethinguseful(data); })...