Search completed in 1.84 seconds.
1924 results for "self":
Your results are loading. Please wait...
Self-hosted builtins in SpiderMonkey
since firefox 17, spidermonkey has the ability to self-host built-in functions in javascript.
... differences from normal javascript all self-hosted code is strict, so self-hosted functions invoked in a null or undefined scope won't be run in the scope of the global object.
... self-hosted code has access to some functionality that's not available to normal js code.
...And 16 more matches
justify-self - CSS: Cascading Style Sheets
the css justify-self property sets the way a box is justified inside its alignment container along the appropriate axis.
... in table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) in flexbox layouts, this property is ignored (more about alignment in flexbox) in grid layouts, it aligns an item inside its grid area on the inline axis (more about alignment in grid layouts) syntax /* basic keywords */ justify-self: auto; justify-self: normal; justify-self: stretch; /* positional alignment */ justify-self: center; /* pack item around the center */ justify-self: start; /* pack item from the start */ justify-self: end; /* pack item from the end */ justify-self: flex-start; /* equivalent to 'start'.
... note that justify-self is ignored in flexbox layouts.
...And 11 more matches
place-self - CSS: Cascading Style Sheets
the place-self css shorthand property allows you to align an individual item in both the block and inline directions at once (i.e.
... the align-self and justify-self properties) in a relevant layout system such as grid or flexbox.
... constituent properties this property is a shorthand for the following css properties: align-self justify-self syntax /* keyword values */ place-self: auto center; place-self: normal start; /* positional alignment */ place-self: center normal; place-self: start auto; place-self: end normal; place-self: self-start auto; place-self: self-end normal; place-self: flex-start auto; place-self: flex-end normal; place-self: left auto; place-self: right normal; /* baseline alignment */ place-self:...
...And 9 more matches
align-self - CSS: Cascading Style Sheets
the align-self css property overrides a grid or flex item's align-items value.
...if a flexbox item's cross-axis margin is auto, then align-self is ignored.
... syntax /* keyword values */ align-self: auto; align-self: normal; /* positional alignment */ /* align-self does not take left and right values */ align-self: center; /* put the item around the center */ align-self: start; /* put the item at the start */ align-self: end; /* put the item at the end */ align-self: self-start; /* align the item flush at the start */ align-self: self-end; /* align the item flush at the end */ align-self: flex-start; /* put the flex item at the start */ align-self: flex-end; /* put the flex item at the end */ /* baseline alignment */ align-self: baseline; align-self: first baseline; align-self: last baseline; align-self: stretch; /* stretch 'auto'-sized items to fit the container */ /* overflow alignment */ align-self: safe center; align-self: unsafe center; ...
...And 8 more matches
self - Archive of obsolete content
this article documents the self object that is available as a global in content scripts.
... self provides: access to the options object access to the port object access to a mostly deprecated messaging api for an overview of content scripts, see the main article.
... note that the self object in content scripts is completely different from the self module, which provides an api for an add-on to access its data files and id.
...And 5 more matches
Window.self - Web APIs
WebAPIWindowself
the window.self read-only property returns the window itself, as a windowproxy.
... it can be used with dot notation on a window object (that is, window.self) or standalone (self).
...by using self, you can refer to the global scope in a way that will work not only in a window context (self will resolve to window.self) but also in a worker context (self will then resolve to workerglobalscope.self).
...And 5 more matches
JS::GetSelfHostedFunction
this article covers features introduced in spidermonkey 31 create a new javascript function that is implemented in self-hosted javascript.
... syntax jsfunction* js::getselfhostedfunction(jscontext* cx, const char* selfhostedname, js::handle<jsid> id, unsigned nargs); name type description cx jscontext* the context from which to get the function.
... selfhostedname const char* function name in the self-hosted javascript.
...And 3 more matches
self - XPath
WebXPathAxesself
the self axis indicates the context node itself.
... specifications specification status comment xpath 3.1the definition of 'self' in that specification.
... recommendation xpath 3.0the definition of 'self' in that specification.
...And 2 more matches
self - Archive of obsolete content
note that the self module is completely different from the global self object accessible to content scripts, which is used by a content script to communicate with the add-on code.
...each package that uses the self module will see its own data directory.
...the url can be passed to a content frame constructor, such as the panel: var self = require("sdk/self"); var mypanel = require("sdk/panel").panel({ contenturl: self.data.url("myfile.html") }); mypanel.show(); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html").
...each package that uses the self module will see its own data directory.
WorkerGlobalScope.self - Web APIs
the self read-only property of the workerglobalscope interface returns a reference to the workerglobalscope itself.
... syntax var selfref = self; value a global scope object (differs depending on the type of worker you are dealing with, as indicated above).
... example if you called console.log(self); inside a worker, you will get a worker global scope of the same type as that worker object written to the console — something like the following: dedicatedworkerglobalscope { undefined: undefined, infinity: infinity, math: mathconstructor, nan: nan, intl: object…} infinity: infinity array: function array() { [native code] } arguments: null caller: null isarray: function isarray() { [native code] } length: 1 name: "array" observe: function observe() { [native code] } prototype: array[0] unobserve: function unobserve() { [native code] } __proto__: function empty() {} <function scope> arraybuffer: function arraybuffer() { [native code] } blob: function blob() { [native co...
... specifications specification status comment html living standardthe definition of 'self' in that specification.
registerSelf
this content is now available at nsimodule.registerself().
unregisterSelf
this content is now available at nsimodule.unregisterself().
ancestor-or-self - XPath
the ancestor-or-self axis indicates the context node and all of its ancestors, including the root node.
descendant-or-self - XPath
the descendant-or-self axis indicates the context node and all of its descendants.
Index - Web APIs
WebAPIIndex
this interface exists to define timeline features (inherited by documenttimeline and future timeline types) and is not itself directly used by developers.
...access it via self.clients within a service worker.
... 631 clients.claim() api, clients, experimental, method, reference, service workers, serviceworker, claim the claim() method of the clients allows an active service worker to set itself as the controller for all clients within its scope.
...And 30 more matches
DOMMatrix - Web APIs
WebAPIDOMMatrix
dommatrix.invertself() modifies the matrix by inverting it.
... dommatrix.multiplyself() modifies the matrix by post-multiplying it with the specified dommatrix.
...returns itself.
...And 22 more matches
Creating the Component Code
in the subsequent chapters, we can begin to work on the example weblock component functionality itself.
... web lock user interface most of the actual work in the weblock component is preparing the component itself, finding the xpcom interfaces the component needs to use, and hooking into existing functionality within the gecko browser.
... the weblock component must do a number of things to register itself.
...And 19 more matches
context-menu - Archive of obsolete content
contexts can be related to page content or the page itself, but they should never be external to the page.
... for example, this item appears whenever the context menu is invoked on a page that contains at least one image: require("sdk/context-menu").item({ label: "this page has images", contentscript: 'self.on("context", function (node) {' + ' return !!document.queryselector("img");' + '});' }); note that the listener function has a parameter called node.
...the example above works because <img> elements can't contain other elements, but in the example below, node.nodename is not guaranteed to be "p" - for example, it won't be "p" if the user context-clicked a link inside a paragraph: var cm = require("sdk/context-menu"); cm.item({ label: "a paragraph", context: cm.selectorcontext("p"), contentscript: 'self.on("context", function (node) {' + ' console.log(node.nodename);' + ' return true;' + '});' }); the content script is executed for every page that a context menu is shown for.
...And 18 more matches
panel - Archive of obsolete content
to do this, save the html in your add-on's data directory and load it using the data.url() method exported by the self module, like this: var mypanel = require("sdk/panel").panel({ contenturl: require("sdk/self").data.url("myfile.html") }); mypanel.show(); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html").
... attaching panels to buttons you can attach a panel to a toggle button by passing the button itself as the position option to the panel's show() method or to its constructor: var { togglebutton } = require('sdk/ui/button/toggle'); var sdkpanels = require("sdk/panel"); var self = require("sdk/self"); var button = togglebutton({ id: "my-button", label: "my button", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onchange: handlechange }); va...
...r mypanel = sdkpanels.panel({ contenturl: self.data.url("panel.html"), onhide: handlehide }); function handlechange(state) { if (state.checked) { mypanel.show({ position: button }); } } function handlehide() { button.state('window', {checked: false}); } updating panel content you can update the panel's content by: sending a message to a content script that updates the dom in the same document.
...And 18 more matches
Index - Archive of obsolete content
22 self this article documents the self object that is available as a global in content scripts.
... self provides: 23 contributor's guide no summary!
... 27 modules add-ons, extensions a module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface.
...And 18 more matches
Content Scripts - Archive of obsolete content
the contentscript option treats the string itself as a script: // main.js var pagemod = require("sdk/page-mod"); var contentscriptvalue = 'document.body.innerhtml = ' + ' "<h1>page matches ruleset</h1>";'; pagemod.pagemod({ include: "*.mozilla.org", contentscript: contentscriptvalue }); the contentscriptfile option treats the string as a resource:// url pointing to a script file stored in your add-on's data direc...
... this add-on supplies a url pointing to the file "content-script.js", located in the data subdirectory under the add-on's root directory: // main.js var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscriptfile: data.url("content-script.js") }); // content-script.js document.body.innerhtml = "<h1>page matches ruleset</h1>"; from firefox 34 onwards, you can use "./content-script.js" as an alias for self.data.url("content-script.js").
... you can load multiple scripts by passing an array of strings to either contentscript or contentscriptfile: // main.js var tabs = require("sdk/tabs"); tabs.on('ready', function(tab) { tab.attach({ contentscript: ['document.body.style.border = "5px solid red";', 'window.alert("hi");'] }); }); // main.js var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscriptfile: [data.url("jquery.min.js"), data.url("my-content-script.js")] }); if you do this, the scripts can interact directly with each other, just like scripts loaded by the same web page.
...And 15 more matches
widget - Archive of obsolete content
just save the file in your add-on's data directory, and reference it using the data.url() method of the self module: var data = require("sdk/self").data; require("sdk/widget").widget({ id: "my-widget", label: "my widget", contenturl: data.url("my-content.html") }); this widget contains an entire web page: require("sdk/widget").widget({ id: "hello-display", label: "my hello widget", content: "hello!", width: 50 }); widgets are quite small by default, so this example used the width prop...
... next, we write a content script that listens for click events on each icon and sends the corresponding message to the main add-on code: var play_button = document.getelementbyid("play-button"); play_button.onclick = function() { self.port.emit("play"); } var pause_button = document.getelementbyid("pause-button"); pause_button.onclick = function() { self.port.emit("pause"); } var stop_button = document.getelementbyid("stop-button"); stop_button.onclick = function() { self.port.emit("stop"); } we save this file in the add-on's data directory as "button-script.js".
...in the add-on's "main.js" file, we create the widget, assign it the html file and the content script, and listen for events from the content script: const widgets = require("sdk/widget"); const data = require("sdk/self").data; var player = widgets.widget({ id: "player", width: 72, label: "player", contenturl: data.url("buttons.html"), contentscriptfile: data.url("button-script.js") }); player.port.on("play", function() { console.log("playing"); }); player.port.on("pause", function() { console.log("pausing"); }); player.port.on("stop", function() { console.log("stopping"); }); to learn much more about content scripts, see the working with content scripts guide.
...And 12 more matches
Index
this is often sufficient if you encrypt data for yourself, but as soon as you need to exchange signed/encrypted data with communication partners, using public key encryption simplifies the key management.
...(however, it's also possible to use nss functionality to create a self-signed certificate, which, however, usually won't be trusted by other parties.) once received, it's sufficient to tell nss to import such a new certificate into the nss database, and nss will automatically perform a lookup of the embedded public key, be able to find the associated private key, and subsequently be able to treat it as a personal certificate.
... trust anchors contained in the ckbi module are usually self signed, which is defined as having identical subject name and issuer name fields.
...And 12 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
f(stderr, "%-30s - certificate nickname\n\n", "-n <nickname>"); fprintf(stderr, "%-30s - certificate trust\n\n", "-t <trustargs>"); fprintf(stderr, "%-30s - certificate issuer nickname\n\n", "-u <issuernickname>"); fprintf(stderr, "%-30s - certificate signing request \n\n", "-r <csr>"); fprintf(stderr, "%-30s - generate a self-signed cert [optional]\n\n", "-x"); fprintf(stderr, "%-30s - to enable ascii [optional]\n\n", "-a"); fprintf(stderr, "%-30s - to save certificate to header file as sig verification [optional]\n\n", "-v"); exit(-1); } /* * validate the options used for generate csr command */ static void validategeneratecsrcommand(const char *prognam...
... const char *dbdir, const char *nicknamestr, const char *truststr, const char *certfilename, const char *certreqfilename, const char *issuernamestr, const char *serialnumberstr, prbool selfsign) { prbool validationfailed = pr_false; if (!nicknamestr) { pr_fprintf(pr_stderr, "%s -a -d %s -n : nick name is missing\n", progname, dbdir); validationfailed = pr_true; } if (!truststr) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t: trust flag is missing\n", progname, dbdir, nicknamestr); validat...
...led = pr_true; } if (pr_access(certfilename, pr_access_exists) == pr_failure) { if (!certreqfilename) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c %s -r: certificate file or certificate request file is not found\n", progname, dbdir, nicknamestr, truststr, certfilename); validationfailed = pr_true; } if (!selfsign && !issuernamestr) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c %s -r %s -u : issuer name is missing\n", progname, dbdir, nicknamestr, truststr, certfilename, certreqfilename); validationfailed = pr_true; } if (!serialnumberstr) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c %s -r %s -u %s -m : serial...
...And 12 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
aligning items on the block axis the align-self and align-items properties control alignment on the block axis.
... the align-items property sets the align-self property for all of the child grid items.
... this means that you can set the property individually, by using align-self on a grid item.
...And 12 more matches
sample2
tderr, "%-30s - certificate serial number\n\n", "-m <serialnumber>"); fprintf(stderr, "%-30s - certificate nickname\n\n", "-n <nickname>"); fprintf(stderr, "%-30s - certificate trust\n\n", "-t <trustargs>"); fprintf(stderr, "%-30s - certificate issuer nickname\n\n", "-u <issuernickname>"); fprintf(stderr, "%-30s - certificate signing request \n\n", "-r <csr>"); fprintf(stderr, "%-30s - generate a self-signed cert [optional]\n\n", "-x"); fprintf(stderr, "%-30s - to enable ascii [optional]\n\n", "-a"); fprintf(stderr, "%-30s - to save certificate to header file as sig verification [optional]\n\n", "-v"); exit(-1); } /* * validate the options used for generate csr command */ static void validategeneratecsrcommand(const char *progname, const char *dbdir, certname *subject, const char *subjectstr, ...
..."\nusage: %s %s \n\n", progname, "-g -d <dbdirpath> -s <subject> -r <csr> \n"); exit(-1); } } /* * validate the options used for add cert to db command */ static void validateaddcerttodbcommand(const char *progname, const char *dbdir, const char *nicknamestr, const char *truststr, const char *certfilename, const char *certreqfilename, const char *issuernamestr, const char *serialnumberstr, prbool selfsign) { prbool validationfailed = pr_false; if (!nicknamestr) { pr_fprintf(pr_stderr, "%s -a -d %s -n : nick name is missing\n", progname, dbdir); validationfailed = pr_true; } if (!truststr) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t: trust flag is missing\n", progname, dbdir, nicknamestr); validationfailed = pr_true; } if (!certfilename) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c: ce...
...rogname, dbdir, nicknamestr, truststr, serialnumberstr, certreqfilename); validationfailed = pr_true; } if (pr_access(certfilename, pr_access_exists) == pr_failure) { if (!certreqfilename) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c %s -r: certificate file or certificate request file is not found\n", progname, dbdir, nicknamestr, truststr, certfilename); validationfailed = pr_true; } if (!selfsign && !issuernamestr) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c %s -r %s -u : issuer name is missing\n", progname, dbdir, nicknamestr, truststr, certfilename, certreqfilename); validationfailed = pr_true; } if (!serialnumberstr) { pr_fprintf(pr_stderr, "%s -a -d %s -n %s -t %s -c %s -r %s -u %s -m : serial number is missing\n", progname, dbdir, nicknamestr, truststr, certfilename, cert...
...And 11 more matches
SVGTransformList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...the inserted item is the item itself and not a copy.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 11 more matches
Communicating using "port" - Archive of obsolete content
here's a simple add-on that sends a message to a content script using port: var tabs = require("sdk/tabs"); var alertcontentscript = "self.port.on('alert', function(message) {" + " window.alert(message);" + "})"; tabs.on("ready", function(tab) { worker = tab.attach({ contentscript: alertcontentscript }); worker.port.emit("alert", "message from the add-on"); }); tabs.open("http://www.mozilla.org"); in total, the port object defines four functions: emit(): emit a mess...
... accessing port accessing port in the content script note that the global self object is completely different from the self module, which provides an api for an add-on to access its data files and id.
... in the content script the port object is available as a property of the global self object.
...And 10 more matches
page-mod - Archive of obsolete content
if you supply the scripts as separate files in the "data" directory, you specify them using with a url, typically constructed using the url() method of the self module's data object: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscriptfile: data.url("my-script.js") }); var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscriptfile: [data.url("jquery-1.7.min.js"), data...
....url("my-script.js")] }); from firefox 34, you can use "./my-script.js" as an alias for self.data.url("my-script.js").
... /lib/main.js: var tag = "p"; var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "*.mozilla.org", contentscriptfile: data.url("element-getter.js"), onattach: function(worker) { worker.port.emit("getelements", tag); worker.port.on("gotelement", function(elementcontent) { console.log(elementcontent); }); } }); /data/element-getter.js: self.port.on("getelements", function(tag) ...
...And 10 more matches
Bytecode Descriptions
self-hosted code uses it by calling the intrinsic hasown(id, obj).
...this instruction and the branch around the iterator loop are emitted only when arr is itself a rest parameter, as in (...arr) => f(...arr), a strong hint that it's a packed array whose prototype is array.prototype.
...however, the functionbody of the generator is not supposed to start running until the first .next() call, so after setup the script suspends itself: the "initial yield".
...And 10 more matches
Index
MozillaTechXPCOMIndex
in the subsequent chapters, we can begin to work on the example weblock component functionality itself.
... 106 packaging weblock xpcom in this final part of the tutorial, we'll put all of the pieces of the web locking component - the library itself, the type library, the header file, and the user interface resources - into a package that can be installed on other systems.
... 110 starting weblock xpcom in this chapter, we begin to design and implement the web locking functionality itself.
...And 10 more matches
SVGLengthList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...the inserted item is the item itself and not a copy.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 9 more matches
SVGNumberList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...the inserted item is the item itself and not a copy.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 9 more matches
SVGPointList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...the inserted item is the item itself and not a copy.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 9 more matches
SVGStringList - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...the inserted item is the item itself and not a copy.
... exceptions: a domexception with code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only.
...And 9 more matches
Functions - JavaScript
the function consists of one statement that says to return the parameter of the function (that is, number) multiplied by itself.
...providing a name allows the function to refer to itself, and also makes it easier to identify the function in a debugger's stack traces: const factorial = function fac(n) { return n < 2 ?
... a function can call itself.
...And 9 more matches
page-worker - Archive of obsolete content
to do this, save the file in your add-on's data directory and create the url using the data.url() method of the self module: pageworker = require("sdk/page-worker").page({ contentscript: "console.log(document.body.innerhtml);", contenturl: require("sdk/self").data.url("myfile.html") }); from firefox 34, you can use "./myfile.html" as an alias for self.data.url("myfile.html").
...in this example we fetch the first paragraph of a page from wikipedia, then the first paragraph of a different page: var getfirstparagraph = "var paras = document.getelementsbytagname('p');" + "console.log(paras[0].textcontent);" + "self.port.emit('loaded');" pageworker = require("sdk/page-worker").page({ contentscript: getfirstparagraph, contenturl: "http://en.wikipedia.org/wiki/chalk" }); pageworker.port.on("loaded", function() { pageworker.contenturl = "http://en.wikipedia.org/wiki/cheese" }); scripting page content to access the page's dom you need to attach a script to it.
...you construct the url using the data.url() method of the self module.
...And 8 more matches
Client-side storage - Learn web development
lector('form'); const nameinput = document.queryselector('#entername'); const submitbtn = document.queryselector('#submitname'); const forgetbtn = document.queryselector('#forgetname'); const h1 = document.queryselector('h1'); const personalgreeting = document.queryselector('.personal-greeting'); next up, we need to include a small event listener to stop the form from actually submitting itself when the submit button is pressed, as this is not the behavior we want.
...the bottom: // run function when the 'forget' button is clicked forgetbtn.addeventlistener('click', function() { // remove the stored name from web storage localstorage.removeitem('name'); // run namedisplaycheck() to sort out displaying the // generic greeting again and updating the form display namedisplaycheck(); }); it is now time to define the namedisplaycheck() function itself.
... working through a note storage example here we'll run you through an example that allows you to store notes in your browser and view and delete them whenever you like, getting you to build it up for yourself and explaining the most fundamental parts of idb as we go along.
...And 8 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
align-self — controls alignment of an individual flex item on the cross axis.
... the cross axis the align-items and align-self properties control alignment of our flex items on the cross axis, down the columns if flex-direction is row and along the row if flex-direction is column.
... aligning one item with align-self the align-items property sets the align-self property on all of the flex items as a group.
...And 8 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
the first item overrides the align-items value set on the group by setting align-self to center.
...the first item overrides the align-items set on the group by setting align-self to center.
... when aligning items on the inline axis you will use the properties which begin with justify-: justify-items justify-self justify-content when aligning items on the block axis you will use the properties that begin align-: align-items align-self align-content flexbox adds an additional complication in that the above is true when flex-direction is set to row.
...And 7 more matches
ui/sidebar - Archive of obsolete content
unlike modules such as panel, the content must be local, typically loaded from the add-on's data directory via a url constructed using self.data.url(): var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html") }); from firefox 34, you can use "./sidebar.html" as an alias for self.data.url("sidebar.html").
... so you can rewrite the above code like this: var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: "./sidebar.html" }); you can include javascript and css from the html as you would with any web page, for example using <script> and <link> tags containing a path relative to the html file itself.
...on attach, "main.js" starts listening to the ping message, and responds with a pong: var sidebar = require("sdk/ui/sidebar").sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html"), onattach: function (worker) { worker.port.on("ping", function() { console.log("add-on script got the message"); worker.port.emit("pong"); }); } }); try running the add-on, and showing the sidebar using the "view->sidebar->my sidebar" menu item.
...And 6 more matches
Modifying Web Pages Based on URL - Archive of obsolete content
use contentscriptfile option instead of contentscript and pass it script url which can be obtained using self.data.url("my-script.js").
... for example, if we save the script above under the add-on's data directory in a file called my-script.js: // import the page-mod api var pagemod = require("sdk/page-mod"); // import the self api var self = require("sdk/self"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscriptfile: self.data.url("my-script.js") }); or from firefox 34 onwards: // import the page-mod api var pagemod = require("sdk/page-mod"); // create a page-mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contents...
... // import the page-mod api var pagemod = require("sdk/page-mod"); // import the self api var self = require("sdk/self"); // create a page mod // it will run a script whenever a ".org" url is loaded // the script replaces the page contents with a message pagemod.pagemod({ include: "*.org", contentscriptfile: [self.data.url("jquery-1.7.min.js"), self.data.url("my-script.js")] }); you can use both contentscript and contentscriptfile in the same page-mod.
...And 6 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
15 algorithm codingscripting, glossary an algorithm is a self-contained series of instructions to perform a function.
...r own additions, 160 fragmentainer css, css fragmentation specification, glossary, fragmentainer a fragmentainer is defined in the css fragmentation specification as follows: 161 function codingscripting, glossary, iife, immediately invoked function expressions (iife), intro, javascript a function is a code snippet that can be called by other code or by itself, or a variable that refers to the function.
... 170 general header glossary, webmechanics a general header is an http header that can be used in both request and response messages but doesn't apply to the content itself.
...And 6 more matches
JSAPI User Guide
but in mozilla, all of these features are actually provided by other components, not the spidermonkey engine itself.
... for integers and boolean values, a jsval contains the value itself.
...in the case of js::value, the javascript garbage collector recycles objects, strings, and numbers that don't appear to be in use, and a js::value by itself does not protect its referent from the garbage collector.
...And 6 more matches
JS::CompileOptions
methods some methods of js::owningcompileoptions and js::compileoptions return the instance itself to allow method chain.
... owningcompileoptions &setline(unsigned l) sets each property and returns the instance itself.
...ngcompileoptions &setmutederrors(bool mute) owningcompileoptions &setversion(jsversion v) owningcompileoptions &setutf8(bool u) owningcompileoptions &setcolumn(unsigned c) owningcompileoptions &setcompileandgo(bool cng) owningcompileoptions &setforeval(bool eval) owningcompileoptions &setnoscriptrval(bool nsr) owningcompileoptions &setselfhostingmode(bool shm) owningcompileoptions &setcanlazilyparse(bool clp) owningcompileoptions &setsourceislazy(bool l) owningcompileoptions &setintroductiontype(const char *t) bool setintroductioninfo(jscontext *cx, const char *introducerfn, const char *intro, unsigned line, jsscript *script, uint32_t offset) duplicate null-terminated string introducerfn for i...
...And 6 more matches
JS_FS
// added in spidermonkey 17 #define js_self_hosted_fn(name,selfhostedname,nargs,flags) ...
... // added in spidermonkey 31 #define js_self_hosted_sym_fn(symbol, selfhostedname, nargs, flags) ...
... // added in spidermonkey 38 #define js_sym_fnspec(symbol, call, info, nargs, flags, selfhostedname) ...
...And 6 more matches
Starting WebLock
« previousnext » in this chapter, we begin to design and implement the web locking functionality itself.
... getting called at startup no person is an island to himself, and neither are components.
...the first callback is called when the component's nsimodule::registerself method is called.
...And 6 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
this is what firefox itself uses for bookmark properties and other dialogs.
...pt,cancel" ondialogaccept="savevalues(); window.close();" ondialogcancel="window.close();"> <checkbox label="my option"/> </dialog> listing 8: a dialog figure 5: output from listing 8 note: the functions behind the dialog elements discussed here require "xpconnect privileges," which are discussed in chapter 4, so this example will only run correctly if it can run as firefox code itself or installed extension code.
...here, the button-click itself is not taken as the input; instead, a command event is issued only when a popup menu item is selected.
...And 5 more matches
CustomizableUI.jsm
if you want to use it from a jsm or another context without a window reference, you need to import it yourself: components.utils.import("resource:///modules/customizableui.jsm"); introduction the module is intended for two primary purposes: allow adding, moving and removing customizable widgets.
...there should normally be no need to call it yourself.
...always prefer this over using toolbar.insertitem() (which might no-op because it delegates to addwidgettoarea) or, worse, moving items in the dom yourself.
...And 5 more matches
Using Service Workers - Web APIs
let’s start this section by looking at a code sample — this is the first block you’ll find in our service worker: self.addeventlistener('install', (event) => { event.waituntil( caches.open('v1').then((cache) => { return cache.addall([ './sw-test/', './sw-test/index.html', './sw-test/style.css', './sw-test/app.js', './sw-test/image-list.js', './sw-test/star-wars-logo.jpg', './sw-test/gallery/', './sw-test/gallery/bountyhunters.jpg', ...
... './sw-test/gallery/mylittlevader.jpg', './sw-test/gallery/snowtroopers.jpg' ]); }) ); }); here we add an install event listener to the service worker (hence self), and then chain a extendableevent.waituntil() method onto the event — this ensures that the service worker will not install until the code inside waituntil() has successfully occurred.
... self.addeventlistener('fetch', (event) => { event.respondwith( // magic goes here ); }); we could start by simply responding with the resource whose url matches that of the network request, in each case: self.addeventlistener('fetch', (event) => { event.respondwith( caches.match(event.request) ); }); caches.match(event.request) allows us to match each resource requested from the net...
...And 5 more matches
Box alignment in grid layout - CSS: Cascading Style Sheets
the first item overrides the align-items value set on the group by setting align-self to center.
... to align things on the inline axis you use the properties that start with justify-, justify-content, justify-items and justify-self.
... to align things on the block axis you use the properties that start with align-, align-content, align-items and align-self.
...And 5 more matches
justify-items - CSS: Cascading Style Sheets
the css justify-items property defines the default justify-self for all items of the box, giving them all a default way of justifying each box along the appropriate axis.
...*/ justify-items: self-start; justify-items: self-end; justify-items: left; /* pack items from the left */ justify-items: right; /* pack items from the right */ /* baseline alignment */ justify-items: baseline; justify-items: first baseline; justify-items: last baseline; /* overflow alignment (for positional alignment only) */ justify-items: safe center; justify-items: unsafe center; /* legacy alignment *...
... positional alignment: one of: center, start, end, flex-start, flex-end, self-start, self-end, left, or right.
...And 5 more matches
Interacting with page scripts - Archive of obsolete content
in this example a page script adds a string variable foo to the window: <!doctype html"> <html> <head> <script> window.foo = "hello from page script" </script> </head> </html> the content script can see this object if it uses unsafewindow.foo instead of window.foo: // main.js var tabs = require("sdk/tabs"); var mod = require("sdk/page-mod"); var self = require("sdk/self"); var pageurl = self.data.url("page.html") var pagemod = mod.pagemod({ include: pageurl, contentscript: "console.log(unsafewindow.foo);" }) tabs.open(pageurl); be careful using unsafewindow: you can't rely on any of its properties or functions being, or doing, what you expect.
...the "main.js" opens the local file "page.html" and attaches a content script to it: // main.js var tabs = require("sdk/tabs"); var self = require("sdk/self"); tabs.open({ url: self.data.url("page.html"), onready: attachscript }); function attachscript(tab) { tab.attach({ contentscriptfile: self.data.url("content-script.js") }); } the content script defines an object and assigns it to unsafewindow twice: the first time using cloneinto(), the second time using simple assignment: // content-script.js var contentscr...
...the "main.js" opens the local file "page.html" and attaches a content script to it: // main.js var tabs = require("sdk/tabs"); var self = require("sdk/self"); tabs.open({ url: self.data.url("page.html"), onready: attachscript }); function attachscript(tab) { tab.attach({ contentscriptfile: self.data.url("content-script.js") }); } the content script defines a function greetme() and exports it to the page script context.
...And 4 more matches
port - Archive of obsolete content
each end of the conversation has access to a port: the content script via the global self property, and the main add-on code via a worker object associated with the sdk module you've used to attach the content script, such as page-mod or page-worker.
... from the content script to the main add-on code: // content-script.js var mymessagepayload = "some data"; self.port.emit("mymessage", mymessagepayload); from the main add-on code to the content script: // main.js var mymessagepayload = "some data"; worker.port.emit("mymessage", mymessagepayload); on() the port.on() function registers a function as a listener for a particular message sent from the other side using port.emit().
... in a content script, to listen for "mymessage" sent from the main add-on code: // content-script.js self.port.on("mymessage", function handlemymessage(mymessagepayload) { // handle the message }); in the main add-on code, to listen for "mymessage" sent from a a content script: // main.js worker.port.on("mymessage", function handlemymessage(mymessagepayload) { // handle the message }); once() often you'll want to receive a message just once, then stop listening.
...And 4 more matches
A XUL Bestiary - Archive of obsolete content
in other words, a chrome url like the global pointer above picks up a file called global.css, and the help pointer above could also be written as chrome://help/content, because the name of the package itself is "help." viewing chromes other than mozilla's there is a special flag you can use to start mozilla with some chrome other than the default.
...xul itself contains very little provision for how widgets are to be presented in the interface.
...at the highest level in the tree of nodes that is the dom sits the window object itself.
...And 4 more matches
Game distribution - Game development
this includes hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like google play or the ios app store.
... benefits of html5 over native building games with html5 gives you extra advantages, such as: multiplatform bliss the technology itself is multiplatform, so you can write the code once and target multiple devices.
... publishing the game there are three main options when it comes to publishing a game: self-hosting publishers stores remember that the name of your game should be unique enough to be quickly promoted later on, but also catchy enough, so people don't forget it.
...And 4 more matches
Index
34 js::compileoptions jsapi reference, reference, référence(2), spidermonkey some methods of js::owningcompileoptions and js::compileoptions return the instance itself to allow method chain.
... 46 js::getselfhostedfunction jsapi reference, reference, référence(2), spidermonkey js::getselfhostedfunction creates a new javascript function implemented in self-hosted javascript.
...if the cx's runtime has no parent runtime, js_getparentruntime returns cx's runtime itself.
...And 4 more matches
nsIDBChangeListener
this can be used to filter out events that you yourself started.
...this can be used to filter out events that you yourself started.
...this can be used to filter out events that you yourself started.
...And 4 more matches
Working with Multiple Versions of Interfaces
to do this i used the accessibility framework: hwnd gethwnd(nsidomnode *node){ hwnd self = null; nsresult rv; nscomptr<nsiaccessibleretrieval> refp; refp = do_createinstance( "@mozilla.org/accessibleretrieval;1", &rv); if (ns_failed(rv)){ return self; } //line 6.
... nscomptr<nsiaccessible> accnode; rv = refp->getaccessiblefor(node, getter_addrefs(accnode)); if(ns_failed(rv)){ return self; } void *wh = null; nscomptr<nsiaccessibledocument> accdocnode; accdocnode = do_queryinterface(accnode, &rv); if(ns_failed(rv)){ return self; } rv = accdocnode->getwindowhandle(&wh); if(ns_succeeded(rv)){ self = static_cast<hwnd>(wh); } return self; } this approach worked, as is, for versions as early as firefox 1.5.
... hwnd gethwndb(nsidomnode *node){ hwnd self = null; nsresult rv; nscomptr<nsicomponentmanager> compmgr; rv = ns_getcomponentmanager(getter_addrefs(compmgr)); if (ns_failed(rv)){ return self; } nscomptr<nsiaccessibleretrieval> refp; rv = compmgr->createinstancebycontractid(accretcid, 0, iar_iid_old, getter_addrefs(refp)); if (ns_failed(rv)){ return self; } nscomptr<nsiaccessible> accnode; rv = refp->getaccessiblefor(node,...
...And 4 more matches
Drawing and Event Handling - Plugins
you determine whether a plug-in is windowed or windowless by the way you define the plug-in itself.
...this type of plug-in determines when it draws itself.
...a windowless plug-in draws itself only in response to a paint message from the browser.
...And 4 more matches
Call Tree - Firefox Developer Tools
self time is calculated as the time spent in that particular function, excluding its children.
... self cost is calculated from self time as a percentage of the total number of samples in the selected portion of the recording.
...functions with a relatively high self cost are good candidates for optimization, either because they take a long time to run, or because they are called very often.
...And 4 more matches
SVGTransform - Web APIs
in case the matrix object is changed directly (i.e., without using the methods on the svgtransform interface itself) then the type of the svgtransform changes to svg_transform_matrix.
... exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when attempting to modify a read only attribute or when the object itself is read only.
...And 4 more matches
Using Web Workers - Web APIs
thus, using the window shortcut to get the current global scope (instead of self) within a worker will return an error.
...essage is received by writing an event handler block like this (worker.js): onmessage = function(e) { console.log('message received from main script'); var workerresult = 'result: ' + (e.data[0] * e.data[1]); console.log('posting message back to main script'); postmessage(workerresult); } the onmessage handler allows us to run some code whenever a message is received, with the message itself being available in the message event's data attribute.
...so for example, suppose a document is served with the following header: content-security-policy: script-src 'self' among other things, this will prevent any scripts it includes from using eval().
...And 4 more matches
align-items - CSS: Cascading Style Sheets
the css align-items property sets the align-self value on all direct children as a group.
... self-start the items are packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.
... self-end the items are packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis.
...And 4 more matches
overflow-wrap - CSS: Cascading Style Sheets
html <p>they say the fishing is excellent at lake <em class="normal">chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though i've never been there myself.
... (<code>normal</code>)</p> <p>they say the fishing is excellent at lake <em class="ow-anywhere">chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though i've never been there myself.
... (<code>overflow-wrap: anywhere</code>)</p> <p>they say the fishing is excellent at lake <em class="ow-break-word">chargoggagoggmanchauggagoggchaubunagungamaugg</em>, though i've never been there myself.
...And 4 more matches
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
it's the only piece of service worker code that sits inside the app.js file; everything else that is service worker-specific is written in the sw.js file itself.
... installation the api allows us to add event listeners for key events we are interested in — the first one is the install event: self.addeventlistener('install', (e) => { console.log('[service worker] install'); }); in the install listener, we can initialize the cache and add files to it for offline use.
... var gamesimages = []; for(var i=0; i<games.length; i++) { gamesimages.push('data/img/'+games[i].slug+'.jpg'); } var contenttocache = appshellfiles.concat(gamesimages); then we can manage the install event itself: self.addeventlistener('install', (e) => { console.log('[service worker] install'); e.waituntil( caches.open(cachename).then((cache) => { console.log('[service worker] caching all: app shell and content'); return cache.addall(contenttocache); }) ); }); there are two things that need an explanation here: what extendableevent.waituntil does, and what the caches objec...
...And 4 more matches
tabs - Archive of obsolete content
tabs.on('ready', function(tab) { console.log('tab is loaded', tab.title, tab.url); }); access tabs the module itself can be used as a list of all opened tabs across all windows.
...tabs"); tabs.on('activate', function(tab) { tab.url = "http://www.example.com"; }); run scripts in a tab you can attach a content script to the page hosted in a tab, and use that to access and manipulate the page's content (see the modifying the page hosted by a tab tutorial): var tabs = require("sdk/tabs"); tabs.on('activate', function(tab) { var worker = tab.attach({ contentscript: 'self.port.emit("html", document.body.innerhtml);' }); worker.port.on("html", function(message) { console.log(message) }) }); note that tab.attach is tab-centric: if the user navigates to a new page in the same tab, then the worker and content scripts will be reattached to the new page.
... tabs hosted by private browser windows won't be seen if you enumerate the tabs module itself, and you won't receive any events for them.
...And 3 more matches
Anonymous Content - Archive of obsolete content
the xbl:text value cannot occur by itself in the list.
... whenever events flow from an anonymous element in a bound element's scope to the bound element itself, one of two actions occurs.
...as this event flows across scopes, it is retargeted to be a focus event on the file control itself.
...And 3 more matches
Building accessible custom components in XUL - Archive of obsolete content
(the firefox interface itself is built in xul, as well as the graphical interface presented by firefox extensions.) xul itself has a much richer set of built-in controls than html.
...the role attribute itself is in the xhtml 2 namespace.
...we need to set the containing grid to be focusable, which will put the spreadsheet itself in the tab order.
...And 3 more matches
The Implementation of the Application Object Model - Archive of obsolete content
the second section describes the xul/rdf architecture itself and outlines enhancements to the xul language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data.
...where html describes the contents of a single document, xul describes the contents of an entire window (which could itself contain multiple html documents).
...the data itself can be fed in from any number of different sources (e.g., from a local file system, from your bookmarks file, or from some remote downloadable rdf file), and can then be combined into a single graph.
...And 3 more matches
XUL Event Propagation - Archive of obsolete content
very often, the event raised by the element is heard by the element itself and handled right there before it bubbles up any higher.
...where event bubbling propagates an event from its target up higher into the node hiearchy, event capturing intercepts an event before it is received by other elements, even by the event target itself.
...in the example above, when the menuitem raises the "command" event, indicating that it has been selected, the menupopup, the menu itself, the parent box, or the root window element itself can all take advantage of this.
...And 3 more matches
Introduction to SSL - Archive of obsolete content
it uses tcp/ip on behalf of the higher-level protocols, and in the process allows an ssl-enabled server to authenticate itself to an ssl-enabled client, allows the client to authenticate itself to the server, and allows both machines to establish an encrypted connection.
...the handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows.
... optionally, the handshake also allows the client to authenticate itself to the server.
...And 3 more matches
JS::PersistentRooted
they are registered with the jsruntime itself, without locking, so they require a full jscontext to be initialized, not one of its more restricted superclasses.
...it's up to the implementor of the type containing heap<t> or tenuredheap<t> members to make sure their referents get marked when the object itself is marked.
... before spidermonkey 38, persistentrooted<t> itself cannot be a global variable, but from spidermonkey38, it can be declared as a global variable, and initialized later with init() method (bug 1107639).
...And 3 more matches
JS_PSGS
#define js_self_hosted_get(name, gettername, flags) ...
... // added in spidermonkey 31 #define js_self_hosted_getset(name, gettername, settername, flags) ...
... gettername const char * the function's name in self-hosted javascript code for getter function.
...And 3 more matches
Building the WebLock UI
it uses xul, which is an xml language that gecko knows how to render as user interface, but it also interacts with particular parts of the mozilla user interface, where it must install itself as an extension to the ui.
...in this tutorial, focusing as it is on the weblock functionality (rather than the ui), we'll assume the strings we get from the ui itself are urls we actually want to write to the white list: function addthissite() { var tf = document.getelementbyid("dialog.input"); // weblock is global and declared above weblock.addsite(tf.value); } this javascript function can be called directly from the xul widget, where the input string is retrieved as the value property of the textbox element.
... you also need to create the function that displays the weblock window itself when the user clicks the weblock icon in the statusbar.
...And 3 more matches
nsIWebProgressListener
method overview void onlocationchange(in nsiwebprogress awebprogress, in nsirequest arequest, in nsiuri alocation, [optional] in unsigned long aflags); void onprogresschange(in nsiwebprogress awebprogress, in nsirequest arequest, in long acurselfprogress, in long amaxselfprogress, in long acurtotalprogress, in long amaxtotalprogress); void onsecuritychange(in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astate); void onstatechange(in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astateflags, in nsresult astatus); void onstatuschange(in nsiwebprogress awebprogress,...
... void onprogresschange( in nsiwebprogress awebprogress, in nsirequest arequest, in long acurselfprogress, in long amaxselfprogress, in long acurtotalprogress, in long amaxtotalprogress ); parameters awebprogress the nsiwebprogress instance that fired the notification.
... acurselfprogress the current progress for arequest.
...And 3 more matches
WebIDL bindings
(this allows the return value to be implicitly converted to a parentobject instance by the compiler via one of that class's non-explicit constructors.) if many instances of myinterface are expected to be created quicky, the return value of getparentobject should itself inherit from nswrappercache for optimal performance.
...optional arguments which do have a default value are just represented by the argument type itself, set to the default value if the argument was not in fact passed in.
...if it's implemented by an object with a property whose name matches the operation, the object itself is always used as this.
...And 3 more matches
Signaling and video calling - Web APIs
first we need the signaling server itself.
...they still don't know how to transmit the media data itself though.
... each ice message suggests a communication protocol (tcp or udp), ip address, port number, connection type (for example, whether the specified ip is the peer itself or a relay server), along with other information needed to link the two computers together.
...And 3 more matches
Rendering and the WebXR frame animation callback - Web APIs
this happens when the amount of time it takes to render a frame exceeds the time available between frames, whether because rendering was delayed or because rendering itself took more time than was available.
...not only that, but if your renderer itself runs longer than that amount of time, you can cause not just the frame to get dropped, but that time to be wasted entirely, blocking other code from getting to run at all for that frame.
...you need to make sure that the main thread doesn't need to run for more time per frame than the duration of the frame itself.
...And 3 more matches
Box alignment in Flexbox - CSS: Cascading Style Sheets
the first item overrides the align-items values set on the group by setting align-self to center.
...therefore it is easiest to think about the main and cross axis when working in flexbox like so: the main axis = direction set by flex-direction = alignment via justify-content the cross axis = runs across the main axis = alignment via align-content, align-self/align-items main axis alignment justify-content cross axis alignment align-self align-items align-content there is no justify-self in flexbox on the main axis, flexbox deals with our content as a group.
... this means that a justify-self property does not make sense in flexbox as we are always dealing with moving the entire group of items around.
...And 3 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>one</div> <div>two</div> <div>three</div> <div>four</div> <div>five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1fr); } a simple question to ask yourself when deciding between grid or flexbox is: do i only need to control the layout by row or column – use a flexbox do i need to control the layout by row and column – use a grid content out or layout in?
... if you are using flexbox and find yourself disabling some of the flexibility, you probably need to use css grid layout.
...i have also set the align-self property on box1 so it will override the default and stretch to the height of the container and on box2 so it aligns to the start of the flex container.
...And 3 more matches
<input type="image"> - HTML: Hypertext Markup Language
WebHTMLElementinputimage
in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form.
...if there is no parent context, this behaves the same as _self.
...if the current context is the topmost context, this behaves the same as _self.
...And 3 more matches
Feature-Policy: fullscreen - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
...And 3 more matches
Feature-Policy: geolocation - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
...And 3 more matches
Communicating With Other Scripts - Archive of obsolete content
content scripts content scripts loaded into the same document at the same time using the same method can interact with each other directly as well as with the web content itself.
... in the main add-on code, we have a page-mod that attaches the content script "talk.js" to the right page: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/listen.html", contentscriptfile: data.url("talk.js") }); the "talk.js" content script uses window.postmessage() to send the message to the page: // content-script (talk.js) window.postmessage("message from content script", "http://my-domain.org/"); the second argument may be '*' which will al...
... here "main.js" creates a page-mod that attaches "listen.js" to the web page: var data = require("sdk/self").data; var pagemod = require("sdk/page-mod"); pagemod.pagemod({ include: "http://my-domain.org/talk.html", contentscriptfile: data.url("listen.js") }); the web page "talk.html" embeds a script that uses window.postmessage() to send the content script a message when the user clicks a button: <!doctype html> <html> <head></head> <body> <script> function sendmessage() { ...
...And 2 more matches
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 xmlhttprequests 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/.
... //main.js var data = require("sdk/self").data; var pageworker = require("sdk/page-worker").page({ contenturl: data.url("page.html"), contentscriptfile: data.url("page-script.js") }); pageworker.on("message", function(message) { console.log(message); }); the "page.html" file embeds an iframe whose content is served from "http://en.m.wikipedia.org/": <!doctype html> <!-- page.html --> <html> <head></head> ...
... <body> <iframe id="wikipedia" src="http://en.m.wikipedia.org/"></iframe> </body> </html> the "page-script.js" file locates "today's featured article" and sends its content to "main.js": // page-script.js var iframe = window.document.getelementbyid("wikipedia"); var todaysfeaturedarticle = iframe.contentwindow.document.getelementbyid("mp-tfa"); self.postmessage(todaysfeaturedarticle.textcontent); for this to work, we need to add the "cross-domain-content" key to "package.json": "permissions": { "cross-domain-content": ["http://en.m.wikipedia.org/"] } the add-on should successfully retrieve the iframe's content.
...And 2 more matches
Communicating using "postMessage" - Archive of obsolete content
handling message events in the content script to send a message from a content script, you use the postmessage function of the global self object: self.postmessage(contentscriptmessage); this takes a single parameter, the message payload, which may be any json-serializable value.
... to receive a message from the add-on script, use self's on function: self.on("message", function(addonmessage) { // handle the message }); like all event-registration functions, this takes two parameters: the name of the event, and the handler function.
... property as an argument to the constructor: panel = require("sdk/panel").panel({ onmessage: function(contentscriptmessage) { // handle message from the content script } }); message events versus user-defined events you can use message events as an alternative to user-defined events: var pagemodscript = "window.addeventlistener('mouseover', function(event) {" + " self.postmessage(event.target.tostring());" + "}, false);"; var pagemod = require('sdk/page-mod').pagemod({ include: ['*'], contentscript: pagemodscript, onattach: function(worker) { worker.on('message', function(message) { console.log('mouseover: ' + message); }); } }); the reason to prefer user-defined events is that as soon as you need to send more than ...
...And 2 more matches
Classes and Inheritance - Archive of obsolete content
when javascript looks for a property, it first looks for it in the object itself.
... circle.prototype = object.create(shape.prototype); now when javascript looks for the method draw on an instance of circle, it first looks for it on the object itself.
...if the extends property is omitted, class itself is used as the base class: var shape = new shape(2, 3); shape instanceof shape; // => true shape instanceof class; // => true to illustrate the use of the extends property, let's redefine the constructor for the class circle in terms of class: var circle = class({ extends: shape, initialize: function(x, y, radius) { shape.prototype.initialize.call(this, x, y); this.rad...
...And 2 more matches
ui/button/toggle - Archive of obsolete content
attaching panels to buttons you can attach panels to buttons by passing the button as the position option to the panel's show() method or the panel's constructor: var { togglebutton } = require('sdk/ui/button/toggle'); var panels = require("sdk/panel"); var self = require("sdk/self"); var button = togglebutton({ id: "my-button", label: "my button", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onchange: handlechange }); var panel = panels.panel({ contenturl: self.data.url("panel.html"), onhide: handlehide }); function handlechange(state) { if (state.checked) { panel.show({ position...
... here's an add-on with a button that disables itself when you click it, but only for the currently active window: var { togglebutton } = require("sdk/ui/button/toggle"); var button = togglebutton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onclick: disableforthiswindow }); function disableforthiswindow(state) { button.state("window", { disabled: true...
...you can specify this in one of three ways: as a resource:// url pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory as an object, or dictionary of key-value pairs.
...And 2 more matches
Modifying the Page Hosted by a Tab - Archive of obsolete content
for example, if we save the script above under the add-on's data directory in a file called my-script.js: var self = require("sdk/self"); var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ contentscriptfile: self.data.url("my-script.js") }); } }); you can load more than one script, and the scripts can interact directly with each other.
... // index.js var self = require("sdk/self"); var tabs = require("sdk/tabs"); require("sdk/ui/button/action").actionbutton({ id: "load-several", label: "load several scripts", icon: "./icon-16.png", onclick: function () { tabs.activetab.attach({ contentscriptfile: [self.data.url('first.js'), self.data.url('second.js')] }); } }); communicating with the content scripts...
... in the content script, port is a property of the global self object.
...And 2 more matches
XPCOM Objects - Archive of obsolete content
the second one will hold the length of the return array, and the third parameter will hold the array itself.
... the implementation object itself should be easy to understand.
... var countermodule = { // registerself, unregisterself, getclassobject, canunload }; the only thing you may need to change here is when you need to use the category manager.
...And 2 more matches
Notes on HTML Reflow - Archive of obsolete content
a frame requests a incremental reflow (or one is requested on a frame's behalf) when something about the frame itself has changed.
...a frame that decides it needs a dirty reflow sets the ns_frame_is_dirty state bit on itself, and then calls the reflowdirtychild method on its parent frame.
... in reflowdirtychild, the parent frame sets the ns_frame_has_dirty_child state bit on itself, and does any bookkeeping necessary to remember which child is dirty (for example, the block frame marks the linebox dirty that contains the child frame).
...And 2 more matches
Modularization techniques - Archive of obsolete content
if a call to release() causes the reference count to hit zero, the object will generally free itself.
...we rely on the factory registering itself somehow.
... a dll can export two additional functions for self registration and unregistration.
...And 2 more matches
Skinning XUL Files by Hand - Archive of obsolete content
reading the global skin it's very important to familiarize yourself with the basic style definitions in the global skin before you set out creating your own stylesheet.
... stylesheet syntax to familiarize yourself with the global skin, open up the text file called global.css in the chrome/classic.jar!/skin/classic/global directory of the mozilla application.
... browse through the global skin to familiarize yourself with what's there.
...And 2 more matches
NPN_GetURL - Archive of obsolete content
_self or _current: load the link into the same window the plug-in instance occupies.
...if the plug-in instance's document has no parent, the default is _self.
...the default is _self, if the plug-in instance's document is already at the top.
...And 2 more matches
Browser Detection and Cross Browser Support - Archive of obsolete content
html itself was not standardized until html 2.0 was introduced in late 1995 and it did not even include tables.
...web authors were no longer limited to detecting browsers on their web servers, but could now execute scripts client side (in the browser itself) which could be used to distinguish browsers.
... function moveelement(id, x, y) { // move the element with id to x,y // where x,y are the horizontal // and vertical position in pixels var elm = document.getelementbyid(id); if (elm) { elm.style.left = x + 'px'; elm.style.top = y + 'px'; } } ask yourself this: "is supporting non-standard browsers worth the development and maintenance costs?" example 3 - detecting specific gecko branches // return the rv value of a gecko user agent // as a floating point number.
...And 2 more matches
Examples - Archive of obsolete content
if you wish to test these examples by yourself, please read the important notes.
... important notes if you plan to test these examples by yourself, you must use the right filename extension (it is written at the beginning of the code).
... </p> <p> <a href="http://validator.w3.org/check/referer"><img src="https://udn.realityripple.com/samples/8a/9e64asf935.png" alt="valid xhtml 1.0!" height="31" width="88" /></a> </p> </body> </html> before testing this example by yourself, please read this.
...And 2 more matches
Introduction to events - Learn web development
note: it doesn't work if you try to register this event handler on the button itself — we've had to register it on the window object, which represents the entire browser window.
... here you can see we are including an event object, e, in the function, and in the function setting a background color style on e.target — which is the button itself.
...it's always good to be consistent — with yourself, and with others if possible.
...And 2 more matches
Getting started with React - Learn web development
it does this through the use of components — self-contained, logical pieces of code that describe a portion of the user interface.
...when compiled (using a tool like babel or parcel), our header expression would look like this: const header = react.createelement("header", null, react.createelement("h1", null, "mozilla developer network") ); it's possible to skip the compilation step and use react.createelement() to write your ui yourself.
...you don't have to configure compilation yourself unless you want to.
...And 2 more matches
Listening to events on all tabs
removing a listener to remove a previously installed progress listener, call removetabsprogresslistener(): gbrowser.removetabsprogresslistener(myprogresslistener); implementing a listener the listener object itself has five methods it can implement to handle various events: onlocationchange called when the uri of the document displayed in the tab changes.
...void onprogresschange( nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequest arequest, print32 acurselfprogress, print32 amaxselfprogress, print32 acurtotalprogress, print32 amaxtotalprogress ); parameters abrowser the browser representing the tab for which updated progress information is being provided.
... acurselfprogress the current progress for the request indicated by the request parameter.
...And 2 more matches
mach
mach itself is python 3 compliant, but modules used by mach likely are not python 3 compliant - so stick to python 2.7.
...however, most commands aren't part of mach itself.
...here is a minimal mach command module: from __future__ import print_function, unicode_literals from mach.decorators import ( commandargument, commandprovider, command, ) @commandprovider class machcommands(object): @command('doit', description='run it!') @commandargument('--debug', '-d', action='store_true', help='do it in debug mode.') def doit(self, debug=false): print('i did it!') from mach.decorators we import some python decorators which are used to define what python code corresponds to mach commands.
...And 2 more matches
Displaying Places information using views
when a view's underlying data changes, the view will automatically update itself so that it displays the new data.
...once notified, the view is responsible for updating itself.
... you therefore have four points of interaction with the built-in places tree view: the convenience methods and properties implemented directly on the view itself, the nsiplacesview interface of the view itself, the nsinavhistoryresulttreeviewer interface of the view's view, and the nsitreeview interface of the view's view.
...And 2 more matches
sslfnc.html
ssl_request_certificate is a server option that requests a client to authenticate itself.
... ssl_require_certificate is a server option that requires a client to authenticate itself (only if ssl_request_certificate is also on).
... ssl_request_certificate is a server option that requests a client to authenticate itself.
...And 2 more matches
ssltyp.html
to free a structure pointed to by a secitem, and, if desired, the secitem structure itself, use one the functions secitem_freeitem or secitem_zfreeitem.
...otherwise, free both the structure pointed to and the secitem structure itself.
...when freeitem is not pr_false, also frees the item structure itself.
...And 2 more matches
Shell global objects
if omitted, attach no source map url to the code (although the code may provide one itself, via a //#sourcemappingurl comment).
... functions available only if enable_intl_api is defined addintlextras(obj) adds various not-yet-standardized intl functions as properties on the provided object (this should generally be intl itself).
... getselfhostedvalue() get a self-hosted value by its name.
...And 2 more matches
Component Internals
the illustration below shows the basic relationship between the shared library containing the component implementation code you write and the xpcom framework itself.
...the largest and possibly most complex part of a component is the code specific to the component itself.
...the sequence of events that kicks off this xpcom initialization may be triggered by user action or by the application startup itself.
...And 2 more matches
Mozilla internal string guide
nsautostring / nsautocstring- derived from nsstring, a string which owns a 64 code unit buffer in the same storage space as the string itself.
... mozilla::bulkwritehandle<t> autoconverts to a writable mozilla::span<t> and also provides explicit access to itself as span (asspan()) or via component accessors named consistently with those on span: elements() and length() the latter is not the logical length of the string but the writable length of the buffer.
...see unicode conversion for more details and for better ways that don't require you to manage the memory yourself.
...And 2 more matches
nsIDownloadProgressListener
method overview void ondownloadstatechange(in short astate, in nsidownload adownload); void onlocationchange(in nsiwebprogress awebprogress, in nsirequest arequest, in nsiuri alocation, in nsidownload adownload); obsolete since gecko 1.9.1 void onprogresschange(in nsiwebprogress awebprogress, in nsirequest arequest, in long long acurselfprogress, in long long amaxselfprogress, in long long acurtotalprogress, in long long amaxtotalprogress, in nsidownload adownload); void onsecuritychange(in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astate, in nsidownload adownload); void onstatechange(in nsiwebprogress awebprogress, in nsirequest arequest, in unsigned long astateflags, in nsresult ast...
... void onprogresschange( in nsiwebprogress awebprogress, in nsirequest arequest, in long long acurselfprogress, in long long amaxselfprogress, in long long acurtotalprogress, in long long amaxtotalprogress, in nsidownload adownload ); parameters awebprogress the nsiwebprogress instance used by the download manager to monitor downloads.
... acurselfprogress the current amount of progress that's been made on the download specified by adownload.
...And 2 more matches
nsIModule
inherits from: nsisupports last changed in gecko 0.9.9 method overview boolean canunload(in nsicomponentmanager acompmgr); void getclassobject(in nsicomponentmanager acompmgr, in nscidref aclass, in nsiidref aiid, [retval, iid_is(aiid)] out nsqiresult aresult); void registerself(in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr, in string atype); void unregisterself(in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr); methods canunload() this method may be queried to determine whether or not the component module can be unloaded by xpcom.
... registerself() when the nsimodule is discovered, this method will be called so that any setup registration can be preformed.
... void registerself( in nsicomponentmanager acompmgr, in nsifile alocation, in string aloaderstr, in string atype ); parameters acompmgr the global component manager.
...And 2 more matches
MailNews fakeserver
it is comprised of three major components: a daemon, a handler, and the server itself.
... the server itself is found in mailnews/test/fakeserver/maild.js and was largely based off of the httpd fakeserver from network code.
...i tend to like using 1024 + default port number myself.
...And 2 more matches
Mozilla
this may be because of a code error within firefox itself, such as a deadlock or infinite loop, or it may be caused by 3rd-party software such as a firefox extension, antivirus software, or even malware or a virus on your computer.
...for example, a module could be used by firefox itself as well as by extensions, in order to avoid code duplication.
...all the methods that are supposed to show up on this jsobject are actually not properties of the object itself, but rather properties of the prototype of the jsobject for the wrapper (unless the c++ object's class info has the flag nsixpcscriptable::dont_share_prototype set, but lets assume that's not the case here).
...And 2 more matches
Debugger-API - Firefox Developer Tools
the debugger api cannot currently observe self-hosted javascript.
... this is not inherent in the api’s design, but simply that the self-hosting infrastructure isn’t prepared for the kind of invasions the debugger api can perform.
... the debugger instance itself is not really a shadow of anything in the debuggee; rather, it maintains the set of global objects which are to be considered debuggees.
...And 2 more matches
Allocations - Firefox Developer Tools
it includes the following columns: self count: the number of allocation-samples that were taken in this function (also shown as a percentage of the total) self bytes: the total number of bytes allocated in the allocation-samples in this function (also shown as a percentage of the total) rows are sorted by the "self bytes" column.
... self cost and total cost you'll see that there are separate sets of columns for "self" and for "total".
... "self" records samples taken only in this function.
...And 2 more matches
EventTarget.addEventListener() - Web APIs
see the event listener callback for details on the callback itself.
...this parameter is useful for code found in add-ons, as well as the browser itself.
... the callback function itself has the same parameters and return value as the handleevent() method; that is, the callback accepts a single parameter: an object based on event describing the event that has occurred, and it returns nothing.
...And 2 more matches
SVGPathSegList - Web APIs
the inserted item is the item itself and not a copy.
...the returned item is the item itself and not a copy.
...the inserted item is the item itself and not a copy.
...And 2 more matches
Content Security Policy (CSP) - HTTP
WebHTTPCSP
(sometimes you may see mentions of the x-content-security-policy header, but that's an older version and you don't need to specify it anymore.) alternatively, the <meta> element can be used to configure a policy, for example: <meta http-equiv="content-security-policy" content="default-src 'self'; img-src https://*; child-src 'none';"> threats mitigating cross site scripting a primary goal of csp is to mitigate and report xss attacks.
... example 1 a web site administrator wants all content to come from the site's own origin (this excludes subdomains.) content-security-policy: default-src 'self' example 2 a web site administrator wants to allow content from a trusted domain and all its subdomains (it doesn't have to be the same domain that the csp is set on.) content-security-policy: default-src 'self' *.trusted.com example 3 a web site administrator wants to allow users of a web application to include images from any origin in their own content, but to restrict audio or video medi...
... content-security-policy: default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com here, by default, content is only permitted from the document's origin, with the following exceptions: images may load from anywhere (note the "*" wildcard).
...And 2 more matches
Feature-Policy: usb - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
...And 2 more matches
globalThis - JavaScript
on the web you can use window, self, or frames - but in web workers only self will work.
... the globalthis property provides a standard way of accessing the global this value (and hence the global object itself) across environments.
... unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts.
...And 2 more matches
target - SVG: Scalable Vector Graphics
WebSVGAttributetarget
(x)html iframe or object element) into which a document is to be opened when the link is activated: only one element is using this attribute: <a> html, body, svg { height: 100%; } text { font: 20px arial, helvetica, sans-serif; fill: blue; text-decoration: underline; } <svg viewbox="0 0 300 120" xmlns="http://www.w3.org/2000/svg"> <a href="https://developer.mozilla.org" target="_self"> <text x="0" y="20">open link within iframe</text> </a> <a href="https://developer.mozilla.org" target="_blank"> <text x="0" y="60">open link in new tab or window</text> </a> <a href="https://developer.mozilla.org" target="_top"> <text x="0" y="100">open link in this tab or window</text> </a> </svg> usage notes value _self | _parent | _top | _blank | <xml-n...
...ame> default value _self animatable yes _replace the current svg image is replaced by the linked content in the same rectangular area in the same frame as the current svg image.
... note: this value was never well implemented, and the distinction between _replace and _self has been made redundant by changes in the html definition of browsing contexts.
...And 2 more matches
Loading Content Scripts - Archive of obsolete content
the constructors for content-script-using objects such as panel and page-mod define a group of options for loading content scripts: contentscript string, array contentscriptfile string, array contentscriptwhen string contentscriptoptions object we have already seen the contentscript option, which enables you to pass in the text of the script itself as a string literal.
...to supply the file "my-content-script.js", located in the /data subdirectory under your add-on's root directory, use a line like: // "data" is supplied by the "self" module var data = require("sdk/self").data; ...
... contentscriptfile: data.url("my-content-script.js") both contentscript and contentscriptfile accept an array of strings, so you can load multiple scripts, which can also interact directly with each other in the content process: // "data" is supplied by the "self" module var data = require("sdk/self").data; ...
... the contentscriptoptions is a json that is exposed to content scripts as a read only value under self.options property.
Modules - Archive of obsolete content
a module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface.
...rewriting the loadscript function using sandboxes, we end up with: function loadscript(url, imports) { let global = components.utils.sandbox(url); global.imports = imports; global.exports = {}; loader.loadsubscript(url, global); return global.exports; } note that the object returned by sandbox is a wrapper to the sandbox, not the sandbox itself.
...a commonjs module defines three global variables: require, which is a function that behaves like loadscript in our examples, exports, which behaves like the exports object, and module, which is an object representing the module itself.
...the module system is implemented using a loader object, which is actually provided as a module itself.
ui/button/action - Archive of obsolete content
here's an add-on with a button that disables itself when you click it, but only for the currently active window: var { actionbutton } = require("sdk/ui/button/action"); var button = actionbutton({ id: "my-button", label: "my button", icon: { "16": "./firefox-16.png", "32": "./firefox-32.png" }, onclick: disableforthiswindow }); function disableforthiswindow(state) { button.state("window", { disabled: true...
...you can specify this in one of three ways: as a resource:// url pointing at an icon file in your add-on's "data" directory, typically constructed using self.data.url(iconfile) as a relative path: a string in the form "./iconfile", where "iconfile" is a relative path to the icon file beginning in your add-on's "data" directory as an object, or dictionary of key-value pairs.
... var { actionbutton } = require('sdk/ui/button/action'); var self = require("sdk/self"); var button1 = actionbutton({ id: "my-button1", label: "my button1", icon: self.data.url("firefox-16.png") }); var button2 = actionbutton({ id: "my-button2", label: "my button2", icon: "./firefox-16.png" }); var button3 = actionbutton({ id: "my-button3", label: "my button3", icon: { "16" : "./firefox-16.png", "32" : "./f...
...first tab's label -> "window-specific label" console.log(button.state(tabs[0]).label); // access the second tab's label -> "tab-specific label" console.log(button.state(tabs[1]).label); // reset the tab-specific state button.state(tab, null); // access the second tab's label -> "window-specific label" console.log(button.state(tabs[1]).label); } finally, you can pass the button itself into state().
ui/frame - Archive of obsolete content
so there are three cases to consider: sending messages from a frame script to the main add-on code sending messages from the main add-on code to all instances of a frame, across all browser windows sending messages from the main add-on code to a single instance of a frame, attached to a specific browser window in all cases, postmessage() takes two arguments: the message itself and a targetorigin.
...this takes two arguments, the message itself and a target origin.
...to do this, you call postmessage() not on the frame itself but on the source attribute of the object passed into an event listener.
...you can specify the url in one of two ways: as a resource:// url pointing at a file under your add-on's "data" directory, typically constructed using self.data.url(filename) as a relative path: a string in the form "./relativepath", where "relativepath" is a relative path to the file beginning in your add-on's "data" directory var { frame } = require("sdk/ui/frame"); var self = require("sdk/self"); var frame1 = new frame({ url: require("sdk/self").data.url("content1.html") }); var frame2 = new frame({ url: "./content2.html" });...
package.json - Archive of obsolete content
others, such as lib, permissions, and preferences, represent instructions to the jpm tool itself to generate and include particular code and data structures in your add-on.
... see supporting updates for self-hosted add-ons.
... see supporting updates for self-hosted add-ons.
... see supporting updates for self-hosted add-ons.
Creating annotations - Archive of obsolete content
we'll use two objects to create annotations: a page-mod to find page elements that the user can annotate, and a panel for the user to enter the annotation text itself.
...it is initially off: var matchedelement = null; var originalbgcolor = null; var active = false; function resetmatchedelement() { if (matchedelement) { (matchedelement).css('background-color', originalbgcolor); (matchedelement).unbind('click.annotator'); } } self.on('message', function onmessage(activation) { active = activation; if (!active) { resetmatchedelement(); } }); this selector listens for occurrences of the jquery mouseenter event.
...!active || $(this).hasclass('annotated')) { return; } resetmatchedelement(); ancestor = $(this).closest("[id]"); matchedelement = $(this).first(); originalbgcolor = $(matchedelement).css('background-color'); $(matchedelement).css('background-color', 'yellow'); $(matchedelement).bind('click.annotator', function(event) { event.stoppropagation(); event.preventdefault(); self.port.emit('show', [ document.location.tostring(), $(ancestor).attr("id"), $(matchedelement).text() ] ); }); }); conversely, the add-on resets the matched element on mouseout: $('*').mouseout(function() { resetmatchedelement(); }); save this code in a new file called selector.js in your add-on's data directory.
... here's the code: var textarea = document.getelementbyid('annotation-box'); textarea.onkeyup = function(event) { if (event.keycode == 13) { self.postmessage(textarea.value); textarea.value = ''; } }; self.on('message', function() { var textarea = document.getelementbyid('annotation-box'); textarea.value = ''; textarea.focus(); }); save this inside data/editor as annotation-editor.js.
Creating reusable content with CSS and XBL - Archive of obsolete content
information: xbl bindings the structure provided by markup languages and css is not ideal for complex applications where parts need to be self-contained and reusable.
...you can use xbl to link selected elements to their own: stylesheets content properties and methods event handlers because you avoid linking everything at the document level, you can make self-contained parts that are easy to maintain and reuse.
...so the binding is self-contained.
...in this demonstration, the square and the button make a self-contained widget that functions within an html document.
MMgc - Archive of obsolete content
it represents a full, self-contained instance of the garbage collector.
...}; class myothermanagedgcobject : public mmgc::gcobject { drcwb(myobject*) myobject; }; class myothermanagedrcobject : public mmgc::rcobject { drcwb(myobject*) myobject; }; the rcobject must zero itself out on deletion.
...finalizers may not perform any of the following actions: fire any write barriers dereference a pointer to any gc object, including member variables (except see below about rcobject references) allocate any gc memory (gc::alloc), explicitly free gc memory (gc::free) change the set of gc roots (create a gcroot object or derivative) cause itself to become reachable if a finalized object holds a reference to an rcobject, it may safely call decrementref on the rcobject.
...thus the queue itself is a perfect way to maintain marking state between marking increments.
JavaScript Client API - Archive of obsolete content
the store must also make updates to the underlying data itself based on incoming record objects.
...that doesn't mean just whatever caches of the data the store happens to be maintaining; it means the underlying data itself.
... function footracker(name) { tracker.call(this, name); // register yourself as event listener or observer for whatever // you want to track.
...it's a bit smarter to have // yourself notified when to start and stop tracking therefore: svc.obs.add("weave:engine:start-tracking", this); svc.obs.add("weave:engine:stop-tracking", this); } footracker.prototype = { __proto__: tracker.prototype, _enabled: false, observe: function observe(subject, topic, data) { switch (topic) { case "weave:engine:start-tracking": if (!this._enabled) { // register event handler or observer here ...
XPJS Components Proposal - Archive of obsolete content
just as with native component modules each of these .js files will be expected to have the functions: nsregisterself nsgetfactory nsunregisterself (optional) nscanunload (optional) each .js file might implement one or more components.
... when a xpjs component module is first installed - or at autoregistration time - the xpjsmanager will load the .js file into a fresh js environment, let its top level script run to do whatever initialization it wants to do, and then it will call the module's nsregisterself function (passing the filespec of the .js file).
... at this point the module will use the (new) methods on the components object to register itself with the component manager as a factory module for one or more classid or progid.
...if the xpjsmanager is asked to trim itself back (by whatever means) it will call the nscanunload method (if present) on each module.
XUL Parser in Python - Archive of obsolete content
the script writes out all the attributes and none of the values, but the parser itself is seeing the elements, their attributes, and the values of those attributes, and you just have to ask for them if you want them.
...note also that i wrote the build number into the header myself, and haven't figured out yet how to get that written automatically.
...the parser provides the tag name itself as a string and the attributes and their values in a dictionary, "a".
...extending on the approach in this script, then, you could imagine a kind of introspective xul chrome that could modify and replicate itself by calling services from the xulparser and xulwriter xpcom objects.
Anatomy of a video game - Game development
your game loop might be similar to the find the differences example and base itself on input events.
...this function does some work and also tells the browser to call itself next frame with window.requestanimationframe().
...because main() is called once in the second statement and every call of it places itself in the queue of things to do next frame, main() is synchronized to your framerate.
...obviously, cleaning up resources is not time sensitive (especially if tidying is more disruptive than the garbage itself).
Game monetization - Game development
the word itself acquired negative connotations after big companies focused on creating games, the main purpose of which was to get as much money from the players as possible instead of delivering a fun experience.
...a totally new set of levels with new characters, weapons and story is a good material for dlc, but to have enough sales the game itself has to be popular, or else there won't be any players interested in spending their hard earned money on it.
... advertisements instead of actively selling the games you can also try to get yourself a passive income — showing adverts and relying on previous activities related to promoting your game may benefit, but your game has to be addictive, which isn't as easy as it sounds.
... branding you can sell rights to use your game for branding, or do it yourself.
Accessible multimedia - Learn web development
creating custom audio and video controls html5 video and audio share an api — html media element — which allows you to map custom functionality to buttons and other controls — both of which you define yourself.
... to each of the controls — add the following to the top of your javascript file: const playpausebtn = document.queryselector('.playpause'); const stopbtn = document.queryselector('.stop'); const rwdbtn = document.queryselector('.rwd'); const fwdbtn = document.queryselector('.fwd'); const timelabel = document.queryselector('.time'); next, we need to grab a reference to the video/audio player itself — add this line below the previous lines: const player = document.queryselector('video'); this holds a reference to a htmlmediaelement object, which has several useful properties and methods available on it that can be used to wire up functionality to our buttons.
... community/grass roots/self transcription — if you are part of an active community or team in your workplace, then you could ask them for help with doing the translations.
... you could even have a go at doing them yourself.
Legacy layout methods - Learn web development
first, of all, apply the following to your html to provide some basic setup: body { width: 90%; max-width: 900px; margin: 0 auto; } the body will be 90% of the viewport wide until it gets to 900px wide, in which case it will stay fixed at this width and center itself in the viewport.
...try adjusting the width of your browser window to see for yourself.
...add the following to the bottom of your css: .offset-by-one { margin-left: calc(6.25% + (2.08333333%*2)); } or if you prefer to calculate the percentages yourself, use this one: .offset-by-one { margin-left: 10.41666666%; } you can now add this class to any container you want to leave a one column wide empty space on the left hand side of it.
...it’s exactly the same as if you did the work of calculating these percentages yourself.
Practical positioning examples - Learn web development
we'll also give you a bit of javascript to include on your page to display the corresponding panel when a tab is pressed, and style the tab itself.
... you won't need to understand the javascript itself at this stage, but you should think about learning some basic javascript as soon as possible — the more complex your ui features become, the more likely it is that you'll need some javascript to implement your desired functionality.
... here we are going to use these elements for a slightly different purpose — another useful side effect of <label> elements is that you can click a checkbox's label to check the checkbox, as well as just the checkbox itself.
... styling the panel now it's time to style the actual sliding panel itself.
What text editors are available? - Learn web development
that means, if you've set your heart on an obscure text editor, you may have to compile it from source yourself (not for the faint-hearted).
...that works great for writing notes to yourself, but when you're doing web development and writing in html, css, and javascript, you can produce some pretty large, complex files.
... make it easier on yourself by choosing a text editor that understands the technologies you're working with.
...save yourself the hassle of retyping all this by using a code snippet to pre-fill your document.
Sending form data - Learn web development
when you do this, the data is encrypted along with the rest of the request, even if the form itself is hosted on an insecure page accessed using http.
...') @app.route('/hello', methods=['get', 'post']) def hello(): return render_template('greeting.html', say=request.form['say'], to=request.form['to']) if __name__ == "__main__": app.run() the two templates referenced in the above code are as follows (these need to be in a subdirectory called templates in the same directory as the python-example.py file, if you try to run the example yourself): form.html: the same form as we saw above in the the post method section but with the action set to {{ url_for('hello') }}.
...but it's much easier than trying to write all the functionality yourself from scratch, and will save you a lot of time.
...the most important rule is: never ever trust your users, including yourself; even a trusted user could have been hijacked.
Advanced text formatting - Learn web development
turn "the need to eliminate negative self talk" in the third paragraph into an inline quote, and include a cite attribute.
... the citation sources you need are: http://www.brainyquote.com/quotes/authors/c/confucius.html for the confucius quote http://www.affirmationsforpositivethinking.com for "the need to eliminate negative self talk".
...as confucius' quotes site says:</p> <p>it does not matter how slowly you go as long as you do not stop.</p> <p>i also love the concept of positive thinking, and the need to eliminate negative self talk (as mentioned in affirmations for positive thinking.)</p> </textarea> <div class="playable-buttons"> <input id="reset" type="button" value="reset"> <input id="solution" type="button" value="show solution"> </div> html { font-family: sans-serif; } h2 { font-size: 16px; } .a11y-label { margin: 0; text-align: right; font-size: 0.7rem; width: 98%; } body { margin: 10px; ...
.../quotes/authors/c/confucius.html"><cite>confucius\' quotes site</cite></a> says:</p>\n\n<blockquote cite="http://www.brainyquote.com/quotes/authors/c/confucius.html">\n <p>it does not matter how slowly you go as long as you do not stop.</p>\n</blockquote>\n\n<p>i also love the concept of positive thinking, and <q cite="http://www.affirmationsforpositivethinking.com">the need to eliminate negative self talk</q> (as mentioned in <a href="http://www.affirmationsforpositivethinking.com"><cite>affirmations for positive thinking</cite></a>.)</p>'; const solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = functi...
Index - Learn web development
you may want to return to this lesson in the future if you ever find yourself confused about how big boxes are in your layout.
...see the article on legacy layout methods for information on how they used to be used, which may be useful if you find yourself working on older projects.
...this also marks the end of the introduction to html module learning articles — now you can go on to testing yourself with our assessments: the first one is linked below.
...while there is a long way to go before you can consider yourself a client-side tooling wizard, we are hoping that this module has given you that first important step towards understanding client-side tooling, and the confidence to learn more and try out new things.
Manipulating documents - Learn web development
this is a "tree structure" representation created by the browser that enables the html structure to be easily accessed by programming languages — for example the browser itself uses it to apply styling and other information to the correct elements as it renders a page, and developers like you can manipulate the dom with javascript after the page has been rendered.
... it is useful to familiarize yourself with this terminology before working with the dom, as a number of the code terms you'll come across make use of them.
...in our current case, we just use node.removechild(), like this: sect.removechild(linkpara); when you want to remove a node based only on a reference to itself, which is fairly common, you can use childnode.remove(): linkpara.remove(); this method is not supported in older browsers.
... they have no method to tell a node to remove itself, so you'd have to do the following.
Inheritance in JavaScript - Learn web development
getting started first of all, make yourself a local copy of our oojs-class-inheritance-start.html file (see it running live also).
...we have defined a new constructor, and it has a prototype property, which by default just contains an object with a reference to the constructor function itself.
...if you find yourself starting to create a number of objects that have similar features, then creating a generic object type to contain all the shared functionality and inheriting those features in more specialized object types can be convenient and useful.
...if you find yourself creating a bunch of related variables and functions and want to track them all together and package them neatly, an object is a good idea.
Object building practice - Learn web development
drawing the ball first add the following draw() method to the ball()'s prototype: ball.prototype.draw = function() { ctx.beginpath(); ctx.fillstyle = this.color; ctx.arc(this.x, this.y, this.size, 0, 2 * math.pi); ctx.fill(); } using this function, we can tell the ball to draw itself onto the screen, by calling a series of members of the 2d canvas context we defined earlier (ctx).
... type in the following to create a new ball instance: let testball = new ball(50, 100, 4, 4, 'blue', 10); try calling its members: testball.x testball.size testball.color testball.draw() when you enter the last line, you should see the ball draw itself somewhere on the canvas.
...this is generally done recursively — which means that the function is calling itself every time it runs, so it runs over and over again.
...we don't want to check whether a ball has collided with itself!
Deploying our app - Learn web development
testing testing itself is a vast subject, even within the realm of front end development.
... the test itself isn't what is important.
...while there is a long way to go before you can consider yourself a client-side tooling wizard, we are hoping that this module has given you that first important step towards understanding client-side tooling, and the confidence to learn more and try out new things.
...some questions to ask yourself: can images be compressed during the build step?
Theme concepts
these resources are then packed in a zip for publication on addons.mozilla.org (amo) or for self-distribution.
... for more information on self-distribution, visit signing and distributing your add-on.
...themes can be submitted to amo for hosting or for self-distribution.
... updating static themes if your static theme is hosted on amo, you can upload a new version using the developer hub with the following steps: visit the product page for your theme through the developer hub select "upload new version" on the left upload your packaged file for validation or modify it using the theme generator for self-hosted static themes, a new version can be updated through amo by following the above steps or be handled by you through an updateurl or external application updates.
Application cache implementation overview
nsofflinecacheupdate it self is the core of the update process.
...when found, this update is processing an “update” and this cache is used as a cache to satisfy each manifest item and the manifest it self load from.
...processnexturi then invokes it self asynchronously via dispatch to a main thread when not already on the concurrency limit of 15 loads.
... when concurrency limit is reached, the processnexturi self-invocation cycle is stopped.
Performance best practices for Firefox front-end engineers
the rendering process goes through the following steps: the above image is used under creative commons attribution 3.0, courtesy of this page from our friends at google, which itself is well worth the read.
... a documentfragment is maintained in memory outside the dom itself, so changes don't cause reflow.
... prove to yourself that you’ve actually improved something by measuring before and after.
...test on slower machines to make it more obvious to yourself if what you’ve written impacts the performance of the browser.
PromiseWorker.jsm
let worker = new promiseworker.abstractworker() worker.dispatch = function(method, args = []) { // dispatch a call to method `method` with args `args` return self[method](...args); }; worker.postmessage = function(...args) { // post a message to the main thread self.postmessage(...args); }; worker.close = function() { // close the worker self.close(); }; worker.log = function(...args) { // log (or discard) messages (optional) dump('worker: ' + args.join(' ') + '\n'); }; // connect it to message port.
... self.addeventlistener('message', msg => worker.handlemessage(msg)); abstractworker is a base class for the worker, and it's designed to be used by derived class, which provides above four methods (dispatch, postmessage, close, and log).
... but you can instantiate abstractworker itself and set its properties later, instead of creating derived class.
... worker file myworker.js importscripts('resource://gre/modules/workers/require.js'); let promiseworker = require('resource://gre/modules/workers/promiseworker.js'); let worker = new promiseworker.abstractworker(); worker.dispatch = function(method, args = []) { return self[method](...args); }; worker.postmessage = function(...args) { self.postmessage(...args); }; worker.close = function() { self.close(); }; worker.log = function(...args) { dump('worker: ' + args.join(' ') + '\n'); }; self.addeventlistener('message', msg => worker.handlemessage(msg)); // start - my functionalities function resolvetest(shouldresolve) { if (shouldresolve) { return 'you s...
XPCOMUtils.jsm
definelazygetter takes three arguments: the object to define the property on the name of the property defined the getter function itself, which returns the value and which will be called just once, the first time code tries to access the property.
...this parameter should not be the component itself because that would cause a memory leak.
... when the generated method is invoked on that object, it checks to see if the specified iid is listed in the array specified by the interfaces parameter; if it is, this (that is, the object itself) is returned.
... remarks this lets an extension bundle its own javascript code modules within itself and have them load one another.
An overview of NSS Internals
this is often sufficient if you encrypt data for yourself, but as soon as you need to exchange signed/encrypted data with communication partners, using public key encryption simplifies the key management.
...(however, it's also possible to use nss functionality to create a self-signed certificate, which, however, usually won't be trusted by other parties.) once received, it's sufficient to tell nss to import such a new certificate into the nss database, and nss will automatically perform a lookup of the embedded public key, be able to find the associated private key, and subsequently be able to treat it as a personal certificate.
... trust anchors contained in the ckbi module are usually self signed, which is defined as having identical subject name and issuer name fields.
... if a self-signed certificate is marked as explicitly trusted, nss will skip checking the self-signature for validity.
NSS tools : certutil
if a ca key pair is not available, you can create a self-signed certificate using the -x argument with the -s command option.
... for example, this creates a self-signed certificate: $ certutil -s -s "cn=example ca" -n my-ca-cert -x -t "c,c,c" -1 -2 -5 -m 3650 from there, new certificates can reference the self-signed certificate: $ certutil -s -s "cn=my server cert" -n my-server-cert -c "my-ca-cert" - t "u,u,u" -1 -5 -6 -8 -m 730 generating a certificate from a certificate request when a certificate request is created, a certifi...
... certutil -d -d [sql:]directory -n "nickname" for example: $ certutil -d -d sql:/home/my/sharednssdb -n "my-ssl-cert" validating certificates a certificate contains an expiration date in itself, and expired certificates are easily rejected.
... certutil -m -n certificate-name -t trust-args -d [sql:]directory for example: $ certutil -m -n "my ca certificate" -d sql:/home/my/sharednssdb -t "ctu ,ctu,ctu" printing the certificate chain certificates can be issued in chains because every certificate authority itself has a certificate; when a ca issues a certificate, it essentially stamps that certificate with its own fingerprint.
certutil
if a ca key pair is not available, you can create a self-signed certificate using the -x argument with the -s command option.
... for example, this creates a self-signed certificate: $ certutil -s -s "cn=example ca" -n my-ca-cert -x -t "c,c,c" -1 -2 -5 -m 3650 from there, new certificates can reference the self-signed certificate: $ certutil -s -s "cn=my server cert" -n my-server-cert -c "my-ca-cert" -t "u,u,u" -1 -5 -6 -8 -m 730 generating a certificate from a certificate request when a certificate request is created, a certificate can be ...
... certutil -d -d [sql:]directory -n "nickname" for example: $ certutil -d -d sql:/home/my/sharednssdb -n "my-ssl-cert" validating certificates a certificate contains an expiration date in itself, and expired certificates are easily rejected.
... certutil -m -n certificate-name -t trust-args -d [sql:]directory for example: $ certutil -m -n "my ca certificate" -d sql:/home/my/sharednssdb -t "ctu,ctu,ctu" printing the certificate chain certificates can be issued in chains because every certificate authority itself has a certificate; when a ca issues a certificate, it essentially stamps that certificate with its own fingerprint.
NSS tools : signtool
this special type of entry does not have to appear in the jar file itself.
...instead, it is self-signed.
...metadata is signed information attached either to the jar archive itself or to files within the archive.
...the metadata file contains one entry per line, each with three fields: field #1: file specification, or + if you want to specify global metadata (that is, metadata about the jar archive itself or all entries in the archive) field #2: the name of the data you are specifying; for example: install-script field #3: data corresponding to the name in field #2 for example, the -i option uses the equivalent of this line: + install-script: script.js this example associates a mime type with a file: movie.qt mime-type: video/quicktime for information about the way installer script information appears in...
SpiderMonkey Internals
self-hosting of built-in functions in js starting with firefox 17, spidermonkey has the ability to implement built-in functions in self-hosted js code.
... all self-hosted code lives in .js files under builtin/.
... for details on implementing self-hosted built-ins, see self-hosting.
...an example, from perfect.js: function perfect(n) { print("the perfect numbers up to " + n + " are:"); // we build sumofdivisors[i] to hold a string expression for // the sum of the divisors of i, excluding i itself.
JSFunctionSpec
syntax struct jsfunctionspec { const char *name; jsnativewrapper call; uint16_t nargs; uint16_t flags; const char *selfhostedname; }; typedef struct jsnativewrapper { jsnative op; const jsjitinfo *info; } jsnativewrapper; name type description name const char * the function's name.
... selfhostedname const char * the function's name in self-hosted javascript code.
...to define an array of jspropertyspec, use js_fs, js_fn, js_sym_fn, js_fninfo, js_self_hosted_fn, js_self_hosted_sym_fn, js_sym_fnspec, js_fnspec, and js_fs_end.
... see also mxr id search for jsfunctionspec jspropertyspec jsnative js_fs js_fn js_sym_fn js_fninfo js_self_hosted_fn js_self_hosted_sym_fn js_sym_fnspec js_fnspec js_fs_end property attributes js_definefunctions js_initclass ...
JSPropertySpec
syntax struct jspropertyspec { struct selfhostedwrapper { void *unused; const char *funname; }; const char *name; int8 tinyid; // obsolete since jsapi 31 uint8_t flags; union { jsnativewrapper native; selfhostedwrapper selfhosted; } getter; union { jsnativewrapper native; selfhostedwrapper selfhosted; } setter; /* obsolete since jsapi 29 */ /* added in jsapi 28 */ const char *selfhostedgetter; const char *selfhostedsetter; }; name type description name const char * name to assign the prope...
... getter jsnativewrapper or selfhostedwrapper getter method for the property.
... setter jsnativewrapper or selfhostedwrapper setter method for the property.
...to define an array of jspropertyspec, use js_psg, js_psgs, js_self_hosted_get, js_self_hosted_getset, and js_ps_end see also mxr id search for jspropertyspec jsfunctionspec jsnativewrapper js_defineproperties js_psg js_psgs js_self_hosted_get js_self_hosted_getset js_ps_end bug 766448 - changed type of getter and setter to wrapper bug 938728 - added selfhostedgetter and selfhostedsetter bug 958262 - changed type of getter and setter to union, and removed selfhostedgetter and selfhostedsetter.
A Web PKI x509 certificate primer
in order for a certificate to be valid these three requirements must be met: there is a verification path from the site certificate to a trusted certificate of the user agent (ie if you follow the issuer path you will end on a self-signed certificate that is considered trusted by the browser).
... self-signed certificates these are the steps to generate a certificate for www.example.com.
...self-sign csr (using sha256) and append the extensions described in the file "openssl x509 -req -sha256 -days 3650 -in example.csr -signkey key.pem -set_serial $any_integer -extfile openssl.ss.cnf -out example.pem" you can now use example.pem as your certfile cas included in firefox when you visit a secure website, firefox will validate the website’s certificate by checking that the certif...
... write extensions file (openssl.root.cnf) basicconstraints = critical, ca:true keyusage = keycertsign, crlsign subjectkeyidentifier = hash nameconstraints = permitted;dns:example.com,permitted;dns:example.net self-sign csr (using sha256) and append the extensions described in the file "openssl x509 -req -sha256 -days 3650 -in root.csr -signkey rootkey.pem -set_serial $any_small_integer -extfile openssl.root.cnf -out root.pem" now you have ca pem file with its associated key.
XForms Accessibility
these are either downloading latest build of firefox or building it yourself.
...you must build it yourself.
... build it yourself if you would like to build firefox/seamonkey yourself then please ensure your .mozconfig file has the following option: ac_add_options --enable-extensions=default,xforms,schema-validation how to test there are two approaches to test xforms accessibility.
...some of these elements are not accessible itself but they makes accessibility properties for xforms elements that hold them.
Embedded Dialog API
however while xul dialogs are very configurable, they will not behave and probably not look precisely like dialogs which the application builds for itself, independently of gecko.
...this basic api will by itself provide the minimal functionality gecko needs to create new windows, and an embedding application must implement at least this much.
...advanced windowing api embedding applications concerned with ensuring that dialogs posed by gecko are consistent in appearance and behaviour with dialogs posed directly by the application itself face a choice.
...(note to self: is there decent documentation on writing factories or components?
History Service Design
in future this will probably change in favour of storage asynchronous statements, so that the inserts will be queued-up by mozstorage itself in a separate thread.
...a smart bookmark can update itself automatically when bookmarks or visits change, providing a sort of saved search.
...an history container node is built (the so-called rootnode), this node will fill itself.
... finally expiration can be forced by the user himself to clean up the full history or slices of it (last hour, last day, ...).
An Overview of XPCOM
the brief sections in this chapter introduce the concepts at a very high level, so that we can discuss and use them with more familiarity in the tutorial itself, which describes the creation of a mozilla component called weblock.
...when all clients lose interest in the component, the reference count hits zero, and the component deletes itself.
...if the object supports the requested interface, it adds a reference to itself and passes back a pointer to that interface.
... writing components in other languages though you do not have access to some of the tools that xpcom provides for c++ developers (such as macros, templates, smart pointers, and others) when you create components in other languages, you may be so comfortable with the language itself that you can eschew c++ altogether and build, for example, python-based xpcom components that can be used from javascript or vice versa.
Packaging WebLock
« previousnext » in this final part of the tutorial, we'll put all of the pieces of the web locking component - the library itself, the type library, the header file, and the user interface resources - into a package that can be installed on other systems.
... note: the emphasis of this tutorial is on the component development itself, so this section on packaging and installing extensions to gecko is necessarily brief.
... the chrome registry lives in a series of rdf/xml files in the application directory of mozilla and other gecko-based browsers, where new installs, user configurable data, skins, and other information are related to one another and the application itself.
...it must appear at the top level of the installation archive (i.e., weblock.xpi) itself.
Using XPCOM Components
it registers itself for use when the browser starts up, and provides a factory that creates an instance of it for use when the user or administrator clicks the weblock icon in the browser's user interface.
... beyond the methods that are being called on the cookiemanager itself (e.g., cookiemanager.remove, which maps to the remove() function in the nsicookiemanager interface), note the special xpconnect objects and methods that reflect the xpcom component into javascript.
... note: cookie-manager-ui note that the interface is not part of the component itself.
... xpcom makes it easy to use components like cookiemanager from mozilla's cross platform front end (xpfe) and other user interfaces, but the component itself doesn't provide its own ui.
Introduction to XPCOM for the DOM
when the reference count of an object hits 0 (zero), the object deletes itself.
...in the first case, if we forget to addref the object, the object may delete itself before we are done using the pointer, which would cause a crash when dereferencing it.
... in the second case, if we forget to release the object, it will never delete itself, which will cause "memory leaks", i.e.
...i had to use the second solution: nscomptr<nsicontent> content = getter_addrefs(ns_static_cast(nsicontent*, this)); // or, if you want to do the refcounting yourself, nsicontent *content = ns_static_cast(nsicontent*, this); the second form should be used with care, and is recommended only for advanced xpcom'ers.
operator=
self_type& operator=( const self_type& astring ); parameters astring [in] a nsembedcstring to append to this string.
... self_type& operator=( const abstract_string_type& astring ); parameters astring [in] a nsacstring to append to this string.
... self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string.
... self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string.
operator=
self_type& operator=( const self_type& astring ); parameters astring [in] a nsembedstring to append to this string.
... self_type& operator=( const abstract_string_type& astring ); parameters astring [in] a nsastring to append to this string.
... self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string.
... self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string.
nsIPrincipal
note that this may be empty; prefer to get the certificate itself and get this information from it, since that may provide more information.
...a principal always subsumes itself.
...the system principal subsumes itself and all other principals.
... a null principal (corresponding to an unknown, hence assumed minimally privileged, security context) is not equal to any other principal (including other null principals), and therefore does not subsume anything but itself.
nsIWebProgressListener2
last changed in gecko 1.9 (firefox 3) inherits from: nsiwebprogresslistener method overview void onprogresschange64(in nsiwebprogress awebprogress, in nsirequest arequest, in long long acurselfprogress, in long long amaxselfprogress, in long long acurtotalprogress, in long long amaxtotalprogress); boolean onrefreshattempted(in nsiwebprogress awebprogress, in nsiuri arefreshuri, in long amillis, in boolean asameuri); methods onprogresschange64() notification that the progress has changed for one of the requests associated with awebprogress.
...void onprogresschange64( in nsiwebprogress awebprogress, in nsirequest arequest, in long long acurselfprogress, in long long amaxselfprogress, in long long acurtotalprogress, in long long amaxtotalprogress ); parameters awebprogress the nsiwebprogress instance that fired the notification.
...acurselfprogress the current progress for arequest.
... amaxselfprogress the maximum progress for arequest.
Using nsIDirectoryService
be sure to see the documentation on the service itself.
...if you are not using ns_initembedding, you will have to construct it and register it yourself using nsidirectoryservice.registerprovider().
... if you are registering it yourself it is very important to register it immediately after calling ns_initxpcom.
...if you want to use mpfilelocprovider, or something like it, to provide one fixed profile, just construct it and call its initialize method - it will register itself.
Mail and RDF
asynchronously notifying rdf when the data itself changes, rdf needs to be notified.
... in the example of mail folders, each folder datasource first registers itself with the mail session as a nsifolderlistener because it wants information about when a folder changes.
... each template registers itself as an rdf observer.
... the calling chain essentially looks like this: registration: folder datasource registers itself with the mail session as a folder listener rdf template registers itself with the datasource as a content observer.
URLs - Plugins
in general, if a url works in the location box of the navigator, it works as a target for npn_geturl, except for the _self target.
... _self or _current: load the url into the same window the plug-in instance occupies.
...if the plug-in instance document has no parent, the default is _self.
...the default is _self, if the plug-in instance document is already at the top.
Debugger - Firefox Developer Tools
this property gives debugger code a single point of control for disentangling itself from the debuggee, regardless of what sort of events or handlers or “points” we add to the interface.
... if the uncaught exception hook itself throws an exception,uncaught-hook-exception, spidermonkey throws a new error object,confess-to-debuggee-exception, to the debuggee whose message blames the debugger, and includes textual descriptions ofuncaught-hook-exception and the originaldebugger-exception.
...thus, for example, a debugger.object referring to a second debugger.object which refers to a global does not designate that global for the purposes of this function.) the global designated byglobal must be in a different compartment than this debugger instance itself.
...note that in some cases, the prototype object for a given constructor has the same [[class]] as the instances that refer to it, but cannot itself be used as a valid instance of the class.
Manipulating video using canvas - Web APIs
var processor; processor.doload = function doload() { this.video = document.getelementbyid('video'); this.c1 = document.getelementbyid('c1'); this.ctx1 = this.c1.getcontext('2d'); this.c2 = document.getelementbyid('c2'); this.ctx2 = this.c2.getcontext('2d'); let self = this; this.video.addeventlistener('play', function() { self.width = self.video.videowidth / 2; self.height = self.video.videoheight / 2; self.timercallback(); }, false); }, this code grabs references to the elements in the xhtml document that are of particular interest, namely the video element and the two canvas elements.
... the timer callback the timer callback is called initially when the video starts playing (when the "play" event occurs), then takes responsibility for establishing itself to be called periodically in order to launch the keying effect for each frame.
... processor.timercallback = function timercallback() { if (this.video.paused || this.video.ended) { return; } this.computeframe(); let self = this; settimeout(function() { self.timercallback(); }, 0); }, the first thing the callback does is check to see if the video is even playing; if it's not, the callback returns immediately without doing anything.
... the last thing the callback does is call settimeout() to schedule itself to be called again as soon as possible.
Introduction to the DOM - Web APIs
alert(paragraphs[0].nodename); all of the properties, methods, and events available for manipulating and creating web pages are organized into objects (for example, the document object that represents the document itself, the table object that implements the special htmltableelement dom interface for accessing html tables, and so forth).
... when you create a script–whether it's inline in a <script> element or included in the web page by means of a script loading instruction–you can immediately begin using the api for the document or window elements to manipulate the document itself or to get at the children of that document, which are the various elements in the web page.
... data type (interface) description document when a member returns an object of type document (e.g., the ownerdocument property of an element returns the document to which it belongs), this object is the root document object itself.
...in simple terms, the window object represents something like the browser, and the document object is the root of the document itself.
Drag Operations - Web APIs
in this example the dragstart listener is added to the draggable element itself.
...for example, when dragging the selected text within a textbox, the data associated with the drag data item is the text itself.
...this image is created automatically, so you do not need to create it yourself.
...for example: const link = event.datatransfer.getdata("url"); this eliminates the need to check for comments or iterate through lines yourself.
Timing element visibility with the Intersection Observer API - Web APIs
the intersection observer api makes it easy to be asynchronously notified when elements of interest become more or less obscured by a shared ancestor node or element, including the document itself.
...our script receives this event when the document itself becomes visible or invisible.
...isibleads; visibleads = []; previouslyvisibleads.foreach(function(adbox) { updateadtimer(adbox); adbox.dataset.lastviewstarted = 0; }); } } else { previouslyvisibleads.foreach(function(adbox) { adbox.dataset.lastviewstarted = performance.now(); }); visibleads = previouslyvisibleads; previouslyvisibleads = null; } } since the event itself doesn't state whether the document has switched from visible to invisible or vice-versa, the document.hidden property is checked to see if the document is not currently visible.
...then the local variables for each of the elements that comprise an ad: the ad box itself, the title, the body, and the timer box, are all set to the corresponding elements in the existing ad.
Node - Web APIs
WebAPINode
if the node is itself a document, returns null.
...*/ removeallchildren(document.body) recurse through child nodes the following function recursively calls a callback function for each node contained by a root node (including the root itself): function eachnode(rootnode, callback) { if (!callback) { const nodes = [] eachnode(rootnode, function(node) { nodes.push(node) }) return nodes } if (false === callback(rootnode)) { return false } if (rootnode.haschildnodes()) { const nodes = rootnode.childnodes for (let i = 0, l = nodes.length; i < l; ++i) { if (false === eachnode(nodes[i], callback)) { return...
... } } } } syntax eachnode(rootnode, callback) description recursively calls a function for each descendant node of rootnode (including the root itself).
...if omitted, eachnode returns an array of every node contained within rootnode (including the root itself).
SVGAngle - Web APIs
WebAPISVGAngle
exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read-only attribute, or when the object itself is read-only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
SVGLength - Web APIs
WebAPISVGLength
exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... exceptions on setting: a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
... a domexception with code no_modification_allowed_err is raised when the length corresponds to a read only attribute or when the object itself is read only.
ServiceWorkerGlobalScope.skipWaiting() - Web APIs
example while self.skipwaiting() can be called at any point during the service worker's execution, it will only have an effect if there's a newly installed service worker that might otherwise remain in the waiting state.
... therefore, it's common to call self.skipwaiting() from inside of an installevent handler.
... self.addeventlistener('install', function(event) { // the promise that skipwaiting() returns can be safely ignored.
... self.skipwaiting(); // perform any other actions required for your // service worker to install, potentially inside // of event.waituntil(); }); specifications specification status comment service workersthe definition of 'skipwaiting()' in that specification.
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
const constraints = { audio: true, video: true }; const config = { iceservers: [{ urls: "stun:stun.mystunserver.tld" }] }; const selfvideo = document.queryselector("video.selfview"); const remotevideo = document.queryselector("video.remoteview"); const signaler = new signalingchannel(); const pc = new rtcpeerconnection(config); this code also gets the <video> elements using the classes "selfview" and "remoteview"; these will contain, respectively, the local user's self-view and the view of the incoming stream from the remote...
... async function start() { try { const stream = await navigator.mediadevices.getusermedia(constraints); for (const track of stream.gettracks()) { pc.addtrack(track, stream); } selfvideo.srcobject = stream; } catch(err) { console.error(err); } } this isn't appreciably different from older webrtc connection establishment code.
...then, finally, the media source for the self-view <video> element indicated by the selfvideo constant is set to the camera and microphone stream, allowing the local user to see what the other peer sees.
... automatic rollback in setremotedescription() a key component to perfect negotiation is the concept of the polite peer, which always rolls itself back if it receives an offer while itself waiting for an answer to an offer.
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
the value of w is always 0 for vectors, so the aforementioned vector can also be represented using [3, 1, -2, 0] or: [31-20]\left [ \begin{matrix} 3 \\ 1 \\ -2 \\ 0 \end{matrix} \right ] webxr automatically normalizes vectors to have a length of 1 meter; however, you may find that it makes sense to do it yourself for various reasons, such as to improve performance of calculations by not having to repeatedly perform normalization.
...this is because each transform affects the position of the object and possibly the very coordinate system itself, which can dramatically change the results of the next operation performed.
...zooming is performed in a physical camera by altering the focal length of the lens; this is the distance between the center of the lens itself and the camera's light sensors.
...you can remind yourself of this fact by closing one eye at a time, switching back and forth between the two eyes.
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
align-self allows this default alignment to be overridden for individual flex items.
... (for anonymous flex items, align-self always matches the value of align-items on their associated flex container.) values: flex-start | flex-end | center | baseline | stretch (default) spec: https://drafts.csswg.org/css-flexbox/#align-items-property @mixin align-items($value: stretch) { @if $value == flex-start { -webkit-box-align: start; -moz-box-align: start; -ms-flex-align: start; } @else if $value == flex-end { -webkit-box-align: end; -moz-box-align: end; -ms-flex-align: end; } @else { -webkit-box-align: $value; -moz-box-align: $value; -ms-flex-align: $value; } -webkit-align-items: $value; align-items: $value; } flexbox align self values: auto (default) | flex-start | flex-end | center | baseline | stretch spec: https://drafts.css...
...wg.org/css-flexbox/#align-items-property @mixin align-self($value: auto) { // no webkit box fallback.
... -webkit-align-self: $value; @if $value == flex-start { -ms-flex-item-align: start; } @else if $value == flex-end { -ms-flex-item-align: end; } @else { -ms-flex-item-align: $value; } align-self: $value; } flexbox align content the align-content property aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main axis.
place-items - CSS: Cascading Style Sheets
constituent properties this property is a shorthand for the following css properties: align-items justify-items syntax /* keyword values */ place-items: auto center; place-items: normal start; /* positional alignment */ place-items: center normal; place-items: start auto; place-items: end normal; place-items: self-start auto; place-items: self-end normal; place-items: flex-start auto; place-items: flex-end normal; place-items: left auto; place-items: right normal; /* baseline alignment */ place-items: baseline normal; place-items: first baseline auto; place-items: last baseline normal; place-items: stretch auto; /* global values */ place-items: inherit; place-items: initial; place-items: unset; values ...
... self-start the item is packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis.
... self-end the item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis.
... <option value="end">end</option> <option value="left">left</option> <option value="right">right</option> <option value="auto center">auto center</option> <option value="normal start">normal start</option> <option value="center normal">center normal</option> <option value="start auto">start auto</option> <option value="end normal">end normal</option> <option value="self-start auto">self-start auto</option> <option value="self-end normal">self-end normal</option> <option value="flex-start auto">flex-start auto</option> <option value="flex-end normal">flex-end normal</option> <option value="left auto">left auto</option> <option value="right normal">right normal</option> <option value="baseline normal">baseline normal</option> <option va...
Content categories - Developer guides
heading content heading content defines the title of a section, whether marked by an explicit sectioning content element, or implicitly defined by the heading content itself.
... though likely to contain heading content, the <header> is not heading content itself.
... for example, the <del> and <ins> elements are transparent: <p>we hold these truths to be <del><em>sacred &amp; undeniable</em></del> <ins>self-evident</ins>.</p> if those elements were removed, this fragment would still be valid html (if not correct english).
... <p>we hold these truths to be <em>sacred &amp; undeniable</em> self-evident.</p> other content models sectioning root.
Constraint validation - Developer guides
while marking up the form itself is easy, checking whether each field has a valid and coherent value is more difficult, and informing the user about the problem may become a headache.
... toolong constraint violation constraint validation process constraint validation is done through the constraint validation api either on a single form element or at the form level, on the <form> element itself.
... by submitting the form itself.
...label for="country">country : </label> <select id="country"> <option value="ch">switzerland</option> <option value="fr">france</option> <option value="de">germany</option> <option value="nl">the netherlands</option> </select> <input type="submit" value="validate"> </form> this displays the following form: first, we write a function checking the constraint itself: function checkzip() { // for each country, defines the pattern that the zip has to follow var constraints = { ch : [ '^(ch-)?\\d{4}$', "switzerland zips must have exactly 4 digits: e.g.
Browser detection using the user agent - HTTP
there are ways to develop your website to progressively enhance itself based on the availability of features rather than by targeting specific browsers.
... problems like these can be avoided by testing for support of the feature itself instead: var islookbehindsupported = false; try { new regexp("(?<=)"); islookbehindsupported = true; } catch (err) { // if the agent doesn't support lookbehinds, the attempted // creation of a regexp object using that syntax throws and // islookbehindsupported remains false.
...using this information of whether the device has a touchscreen, do not change the entire layout of the website just for touch devices: you will only create more work and maintenance for yourself.
...so to detect safari you have to check for the safari string and the absence of the chrome string, chromium often reports itself as chrome too or seamonkey sometimes reports itself as firefox.
Using Feature Policy - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... for example, the following are equivalent: feature-policy: unsized-media 'none'; geolocation 'self' https://example.com; camera *; feature-policy: unsized-media 'none' feature-policy: geolocation 'self' https://example.com feature-policy: camera *; the iframe allow attribute the second way to use feature policy is for controlling content within an iframe.
CSP: base-uri - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
... examples meta tag configuration <meta http-equiv="content-security-policy" content="base-uri 'self'"> apache configuration <ifmodule mod_headers.c> header set content-security-policy "base-uri 'self'"; </ifmodule> nginx configuration add_header content-security-policy "base-uri 'self';" violation case since your domain isn't example.com, a <base> element with its href set to https://example.com will result in a csp violation.
... <meta http-equiv="content-security-policy" content="base-uri 'self'"> <base href="https://example.com/"> // error: refused to set the document's base uri to 'https://example.com/' // because it violates the following content security policy // directive: "base-uri 'self'" specifications specification status comment content security policy level 3the definition of 'base-uri' in that specification.
CSP: default-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
...the following header: content-security-policy: default-src 'self'; script-src https://example.com is the same as: content-security-policy: connect-src 'self'; font-src 'self'; frame-src 'self'; img-src 'self'; manifest-src 'self'; media-src 'self'; object-src 'self'; script-src https://example.com; style-src 'self'; ...
... worker-src 'self' specifications specification status comment content security policy level 3the definition of 'default-src' in that specification.
Feature-Policy: accelerometer - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default value is 'self'.
Feature-Policy: ambient-light-sensor - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default value is 'self'.
Feature-Policy: autoplay - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default value in google chrome is 'self'.
Feature-Policy: battery - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default value is 'self'.
Feature-Policy: camera - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default value is 'self'.
Feature-Policy: display-capture - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default alowlist is 'self'.
Feature-Policy: encrypted-media - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the allow list is 'self'.
Feature-Policy: gyroscope - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: layout-animations - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: legacy-image-formats - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: magnetometer - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: microphone - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: midi - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the allow list is 'self'.
Feature-Policy: payment - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the payment feature's default allowlist value is 'self'.
Feature-Policy: publickey-credentials-get - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default allowlist is 'self'.
Feature-Policy: screen-wake-lock - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy default allow list for screen-wake-lock is 'self'.
Feature-Policy: unoptimized-images - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: vibrate - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... the default value is 'self'.
Feature-Policy: wake-lock - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy default allow list for wake-lock is 'self'.
web-share - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default value is 'self'.
Feature-Policy: xr-spatial-tracking - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
... default policy the default allowlist is 'self'.
InternalError: too much recursion - JavaScript
a function that calls itself is called a recursive function.
... once a condition is met, the function stops calling itself.
...as there is no exit condition, the function will call itself infinitely.
...this causes the function to call itself, again and again, making it infinitely recursive.
arguments.callee - JavaScript
avoid using arguments.callee() by either giving function expressions a name or use a function declaration where a function must call itself.
... examples using arguments.callee in an anonymous recursive function a recursive function must be able to refer to itself.
... typically, a function refers to itself by its name.
...therefore if there is no accessible variable referring to it, the only way the function can refer to itself is by arguments.callee.
Progressive web app structure - Progressive web apps (PWAs)
we can control what is requested from the server and what is retrieved from the cache with a service worker, which will be explained in detail in the next article — for now let's focus on the structure itself.
...[randomitem].author+'.'; var notifimg = 'data/img/'+games[randomitem].slug+'.jpg'; var options = { body: notifbody, icon: notifimg } var notif = new notification(notiftitle, options); settimeout(randomnotification, 30000); } the service worker the last file we will quickly look at is the service worker: sw.js — it first imports data from the games.js file: self.importscripts('data/games.js'); next, it creates a list of all the files to be cached, both from the app shell and the content: var cachename = 'js13kpwa-v1'; var appshellfiles = [ '/pwa-examples/js13kpwa/', '/pwa-examples/js13kpwa/index.html', '/pwa-examples/js13kpwa/app.js', '/pwa-examples/js13kpwa/style.css', '/pwa-examples/js13kpwa/fonts/graduate.eot', '/pwa-examples/js13kpwa/fo...
...ns/icon-192.png', '/pwa-examples/js13kpwa/icons/icon-256.png', '/pwa-examples/js13kpwa/icons/icon-512.png' ]; var gamesimages = []; for(var i=0; i<games.length; i++) { gamesimages.push('data/img/'+games[i].slug+'.jpg'); } var contenttocache = appshellfiles.concat(gamesimages); the next block installs the service worker, which then actually caches all the files contained in the above list: self.addeventlistener('install', function(e) { console.log('[service worker] install'); e.waituntil( caches.open(cachename).then(function(cache) { console.log('[service worker] caching all: app shell and content'); return cache.addall(contenttocache); }) ); }); last of all, the service worker fetches content from the cache if it is available there, providing offline function...
...ality: self.addeventlistener('fetch', function(e) { e.respondwith( caches.match(e.request).then(function(r) { console.log('[service worker] fetching resource: '+e.request.url); return r || fetch(e.request).then(function(response) { return caches.open(cachename).then(function(cache) { console.log('[service worker] caching new resource: '+e.request.url); cache.put(e.request, response.clone()); return response; }); }); }) ); }); the javascript data the games data is present in the data folder in a form of a javascript object (games.js): var games = [ { slug: 'lost-in-cyberspace', name: 'lost in cyberspace', author: 'zosia and bartek', twitter: 'bartaz', website: '', ...
Structural overview of progressive web apps - Progressive web apps (PWAs)
we can control what is requested from the server and what is retrieved from the cache with a service worker, which will be explained in detail in the next article — for now let's focus on the structure itself.
...this script begins by importing data from the file games.js in the data directory: self.importscripts("data/games.js"); then it creates a list of all the files that the service worker needs to cache.
...con-168.png', '/pwa-examples/js13kpwa/icons/icon-192.png', '/pwa-examples/js13kpwa/icons/icon-256.png', '/pwa-examples/js13kpwa/icons/icon-512.png' ]; var gamesimages = []; for(var i=0; i<games.length; i++) { gamesimages.push('data/img/'+games[i].slug+'.jpg'); } var contenttocache = appshellfiles.concat(gamesimages); with the file list prepared, it's time to install the service worker itself.
... self.addeventlistener('install', function(e) { console.log('[service worker] install'); e.waituntil( caches.open(cachename).then(function(cache) { console.log('[service worker] caching all: app shell and content'); return cache.addall(contenttocache); }) ); }); with that done, we implement the service worker's fetch event handler; its job is to return the contents of the specified file, either from the cache or by loading it over the network (caching it upon doing so): self.addeventlistener('fetch', function(e) { e.respondwith( caches.match(e.request).then(function(r) { console.log('[service worker] fetching resource: '+e.request.url); return r || fetch(e.request).then(functio...
Patterns - SVG: Scalable Vector Graphics
WebSVGTutorialPatterns
in the example above, we've defined a width and height attribute on the pattern element to describe how far the pattern should go before it begins repeating itself again.
... to make this work in the example above, we had to consider the size of our box (200 pixels) and the fact that we wanted the pattern to repeat itself 4 times horizontally and vertically.
... the caveat here is that if the object changes size, the pattern itself will scale to fit it, but the objects inside will not.
...this contrasts with the "userspaceonuse" system, where if the object changes the size, the pattern would stay the same and just repeat itself more times to fill the box.
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
WebXSLTElementnumber
the processor goes to the first node in the ancestor-or-self axis that matches the count attribute and then counts that node plus all its preceding siblings (stopping when it reaches a match to the from attribute, if there is one) that also match the count attribute.if no match is found, the sequence will be an empty list.
...the processor looks at all ancestors of the current node and the current node itself, stopping when it reaches a match for the from attribute, if there is one.
... for each node in this list that matches the count attribute, the processor counts how many preceding matching siblings it has, and adds one for the node itself.
...the ancestor, self, and preceding axes are all considered.
Reddit Example - Archive of obsolete content
this is the complete add-on script: var data = require("sdk/self").data; var button = require("sdk/ui/button/action").actionbutton({ id: "reddit-panel", label: "reddit panel", icon: "./icon-16.png", onclick: function() { reddit_panel.show(); } }); var reddit_panel = require("sdk/panel").panel({ width: 240, height: 320, contenturl: "http://www.reddit.com/.mobile?keep_extension=true", contentscriptfile: [data.url("jquery-2.1.0.min.js"), ...
... if (t.nodename != "a") return; // don't intercept the click if it was on one of the links in the header // or next/previous footer, since those links should load in the panel itself.
... event.stoppropagation(); event.preventdefault(); self.port.emit('click', t.tostring()); }); this script uses jquery to interact with the dom of the page and the self.port.emit function to pass urls back to the add-on script.
Content Processes - Archive of obsolete content
content scripts differ from scripts that are loaded by the page itself in that they are provided with a messaging api that can be used to send messages back to the add-on script.
...one emit function is associated with the event emitter itself.
... the fact that you can't override the properties of the window object via a content script is sometimes inconvenient, so it is possible to circumvent this: by defining the property on window.wrappedobject, the property is defined on the underlying object, rather than the wrapper itself.
Module structure of the SDK - Archive of obsolete content
for high-level modules this is just sdk/<module_name>, and for low-level modules it is sdk/<path_to_module>/<module_name>: // load the high-level "tabs" module var tabs = require("sdk/tabs"); // load the low-level "uuid" module var uuid = require('sdk/util/uuid'); the path to specify for a low-level module is given along with the module name itself in the title of the module's documentation page (for example, system/environment).
...so a if you import a module using require, you can't change the properties of the object returned: self = require("sdk/self"); // attempting to define a new property // will fail, or throw an exception in strict mode self.foo = 1; // attempting to modify an existing property // will fail, or throw an exception in strict mode self.data = "foo"; using modules from outside the add-on sdk you can use commonjs modules outside the add-on sdk, in any environment where you can use components.utils.impor...
...dk add-on: // import the sdk's base64 module var base64 = require("sdk/base64"); base64.encode("hello"); // "agvsbg8=" you can import other commonjs modules, too, as long as you know the path to them: // import my module var mymodule = require("resource://path/to/my/module.js"); in this case, though, you might be better off creating your own loader, so you can specify the paths property yourself.
notifications - Archive of obsolete content
see the self module documentation for more information.
... var notifications = require("sdk/notifications"); var self = require("sdk/self"); var myiconurl = self.data.url("myicon.png"); notifications.notify({ text: "i have an icon!", iconurl: myiconurl }); from firefox 34, you can use "./myicon.png" as an alias for self.data.url("myicon.png").
...it may be a remote url, a data uri, or a url returned by the self module.
passwords - Archive of obsolete content
usage a credential is the set of information a user supplies to authenticate herself with a service.
...however, you can use it to work out which stored credentials belong to your add-on by comparing it with the uri property of the self module.
...ire("sdk/passwords").search({ username: "joe", url: "https://www.google.com", oncomplete: function oncomplete(credentials) { credentials.foreach(function(credential) { console.log(credential.username); console.log(credential.password); }); } }); } to retrieve only credentials associated with your add-on, use the url property, initialized from self.uri: function show_my_addon_passwords() { require("sdk/passwords").search({ url: require("sdk/self").uri, oncomplete: function oncomplete(credentials) { credentials.foreach(function(credential) { console.log(credential.username); console.log(credential.password); }); } }); } parameters options : object required options: name typ...
/loader - Archive of obsolete content
it can be loaded as a javascript code module: let { loader, require, unload } = components.utils.import('resource://gre/modules/commonjs/toolkit/loader.js'); it can be required as a commonjs module from a module loaded in the loader itself: let { loader, require, unload } = require('toolkit/loader'); what is it good for ?
...you may still end up with a relative module id if the entry point module id is itself relative.
... other utilities the loader module exposes several other utility functions that are used internally and can also be handy while bootstrapping the loader itself.
content/symbiont - Archive of obsolete content
this may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires this property is optional and defaults to "end".
... contentscriptoptions object read-only value exposed to content scripts under self.options property.
...this may have one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires contentscriptoptions read-only value exposed to content scripts under self.options property.
platform/xpcom - Archive of obsolete content
the logger itself is implemented by subclassing the unknown class, then we create a service which associates the logger's constructor with its contract id.
...d = '@me.org/request' // create and register the factory var factory = factory({ contract: contractid, component: request }); now xpcom users can access our implementation in the normal way: var request = cc[contractid].createinstance(ci.nsirequest); request.resume(); methods queryinterface(interface) this method is called automatically by xpcom, so usually you don't need to call it yourself.
... returns object : the object itself(this).
cfx - Archive of obsolete content
cfx usage is: cfx [options] command [command-specific options] "options" are global options applicable to the tool itself or to all commands (for example --help).
... updateurl and updatelink if you choose to host the xpi yourself you should enable the host application to find new versions of your add-on.
...at the updateurl you host a file in the update rdf format: among other things, this includes another url called updatelink which points to the updated xpi itself.
jpm - Archive of obsolete content
this allows you to self-host your add-on so that users can install it without error when signed add-ons are required.
... under the hood, jpm sign creates an unlisted add-on inside addons.mozilla.org, which means you must distribute the xpi file yourself for your users to install it.
... supporting updates for self-hosted add-ons this feature is only supported from jpm 1.0.3 onwards.
Add a Context Menu Item - Archive of obsolete content
when it's clicked, the selection is sent to the main add-on code, which just logs it: var contextmenu = require("sdk/context-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscript: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', onmessage: function (selectiontext) { console.log(selectiontext); } }); try it: run the add-on, load a web page, select some text and right-click.
...typically you'd store the image in your add-on's "data" directory, and construct the url using self.data.url(): var self = require("sdk/self"); var contextmenu = require("sdk/context-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscript: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', image: sel...
...pressing the key selects the option when the context menu is open: var contextmenu = require("sdk/context-menu"); var menuitem = contextmenu.item({ label: "log selection", context: contextmenu.selectioncontext(), contentscript: 'self.on("click", function () {' + ' var text = window.getselection().tostring();' + ' self.postmessage(text);' + '});', accesskey: "l", onmessage: function (selectiontext) { console.log(selectiontext); } }); learning more to learn more about the context-menu module, see the context-menu api reference.
Displaying annotations - Archive of obsolete content
the complete content script is here: self.on('message', function onmessage(annotations) { annotations.foreach( function(annotation) { if(annotation.url == document.location.tostring()) { createanchor(annotation); } }); $('.annotated').css('border', 'solid 3px yellow'); $('.annotated').bind('mouseenter', function(event) { self.port.emit('show', $(this).attr('annotation')); event.stoppropagation();...
... event.preventdefault(); }); $('.annotated').bind('mouseleave', function() { self.port.emit('hide'); }); }); function createanchor(annotation) { annotationanchorancestor = $('#' + annotation.ancestorid); annotationanchor = $(annotationanchorancestor).parent().find( ':contains(' + annotation.anchortext + ')').last(); $(annotationanchor).addclass('annotated'); $(annotationanchor).attr('annotation', annotation.annotationtext); } save this in data as matcher.js.
... annotation panel content script the annotation panel has a minimal content script that sets the text: self.on('message', function(message) { $('#annotation').text(message); }); save this in data/annotation as annotation.js.
Display a Popup - Archive of obsolete content
the add-on consists of seven files: package.json: created when you run jpm init index.js: the main add-on code, that creates the button and panel get-text.js: the content script that interacts with the panel content text-entry.html: the panel content itself, specified as html icon-16.png, icon-32.png, and icon-64.png: icons for the button in three different sizes the "index.js" looks like this: var data = require("sdk/self").data; // construct a panel, loading its content from the "text-entry.html" // file in the "data" directory, and loading the "get-text.js" script // into it.
... text = textarea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textarea.value = ''; } }, false); // listen for the "show" event being sent from the // main add-on code.
...self.port.on("show", function onshow() { textarea.focus(); }); finally, the "text-entry.html" file defines the <textarea> element: <html> <head> <style type="text/css" media="all"> textarea { margin: 10px; } body { background-color: gray; } </style> </head> <body> <textarea rows="13" cols="33" id="edit-box"></textarea> </body> </html> finally, save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png try it out: "index.js" is saved in the top level, and the other five files go in your add-on's data directory: my-addon/ ...
Localization - Archive of obsolete content
d"></h1> </body> </html> then you can use this html file to build your interface, for example inside a panel: var button = require("sdk/ui/button/action").actionbutton({ id: "localized-hello", label: "localized hello", icon: "./icon-16.png", onclick: function() { hello.show(); } }); var hello = require("sdk/panel").panel({ height: 75, width: 150, contenturl: require("sdk/self").data.url("my-panel.html") }); given locale files for "en-us" and "fr" which provide translations of hello_id, the panel will now display "hello!" or "bonjour !", according to the current locale: the translation is inserted into the node which has the data-l10n-id attribute set.
...lural localizations (note that the "other" category does not take the cldr keyword): # en-us translations tomato_id[one]= %d tomato tomato_id= %d tomatoes in russian we could have four plural localizations: # ru-ru translations tomato_id[one]= %d помидор tomato_id[few]= %d помидора tomato_id[many]= %d помидоров tomato_id= %d помидоры the localization module itself understands the cldr definitions for each language, enabling it to map between, for example, "2" in the code and "few" in the ru-ru.properties file.
... using identifiers if the localization system can't find an entry for a particular identifier using the current locale, then it just returns the identifier itself.
StringView - Archive of obsolete content
ninptlen - nstartidx : nlength); break typeswitch; case uint32array: case uint16array: case uint8array: /* the input argument is a typedarray: the buffer, and possibly the array itself, will be shared.
...you rarely need to invoke the stringview.valueof() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
... notes when you include the script stringview.js into a page, no variables other than stringview itself will be added to the global scope.
Extension Etiquette - Archive of obsolete content
coding practices namespace conflicts there are many namespaces which extensions often must share with other consumers, be they other add-ons, web code, or the browser itself.
... call .noconflict(true) where applicable many common libraries which create global variables provide a method called noconflict, or similar, which revert any global variables they've declared, and return the object itself.
... for instance, calling jquery.noconflict(true) will remove the window.jquery and window.$ variables, and return the jquery object itself, for future use by the caller.
Appendix: What you should know about open-source software licenses - Archive of obsolete content
picking a license for original works if you are releasing source code you have developed yourself, you need to pick a license.
... when giving feedback on a project if you want to contribute modified source code to an existing project, you need to familiarize yourself with that project’s procedure for submitting modified code.
...despite the fact that different modules have different copyright holders, and overall license management is complicated, by taking this contract as a kind of proxy letter, sun is able to make changes to the openoffice.org license by itself.
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
also, because it works with the javascript in extensions and firefox itself, the debugger can be a good way to learn about design methods.
...mozunit uses the same kind of notation, but you can also make the string the method name, making the test self-documenting.
...fixme: not sure we should talk about this tool installation windows users can take advantage of a self-contained version created by soutaro matsumoto called “gonzui for win32” http://soutaro.com/gonzui-win32/ run it as follows: download gonzui-win32-1.2.2.zip and expand it into a suitable directory.
Adding windows and dialogs - Archive of obsolete content
whenever you need a new dialog, you should ask yourself if it can be implemented using these common dialogs, and use them whenever it is possible.
... they have been thoroughly tested for os integration, accessbility and localization, so you save yourself a lot of work and favor them.
... you may be asking yourself what's the big deal about defining a simple xul window with an ok and maybe a cancel button.
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
i used to pride myself in knowing how to reproduce any interface design down to a pixel-perfect level.
...i counted them myself.
... as many times as i heard the message that design of content should be addressable separately from the content itself, i don't think i realized the full benefits of doing so until we actually went through the process of separating them.
Drag and Drop JavaScript Wrapper - Archive of obsolete content
." ondraggesture="nsdraganddrop.startdrag(event,textobserver)" ondragover="nsdraganddrop.dragover(event,textobserver)" ondragexit="nsdraganddrop.dragexit(event,textobserver)" ondragdrop="nsdraganddrop.drop(event,textobserver)" /> as mentioned earlier, there is nothing special that happens during a dragenter event, so you can just write that yourself.
...the observer is an object that you declare yourself.
...for example, a file may come in two flavors, the file itself and the text name of the file.
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
it usually manifests itself by changing text style when hovered over in mozilla, but not in internet explorer.
... rich text editing while mozilla prides itself with being the most w3c web standards compliant browser, it does support nonstandard functionality, such as innerhtml and rich text editing, if no w3c equivalent exists.
...mozilla's xslt engine will report itself as "transformiix" and internet explorer will return "microsoft".
Mozilla Crypto FAQ - Archive of obsolete content
for more information on the rsa patent see the rsa security press release announcing release of the patent into the public domain, and the rsa patent itself.
... (you may also be interested in a more in-depth analysis of the new regulations, with an emphasis on how they affect open source software.) for more information on the ssl, s/mime, pki, and other crypto source code being developed as part of the mozilla project, see the pki project page and of course the source code itself.
...also, the case itself may be declared moot in light of the new u.s.
Elements - Archive of obsolete content
firefox 2) it is impossible to attach bindings to table sub-elements (rows, cells etc.) you can attach binding only to the table element itself.
... if the children tag contains content itself, that content will become the default content.
... a field no longer changes the value of a property set on the object itself (rather than a proto) before binding attachment.
Creating XPI Installer Modules - Archive of obsolete content
these archives are redundant with the subdirectories: mozilla now installs both the compressed and uncompressed versions of the ui, though you can change this when you build mozilla yourself.
...creating a new package the package described in this section is a very simple one, but it uses the new packaging scheme and the chrome registry to make itself a piece of self-contained and redistributable software.
...the resources are installed in the mozilla/bin/chrome/ directory, and the xpi itself can be redistributed for installation on other machines.
Mac stub installer - Archive of obsolete content
copy the license and readme from the "mozilla installer" folder" to the "macbuild" folder itself.
... now run the built installer from the "macbuild" itself or by running it from the miw.mcp codewarrior project.
.../lxr.mozilla.org/seamonkey/sou...ackages-mac#33> note that if you are using the debug target of the installer binary all shared libraries are expected to have the name format <libname>debug.shlb now set a break point at xpi_init() in the mac installer code and step into xpistub and eventually the xpinstall engine will load including symbols so you can set a break point in the xpinstall engine itself.
Using XPInstall to Install Plugins - Archive of obsolete content
a definition of terms xpinstall is an installer technology, and the name itself stands for "cross platform install" (hence "xp" -- an abbreviation for "cross platform").
...the plugin itself is an imaginary one: myplugin.
...xpinstall can therefore be the "agent of delivery" to streamline the download of the exe software, but ultimately, the logic of installation and uninstallation will be handled by exe, which can then create files and registry entries and also clean up after itself upon removal.
execute - Archive of obsolete content
(note that this path points into the xpi itself.) args a parameter string that is passed to the executable.
...the following line, for example, passes the "-c" command-line parameter to the executable: err = file.execute(myfile, "-c", true); when you want to pass more than one parameter to the executable itself, however, you must format the args string in a particular way so that the parameters can be broken up and passed separately as required.
... the outer quotes that frame the args string itself are stripped off when the string is passed to the executable.
Learn XPI Installer Scripting by Example - Archive of obsolete content
ollowing high-level directory structure: install.js bin\ chrome\ components defaults\ icons\ plugins\ res\ note that this high-level structure parallels the directory structure of the installed browser very closely: as you will see in the installation script, the contents of the archive are installed onto the file system in much the same way that they are stored in the archive itself, though it's possible to rearrange things arbitrarily upon installation--to create new directories, to install files in system folders and other areas.
..."program" represents the directory where software itself is installed (e.g., c:\program files\ on win32 systems), as opposed to supporting directories like "components", "chrome", or "temporary" (see getfolder in the xpinstall api reference for a list of keywords).
...recall that an install process takes the following general form: initinstall(); if (verify_space()) { err = add_dirs_and_files; register_files; if (err==success) { performinstall() }; else { cancelinstall() }; } in this arrangement, the actual execution of the installation is checked against the errors returned from the addition of files to the installation, which may itself have been conditioned on some verification of version and necessary disk space.
Index - Archive of obsolete content
ArchiveMozillaXULIndex
the second section describes the xul/rdf architecture itself and outlines enhancements to the xul language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data.
...the editor does not provide any editing user interface; you would supply that yourself.
...it is intended to be used when an application wants to be able to adjust the scroll position itself.
Introduction to XUL - Archive of obsolete content
widgets are pieces of the application largely self-contained, generally corresponding to a rectangle of window real estate.
...but xul defines several element types unique to itself, which add functionality to the window.
...each widget will define a unique xml syntax for describing itself; see the widget documentation referenced at the index for details.
MenuItems - Archive of obsolete content
hence, -moz-image-region is not applied to the menu itself, but one level lower: <menuitem id="add-bookmark" class="menuitem-iconic" label="add bookmark" image="addbookmark.png"/> #add-bookmark { list-style-image: url('addbookmark.png'); } #add-bookmark .menu-iconic-icon { -moz-image-region: rect(0px, 16px, 16px, 0px) !important; } #add-bookmark:hover .menu-iconic-icon { -moz-image-region: rect(16px, 16px, 32px, 0px) !important; } this behavior i...
...when the autocheck attribute is set to false, the checkbox state is not updated automatically, and you must write code to adjust the state yourself.
...<menuitem label="show toolbar" accesskey="t" type="checkbox" autocheck="false" oncommand="changetoolbarstate();"/> this version of the changetoolbarstate function changes the checked attribute itself.
textbox (Toolkit autocomplete) - Archive of obsolete content
you should not call this method yourself.
...you should not call this method yourself.
...you should not call this method yourself.
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
instead, you make your custom button as a self-contained extension.
... explanation: the chrome directory contains program files that are part of seamonkey itself, together with other files that are provided by extensions.
...(some zip tools require you to use the .zip extension first, then rename the file to change the extension.) ensure that the package does not contain your working directory itself, but only install.js, content and all the files in content.
Keyboard Shortcuts - Archive of obsolete content
the key attribute (note that it has the same name as the element itself) can be used to indicate which key should be pressed, in this case r.
...note that textboxes have the clipboard shortcuts built-in so you don't have to implement them yourself.
...if no element is focused, the key event will instead be targeted at the xul document itself.
XPCOM Interfaces - Archive of obsolete content
so, in most cases, you don't need to write native code for yourself.
... xpcom components are typically implemented natively, which means that they generally do things that javascript cannot do itself.
... however, at this point, we only have a reference to the file component itself.
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
if you are just creating a xulrunner app with some c++ components, you can avoid the challenge of building xulrunner itself by downloading a prebuilt sdk.
...follow the instructions for meeting build requirements and getting the source, then come back here since the build process itself will be slightly different.
...oh, and actually develop the application itself.
Reference - Archive of obsolete content
i checked this by doing alert(math.constructor) //shows that object is its constructor alert(object.constructor) //shows that function is its constructor alert(function.constructor) //shows that function is its constructor note : the function.constructor seems to keep on refering to itself, if you do the following you get same results which suggests that this is indeed the top level object.
...all functions in javascript (that is, every object that has an internal [[call]] or [[construct]] property) are functions as well as objects (including the function object itself).
...in the meantime, newer features from js 1.6 (and hopefully someone will add js 1.7 features too) are being added to the reference with appropriate version information on the page itself.
RDF in Mozilla FAQ - Archive of obsolete content
</window> assuming that we've aquired a datasource somehow (e.g., like this), the following sample code illustrates how to add that datasource to the template, and then force the template to rebuild itself based on the newly added datasource's contents.
... note the rdf:null datasource: this is a special datasource that says, "hey, i don't have a datasource for you yet, but i'm going to add one later, so set yourself up for it!" it causes the database and builder properties to get installed, but leaves the database empty of datasources: you've got to add these in yourself!
...to refresh the template's contents, you must manually call elt.builder.rebuild() yourself.
2D maze game with device orientation - Game development
the phaser framework provides you with a set of tools that will speed up development and help handle generic tasks needed to complete the game, so you can focus on the game idea itself.
...you can create this yourself if you want to follow along: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>cyber orb demo</title> <style> body { margin: 0; background: #333; } </style> <script src="src/phaser-arcade-physics.2.2.2.min.js"></script> <script src="src/boot.js"></script> <script src="src/preloader.js"></script> <script src="src/mainmenu.js"></script> <script src="src/...
... adding the ball and its motion mechanics first, let’s go to the create() function, initialize the ball object itself and assign a few properties to it: this.ball = this.add.sprite(this.ballstartpos.x, this.ballstartpos.y, 'ball'); this.ball.anchor.set(0.5); this.physics.enable(this.ball, phaser.physics.arcade); this.ball.body.setsize(18, 18); this.ball.body.bounce.set(0.3, 0.3); here we’re adding a sprite at the given place on the screen and using the 'ball' image from the loaded graphic assets.
HTTP header - MDN Web Docs Glossary: Definitions of Web-related terms
headers are case-insensitive, begins at the start of a line and are immediately followed by a ':' and a value depending of the header itself.
... request header: headers containing more information about the resource to be fetched or about the client itself.
... response header: headers with additional information about the response, like its location or about the server itself (name, version, …).
Organizing your CSS - Learn web development
you don't need to comment every single thing in your css, as much of it will be self-explanatory.
...you will thank yourself when you come back to this project in a year or so, and can vaguely remember there was a great tutorial about that thing, but where is it?
... other tools that can help css itself doesn't have much in the way of in-built organisation, therefore you need to do the work to create consistency and rules around how you write css.
How much does it cost to do something on the Web? - Learn web development
you have to try it for yourself and decide if it meets your needs.
... do-it-yourself hosting vs.
... “packaged” hosting when you want to publish a website, you could do everything by yourself: set up a database (if needed), content management system, or cms (like wordpress, dotclear, spip, etc.), upload pre-made or your own templates.
Client-side form validation - Learn web development
that means that even though the browser doesn't automatically check the validity of the form before sending its data, you can still do it yourself and style the form accordingly.
... // there are many ways to pick a dom node; here we get the form itself and the email // input box, as well as the span element into which we will place the error message.
... to validate a form, ask yourself a few questions: what kind of validation should i perform?
UI pseudo-classes - Learn web development
note: you'll probably not find yourself using the :optional pseudo-class very often.
... back to our required/optional example from before, this time we'll not alter the appearance of the input itself — we'll use generated content to add an indicating label (see it live here, and see the source code here).
... the most common use of this is to add a different style onto the checkbox/radiobutton when it is checked, in cases where you've removed the system default styling with appearance: none; and want to build the styles back up yourself.
Use JavaScript within a webpage - Learn web development
if you want to learn javascript itself, you can start with our javascript basics article.
... how to trigger javascript from html within a browser, javascript doesn't do anything by itself.
... <script> window.addeventlistener('load', function () { console.log('this function is executed once the page is fully loaded'); }); </script> that's convenient when you just need a small bit of javascript, but if you keep javascript in separate files you'll find it easier to focus on your work write self-sufficient html write structured javascript applications use scripting accessibly accessibility is a major issue in any software development.
From object to iframe — other embedding technologies - Learn web development
only embed when necessary sometimes it makes sense to embed third-party content — like youtube videos and maps — but you can save yourself a lot of headaches if you only embed third-party content when completely necessary.
... if you find yourself needing to embed plugin content, this is the kind of information you'll need, at a minimum: <embed> <object> url of the embedded content src data accurate media type of the embedded content type type height and width (in css pixels) of the box controlled by the plugin height width height width names and values, to ...
... give yourself a break from the extra accessibility headaches that come with flash and other plugins.
Functions — reusable blocks of code - Learn web development
note: feel free to enter these lines into your browser's javascript console to re-familiarize yourself with their functionality, if needed.
... the javascript language has many built-in functions to allow you to do useful things without having to write all that code yourself.
...output() itself is available from anywhere, as it is defined in the global scope.
Drawing graphics - Learn web development
parameters 2 and 3 define the coordinates of the top left corner of the area you want to cut out of the loaded image, relative to the top-left corner of the image itself.
...if you aren't going to change anything, then you might as well just use static images and save yourself all the work.
...if your browser doesn't support these inputs, they will fall back to simple text fields and you'll just have to enter valid color/number values yourself.
A first splash into JavaScript - Learn web development
i].textcontent = ''; } resetbutton.parentnode.removechild(resetbutton); guessfield.disabled = false; guesssubmit.disabled = false; guessfield.value = ''; guessfield.focus(); lastresult.style.backgroundcolor = 'white'; randomnumber = math.floor(math.random() * 100) + 1; } </script> </body> </html> have a go at playing it — familiarize yourself with the game before you move on.
... the first three constants are each made to store a reference to the results paragraphs in our html, and are used to insert values into the paragraphs later on in the code (note how they are inside a <div> element, which is itself used to select all three later on for resetting, when we restart the game): <div class="resultparas"> <p class="guesses"></p> <p class="lastresult"></p> <p class="loworhi"></p> </div> the next two constants store references to the form text input and submit button and are used to control submitting the guess later on.
...try entering the below lines, one by one: guesses.style.backgroundcolor = 'yellow'; guesses.style.fontsize = '200%'; guesses.style.padding = '10px'; guesses.style.boxshadow = '3px 3px 6px black'; every element on a page has a style property, which itself contains an object whose properties contain all the inline css styles applied to that element.
Basic math in JavaScript — numbers and operators - Learn web development
** exponent raises a base number to the exponent power, that is, the base number multiplied by itself, exponent times.
...try entering the examples below into your developer tools javascript console to familiarize yourself with the syntax.
...for a start, note that you can't apply these directly to a number, which might seem strange, but we are assigning a variable a new updated value, not operating on the value itself.
Object prototypes - Learn web development
they are methods/properties available just on the object() constructor itself.
... note: this seems strange — how can you have a method defined on a constructor, which is itself a function?
... you can check out existing prototype properties for yourself — go back to our previous example and try entering the following into the javascript console: person.prototype the output won't show you very much because we haven't defined anything on our custom constructor's prototype!
Server-side web frameworks - Learn web development
get it yourself: some web frameworks include tools/libraries that address every problem their developers can think "by default", while more lightweight frameworks expect web developers to pick and choose solution to problems from separate libraries (django is an example of the former, while flask is an example of a very light-weight framework).
...in addition to "ease of use" of the language itself, high quality documentation/tutorials and an active community helping new users are your most valuable resources.
...it similarly encourages the use of design patterns like dry ("dont repeat yourself" — write code only once if at all possible), mvc (model-view-controller) and a number of others.
Introduction to client-side frameworks - Learn web development
react itself is not technically a framework; it's a library for rendering ui components.
...as we've alluded to before, the advantages of frameworks are achievable in vanilla javascript, but using a framework takes away all of the cognitive load of having to solve these problems yourself.
...this rfc serves as a great example of the kind of research you should do for yourself when planning to use a front-end framework.
Framework main features - Learn web development
the code will be initially rendered like so in the browser: <button>clicked 0 times</button> the usestate() call keeps track of the count value in a robust way across the app, without you needing to write code to do that yourself.
...because frameworks make these decisions for you, you typically don't interact with the dom yourself.
... this abstraction away from the dom is more complex and more memory-intensive than updating the dom yourself, but without it, frameworks could not allow you to program in the declarative way they’re known for.
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
like we already saw, we could just tell svelte to update the variable with a self-assignment, like this: const checkalltodos = (completed) => { todos.foreach(t => t.completed = completed) todos = todos } this will solve the problem.
... internally svelte will flag todos as changed and remove the apparently redundant self-assignment.
...this one comes from javascript itself and has nothing to do with svelte, besides providing some inspiration for svelte's own shorthands.
Strategies for carrying out testing - Learn web development
they expect you to self-host the analytics platform.
... putting together a testing lab one option for carrying out browser tests is to do the testing yourself.
...stalled side by side, so you might want to build up a library of virtual machines to handle different tests as required, e.g.: windows 10 with edge 14 windows 10 with edge 13 windows 8.1 with ie11 windows 8 with ie10 windows 7 with ie9 windows xp with ie8 windows xp with ie7 windows xp with ie6 note: another good thing about virtual machines is that the virtual disk images are fairly self-contained.
Chrome Worker Modules
you only need to do it once for each worker, from within the chrome worker itself: importscripts("resource://gre/modules/workers/require.js"); note: although you only need to do this once for each worker, it doesn't hurt if you do it more than once.
...in particular, globals (string, math, object, self) and the worker global scope itself (this) are shared between workers.
... in other words, the true isolation unit is the worker itself, not the module.
Software accessibility: Where are we today?
the importance of braille itself must be emphasized.
...however, any special features are generally handled in the keyboard itself, so that no special programming is required.
...each end user has a unique set problems, and in the open source world, providing highly customized solutions can be a business in itself.
Mozilla’s UAAG evaluation report
this uaag evaluation report covers nightly builds of the mozilla web browser itself, running on windows 2000, as of february 20, 2002.
... does not provide information about whether link is internal or external, except through url itself.
...(p2) ni the web page itself is currently responsible for letting the user know what accesskey's are available.
Eclipse CDT
rebuilding the index itself is required much more frequently since the source changes more frequently.
...to rebuild for changes in an individual directory (for example, to take account of some changes that you yourself made) select "index > freshen all files" on that directory.
...eclipse should now update itself and ask you to restart.
Using JavaScript code modules
.import("resource://app/my_module.jsm"); alert(foo()); // displays "foo" alert(bar.size + 3); // displays "6" alert(dummy); // displays "dummy is not defined" because 'dummy' was not exported from the module note: when you're testing changes to a code module, be sure to change the application's build id (e.g., the version) before your next test run; otherwise, you may find yourself running the previous version of your module's code.
...interface(components.interfaces.nsiresprotocolhandler); 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); // assuming the code modules are in the alias folder itself notes custom modules and xpcom components note that prior to gecko 2.0 javascript xpcom components are loaded before chrome registration.
...dk add-on: // import the sdk's base64 module var base64 = require("sdk/base64"); base64.encode("hello"); // "agvsbg8=" you can import other commonjs modules, too, as long as you know the path to them: // import my module var mymodule = require("resource://path/to/my/module.js"); in this case, though, you might be better off creating your own loader, so you can specify the paths property yourself.
Localizing with Mercurial
your mercurial configuration is contained within a config file which you must create yourself.
...let's face it, it's just more convenient to commit and push your work to the remote repo yourself, rather than creating patches and asking someone else to push them for you.
... sending changes to mozilla now that you have hg account privileges, you can send your work to mozilla all by yourself.
Mozilla DOM Hacking Guide
since i am myself still learning how it works, don't expect this to be a complete reference quite yet.
...the behavior "act as an array" cannot be reflected in the idl itself.
...the line d.minterfaces = interface_list assigns to minterfaces the address of the first element of the interface_list array, which is itself a pointer.
Mozilla Development Strategies
of course, our documentation is a wiki; you can really help by updating the documentation yourself.
... if it takes you five extra minutes to do something the "right" way rather than twenty minutes debating it with the reviewer, you've just saved yourself and the reviewer valuable time.
...save yourself (and others) time later by doing a solid code review.
NSS API Guidelines
if our library is self-consistent with how we accomplish these tasks, it makes it easier for the developer to learn how to use our functions.
... thread b now finds itself with a pointer to released data.
...be sure to calculate the hash value first, then only lock over the hash table value itself.
PKCS11 FAQ
MozillaProjectsNSSPKCS11FAQ
nss itself uses two tokens internally--one that provides generic cryptographic services without authentication, and one that provides operations based on the keys stored in the user's database and do need authentication.
...nss does not keep a copy of the generated key if it generates the key itself.
...(it goes to sso mode only if your token identifies itself as ckf_login_required, but not ckf_user_initialized).
NSS tools : modutil
nss internal pkcs #11 module slots: 2 slots attached status: loaded slot: nss internal cryptographic services token: nss generic crypto services slot: nss user private key and certificate services token: nss certificate db ----------------------------------------------------------- passing a specific module name with the -list returns details information about the module itself, like supported cipher mechanisms, version numbers, serial numbers, and other information about the module and the token it is loaded on.
...each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform.
...typically, this string is used for a setup program provided by a module vendor, such as a self-extracting setup executable.
NSS Tools certutil
if a ca key pair is not available, you can create a self-signed certificate (for purposes of illustration) with the -x argument.
... this example creates a new binary, self-signed ca certificate named myissuer, in the specified directory.
...it is issued by the self-signed certificate created above, myissuer.
NSS tools : modutil
MozillaProjectsNSStoolsmodutil
s: 2 slots attached status: loaded slot: nss internal cryptographic services token: nss generic crypto services slot: nss user private key and certificate services token: nss certificate db ----------------------------------------------------------- passing a specific module name with the -list returns details information about the module itself, like supported cipher mechanisms, version numbers, serial numbers, and other information about the module and the token it is loaded on.
...each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform.
...typically, this string is used for a setup program provided by a module vendor, such as a self-extracting setup executable.
Rhino Debugger
the debugger is itself a java program which you may run as java org.mozilla.javascript.tools.debugger.main [options] [filename.js] [script-arguments] where the options are the same as the shell.
...if a property is itself a javascript object the property may be expanded to show its sub-properties.
...if a variable is itself a javascript object the variable may be expanded to show its sub-properties.
SpiderMonkey Build Documentation
(if you want to use spidermonkey as a library in your c++ application, or work on improving spidermonkey itself, do a developer/debug build instead, as described below.) cd js/src # this name should end with "_opt.obj" to make the version control system ignore it.
... developer (debug) build for developing and debugging spidermonkey itself, it is best to have both a debug build (for everyday debugging) and an optimized build (for performance testing), in separate build directories.
...these flags ensure the compiler will find the spidermonkey libraries, along with any libraries that spidermonkey itself depends upon (like nspr).
Tracing JIT
the recorder in jstracer inserts lins values into a lir buffer held in a page, itself contained within a logical fragment, and the nanojit compilation pipeline and assembler transform the lins values into nins values.
... if the recorder is asked to record a bytecode that implies a call to a native function elsewhere in spidermonkey -- some helper function written in c -- and that native happens to re-enter the interpreter to interpret yet more bytecode, and furthermore if that bytecode itself contains a hot pc that has not yet been traced, the trace monitor may be asked to begin nested recording.
...if that pc has itself grown hot, the monitor will immediately transition to recording mode starting with the exiting pc.
SpiderMonkey 38
please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use).
...869) js_getlatin1internedstringchars (bug 1037869) js_getlatin1stringcharsandlength (bug 1032726) js_getstringcharat (bug 1034627) js_gettwobyteexternalstringchars (bug 1034627) js_gettwobyteflatstringchars (bug 1037869) js_gettwobyteinternedstringchars (bug 1037869) js_gettwobytestringcharsandlength (bug 1032726) js_newplainobject (bug 1125356) js_removefinalizecallback (bug 996785) js_self_hosted_sym_fn (bug 1082672) js_sym_fn (bug 1082672) js_sym_fnspec (bug 1082672) js_stringhaslatin1chars (bug 1032726) js_stringisflat (bug 1037869) js_stringtoid (bug 959787) propertydefinitionbehavior (bug 825199) symbol_to_jsid (bug 645416) obsolete apis ...
... this change better aligns with ecmascript's [[preventextensions]] hook, which generally returns true or false to indicate whether subsequent attempts to add a new property will fail, yet also itself may throw in some cases.
Web Replay
instead of communicating via ipc with a compositor in the ui process, there is a compositor in the recording process itself which performs the rendering.
... middleman process the middleman is the same as a normal content process, except that it spawns and communicates with the child process, and avoids creating any documents itself.
... this will be part of gecko itself, rather than a separate tool, which means both that developers won't need additional software to use it and that this can't be used to debug other software.
Secure Development Guidelines
ng % encoding java/vbscript escaping depends on the context; in a single-quoted string, escaping ' would suffice sql injection occurs when un-trusted input is mixed with a sql string sql is a language used to interact with databases code injection attack that is similar to xss but targeted at sql rather than html and javascript if input is mixed with sql, it could itself become an sql instruction and be used to: query data from the database (passwords) insert value into the database (a user account) change application logic based on results returned by the database sql injection: example snprintf(str, sizeof(str), "select * from account where name ='%s'", name); sqlite3_exec(db, str, null, null, null); sql injection: prevention ...
... free(ptr); } }; constructor/destructor issues: prevention initialize the data members of an object in the constructor writing secure code: miscellaneous file i/o a lot can go wrong because a lot can be done with file input and output filenames permissions file handles and descriptors file i/o: filename divided in directories, subdirectories, and the file itself ‘/’ is separator; in windows ‘\’ would work too int openfile(char *file) { handle fh; if (strstr(file, “\”)) return -1; fh = createfilea(file, ...); writefile(fh, data, sizeofdata, null, null); } could be a normal file, directory, device, or link directory traversal (../../../../) file i/o: file permissions should be set correctly be sure...
...act base class nsastring common read-only methods length() isempty() equals() common methods for modifying the string assign() append() insert() truncate() checking return values often causes problems return value not handled certain cases not handled or interpreted incorrectly double meaning malloc() can return a pointer or null, but null by itself is a valid address checking return values int main() { int fds[2]; pipe(fds); write(fds[0], "data", 4); } the pipe() return value is not checked if pipe() fails, fds is not initialized write to un-initialized file descriptor checking return values check all return values—no matter how unlikely the api failure for example: close() can fail and leak file d...
Creating a Python XPCOM component
make a file named "py_simple.py" for the actual code (again, in the 'components' directory): from xpcom import components, verbose class pysimple: #pythontestcomponent _com_interfaces_ = components.interfaces.nsipysimple _reg_clsid_ = "{c456ceb5-f142-40a8-becc-764911bc8ca5}" _reg_contractid_ = "@mozilla.org/pysimple;1" def __init__(self): self.yourname = "a default name" # or mname ?
... def __del__(self): if verbose: print "pysimple: __del__ method called - object is destructing" def write(self): print self.yourname def change(self, newname): self.yourname = newname then register your component; the procedure is the same for any component, but will not work if python components weren't enabled.
... # _reg_clsid_ = "{a new clsid generated for this object}" # _reg_contractid_ = "the.object.name" def get_value( self ): # result: string pass def set_value( self, param0 ): # result: void - none # in: param0: string pass as you can see, the output is valid python code, with basic signatures and useful comments for each of the methods.
Finishing the Component
the only trouble occurs when the compiler itself changes its v-table layout, which can happen when the compiler changes its abi.
... the name of the resource itself, given as a path.
... instead of extracting the string spec out of the nsiuri to do a string comparison, which would require you to do the parsing yourself, you can compare the nsiuri objects with each other, as in the following section.
operator=
self_type& operator=( const self_type& astring ); parameters astring [in] a nsacstring to append to this string.
... self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string.
... self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string.
operator+=
self_type& operator+=( const self_type& astring ); parameters astring [in] a nsacstring to append to this string.
... self_type& operator+=( const char_type* adata ); parameters adata [in] a raw character array to append to this string.
... self_type& operator+=( char_type achar ); parameters achar [in] a character to append to this string.
operator=
self_type& operator+=( const self_type& astring ); parameters astring [in] a nsastring to append to this string.
... self_type& operator=( const char_type* adata ); parameters adata [in] a raw character array to append to this string.
... self_type& operator=( char_type achar ); parameters achar [in] a character to append to this string.
operator+=
self_type& operator+=( const self_type& astring ); parameters astring [in] a nsastring to append to this string.
... self_type& operator+=( const char_type* adata ); parameters adata [in] a raw character array to append to this string.
... self_type& operator+=( char_type achar ); parameters achar [in] a character to append to this string.
nsIContentSecurityPolicy
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 boolean permitsancestry(in nsidocshell docshell); void refinepolicy(in astring policystring, in nsiuri selfuri); void scanrequestdata(in nsihttpchannel achannel); void sendreports(in astring blockeduri, in astring violateddirective); short shouldload(in unsigned long acontenttype, in nsiuri acontentlocation, in nsiuri arequestorigin, in nsisupports acontext, in acstring amimetypeguess, in nsisupports aextra); short shouldprocess(in unsigned long acontenttype, in nsiuri acontentlocation, in nsiu...
...void refinepolicy( in astring policystring, in nsiuri selfuri ); parameters policystring selfuri scanrequestdata() called after the content security policy object is created to fill in the appropriate request and request header information needed in case a report needs to be sent.
...the uri may be null, in which case "self" is sent.
Component; nsIPrefBranch
if you find yourself wondering what is the maximum amount of data you can store in a string preference, consider storing data separately, for example in a flat file or an sqlite database.
...if you find yourself wondering what is the maximum amount of data you can store in a string preference, consider storing data separately, for example in a flat file or an sqlite database.
...these cycles generally occur because an object both registers itself as an observer (causing the branch to hold a reference to the observer) and holds a reference to the branch object for the purpose of getting/setting preference values.
nsISocketTransport
prnetaddr getselfaddr(); native code only!
...native code only!getselfaddr returns the ip address of the initiating end.
...prnetaddr getselfaddr(); parameters none.
nsIThread
warning: this method may not be called from the thread itself.
... exceptions thrown ns_error_unexpected shutdown() was erroneously called from within the thread itself, the thread was not created with the thread manager's nsithreadmanager.newthread() method, or the thread is already in the process of being shut down.
... note: this method must be called from within the thread itself, and not from another thread.
Setting HTTP request headers
please also note that the code itself usually is wrapped inside a exports.main = function() { ...
...addobserver(this, "http-on-modify-request", false); return; } }, queryinterface: function (iid) { if (iid.equals(components.interfaces.nsiobserver) || iid.equals(components.interfaces.nsisupports)) return this; components.returncode = components.results.ns_error_no_interface; return null; }, }; var mymodule = { registerself: function (compmgr, filespec, location, type) { var compmgr = compmgr.queryinterface(components.interfaces.nsicomponentregistrar); compmgr.registerfactorylocation(this.mycid, this.myname, this.myprogid, filespec, location,...
... type); log("----------------------------> registerself"); var catmgr = components.classes["@mozilla.org/categorymanager;1"].getservice(components.interfaces.nsicategorymanager); catmgr.addcategoryentry("app-startup", this.myname, this.myprogid, true, true); }, getclassobject: function (compmgr, cid, iid) { log("----------------------------> getclassobject"); return this.myfactory; }, mycid: components.id("{9cf5f3df-2505-42dd-9094-c1631bd1be1c}"), myprogid: "@dougt/myhttplistener;1", myname: "simple http listener", myfactory: { queryinterface: function (aiid) { if (!aiid.equals(components.interfaces.nsisupports) && !aiid.equals(compone...
Getting Started Guide
when that count goes to zero, the interface may delete itself.
...when the last pointer to an interface is released, the interface (and consequently, typically the underlying object) will delete itself.
...nscomptr never calls queryinterface implicitly, i.e., you must call it yourself, or explictly ask nscomptr to call it with do_queryinterface.
wrappedJSObject
suppose we register the component below with the @myself.com/my-component;1 contract.
...in this example we use getservice, but as long as we get the reference from xpcom, our component gets wrapped by xpconnect in the same way: var comp = components.classes["@myself.com/my-component;1"].getservice(); if we try to call the hello() method we defined in our component implementation, we get: > comp.hello(); typeerror on line 1: comp.hello is not a function this happens because, as we mentioned earlier, comp is not the helloworld js object itself, but an xpconnect wrapper around it: > dump(comp); [xpconnect wrapped nsisupports] the idea of these wrappers ...
...for example: function helloworld() { this.wrappedjsobject = this; }; now we can get the component directly: var comp = components.classes["@myself.com/my-component;1"] .getservice().wrappedjsobject; this is a real js object: > comp [object object] so we can access any property on it: > comp.hello(); hello world!
Mail event system
when a notification is fired on a folder, all of the folder's folder listeners and the mail session itself is notified.
...the folder calls notifyintpropertychanged on itself with the atom that represents "totalmessages": this->notifyintpropertychanged(ktotalmessagesatom, 4, 5);.
... onitemboolpropertychanged: function(item, property, oldvalue, newvalue) {}, onitemunicharpropertychanged: function(item, property, oldvalue, newvalue) {}, onitempropertyflagchanged: function(item, property, oldflag, newflag) {}, onitemevent: function(item, event) = {}, onfolderloaded: function(afolder) = {} ondeleteormovemessagescompleted: function( afolder) = {}, } // now register myself as a listener on every mail folder var mailsession = components.classes["component://netscape/messenger/services/session"].
Add to iPhoto
initializing core foundation the init() method, which sets everything up, looks like this: init: function() { this.lib = ctypes.open("/system/library/frameworks/corefoundation.framework/corefoundation"); // declaring all the apis goes here } shutting down core foundation while the core foundation system framework itself doesn't need to be shut down, we do need to close the library we opened using the js-ctypes api; that's where the shutdown() method comes in: shutdown: function() { this.lib.close(); } select api declarations let's take a look at a few of the key apis we declare for core foundation, to see how it's done.
... there are also a few constants used for the flags field in the lsapplicationparameters structure: this.klsrolesnone = 1; this.klsrolesviewer = 2; this.klsroleseditor = 4; this.klsrolesall = 0xffffffff; implementing the extension now that the mac os x apis we'll be using have been declared, we can write the core of the extension itself.
... the first step here is to create a new fsref object to contain the reference to the iphoto application itself, since lsopenurlswithrole() uses an fsref to specify the application to launch.
Working with data
if you need to convert a string that doesn't meet these requirements, you'll need to do it yourself.
...you'll have to convert those yourself, as covered above.
...for example: var num = ctypes.int64.join(-0x12345678, 0x90abcdef); performing arithmetic with 64-bit values the int64 and uint64 objects don't provide any methods for performing arithmetic, which means you'll have to do it yourself by pulling out the high and low 32-bit portions and doing math on them, then joining them back together if necessary to get the complete result.
Debugger.Object - Firefox Developer Tools
call(this,argument, ...) if the referent is callable, call it with the giventhis value andargument values, and return a completion value describing how the call completed.this should be a debuggee value, or { asconstructor: true } to invoke the referent as a constructor, in which case spidermonkey provides an appropriate this value itself.
... apply(this,arguments) if the referent is callable, call it with the giventhis value and the argument values inarguments, and return a completion value describing how the call completed.this should be a debuggee value, or { asconstructor: true } to invokefunction as a constructor, in which case spidermonkey provides an appropriate this value itself.arguments must either be an array (in the debugger) of debuggee values, or null or undefined, which are treated as an empty array.
... for all watchpoint handler methods: handler calls receive the handler object itself as the this value.
Dominators - Firefox Developer Tools
these concepts matter in memory analysis, because often an object may itself be small, but may hold references to other much larger objects, and by doing this will prevent the garbage collector from freeing that extra memory.
... shallow and retained size this gives rise to a distinction between two ways to look at the size of an object: shallow size: the size of the object itself retained size: the size of the object itself, plus the size of other objects that are kept alive by this object often, objects will have a small shallow size but a much larger retained size, through the references they contain to other objects.
...node b is said to dominate node a if every path from the root to a passes through b: if any of node a's dominators are freed, then node a itself becomes eligible for garbage collection.
Intensive JavaScript - Firefox Developer Tools
using requestanimationframe in the first attempt at fixing this, we'll split up the function into a number of much smaller self-contained functions, and schedule each one using requestanimationframe().
... using requestanimationframe worked to solve the responsiveness problem here, but there are a couple of potential problems with it: it can be difficult to split up a long-running function into separate self-contained functions.
... then we need a new file "calculate.js", that looks like this: self.addeventlistener("message", go); function go(message) { var iterations = message.data.iterations; var multiplier = message.data.multiplier; primes = calculateprimes(iterations, multiplier); self.postmessage({ "command":"done", "primes": primes }); } function calculateprimes(iterations, multiplier) { var primes = []; for (var i = 0; i < iterations; i++) { var candidate...
Responsive Design Mode - Firefox Developer Tools
for example: developer toolbox with rdm you can show or hide the developer tools toolbox independently of toggling responsive design mode itself: while responsive design mode is enabled, you can continue browsing as you normally would in the resized content area.
...select a device, and responsive design mode sets the following properties to match the selected device: screen size device pixel ratio (the ratio of device physical pixels to device-independent pixels) touch event simulation additionally, firefox sets the user-agent http request header to identify itself as the default browser on the selected device.
... for example, if you've selected an iphone, then firefox identifies itself as safari.
Web Console remoting - Firefox Developer Tools
this option allows you to bind _self to the debugger.object of the given object actor, during string evaluation.
... the variable view needs to update objects and it does so by binding _self to the debugger.object of the objectactor that is being viewed.
... as such, variable view sends strings like these for evaluation: _self["prop"] = value; the frameactor property is an optional frameactor id.
DirectoryReaderSync - Web APIs
self.requestfilesystemsync = self.webkitrequestfilesystemsync || self.requestfilesystemsync; // global for holding the list of entry file system urls.
...function onerror(e) { postmessage('error: ' + e.tostring()); } self.onmessage = function(e) { var data = e.data; // ignore everything else except our 'list' command.
... if (!data.cmd || data.cmd != 'list') { return; } try { var fs = requestfilesystemsync(temporary, 1024*1024 /*1mb*/); getallentries(fs.root.createreader()); self.postmessage({entries: paths}); } catch (e) { onerror(e); } }; method overview entrysync readentries () raises (fileexception); method readentries() returns a lost of entries from a specific directory.
Element.getElementsByTagName() - Web APIs
all descendants of the specified element are searched, but not the element itself.
... the returned list is live, which means it updates itself with the dom tree automatically.
...only the element's descendants are included, not the element itself.
FetchEvent - Web APIs
the browser creates these objects itself and provides them to fetch event callbacks.
... fetchevent.respondwith() prevent the browser's default fetch handling, and provide (a promise for) a response yourself.
... self.addeventlistener('fetch', event => { // let the browser do its default thing // for non-get requests.
FileSystemEntrySync - Web APIs
you cannot do the following: move a directory inside itself or to any child at any depth move an entry into its parent if a name different from its current one isn't provided move a file to a path occupied by a directory or move a directory to a path occupied by a file move any element to a path occupied by a directory that is not empty.
...you cannot copy an entry inside itself if it is a directory, nor can you copy it into its parent without providing a new name.
...if this entry is the root of its file system, then the parent is itself.
Notification - Web APIs
properties static properties these properties are available only on the notification object itself.
... notification.badge read only the url of the image used to represent the notification when there is not enough space to display the notification itself.
... methods static methods these methods are available only on the notification object itself.
Payment processing concepts - Web APIs
these may be either one of the standardized payment handler identifiers, or a url used by the payment processing service to both identify itself and to handle payments.
...note this function must go through the merchant server, because a client typically does not access the validation url itself.
... thus, it's important to note that the user agent never sends a merchantvalidation event, unless the user agent itself implements a payment handler.
WebGLRenderingContext.vertexAttribPointer() - Web APIs
however, if you are designing the format yourself, or your geometry is in text files (like wavefront .obj files) and must be converted into an arraybuffer at runtime, you have free choice on how to structure the memory.
...you have two options: either you specify the index yourself.
... if you are using webgl 2, you can specify the index yourself in the vertex shader code and override the default used by the graphics card, e.g.
Inputs and input sources - Web APIs
the fundamental capabilities of an input source are: targeting monitoring directional controls (either a motion-sensing pointer or a joystick or trackpad, for example) to aim in a direction, possibly at a target, though targeting is left to you to implement yourself.
... this may or may not involve actually pointing at a particular object within the 3d world; you have to determine this yourself using hit testing—that is, checking to see if the target ray intersects with any objects in your scene.
...while webxr offers no support for directly interfacing these input devices with the xr scene, you can collect the input data yourself and apply it yourself.
Starting up and shutting down a WebXR session - Web APIs
this includes the xrsession itself, all of the data used to render the scene in webgl, the world reference space, and the id returned by requestanimationframe().
... preparing to render the scene at this point, the xrsession itself has been fully configured, so we can begin rendering.
...the shutdown of an xrsession can happen either due to the session itself deciding it's time to shut down (such as if the user turns off their xr device), because the user has clicked a button to end the session, or some other situation as appropriate for your application.
window.postMessage() - Web APIs
this means you can pass a broad variety of data objects safely to the destination window without having to serialize them yourself.
... if (event.origin !== "http://example.com") return; // event.source is popup // event.data is "hi there yourself!
... event.source.postmessage("hi there yourself!
WindowOrWorkerGlobalScope.setInterval() - Web APIs
this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,two" myarray.mymethod(1); // prints "one" settimeout(myarray.mymethod, 1000); // prints "[object window]" after 1 second settimeout(myarray.mymethod, 1500, "1"); // prints "undefined" after 1,5 seconds // passing the 'this' object with .call won't work // because this will change the value of this inside settimeout itself // while we want to change the value of this inside myarray.mymethod // in fact, it will be an error because settimeout code expects this to be the window object: settimeout.call(myarray, myarray.mymethod, 2000); // error: "ns_error_xpc_bad_op_on_wn_proto: illegal operation on wrappednative prototype object" settimeout.call(myarray, myarray.mymethod, 2500, 2); // same error as you can see there...
...however, the daemon constructor itself is nothing but a clone of minidaemon with an added support for init and onstart functions declarable during the instantiation of the daemon.
...as such, you may find yourself with queued up xhr requests that won't necessarily return in order.
Using XMLHttpRequest - Web APIs
the download events are fired on the xmlhttprequest object itself, as shown in the above sample.
...> post your photos: <input type="file" multiple name="photos[]"> </p> <p> <input id="vehicle_bike" type="checkbox" name="vehicle[]" value="bike" /> <label for="vehicle_bike">i have a bike</label><br /> <input id="vehicle_car" type="checkbox" name="vehicle[]" value="car" /> <label for="vehicle_car">i have a car</label> </p> <p> describe yourself:<br /> <textarea name="description" cols="50" rows="8"></textarea> </p> <p> <input type="submit" value="submit" /> </p> </fieldset> </form> </body> </html> to test this, create a page named register.php (which is the action attribute of these sample forms), and put the following minimalistic content: <?php /* register.php */ header("content-type: text/plain"); /* n...
...> post your photos: <input type="file" multiple name="photos[]"> </p> <p> <input id="vehicle_bike" type="checkbox" name="vehicle[]" value="bike" /> <label for="vehicle_bike">i have a bike</label><br /> <input id="vehicle_car" type="checkbox" name="vehicle[]" value="car" /> <label for="vehicle_car">i have a car</label> </p> <p> describe yourself:<br /> <textarea name="description" cols="50" rows="8"></textarea> </p> <p> <input type="submit" value="submit" /> </p> </fieldset> </form> </body> </html> note: as we said, formdata objects are not stringifiable objects.
Accessibility: What users can do to browse more safely - Accessibility
the user can do much to protect himself by learning his operating system, its personalization and accessibility settings.
...this will not work on animated gifs; the source of the animation is self-contained within a gif and is not affected by these settings.
...this will not work on animated gifs; the source of the animation is self-contained within a gif and is not affected by these settings..
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
ortant] state_pressed state_checked [important] state_mixed state_readonly [important] state_hottracked state_default [important] state_expanded [important] state_collapsed [important] state_busy [important] state_floating state_marqueed state_animated state_invisible state_offscreen [important] state_sizeable state_moveable state_selfvoicing state_focusable [important] state_selectable [important] state_linked [important] state_traversed [important] state_multiselectable [important] state_extselectable state_alert_low state_alert_medium state_alert_high state_protected [important] state_haspopup msaa roles cheat sheet for information on what each role does, see the msdn role...
...problems can easily happen merely by having two listboxes visible at the same time, because selected listbox items use the system highlight color, even when the listbox itself is not focused.
...the tree view object itself handles all of the requests for get_accname for child objects.
CSS Animations tips and tricks - CSS: Cascading Style Sheets
<div class="box"> </div> <div class="runbutton">click me to run the animation</div> css content now we'll define the animation itself using css.
... some css that's not important (the style of the "run" button itself) isn't shown here, for brevity.
...the main tricks are: make your animation as self-contained as possible.
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
justify-self the justify-self property is used to align an item inside its containing block on the inline axis.
... align-self the align-self property does not apply to block-level boxes (including floats), because there is more than one item in the block axis.
... reference css properties justify-content align-content justify-self align-self glossary entries alignment subject alignment container fallback alignment ...
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
the ie/edge (≤15) version of the specification is prefixed with an -ms prefix and the properties implemented in ie/edge (≤15) are as follows: grid-template-columns as -ms-grid-columns grid-template-rows as -ms-grid-rows grid-row-start as -ms-grid-row grid-column-start as -ms-grid-column align-self as -ms-grid-row-align justify-self as -ms-grid-column-align the ie version has additional properties not required in the new specification of -ms-grid-column-span and -ms-grid-row-span.
... the float no longer applies, and i can use the css box alignment property align-self to align my content to the end of the container: * {box-sizing: border-box;} img { max-width: 100%; display: block; } .media { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; max-width: 400px; display: grid; grid-template-columns: 1fr 2fr; grid-template-areas: "img content"; margin-bottom: 1em; } .media::after { content: ""; ...
... display: block; clear: both; } .media .image { float: left; width: 150px; margin-right: 20px; } .media .text { padding: 10px; align-self: end; } <div class="media"> <div class="image"><img src="https://udn.realityripple.com/samples/89/f993f273dd.png" alt="placeholder"></div> <div class="text">this is a media object example.
CSS reference - CSS: Cascading Style Sheets
WebCSSReference
--webkit-line-clampa:activeadditive-symbols (@counter-style)::after (:after)align-contentalign-itemsalign-selfall<an-plus-b><angle><angle-percentage>animationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-function@annotationannotation()attr()b::backdropbackdrop-filterbackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackgro...
...te-rowshhzhanging-punctuationheightheight (@viewport)@historical-forms:hoverhsl()hsla()hue-rotate()hyphensi<ident><image>image()image-orientationimage-renderingimage-set()@importin:in-range:indeterminateinheritinitialinline-sizeinsetinset()inset-blockinset-block-endinset-block-startinset-inlineinset-inline-endinset-inline-start<integer>:invalidinvert()isolationjjustify-contentjustify-itemsjustify-selfkkhz@keyframesl:lang:last-child:last-of-typeleader():leftleft@left-bottom<length><length-percentage>letter-spacingline-breakline-heightlinear-gradient():linklist-stylelist-style-imagelist-style-positionlist-style-typelocal()mmarginmargin-blockmargin-block-endmargin-block-startmargin-bottommargin-inlinemargin-inline-endmargin-inline-startmargin-leftmargin-rightmargin-top::markermarks (@page)maskmas...
...ehavior-inlineoverscroll-behavior-xoverscroll-behavior-yppad (@counter-style)paddingpadding-blockpadding-block-endpadding-block-startpadding-bottompadding-inlinepadding-inline-endpadding-inline-startpadding-leftpadding-rightpadding-top@pagepage-break-afterpage-break-beforepage-break-insidepaint()paint-orderpath()pc<percentage>perspectiveperspective()perspective-originplace-contentplace-itemsplace-self::placeholderpointer-eventspolygon()<position>positionprefix (@counter-style)ptpxqqquotesrradradial-gradient()range (@counter-style)<ratio>:read-only:read-writerect()remrepeat()repeating-linear-gradient()repeating-radial-gradient():requiredresize<resolution>revertrgb()rgba():rightright@right-bottom:rootrotaterotate()rotate3d()rotatex()rotatey()rotatez()row-gapsssaturate()scalescale()scale3d()scale...
WebKit CSS extensions - CSS: Cascading Style Sheets
a -webkit-align-content -webkit-align-items -webkit-align-self -webkit-animation -webkit-animation-delay -webkit-animation-direction -webkit-animation-duration -webkit-animation-fill-mode -webkit-animation-iteration-count -webkit-animation-name -webkit-animation-play-state -webkit-animation-timing-function b -webkit-backface-visibility -webkit-background-clip -webkit-background-origin -webkit-background-size -webkit-border-bottom-left-radiu...
...ebkit-grid-column -webkit-grid-column-end -webkit-grid-column-gap -webkit-grid-column-start -webkit-grid-gap -webkit-grid-row -webkit-grid-row-end -webkit-grid-row-gap -webkit-grid-row-start -webkit-grid-template -webkit-grid-template-areas -webkit-grid-template-columns -webkit-grid-template-rows h-l -webkit-hyphens -webkit-justify-content -webkit-justify-items -webkit-justify-self -webkit-line-break m -webkit-mask -webkit-mask-clip -webkit-mask-composite -webkit-mask-image -webkit-mask-origin -webkit-mask-position -webkit-mask-repeat -webkit-mask-size o-r -webkit-opacity -webkit-order -webkit-perspective -webkit-perspective-origin -webkit-ruby-position s -webkit-scroll-snap-type -webkit-shape-image-threshold -webkit-shape-margin -webkit-shape-...
... a -webkit-align-content -webkit-align-items -webkit-align-self -webkit-animation -webkit-animation-delay -webkit-animation-direction -webkit-animation-duration -webkit-animation-fill-mode -webkit-animation-iteration-count -webkit-animation-name -webkit-animation-play-state -webkit-animation-timing-function -webkit-appearance* b -webkit-backface-visibility -webkit-background-clip -webkit-background-origin -webkit-background-size -webkit-bor...
<a>: The Anchor element - HTML: Hypertext Markup Language
WebHTMLElementa
the following keywords have special meanings for where to load the url: _self: the current browsing context.
...if no parent, behaves as _self.
...if no ancestors, behaves as _self.
<area> - HTML: Hypertext Markup Language
WebHTMLElementarea
the following keywords have special meanings: _self (default): show the resource in the current browsing context.
...if there is no parent, acts the same as _self.
...if there is no parent, acts the same as _self.
<base>: The Document Base URL element - HTML: Hypertext Markup Language
WebHTMLElementbase
the following keywords have special meanings: _self (default): show the result in the current browsing context.
...if there is no parent, acts the same as _self.
...if there is no parent, acts the same as _self.
<button>: The Button element - HTML: Hypertext Markup Language
WebHTMLElementbutton
the following keywords have special meanings: _self: load the response into the same browsing context as the current one.
...if there is no parent, this option behaves the same way as _self.
...if there is no parent, this option behaves the same way as _self.
<form> - HTML: Hypertext Markup Language
WebHTMLElementform
the following keywords have special meanings: _self (default): load into the same browsing context as the current one.
...if no parent, behaves the same as _self.
...if no parent, behaves the same as _self.
<input type="email"> - HTML: Hypertext Markup Language
WebHTMLElementinputemail
<input type="email" placeholder="sophie@example.com"> controlling the input size you can control not only the physical length of the input box, but also the minimum and maximum lengths allowed for the input text itself.
...in this example the email edit box is 15 characters wide: <input type="email" size="15"> element value length the size is separate from the length limitation on the entered e-mail address itself so that you can have fields fit in a small space while still allowing longer e-mail address strings to be entered.
...the input box itself is physically 64 characters wide, and displays the text user@example.gov as a placeholder anytime the field is empty.
<input type="submit"> - HTML: Hypertext Markup Language
WebHTMLElementinputsubmit
in addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self loads the response into the same browsing context as the one that contains the form.
...if there is no parent context, this behaves the same as _self.
...if the current context is the topmost context, this behaves the same as _self.
Using the application cache - HTML: Hypertext Markup Language
note that if you change any cached resources on the server, you must also change the manifest file itself, so that the browser knows it needs to fetch all the resources again.
... important: do not specify the manifest itself in the cache manifest file, otherwise it will be nearly impossible to inform the browser a new manifest is available.
...you must update the cache manifest file itself before the browser retrieves and uses the updated files.
CSP: script-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
...at the same time, any whitelist or source expressions such as 'self' or 'unsafe-inline' will be ignored.
Feature-Policy: document-domain - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
Feature-Policy: oversized-images - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
Feature-Policy: picture-in-picture - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
Feature-Policy: sync-xhr - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
Feature-Policy: unsized-media - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
Feature-Policy - HTTP
'self': the feature will be allowed in this document, and in all nested browsing contexts (iframes) in the same origin.
... the values * (enable for all origins) or 'none' (disable for all origins) may only be used alone, while 'self' and 'src' may be used with one or more origins.
... 'self': the feature is allowed by default in top-level browsing contexts and in nested browsing contexts (iframes) in the same origin.
Proxy Auto-Configuration (PAC) file - HTTP
notes: the javascript function should always be saved to a file by itself but not be embedded in a html file or any other file.
...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 the time javascript code was unable to define it by itself: proxyconfig.bindings note: pactester (part of the pacparser package) was used to test the following syntax examples.
...open-sourcing netscape eventually lead to firefox itself.
HTTP response status codes - HTTP
WebHTTPStatus
that is, the client must authenticate itself to get the requested response.
...in an api, this can also mean that the endpoint is valid but the resource itself does not exist.
... 506 variant also negotiates the server has an internal configuration error: the chosen variant resource is configured to engage in transparent content negotiation itself, and is therefore not a proper end point in the negotiation process.
Equality comparisons and sameness - JavaScript
for all values except numbers, it uses the obvious semantics: a value is only equal to itself.
...strict equality treats nan as unequal to every other value -- including itself.
... here's a non-exhaustive list of built-in methods and operators that might cause a distinction between -0 and +0 to manifest itself in your code: - (unary negation) let stoppingforce = obj.mass * -obj.velocity; if obj.velocity is 0 (or computes to 0), a -0 is introduced at that place and propogates out into stoppingforce.
Private class fields - JavaScript
syntax class classwithprivatefield { #privatefield } class classwithprivatemethod { #privatemethod() { return 'hello world' } } class classwithprivatestaticfield { static #private_static_field } examples private static fields private fields are accessible on the class constructor from inside the class declaration itself.
...the # is a part of the name itself.
... class classwithprivatefield { #privatefield constructor() { this.#privatefield = 42 this.#randomfield = 666 // syntax error } } const instance = new classwithprivatefield() instance.#privatefield === 42 // syntax error private methods private static methods like their public equivalent, private static methods are called on the class itself, not instances of the class.
Public class fields - JavaScript
by declaring a public field, you can ensure the field is always present, and the class definition is more self-documenting.
...instead, they're called on the class itself.
... class classwithfancymethods { *generatormethod() { } async asyncmethod() { } async *asyncgeneratormethod() { } } inside instance methods, this refers to the instance itself.
Functions - JavaScript
like the program itself, a function is composed of a sequence of statements called the function body.
...for example, the following would result in an error: var foo = new function("alert(anonymous);"); foo(); unlike functions defined by function expressions or by the function constructor, a function defined by a function declaration can be used before the function declaration itself.
...a function declaration ceases to be one when it either: becomes part of an expression is no longer a "source element" of a function or the script itself.
Object.prototype.valueOf() - JavaScript
you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
...if an object has no primitive value, valueof returns the object itself.
... an object's valueof method is usually invoked by javascript, but you can invoke it yourself as follows: mynumbertype.valueof() note: objects in string contexts convert via the tostring() method, which is different from string objects converting to string primitives using valueof.
Autoplay guide for media and Web Audio APIs - Web media technologies
by default, the autoplay feature policy is set to 'self' (including the single quote characters), indicating that autoplay is permitted as they're hosted on the same domain as the document.
... example: allowing autoplay only from the document's domain to use the feature-policy header to only allow media to autoplay from the document's origin: feature-policy: autoplay 'self' to do the same for an <iframe>: <iframe src="mediaplayer.html" allow="autoplay 'src'"> </iframe> example: allowing autoplay and fullscreen mode adding fullscreen api permission to the previous example results in a feature-policy header like the following if fullscreen access is allowed regardless of the domain; a domain restriction can be added as well as needed.
... feature-policy: autoplay 'self'; fullscreen the same permissions, grated using the <iframe> element's allow property, look like this: <iframe src="mediaplayer.html" allow="autoplay 'src'; fullscreen"> </iframe> example: allowing autoplay from specific sources the feature-policy header to allow media to be played from both the document's (or <iframe>'s) own domain and https://example.media looks like this: feature-policy: autoplay 'self' https://example.media an <iframe> can be written to specify that this autoplay policy should be applied to itself and any child frames would be written thusly: <iframe width="300" height="200" src="mediaplayer.html" allow="autoplay 'src' https://example.media"> </iframe> example: disabling autoplay setting the autoplay featu...
Digital audio concepts - Web media technologies
some audio does travel through water, or even through the rock comprising the planet itself (if you've ever heard the rumble or boom of an earthquake, you've experienced this phenomenon), but nearly all of the sounds you hear every day travel to your ears through the air.
... audio file size and network bandwidth once you know the size of a single audio frame and how many frames per second make up your audio data, you can easily calculate how much space the raw sound data itself will occupy (and therefore how much bandwidth it would consume on a network).
... you will need to refer to the documentation for the encoding software you use to determine which options are available, which will depend on the codec and the encoding software itself.
OpenSearch description format
the opensearch description format lets a website describe a search engine for itself, so that a browser or other client application can use that search engine.
...to support this, include an extra url element with type="application/opensearchdescription+xml" and rel="self".
... for example: <url type="application/opensearchdescription+xml" rel="self" template="https://example.com/mysearchdescription.xml" /> note: at this time, addons.mozilla.org (amo) doesn't support automatic updating of opensearch plugins.
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
to receive push messages, we can listen to the push event in the service worker file: self.addeventlistener('push', function(e) { /* ...
...{ ttl: req.body.ttl }; settimeout(function() { webpush.sendnotification(subscription, payload, options) .then(function() { res.sendstatus(201); }) .catch(function(error) { console.log(error); res.sendstatus(500); }); }, req.body.delay * 1000); }); }; service-worker.js the last file we will look at is the service worker: self.addeventlistener('push', function(event) { const payload = event.data ?
... event.data.text() : 'no payload'; event.waituntil( self.registration.shownotification('serviceworker cookbook', { body: payload, }) ); }); all it does is add a listener for the push event, create the payload variable consisting of the text taken from the data (or create a string to use if data is empty), and then wait until the notification is shown to the user.
in - SVG: Scalable Vector Graphics
WebSVGAttributein
in many cases, the fillpaint is opaque everywhere, but that might not be the case if a shape is painted with a gradient or pattern which itself includes transparent or semi-transparent parts.
...in many cases, the strokepaint is opaque everywhere, but that might not be the case if a shape is painted with a gradient or pattern which itself includes transparent or semi-transparent parts.
... workaround for backgroundimage instead of using in="backgroundimage", we need to import one of the images to blend inside the filter itself, using an <feimage> element.
Axes - XPath
WebXPathAxes
ancestor-or-self indicates the context node and all of its ancestors, including the root node.
... descendant-or-self indicates the context node and all of its descendants.
... self indicates the context node itself.
Index - XPath
WebXPathIndex
4 ancestor-or-self axe, xpath the ancestor-or-self axis indicates the context node and all of its ancestors, including the root node.
... 8 descendant-or-self axe, xpath the descendant-or-self axis indicates the context node and all of its descendants.
... 15 self axe, xpath the self axis indicates the context node itself.
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
the structure of an xml document is designed to reflect and clarify important relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented.
...built from the ground up utilizing a wide variety of xml technologies, firefox incorporates within itself all of the mechanisms needed to process both original xml documents and the specialized stylesheets used to style and lay them out for html display, reducing server load with client-side processing.
...xsl:param (supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() (supported)...
2015 MDN Fellowship Program - Archive of obsolete content
self-starter and autonomous worker mentor information brittany storoz, mozilla apps engineering.
...if you don’t have specific questions and just want to introduce yourself, please use the application form.
Porting the Library Detector - Archive of obsolete content
script will just run when it's loaded, collect the array of library names, and post it back to main.js: function testlibraries() { var win = unsafewindow; var librarylist = []; for(var i in ld_tests) { var passed = ld_tests[i].test(win); if (passed) { var libraryinfo = { name: i, version: passed.version }; librarylist.push(libraryinfo); } } self.postmessage(librarylist); } testlibraries(); main.js responds to that message by fetching the tab corresponding to that worker using worker.tab, and adding the array of library names to that tab's libraries property: pagemod.pagemod({ include: "*", contentscriptwhen: 'end', contentscriptfile: (data.url('library-detector.js')), onattach: function(worker) { worker.on('message', func...
...this means we'll need two additional content scripts: one in the widget's context, which listens for icon mouseover events and sends a message to main.js containing the name of the corresponding library: function setlibraryinfo(element) { self.port.emit('setlibraryinfo', element.target.title); } var elements = document.getelementsbytagname('img'); for (var i = 0; i &lt; elements.length; i++) { elements[i].addeventlistener('mouseover', setlibraryinfo, false); } one in the panel, which updates the panel's content with the library information: self.on("message", function(libraryinfo) { window.document.body.innerhtml = libraryi...
Working with Events - Archive of obsolete content
listener: the listener itself.
...if you do this, the listener will be called for any event emitted by that object, and its argument will be the name of the event: var ui = require("sdk/ui"); var panels = require("sdk/panel"); var self = require("sdk/self"); var panel = panels.panel({ contenturl: self.data.url("panel.html") }); panel.on("*", function(e) { console.log("event " + e + " was emitted"); }); var button = ui.actionbutton({ id: "my-button", label: "my button", icon: "./icon-16.png", onclick: handleclick }); function handleclick(state) { panel.show({ position: button }); } this wildcard feature ...
l10n - Archive of obsolete content
if this function can't find the string referenced by the identifier parameter, it returns the identifier itself.
... returns string : the localized string referenced by the identifier parameter passed in, or the identifier itself if no referent for the identifier can be found.
windows - Archive of obsolete content
this does not mean that the url content has loaded, only that the window itself is fully functional and its properties can be accessed.
...this does not mean that the content has loaded, only that the browser window itself is fully visible to the user.
content/loader - Archive of obsolete content
contenturl property is changed: var hiddenframes = require("sdk/frame/hidden-frame"); var { loader } = require("sdk/content/content"); var pageloader = loader.compose({ constructor: function pageloader(options) { options = options || {}; if (options.contenturl) this.contenturl = options.contenturl; this.on('propertychange', this._onchange = this._onchange.bind(this)); let self = this; hiddenframes.add(hiddenframes.hiddenframe({ onready: function onready() { let frame = self._frame = this.element; self._emit('propertychange', { contenturl: self.contenturl }); } })); }, _onchange: function _onchange(e) { if ('contenturl' in e) this._frame.setattribute('src', this._contenturl); } }); loader properties contentscriptfil...
...this may take one of the following values: "start": load content scripts immediately after the document element for the page is inserted into the dom, but before the dom content itself has been loaded "ready": load content scripts once dom content has been loaded, corresponding to the domcontentloaded event "end": load content scripts once all the content (dom, js, css, images) for the page has been loaded, at the time the window.onload event fires contentscriptoptions read-only value exposed to content scripts under self.options property.
content/mod - Archive of obsolete content
for example target can be a content window itself in which case it's will be returned back.
...if a nsidomwindow is given, it works as an identify function, returns target itself.
content/worker - Archive of obsolete content
calling the self.postmessage() function from a content script will asynchronously emit the message event on the corresponding worker.
...the script may not be initialized yet, or may already have been unloaded you can handle the detach event in the content script itself though: // in content script self.port.on("detach", function() { window.close(); }); ...
core/heritage - Archive of obsolete content
also, idiomatic sdk code does not uses optional new keywords, but you're free to use it in your add-on code: var fluffy = dog('fluffy'); // instatiation fluffy instanceof dog // => true fluffy instanceof class // => true as you could notice from example above classes created via class function by default inherits from a class itself.
...ruff!' leo.instanceof labrador // => true leo.instanceof dog // => true also, you could use class function to subclass constructor functions that were not created by a class itself: var foo = class({ extends: labrador // ...
lang/functional - Archive of obsolete content
invoke(callee, params, self) invokes callee, passing params as an argument and self as this.
... self : mixed object to be passed as the this context to callee.
Implementing the widget - Archive of obsolete content
the widget's content script the widget's content script just listens for left- and right- mouse clicks and posts the corresponding message to the add-on code: this.addeventlistener('click', function(event) { if(event.button == 0 && event.shiftkey == false) self.port.emit('left-click'); if(event.button == 2 || (event.button == 0 && event.shiftkey == true)) self.port.emit('right-click'); event.preventdefault(); }, true); save this in your data/widget directory as widget.js.
... main.js now in the lib directory open main.js and add the following code: var widgets = require('sdk/widget'); var data = require('sdk/self').data; var annotatorison = false; function toggleactivation() { annotatorison = !annotatorison; return annotatorison; } exports.main = function() { var widget = widgets.widget({ id: 'toggle-switch', label: 'annotator', contenturl: data.url('widget/pencil-off.png'), contentscriptwhen: 'ready', contentscriptfile: data.url('widget/widget.js') }); widget.port.on('left-click', function() { console.log('activate/deactivate'); widget.con...
Storing annotations - Archive of obsolete content
annotation list content script here's the annotation list's content script: self.on("message", function onmessage(storedannotations) { var annotationlist = $('#annotation-list'); annotationlist.empty(); storedannotations.foreach( function(storedannotation) { var annotationhtml = $('#template .annotation-details').clone(); annotationhtml.find('.url').text(storedannotation.url) .attr('href', storedannotation.url); ann...
...otationhtml.find('.url').bind('click', function(event) { event.stoppropagation(); event.preventdefault(); self.postmessage(storedannotation.url); }); annotationhtml.find('.selection-text') .text(storedannotation.anchortext); annotationhtml.find('.annotation-text') .text(storedannotation.annotationtext); annotationlist.append(annotationhtml); }); }); it builds the dom for the panel from the array of annotations it is given.
Getting Started (jpm) - Archive of obsolete content
you can distribute xpi files yourself or publish them to https://addons.mozilla.org so other users can download and install them.
... the add-on code itself uses two sdk modules, action button and tabs.
Getting started (cfx) - Archive of obsolete content
you can distribute xpi files yourself or publish them to https://addons.mozilla.org so other users can download and install them.
... the add-on code itself uses two sdk modules, action button and tabs.
Developing for Firefox Mobile - Archive of obsolete content
running add-ons on android you can develop your add-on as normal, as long as you restrict yourself to the supported modules.
... hotkeys supported indexed-db supported l10n supported notifications supported page-mod supported page-worker supported panel not supported passwords supported private-browsing not supported querystring supported request supported selection not supported self supported simple-prefs supported simple-storage supported system supported tabs supported timers supported ui not supported url supported widget not supported windows supported low-level apis /loader supported chrome supported console/plain-text ...
Bootstrapped extensions - Archive of obsolete content
startup called when the extension needs to start itself up.
... shutdown called when the extensidisableon needs to shut itself down, such as when the application is quitting or when the extension is about to be upgraded or disabled.
Miscellaneous - Archive of obsolete content
this page contains small, self-explanatory code snippets.
... var postdata = history.getentryatindex(history.index-1,false).queryinterface(ci.nsishentry).postdata; if you got here all by yourself, your problem must be at reading the postdata, because it's a nsiinputstream object, whose available function always returns 0.
JavaScript Daemons Management - Archive of obsolete content
but the daemon constructor itself is nothing but a clone of minidaemon with an added support for init and onstart functions declarable during the instantiation of the daemon.
...the daemon constructor itself is nothing but a clone of the little framework minidaemon with added support for init and onstart functions (declarable during the instantiation of the daemon).
Enhanced Extension Installation - Archive of obsolete content
this boolean relationship itself is not stored directly in the datasource.
... messages that appear in the extensions ui in response to user-actions such as install, uninstall, enable and disable are now driven by the extensions datasource itself and are supplied by the em:displaydescription property, rather than being supplied by the front end and several different redundant xbl bindings/style rules.
Extension Packaging - Archive of obsolete content
instead, the xpi itself is placed in the extensions directory, and files are loaded directly out of the package.
...otherwise, the extension manager may not function properly with the extension, or the extension itself may not work properly.
Extension Versioning, Update and Compatibility - Archive of obsolete content
note: before firefox 1.5 the preference app.extensions.version could be used to override the version that the application believed itself to be to allow normally incompatible extensions to install.
... update rdf format if you host your add-on's updateurl yourself then you will need to return the add-on version information in an rdf format.
How to convert an overlay extension to restartless - Archive of obsolete content
if you're getting json this way make sure to explicitly set the type as "text" if you intend to parse it yourself.
...this part is fairly easy to implement yourself, at least.
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
firefox itself includes a great number of xpcom components, and they can be used in extensions as well.
... note that firefox itself and its extensions have privileges set by default after installation and registration.
Appendix A: Add-on Performance - Archive of obsolete content
ask yourself: is there anything i can’t run 100 ms or even 500 ms later?
... other recommendations always clean up after yourself.
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
even if you trust the remote server; for example, because it is one you rent and administer yourself, there is a huge security risk, because of, but not limited to: you might discontinue your project or sell it, so that it is possible another person with malicious intentions takes over your domain.
...settimeout("dosomething();", 100); addeventlistener("load", "myaddon.init(); myaddon.onload();", true); setinterval(am_i_a_string_or_function_reference_qmark, 100); that in itself is certainly not elegant, but it may also become a security issue if you pass code that was externally retrieved (or at least contains bits of externally retrieved data): // do not use!
Appendix D: Loading Scripts - Archive of obsolete content
the script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself.
...the script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself.
Performance best practices in extensions - Archive of obsolete content
there is a down side to this: poorly written extensions can have a severe impact on the browsing experience, including on the overall performance of firefox itself.
... this article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of firefox itself.
Signing an XPI - Archive of obsolete content
for an extension to work in firefox it must be signed by mozilla, not by yourself.
... note: these instructions are for how to test with a self-signed certificate.
Using Dependent Libraries In Extension Components - Archive of obsolete content
we want to load the dependent libraries // of the real component, then the component itself, and call nsgetmodule on // the component.
...we want to load the dependent libraries // of the real component, then the component itself, and call nsgetmodule on // the component.
Add-ons - Archive of obsolete content
there is a down side to this: poorly written extensions can have a severe impact on the browsing experience, including on the overall performance of firefox itself.
... this article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of firefox itself.
Creating a dynamic status bar extension - Archive of obsolete content
we need this so that we can make changes to the status bar panel itself.
...at index 0 is the ticker symbol itself, which we don't need since we know which stock we're looking at.
Index of archived content - Archive of obsolete content
content scripts communicating with other scripts communicating using "port" communicating using "postmessage" cross-domain content scripts interacting with page scripts loading content scripts reddit example port self contributor's guide classes and inheritance content processes getting started modules private properties firefox compatibility module structure of the sdk porting the li...
... addon-page base64 clipboard context-menu hotkeys indexed-db l10n notifications page-mod page-worker panel passwords private-browsing querystring request selection self simple-prefs simple-storage system tabs timers ui url widget windows low-level apis /loader chrome console/plain-text console/traceback ...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
instead of "shrinkwrapping" the image itself, the browser is now wrapping around the line in which the image sits.
...if you have markup that lends itself well to this approach, you could class the table rows instead of the images.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
situation int-evry manages about 3000 users (mostly students) who share computers in labs and "self service" computer rooms.
... the use of the getldapattributes() function by calling inside itself the processldapvalues() as a user defined function (see prefcalls.js) forces us to slightly change these calls in our original web cgi javascript (here mci-mozilla-glob-prefs-tux.cgi).
Source code directories overview - Archive of obsolete content
it resizes and aligns pieces of content according to the css1 and css2 (cascading style sheets), alignment styles and the content itself.
...it does not include the code for the virtual machine itself, though.
Autodial for Windows NT - Archive of obsolete content
bug 166134 describes how the aol client installs itself as a dialer, but it doesn't behave like other dialers.
... the problem is with the aol client, be the bug could probably be fixed by not changing mozilla to avoid using the aol client as a dialer even though it installs itself as one.
Drag and Drop - Archive of obsolete content
note that drag sessions can be created from within mozilla itself or from other applications.
...the element can simply ignore the event or can handle it some way, such as pasting the dragged object into itself.
Repackaging Firefox - Archive of obsolete content
if the value is the same for *all* locales, it can be set in the partner.js file itself, see the section "preferences" for more information.
... the "repackaging" section is where you configure the actual repackaging job itself.
Menu - Archive of obsolete content
ArchiveMozillaJetpackUIMenu
null is recommended because it stands out.) function a menuitem that will update itself when its menu is shown.
... many users, especially those new to firefox, don't realize the distinction between add-ons and the browser itself.
Mozilla Application Framework in Detail - Archive of obsolete content
on the developer side, xpcom lets you to write components in c++, javascript, python, or other languages for which special bindings have been created, and compile and run those components on dozens of different platforms, including these and others where mozilla itself is supported: microsoft windows gnu/linux hp-ux aix solaris openvms mac os x *bsd the flexibility to reuse the xpcom components from the gecko library and develop new components that run on different platforms can make your application development faster, more productive, and easier to maintain.
...the mozblog application hosted at mozdev.org, for example, uses xpinstall to make several different versions available simultaneously as updates are made and the browser itself advances versions.
RDF Datasource How-To - Archive of obsolete content
implement the interface yourself.
...registering an rdf datasource is fairly simple: in the dll's nsregisterself() method, you simply call the component manager's registercomponent() method: extern "c" pr_implement(nsresult) nsregisterself(nsisupports* aservicemanager, const char* apath) { nsresult rv; ...
Remotely debugging Firefox for Metro - Archive of obsolete content
on the desktop next, the desktop shows you a dialog that looks something like this: this is asking whether you want to debug web content running in a browser tab, or to debug the browser code itself.
... you'll see one entry under "available remote processes": this is the browser process itself.
Table Layout Regression Tests - Archive of obsolete content
to build the layoutdebugger itself, build either all extensions or include layoutdebug in your .mozconfig file.
... execute the baseline test shutdown the layoutdebugger execute mozilla -layoutdebug - p foo >selftest.txt execute the verify test make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile.
Tamarin Acceptance Testing - Archive of obsolete content
successfully build release and debug versions of the shell with the debugger enabled [info] successfully run the following test suites: acceptance test suite [info] self tests [info] submit a sandbox build request to test against platforms that you may not have locally [info] available tamarin acceptance test suites actionscript acceptance tests: actionscript acceptance tests running tamarin acceptance tests abc assembler tests cmdline tests performance tests actionscript performance tests running tamarin performance tests built-in self tests...
... see instructions in doc/selftest.html in the tamarin repository.
Tamarin build documentation - Archive of obsolete content
a prototype self-hosting ecmascript edition 4 compiler, esc, is provided with tamarin but it is not yet capable of bootstrapping itself or building applications.
... description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/tamarin-redux/ , you can also see your build request in the queue at http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm.
Using Breakpoints in Venkman - Archive of obsolete content
basic breakpoints the stop button and debugger keyword are useful features of the javascript debugger, but when you are debugging deep in code—especially code you have authored yourself and are responsible for troubleshooting—you're going to need breakpoints.
... using breakpoints and the interactive view, you can change the values of the variables that venkman displays (only in the context of the debugging environment itself) and see how these changes affect the execution of the code.
allowevents - Archive of obsolete content
on listitem and titlebar elements, mouse events normally do not get sent to their children; instead they are retargeted to the listitem and titlebar element itself.
... for menu, menuseparator, menuitem and treecol elements, as well as menu buttons, and the popup datepicker, mouse events are also retargeted to the element itself.
sizetopopup - Archive of obsolete content
if the sizetopopup attribute is left out or set to none, the menu will be its preferred width and the popup may extend outside of this width, unaffected by the maximum width of the menu itself.
... otherwise, the menu will size itself to at least the size of the popup.
XUL Events - Archive of obsolete content
the element, if it accepts the drop, should respond in some manner such inserting the dragged object into itself.
...you would not normally use these yourself.
findbar - Archive of obsolete content
for example, the standard findbar in firefox 3.5 looks like this on the mac: you may attach a findbar to a particular browser element by either setting the findbar's browserid attribute to the id of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself.
... the first time this is called for a given findbar, the findbar will flash to draw attention to itself.
PopupKeys - Archive of obsolete content
note that the last argument here is true to listen for events during the capturing phase of event propagation: window.addeventlistener("keypress", someaction, true); however, the default listener provides all the suitable responses to keys, so there shouldn't be a need to handle keys yourself.
...instead, you will have to handle this yourself.
Building Menus With Templates - Archive of obsolete content
if you press this button before opening the menu, there will be one child (the template itself).
...the special feature of menus to not generate content immediately applies only to the menu itself.
Multiple Queries - Archive of obsolete content
it the first query was used by itself, only one result would match.
... if the second query was used by itself, three results would match.
RDF Modifications - Archive of obsolete content
you don't need to implement this observer yourself, although you may add an observer to the datasource if you want to be notified when the data changes.
...in effect, this isn't any different than adding the same set of triples yourself using the assert method.
Adding Methods to XBL-defined Elements - Archive of obsolete content
the stack has only one child, the children element itself.
...here are some examples: <constructor> if (this.childnodes[0].getattribute("open") == "true"){ this.loadchildren(); } </constructor> <destructor action="savemyself(this);"/> the next section shows how to add event handlers to xbl-defined elements.
Box Model Details - Archive of obsolete content
you can also prevent this stretching by placing a maximum height on the elements or, better, on the box itself.
...the box model may be difficult to understand without trying various various things out for yourself.
Broadcasters and Observers - Archive of obsolete content
attributes of the observers that the broadcaster doesn't have itself are not modified.
...the observes element itself does not change but the element it is inside changes, which in this case is a button.
List Controls - Archive of obsolete content
the simplest list box uses the listbox element for the box itself, and the listitem element for each item.
...for example, the url field in the browser has a drop-down for selecting previously typed urls, but you can also type them in yourself.
More Wizards - Archive of obsolete content
remember to return false in this case, because you have already changed the page yourself.
...thus, the back button will be disabled on the first page so you don't have to set it yourself.
Popup Menus - Archive of obsolete content
this type of popup is usually used to provide a description of a button in more detail than can be provided on the button itself.
...you will also notice that the id has been set on the menupopup element itself.
Templates - Archive of obsolete content
(you may have to focus the window for it to change.) container and datasources the template itself is placed inside a vertical box.
...these elements get displayed, but the template itself is not displayed, although it still exists in the document tree.
XUL accessibility guidelines - Archive of obsolete content
initial dialog focus the initial focus in a xul dialog (i.e., the focus when the dialog is first opened) should always be on a specific control, not on the dialog itself.
...in all other dialogs, focus should just start on the first control (although it can be on any other control if there is a good reason for, just not on the dialog itself).
XML - Archive of obsolete content
it does not describe the way in which this data is to be presented, like its semantically-challenged cousin html does, and it doesn't have much to say about the data itself.
...an actual memo using the memoml to represent itself might look like this: <memo> <from>ian oeschger</from> <to>steve rudman</to> <body>i think the first draft of the guide is done!</body> </memo> note how the memo element -- the root element in our brief definition, ordeclaration, above -- surrounds the other three elements.
editor - Archive of obsolete content
the editor does not provide any editing user interface; you would supply that yourself.
...most of its methods are callable directly on the element itself, such as goback and goforward.
iframe - Archive of obsolete content
warning: when used in chrome-privileged documents (either html or xul) such as firefox addons, the contents of the frame may have the same permissions as firefox itself.
...most of its methods are callable directly on the element itself, such as goback and goforward.
menu - Archive of obsolete content
ArchiveMozillaXULmenu
if the sizetopopup attribute is left out or set to none, the menu will be its preferred width and the popup may extend outside of this width, unaffected by the maximum width of the menu itself.
... otherwise, the menu will size itself to at least the size of the popup.
menulist - Archive of obsolete content
if the sizetopopup attribute is left out or set to none, the menu will be its preferred width and the popup may extend outside of this width, unaffected by the maximum width of the menu itself.
... otherwise, the menu will size itself to at least the size of the popup.
textbox - Archive of obsolete content
from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
...from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
Building XULRunner with Python - Archive of obsolete content
it effectively specifies a release build that is not particularly suitable for debugging xulrunner itself.
...options --enable-optimize to check out all the required source code and build it the first time with no local client.mk file, execute cd /c/projects cvs -d :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot co mozilla/client.mk cd mozilla make -f client.mk for subsequent updates from cvs followed by a build, use cd /c/projects/mozilla make -f client.mk which will also checkout client.mk itself for build only, without checkouts, use make -f client.mk build and see client.mk for other options.
CommandLine - Archive of obsolete content
face : function mod_qi(aiid) { if (aiid.equals(nsimodule) || aiid.equals(nsisupports)) return this; throw components.results.ns_error_no_interface; }, /* nsimodule */ getclassobject : function mod_gch(acompmgr, acid, aiid) { if (acid.equals(class_id)) return apphandler.queryinterface(aiid); throw components.results.ns_error_failure; }, registerself : function mod_regself(acompmgr, afilespec, alocation, atype) { var compreg = acompmgr.queryinterface(nsicomponentregistrar); compreg.registerfactorylocation(class_id, class_name, contract_id, afilespec, alocation, atype); var catman = components.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager)...
...; catman.addcategoryentry("command-line-handler", cld_category, contract_id, true, true); }, unregisterself : function mod_unreg(acompmgr, alocation, atype) { var compreg = acompmgr.queryinterface(nsicomponentregistrar); compreg.unregisterfactorylocation(class_id, alocation); var catman = components.classes["@mozilla.org/categorymanager;1"] .getservice(nsicategorymanager); catman.deletecategoryentry("command-line-handler", cld_category); }, canunload : function (acompmgr) { return true; } }; function nsgetmodule(acompmgr, afilespec) { return apphandlermodule; } create an observer that will get notified when arguments change: chrome/content/cmdline.js function commandlineobserver() { this.reg...
Deploying XULRunner - Archive of obsolete content
this document explains how deployment should be managed for self contained portable applications built on xulrunner.
... it may turn out to be easier to create a self contained portable application, as described here, and deploy it with a generic installer that would create shortcuts to scripts that launch your application in the unregistered bundled xulrunner.
Getting started with XULRunner - Archive of obsolete content
if you need to change xulrunner itself or integrate it with external binaries you may need to read that article.
...this does not work if firefox itself was installed as a xul app - you need to use the installed xulrunner directly.
Mozilla release FAQ - Archive of obsolete content
if not, post to netscape.public.mozilla.builds or try to fix it yourself.
...both are great ways to meet others working on mozilla, including lots of netscape employees as well as other interested people (like myself).
NPN NewStream - Archive of obsolete content
a plug-in can create another instance of itself by specifying its own mime type and a new target name in a call to npn_newstream.
...if the new stream has the target of _self, this function should return an invalid_param np error.
NPP_NewStream - Archive of obsolete content
the data in the stream can be the file specified in the src attribute of the embed tag, for an embedded instance, or the file itself, for a full-page instance.
...the plug-in can terminate the stream itself by calling npn_destroystream.
NPAPI plugin reference - Archive of obsolete content
npn_version lets plugins obtain version information, both of the plug-in api and of the browser itself.
... npprint contains information the plug-in needs to print itself in full-page or embedded mode.
Plugins - Archive of obsolete content
plugins are different from extensions, which modify or enhance the functionality of the browser itself.
... plugins: the first install problem the first install problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser.
Introduction to Public-Key Cryptography - Archive of obsolete content
information about the user's public key, including the algorithm used and a representation of the key itself.
...the root ca's certificate is a self-signed certificate: that is, the certificate is digitally signed by the same entity-the root ca-that the certificate identifies.
Threats - Archive of obsolete content
for example, a person can pretend to have the email address jdoe@example.net, or a computer can identify itself as a site called www.example.net when it is not.
...a person or organization can misrepresent itself.
Vulnerabilities - Archive of obsolete content
a security configuration setting is an element of a software’s security that can be altered through the software itself.
... here are six of the most common website vulnerabilities you must protect yourself against.
Sunbird Theme Tutorial - Archive of obsolete content
making a theme a theme consists of: a unique identifier a file containing information about the theme a file that registers the theme with sunbird some files containing the theme itself set up your theme in sunbird's profile directory.
... creating the theme itself to create the theme itself, go to sunbird's program directory.
Table Reflow Internals - Archive of obsolete content
the container posts a dirty reflow command with itself as the target.
...the container posts a dirty reflow command with itself as the target.
Building a Theme - Archive of obsolete content
the element itself is of id navigator-toolbox, with no idea.
... zip up the contents of your theme's folder (not the theme folder itself), and rename the zip file to have a .xpi extension.
Old Proxy API - Archive of obsolete content
return "something"; } }); var q = p.azerty; // infinite loop the receiver argument in 'get' and 'set' traps may not be the proxy itself: var proxy; var handler = { has: function (name) { return name == 'foo'; }, get: function (rcvr, name) { if (name != 'foo') return undefined; print(proxy !== rcvr); return "bye"; }, }; proxy = proxy.create(handler); var c = object.create(proxy); print(c.foo); // prints: 'true' (from "proxy !== rcvr") and 'bye' (from "c.foo").
...esc) { object.defineproperty(obj, name, desc); }, delete: function(name) { return delete obj[name]; }, fix: function() { if (object.isfrozen(obj)) { return object.getownpropertynames(obj).map(function(name) { return object.getownpropertydescriptor(obj, name); }); } // as long as obj is not frozen, the proxy won't allow itself to be fixed return undefined; // will cause a typeerror to be thrown }, // derived traps has: function(name) { return name in obj; }, hasown: function(name) { return object.prototype.hasownproperty.call(obj, name); }, get: function(receiver, name) { return obj[name]; }, set: function(receiver, name, val) { obj[name] = val; return tru...
Describing microformats in JavaScript - Archive of obsolete content
subproperties it's possible for a property to itself include more properties; to do so, include them in a subproperties structure within the property.
... the microformat is registered with the microformat api by calling microformats.add(), like this: microformats.add("adr", adr_definition); note: to be clear: since the adr microformat is included by default in firefox 3 and later, you don't need to add it yourself if you wish to make use of it.
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
the problem in affected browsers, list item markers will very often appear to be too big compared to the text in the list item itself.
...the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself.
The Business Benefits of Web Standards - Archive of obsolete content
in a multi headed and possibly commercial environment such as a web development agency, this approach also lends itself to a very strict demarcation, between disciplines within a common framework.
... the content - markup - style; model also lends itself very neatly to linear methods of production.
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
return rv; } nperror npp_getvalue(npp instance, nppvariable variable, void *value) { if(instance == null) return nperr_invalid_instance_error; nperror rv = nperr_no_error; static nsiid scriptableiid = ns_itestplugin_iid; if (variable == nppvpluginscriptableinstance) { // nsitestplugin interface object should be associated with the plugin // instance itself.
... nsitestplugin *scriptablepeer = (nsitestplugin *)instance->pdata; // see if this is the first time and we haven't created it yet if (!scriptablepeer) { nsitestplugin *scriptablepeer = new nsscriptablepeer(); if (scriptablepeer) ns_addref(scriptablepeer); // addref for ourself, // don't forget to release on // shutdown to trigger its destruction } // add reference for the caller requesting the object ns_addref(scriptablepeer); *(nsisupports **)value = scriptablepeer; } else if (variable == nppvpluginscriptableiid) { nsiid* ptr = (nsiid *...
Index - Game development
we have successfully implemented gamepad controls in our game — try connecting any popular controller like the xbox 360 one and see for yourself how fun it is to avoid the asteroids and shoot the aliens with a gamepad.
... 66 mouse controls beginner, canvas, controls, games, javascript, tutorial, mouse the game itself is actually finished, so let's work on polishing it up.
Game promotion - Game development
act cool, be generous, be yourself and be there for others, and you'll get treated with respect.
... fostering the community you can help community grow and promote yourself and your games at the same time.
Plug-in Development Overview - Gecko Plugin API Reference
drawing a plug-in instance before drawing itself on the page, the plug-in must provide information about itself, set the window or other target in which it draws, arrange for redrawing, and handle events.
... a windowless plug-in can call the following netscape methods to draw itself: npn_forceredraw: force a paint message for windowless plug-ins.
Cross Axis - MDN Web Docs Glossary: Definitions of Web-related terms
alignment of items on the cross axis is achieved with the align-items property on the flex container or align-self property on individual items.
... learn more property reference align-content align-items align-self flex-wrap flex-direction flex further reading css flexbox guide: basic concepts of flexbox css flexbox guide: aligning items in a flex container css flexbox guide: mastering wrapping of flex items ...
Function - MDN Web Docs Glossary: Definitions of Web-related terms
a function is a code snippet that can be called by other code or by itself, or a variable that refers to the function.
...an outer function is a function containing a function (addsquares in this case): function addsquares(a,b) { function square(x) { return x * x; } return square(a) + square(b); }; //using ecmascript 2015 arrow notation const addsquares = (a,b) => { const square = x => x*x; return square(a) + square(b); }; a recursive function is a function that calls itself.
IIFE - MDN Web Docs Glossary: Definitions of Web-related terms
(function () { statements })(); it is a design pattern which is also known as a self-executing anonymous function and contains two major parts: the first is the anonymous function with lexical scope enclosed within the grouping operator ().
... (function () { var aname = "barry"; })(); // variable aname is not accessible from the outside scope aname // throws "uncaught referenceerror: aname is not defined" assigning the iife to a variable stores the function's return value, not the function definition itself.
Recursion - MDN Web Docs Glossary: Definitions of Web-related terms
the act of a function calling itself, recursion is used to solve problems that contain smaller sub-problems.
... examples recursive function calls itself until condition met the following python code defines a function that takes a number, prints it, and then calls itself again with the number's value -1.
Safe - MDN Web Docs Glossary: Definitions of Web-related terms
what is important here is that by calling a safe method, the client doesn't request any server change itself, and therefore won't create an unnecessary load or burden for the server.
... it is the responsibility of the application on the server to implement the safe semantic correctly, the webserver itself, being apache, nginx or iis, can't enforce it by itself.
MDN Web Docs Glossary: Definitions of Web-related terms
) rtsp: real-time streaming protocol ruby s safe same-origin policy scm scope screen reader script-supporting element scroll container scrollport sctp sdp search engine second-level domain secure sockets layer (ssl) selector (css) self-executing anonymous function semantics seo serialization server server timing session hijacking sgml shadow tree shim signature signature (functions) signature (security) simd simple header simple response header sisd site site map ...
... xquery xslt other 404 502 alpn at-rule attack byte-order mark character set client cryptosystem debug digital signature execution flex-direction glsl interface library memory management routers self-executing anonymous function stylesheet vector image ...
What is accessibility? - Learn web development
it is a good idea to familiarise yourself with screen readers; you should also set up a screen reader and have a play around with it, to get an idea of how it works.
...our advice is to familiarize yourself with the basic areas in which you need to take care, as well as understanding the high-level structures of the guidelines that are most relevant to you.
Cascade and inheritance - Learn web development
the first has styling applied to the blockquote element itself, the second has a class applied to the blockquote which sets the value of all to unset.
...you can think of this as rules which are nearer the element itself overwriting early ones until the last one wins and gets to style the element.
Debugging CSS - Learn web development
solving specificity issues sometimes during development, but in particular when you need to edit the css on an existing site, you will find yourself having a hard time getting some css to apply.
... debugging problems in css devtools can be a great help when solving css problems, so when you find yourself in a situation where css isn't behaving as you expect, how should you go about solving it?
The box model - Learn web development
this establishes flex layout for the items inside the container, however, the list itself is a block box and — like the paragraph — expands to the full container width and breaks onto a new line.
...you may want to return to this lesson in the future if you ever find yourself confused about how big boxes are in your layout.
CSS values and units - Learn web development
numbers, lengths, and percentages there are various numeric data types that you might find yourself using in css.
... unit relative to em font size of the parent, in the case of typographical properties like font-size, and font size of the element itself, in the case of other properties like width.
Flexbox - Learn web development
you can override the align-items behavior for individual flex items by applying the align-self property to them.
... for example, try adding the following to your css: button:first-child { align-self: flex-end; } have a look at what effect this has, and remove it again when you've finished.
What is CSS? - Learn web development
sometimes because a particular browser is interested in having some capability, other times because web designers and developers are asking for a feature, and sometimes because the working group itself has identified a requirement.
... what's next now that you have some understanding of what css is, let's move on to getting started with css, where you can start to write some css yourself.
Web fonts - Learn web development
for this example, we just want you to concern yourself with a single font file for each choice.
...they are somewhat advanced for our beginner's course, but if you fancy stretching yourself and looking into them, read our variable fonts guide.
How do you make sure your website works properly? - Learn web development
404: not found self-explanatory.
...for instance, maybe the server-side language (php, .net, etc.) stopped working, or the web server itself has a configuration problem.
What do common web layouts contain? - Learn web development
simple layouts are easier to implement, but allow yourself room to express your creativity in this area.
...have a look at your own favorite websites and ask yourself, where's the header, the footer, the main content, and the side content?
How do I start to design my website? - Learn web development
by answering that, you'll find the best way to reach your goals and save yourself from wasted effort.
...(for example, should i learn how to do all this myself, ask someone to do it for me, or use third-party services?) conclusion as you can see, the simple idea "i want to make a website" generates a long to-do list, which only grows longer as you think about it.
What is a URL? - Learn web development
as the resource represented by the url and the url itself are handled by the web server, it is up to the owner of the web server to carefully manage that resource and its associated url.
... #somewhereinthedocument is an anchor to another part of the resource itself.
What is a web server? - Learn web development
we'll cover http itself in a technical article later.
...unless you want to learn web server programming (which is an exciting area in itself!), you don't need to create your own application server.
Advanced form styling - Learn web development
this stops any control you apply it to from using system-level styling, as much as possible, and lets you build up the styles yourself using css.
... also bear in mind that we've added some javascript to the page that lists the files selected by the file picker, below the control itself.
How to build custom form controls - Learn web development
, let's style the list of options: .select .optlist { z-index : 2; /* we explicitly said the list of options will always be on top of the down arrow */ /* this will reset the default style of the ul element */ list-style: none; margin : 0; padding: 0; box-sizing : border-box; /* if the values are smaller than the control, the list of options will be as wide as the control itself */ min-width : 100%; /* in case the list is too long, its content will overflow vertically (which will add a vertical scrollbar automatically) but never horizontally (because we haven't set a width, the list will adjust its width automatically.
...lect` class to deactivate function deactivateselect(select) { // if the control is not active there is nothing to do if (!select.classlist.contains('active')) return; // we need to get the list of options for the custom control var optlist = select.queryselector('.optlist'); // we close the list of option optlist.classlist.add('hidden'); // and we deactivate the custom control itself select.classlist.remove('active'); } // this function will be used each time the user wants to (de)activate the control // it takes two parameters: // select : the dom node with the `select` class to activate // selectlist : the list of all the dom nodes with the `select` class function activeselect(select, selectlist) { // if the control is already active there is nothing to do if (selec...
Front-end web developer - Learn web development
you can work through sections in order, but each one is also self-contained.
...the learning and getting help article provides you with a series of tips for looking up information and helping yourself.
Debugging HTML - Learn web development
html itself doesn't suffer from syntax errors because browsers parse it permissively, meaning that the page still displays even if there are syntax errors.
...this also marks the end of the introduction to html module learning articles — now you can go on to testing yourself with our assessments: the first one is linked below.
Getting started with HTML - Learn web development
for example, consider the following line of text: my cat is very grumpy if we wanted the text to stand by itself, we could specify that it is a paragraph by enclosing it in a paragraph (<p>) element: <p>my cat is very grumpy</p> note: tags in html are case-insensitive.
...they are parts of the html syntax itself.
Introducing asynchronous JavaScript - Learn web development
you can try it for yourself: <button>click me</button> note: it is important to remember that alert(), while being very useful for demonstrating a synchronous blocking operation, is terrible for use in real world applications.
...the expected parameter of foreach() is a callback function, which itself takes two parameters, a reference to the array name and index values.
Graceful asynchronous programming with Promises - Learn web development
the code that the video chat application would use might look something like this: function handlecallbutton(evt) { setstatusmessage("calling..."); navigator.mediadevices.getusermedia({video: true, audio: true}) .then(chatstream => { selfviewelem.srcobject = chatstream; chatstream.gettracks().foreach(track => mypeerconnection.addtrack(track, chatstream)); setstatusmessage("connected"); }).catch(err => { setstatusmessage("failed to connect"); }); } this function starts by using a function called setstatusmessage() to update a status display with the message "calling...", indicating that a call is being a...
...it then calls getusermedia(), asking for a stream that has both video and audio tracks, then once that's been obtained, sets up a video element to show the stream coming from the camera as a "self view," then takes each of the stream's tracks and adds them to the webrtc rtcpeerconnection representing a connection to another user.
Looping code - Learn web development
the javascript is mostly the same too, although the loop itself is a bit different: let num = input.value; for (let i = 1; i <= num; i++) { let sqroot = math.sqrt(i); if (math.floor(sqroot) !== sqroot) { continue; } para.textcontent += i + ' '; } here's the output: hidden code 4 <!doctype html> <html> <head> <meta charset="utf-8"> <title>integer squares generator</title> <style> </style> </head> <body> <label for="...
... inside the loop, we find the square root of each number using math.sqrt(i), then check whether the square root is an integer by testing whether it is the same as itself when it has been rounded down to the nearest integer (this is what math.floor() does to the number it is passed).
Arrays - Learn web development
you can access an item inside an array that is itself inside another array by chaining two sets of square brackets together.
...we'll be teaching you all the useful basics there are to know about loops in the next module, but for now you should give yourself a clap and take a well-deserved break; you've worked through all the articles in this module!
What is JavaScript? - Learn web development
they do the same thing for programming that ready-made furniture kits do for home building — it is much easier to take ready-cut panels and screw them together to make a bookshelf than it is to work out the design yourself, go and find the correct wood, cut all the panels to the right size and shape, find the correct-sized screws, and then put them together to make a bookshelf.
...*/ const buttons = document.queryselectorall('button'); for (let i = 0; i < buttons.length ; i++) { buttons[i].addeventlistener('click', createparagraph); } note: in general more comments are usually better than less, but you should be careful if you find yourself adding lots of comments to explain what variables are (your variable names perhaps should be more intuitive), or to explain very simple operations (maybe your code is overcomplicated).
Client-Server Overview - Learn web development
the first part is called the header, and contains useful information about the request, in the same way that an html head contains useful information about an html document (but not the actual content itself, which is in the body): get https://developer.mozilla.org/search?q=client+server+overview&topic=apps&topic=html&topic=css&topic=js&topic=api&topic=webdev http/1.1 host: developer.mozilla.org connection: keep-alive pragma: no-cache cache-control: no-cache upgrade-insecure-requests: 1 user-agent: mozilla/5.0 (windows nt 10.0; wow64) applewebkit/537.36 (khtml, like gecko) chrome/52.0.2743.116 safar...
...you can try this yourself.
Introduction to the server side - Learn web development
client-side web frameworks simplify layout and presentation tasks while server-side web frameworks provide a lot of “common” web server functionality that you might otherwise have to implement yourself (e.g.
... notifications and communication servers can send general or user-specific notifications through the website itself or via email, sms, instant messaging, video conversations, or other communications services.
Website security - Learn web development
as a defense, your site can prevent itself from being embedded in an iframe in another site by setting the appropriate http headers.
...these defenses are typically located before or in the web server (they are not part of the web application itself).
React interactivity: Events and state - Learn web development
data such as this, which a component itself owns, is called state.
...in form.js, change your very first line so that it reads like this: import react, { usestate } from "react"; this allows us to import the usestate() function by itself, and utilize it anywhere in this file.
TypeScript support in Svelte - Learn web development
readability: static typing gives the code more structure, making it self-documenting and more readable.
...in those cases you can declare the typed variable in a different statement, like this: let completetodos: number $: completedtodos = todos.filter((t: todotype) => t.completed).length you can't specify the type in the reactive assignment itself.
Working with Svelte stores - Learn web development
whenever the value is modified, updates the store itself and also the data in local storage.
...because stores has a minimal api, it's very simple to create our custom stores to abstract away the inner workings of the store itself.
Getting started with Vue - Learn web development
this allows you to start using vue on existing sites, which is why vue prides itself on being a progressive framework.
...this allows you to run your app locally so you can test it easily without needing to configure a server yourself.
Adding a new todo form: Vue events, methods, and models - Learn web development
.self: triggers the handler only if the event was dispatched from this exact element.
... update your todoform component’s onsubmit() method to this: onsubmit() { if(this.label === "") { return; } this.$emit('todo-added', this.label); this.label = ""; } now when you click the "add" button, the "new-todo-input" will clear itself.
Introduction to automated testing - Learn web development
note: this is already very useful, and way more convenient than having to set up all these emulators and virtual machines by yourself.
... note: this is already very useful, and way more convenient than having to set up all these emulators and virtual machines by yourself.
Client-side tooling overview - Learn web development
you might even find yourself writing a piece of software to aid your own development process, to solve a specific problem that existing tools don’t already seem to handle.
...if you have found yourself struggling in the past, then don’t worry — you are not alone.
Package management basics - Learn web development
you could certainly code this yourself, but there's a strong chance that someone else has already solved this problem — why waste time reinventing the wheel?
... we've met npm already, but stepping back from npm itself, a package manager is a system that will manage your project dependencies.
Accessibility API cross-reference
n/a n/a canvas n/a <canvas> (accessible alternative richtext content may be nested inside, but the canvas itself is presentational) a dialog for picking a color n/a color_chooser color_chooser n/a <input type=color> a dialog for picking a file n/a file_chooser file_chooser n/a invoked with <input type=file> no explanation given n/a n/a invalid n/a contains accessible info, but its ro...
... n/a n/a sensitive don't speak for this item, it will take care of text-to-speech on its own selfvoicing n/a n/a object can be resized n/a resizable resizable this object and all of its ancestors are visible n/a showing showing this text object can only contain 1 line of text n/a single_line single_line tells accessibility aid "don't add event li...
Accessibility/LiveRegionDevGuide
sometimes the very best guide for some developers is the code itself.
...however, many web sites do not have proper aria markup so this cannot be used by itself.
Mozilla accessibility architecture
the shared code makes itself available to the toolkit-specific code via generic xpcom interfaces that return information about objects we want to expose.
... nsxultreeaccessible: which does not have a dom node for each tree item, a special interface is provided by the tree itself to get the text for each row, column in the tree.
Index
this signing process takes place through addons.mozilla.org (amo), whether you choose to distribute your add-on through amo or to do it yourself.
...you may submit themes for publishing on amo or for self-distribution.
Browser chrome tests
you should attempt to reduce the side effects of the testing code and "clean up" after yourself, to avoid influencing other tests.
... cleaning up after yourself if you need to do special clean up after running your test, you can register a cleanup function that is guaranteed to be run after your test finishes.
Debugging JavaScript
this document is intended to help developers writing javascript code in mozilla, mainly for mozilla itself, but it may also be useful for web developers.
... browser debugger (built-in) on firefox 19 or later, it's possible to use the built-in js debugger on the browser itself.
Contributing to the Mozilla code base
the mozilla community prides itself on being an open, accessible, and friendly community for new participants.
... the bug itself may contain a clear indication of the best person to ask for a review are there related bugs on similar topics?
Performance
additionally the example above does not clean unregister itself, thus leaking objects each time a tab is closed.
... frame message manager message and event listeners are limited in their lifetime to that of the frame itself, this does not apply to observer registrations.
Firefox
learn how to create add-ons for firefox, how to develop and build firefox itself, and how the internals of firefox and its subprojects work.
... firefox profiles if you find yourself using multiple firefox channels—or just multiple configurations—on a regular basis, you should read how to use multiple firefox profiles by turning firefox's profile manager and other profile management tools to your advantage.
Gecko SDK
do not confuse the gecko/xulrunner sdk with xulrunner itself.
... mac i386 download download download download n/a mac ppc n/a download download download download linux x86_64 download n/a n/a n/a n/a linux i686 download download download download download the sdk is not officially released for other platforms; if you need it, you will probably need to build it yourself.
Script security
it subsumes itself and all other principals.
...it has no privileges and can't be accessed by anything but itself and chrome.
IPDL Best Practices
do not use them as data structures outside of ipdl, or wou will eventually find yourself in bad situations to implement proper memory management.
... is there any chance that an ipdl function could be called after the protocol itself has been destroyed, or before it has been created?
JavaScript-DOM Prototypes in Mozilla
all the methods that are supposed to show up on this jsobject are actually not properties of the object itself, but rather properties of the prototype of the jsobject for the wrapper (unless the c++ object's class info has the flag nsixpcscriptable::dont_share_prototype set, but lets assume that's not the case here).
... a third way through which one can access the prototype of an object is through the constructor property of the object, which itself points (initially) to the constructor: document.images[0].constructor.prototype.foo = bar; note though, the above may or may not work in mozilla.
DeferredTask.jsm
if a special operation or error logging is needed on completion, it can be better handled from within the task itself, for example using a try/catch/finally clause in the task.
... void arm(); disarm cancel any request for a delayed execution of the task, though the task itself cannot be canceled in case it is already running.
Deferred
specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.
...if however a promise is passed, then the promise * itself will be the reason for rejection no matter the state of the promise.
Localizing with Mozilla Translator
files hanging directly from the platform neutral platform can't be part of a partial glossary (because they are not components), and platform neutral itself can't be selected either, since it is not a component, but a platform.
... if you have opted for the first solution, you will find yourself with some new products completely untranslated (once you update each of them).
Memory Profiler
developers have to infer how an object might be allocated and freed by himself/herself.
...the table could be sorted according to the 6 measurements: {retained, allocated, peak} x {self, inclusive}.
TimerFirings logging
204 801266240[7f7c1f248000]: [7163] fn timer (one_shot 50 ms): [content] http://widgets.outbrain.com/outbrain.js:20:330 135 -495057024[7f74e105ba00]: [7108] fn timer (one_shot 4 ms): [content] https://self-repair.mozilla.org/repair/:7:13669 118 801266240[7f7c1f248000]: [7163] fn timer (one_shot 100 ms): [content] http://a.visualrevenue.com/vrs.js:6:9423 103 801266240[7f7c1f248000]: [7163] fn timer (one_shot 50 ms): [content] http://static.dynamicyield.com/scripts/12086/dy-min.js?v=12086:3:3389 94 801266240[7f7c1f248000]: [7163] fn timer (one_shot 50 ms): [content] http...
... 204 fn timer (one_shot): [content] http://widgets.outbrain.com/outbrain.js:20:330 186 fn timer (one_shot): nsbrowserstatusfilter::timeouthandler 138 fn timer (one_shot): [content] https://self-repair.mozilla.org/repair/:7:13669 118 fn timer (one_shot): [content] http://a.visualrevenue.com/vrs.js:6:9423 108 fn timer (slack): layeractivitytracker 104 fn timer (slack): nsidocument::selectorcache 104 fn timer (slack): cctimerfired ...
about:memory
perhaps you want to investigate it yourself, or perhaps someone has asked you to use about:memory to generate "memory reports" so they can investigate a problem you are having.
...don't click "measure..." repeatedly, because that will cause the memory usage of about:memory itself to rise, due to it discarding and regenerating large numbers of dom nodes.
I/O Types
types unique to a particular function are described with the function itself.
...each prfiledesc structure has a field (of type prdescidentity) to identify itself in the layers.
PLHashEntry
if the key of an entry is an integral value that can fit into a void * pointer, you can just cast the key itself to void * and store it in the key field.
... similarly, if the value of an entry is an integral value that can fit into a void * pointer, you can cast the value itself to void * and store it in the value field.
PRThreadState
if a thread is created as an unjoinable (also called detached) thread, it terminates and cleans up after itself after returning from its root function.
... this results in some ambiguity after the thread's root function has returned and before the thread has finished terminating itself.
JSS FAQ
MozillaProjectsNSSJSSJSS FAQ
ity/jss/org/mozilla/jss/tests org/mozilla/jss/tests/closedbs.java org/mozilla/jss/tests/keyfactorytest.java org/mozilla/jss/tests/digesttest.java org/mozilla/jss/tests/jcasigtest.java org/mozilla/jss/tests/keywrapping.java org/mozilla/jss/tests/listcerts.java org/mozilla/jss/tests/pk10gen.java org/mozilla/jss/tests/sdr.java org/mozilla/jss/tests/selftest.java org/mozilla/jss/tests/setupdbs.java org/mozilla/jss/tests/sigtest.java org/mozilla/jss/tests/symkeygen.java org/mozilla/jss/tests/testkeygen.java org/mozilla/jss/tests/sslclientauth.java org/mozilla/jss/tests/listcacerts.java org/mozilla/jss/tests/keystoretest.java org/mozilla/jss/tests/verifycert.java ssl examples: org/mozilla/jss/...
...setcipherpolicy does not need to be called by a jss app unless that app wants to limit itself to export-allowed cipher suites.
NSS_3.12_release_notes.html
bug 399326: libpkix is unable to validate cert for certusagestatusresponder bug 400947: thread unsafe operation in pkix_pl_hashtable_add cause selfserv to crash.
... 353908: klocwork oom crash in tdcache.c bug 353909: klocwork ptr dereference before null check in devutil.c bug 353912: misc klocwork bugs in lib/ckfw bug 354008: klocwork bugs in freebl bug 359331: modutil -changepw strict shutdown failure bug 373367: verify ocsp response signature in libpkix without decoding and reencoding bug 390542: libpkix fails to validate a chain that consists only of one self issued, trusted cert bug 390728: pkix_pl_ocsprequest_create throws an error if it was not able to get aia location bug 397825: libpkix: ifdef code that uses user object types bug 397832: libpkix leaks memory if a macro calls a function that returns an error bug 402727: functions responsible for creating an object leak if subsequent function code produces an error bug 402731: pkix_pl_pk11certstore...
NSS 3.39 release notes
nss 3.39 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_39_rtm/src/ new in nss 3.39 new functionality the tstclnt and selfserv utilities added support for configuring the enabled tls signature schemes using the -j parameter.
... the tstclnt and selfserv test utilities no longer accept the -z parameter, as support for tls compression was removed in a previous nss version.
NSS 3.47 release notes
does not store nickname for ec keys bug 1586456 - unnecessary conditional in pki3hack, pk11load and stanpcertdb bug 1576307 - check mechanism param and param length before casting to mechanism-specific structs bug 1577953 - support longer (up to rfc maximum) hkdf outputs bug 1508776 - remove refcounting from sftk_freesession (cve-2019-11756) bug 1494063 - support tls exporter in tstclnt and selfserv bug 1581024 - heap overflow in nss utility "derdump" bug 1582343 - soft token mac verification not constant time bug 1578238 - handle invald tag sizes for ckm_aes_gcm bug 1576295 - check all bounds when encrypting with seed_cbc bug 1580286 - nss rejects tls 1.2 records with large padding with sha384 hmac bug 1577448 - create additional nested s/mime test messages for thunderbird bug 13...
... bug 1542207 - limit policy check on signature algorithms to known algorithms bug 1560329 - drbg: add continuous self-test on entropy source bug 1579290 - asan builds should disable lsan while building bug 1385061 - build nspr tests with nss make; add gyp parameters to build/run nspr tests bug 1577359 - build atob and btoa for thunderbird bug 1579036 - confusing error when trying to export non-existent cert with pk12util bug 1578626 - [cid 1453375] ub: decrement nullptr.
NSS PKCS11 Functions
do not try to free the string yourself.
...do not try to free the string yourself.
FC_Initialize
in addition to creating the internal data structures, it performs the fips software integrity test and power-up self-tests.
...(note: we probably should return ckr_host_memory instead.) the software integrity test or power-up self-tests failed.
pkfnc.html
do not try to free the string yourself.
...do not try to free the string yourself.
NSS Tools modutil
each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform.
...typically this string would be used for a setup program provided by a module vendor, such as a self-extracting setup.exe.
Necko Architecture
because a uri has no self knowledge about what "protocol" it represents, another component is responsible for deciding which channel implementation will be responsible for "loading" the uri.
...for example, the http protocol handler registers itself as the protocol handler for "http." the http protocol handler creates http channels for http urls.
Rhino scopes and contexts
this is a large topic in itself, but for our purposes it gives us an easy way to share a set of read-only variables across multiple scopes.
...to seal all objects in the standard library passtrue for the sealed argument when calling context.initstandardobjects(scriptableobject, boolean): scriptableobject sealedsharedscope = cx.initstandardobjects(null, true); this seals only all standard library objects, it does not seal the shared scope itself thus after callinginitstandardobjects, sealedsharedscope can be farther populated with application-specific objects and functions.
Scripting Java
this works just as in java, with the use of the new operator: js> new java.util.date() thu jan 24 16:18:17 est 2002 if we store the new object in a javascript variable, we can then call methods on it: js> f = new java.io.file("test.txt") test.txt js> f.exists() true js> f.getname() test.txt static methods and fields can be accessed from the class object itself: js> java.lang.math.pi 3.141592653589793 js> java.lang.math.cos(0) 1 in javascript, unlike java, the method by itself is an object and can be evaluated as well as being called.
... if we just view the method object by itself we can see the various overloaded forms of the method: js> f.listfiles function listfiles() {/* java.io.file[] listfiles() java.io.file[] listfiles(java.io.filenamefilter) java.io.file[] listfiles(java.io.filefilter) */} this output shows that the file class defines three overloaded methods listfiles: one that takes no arguments, another with a filenamefilter argument, and a third with a filefilter argument.
Rhino shell
(the system command prompt is shown as $.) the first invocation executes a script specified on the command line itself.
...finally, the last invocation executes a script from a file and accesses arguments to the script itself.
Hacking Tips
linker linker(masm); (gdb) n 4784 ioncode *code = linker.newcode(cx, jsc::ion_code); (gdb) n 4785 if (!code) (gdb) p code->code_ $1 = (uint8_t *) 0xf7fd25a8 "\201", <incomplete sequence \354\200> (gdb) x/2i 0xf7fd25a8 0xf7fd25a8: sub $0x80,%esp 0xf7fd25ae: mov 0x94(%esp),%ecx on arm, the compiled js code will always be arm machine code, whereas spidermonkey itself is frequently thumb2.
...(gdb) continue compiling self-hosted:650:20470-21501 bailout from self-hosted:20:403-500 invalidate self-hosted:20:403-500 note: the line 3196, listed above, corresponds to the location of the jit spew inside jit::invalidate function.
Garbage collection
by definition, a weak reference should not hold a target live by itself.
...the private field itself is opaque to the engine, but it may point to things that need to be marked, e.g., an array of jsobject pointers.
Property attributes
some objects like function/object have self-hosted functions that can only be defined after the initialization is already finished.
...this keeps the resolve hook from accidentally triggering itself: unchecked recursion.
JSAPI reference
ince javascript 1.8.5 struct jsobjectops obsolete since javascript 1.8.5 struct jsxmlobjectops obsolete since javascript 1.8.5 struct jsproperty obsolete since jsapi 16 adding native properties and methods to classes: jsnative struct jsfunctionspec js_fs added in spidermonkey 1.8 js_fn added in spidermonkey 1.8 js_sym_fn added in spidermonkey 38 js_fninfo added in spidermonkey 17 js_self_hosted_fn added in spidermonkey 31 js_self_hosted_sym_fn added in spidermonkey 38 js_sym_fnspec added in spidermonkey 38 js_fnspec added in spidermonkey 31 js_fs_end added in spidermonkey 1.8 struct jspropertyspec js_psg added in spidermonkey 17 js_psgs added in spidermonkey 17 js_self_hosted_get added in spidermonkey 31 js_self_hosted_getset added in spidermonkey 31 js_ps_end added in ...
... 38 js_getfunctionobject js_getfunctionflags obsolete since jsapi 19 js_getfunctionname obsolete since javascript 1.8.5 creating functions: js::clonefunctionobject added in spidermonkey 36 js_definefunction js_defineucfunction js_definefunctionbyid added in spidermonkey 17 js_definefunctions enum propertydefinitionbehavior added in spidermonkey 38 js_newfunction js::getselfhostedfunction added in jsapi 31 js::newfunctionfromspec added in jsapi 45 js_newfunctionbyid added in spidermonkey 17 obsolete since jsapi 44 js_clonefunctionobject obsolete since jsapi 36 regexps js_newregexpobject jsreg_fold jsreg_glob jsreg_multiline jsreg_sticky js_newucregexpobject js_newregexpobjectnostatics js_newucregexpobjectnostatics js_setregexpinput...
Split object
it represents the window or tab itself and survives as the user navigates in that window or tab.
...spidermonkey's split object support, by itself, does not cause inner object properties to appear on the outer object or vice versa.
Redis Tips
i haven't yet used bitstrings in production myself.
... but before you start cramming huge messes of stringified json in your db, check in with your gut and ask yourself: does the structure of the json matter for my queries?
Setting up an update server
there are two common ways to obtain a mar to use: download a prebuilt one, or build one yourself.
...part of the problem is that mars are signed by mozilla and so you cannot really build an "official" mar yourself.
Retrieving part of the bookmarks tree
as long as the container is open, it will listen for notifications from the bookmarks system to keep itself up-to-date.
...otherwise, it will continue to get observer notifications and update itself, slowing down the whole browser.
XPCOM array guide
MozillaTechXPCOMGuideArrays
the only functional drawback to in-place enumeration is that you cannot manipulate the array itself during the enumeration.
...as a class member, nscomarray<t> is preferred over nsiarray when access to the array is confined to the class itself.
Avoiding leaks in JavaScript XPCOM components
when this count goes to zero, the object destroys itself.
... it's also worth noting that failing to unregister an observer that's attached to something temporary (such as a controller or event listener) can cause the garbage collector to take an extra cycle to clean up everything that was associated with a document if the temporary object itself is destroyed as a result of garbage collection.
Profiling XPCShell
a profile will look like this: file:///users/michiel/mozilla/tree1/...js/calutils.js [2,25420] createdatetime() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_qi() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} the first line tells which file was profiled.
...the line consists of: the compile count of the function; the call count of the function; the functions name; the starting line number; the ending line number; the function's size; the amount of time (in milliseconds) the fastest call took; the time of the slowest call; the average time spend; the total time; the time spend in the function itself is given (that is the total time excluding the time spend in functions called from this function).
nsACString
self_type [nsacstring] an alias for the type of this class.
...nsacstring by itself does not imply a particular character encoding.
nsAString
self_type [nsastring] an alias for the type of this class.
...nsastring by itself does not imply a particular character encoding.
imgIContainer
create a new imgcontainer that contains only a single frame, which itself contains a subregion of the current frame.
... return value missing description exceptions thrown missing exception missing description native code only!extractframe create a new imgcontainer that contains only a single frame, which itself contains a subregion of the given frame.
mozIAsyncFavicons
it's better to not use this function for chrome: icon uris since you can reference the chrome image yourself.
...it's better to not use this function for chrome: icon uris since you can reference the chrome image yourself.
mozIRegistry
i think a simple clsid "alias" mechanism (equivalent to com's "component categories" in some respects), along with the ability to "set" services (versus the service manager insisting on creating the services itself) would suffice.
...one could then make the nsrepository itself a service and permit full (?!) de-coupling of xpcom modules from the xpcom implementation.
nsIComponentRegistrar
this value is passed into the nsimodule.registerself() callback and must be forwarded unmodified when registering factories via their location.
...this value is passed into thensimodule.registerself() callback and must be forwarded unmodified when registering factories via their location.
nsIDOMWindowInternal
domstring atob(in domstring aasciistring) domstring btoa(in domstring abase64data) nsivariant showmodaldialog(in nsivariant aargs, [optional] in domstring aoptions) void postmessage(in domstring message, in domstring targetorigin) attributes attribute type description window nsidomwindowinternal readonly: the window object itself.
... self nsidomwindowinternal readonly: returns an object reference to the window object.
nsIExternalProtocolService
note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself.
...note: aprotocolscheme should not include a trailing colon, which is part of the uri syntax, not part of the scheme itself (that is pass "mailto" not "mailto:").
nsIFaviconService
you should reference the chrome image yourself.
...you should reference the chrome image yourself.
nsIFile
using the native form limits the ability of your code to deal with the full unicode support on windows 2000 or later where the os itself does not have such a limitation.
...(it does not clone the file itself; see the copy methods.) nsifile clone(); parameters none.
nsINavHistoryResult
while the result waits to be collected it will stay in memory, and continue to update itself, potentially causing unwanted additional work.
...the viewer is responsible for actually updating the view object itself, as well as for handling events on the view.
nsISupports proxies
it will take care of freeing the "real" object as well as itself.
... if you have created the object yourself and then created the proxy, please note that you will have at least a refcount of 2 (one for the proxy and one for the created object which you passed into getproxyobject, plus any other refcounts which you may have).
nsITransferable
adata on return, this is the data itself, which is an instance of a class based upon nsisupportsprimitives.
... adata on return, this is the data itself, which is an instance of a class based upon nsisupportsprimitives.
nsIWebBrowserChrome
in this case the implementer is responsible for taking the new webbrowser object and doing any necessary initialization or setup as if it had created the webbrowser itself.
...sizebrowserto() tells the chrome to size itself such that the browser will be the specified size.
nsIWorkerGlobalScope
this interface allows a worker to look up information about itself, as well as to control itself.
... onerror nsidomeventlistener self nsiworkerglobalscope returns the global scope object itself.
XPCOM ownership guidelines
such a function is the perfect example of something that creates an object with a longer lifespan that itself, and gives away ownership (by producing a pointer that is already addrefed) --- in this case, to the caller.
... needing it isn't, by itself, a valid reason for owning it.
XPCOM
xpcom itself provides a set of core components and classes, e.g.
...like the standard libraries, xpcom must be a fairly self-contained library, so as not to encumber clients with any unnecessary external dependencies.xpcom thread synchronizationxpcom thread synchronization primitives have the same semantics as those in nspr, and each method of these synchronization objects (e.g.
XPIDL
xpidl itself does not interpret this string, it just literally pastes it anywhere the native type is used.
...naturally, a method which contains a retval parameter must be declared void, and the parameter itself must be an out parameter and the last parameter.
XUL Overlays
MozillaTechXULOverlays
for any package, the master skin file is that css file named after the package itself.
...3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <menu id="file_menu"> <menuitem name="example one"/> <menuitem name="example two"/> <menuitem name="example three"/> <menuitem name="example four" position="1"/> </menu> </overlay> the node with the position attribute orders itself to the top of the menu.
Working with windows in chrome code
content windows when a xul window contains a widget capable of displaying a page, such as <browser> or <iframe>, the document in that widget is, naturally, separate from the document of the chrome window itself.
... abusing the preferences service and not cleaning up after yourself can cause prefs.js to grow large and slow down application startup.
XPI
an xpi contains installation instructions (install.js or install.rdf) as well as the actual software to install, which is often itself packaged as a jar file.
...instead, the xpi itself is placed in the extensions directory, and files are loaded directly out of the package.
PKCS #11 Netscape Trust Objects - Network Security Services
trusted: the certificate itself is explicitly trusted.
... there are two ways to refer to a certificate depending on whether that certificate is self-signed (like a certificate authority) or signed by another trusted certificate.
Plug-in Basics - Plugins
the next section, how gecko finds plug-ins, describes these rules, and the following section, checking plug-ins by mime type, describes how you can use javascript to locate plug-ins yourself and establish which ones are to be registered for which mime types.
... plug-ins were originally designed to work with the embed element rather than the object element (see using the embed element for plug-in display), but the object element itself provides some flexibility here.
Plug-in Development Overview - Plugins
drawing a plug-in instance before drawing itself on the page, the plug-in must provide information about itself, set the window or other target in which it draws, arrange for redrawing, and handle events.
... a windowless plug-in can call the following netscape methods to draw itself: npn_forceredraw: force a paint message for windowless plug-ins.
Streams - Plugins
the plug-in can terminate the stream itself by calling npn_destroystream.
...*/ err = npn_destroystream(instance, stream, npres_done); your plug-in can create another instance of itself by specifying its own mime type and a new target name in a call to npn_newstream.
DOM Inspector internals - Firefox Developer Tools
this separation allows for viewers to be self-contained, with a viewer's xul defined in its own document and loaded in its own scope, without fear of collisions in the xul, css, or js.
...inspector.xul itself is only a skeleton describing the basic structure and layout of the primary dom inspector window, leaving most of its contents to be added by the overlays.
Set a logpoint - Firefox Developer Tools
it’s faster than changing the underlying source code itself to add calls to the console.log method.
... if you need to execute additional logic related to the source code and you can’t change the source code itself, you can use a logpoint.
Debugger.Memory - Firefox Developer Tools
however, the memory consumed by the string itself is a small constant independent of its size, since it is simply a reference to the larger string, a start position, and a length.
...again, such a string retains other strings, but the memory consumed by the string itself is a small constant independent of its size, since it is simply a pair of pointers.
Debugger.Object - Firefox Developer Tools
call(this,argument, …) if the referent is callable, call it with the giventhis value andargument values, and return a completion value describing how the call completed.this should be a debuggee value, or { asconstructor: true } to invoke the referent as a constructor, in which case spidermonkey provides an appropriate this value itself.
... apply(this,arguments) if the referent is callable, call it with the giventhis value and the argument values inarguments, and return a completion value describing how the call completed.this should be a debuggee value, or { asconstructor: true } to invokefunction as a constructor, in which case spidermonkey provides an appropriate this value itself.arguments must either be an array (in the debugger) of debuggee values, or null or undefined, which are treated as an empty array.
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
indeed, this display shows that popup.xml and content.js, which are internal components of firefox, allocated more objects in the page's compartment than the page itself.
...(the line number for the onclick handler is 1, indicating that the allocating call is located on line one of the handler text itself.
Firefox Developer Tools
browser console see messages logged by the browser itself and by add-ons, and run javascript code in the browser's scope.
... browser toolbox attach the developer tools to the browser itself.
AbstractRange - Web APIs
contents of elements when trying to access the contents of an element, keep in mind that the element itself is a node, but so is any text inside it.
... with the text node reference in hand, we create a new range object by calling createrange() on the document itself.
Background Tasks API - Web APIs
as a result, while our shim doesn't constrain itself to the amount of idle time left in the current event loop pass like the true requestidlecallback(), it does at least limit the callback to no more than 50 milliseconds of run time per pass.
...this element is a pseudo-dom into which we can insert elements without immediately changing the main dom itself.
Using the Beacon API - Web APIs
sole.log("worker reply: sendbeacon() status = " + msg); }; } this code snippet is for the worker (worker-using.js): onmessage = function(event) { var msg = event.data; // split the url and data from the message var url = msg[0]; var data = msg[1]; // if the browser supports worker sendbeacon(), then send the beacon; otherwise // return failure message to the global context if (self.navigator.sendbeacon) { var status = self.navigator.sendbeacon(url, data); postmessage(status ?
... "success" : "fail"); } else { postmessage("worker: self.navigator.sendbeacon is unsupported"); } } see also beacon api (overview) beacon standard beacon caniuse data ...
Managing screen orientation - Web APIs
the second way is the javascript screen orientation api that can be used to get the current orientation of the screen itself and eventually lock it.
... listening orientation change the orientationchange event is triggered each time the device change the orientation of the screen and the orientation itself can be read with the screen.orientation property.
Cache - Web APIs
WebAPICache
var cache_version = 1; var current_caches = { font: 'font-cache-v' + cache_version }; self.addeventlistener('activate', function(event) { // delete all caches that aren't named in current_caches.
... console.log('deleting out of date cache:', cachename); return caches.delete(cachename); } }) ); }) ); }); self.addeventlistener('fetch', function(event) { console.log('handling fetch event for', event.request.url); event.respondwith( caches.open(current_caches.font).then(function(cache) { return cache.match(event.request).then(function(response) { if (response) { // if there is an entry in the cache for event.request, then response will be defined // and we can j...
CacheStorage - Web APIs
self.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.addall([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittl...
...evader.jpg', '/sw-test/gallery/snowtroopers.jpg' ]); }) ); }); self.addeventlistener('fetch', function(event) { event.respondwith(caches.match(event.request).then(function(response) { // caches.match() always resolves // but in case of success response will have value if (response !== undefined) { return response; } else { return fetch(event.request).then(function (response) { // response may be used only once // we need to save clone to put one copy in cache // and serve second one let responseclone = response.clone(); caches.open('v1').then(function (cache) { cache.put(event.request, responseclone); }); return response; }).catch(function () { return caches.match...
Drawing shapes with canvas - Web APIs
to try this for yourself, you can use the code snippet below.
...radius is self-explanatory.
Using images - Web APIs
screenshotlive sample the script itself is very simple.
... the code below should be self-explanatory.
Clients.claim() - Web APIs
WebAPIClientsclaim
the claim() method of the clients interface allows an active service worker to set itself as the controller for all clients within its scope.
... self.addeventlistener('activate', event => { event.waituntil(clients.claim()); }); specifications specification status comment service workersthe definition of 'claim()' in that specification.
Clients.get() - Web APIs
WebAPIClientsget
syntax self.clients.get(id).then(function(client) { // do something with your returned client }); parameters id a domstring representing the id of the client you want to get.
... examples self.clients.get(id).then(function(client) { self.clients.openwindow(client.url); }); specifications specification status comment service workersthe definition of 'get()' in that specification.
Clients.openWindow() - Web APIs
syntax self.clients.openwindow(url).then(function(windowclient) { // do something with your windowclient }); parameters url a usvstring representing the url of the client you want to open in the window.
... examples // send notification to os if applicable if (self.notification.permission === 'granted') { const notificationobject = { body: 'click here to view your messages.', data: { url: self.location.origin + '/some/path' }, // data: { url: 'http://example.com' }, }; self.registration.shownotification('you\'ve got messages!', notificationobject); } // notification click event listener self.addeventlistener('notificationclick', e => { // close the notification popout e.notification.close(); // get all the window clients e.waituntil(clients...
Clients - Web APIs
WebAPIClients
access it via self.clients within a service worker.
... clients.claim() allows an active service worker to set itself as the controller for all clients within its scope.
Content Index API - Web APIs
they are accessible from the workerglobalscope.self property: // service worker script self.registration.index.add(item); self.registration.index.delete(item.id); const contentindexitems = self.registration.index.getall(); contentdelete event when an item is removed from the user agent interface, a contentdelete event is received by the service worker.
... self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); the contentdelete event is only fired when the deletion happens due to interaction with the browser's built-in user interface.
DedicatedWorkerGlobalScope.name - Web APIs
syntax var nameobj = self.name; value a domstring.
... example if a worker is created using a constructor with a name option: var myworker = new worker("worker.js", { name : "myworker" }); the dedicatedworkerglobalscope will now have a name of "myworker", returnable by running self.name from inside the worker.
DedicatedWorkerGlobalScope - Web APIs
the dedicatedworkerglobalscope object (the worker global scope) is accessible through the self keyword.
... properties inherited from workerglobalscope workerglobalscope.self returns an object reference to the dedicatedworkerglobalscope object itself.
Document.getElementsByTagName() - Web APIs
the returned htmlcollection is live, meaning that it updates itself automatically to stay in sync with the dom tree without having to call document.getelementsbytagname() again.
... clicking the buttons uses getelementsbytagname() to count the descendant paragraph elements of a particular parent (either the document itself or one of two nested <div> elements).
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
these characters allow you to format your code in a way that will make it easily readable by yourself and other people.
...; height: 2em; background: #f06; border: 1px solid; } <ul class="people-list"> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> you probably don't want the gaps in between the blocks — depending on the use case (is this a list of avatars, or horizontal nav buttons?), you probably want the element sides flush with each other, and to be able to control any spacing yourself.
Element.closest() - Web APIs
WebAPIElementclosest
will return itself or the matching ancestor.
... <article> <div id="div-01">here is div-01 <div id="div-02">here is div-02 <div id="div-03">here is div-03</div> </div> </div> </article> javascript var el = document.getelementbyid('div-03'); var r1 = el.closest("#div-02"); // returns the element with the id=div-02 var r2 = el.closest("div div"); // returns the closest ancestor which is a div in div, here it is the div-03 itself var r3 = el.closest("article > div"); // returns the closest ancestor which is a div and has a parent article, here it is the div-01 var r4 = el.closest(":not(div)"); // returns the closest ancestor which is not a div, here it is the outmost article polyfill for browsers that do not support element.closest(), but carry support for element.matches() (or a prefixed equivalent, meaning ie9+), a ...
Element.insertAdjacentElement() - Web APIs
syntax targetelement.insertadjacentelement(position, element); parameters position a domstring representing the position relative to the targetelement; must match (case-insensitively) one of the following strings: 'beforebegin': before the targetelement itself.
... 'afterend': after the targetelement itself.
Element.insertAdjacentHTML() - Web APIs
syntax element.insertadjacenthtml(position, text); parameters position a domstring representing the position relative to the element; must be one of the following strings: 'beforebegin': before the element itself.
... 'afterend': after the element itself.
Element.insertAdjacentText() - Web APIs
syntax element.insertadjacenttext(position, element); parameters position a domstring representing the position relative to the element; must be one of the following strings: 'beforebegin': before the element itself.
... 'afterend': after the element itself.
Element.scrollTop - Web APIs
WebAPIElementscrollTop
scrolltop doesn't respond to negative values; instead, it sets itself back to 0.
... if set to a value greater than the maximum available for the element, scrolltop settles itself to the maximum value.
Element.shadowRoot - Web APIs
you'll see that we are passing it this (the custom element itself) as a parameter.
... connectedcallback() { console.log('custom square element added to page.'); updatestyle(this); } attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot.
FetchEvent.respondWith() - Web APIs
the respondwith() method of fetchevent prevents the browser's default fetch handling, and allows you to provide a promise for a response yourself.
... if a worker script is intercepted, then the final url is used to set self.location and used as the base url for relative urls in the worker script.
FileSystemEntry.copyTo() - Web APIs
there are some typical restrictions on what you can do: a directory can't be copied into itself.
... errors fileerror.invalid_modification_err the requested operation involves an impossible change, such as moving a directory inside itself or one of its own child directories, or copying an item within the same directory without renaming it.
FileSystemEntry.moveTo() - Web APIs
there are some typical restrictions on what you can do: a directory can't be moved into itself.
... errors fileerror.invalid_modification_err the requested operation involves an impossible change, such as moving a directory inside itself or one of its own child directories, or copying an item within the same directory without renaming it.
FileHandle API - Web APIs
if you want a file to survive a page refresh/app relaunch, you need to store the handle in a more permanent location, like the database itself.
...the database itself only stores a pointer to that file.
Using FormData Objects - Web APIs
creating a formdata object from scratch you can build a formdata object yourself, instantiating it then appending fields to it by calling its append() method, like this: var formdata = new formdata(); formdata.append("username", "groucho"); formdata.append("accountnum", 123456); // number 123456 is immediately converted to a string "123456" // html file input, chosen by user formdata.append("userfile", fileinputelement.files[0]); // javascript file-like object var content...
... this allows a formdata object to be quickly obtained in response to a formdata event firing, rather than needing to put it together yourself.
Guide to the Fullscreen API - Web APIs
to get the same fullscreen behavior in webkit, you need to add your own "width: 100%; height: 100%;" css rules to the element yourself: #myvideo:-webkit-full-screen { width: 100%; height: 100%; } on the other hand, if you're trying to emulate webkit's behavior on gecko, you need to place the element you want to present inside another element, which you'll make fullscreen instead, and use css rules to adjust the inner element to match the appearance you want.
...note that the fullscreenchange event doesn't provide any information itself as to whether the document is entering or exiting fullscreen mode, but if the document has a non null fullscreenelement, you know you're in fullscreen mode.
GlobalEventHandlers.onanimationcancel - Web APIs
300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... first is the box itself, with all its properties, including animation, defined.
GlobalEventHandlers.onanimationend - Web APIs
:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... first is the box itself.
GlobalEventHandlers.onanimationiteration - Web APIs
:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... first is the box itself.
GlobalEventHandlers.onanimationstart - Web APIs
:300px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 46px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 1.4em "lucida grande", "open sans", sans-serif; } leaving out some bits of the css that don't matter for the discussion here, let's take a look at the styles for the box that we're animating.
... first is the box itself.
HTMLElement.offsetTop - Web APIs
1samsung internet android full support 1.0legend full support full support in compliance with the specification, this property will return null on webkit if the element is hidden (the style.display of this element or any ancestor is "none") or if the style.position of the element itself is set to "fixed".
... this property will return null on internet explorer (9) if the style.position of the element itself is set to "fixed".
HTMLFormElement.requestSubmit() - Web APIs
if you omit the submitter parameter, the form element itself is used as the submitter.
...otherwise, the form is submitted with no submitter parameter, so it's submitted directly by the form itself.
HTMLIFrameElement - Web APIs
this attribute also accepts the values self and src which represent the origin in the iframe's src attribute.
... htmliframeelement.csp specifies the content security policy that an embedded document must agree to enforce upon itself.
HTMLMediaElement.load() - Web APIs
this method is generally only useful when you've made dynamic changes to the set of sources available for the media element, either by changing the element's src attribute or by adding or removing <source> elements nested within the media element itself.
... appropriate events will be sent to the media element itself as the load process proceeds: if the element is already in the process of loading media, that load process is aborted and the abort event is sent.
In depth: Microtasks and the JavaScript runtime environment - Web APIs
your web site or app's code runs in the same thread, sharing the same event loop, as the user interface of the web browser itself.
... problems because your code runs in the same thread, using the same event loop, as the browser's user interface, if your code blocks or enters an infinite loop, the browser itself will stall.
Recommended Drag Types - Web APIs
for example: event.datatransfer.setdata("text/plain", "this is text to drag"); dragging text in textboxes and selections on web pages is done automatically by the browser, so you do not need to handle it yourself.
....value.queryinterface(components.interfaces.nsilocalfile); console.log("target folder is = " + dir.path); var file = cc['@mozilla.org/file/local;1'].createinstance(components.interfaces.nsilocalfile); file.initwithpath(dir.path); file.appendrelativepath(name); console.log("output final path is =" + file.path); // now you can write or copy the file yourself… } } } see also html drag and drop api (overview) drag operations dragging and dropping multiple items html5 living standard: drag and drop ...
Intersection Observer API - Web APIs
each colored box within it displays the percentage of itself that's visible in all four of its corners, so you can see these ratios change over time as you scroll the container.
...the callback receives as input an array of all of intersectionobserverentry objects, one for each threshold which was crossed, and a reference to the intersectionobserver object itself.
Key Values - Web APIs
if pressed by itself, it doesn't generate a character.
... vk_video_mode_next gdk_key_next_vmode (0x1008fe22) "wink" causes the device to identify itself in some fashion, such as by flashing a light, briefly changing the brightness of indicator lights, or emitting a tone.
Capabilities, constraints, and settings - Web APIs
in addition, the only acceptable input device is a camera facing the user (a "selfie cam").
... below all of that, you'll see the video itself.</p> <p>click the "start" button to begin.</p> <h3>constrainable properties available:</h3> <ul id="supportedconstraints"> </ul> <div id="startbutton" class="button"> start </div> <div class="wrapper"> <div class="trackrow"> <div class="leftside"> <h3>requested video constraints:</h3> <textarea id="videoconstrainteditor" cols=32 rows=8></textarea> </div> <div class="r...
NavigationPreloadManager - Web APIs
examples feature detecting and enabling navigation preloading addeventlistener('activate', event => { event.waituntil(async function() { if (self.registration.navigationpreload) { // enable navigation preloads!
... await self.registration.navigationpreload.enable(); } }()); }); using a preloaded response the following example shows the implementation of a fetch event that uses a preloaded response.
Node.contains() - Web APIs
WebAPINodecontains
the node itself, one of its direct children (childnodes), one of the children's direct children, and so on.
...as contains is inclusive and determining if the body contains itself isn't the intention of isinpage this case explicitly returns false.
Notification.Notification() - Web APIs
badge: a usvstring containing the url of the image used to represent the notification when there isn't enough space to display the notification itself.
...these are options the user can choose among in order to act on the action within the context of the notification itself.
NotificationAction - Web APIs
notificationaction.icon read only the url of the image used to represent the notification when there is not enough space to display the notification itself.
... self.registration.shownotification("new mail from alice", { actions: [ { action: 'archive', title: 'archive' } ] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'archive') { // archive action was clicked archiveemail(); } else { // main body of notification was clicked clients.openwindow('/inbox'); } }, false); specifications ...
ProgressEvent() - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
...when downloading a resource using http, this only represent the content itself, not headers and other overhead.
ProgressEvent.initProgressEvent() - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
...when downloading a resource using http, this only represent the content itself, not headers and other overhead.
ProgressEvent - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
...when downloading a resource using http, this only represent the content itself, not headers and other overhead.
PushEvent - Web APIs
WebAPIPushEvent
self.addeventlistener('push', function(event) { if (!(self.notification && self.notification.permission === 'granted')) { return; } var data = {}; if (event.data) { data = event.data.json(); } var title = data.title || "something has happened"; var message = data.message || "here's something you might want to check out."; var icon = "images/new-notification.png"; var notifi...
...cation = new self.notification(title, { body: message, tag: 'simple-push-demo-notification', icon: icon }); notification.addeventlistener('click', function() { if (clients.openwindow) { clients.openwindow('https://example.blog.com/2015/03/04/something-new.html'); } }); }); specifications specification status comment push apithe definition of 'pushevent' in that specification.
RTCIceCandidate.relatedAddress - Web APIs
the related address and port (relatedport) are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values.
... usage notes the related address is included in ice candidates despite not being used by ice itself.
RTCIceCandidate.relatedPort - Web APIs
the related address (relatedaddress) and port are not used at all by ice itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values.
... usage notes the related address and port are not used by ice itself, and are only present for diagnostic and quality-of-service purposes.
RTCSessionDescription() - Web APIs
this constructor has been deprecated because rtcpeerconnection.setlocaldescription() and other methods which take sdp as input now directly accept an object conforming to the rtcsessiondescriptioninit dictionary, so you don't have to instantiate an rtcsessiondescription yourself.
... this is no longer necessary, however; rtcpeerconnection.setlocaldescription() and other methods which take sdp as input now directly accept an object conforming to the rtcsessiondescriptioninit dictionary, so you don't have to instantiate an rtcsessiondescription yourself.
RTCTrackEvent - Web APIs
this event is sent by the webrtc layer to the web site or application, so you will not typically need to instantiate an rtctrackevent yourself.
...you will probably not need to create new track events yourself, since they're typically created by the webrtc infrastructure and sent to the connection's ontrack event handler.
ResizeObserver() - Web APIs
observer a reference to the resizeobserver itself, so it will definitely be accessible from inside the callback, should you need it.
... the callback will generally follow a pattern along the lines of: function(entries, observer) { for (let entry of entries) { // do something to each entry // and possibly something to the observer itself } } examples the following snippet is taken from the resize-observer-text.html (see source) example: const resizeobserver = new resizeobserver(entries => { for (let entry of entries) { if(entry.contentboxsize) { h1elem.style.fontsize = math.max(1.5, entry.contentboxsize.inlinesize/200) + 'rem'; pelem.style.fontsize = math.max(1, entry.contentboxsize.inlinesize/600) + 'rem'; } else { h1elem.style...
SVGMarkerElement - Web APIs
exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only.
... exceptions: a domexception with code no_modification_allowed_err is raised when the object itself is read only.
Using the Screen Capture API - Web APIs
it doesn't establish a restriction on the size of the source itself.
... for example, this line in the http headers will enable screen capture api for the document and any embedded <iframe> elements that are loaded from the same origin: feature-policy: display-capture 'self' if you're performing screen capture within an <iframe>, you can request permission just for that frame, which is clearly more secure than requesting a more general permission: <iframe src="https://mycode.example.net/etc" allow="display-capture"> </iframe> ...
ServiceWorkerGlobalScope: notificationclick event - Web APIs
bubbles no cancelable no interface notificationevent event handler onnotificationclick examples you can use the notificationclick event in an addeventlistener method: self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.
...url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); or use the onnotificationclick event handler property: self.onnotificationclick = function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }; specifications specification ...
ServiceWorkerGlobalScope.onnotificationclick - Web APIs
notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a click event on the notification object itself.
...}; example self.onnotificationclick = function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }; spec...
onnotificationclose - Web APIs
notifications created on the main thread or in workers which aren't service workers using the notification() constructor will instead receive a close event on the notification object itself.
...self.onnotificationclose = function(event) { console.log('on notification close: ', event.notification.tag); }; specifications specification status comment notifications apithe definition of 'onnotificationclick' in that specification.
ServiceWorkerGlobalScope.onpush - Web APIs
} self.addeventlistener('push', function(pushevent) { ...
...the data payload of the push message is available in the event object's data property (pushevent.data, which contains a pushmessagedata object.) self.addeventlistener('push', function(event) { if (!(self.notification && self.notification.permission === 'granted')) { return; } var data = {}; if (event.data) { data = event.data.json(); } var title = data.title || "something has happened"; var message = data.message || "here's something you might want to check out."; var icon = "images/new-notification.png"; var notification = new notification(title, { body: message, tag: 'simple-push-demo-notification', icon: icon }); notification.
ServiceWorkerGlobalScope.onpushsubscriptionchange - Web APIs
} self.addeventlistener('pushsubscriptionchange', function() { ...
... }) example self.addeventlistener('pushsubscriptionchange', function() { // do something, usually resubscribe to push and // send the new subscription details back to the // server via xhr or fetch }); specifications specification status comment push apithe definition of 'onpushsubscriptionchange' in that specification.
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
self.addeventlistener("pushsubscriptionchange", event => { event.waituntil(swregistration.pushmanager.subscribe(event.oldsubscription.options) .then(subscription => { return fetch("register", { method: "post", headers: { "content-type": "application/json" }, body: json.stringify({ endpoint: subscription.endpoint }) }); }...
... you can also use the onpushsubscriptionchange event handler property to set up the event handler: self.onpushsubscriptionchange = event => { event.waituntil(swregistration.pushmanager.subscribe(event.oldsubscription.options) .then(subscription => { /* ...
ShadowRoot - Web APIs
you'll see that we are passing it this (the custom element itself) as a parameter.
... connectedcallback() { console.log('custom square element added to page.'); updatestyle(this); } attributechangedcallback(name, oldvalue, newvalue) { console.log('custom square element attributes changed.'); updatestyle(this); } in the updatestyle() function itself, we get a reference to the shadow dom using element.shadowroot.
SharedWorkerGlobalScope.applicationCache - Web APIs
syntax var nameobj = self.applicationcache; value an applicationcache.
... example if a shared worker has an appcache associated with it, you can return a reference to the cache using self.applicationcache from inside the shared worker.
SharedWorkerGlobalScope: connect event - Web APIs
self.onconnect = function(e) { var port = e.ports[0]; port.onmessage = function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); } port.start(); } for a complete running example, see our basic shared worker example (run shared worker.) addeventlistener equivalent you could also set up an event handler using the addeventliste...
...ner() method: self.addeventlistener('connect', function(e) { var port = e.ports[0]; port.onmessage = function(e) { var workerresult = 'result: ' + (e.data[0] * e.data[1]); port.postmessage(workerresult); } }); specifications specification status html living standardthe definition of 'connect event' in that specification.
SharedWorkerGlobalScope.name - Web APIs
syntax var nameobj = self.name; value a domstring.
... example if a shared worker is created using a constructor with a name option: var myworker = new sharedworker("worker.js", { name : "mysharedworker" }); the sharedworkerglobalscope will now have a name of "mysharedworker", returnable by running self.name from inside the shared worker.
SharedWorkerGlobalScope - Web APIs
the sharedworkerglobalscope object (the sharedworker global scope) is accessible through the self keyword.
... properties inherited from workerglobalscope workerglobalscope.self returns an object reference to the dedicatedworkerglobalscope object itself.
SubtleCrypto.unwrapKey() - Web APIs
*/ const saltbytes = [89,113,135,234,168,204,21,36,55,93,1,132,242,242,192,156]; /* the wrapped key itself.
...*/ const ivbytes = [212,187,26,247,172,51,37,151,27,177,249,142]; /* the wrapped key itself.
TextEncoder.prototype.encodeInto() - Web APIs
typeof self == "" + void 0 ?
... this : self : global); source: https://github.com/anonyco/fastestsmallesttextencoderdecoder specifications specification status comment encodingthe definition of 'textencoder.encode()' in that specification.
WebGLRenderingContext.getUniformLocation() - Web APIs
once you have the uniform's location, you can access the uniform itself using one of the other uniform access methods, passing in the uniform location as one of the inputs: getuniform() returns the value of the uniform at the given location.
... the uniform itself is declared in the shader program using glsl.
Clearing with colors - Web APIs
we are giving the event // handler a name (setupwebgl) so that we can refer to the // function object within the function itself.
...the event handler removes // itself, because it only needs to run once.
Getting started with WebGL - Web APIs
it's assumed that you already have an understanding of the mathematics involved in 3d graphics, and this article doesn't pretend to try to teach you 3d graphics concepts itself.
... it's worth noting here that this series of articles introduces webgl itself; however, there are a number of frameworks available that encapsulate webgl's capabilities, making it easier to build 3d applications and games, such as three.js and babylon.js.
WebRTC connectivity - Web APIs
each peer, then, keeps two descriptions on hand: the local description, describing itself, and the remote description, describing the other end of the call.
... passive the transport will receive incoming connection attempts but won't attempt a connection itself.
Web Video Text Tracks Format (WebVTT) - Web APIs
the html snippet below actually handles displaying the media itself.
... <video controls autoplay src="video.webm"> <track default src="track.vtt"> </video> within the webvtt file itself you can also define the style directly in the webvtt file.
Using bounded reference spaces - Web APIs
this is the only type of bounded reference space currently available; in all others, if you need boundaries, you will have to manage them yourself.
...although the user's xr system may provide automated detection and protection against exiting the safe area, it is always good practice to handle this yourself, watching for collisions between the user's position and the boundary of the world, and providing guidance to move back toward the origin point, or at least to stay inside the safe zone.
Geometry and reference spaces in WebXR - Web APIs
defining spatial relationships with reference spaces there are a number of commonly used ways to reference the positions and orientations of objects relative to their environment, as well as to constrain the environment itself.
...if you wish to prevent the user from moving into certain areas, you must handle that yourself.
Movement, orientation, and motion: A WebXR example - Web APIs
remember: as you wander around, if you get lost, just hit the r key to reset yourself to the beginning.
... there are few limitations on what can be done if you set yourself to it.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
representing a position using a reference space as covered in defining spatial relationships with reference spaces in geometry and reference spaces in webxr, reference spaces establish a local coordinate system which is offset from another coordinate system that is itself defined by some other space.
... the hand and/or hand controller; each of these represents one of the user's hands, either in the form of the hand itself or a controller (or both).
Window.window - Web APIs
WebAPIWindowwindow
the window property of a window object points to the window object itself.
...alert(window === window.window); // displays "true" the point of having the window property refer to the object itself, was likely to make it easy to refer to the global object.
WindowOrWorkerGlobalScope.origin - Web APIs
syntax var myorigin = self.origin; // or just origin value a usvstring.
... examples executed from inside a worker script, the following snippet will log the worker's global scope's origin to the console each time it receives a message onmessage = function() { console.log(self.origin); }; if the origin is not a scheme/host/port tuple (say you are trying to run it locally, i.e.
WindowOrWorkerGlobalScope.queueMicrotask() - Web APIs
examples self.queuemicrotask(() => { // function contents here }) taken from the queuemicrotask spec: myelement.prototype.loaddata = function (url) { if (this._cache[url]) { queuemicrotask(() => { this._setdata(this._cache[url]); this.dispatchevent(new event("load")); }); } else { fetch(url).then(res => res.arraybuffer()).then(data => { this._cache[url] = data; this.
... if (typeof window.queuemicrotask !== "function") { window.queuemicrotask = function (callback) { promise.resolve() .then(callback) .catch(e => settimeout(() => { throw e; })); // report exceptions }; } specifications specification status comment html living standardthe definition of 'self.queuemicrotask()' in that specification.
Worker.prototype.postMessage() - Web APIs
main thread code: var myworker = new chromeworker(self.path + 'myworker.js'); function handlemessagefromworker(msg) { console.log('incoming message from worker, msg:', msg); switch (msg.data.atopic) { case 'do_sendmainarrbuff': sendmainarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } myworker.addeventlistener('message', handlemessagefrom...
...sole.info('arrbuf.bytelength pre transfer:', arrbuf.bytelength); myworker.postmessage( { atopic: 'do_sendworkerarrbuff', abuf: arrbuf // the array buffer that we passed to the transferrable section 3 lines below }, [ arrbuf // the array buffer we created 9 lines above ] ); console.info('arrbuf.bytelength post transfer:', arrbuf.bytelength); worker code self.onmessage = function (msg) { switch (msg.data.atopic) { case 'do_sendworkerarrbuff': sendworkerarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } function sendworkerarrbuff(abuf) { console.info('from worker, pre send back abuf.bytelength:', abuf.bytelength); self.postmessag...
WorkerGlobalScope.console - Web APIs
syntax var consoleobj = self.console; value a console object.
...so for example you could call console.log('test'); inside a worker (which would basically be the equivalent of self.console.log('test');, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), to return a test message out to the browser console.
WorkerGlobalScope.importScripts() - Web APIs
syntax self.importscripts('foo.js'); self.importscripts('foo.js', 'bar.js', ...); parameters a comma-separated list of domstring objects representing the scripts to be imported.
... example if you had some functionality written in a separate script called foo.js that you wanted to use inside worker.js, you could import it using the following line: importscripts('foo.js'); importscripts() and self.importscripts() are effectively equivalent — both represent importscripts() being called from inside the worker's inner scope.
WorkerGlobalScope.location - Web APIs
syntax var locationobj = self.location; value a workerlocation object.
... example if you called the following in a document served at localhost: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: "localhost"…} hash: "" host: "localhost:8000" hostname: "localhost" href: "http://localhost:8000/worker.js" origin: "http://localhost:8000" pathname: "/worker.js" port: "8000" protocol: "http:" search: "" __proto__: workerlocation you could use this location object to return more information about the...
WorkerGlobalScope.navigator - Web APIs
syntax var navigatorobj = self.navigator; value a workernavigator object.
... example if you call the following console.log(navigator); inside a worker (which would basically be the equivalent of self.console.log(self.navigator);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workernavigator object written to the console — something like the following: object {online: true, useragent: "mozilla/5.0 (macintosh; intel mac os x 10_10_1) ap…ml, like gecko) chrome/40.0.2214.93 safari/537.36", product: "gecko", platform: "macintel", appversion: "5.0 (macintosh; intel mac os x 10_10_1) applewebki…ml, like gecko) chrome/40.0.2214.93 safari/537.36"…} appcodename: "mozilla" appname: "netscape" appversion: "5.0 (macintosh; intel mac os x 10_10_1) applewebkit/537.36 (khtml, like gecko) ch...
WorkerGlobalScope.onclose - Web APIs
syntax self.onclose = function() { ...
... }; example the following code snippet shows an onclose handler set inside a worker: self.onclose = function() { console.log('your worker instance has been closed'); } specifications this feature is no longer defined in any specifications.
WorkerGlobalScope.onerror - Web APIs
syntax self.onerror = function() { ...
... }; example the following code snippet shows an onerror handler set inside a worker: self.onerror = function() { console.log('there is an error inside your worker!'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onerror' in that specification.
WorkerGlobalScope.onlanguagechange - Web APIs
syntax self.onlanguagechange = function() { ...
... }; example the following code snippet shows an onlanguagechange handler set inside a worker: self.onlanguagechange = function() { console.log('your preferred language settings have been changed'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onlanguagechange' in that specification.
WorkerGlobalScope.onoffline - Web APIs
syntax self.onoffline = function() { ...
... }; example the following code snippet shows an onoffline handler set inside a worker: self.onoffline = function() { console.log('your worker is now offline'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.onoffline' in that specification.
WorkerGlobalScope.ononline - Web APIs
syntax self.ononline = function() { ...
... }; example the following code snippet shows an ononline handler set inside a worker: self.ononline = function() { console.log('your worker is now online'); } specifications specification status comment html living standardthe definition of 'workerglobalscope.ononline' in that specification.
WorkerGlobalScope.performance - Web APIs
syntax var perfobj = self.performance; return value a performance object.
... example if you called console.log(performance); inside a worker (which would basically be the equivalent of self.console.log(self.performance);, as these are being called on the worker scope, which can be referenced with workerglobalscope.self), you will get a workerperformance object written to the console — something like the following: workerperformance {now: function} __proto__: workerperformance constructor: function workerperformance() { [native code] } now: function now() { [native code] } __proto__: object you could use this performance object to return performance data, as you might do with a normal performance object.
WorkerGlobalScope - Web APIs
the self property returns the specialized scope for each context.
... workerglobalscope.self read only returns a reference to the workerglobalscope itself.
WorkerNavigator.permissions - Web APIs
syntax permissionsobj = self.permissions value a permissions object.
... examples self.navigator.permissions.query({name:'notifications'}).then(function(result) { if (result.state === 'granted') { shownotification(); } else if (result.state === 'prompt') { requestnotificationpermission() } }); specification specification status comment permissions working draft initial definition.
XRSession.requestAnimationFrame() - Web APIs
this can be done from within the callback itself.
...this can be used to obtain the poses of the viewer and the scene itself, as well as other information needed to render a frame of an ar or vr scene.
ARIA Test Cases - Accessibility
as the controls within the toolbar are navigated, the newly focused item should be announced, but the label or role of the toolbar itself should not be repeated.
... upon initial focus, the label (if present), and role of the tree itself should be spoken, followed by the current tree item's information.
ARIA: row role - Accessibility
it is generally placed on row children, rather than on the row itself.
... if the set of columns which is present in the dom is not contiguous, or if there are cells spanning more than one row or column, put the aria-colindex on all of the children of each row instead of on the row itself.
ARIA: dialog role - Accessibility
labeling even though it is not required for the dialog itself to be able to receive focus, it still needs to be labeled.
... if a dialog already has a visible title bar, the text inside that bar can be used to label the dialog itself.
-webkit-mask-position-x - CSS: Cascading Style Sheets
webkit-mask-position-x: -50%; /* <length> values */ -webkit-mask-position-x: 50px; -webkit-mask-position-x: -1cm; /* multiple values values */ -webkit-mask-position-x: 50px, 25%, -3em; /* global values */ -webkit-mask-position-x: inherit; -webkit-mask-position-x: initial; -webkit-mask-position-x: unset; initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete syntax values <length-percentage> a length indicating the position of the left edge of the image relative to the box's left padding edge.
... formal definition initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete formal syntax [ <length-percentage> | left | center | right ]#where <length-percentage> = <length> | <percentage> examples horizontally positioning a mask image .exampleone { -webkit-mask-image: url(mask.png); -webkit-mask-position-x: right; } .exampletwo { -webkit-mask-image: url(mask.png); -...
-webkit-mask-position-y - CSS: Cascading Style Sheets
webkit-mask-position-y: -50%; /* <length> values */ -webkit-mask-position-y: 50px; -webkit-mask-position-y: -1cm; /* multiple values values */ -webkit-mask-position-y: 50px, 25%, -3em; /* global values */ -webkit-mask-position-y: inherit; -webkit-mask-position-y: initial; -webkit-mask-position-y: unset; initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete syntax values <length-percentage> a length indicating the position of the top side of the image relative to the box's top padding edge.
... formal definition initial value0%applies toall elementsinheritednopercentagesrefer to the size of the box itselfcomputed valuefor <length> the absolute value, otherwise a percentageanimation typediscrete formal syntax [ <length-percentage> | top | center | bottom ]#where <length-percentage> = <length> | <percentage> examples vertically positioning a mask image .exampleone { -webkit-mask-image: url(mask.png); -webkit-mask-position-y: bottom; } .exampletwo { -webkit-mask-image: url(mask.png); -w...
Using CSS animations - CSS: Cascading Style Sheets
animation-direction configures whether or not the animation should alternate direction on each run through the sequence or reset to the start point and repeat itself.
... making it repeat to make the animation repeat itself, simply use the animation-iteration-count property to indicate how many times to repeat the animation.
Using URL values for the cursor property - CSS: Cascading Style Sheets
if none are specified, the coordinates of the hotspot are read from the file itself (for cur and xbm files) or are set to the top left corner of the image.
...however, you should limit yourself to the size 32×32 for maximum compatibility with operating systems and platforms.
CSS Containment - CSS: Cascading Style Sheets
however browsers cannot guess at your intent and cannot assume that an article will be entirely self-contained.
...however, it means that the size of the element's children cannot affect the size of the element itself — its size is computed as if it had no children.
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
if you assign percentage widths to flex items — either as flex-basis or by adding a width to the item itself leaving the value of flex-basis as auto — you can get the impression of a two dimensional layout.
... you can see from the live example below that in order to create gaps that do not also create a gap at the edges of the container, we need to use negative margins on the flex container itself.
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
flexbox and display: contents the contents value of the display property is a new value that is described in the spec as follows: “the element itself does not generate any boxes, but its children and pseudo-elements still generate boxes as normal.
...this will cause the element itself to no longer be announced by screen reading technology.
CSS Flexible Box Layout - CSS: Cascading Style Sheets
reference css properties flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap order alignment properties the properties align-content, align-self, align-items and justify-content initially appeared in the flexbox specification, but are now defined in box alignment.
... justify-content align-content align-items align-self place-content place-items row-gap column-gap gap glossary entries flexbox flex container flex item main axis cross axis flex guides basic concepts of flexbox an overview of the features of flexbox relationship of flexbox to other layout methods how flexbox relates to other layout methods, and other css specifications aligning items in a flex container how the box alignment properties work with flexbox.
Variable fonts guide - CSS: Cascading Style Sheets
custom axes are in fact limitless: the typeface designer can define and scope any axis they like, and are just required to give it a four-letter tag to identify it within the font file format itself.
...this makes grade a useful axis of variation as it can be varied or animated without causing reflow of the text itself.
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
i have a layout using css grid, the grid container has a width applied and i am using the align-self and justify-self properties to align the items.
... these properties are flow relative — justify-self: start aligns the item to the start on the inline dimension, align-self: start does the same on the block dimension.
clamp() - CSS: Cascading Style Sheets
WebCSSclamp
as math expressions, so you can use addition, subtraction, multiplication and division without using the calc() function itself.
...the expressions are full math expressions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself.
display - CSS: Cascading Style Sheets
WebCSSdisplay
depending on the value of other properties (such as position, float, or overflow) and whether it is itself participating in a block or inline formatting context, it either establishes a new block formatting context (bfc) for its contents or integrates its contents into its parent formatting context.
...this will cause the element itself to no longer be announced by screen reading technology.
line-height - CSS: Cascading Style Sheets
<percentage> relative to the font size of the element itself.
...it also applies to ::first-letter and ::first-line.inheritedyespercentagesrefer to the font size of the element itselfcomputed valuefor percentage and length values, the absolute length, otherwise as specifiedanimation typeeither number or length formal syntax normal | <number> | <length> | <percentage> examples basic example /* all rules below have the same resultant line height */ div { line-height: 1.2; font-size: 10pt; } /* number/unitless */ div { line-height: 1.2em; font-size: 10pt; } /* length ...
min() - CSS: Cascading Style Sheets
WebCSSmin
the expressions are full math expressions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself.
... let's look at some css: input, label { padding: 2px; box-sizing: border-box; display: inline-block; width: min(40%, 400px); background-color: pink; } form { margin: 4px; border: 1px solid black; padding: 4px; } here, the form itself, along with the margin, border, and padding, will be 100% of its parent's width.
object-position - CSS: Cascading Style Sheets
formal definition initial value50% 50%applies toreplaced elementsinheritedyespercentagesrefer to width and height of element itselfcomputed valueas specifiedanimation typerepeatable list of simple list of length, percentage, or calc formal syntax <position>where <position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]?
... <img id="object-position-1" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg" alt="mdn logo"/> <img id="object-position-2" src="https://udn.realityripple.com/samples/db/4f9fbd7dfb.svg" alt="mdn logo"/> css the css includes default styling for the <img> element itself, as well as separate styles for each of the two images.
Creating a cross-browser video player - Developer guides
to get it to toggle, we set it to the inverse of itself.
...the function of these attributes is self-explanatory, with min indicating the minimum allowed value of the progress element and value indicating its current value.
Audio and Video Delivery - Developer guides
source = context.createbuffersource(); source.buffer = buffer; source.connect(context.destination); // auto play source.start(0); // start was previously noteon }); }; request.send(); } catch(e) { alert('web audio api not supported'); } in this example we retrieve an mp3 file via xhr, load it into a source and play it (try it for yourself).
...instead of the error event being dispatched to the media element itself, it now gets delivered to the child <source> elements corresponding to the sources resulting in the error.
Audio and video manipulation - Developer guides
var processor = { timercallback: function() { if (this.video.paused || this.video.ended) { return; } this.computeframe(); var self = this; settimeout(function () { self.timercallback(); }, 16); // roughly 60 frames per second }, doload: function() { this.video = document.getelementbyid("my-video"); this.c1 = document.getelementbyid("my-canvas"); this.ctx1 = this.c1.getcontext("2d"); var self = this; this.video.addeventlistener("play", function() { self.width = self.video.width; ...
... self.height = self.video.height; self.timercallback(); }, false); }, computeframe: function() { this.ctx1.drawimage(this.video, 0, 0, this.width, this.height); var frame = this.ctx1.getimagedata(0, 0, this.width, this.height); var l = frame.data.length / 4; for (var i = 0; i < l; i++) { var grey = (frame.data[i * 4 + 0] + frame.data[i * 4 + 1] + frame.data[i * 4 + 2]) / 3; frame.data[i * 4 + 0] = grey; frame.data[i * 4 + 1] = grey; frame.data[i * 4 + 2] = grey; } this.ctx1.putimagedata(frame, 0, 0); return; } }; once the page has loaded you can call processor.doload() result this is a pretty simple example showing how to manipulate video frames using a canvas.
Creating and triggering events - Developer guides
such events are commonly called synthetic events, as opposed to the events fired by the browser itself.
...const eventawesome = new customevent('awesome', { bubbles: true, detail: { text: () => textarea.value } }); // the form element listens for the custom "awesome" event and then consoles the output of the passed text() method form.addeventlistener('awesome', e => console.log(e.detail.text())); // as the user types, the textarea inside the form dispatches/triggers the event to fire, and uses itself as the starting point textarea.addeventlistener('input', e => e.target.dispatchevent(eventawesome)); creating and dispatching events dynamically elements can listen for events that haven't been created yet: <form> <textarea></textarea> </form> const form = document.queryselector('form'); const textarea = document.queryselector('textarea'); form.addeventlistener('awesome', e => console.lo...
DOM onevent handlers - Developer guides
you don't need to call them yourself, although you can do so in many cases to easily simulate an event taking place.
... this continues until every handler has been called, unless one of the event handlers explicitly halts the processing of the event by calling stoppropagation() on the event object itself.
Using HTML sections and outlines - Developer guides
html article element (<article>) defines a piece of self-contained content.
... article element the <article> element indicates self-contained content, meaning that if you removed all the other html except the <article> element, the content would still make sense to a reader.
Index - Developer guides
WebGuideIndex
2 ajax ajax, dom, json, javascript, references, xmlhttprequest 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.
...such events are commonly called synthetic events, as opposed to the events fired by the browser itself.
disabled - HTML: Hypertext Markup Language
if this attribute is not specified, the control inherits its setting from the containing element, for example fieldset; if there is no containing element with the disabled attribute set, and the control itself does not have the attribute, then the control is enabled.
...the <option>s are disabled, but the <select> itself is not.
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
calling any of the following on a tainted canvas will result in an error: calling getimagedata() on the canvas's context calling toblob() on the <canvas> element itself calling todataurl() on the canvas attempting any of these when the canvas is tainted will cause a securityerror to be thrown.
...implementing this requires configuring the server as well as writing code for the web site itself.
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
WebHTMLElementaudio
however, these events aren't sent directly to the <audio> element itself.
...you will have to find a library or framework that provides the capability for you, or write the code to display captions yourself.
<dfn>: The Definition element - HTML: Hypertext Markup Language
WebHTMLElementdfn
if the <dfn> contains a single child element and does not have any text content of its own, and the child element is an <abbr> element with a title attribute itself, then the exact value of the <abbr> element's title is the term being defined.
... html <p>the <strong>html definition element</strong> (<strong><dfn>&lt;dfn&gt;</dfn></strong>) is used to indicate the term being defined within the context of a definition phrase or sentence.</p> since the <dfn> element has no title, the text contents of the <dfn> element itself are used as the term being defined.
<input type="range"> - HTML: Hypertext Markup Language
WebHTMLElementinputrange
as a rule, if the user is more likely to be interested in the percentage of the distance between minimum and maximum values than the actual number itself, a range input is a great candidate.
...first is the css for the wrapper itself; this specifies the display mode and size we want so that the page lays out correctly; in essence, it's reserving an area of the page for the slider so that the rotated slider fits into the reserved space without making a mess of things.
<input type="tel"> - HTML: Hypertext Markup Language
WebHTMLElementinputtel
fortunately, you can consider the requirements of your own site and implement an appropriate level of validation yourself.
... <input id="telno" name="telno" type="tel" placeholder="123-4567-8901"> controlling the input size you can control not only the physical length of the input box, but also the minimum and maximum lengths allowed for the input text itself.
<input type="url"> - HTML: Hypertext Markup Language
WebHTMLElementinputurl
<input id="myurl" name="myurl" type="url" placeholder="http://www.example.com"> controlling the input size you can control not only the physical length of the input box, but also the minimum and maximum lengths allowed for the input text itself.
...in this example, for instance, the url edit box is 30 characters wide: <input id="myurl" name="myurl" type="url" size="30"> element value length the size is separate from the length limitation on the entered url itself.
HTML elements reference - HTML: Hypertext Markup Language
WebHTMLElement
<article> the html <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication).
... <figure> the html <figure> (figure with optional caption) element represents self-contained content, potentially with an optional caption, which is specified using the (<figcaption>) element.
HTML documentation index - HTML: Hypertext Markup Language
WebHTMLIndex
61 <article>: the article contents element element, html, html sections, reference, web the html <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication).
... 101 <figure>: the figure with optional caption element element, html, html grouping content, information, presentation, reference, figure the html <figure> (figure with optional caption) element represents self-contained content, potentially with an optional caption, which is specified using the (<figcaption>) element.
Evolution of HTTP - HTTP
get /mypage.html the response is extremely simple too: it only consisted of the file itself.
... http/1.0 – building extensibility http/0.9 was very limited and both browsers and servers quickly extended it to be more versatile: versioning information is now sent within each request (http/1.0 is appended to the get line) a status code line is also sent at the beginning of the response, allowing the browser itself to understand the success or failure of the request and to adapt its behavior in consequence (like in updating or using its local cache in a specific way) the notion of http headers has been introduced, both for the requests and the responses, allowing metadata to be transmitted and making the protocol extremely flexible and extensible.
CSP: connect-src - HTTP
note: connect-src 'self' does not resolve to websocket schemas in all browsers, more info: https://github.com/w3c/webappsec-csp/issues/7 csp version 1 directive type fetch directive default-src fallback yes.
... 'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: form-action - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
CSP: frame-ancestors - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
... examples content-security-policy: frame-ancestors 'none'; content-security-policy: frame-ancestors 'self' https://www.example.org; specifications specification status comment content security policy level 3the definition of 'frame-ancestors' in that specification.
CSP: img-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
CSP: navigate-to - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
CSP: script-src-attr - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
CSP: script-src-elem - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
...at the same time, any allow-list or source expressions such as 'self' or 'unsafe-inline' are ignored.
Content-Security-Policy - HTTP
to specify a content security policy for the worker, set a content-security-policy response header for the request which requested the worker script itself.
... content-security-policy: default-src 'self' http://example.com; connect-src 'none'; content-security-policy: connect-src http://example.com/; script-src http://example.com/ examples example: disable unsafe inline/eval, only allow loading of resources (images, fonts, scripts, etc.) over https: // header content-security-policy: default-src https: // meta tag <meta http-equiv="content-se...
Transfer-Encoding - HTTP
transfer-encoding is a hop-by-hop header, that is applied to a message between two nodes, not to a resource itself.
...the content-length header is omitted in this case and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format, followed by '\r\n' and then the chunk itself, followed by another '\r\n'.
HTTP Index - HTTP
WebHTTPIndex
there are ways to develop your website to progressively enhance itself based on the availability of features rather than by targeting specific browsers.
...used on the body itself, content-disposition has no effect.
A re-introduction to JavaScript (JS tutorial) - JavaScript
just try parsing the string "10.2abc" with each method by yourself in the console and you'll understand the differences better.
...this might trip you up: '3' + 4 + 5; // "345" 3 + 4 + '5'; // "75" adding an empty string to something is a useful way of converting it to a string itself.
Enumerability and ownership of properties - JavaScript
s _enumerable: function(obj, prop) { return obj.propertyisenumerable(prop); }, _notenumerable: function(obj, prop) { return !obj.propertyisenumerable(prop); }, _enumerableandnotenumerable: function(obj, prop) { return true; }, // inspired by http://stackoverflow.com/a/8024294/271577 _getpropertynames: function getallpropertynames(obj, iterateselfbool, iterateprototypebool, includepropcb) { var props = []; do { if (iterateselfbool) { object.getownpropertynames(obj).foreach(function(prop) { if (props.indexof(prop) === -1 && includepropcb(obj, prop)) { props.push(prop); } }); } if (!iterateproto...
...typebool) { break; } iterateselfbool = true; } while (obj = object.getprototypeof(obj)); return props; } }; detection table in for..in obj.hasownproperty obj.propertyisenumerable object.keys object.getownpropertynames object.getownpropertydescriptors reflect.ownkeys() enumerable true true true true true true true true nonenumerable true false true false false true true true symbols keys true false true true false false true true inherited enumerable true true false false false false false false inherited nonenumerable true false false false ...
Iterators and generators - JavaScript
function* makeiterator() { yield 1; yield 2; } const it = makeiterator(); for (const ititem of it) { console.log(ititem); } console.log(it[symbol.iterator]() === it) // true; // this example show us generator(iterator) is iterable object, // which has the @@iterator method return the it (itself), // and consequently, the it object can iterate only _once_.
... generators have a return(value) method that returns the given value and finishes the generator itself.
Working with objects - JavaScript
for example, var kenscar = new car('nissan', '300zx', 1992); var vpgscar = new car('mazda', 'miata', 1990); an object can have a property that is itself another object.
...only comparing the same object reference with itself yields true.
Inheritance and the prototype chain - JavaScript
while this confusion is often considered to be one of javascript's weaknesses, the prototypal inheritance model itself is, in fact, more powerful than the classic model.
...to check whether an object has a property defined on itself and not somewhere on its prototype chain, it is necessary to use the hasownproperty method which all objects inherit from object.prototype.
Memory Management - JavaScript
cycles are a common mistake that can generate memory leaks: var div; window.onload = function() { div = document.getelementbyid('mydivelement'); div.circularreference = div; div.lotsofdata = new array(10000).join('*'); }; in the above example, the dom element "mydivelement" has a circular reference to itself in the "circularreference" property.
...all improvements made in the field of javascript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last few years are implementation improvements of this algorithm, but not improvements over the garbage collection algorithm itself nor its reduction of the definition of when "an object is no longer needed".
TypeError: cyclic object value - JavaScript
examples circular references in a circular structure like the following var circularreference = {otherdata: 123}; circularreference.myself = circularreference; json.stringify() will fail json.stringify(circularreference); // typeerror: cyclic object value to serialize circular references you can use a library that supports them (e.g.
... cycle.js) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values.
Arrow function expressions - JavaScript
instead, the literal name // itself of the variable `length` is used as the property we want to retrieve from the object.
... function person() { // the person() constructor defines `this` as an instance of itself.
FinalizationRegistry - JavaScript
it's common to use the object itself as the unregister token, which is just fine: registry.register(theobject, "some value", theobject); // ...some time later, if you don't care about `theobject` anymore...
... when the finalizationregistry instance itself is no longer reachable by javascript code.
JSON.stringify() - JavaScript
const circularreference = {}; circularreference.myself = circularreference; // serializing circular references throws "typeerror: cyclic object value" json.stringify(circularreference); to serialize circular references you can use a library that supports them (e.g.
... cycle.js by douglas crockford) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values.
Map - JavaScript
even though every nan is not equal to itself (nan !== nan is true), the following example works because nans are indistinguishable from each other: let mymap = new map() mymap.set(nan, 'not a number') mymap.get(nan) // "not a number" let othernan = number('foo') mymap.get(othernan) // "not a number" iterating map with for..of maps can be iterated using a for..of loop: let mymap = new map() mymap.set(0, 'zero') mymap.set(1, 'one') fo...
...alues() iterators, and convert them to an array console.log(array.from(mymap.keys())) // ["key1", "key2"] cloning and merging maps just like arrays, maps can be cloned: let original = new map([ [1, 'one'] ]) let clone = new map(original) console.log(clone.get(1)) // one console.log(original === clone) // false (useful for shallow comparison) important: keep in mind that the data itself is not cloned.
Object.prototype.constructor - JavaScript
note that the value of this property is a reference to the function itself, not a string containing the function's name.
... take the following case: the object has the create() method to create itself.
Object.defineProperty() - JavaScript
// is equivalent to: object.defineproperty(o, 'a', { value: 1, writable: true, configurable: true, enumerable: true }); // on the other hand, object.defineproperty(o, 'a', { value: 1 }); // is equivalent to: object.defineproperty(o, 'a', { value: 1, writable: false, configurable: false, enumerable: false }); custom setters and getters the example below shows how to implement a self-archiving object.
... function myclass() { } object.defineproperty(myclass.prototype, "x", { get() { return this.stored_x; }, set(x) { this.stored_x = x; } }); var a = new myclass(); var b = new myclass(); a.x = 1; console.log(b.x); // undefined unlike accessor properties, value properties are always set on the object itself, not on a prototype.
Object.freeze() - JavaScript
the result of calling object.freeze(object) only applies to the immediate properties of object itself and will prevent future property addition, removal or value re-assignment operations only on object.
... function deepfreeze(object) { // retrieve the property names defined on object var propnames = object.getownpropertynames(object); // freeze properties before freezing self for (let name of propnames) { let value = object[name]; if(value && typeof value === "object") { deepfreeze(value); } } return object.freeze(object); } var obj2 = { internal: { a: null } }; deepfreeze(obj2); obj2.internal.a = 'anothervalue'; // fails silently in non-strict mode obj2.internal.a; // null specifications specification ec...
handler.construct() - JavaScript
in order for the new operation to be valid on the resulting proxy object, the target used to initialize the proxy must itself have a [[construct]] internal method (i.e.
...the target in proxy initialization must itself be a valid constructor for the new operator.
handler.setPrototypeOf() - JavaScript
approach 1: returning false this approach means that any mutating operation that throws an exception on failure to mutate, must create the exception itself.
... for example, object.setprototypeof() will create and throw a typeerror itself.
Comparing Reflect and Object methods - JavaScript
setprototypeof() object.setprototypeof() returns the object itself if its prototype was set successfully.
...in es2015, treats the argument as a non-extensible, ordinary object and returns the object itself.
Planned changes to shared memory - JavaScript
to avoid having to check whether postmessage() throws, self.crossoriginisolated is being standardized (a getter that returns a boolean; true if the headers are set), available in window and worker contexts.
... postmessage() changes and self.crossoriginisolated: whatwg/html issue #4732, whatwg/html issue #4872, draft specification.
Destructuring assignment - JavaScript
he array props below, and then you want the name property in the object, you can do the following: const props = [ { id: 1, name: 'fizz'}, { id: 2, name: 'buzz'}, { id: 3, name: 'fizzbuzz'} ]; const [,, { name }] = props; console.log(name); // "fizzbuzz" the prototype chain is looked up when the object is deconstructed when deconstructing an object, if a property is not accessed in itself, it will continue to look up along the prototype chain.
... let obj = {self: '123'}; obj.__proto__.prot = '456'; const {self, prot} = obj; // self "123" // prot "456"(access to the prototype chain) specifications specification ecmascript (ecma-262)the definition of 'destructuring assignment' in that specification.
Optional chaining (?.) - JavaScript
note: if someinterface itself is null or undefined, a typeerror exception will still be raised (someinterface is null).
... if you expect that someinterface itself may be null or undefined, you have to use ?.
new operator - JavaScript
an object can have a property that is itself another object.
...for example: var kenscar = new car('nissan', '300zx', 1992); object property that is itself another object suppose you define an object called person as follows: function person(name, age, sex) { this.name = name; this.age = age; this.sex = sex; } and then instantiate two new person objects as follows: var rand = new person('rand mcnally', 33, 'm'); var ken = new person('ken jones', 39, 'm'); then you can rewrite the definition of car to include an owner property that takes...
this - JavaScript
they are properties of the class itself.
...the fact that the object is itself a member of o has no consequence; the most immediate reference is all that matters.
yield* - JavaScript
the value of yield* expression itself is the value returned by that iterator when it's closed (i.e., when done is true).
...one: false} console.log(iterator.next()); // {value: 2, done: false} console.log(iterator.next()); // {value: "3", done: false} console.log(iterator.next()); // {value: "4", done: false} console.log(iterator.next()); // {value: 5, done: false} console.log(iterator.next()); // {value: 6, done: false} console.log(iterator.next()); // {value: undefined, done: true} the value of yield* expression itself yield* is an expression, not a statement—so it evaluates to a value.
for...in - JavaScript
the loop will iterate over all enumerable properties of the object itself and those the object inherits from its prototype chain (properties of nearer prototypes take precedence over those of prototypes further away from the object in its prototype chain).
... iterating over own properties only if you only want to consider properties attached to the object itself, and not its prototypes, use getownpropertynames() or perform a hasownproperty() check (propertyisenumerable() can also be used).
let - JavaScript
in the same line, the if block's foo has already been created in the lexical environment, but has not yet reached (and terminated) its initialization (which is part of the statement itself).
...so, the identifier n.a is resolved to the property 'a' of the 'n' object located in the first part of the instruction itself (let n).
Media container formats (file types) - Web media technologies
support is also implied only for the container itself, not for any specific codecs.
...apple itself generally now uses mp4 for video.
Performance fundamentals - Web Performance
use css transforms instead of tweaking absolute positioning and fiddling with all that math yourself, use the transform css property to adjust the position, scale, and so forth of your content.
...think of the display as a presentation of your data rather than the data itself.
Progressive loading - Progressive web apps (PWAs)
to fix that we can, for example, add defer to javascript files: <script src="app.js" defer></script> they will be downloaded and executed after the document itself has been parsed, so it won't block rendering the html structure.
... we won't do that because the app itself is dependent on javascript — without it, the list of games wouldn't even be loaded, and the service worker code wouldn't be executed.
begin - SVG: Scalable Vector Graphics
WebSVGAttributebegin
the target element did not exist), the <discard> element itself is still removed after the activation.
... the <discard> element itself can be discarded prior to its activation, in which case it will never trigger the removal of its own target element.
<feComposite> - SVG: Scalable Vector Graphics
the second set does not wipe out the background, with the result that the background sometimes shines through and is other cases is blended into itself (i.e., "double-counting").</desc> <filter id="overflood" filterunits="objectboundingbox" x="-5%" y="-5%" width="110%" height="110%"> <feflood flood-color="#ffffff" flood-opacity="1" result="flood"/> <fecomposite in="sourcegraphic" in2="backgroundimage" operator="over" result="comp"/> <femerge> <femergenode in="flood"/> <femergenode in="comp"/> </femerge> </filter> <f...
...rl(#arithmeticflood)" /> <text x="-25" y="275">arithmetic</text> </g> </g> <g transform="translate(0,325)" enable-background="new"> <desc>render the examples using the filters that do not obliterate the background, thus sometimes causing the background to continue to appear in some cases, and in other cases the background image blends into itself ("double-counting").</desc> <text x="15" y="75">opacity 1.0</text> <text x="15" y="115" font-size="27">(without feflood)</text> <text x="15" y="200">opacity 0.5</text> <text x="15" y="240" font-size="27">(without feflood)</text> <use xlink:href="#bluetriangles"/> <g transform="translate(275,25)"> <use xlink:href="#red100" filter="url(#overnoflood)" /> ...
Using the Mozilla JavaScript interface to XSL Transformations - XSLT: Extensible Stylesheet Language Transformations
this is handy because appending a fragment to another node transparently appends all the children of that fragment, and the fragment itself is not merged.
... var ownerdocument = document.implementation.createdocument("", "test", null); var newfragment = processor.transformtofragment(domtobetransformed, ownerdocument); xsltprocessor.transformtofragment() will only produce html dom objects if the owner document is itself an htmldocument, or if the output method of the stylesheet is html.
Understanding WebAssembly text format - WebAssembly
while there are many different ways to encode a string’s length in the string itself (for example, c strings); for simplicity here we just pass both offset and length as parameters: (import "console" "log" (func $log (param i32) (param i32))) on the javascript side, we can use the textdecoder api to easily decode our bytes into a javascript string.
...and webassembly code is itself able to manipulate tables using instructions added as part of reference types, such as table.get and table.set.
Using the WebAssembly JavaScript API - WebAssembly
if you have already compiled a module from another language using tools like emscripten, or loaded and run the code yourself, the next step is to learn more about using the other features of the webassembly javascript api.
...add the following into your code, where indicated: var i32 = new uint32array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = results.instance.exports.accumulate(0, 10); console.log(sum); note how we create the uint32array view on the memory object’s buffer (memory.prototype.buffer), not on the memory itself.
Getting Started - Archive of obsolete content
this page is now maintained alongside the sdk code itself: https://github.com/mozilla/gecko-dev/blob/master/addon-sdk/source/contributing.md.
Private Properties - Archive of obsolete content
sure over these variables: function point(_x, _y) { this.getx = function () { return _x; }; this.setx = function (x) { _x = x; }; this.gety = function () { return _y; }; this.sety = function (y) { _y = y; }; } note that this technique requires member functions that need access to private properties to be defined on the object itself, instead of its prototype.
Contributor's Guide - Archive of obsolete content
modules a module is a self-contained unit of code, which is usually stored in a file, and has a well defined interface.
Testing the Add-on SDK - Archive of obsolete content
this includes: cfx testcfx: a suite of python tests which test cfx itself (which is written in python).
Two Types of Scripts - Archive of obsolete content
✘ ✔ the self global, used for communicating between content scripts and add-on code.
addon-page - Archive of obsolete content
after this, the page loaded from "data/index.html" will not contain navigational elements: var addontab = require("sdk/addon-page"); var data = require("sdk/self").data; require("sdk/tabs").open(data.url("index.html")); this only affects the page at "data/index.html": all other pages are displayed normally.
indexed-db - Archive of obsolete content
e same api: var { indexeddb } = require('sdk/indexed-db'); var request = indexeddb.open('mydatabase'); request.onerror = function(event) { console.log("failure"); }; request.onsuccess = function(event) { console.log("success"); }; most of the objects that implement the indexeddb api, such as idbtransaction, idbopendbrequest, and idbobjectstore, are accessible through the indexeddb object itself.
private-browsing - Archive of obsolete content
in the handler for the page-mod's attach event, it passes the worker into isprivate(): var pagemod = require("sdk/page-mod"); var privatebrowsing = require("sdk/private-browsing"); var loggingscript = "self.port.on('log-content', function() {" + " console.log(document.body.innerhtml);" + "});"; function logpublicpagecontent(worker) { if (privatebrowsing.isprivate(worker)) { console.log("private window, doing nothing"); } else { worker.port.emit("log-content"); } } pagemod.pagemod({ include: "*", contentscript: loggingscript, onattach: ...
selection - Archive of obsolete content
selection.removelistener('select', mylistener); iterating over discontiguous selections discontiguous selections can be accessed by iterating over the selection module itself.
simple-prefs - Archive of obsolete content
by default, simple preferences are stored in a preference like: extensions.<addon-id>.<preference-name> for example, if you had a simple-pref named "somepreference" then you could get its value like so: require('sdk/preferences/service').get(['extensions', require('sdk/self').id, 'somepreference'].join('.')) this would give you the same value as: require('sdk/simple-prefs').prefs['somepreference'] the ability to change the default preferences branch is new in add-on sdk 1.15.
simple-storage - Archive of obsolete content
be careful to set properties on the storage object and not the module itself, as demonstrated below: // this is not good!
ui - Archive of obsolete content
var ui = require("sdk/ui"); var sidebar = ui.sidebar({ id: 'my-sidebar', title: 'my sidebar', url: require("sdk/self").data.url("sidebar.html") }); it appears on the left of the content window: ...
High-Level APIs - Archive of obsolete content
self access data that is bundled with the add-on, and add-on metadata.
frame/hidden-frame - Archive of obsolete content
the following code creates a hidden frame, loads a web page into it, and then logs its title: var hiddenframes = require("sdk/frame/hidden-frame"); let hiddenframe = hiddenframes.add(hiddenframes.hiddenframe({ onready: function() { this.element.contentwindow.location = "http://www.mozilla.org/"; let self = this; this.element.addeventlistener("domcontentloaded", function() { console.log(self.element.contentdocument.title); }, true, true); } })); see the panel module for a real-world example of usage of this module.
preferences/event-target - Archive of obsolete content
example var { prefstarget } = require("sdk/preferences/event-target"); // listen to the same branch which reqire("sdk/simple-prefs") does var target = prefstarget({ branchname: "extensions." + require("sdk/self").preferencesbranch + "." }); target.once("test", function(prefname) { console.log(prefname) // logs "test" console.log(target.prefs[name]) // logs true }); target.once("", function() { console.log(prefname) // logs "test" console.log(target.prefs[name]) // logs true }) // changing a pref which our target listens to require("sdk/simple-prefs").prefs.test = true; ...
system/unload - Archive of obsolete content
therefore, when you register an object with ensure(), you can call its destructor method yourself, you can let it happen for you, or you can do both.
Low-Level APIs - Archive of obsolete content
you're more likely to use these if you are building your own modules that implement new apis, thus extending the sdk itself.
Release notes - Archive of obsolete content
"./my-file" introduced everywhere as an alias for require("sdk/self").data.url("my-file") added the ability to attach stylesheets to individual tabs.
cfx to jpm - Archive of obsolete content
entry point the add-on's entry point is the file that's executed when the add-on needs to initialize itself: for example, when firefox starts, or when the add-on's installed, enabled, or upgraded.
Chrome Authority - Archive of obsolete content
components an alias for components itself (note the lower-case).
Creating Event Targets - Archive of obsolete content
this consists of three functions: on(): start listening for events or a given type once(): listen for the next occurrence of a given event, and then stop removelistener(): stop listening for events of a given type the on() and once() exports delegate to the corresponding function from event/core, and use bind() to pass the exports object itself as the target argument to the underlying function.
Creating Reusable Modules - Archive of obsolete content
once you've done this, you can package the modules and distribute them independently of your add-on, making them available to other add-on developers and effectively extending the sdk itself.
List Open Tabs - Archive of obsolete content
to list the open tabs, you can iterate over the tabs object itself.
Tutorials - Archive of obsolete content
using third-party modules (jpm) install and use additional modules which don't ship with the sdk itself.
Downloading Files - Archive of obsolete content
var privacy = privatebrowsingutils.privacycontextfromwindow(aurlsourcewindow); var progresselement = document.getelementbyid("progress_element"); persist.progresslistener = { onprogresschange: function(awebprogress, arequest, acurselfprogress, amaxselfprogress, acurtotalprogress, amaxtotalprogress) { var percentcomplete = math.round((acurtotalprogress / amaxtotalprogress) * 100); progresselement.textcontent = percentcomplete +"%"; }, onstatechange: function(awebprogress, arequest, astateflags, astatus) { // do something } } persist.saveuri(obj_uri, null, null, null, "", targetfile, privacy); downloading fil...
File I/O - Archive of obsolete content
those methods/properties are mostly self-explanatory, so we haven't included examples of using them here.
Examples and demos from articles - Archive of obsolete content
it guides you through the basic features of the language with practical examples that you can try for yourself on your own computer and illustrates the standard features of css that work in modern browsers.
Progress Listeners - Archive of obsolete content
}, // for definitions of the remaining functions see related documentation onprogresschange: function(awebprogress, arequest, curself, maxself, curtot, maxtot) {}, onstatuschange: function(awebprogress, arequest, astatus, amessage) {}, onsecuritychange: function(awebprogress, arequest, astate) {} } attach the progress listener to a <browser> or a <tabbrowser> element using addprogresslistener, for example for firefox put the following code in a load listener of a main window: gbrowser.addprogresslistener(mylistener...
Windows - Archive of obsolete content
however, window.open() returns a window object for content, not for the browser window itself, so you should get the chrome window first.
Code snippets - Archive of obsolete content
many of these samples can also be used in xulrunner applications, as well as in actual mozilla code itself.
Hiding browser chrome - Archive of obsolete content
note: don't simply replace the hidechromeforlocation() method; this will likely hurt the functionality of firefox itself as well as other extensions.
Installing Extensions and Themes From Web Pages - Archive of obsolete content
this is not necessary as install calls updateenabled itself internally.
Interaction between privileged and non-privileged pages - Archive of obsolete content
(to better ensure others do not also implement the same event with a different meaning, one might either attach a namespace to <myextensiondataelement/> and check on the event handler for the correct namespaceuri property, or as per the dom specification, use initevent() with an event name that is itself namespaced (xml name characters only): "it is also strongly recommended that third parties adding their own events use their own prefix to avoid confusion and lessen the probability of conflicts with other new events.") in the case where your extension's overlay does not interact directly with browser.xul, such as in a sidebar, it might be easier to add the event listener to the top-level docume...
Listening to events in Firefox extensions - Archive of obsolete content
it is used to detect when a webpage attempts to refresh itself and allow the user to block the attempt.
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
you need to supply the appropriate conversion yourself.
Chapter 1: Introduction to Extensions - Archive of obsolete content
greasemonkey userchrome.js both of these provide an environment for running user scripts (javascript) in firefox itself, where the scripts can target specific websites.
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
this means that all those variables and functions get mixed up with those defined by firefox itself and any other extensions that are running.
Adding menus and submenus - Archive of obsolete content
on other systems you would be able to see the item update itself without having to close the menu and then reopen.
Adding sidebars - Archive of obsolete content
they are extremely useful, and you'll find yourself using them in many situations besides sidebars.
Connecting to Remote Content - Archive of obsolete content
you would of course need to be very careful about escaping characters and protecting yourself against sql injection attacks.
Setting Up a Development Environment - Archive of obsolete content
if your system is not listed in the supported builds, you'll have to build the sdk yourself from the mozilla source.
The Box Model - Archive of obsolete content
it also wouldn't make sense to use flexibility or packing in the hbox if it didn't have any available horizontal space; the container element needs to either be flexible itself, or have a fixed width larger than its contents.
Security best practices in extensions - Archive of obsolete content
apis can't be used with self-signed certificates.
Signing an extension - Archive of obsolete content
for an extension to work in firefox it must be signed by mozilla, not by yourself.
Tabbed browser - Archive of obsolete content
httpchannel = subject.queryinterface(ci.nsihttpchannel); requesturl = httpchannel.uri.spec; var newrequesturl, i; if (/someurl/.test(requesturl)) { var goodies = loadcontextgoodies(httpchannel); if (goodies) { httpchannel.cancel(cr.ns_binding_aborted); goodies.contentwindow.location = self.data.url('pages/test.html'); } else { //dont do anything as there is no contentwindow associated with the httpchannel, liekly a google ad is loading or some ajax call or something, so this is not an error } } return; } } }; services.obs.addobserver(httprequestobserver, "http-on-modify-request", false); /...
Promises - Archive of obsolete content
a task example like the following: components.utils.import("resource://gre/modules/task.jsm"); task.spawn(function* () { var response = yield request("login", { username: user, password: password }); if (response.messages) { try { yield publish({ username: user, messages: response.messages }); } catch (e) { self.reporterror("publication failed", e); } } }); can be converted to a pure promise-based equivalent as such: request("login", { username: user, password: password }) .then(response => { if (response.messages) return publish({ username: user, messages: response.messages }); }) .then(null, (e) => { self.reporterror("publication failed", e); })...
Adding preferences to an extension - Archive of obsolete content
the second is the textbox itself, in which the user enters the symbol.
Case Sensitivity in class and id Names - Archive of obsolete content
summary: although css is itself case-insensitive, class and id names are defined to be case-sensitive in html 4.01.
progress - Archive of obsolete content
this doesn't include headers and other overhead, but only the content itself.
Getting the page URL in NPAPI plugin - Archive of obsolete content
or whenever you make network requests yourself, you almost always need to enforce same-origin policy.
Bypassing Security Restrictions and Signing Code - Archive of obsolete content
signed script segregation was removed in bug 726125, the enableprivilege prompt was removed in bug 750859, and enableprivilege itself was nerfed in bug 757046.
cert_override.txt - Archive of obsolete content
domainname:port : port 443 for https (ssl) hash algorithm oid sha1-256: oid.2.16.840.1.101.3.4.2.1 (most used) sha-384: oid.2.16.840.1.101.3.4.2.2 sha-512: oid.2.16.840.1.101.3.4.2.3 certificate fingerprint using previous hash algorithm one or more characters for override type: m : allow mismatches in the hostname u : allow untrusted certs (whether it's self signed cert or a missing or invalid issuer cert) t : allow errors in the validity time, for example, for expired or not yet valid certs certificate's serial number and the issuer name as a base64 encoded string ...
Source Navigator - Archive of obsolete content
(you can always include more by pressing the "more" button.) in my case, i inputted the followings: project file: <tt>~/snav-mozilla</tt> add directory (where your source files reside in -- i understand that the label here is not so self-explanatory...): <tt>~/moz1.9/mozilla</tt> (because i saved my source at ~/moz1.9/mozilla.) remember to ensure that "include subdirectories" and "build cross-reference database" are checked.
Using content preferences - Archive of obsolete content
this permits code running within chrome (in other words: extensions and the browser itself, not web sites) to locally save preferences on a per-site basis.
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
the control itself is implemented in a dll called pluginhostctrl.dll which is standalone from the rest of the mozilla project.
How Mozilla finds its configuration files - Archive of obsolete content
the configuration itself is stored in the specified directory, in a file named prefs.js.
How Thunderbird and Firefox find their configuration files - Archive of obsolete content
the configuration itself is stored in the specified directory, in a file named prefs.js.
Bonsai - Archive of obsolete content
bonsai source code the source code to the bonsai tool itself is also available, check out the information available at the bonsai project page.
Bookmark Keywords - Archive of obsolete content
in addition to being handy pointers to useful resources, bookmarks in mozilla can be used to make the address bar itself a power tool.
Making a Mozilla installation modifiable - Archive of obsolete content
it is located in the chrome directory itself and is called either chrome.rdf or installed-chrome.txt (or both).
Making it into a static overlay - Archive of obsolete content
dynamic overlays also make it possible to modify a xul file without actually changing the code of the file itself, which is necessary when installing an extension like ours.
Creating a Microsummary - Archive of obsolete content
if we were the spread firefox webmasters, we might simply reference the generator within the page itself by adding a <link rel="microsummary"> tag to its <head> element: <head> <link rel="microsummary" href="path/to/our/generator.xml"> </head> since we're not that site's webmasters, however, we can specify the page to which the generator applies within the generator itself and then make the generator available for download and installation.
Getting Started - Archive of obsolete content
the three remaining directories are pretty self-explanatory.
Dehydra - Archive of obsolete content
it was also useful to find bugs in source code as it allows for much more error checking than c++ is capable of by itself.
Embedding FAQ - Archive of obsolete content
faq mozilla.dev.embedding how to start embedding you can find a examples, faqs, and the api from mozilla itself.
Block and Line Layout Cheat Sheet - Archive of obsolete content
this is "passed in" to a child frame from its parent, and provides the constraints in which the child frame must size itself; e.g.
Layout System Overview - Archive of obsolete content
the frame provides generic functionality that can be used by subclasses but cannot itself be instantiated.
Style System Overview - Archive of obsolete content
y origin (ua, user, author) & weight (!important), then specificity of selector, then order example document source <doc> <title>a few quotes</title> <para class="emph"> franklin said that <quote>"a penny saved is a penny earned."</quote> </para> <para> fdr said <quote>"we have nothing to fear but <span class="emph">fear itself.</span>"</quote> </para> </doc> example document tree doc ↙ ↓ ↘ title para class="emph" para ↓ ↓ quote quote ↓ span class="emph" example stylesheet doc { display: block; text-indent: 1em; } title { display: block; f...
Using microformats - Archive of obsolete content
microformats allow web sites to provide semantic data to the browser in order to make it possible to present summaries of the information on a page without having to know how to parse the document itself.
Java in Firefox Extensions - Archive of obsolete content
in your extension within an array of java.net.url's, pass to java.net.urlclassloader to get a class loader, and finally pass the classloader and array to a function which gives the necessary privileges: // this function will be called to give the necessary privileges to your jar files // however, the policy never comes into play, because // (1) adding permissions doesn't add to the policy itself, and // (2) addurl alone does not set the grant codebase function policyadd (loader, urls) { try { //if have trouble with the policy try changing it to //edu.mit.simile.javafirefoxextensionutils.urlsetpolicy var str = 'edu.mit.simile.javafirefoxextensionutils.urlsetpolicy'; var policyclass = java.lang.class.forname( str, ...
Twitter - Archive of obsolete content
in other words, define a data property that is itself an object whose properties correspond to the parameters of the twitter method.
Notifications - Archive of obsolete content
titlethe head of the notification message.string bodythe message itself.stringfalse iconthe url of an .ico file.string jetpack.notifications.show("hello world"); var mybody = " my first message body on jetpack"; var myicon = "http://www.mozilla.com/favicon.ico"; jetpack.notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); ...
Plug-n-Hack Phase1 - Archive of obsolete content
the tool configures itself by serving an html document (we’ll call this the configuration document) to the browser.
FAQ - Archive of obsolete content
ArchiveMozillaPrismFAQ
at the same time, we're also working to increase the capabilities of those apps by adding features to the web itself, like support for offline data storage and access to 3d graphics hardware, that will be available to web applications in both prism and firefox.
HostWindow - Archive of obsolete content
the splitter itself cannot be hidden as it is the only ui to show a collapsed sidebar.
Hacking wiki - Archive of obsolete content
eve...lla.org/trunk/ to see the skins properly, you'll need to also check out <tt>mozilla-org/css</tt> to get the css files needed: export cvsroot=:pserver:anonymous@cvs-mirror.mozilla.org:/www cvs login cvs co mozilla-org/css (when prompted to enter a password, type <tt>anonymous</tt>) setting up copy the contents of the <tt>trunk</tt> folder and the <tt>css</tt> folder (note: the folder itself) into the <tt>www</tt> directory on your server.
New Skin Notes - Archive of obsolete content
since i manage a number of sites for which i must respect quality standards at 800 pixels width for compatibility (we accept break 640 compatibility nowadays except for sites intended for pdas/ppcs), i find myself needing to use ctrl+- with the devmo wikki currently, not to change my global settings of course, which are fine and factory-default, working well with the other sites i visit regularily or manage...
PyDOM - Archive of obsolete content
for example, let's say you have xul similar to pyxultest: top-level script code says something like: button = document.getelementbyid("some-button") button.foo = 0 and the button itself might look like: <button id="some-button" label="click here" onclick="event.target.foo += 1; print 'foo is now', event.target.foo"/> note that (a) we have stuck an arbitrary attribute on a dom element and (b) in all cases (e.g., event handler and top-level script), the dom node needs to be explicitly specified - the globals are the window itself.
Safely loading URIs - Archive of obsolete content
if a web page gets access to a window with such expanded privileges, it may be able to abuse it to gain access to those privileges itself.
Space Manager High Level Design - Archive of obsolete content
the classes that are considered part of the space manager are: nsspacemanager nsbanddata nsblockbanddata bandrect / bandlist (private structs) frameinfo (private struct) nsbandtrapezoid outside of the space manager itself, the clients of the space manager also play an important part in the management of he available and used space.
Supporting per-window private browsing - Archive of obsolete content
however, sometimes you need to adjust the privacy status on a channel manually, for example, if you have created the channel directly yourself.
Running Tamarin acceptance tests - Archive of obsolete content
uld return exitcode=0) $ tamarin-redux/platform/android/android_shell.py hello.abc hello exitcode=0 test it out by retrieving the version information of the shell on the android device $ $avm -dversion shell 1.4 debug build 6299:455bca954565 features avmsystem_32bit;avmsystem_unaligned_int_access;avmsystem_little_endian;avmsystem_arm;avmsystem_unix; avmfeature_jit;avmfeature_abc_interp;avmfeature_selftest;avmfeature_eval;avmfeature_protect_jitmem; avmfeature_shared_gcheap;avmfeature_cache_gqcn;avmfeature_safepoints;avmfeature_swf12;avmfeature_swf13;avmtweak_exact_tracing; running acceptance tests --androidthreads sets the number of threads to the number of phones found via usb.
Tamarin Build System Documentation - Archive of obsolete content
the test phase runs all functional testcases including acceptance tests, cmdline tests, and selftests.
The life of an HTML HTTP request - Archive of obsolete content
(8) each nsiframe knows how how to draw itself on the screen.
[Deprecated] The Mozilla build VM - Archive of obsolete content
whenever you need help, contact the mentor via matrix, in the bug itself, or by email.
Venkman Introduction - Archive of obsolete content
these commands should be self explanatory, with the possible exception of stop, which causes the debugger to stop when the next line of javascript is executed, and the profile button, which can be used to measure execution times for your scripts.
Writing textual data - Archive of obsolete content
when the file is to be read only by the application/extension itself, using utf-8 is often the best choice — it can represent all characters, and ascii characters are represented efficiently.
Binding Implementations - Archive of obsolete content
the first type of property is a raw value that is set directly on the element itself.
DOM Interfaces - Archive of obsolete content
no return value example the following snippet checks to see if any anonymous child of "element" is itself an element.
Example Sticky Notes - Archive of obsolete content
within the virtual properties you cannot set or get the named property itself.
File.windowsShortcut - Archive of obsolete content
file.windowsshortcut in this example, the windowsshortcut method is used to add a shortcut in the program directory ("program" is a keyword for the directory in which the program itself is installed, for example, c:\program files\netscape\netscape 6\" on windows) to windows software (misc.exe) that is installed in the "windows" directory.
diskSpaceAvailable - Archive of obsolete content
you can use a string representing any file on the disk you want to check, and xpinstall will resolve the reference to the partition itself.
macAlias - Archive of obsolete content
aliasname a string representing the name of the alias itself.
modDateChanged - Archive of obsolete content
esource1 = getfolder("program", "file1.txt"); filesource2 = getfolder("program", "file2.txt"); err1 = file.moddate(filesource1); // the baseline returned err2 = file.moddatechanged(filesource1, err1); logcomment("file.moddatechanged should return 'false' = " + err2); // the reason it expects false is we're comparing // the return 'time stamp' value for // file1.txt with the actual file1.txt itself.
dragging - Archive of obsolete content
this attribute is set automatically; you shouldn't adjust it yourself.
textbox.onblur - Archive of obsolete content
from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
textbox.onfocus - Archive of obsolete content
from gecko 1.9 to gecko 12.0 (firefox 12.0 / thunderbird 12.0 / seamonkey 2.9), the script code would actually execute twice, once in the context of the anonymous html <input> element and once in the context of the <textbox> element itself.
Deprecated and defunct markup - Archive of obsolete content
--neil 03 march 2011 <bulletinboard> (made to support left/top styles, but <stack> can now do as well) <gripper> (inside of <scrollbar><thumb>; not to be used by itself) <listboxbody> (internal use only; part of xbl for <listbox>) <menubutton> (experiment in combining buttons and menus; use <button type> instead) <nativescrollbar> (displayed a native scrollbar; had been for mac only with native themes on) <outliner> (former name for <tree>; <listbox> had been "<tree>") <popup> (use menupopup) <package> (no longer present but in older documentat...
Accessing Files - Archive of obsolete content
the actual location of this directory will vary by user and system, so this is a convenient means to refer to a common directory without having to locate it yourself.
International characters in XUL JavaScript - Archive of obsolete content
cross-version compatibility if you want the same code to work in both gecko 1.8 and earlier versions, you must limit yourself to ascii.
startFind - Archive of obsolete content
the first time this is called for a given findbar, the findbar will flash to draw attention to itself.
onSearchComplete - Archive of obsolete content
you should not call this method yourself.
onTextEntered - Archive of obsolete content
you should not call this method yourself.
onTextReverted - Archive of obsolete content
you should not call this method yourself.
ContextMenus - Archive of obsolete content
note that the default attribute just affects how the item is displayed, it performs no other function itself.
Extensions - Archive of obsolete content
you may wish to use these properties instead of determining the type yourself, as the code already handles various special and complex cases that would take a lot of code to deal with manually.
MenuButtons - Archive of obsolete content
<toolbarbutton type="menu" image="cookies.png"> <menupopup> <menuitem label="block cookies" type="checkbox"/> <menuitem label="clear cookies"/> </menupopup> </toolbarbutton> the 'menu-button' button the 'menu-button' type of button is used when you want to attach a menu to a button but want to have a default action carried out when the button is pressed by itself.
OpenClose - Archive of obsolete content
finally, the last argument to the openpopup method, attributesoverride indicates whether attributes placed on the popup element itself override the arguments supplied.
Panels - Archive of obsolete content
<panel id="search-panel" noautohide="true"> <textbox id="search"/> <button label="search" oncommand="dosearch();"/> <button label="cancel" oncommand="this.parentnode.hidepopup();"/> </panel> because the panel can no longer be closed by clicking elsewhere, the panel should always provide a means to close the panel itself.
popupBoxObject - Archive of obsolete content
you wouldn't normally need to use this property as all of its functions are available via the popup itself.
webNavigation - Archive of obsolete content
most of its methods are callable directly on the element itself, such as goback and goforward.
Introduction - Archive of obsolete content
content generated by the template is inserted into the xul just as if you had placed it there yourself.
Rule Compilation - Archive of obsolete content
if the generated content itself contains hidden elements, those child elements will not be generated until necessary.
Simple Query Syntax - Archive of obsolete content
note that the menulist itself must use the extended syntax since it doesn't iterate over the children of a resource.
Template Logging - Archive of obsolete content
unfortunately, detecting network or parsing errors with the data itself can be difficult.
Using Recursive Templates - Archive of obsolete content
as each group has children itself, each result (in this case, each group) becomes the reference point for a futher iteration.
Things I've tried to do with XUL - Archive of obsolete content
resize event problems going with the inability to obtain the clientwidth/clientheight of xul elements, it's impossible to handle the "resize" event yourself to grow/shrink content as needed -- as you grow the content, when you shrink the window, the content will simply be clipped (because now it has a bigger size than the window).
Custom toolbar button - Archive of obsolete content
instead, you make your custom button as a self-contained extension in your profile.
Adding more elements - Archive of obsolete content
this first method would require that we set the style on the box itself.
Adding Style Sheets - Archive of obsolete content
this can be done with the code below, allowing you to remove the import from the xul file: style import from xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> style import from css: @import url(chrome://global/skin/); the second syntax is preferred because it reduces the number of dependencies within the xul file itself.
Advanced Rules - Archive of obsolete content
in the simple rule syntax, the conditions are placed directly on the rule element itself.
Box Objects - Archive of obsolete content
their function should be self explanatory from their names.
Commands - Archive of obsolete content
this function may be separate from the xul itself, and might be handled internally by a widget.
Document Object Model - Archive of obsolete content
javascript itself is just a scripting language that can access these objects because mozilla provides these objects for use.
Grids - Archive of obsolete content
ArchiveMozillaXULTutorialGrids
the grid does not display anything itself; it is used only to position elements in a tabular form with rows and columns.
Introduction - Archive of obsolete content
there are several ways you can use xul: firefox extension an extension adds functionality to the browser itself, often in the form of extra toolbars, context menus, or customizations to the browser's user interface.
Introduction to XBL - Archive of obsolete content
binding example the box is generic enough that you can use it to create custom widgets (although you can use any element, even one you make up yourself).
Manifest Files - Archive of obsolete content
make sure that the url in the line you added to installed-chrome.txt ends with a slash and the file itself ends with a blank line.
Property Files - Archive of obsolete content
stringbundles you could write the code to read properties yourself, however xul provides the stringbundle element which does this for you.
Splitters - Archive of obsolete content
it should be noted that the window does not resize itself automatically.
Tabboxes - Archive of obsolete content
the tabs element itself has been placed inside a tabbox.
The Chrome URL - Archive of obsolete content
of course, for extensions that modify the browser interface, the user will not need to know the url, as the extension will present itself in the ui.
Tree Box Objects - Archive of obsolete content
one important thing to note is that the coordinates are measured from the upper left corner of the containing document, not the edge of the tree itself.
Tree Selection - Archive of obsolete content
the view doesn't need to implement this object itself, the tree will assign a selection object to the view's selection property when the view is attached to a tree.
Tree View Details - Archive of obsolete content
remember that a custom view must keep track of which items are visible itself.
Trees - Archive of obsolete content
ArchiveMozillaXULTutorialTrees
of course, this is independant of the performance of the view object itself.
Using Spacers - Archive of obsolete content
it has resized itself also.
XUL Structure - Archive of obsolete content
it is worth noting that the mozilla browser itself is actually just a set of packages containing xul files, javascript and style sheets.
Using multiple DTDs - Archive of obsolete content
you have to make sure by yourself that the entities defined in the various dtds do not clash.
Using the Editor from XUL - Archive of obsolete content
nseditorshell is able to observe the document load on the <iframe>, because it implements nsidocumentloaderobserver, and registered itself as a doc loader when it was assigned the content window.
Writing Skinnable XUL and CSS - Archive of obsolete content
if you find yourself needing to display an image from the skin, then use <titledbutton> and style it rather than using <html:img>.
XUL Parser in Python/source - Archive of obsolete content
def strip(snip): t = re.sub('http://.*?\s', '', snip) return t class xulparser(xmllib.xmlparser): def unknown_starttag(self, t, a): name = strip(t) if name not in el_list: el_list[name] = {} for attr,val in a.items(): el_list[name][strip(attr)] = strip(val) def syntax_error(self, message): pass p = xulparser() cmd = 'dir /s /b *.xul' chrome_dir = 'c:\program files\netscape\netscape 6\chrome' os.chdir(chrome_dir) files = os.popen(cmd).readlines() for file in files: file = file.strip() print '** ' + ...
XUL and RDF - Archive of obsolete content
the second section describes the xul/rdf architecture itself and outlines enhancements to the xul language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data.
browser - Archive of obsolete content
most of its methods are callable directly on the element itself, such as goback and goforward.
menupopup - Archive of obsolete content
you wouldn't normally need to use this property as all of its functions are available via the popup itself.
panel - Archive of obsolete content
ArchiveMozillaXULpanel
you wouldn't normally need to use this property as all of its functions are available via the popup itself.
scrollbox - Archive of obsolete content
it is intended to be used when an application wants to be able to adjust the scroll position itself.
tabbrowser - Archive of obsolete content
most of its methods are callable directly on the element itself, such as goback and goforward.
tooltip - Archive of obsolete content
you wouldn't normally need to use this property as all of its functions are available via the popup itself.
tree - Archive of obsolete content
ArchiveMozillaXULtree
custom tree view nsitreeview no for this tree you implement the nsitreeview interface yourself.
treecol - Archive of obsolete content
this attribute is set automatically; you shouldn't adjust it yourself.
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
the inno setup script wizard can't set chrome directory's deployment point, so you have to edit the iss file yourself.
How to enable locale switching in a XULRunner application - Archive of obsolete content
this article is for developers who have localised their xul application using dtd entity files and want to provide their users with a mechanism to switch the locale in the application itself.
XULRunner tips - Archive of obsolete content
there are two approaches to display the branding of your application instead: when compiling xulrunner yourself: create a file module.ver in the directory mozilla/xulrunner/app with the contents: win32_module_description=myapplication myapplication should be replaced by whatever you want to see as title of the button.
Windows and menus in XULRunner - Archive of obsolete content
we could hard-code the images in the xul file itself, but css is a better practice.
Archived Mozilla and build documentation - Archive of obsolete content
in addition to being handy pointers to useful resources, bookmarks in mozilla can be used to make the address bar itself a power tool.
2006-11-22 - Archive of obsolete content
new mailing list for nvda steve lee was pleased to announce that the mozilla foundation has approved a grant spearheaded by himself and aaron leventhal for "improved switch access to firefox".
2006-12-01 - Archive of obsolete content
montessi posted a link to a bug that he himself added to bugzilla.
2006-11-10 - Archive of obsolete content
neil deakin points out that "downloads and other network operations are always done in another thread so you shouldn't be creating one yourself".
NPAPI plugin developer guide - Archive of obsolete content
plugins are shared libraries that users can install to display content that the application itself can't display natively.
Monitoring plugins - Archive of obsolete content
if you are new to the mozilla observer service, you may want to familiarize yourself with it before proceeding further.
NPEvent - Archive of obsolete content
if your plug-in ignores key events, return false, and the key events will be processed by the browser itself.
NPN_GetURLNotify - Archive of obsolete content
if this function is called with a target parameter value of _self or a parent to _self, this function should return nperr_invalid_param.
NPN_PostURL - Archive of obsolete content
if you specify _current, _self, or _top, the response data is written to the same plug-in window and the plug-in is unloaded.
NPN_PostURLNotify - Archive of obsolete content
if this function is called with a target parameter value of _self or a parent to _self, this function should return an invalid_param nperror.
NPN_Version - Archive of obsolete content
« gecko plugin api reference « browser side plug-in api summary lets plugins obtain version information, both of the plug-in api and of the browser itself.
NPP_Print - Archive of obsolete content
a full-page plug-in handles all aspects of printing itself.
NPPrint - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary contains information the plug-in needs to print itself in full-page or embedded mode.
NPVariantType - Archive of obsolete content
syntax typedef enum { npvarianttype_void, npvarianttype_null, npvarianttype_bool, npvarianttype_int32, npvarianttype_double, npvarianttype_string, npvarianttype_object } npvarianttype; description each type is self-explanatory.
NP_Shutdown - Archive of obsolete content
syntax #include <npapi.h> void np_shutdown(void); windows #include <npapi.h> void winapi np_shutdown(void); description the browser calls this function once after the last instance of your plug-in is destroyed, before unloading the plug-in library itself.
Shipping a plugin as a Toolkit bundle - Archive of obsolete content
the version is fairly self-descriptive, it must be a toolkit version format.
The First Install Problem - Archive of obsolete content
problem definition the first install problem is the name given to the conditions arising when a plugin or embeddable software installs itself on a system first, before any other gecko-based browser.
Getting Started - Archive of obsolete content
you'll retain the information more and absorb it better if you create the rss files yourself.
Security Controls - Archive of obsolete content
security controls to help thwart phishing, besides the management control of the acceptable use policy itself, include operational controls, such as training users not to fall for phishing scams, and technical controls that monitor emails and web site usage for signs of phishing activity.
SSL and TLS - Archive of obsolete content
the handshake allows the server to authenticate itself to the client using public-key techniques, then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows.
Tamarin Tracing Build Documentation - Archive of obsolete content
description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/sandbox/ tryserver etiquette the sandbox is not a good substitute for running the regression tests locally to catch obvious problems.
Making sure your theme works with RTL locales - Archive of obsolete content
a screenshot of firefox 2 in hebrew what you need to do at this stage you might ask yourself, "how would i know what language is my theme installed on?
Theme changes in Firefox 4 - Archive of obsolete content
overriding the default values themes can override the value of the iconsize attribute on each toolbar by specifying a special value for the counter-reset css property on the toolbar itself.
Scratchpad - Archive of obsolete content
this is useful if you are working on firefox itself or developing add-ons.
Developing cross-browser and cross-platform pages - Archive of obsolete content
the browser will not error if you set this unimplemented property, so you do not need to check that the visiblity property itself exists.
Using the W3C DOM - Archive of obsolete content
in addition to these access methods, the w3c dom specifications provide methods for creating new elements and inserting them in a document, for creating attributes, new content, for traversing the content tree and for handling events dispatched as the user interacts with the document itself.
Using workers in extensions - Archive of obsolete content
var self = this; this.worker.onmessage = function(event) { self.onworkermessage.call(self, event); }; this.worker.postmessage(this.tickersymbol); }, the worker is set up and configured here in lines 13-22: line 13 instantiates a new worker, specifying the uri of the ticker_worker.js file.
-moz-stack-sizing - Archive of obsolete content
the property is set not on the stack itself, but on the stack's children.
E4X for templating - Archive of obsolete content
], it, lev); ++it; } } return ret; } the following real case example iterates over an array of the lines in an e4x child element to produce an xmllist of multiple vbox's representing each line: <vbox> {foreach(e(someel.somechild[0]).split('\n'), function (line) <description>{line}</description> )} </vbox> the following example shows iteration over an e4x object itself: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem}</row> <row><image src="chrome://myext/skin/images/fillerrow.jpg" /></row> </>)} or if the e4x child element had its own children and text: {foreach(elems, function (k, elem, iter) <> <row>{k}: {elem.text()} {elem.somechild}</row> <row><image src="chrome://myext/skin/images/fillerrow.jpg" /></row> </>)} sorting /...
Iterator - Archive of obsolete content
if object is the iterator instance or generator instance, it returns object itself.
Array comprehensions - Archive of obsolete content
the input to an array comprehension does not itself need to be an array; iterators and generators can also be used.
Generator comprehensions - Archive of obsolete content
when the input to the comprehension is itself a small array the overhead involved is insignificant — but when the input is a large array or an expensive (or indeed infinite) generator the creation of a new array can be problematic.
GetObject - Archive of obsolete content
if an object has registered itself as a single-instance object, only one instance of the object is created, no matter how many times activexobject is executed.
@set - Archive of obsolete content
this works because nan is the only value not equal to itself.
New in JavaScript 1.8.5 - Archive of obsolete content
function.prototype.bind() creates a new function that, when called, itself calls this function in the context provided (with a given sequence of arguments).
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
while most of the runat attribute values above are self explanatory, the server-proxy concept is best explained through example.
Server-Side JavaScript - Archive of obsolete content
today with computing cycles having increased more than 10-fold and mozilla's work on rhino (javascript interpreter in java) and spidermonkey (javascript interpreter in c) and javascript itself, we have very solid foundations for javascript to be extraordinarily useful and applicable on the server-side again -- with performance in the same range as popular server-side environments like php and ruby on rails.
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
so i decided to break up the content so that there is a self-contained bit of markup for each fish, and then get down to styling.
background-size - Archive of obsolete content
remember you have to test yourself, don't trust online references, don't trust webkit | apple | google homepage, they are wrong.
Building Mozilla XForms - Archive of obsolete content
the built xpi file will only install on a nightly snapshot from the same day or your self-built firefox version.
XForms Custom Controls - Archive of obsolete content
these are: xformswidget-general - defines utility properties and methods common for all xforms controls xformswidget-accessors - defines the methods that are allow the bindings to work with bound instance nodes and the xforms element itself.
XForms Label Element - Archive of obsolete content
ui behavior accesskey support - if the accesskey attribute is specified on labeled xforms controls or on the label element itself then the label text for the control will contain an indicator as to what the access key is in a standard way.
XForms Repeat Element - Archive of obsolete content
introduction a repeat element contains markup and is itself bound to a nodeset in an instance document (see the spec).
Mozilla XForms User Interface - Archive of obsolete content
repeat a repeat element contains markup and is itself bound to a nodeset in an instance document (see the spec).
Using the Right Markup to Invoke Plugins - Archive of obsolete content
furthermore, ie's use of the codebase attribute as an obtainment mechanism itself is not strictly correct according to the html 4.01 specification, which says that the codebase attribute should be used to qualify urns referenced by the data, archive, and classid attributes.
Archive of obsolete content
or whenever you make network requests yourself, you almost always need to enforce same-origin policy.
Publishing games - Game development
game distribution provides all you need to know about the ways you can distribute your newly created game into the wild — including hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like google play or the ios app store.
Bounding volume collision detection with THREE.js - Game development
var knot = new three.mesh( new three.torusknotgeometry(0.5, 0.1), new meshnormalmaterial({})); knot.geometry.computeboundingbox(); var knotbbox = new box3( knot.geometry.boundingbox.min, knot.geometry.boundingbox.max); note: the boundingbox property takes the geometry itself as reference, and not the mesh.
Explaining basic 3D theory - Game development
if you want to move on to practice and see some demos in action, follow up with the tutorials below: building up a basic demo with three.js building up a basic demo with babylon.js building up a basic demo with playcanvas building up a basic demo with a-frame go ahead and create some cool cutting-edge 3d experiments yourself!
Building up a basic demo with Babylon.js - Game development
conclusion here's the final code listing, along with a viewable live example: you can also see it on github and fork the repository if you want to play with it yourself locally.
Building up a basic demo with the PlayCanvas engine - Game development
conclusion here's the final code listing, along with a viewable live example: you can also see it on github and fork the repository if you want to play with it yourself locally.
Building up a basic demo with PlayCanvas - Game development
engine vs editor the engine itself can be used as a standard library by including its javascript file directly in your html, so you can start coding right away; in addition the playcanvas toolset comes with an online editor that you can use to drag and drop components onto the scene — a great way to create games and other apps requiring scenes if you're more of a designer than a coder.
Building up a basic demo with Three.js - Game development
the geometry itself is not enough though, we also need a material that will be used for our shape.
WebVR — Virtual Reality for the Web - Game development
the concept of virtual reality in itself isn't new, but now we have the technology to have it working as it should be, and a javascript api to make use of it in web applications.
3D games on the Web - Game development
using a framework for 3d games also helps optimize the performance as a lot is taken care of by the tools you use, so you can focus on building the game itself.
Desktop gamepad controls - Game development
we have successfully implemented gamepad controls in our game — try connecting any popular controller like the xbox 360 one and see for yourself how fun it is to avoid the asteroids and shoot the aliens with a gamepad.
Mobile touch controls - Game development
hauling in phaser, if enabled, will work out of the box — you don't have to set the position of the sprite yourself manually, so you could leave the ondragstart() function empty, or place some debug output to see if it's working correctly.
Efficient animation for web games - Game development
how this conclusion was reached, however, is more important than the conclusion itself.
WebRTC data channels - Game development
there's also a broker server component and a hosted broker you can use instead of having to set one up for yourself.
Bounce off the walls - Game development
remembering that the coordinate system starts from the top left, we can come up with something like this: if(y + dy < 0) { dy = -dy; } if the y value of the ball position is lower than zero, change the direction of the movement on the y axis by setting it equal to itself, reversed.
Finishing up - Game development
replace the following line: var interval = setinterval(draw, 10); with simply: draw(); and remove each instance of: clearinterval(interval); // needed for chrome to end game then, at the very bottom of the draw() function (just before the closing curly brace), add in the following line, which causes the draw() function to call itself over and over again: requestanimationframe(draw); the draw() function is now getting executed again and again within a requestanimationframe() loop, but instead of the fixed 10 milliseconds frame rate, we are giving control of the framerate back to the browser.
Mouse controls - Game development
the game itself is actually finished, so let's work on polishing it up.
Move the ball - Game development
ting draw() function with the following two functions: function drawball() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); drawball(); x += dx; y += dy; } compare your code you can check the finished code for this article for yourself in the live demo below, and play with it to understand better how it works: exercise: try changing the speed of the moving ball, or the direction it moves in.
Track the score and win - Game development
the first parameter is the text itself — the code above shows the current number of points — and the last two parameters are the coordinates where the text will be placed on the canvas.
2D breakout game using pure JavaScript - Game development
frameworks are just tools built with the javascript language; so even if you plan on working with them, it's good to learn about the language itself first to know what exactly is going on under the hood.
Build the brick field - Game development
initbricks(); } now onto the function itself.
Load the assets and print them on screen - Game development
compare your code you can check the finished code for this lesson for yourself in the live demo below, and play with it to better understand how it works: next steps printing out the ball was easy; next, we'll try moving the ball on screen.
Visual typescript game engine - Game development
config.js | ├── database/ | | ├── database.js | | ├── common/ | | ├── email/ | | | ├── templates/ | | | | ├── confirmation.html.js | | | ├── nocommit.js (no commited for now) | | └── data/ (ignored - db system folder) | ├── rtc/ | | ├── server.ts | | ├── connector.ts | | ├── self-cert/ server part installed database: mongodb@3.1.8 -no typescript here, we need to keep state clear no.
Algorithm - MDN Web Docs Glossary: Definitions of Web-related terms
an algorithm is a self-contained series of instructions to perform a function.
Alignment subject - MDN Web Docs Glossary: Definitions of Web-related terms
for justify-self and align-self, the alignment subject is the margin box of the box the property is set on, using the writing mode of that box.
Client hints - MDN Web Docs Glossary: Definitions of Web-related terms
basically, with the client hints header, the developer or application can tell the browser to advertise information about itself to the server, such as the device pixel ratio, the viewport width, and the display width.
Domain - MDN Web Docs Glossary: Definitions of Web-related terms
"developer" is a "sub-domain", something you as the owner of a domain may define yourself.
Dominator - MDN Web Docs Glossary: Definitions of Web-related terms
so objects that a dominates contribute to the retained size of a: that is, the total amount of memory that could be freed if a itself were freed.
First-class Function - MDN Web Docs Glossary: Definitions of Web-related terms
if you invoked sayhello directly, it would return the function itself without invoking its returned function.
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference align-content align-items align-self flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content order further reading css flexible box layout module level 1 specification css flexbox guide: basic concepts of flexbox css flexbox guide: relationship of flexbox to other layout methods css flexbox guide: aligning items in a flex container css flexbox guide: ordering flex items css flexbo...
Flex Item - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference align-self flex-basis flex-grow flex-shrink order further reading css flexbox guide: basic concepts of flexbox css flexbox guide: ordering flex items css flexbox guide: controlling ratios of flex items along the main axis ...
Flexbox - MDN Web Docs Glossary: Definitions of Web-related terms
learn more property reference align-content align-items align-self flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content order further reading css flexible box layout module level 1 specification css flexbox guide: basic concepts of flexbox css flexbox guide: relationship of flexbox to other layout methods css flexbox guide: aligning items in a flex container css flexbox guide: ordering flex items css flexbo...
General header - MDN Web Docs Glossary: Definitions of Web-related terms
a general header is an http header that can be used in both request and response messages but doesn't apply to the content itself.
Mixin - MDN Web Docs Glossary: Definitions of Web-related terms
the new class or interface then includes both the properties and methods from the mixin as well as those it defines itself.
Native - MDN Web Docs Glossary: Definitions of Web-related terms
on the other hand, a web app that runs inside a browser is not native — it is run in the web browser, which sits on top of the native environment, not the native environment itself.
Node (DOM) - MDN Web Docs Glossary: Definitions of Web-related terms
GlossaryNodeDOM
various things that are nodes are the document itself, elements, text, and comments.
Node - MDN Web Docs Glossary: Definitions of Web-related terms
various things that are nodes are the document itself, elements, text, and comments.
OOP - MDN Web Docs Glossary: Definitions of Web-related terms
oop (object-oriented programming) is an approach in programming in which data is encapsulated within objects and the object itself is operated on, rather than its component parts.
Primitive - MDN Web Docs Glossary: Definitions of Web-related terms
it is important not to confuse a primitive itself with a variable assigned a primitive value.
Reference - MDN Web Docs Glossary: Definitions of Web-related terms
on mdn, we could be talking about the javascript reference itself.
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
eaders can use it as a signpost to help visually impaired users navigate a page finding blocks of meaningful code is significantly easier than searching though endless divs with or without semantic or namespaced classes suggests to the developer the type of data that will be populated semantic naming mirrors proper custom element/component naming when approaching which markup to use, ask yourself, "what element(s) best describe/represent the data that i'm going to populate?" for example, is it a list of data?; ordered, unordered?; is it an article with sections and an aside of related information?; does it list out definitions?; is it a figure or image that needs a caption?; should it have a header and a footer in addition to the global site-wide header and footer?; etc.
Session Hijacking - MDN Web Docs Glossary: Definitions of Web-related terms
session hijacking occurs because no account lockout for invalid session ids weak session-id generation algorithm insecure handling indefinite session expiration time short session ids transmission in plain text session hijacking process sniff, that is perform a man-in-the-middle (mitm) attack, place yourself between victim and server.
Static method - MDN Web Docs Glossary: Definitions of Web-related terms
examples in the notifications api, the notification.requestpermission() method is called on the actual notification constructor itself — it is a static method: let promise = notification.requestpermission(); the notification.close() method on the other hand, is an instance method — it is called on an specific notification object instance to close the system notification it represents: let mynotification = new notification('this is my notification'); mynotification.close(); ...
TCP slow start - MDN Web Docs Glossary: Definitions of Web-related terms
congestion control congestion itself is a state that happens within a network layer when the message traffic is too busy it slows the network response time.
Cacheable - MDN Web Docs Glossary: Definitions of Web-related terms
not all http responses can be cached, these are the following constraints for an http response to be cached: the method used in the request is itself cacheable, that is either a get or a head method.
Percent-encoding - MDN Web Docs Glossary: Definitions of Web-related terms
special characters needing encoding are: ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', "'", '(', ')', '*', '+', ',', ';', '=', as well as '%' itself.
User agent - MDN Web Docs Glossary: Definitions of Web-related terms
along with each request they make to the server, browsers include a self-identifying user-agent http header called a user agent (ua) string.
Test your skills: CSS and JavaScript accessibility - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
HTML: A good basis for accessibility - Learn web development
this can only be done visually for the above table (see bad-table.html and try the example out yourself).
HTML: A good basis for accessibility - Learn web development
this can only be done visually for the above table (see bad-table.html and try the example out yourself).
Test your skills: HTML accessibility - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: WAI-ARIA - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Advanced styling effects - Learn web development
the really nice thing about filters however, is that they work on the exact shapes of the content inside the box, not just the box itself as one big chunk, so it is worth knowing the difference.
Test your skills: The Cascade - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Images and Form elements - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Overflow - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Overflowing content - Learn web development
the content of the box that you have changed the value of overflow for acquires a self-contained layout.
Test your skills: The Box Model - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Selectors - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
CSS selectors - Learn web development
the :hover pseudo-class for example selects an element only when it is being hovered over by the mouse pointer: a:hover { } it also includes pseudo-elements, which select a certain part of an element rather than the element itself.
Sizing items in CSS - Learn web development
this size is described as the intrinsic size — which comes from the image itself.
Test your skills: sizing - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: tables - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: backgrounds and borders - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: values and units - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Writing Modes and Logical Properties - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Flexbox - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Floats - Learn web development
see the article on legacy layout methods for information on how they used to be used, which may be useful if you find yourself working on older projects.
Test your skills: floats - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test Your Skills: Fundamental layout comprehension - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Grid Layout - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Multicol - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: position - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Media Queries and Responsive Design - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
How CSS is structured - Learn web development
try this experiment for yourself!
CSS first steps - Learn web development
how css is structured now that you have an idea about what css is and the basics of using it, it is time to look a little deeper into the structure of the language itself.
Using CSS generated content - Learn web development
html a text where i need to <span class="ref">something</span> css .ref::before { font-weight: bold; color: navy; content: "reference "; } output the character set of a stylesheet is utf-8 by default, but it can also be specified in the link, in the stylesheet itself, or in other ways.
create fancy boxes - Learn web development
pseudo-elements when styling a single box, you could find yourself limited and could wish to have more boxes to create even more amazing styles.
What HTML features promote accessibility? - Learn web development
link titles if you have a link that isn’t self-descriptive, or the link destination could benefit from being explained in more detail, you can add information to a link using the title attribute.
Basic native form controls - Learn web development
then we also have the <button> element itself.
Styling web forms - Learn web development
using this we can easily position our elements, including the title and all the form elements: h1 { font : 1em "typewriter", monospace; align-self : end; } #message { grid-row: 1 / 5; } #from, #reply { display: flex; } labels and controls now we can start working on the form elements themselves.
Test your skills: Advanced styling - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Basic controls - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Form structure - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Form validation - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: HTML5 controls - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Other controls - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Styling basics - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
HTML basics - Learn web development
for example, take the following line of content: my cat is very grumpy if we wanted the line to stand by itself, we could specify that it is a paragraph by enclosing it in paragraph tags: <p>my cat is very grumpy</p> anatomy of an html element let's explore this paragraph element a bit further.
JavaScript basics - Learn web development
javascript itself is relatively compact, yet very flexible.
The web and web standards - Learn web development
once you embrace the constant change and uncertainty of the web, you'll start to enjoy yourself.
Define terms with HTML - Learn web development
bold itself is a concept foreign to html, but there are tags for indicating emphasis.
Creating hyperlinks - Learn web development
on each page, remove just the link to that same page — it's confusing and unnecessary for a page to include a link to itself.
Document and website structure - Learn web development
it's a place to put common information (like the header) but usually, that information is not critical or secondary to the website itself.
Marking up a letter - Learn web development
award yourself bonus points if it validates.
Test your skills: Advanced HTML text - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: HTML text basics - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Links - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: HTML images - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Images in HTML - Learn web development
this is because the element's content and size are defined by an external resource (like an image or video file), not by the contents of the element itself.
Responsive images - Learn web development
here's a simple example: this works well on a wide screen device, such as a laptop or desktop (you can see the example live and find the source code on github.) we won't discuss the css much in this lesson, except to say that: the body content has been set to a maximum width of 1200 pixels — in viewports above that width, the body remains at 1200px and centers itself in the available space.
Test your skills: Multimedia and embedding - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
HTML table basics - Learn web development
LearnHTMLTablesBasics
active learning: colgroup and col now it's time to have a go yourself.
Making asynchronous programming easier with async and await - Learn web development
status: ${response.status}`); } else { return await response.blob(); } } myfetch().then((blob) => { let objecturl = url.createobjecturl(blob); let image = document.createelement('img'); image.src = objecturl; document.body.appendchild(image); }).catch(e => console.log(e)); you can try typing in the example yourself, or running our live example (see also the source code).
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
note: try this yourself first; if you get really stuck, check out of our live example and source code.
Function return values - Learn web development
o when you execute the following: ctx.arc(random(width), random(height), random(50), 0, 2 * math.pi); if the three random() calls returned the values 500, 200, and 35, respectively, the line would actually be run as if it were this: ctx.arc(500, 200, 35, 0, 2 * math.pi); the function calls on the line are run first, and their return values substituted for the function calls, before the line itself is then executed.
Test your skills: Conditionals - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Events - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Functions - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Loops - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Fetching data from the server - Learn web development
you can test the fail case yourself: make a local copy of the example files (download and unpack the can-store zip file).
Introduction to web APIs - Learn web development
apis in client-side javascript client-side javascript, in particular, has many apis available to it — these are not part of the javascript language itself, rather they are built on top of the core javascript language, providing you with extra superpowers to use in your javascript code.
Third-party APIs - Learn web development
to start this section, make yourself a copy of the mapquest starter file, in a new directory.
Silly story generator - Learn web development
there is a particular string method that will help you here — in each case, make the call to the method equal to newstory, so each time it is called, newstory is made equal to itself, but with substitutions made.
Test your skills: Arrays - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Math - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Strings - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: variables - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
What went wrong? Troubleshooting JavaScript - Learn web development
go to github and make yourself a local copy of number-game-errors.html (see it running live here).
Adding features to our bouncing balls demo - Learn web development
it might be a good idea to save a separate copy of the demo after you get each stage working, so you can refer back to it if you find yourself in trouble later on.
Object-oriented JavaScript for beginners - Learn web development
note: if you get stuck, we have provided an answer inside our github repo (see it live) — try writing it yourself first though!
Test your skills: Object-oriented JavaScript - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Test your skills: Object basics - Learn web development
you can write the code yourself, or use the starting point files linked to in the above sections.
Aprender y obtener ayuda - Learn web development
give yourself rewards.
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
try restarting the dev server and going to localhost: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!
Accessibility in React - Learn web development
useref() and useeffect() are somewhat advanced features, and you should be proud of yourself for using them!
Componentizing our React app - Learn web development
make yourself a new form() component with the same basic structure as todo(), and export that component.
React resources - Learn web development
if you'd like to try this api for yourself, smashing magazine has written an introductory article about react context.
Starting our Svelte Todo list app - Learn web development
] by design, these warnings are implemented in the compiler itself, and not as a plug-in that you may choose to add to your project.
Componentizing our Svelte app - Learn web development
a component is a reusable, self-contained block of code that encapsulates html, css and javascript that belong together, written into a .svelte file.
Vue resources - Learn web development
vue github repo — the vue code itself.
Understanding client-side JavaScript frameworks - Learn web development
after that, we'll provide some tutorials covering the essentials of some of the different framework choices, to provide you with enough context and familiarity to start going into greater depth yourself.
Handling common accessibility problems - Learn web development
if you are inventing them yourself, you need to make sure that they are keyboard accessible; if you are using some kind of third-party framework, carefully review the options available to see how accessible they are before diving in.
Introduction to cross browser testing - Learn web development
the most lo-fi option is to just do all the testing you can by yourself (pulling in team mates to help out if you are working in a team).
Handling common JavaScript problems - Learn web development
we'd like you to try fixing this problem yourself.
Cross browser testing - Learn web development
what browsers, devices, and other segments should you make sure are tested), lo-fi testing strategies (get yourself a range of devices and some virtual machines and do ad-hoc tests when needed), higher tech strategies (automation, using dedicated testing apps), and testing with user groups.
Introducing a complete toolchain - Learn web development
since this module is all about learning the tools around web development, not web development code itself, we won’t be teaching you any actual coding — you’ll find that information in the rest of mdn!
ChromeWorkers and the Chrome worker loader
that makes it available not only to the application itself, but also to add-ons.
Accessibility information for UI designers and developers
see also: understanding success criterion 2.3.3: animation from interactions content on hover or focus if content is revealed on hover or focus, for example in tooltips, there are some things to keep in mind: if the extra content obscures existing content, there should be a way to close it without moving focus if the extra content is opened on hover, hovering the additional content itself should not cause it to disappear consistent navigation navigation should be consistent across different pages on your site.
Mozilla's Section 508 Compliance
mozilla seamonkey rv1.8a4 is with each one: requirement windows linux/unix mac os requirement windows linux/unix mac os (a) when software is designed to run on a system that has a keyboard, product functions shall be executable from a keyboard where the function itself or the result of performing a function can be discerned textually.
Multiprocess on Windows
since gecko's main thread uses com, and com requires threads to declare their threading model, the main thread must initialize itself to live inside its own single threaded apartment (sta).
Accessible Toolkit Checklist
+c, ctrl+i, ctrl+u, ctrl+x, ctrl+v, ctrl+[shift]+z in multiline text field, enter key inserts new line (thus default button no longer shows dark border when multiline text field is focused) in autocomplete text fields, make sure the autocomplete popup doesn't receive actual or msaa focus unless an up/down arrow is pressed, and don't use the default system highlight color in the list itself unless it really has focus in autocomplete text fields, make sure that the delete or backspace key removes all auto completed selected text.
ZoomText
our main focus is on the browser itself, so you you only need to install mailnews or address book if curious about the other apps.
Add-ons
you’ll find: overview of the firefox extension features tools and processes for developing and testing how to publish your extension on addons.mozilla.org or distribute it yourself how to manage your published extension an enterprise guide for developing and using extensions how to develop themes for firefox firefox developer communities extensions for firefox for android in 2020, mozilla will release a new firefox for android experience.
Adding a new event
define and create dom event class manually otherwise, you need to implement a dom event class yourself.
A bird's-eye view of the Mozilla framework
the xpidl interface description is independent of the programming language used to implement the object itself.
Testopia
despite bugzilla 5.0 has already been released a few months ago, we don't plan to release a fix for testopia immediately, because it's currently under heavy work to make testopia a fully self-contained extension, which means that all tr_*.cgi scripts which are currently in the bugzilla/ root directory are being moved into extensions/testopia/lib/.
What to do and what not to do in Bugzilla
resolving bugs some general rules: when you resolve a bug, cc yourself so that you are informed when new facts come up.
Bugzilla
bugzilla etiquette a guide to etiquette; this guide will help you understand how best to conduct yourself on b.m.o.
Choosing the right memory allocator
mprintf(), pr_sprintf_append(), pr_vsmprintf() and pr_vsprintf_append() must be freed with pr_smprintf_free() pl_strdup(), pl_strndup() must be freed with pl_strfree() nscrt::strdup/nscrt::strndup must be freed with nscrt::free allocating memory within plugins there are special memory allocation routines specifically intended for use from plugins, which must not be used from within mozilla itself.
Chrome registration
the providers work together to supply a complete set of chrome for a particular window, from the images on the toolbar buttons to the files that describe the text, content, and appearance of the window itself.
Creating a Firefox sidebar
it's the easiest way to create an extension with a sidebar.obsolete since gecko 57 you can also build a restartless extension yourself without the sdk.
HTTP logging
pat yourself on the back--a job well done!
Debugging
documentation topics debugging on top of the mozilla platform debugging javascript code how to debug javascript code, with a focus on debugging code in the mozilla project itself.
Articles for new developers
to help you find the most critical stuff as quickly as possible, we've created this list of the articles you'll find most useful as you get yourself oriented and make your first contributions to the project.
Configuring Build Options
be aware that changing your mozconfig will require the configure process to be rerun and therefore the build will take considerably longer, so if you find yourself changing the same options regularly, it may be worth having a separate mozconfig for each.
pymake
on other operating systems (linux, os x, etc), pymake itself only requires python 2.6 or higher (but not python 3).
The Firefox codebase: CSS Guidelines
finally, once you have checked all the things above, you can permit yourself to use !important along with a comment why it is needed.
Creating Custom Events That Can Pass Data
you can try to rewrite code but it will have to be a lot of code because nsdomevent uses a lot of code outside of itself which you, again, cannot access from an extension.
Inner and outer windows
then add to that the concept of frames, whereby a document in a window can itself contain other documents, which in turn can contain more documents.
Error codes returned by Mozilla APIs
for instance, a node cannot be inserted into a descendant of itself.
Limitations of chrome scripts
the event object itself is relayed to the chrome process as a cpow.
Firefox Operational Information Database: SQLite
in the manager, select the database you want to explore in the '(select profile database)' pulldown, click 'go', select one of the tables listed in the left column and see the current contents of the database in the 'browse & search' tab.) some databases are used by the browser itself, others are used by applications that you have installed or used; for example: content-prefs.sqlite cookies.sqlite download.sqlite formhistory.sqlite persmissions.sqlite places.sqlite search.sqlite signons.sqlite webappstore.sqlite ...
HTMLIFrameElement.purgeHistory()
note: to delete cookies for a firefox os app, you could call clearbrowserdata() on the actual app itself.
Embedding the editor
the problem with this ownership model is that there can be only one editor per <editor> tag, yet the document loaded in the <iframe> may itself contain multiple <iframe>s (consider a frameset document, or a document itself containing an <html:iframe>).
Roll your own browser: An embedding how-to
there are two functions that are needed: nsresult ns_initembedding(const char *apath); nsresult ns_termembedding(); pretty self-explanatory.
HTML parser threading
if the script was executed without blocking, the executor dispatches an event to reflush itself.
Getting Started with Chat
egistered, you need to type this every time you want to sign into channels using your registered nickname /msg nickserv help this displays a list of commands which can be used with nickserv /msg nickserv help register this displays helpful information about nickname registration /msg nickserv help identify this displays helpful information about identifying yourself upon sign in for more information about nickserv go here.
HTTP Cache
cachestorage, implementing the nsicachestorage interface, is forwarding all calls to internal methods of cachestorageservice passing itself as an argument.
How Mozilla determines MIME Types
note that the extension here comes from the content-disposition header if present, and from the url itself otherwise.
How to implement a custom autocomplete search component
}; // factory var simpleautocompletesearchfactory = { singleton: null, createinstance: function (aouter, aiid) { if (aouter != null) throw components.results.ns_error_no_aggregation; if (this.singleton == null) this.singleton = new simpleautocompletesearch(); return this.singleton.queryinterface(aiid); } }; // module var simpleautocompletesearchmodule = { registerself: function(acompmgr, afilespec, alocation, atype) { acompmgr = acompmgr.queryinterface(components.interfaces.nsicomponentregistrar); acompmgr.registerfactorylocation(class_id, class_name, contract_id, afilespec, alocation, atype); }, unregisterself: function(acompmgr, alocation, atype) { acompmgr = acompmgr.queryinterface(components.interfaces.nsicomponentregistrar); acompmgr.
How to Report a Hung Firefox
this may be because of a code error within firefox itself, such as a deadlock or infinite loop, or it may be caused by 3rd-party software such as a firefox extension, antivirus software, or even malware or a virus on your computer.
IME handling guide
if this notification is tried to sent before sending notify_ime_of_focus, all pending notifications and notify_ime_of_blur itself are canceled.
IPDL Tutorial
otherfunction above) the parameter is, for both resolve and success callbacks, the returns value itself (as a const reference); if the message returns multiple values (e.g.
AsyncShutdown.jsm
instances of phase note that you cannot create an instance of phase yourself.
API-provided widgets
if you're in an add-on, you should not set this property, and should instead include the shortcut as part of the tooltiptext you pass in yourself.
Widget Wrappers
this will point to the overflow chevron on overflowable toolbars if and only if your widget node is overflowed, to the anchor for the panel menu if your widget is inside the panel menu, and to the node itself in all other cases overflowed boolean indicating whether the node is currently in the overflow panel of the toolbar isgroup false, will be true for the group widget label for api-provided widgets, convenience getter for the label attribute of the dom node tooltiptext for api-provided widgets, convenience getter for the tooltiptext attribute of the d...
OS.File for the main thread
on most operating systems, this operation is handled directly by the operating system itself, which makes it as fast as possible.
OSFile.jsm
os.file is designed for efficient, unrestricted, manipulation of files by firefox itself and by add-ons.
PerfMeasurement.jsm
note: the perfmeasurement.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an add-on.
PopupNotifications.jsm
note: this code module is imported by firefox chrome windows, so you don't have to do it yourself in most extensions.
Promise
specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.
Promise.jsm
specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.
Deferred
specifying a rejected promise would make the rejection reason equal to the rejected promise itself, and not its rejection reason.
Sqlite.jsm
note: the sqlite.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an add-on.
WebChannel.jsm
registers the channel itself with the webchannelbroker.
WebRequest.jsm
types: ["image"] }, ["blocking"]); function redirect(e) { console.log("redirecting: " + e.url); return {redirecturl: "https://38.media.tumblr.com/tumblr_ldbj01lzip1qe0eclo1_500.gif"}; } modifying headers this code changes the user agent header so the browser identifies itself as ie 11, but only when visiting pages under "http://useragentstring.com/": let {webrequest} = cu.import("resource://gre/modules/webrequest.jsm", {}); cu.import("resource://gre/modules/matchpattern.jsm"); let pattern = new matchpattern("http://useragentstring.com/*"); let ua = "mozilla/5.0 (windows nt 6.1; wow64; trident/7.0; as; rv:11.0) like gecko"; webrequest.onbeforesendheaders.addlistene...
Webapps.jsm
ids: function(aissigned, azipreader, aconverter, anewapp, aoldapp,) _checkforstoreidmatch: function(aisupdate, anewapp, astoreid, astoreversion) revertdownloadpackage: function(aid, aoldapp, anewapp, aisupdate, aerror) uninstall: function(amanifesturl) _promptforuninstall: function(adata) confirmuninstall: function(adata) denyuninstall: function(adata, areason = "error_unknown_failure") getself: function(adata, amm) checkinstalled: function(adata, amm) getinstalled: function(adata, amm) getnotinstalled: function(adata, amm) geticon: function(adata, amm) getall: function(acallback) isreceipt: function(data) addreceipt: function(adata, amm) removereceipt: function(adata, amm) replacereceipt: function(adata, amm) setenabled: function(adata) getmanifestfor: function(amanifesturl,...
JavaScript code modules
for example, a module could be used by firefox itself as well as by extensions, in order to avoid code duplication.
Application Translation with Mercurial
opening english files and the target locale side-by-side the localization report shows the ids of added or removed texts, but the english text itself is still unknown.
Localization content best practices
if you have doubts about the localizability of some text or structure (not about the text itself, that would need copywriters), it's definitely good to ask feedback.
Localizing XLIFF files for iOS
push your commit into the github repo: git push kick up your feet, pop open a cold beer (or soda), and pat yourself on the back for doing something new, different, and exciting!
Localizing with Koala
a good way of doing that is to ask yourself a question: "if i was a new person to this project and new nothing about the work already done in this repository, would this message help me understand what changes were made in this revision?".
Localizing with Pontoon
you can now pat yourself on the back, do a little dance, go to sleep or do something else to celebrate your work!
QA phase
you might have created it yourself by running hg init or hg clone or you might have had it created by koala when you were setting up a new localization project.
Translation phase
these are the l10n tools we use to localize mozilla web projects: pontoon a web-based, what-you-see-is-what-you-get (wysiwyg) l10n tool that allows you to localize mozilla websites within the site itself.
Localization sign-off reviews
newly translated strings that shouldn't have been translated self-explanatory enough, right?
Mozilla Port Blocking
each protocol's handler can override this blocking for itself in order to enable the required access for that protocol.
Mozilla Web Developer FAQ
it does not (and should not) center the block box itself.
Mozilla Style System Documentation
roosevelt said that <quote>"we have nothing to fear but <span class="emph">fear itself</span>."</para> </doc> this will lead to a rule tree that looks like this, where each node is in the format [name of node: rule it points to]: [a: null] ,------' / \ `------.
Activity Monitor, Battery Status Menu and top
power 50300 firefox 12.9 278 26.6 76256 plugin-container 3.4 159 11.3 151 coreaudiod 0.9 68 4.3 76505 top 1.5 1 1.6 76354 activity monitor 1.0 0 1.0 the pid, command and %cpu columns are self-explanatory.
Leak-hunting strategies and tips
the wrapper itself is just a normal reference-counted object, so a leaked nsxpcwrappedjs can be debugged using the normal refcount-balancer tools.
Measuring performance using the PerfMeasurement.jsm code module
note: the perfmeasurement.jsm javascript code module can only be used from chrome -- that is, from within the application itself or an add-on.
Memory reporting
they let you measure the mystring object itself or not as necessary.
Power profiling overview
some can also be measured via instrumentation within firefox itself.
Profiling with the Firefox Profiler
if you built firefox yourself, it will attempt to use some cleverness3 to grab the symbols from your binary.
Profiling with the Gecko Profiler and Local Symbols on Windows
follow the steps below: note: you only need to do this if you're on windows and you've built firefox yourself.
Reporting a Performance Problem
if possible let the problem manifest itself for 5-10 seconds.
Localization Use Cases
0 : 1; var sizeinfo = filesizeformatter.getreadablefilesize(size, fixeddigits); var _ = navigator.mozl10n.get; element.textcontent = _(l10nid, { size: sizeinfo.size, unit: _('byteunit-' + sizeinfo.unit) }); } the function is used like so: // application storage updateappfreespace: function storage_updateappfreespace() { var self = this; this.getfreespace(this.appstorage, function(freespace) { devicestoragehelper.showformatedsize(self.appstoragedesc, 'availablesize', freespace); }); }, problem definition for all values of freespace, the following string is enough to construct a grammatically-correct sentence in english: availablesize = {{$size}} {{$unit}} available however, other languages might need t...
AsyncTestUtils extended framework
this is likely to happen when i/o is involved or a potentially expensive process wants to break itself up into smaller chunks (like a search operation) so that the ui stays responsive.
McCoy
releasing an update once you are ready to release an updated version of your add-on you must create yourself an update.rdf file.
NSPR Contributor Guide
when you consider a new api for nspr ask yourself if your proposed feature can implement it across all platforms supported by nspr.
Introduction to NSPR
since the nature of the situation is not an attribute of the condition, the program must test that itself.
Logging
nspr uses this facility itself for its own development debugging purposes.
PL_HashTableDestroy
description pl_hashtabledestroy frees all the entries in the table and the table itself.
PR_DestroyLock
locks do not provide self-referential protection against deletion.
PR_GetCurrentThread
syntax #include <prthread.h> prthread* pr_getcurrentthread(void); returns always returns a valid reference to the calling thread--a self-identity.
PR_GetRandomNoise
this implies that the random value provided may not be, by itself, cryptographically secure.
PR_InitializeNetAddr
a client can use this value to connect to itself without knowing the host's network address.
PR_Interrupt
pr_interrupt may itself fail if the target thread is invalid.
PR_REMOVE_AND_INIT_LINK
description pr_remove_and_init_link removes the specified element from its circular list and initializes the links of the element to point to itself.
PR_SetThreadPriority
it is preferable for a thread to specify itself in the thread parameter when it calls pr_setthreadpriority.
Threads
joining a thread provides definitive proof that the target thread has terminated and has finished with both the resources to which the thread has access and the resources of the thread itself.
JSS Provider Notes
if you build jss yourself from source instead of using binaries downloaded from mozilla.org, your jar file will not have a valid signature.
Mozilla-JSS JCA Provider notes
if you build jss yourself from source instead of using binaries downloaded from mozilla.org, your jar file will not have a valid signature.
NSS Memory allocation
this can be done outside the program entirely, or can be done by the program itself, in the main() function.
NSS_3.11.10_release_notes.html
bug 387892: add entrust root ca certificate(s) to nss bug 396999: pk11_authenticate bug 397478: lock from ssl_initsymwrapkeyslock not freed on selfserv shutdown.
NSS_3.12.1_release_notes.html
bug 67890: create self-signed cert with existing key that signed csr bug 129303: nss needs to expose interfaces to deal with multiple token sources of certs.
NSS 3.12.4 release notes
error code set to zero bug 492385: crash freeing named crl entry on shutdown bug 493135: bltest crashes if it can't open the input file bug 493364: can't build with --disable-dbm option when not cross-compiling bug 493693: sse2 instructions for bignum are not implemented on os/2 bug 493912: sqlite3_reset should be invoked in sdb_findobjectsinit when error occurs bug 494073: update rsa/dsa powerupself tests to be compliant for 2011 bug 494087: passing null as the value of cert_pi_trustanchors causes a crash in cert_pkixsetparam bug 494107: during nss_nodb_init(), softoken tries but fails to load libsqlite3.so crash [@ @0x0 ] bug 495097: sdb_mapsqlerror returns signed int bug 495103: nss_initreadwrite(sql:<dbdir>) causes nss to look for sql:<dbdir>/libnssckbi.so bug 495365: add const to the 'ni...
NSS 3.14 release notes
command line utilities tstclnt, strsclnt, and selfserv have changed.
NSS 3.20 release notes
the selfserv utility has been enhanced to support the new dhe features.
NSS 3.24 release notes
items allocated from the arena are still created on the heap, only the arena itself is stack-allocated.
NSS 3.26 release notes
nss 3.26 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_26_rtm/src/ new in nss 3.26 new functionality the selfserv test utility has been enhanced to support alpn (http/1.1) and 0-rtt added support for the system-wide crypto policy available on fedora linux, see http://fedoraproject.org/wiki/changes/cryptopolicy introduced build flag nss_disable_libpkix which allows compilation of nss without the libpkix library notable changes in nss 3.26 the following ca certificate was added cn = isrg root...
NSS 3.28.2 release notes
nss 3.28.2 source distributions are available on ftp.mozilla.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_28_2_rtm/src/ incorrect version number note the version numbers embedded in the nss 3.28.2 are wrong (it reports itself as version 3.28.1).
NSS 3.38 release notes
when using certutil -o to print the chain for a given certificate nickname, the new parameter --simple-self-signed may be provided, which can avoid ambiguous output in some scenarios.
NSS 3.45 release notes
notable changes in nss 3.45 bug 1540403 - implement delegated credentials (draft-ietf-tls-subcerts) this adds a new experimental function: ssl_delegatecredential note: in 3.45, selfserv does not yet support delegated credentials.
NSS 3.46 release notes
bugs fixed in nss 3.46 bug 1572164 - don't unnecessarily free session in nsc_wrapkey bug 1574220 - improve controls after errors in tstcln, selfserv and vfyserv cmds bug 1550636 - upgrade sqlite in nss to a 2019 version bug 1572593 - reset advertised extensions in ssl_constructextensions bug 1415118 - nss build with ./build.sh --enable-libpkix fails bug 1539788 - add length checks for cryptographic primitives (cve-2019-17006) bug 1542077 - mp_set_ulong and mp_set_int should return errors on bad values bug 1572791 - read out-of-bound...
NSS 3.48 release notes
bugs fixed in nss 3.48 bug 1600775 - require nspr 4.24 for nss 3.48 bug 1593401 - fix race condition in self-encrypt functions bug 1599545 - fix assertion and add test for early key update bug 1597799 - fix a crash in nssckfwobject_getattributesize bug 1591178 - add entrust root certification authority - g4 certificate to nss bug 1590001 - prevent negotiation of versions lower than 1.3 after helloretryrequest bug 1596450 - added a simplified and unified mac implementation for hmac and cmac behind p...
NSS 3.54 release notes
bug 1644774 - ssl gtests to use clearservercache when resetting self-encrypt keys.
NSS Sample Code Sample1
the secondary host generates an rsa keypair that will be used // to transport keys between the primary host and itself.
NSS Sample Code sample4
* # create ca cert, self-signed, generates key-pair, prompts for key * # type, cert type etc * # answers for prompts: 5,9,n,y,-1,n,5,6,7,9,n * $ certutil -s -s "cn=test ca, o=bogus inc, l=mtn view, st=ca, c=us" \ * -n testca -t ctu,ctu,ctu -v 60 -x -d .
nss tech note3
each of the above seccertusages translates into a required set of cert type and key usage for the certificate itself, and into another set of required cert type and key usage for all the ca certs in the cert chain.
nss tech note6
if you still decide to make unsupported changes, you can allow the softoken to come up in fips 140 mode of operation by regenerating the .chk files yourself.
Python binding for NSS
you can build it yourself via ./setup.py build_doc.
FC_SeedRandom
the initial seed material is provided by the nss cryptographic module itself.
gtstd.html
>mkdir ca_db >certutil -n -d ca_db create the self-signed root ca certificate, specifying the subject name for the certificate.
NSS_3.12.3_release_notes.html
bug 476126: cert_asciitoname fails when avas in an rdn are separated by '+' bug 477186: infinite loop in cert_getcertchainfromcert bug 477777: selfserv crashed in client/server tests.
Necko Interfaces Overview
d by the consumer of a nsichannel instance passed to nsichannel::asyncopen method nsirequestobserver::onstartrequest - notifies start of async download nsistreamlistener::ondataavailable - notifies presence of downloaded data nsirequestobserver::onstoprequest - notifies completion of async download, possibly w/ error nsiloadgroup : nsirequest attribute of a nsirequest channel impl adds itself to its load group during invocation of asyncopen channel impl removes itself from its load group when download completes load groups in gecko own all channels used to load a particular page (until the channels complete) all channels owned by a load group can be canceled at once via the load group's nsirequest::cancel method nsitransport represents a physical connection, such as a file desc...
Necko walkthrough
note: this callback may be a proxy object, nsinputstreamreadyevent: it is a runnable that dispatches itself to a previously set target thread, and calls its internal mcallback->oninputstreamready function.
Installing Pork
to tell mcpp which gcc installation to integrate itself with, place the selected gcc bin dir as the first element of your path: path=/bindir/of/my/gcc:$path if you want to use a gcc that has binaries named something other than "gcc" and "g++", or you use "ccache" for you main gcc installation and want mcpp to override a separate installation, you need to pass the options "cc=gccxxx cxx=g++xxx" to "./configure".
Rhino overview
rhino contains all the features of javascript 1.7 allows direct scripting of java a javascript shell for executing javascript scripts a javascript compiler to transform javascript source files into java class files a javascript debugger for scripts executed with rhino language the javascript language itself is standardized by standard ecma-262 ecmascript: a general purpose, cross-platform programming language.
Shumway
there are two places where shumway bugs are tracked: github (via issues and pull requests) manages problems relating to shumway, itself.
GCIntegration - SpiderMonkey Redirect 1
for pointers that are traced using js_call_tracer we will most likely change the api so that the address of the pointer being traced is passed in, rather than the pointer itself.
GC Rooting Guide
like the other template classes, it functions as if it were the gc thing pointer itself.
How to embed the JavaScript engine
*/ static jsclass global_class = { "global", jsclass_global_flags, &global_ops }; int main(int argc, const char *argv[]) { js_init(); jscontext *cx = js_newcontext(8l * 1024 * 1024); if (!cx) return 1; if (!js::initselfhostedcode(cx)) return 1; { // scope for our various stack objects (jsautorequest, rootedobject), so they all go // out of scope before we js_destroycontext.
Exact Stack Rooting
warning: js::handlet does not root objects itself!
SpiderMonkey Internals: Thread Safety
it is mainly of interest to people working on spidermonkey itself.
JS::CloneFunctionObject
if the class of funobj is not function, then js::clonefunctionobject returns funobj itself.
JSConvertOp
however, the engine itself only requires support for jstype_string, jstype_number, and jstype_void, if js_convertvalue is not used.
JSErrorReport
we check the strictness of the context's top frame's script; where that isn't appropriate, the caller should do the right checks itself instead of using this flag.
JSPropertyOp
getters (and sometimes setters; see js_setproperty for details) are called even when the property being accessed is found on a prototype and not on obj itself.
JSStringFinalizer
syntax struct jsstringfinalizer { void (*finalize)(const jsstringfinalizer *fin, char16_t *chars); }; name type description fin jsstringfinalizer the finalizer itself.
JS_AddExternalStringFinalizer
in a js_threadsafe build, this function must be invoked on the primordial thread only, at startup—or else the entire program must single-thread itself while loading a module that calls this function.
JS_Add*Root
do not pass a pointer to a js string or object to any of these functions—rp must point to a variable, the location of the pointer itself, and not an object or string.
JS_AliasElement
if the element is currently out of scope, already exists, or the alias itself cannot be assigned to the element, js_aliaselement does not report an error, but returns js_false.
JS_AliasProperty
if the property is currently out of scope, already exists, or the alias itself cannot be assigned to the property, js_aliasproperty does not report an error, but returns js_false.
JS_AlreadyHasOwnProperty
*foundp is set to true only if lookupproperty reports that the property was found on obj itself and not on some other object (even the corresponding outer object, if any).
JS_CloneFunctionObject
if the class of funobj is not function, then js_clonefunctionobject returns funobj itself.
JS_DefaultValue
objects with classes defined by ecmascript itself all use the [[defaultvalue]] algorithm specified in §8.12.8 (but note the algorithm's special case for date objects).
JS_ForgetLocalRoot
in case a native hook allocates many objects or other gc-things, but the native protects some of those gc-things by storing them as property values in an object that is itself protected, the hook can call js_forgetlocalroot to free the local root automatically pushed for the now-protected gc-thing.
JS_GetCompartmentPrivate
the javascript engine itself never uses it.
JS_GetContextPrivate
the javascript engine itself never uses it.
JS_GetNaNValue
in fact, it is not even equal to itself: if x is nan, then x != x.
JS_GetParentRuntime
if the cx's runtime has no parent runtime, js_getparentruntime returns cx's runtime itself.
JS_GetReservedSlot
reserved slots may contain any js::value, and the garbage collector will hold the value alive as long as the object itself is alive.
JS_GetRuntimePrivate
the javascript engine itself never uses it.
JS_NewObject
choosing a default prototype like many jsapi functions, js_newobject selects an appropriate prototype for the newly created object if you don't supply one yourself.
JS_NewRuntime
if parentruntime is specified, the resulting runtime shares significant amounts of read-only state (the self-hosting and initial atoms compartments).
JS_NewScriptObject
(the name "js_newscriptobject" suggests that the script object is freshly allocated; this was the case in older versions of the api, but now the script object is allocated along with the jsscript itself.) (some temporary scripts used internally by spidermonkey do not have script objects allocated for them; such scripts are not accessible via jsapi.) see also the jsapi user guide contains example code using compiled scripts.
JS_ValueToFunction
(implementation note: the actual conversion is performed by the object itself.
PRIVATE_TO_JSVAL
the javascript engine itself never uses a private data pointer.
Parser API
interface graphexpression <: expression { type: "graphexpression"; index: uint32; expression: literal; } a graph expression, aka "sharp literal," such as #1={ self: #1# }.
Profiling SpiderMonkey
instructions 1.) get yourself an optimized libxul build of firefox, with debugger info.
SpiderMonkey 1.8.5
please note that spidermonkey reserves the js:: namespace for itself.
SpiderMonkey 1.8.7
please note that spidermonkey reserves the js:: namespace for itself.
SpiderMonkey 1.8.8
please note that spidermonkey reserves the js:: namespace for itself.
SpiderMonkey 17
please note that spidermonkey reserves the js:: namespace for itself.
SpiderMonkey 24
please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use).
SpiderMonkey 31
please note that spidermonkey reserves the js:: namespace for itself (and the js:: namespace for internal use).
SpiderMonkey 45
please note that spidermonkey reserves the js:: namespace for itself for public exports and the js:: namespace for internal use.
Running Automated JavaScript Tests
basic usage is: jstests.py path_to_js_shell or using mach: ./mach jstests note that mach will generally find the js shell itself; the --shell argument can be used to specify the location manually.
Setting up CDT to work on SpiderMonkey
step 3 - index all the code to let cdt know about the build, it has to invoke make itself (or, as is done in the guide for the whole mozilla codebase on mdn, read a log of the build), which can be setup with these simple steps: open the project's properties by selecting its root and clicking "properties" in the "file" menu and select "c/c++ build".
TPS Tests
troubleshooting and debugging tips for writing and running tps tests tps evaluates the whole file in every phase, so any syntax error(s) in the file will get reported in phase 1, even though the error may not be in phase 1 itself.
Thread Sanitizer
building firefox getting the source if you don't have a source code repository clone yet, you need to get yourself a clone of mozilla-central.
WebReplayRoadmap
firefox's ui and privileged code is largely written in js, and it would be nice to be able to use web replay to help debug and develop firefox itself, for better dogfooding and gathering internal feedback.
Mozilla Projects
mozilla has a number of projects other than firefox itself.
Signing Mozilla apps for Mac OS X
there are good instructions available under "to use the certificate assistant to create a self-signed signing identity".
Task graph
the details of task-graph generation are documented in the source code itself, including a some quick recipes for common changes.
Gecko states
state_selfvoicing the object or child uses text-to-speech (tts) technology for description purposes.
XUL Accessibility
aggregating the text from element subtree if the child node is hidden then it's ignored excepting the case when the element used as label is hidden itself if the child node is text node then its rendered value is appended if the child node is element then if it implements nsidomxullabeledcontrolelement then the value of label property is appended otherwise if it's a label element then then value attribute is appended otherwise append tooltiptext attribute append the accessible value searching specific element in neighbour of the element search inside the elemen...
Feed content access API
this opens a new window containing the feed contents, with each item's title a clickable link that takes you to the article itself.
Mork
MozillaTechMork
a mid has two components: the id itself, to the left of the colon, and the scope, to the right of the colon.
Frecency algorithm
the word "frecency" itself is a combination of the words "frequency" and "recency." the default frecency value for all valid entries is -1.
Using the Places favicon service
if you are manually loading favicon data, you can specify the expiration time yourself.
Bundling multiple binary components
the stub component is an xpcom component itself and when registered by xpcom, the code would sniff the runtime version and operating system then the stub load the appropriate "real" xpcom component for the current configuration.
How to build an XPCOM component in JavaScript
if you need an intel version, you'll need to compile it yourself as described on that page.
XPCOM changes in Gecko 2.0
xpt files the path of any xpt files must be listed explicitly in a manifest using an interfaces directive: interfaces components/mycomponent.xpt javascript components the registration information for javascript components is no longer located in the component itself; instead, it's located in the manifest.
Using XPCOM Utilities to Make Things Easier
instead of implementing the nsisupports yourself, ns_impl_isupports1 can expand to the implementation of addref, release, and queryinterface for any object.
Making cross-thread calls using runnables
// but thread->shutdown must be called from the main thread, not from the thread itself.
Receiving startup notifications
most application features are not yet available at this point, but xpcom itself is.
Interfacing with the XPCOM cycle collector
it will not crash if there are extra owning pointers, but it will find itself unable to account for the reference counts it finds in the owned objects, so may fail to collect cycles.
Components.ID
the exception to this is the case where a component is written in javascript and needs to register itself with the component manager using its own nsid - an id that is not already registered and thus does not appear in components.classes.
Components.classes
usage in order to retrieve the object for a given contractid, you can query the components.classes array as follows: var clazz0 = components.classes["@mozilla.org/messenger;1"]; clazz0 is the class object for the contractid @mozilla.org/messenger;1, which is not usually used by itself, but whose createinstance and getservice methods can be used to create a new instance of the component or to access the singleton instance, if the contract id represents a service.
Components.utils.Sandbox
content scripts should pass the window they're running in as this parameter, in order to ensure that the script is cleaned up at the same time as the content itself.
Components.utils.cloneInto
donscriptobject = {"greeting" : "hello from add-on"}; contentwindow.addonscriptobject = cloneinto(addonscriptobject, contentwindow); scripts running in the page can now access the object: // page script button.addeventlistener("click", function() { console.log(window.addonscriptobject.greeting); // "hello from add-on" }, false); of course, you don't have to assign the clone to the window itself: you can assign it to some other object in the target scope: contentwindow.foo.addonscriptobject = cloneinto(addonscriptobject, contentwindow); you can also pass it into a function defined in the page script.
XPCshell Test Manifest Expressions
this is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported.
Language bindings
since the xpcom layer itself is written in c/c++, its api can be accessed out-of-the-box using c or c++.
Append
void append( const self_type& astring ); parameters astring [in] a nsacstring to append to this string.
Assign
void assign( const self_type& astring ); parameters astring [in] a nsacstring to copy into this string.
Insert
void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsacstring to append to this string.
Replace
void replace( index_type acutstart, index_type acutlength, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units.
Append
void append( const self_type& astring ); parameters astring [in] a nsastring to append to this string.
Assign
void assign( const self_type& astring ); parameters astring [in] a nsastring to copy into this string.
Insert
void insert( const self_type& astring, index_type aposition ); parameters astring [in] a nsastring to append to this string.
Replace
void replace( index_type acutstart, index_type acutlength, const self_type& astring ); parameters acutstart [in] the starting index of the section to remove, measured in storage units.
nsCOMPtr
the class itself and the supporting functions that are used with it are not frozen, but they are available as part of the xpcom glue library for easy reuse.
nsEmbedCString
nsembedcstring(); explicit nsembedcstring( const self_type& astring ); parameters astring [in] a nsembedcstring to copy into this string.
nsEmbedCString
}; typedefs self_type [nsembedcstring] an alias for the type of this class.
nsEmbedString
nsembedstring(); explicit nsembedstring( const self_type& astring ); parameters astring [in] a nsembedstring to copy into this string.
nsEmbedString
}; typedefs self_type [nsembedstring] an alias for the type of this class.
RefPtr
like with nscomptr, it is the responsibility of the object itself to implement reference counting.
XPCOM glue classes
like with nscomptr, it is the responsibility of the object itself to implement reference counting.
IAccessibleImage
some examples are: the accessible name and description() are not enough to fully describe the image, for example when the accessible description() is used to define the behavior of an actionable image and the image itself conveys semantically significant information.
inIDOMUtils
if you have requested anonymous content, then if the element has an xbl binding then this will be the binding's anonymous nodes, otherwise if the element is itself an anonymous node containing an insertion point then this will be a list combining the element's explicit children from its binding parent's anonymous nodes and any children inserted as a result of the insertion point.
nsIAbCard
if this bundle is not supplied, then the function will obtain the bundle itself.
nsIAccessibilityService
the container content node for the change is passed in, rather than the changed presentation for the content node itself.
nsIAccessibleHyperLink
note: the link itself is represented by one embedded character within the parent text, so the endindex should be startindex + 1.
nsIAccessibleProvider
textbox 0x0000101b xulthumb 0x0000101c xultree 0x0000101d xultreecolumns 0x0000101e xultreecolumnitem 0x0000101f xultoolbar 0x00001020 xultoolbarseparator 0x00001021 xultooltip 0x00001022 xultoolbarbutton 0x00001023 xforms elements constants constant value description xformscontainer 0x00002000 used for xforms elements that provide accessible object for itself as well for anonymous content.
nsIAccessibleStates
state_selfvoicing 0x00080000 the object or child uses text-to-speech (tts) technology for description purposes.
nsIAppShell
does not (in itself) stop gecko events from being processed on the main application thread.
nsIAutoCompleteInput
consumerollupevent boolean if true, the event that rolls up the popup should be consumed by the popup itself.
nsIAutoCompleteItem
comment wstring an extra comment that will be displayed next to the value but that will not be part of the value itself.
nsIBrowserHistory
the page itself is only deleted when it is not bookmarked and when it is not a place: uri.
nsIChannel
if asyncopen returns successfully, the channel is responsible for keeping itself alive until it has called onstoprequest on alistener or called onchannelredirect.
nsIContentViewer
ettings); void show(); void stop(); void unload(); obsolete since gecko 1.8 attributes attribute type description container nsisupports domdocument nsidomdocument enablerendering boolean obsolete since gecko 2.0 historyentry nsishentry get the history entry that this viewer will save itself into when destroyed.
nsIDOMProgressEvent
this doesn't include headers and other overhead, but only the content itself.
nsIDOMWindow
this is the window itself if there is no parent, or if the parent is of a different type.
nsIDOMXPathEvaluator
it is used to resolve prefixes within the xpath itself, so that they can be matched with the document.
nsIDragDropHandler
if this is null, the client must handle the drop itself, either through the method provided via overridedrop() or by letting the event bubble up through the dom.
nsIDragService
it's not used on gtk, which handles the drag popup itself.
nsIDroppedLinkHandler
this will occur if the source of the drag initiated a link for dragging that it itself cannot access.
nsIDynamicContainer
this only happens when the container itself goes from the open state to the closed state.
nsIEnvironment
an empty string will be returned when the env variable does not exist or when the value itself is an empty string - please use exists() to probe whether the env variable exists or not.
nsIFaviconDataCallback
it's up to the caller to check adatalen > 0 before using any data-related information like mime-type or data itself.
nsIFeedTextConstruct
if the type is "text", the "<" character represents itself.
nsIIdleService
the subject of the notification the observer will get is always the nsiidleservice itself.
nsILoginManagerStorage
this is not called automatically; you must call it yourself if needed.
nsIMacDockSupport
the application should call this to activate itself when one of its dock menu items are selected, since doing so does not automatically activate the application.
nsIMemory
when a nsimemory instance notifies memory pressure observers, it passes itself as the asubject parameter in the call to nsiobserverservice.notifyobservers().
nsIMessageListener
either an element owning the message manager, or the message manager itself if no element owns it.
nsIMicrosummaryGenerator
gecko 1.9 (firefox 3) warning: microsummary support was removed in gecko 6.0 (firefox 6.0 / thunderbird 6.0 / seamonkey 2.3) method overview long calculateupdateinterval(in nsidomnode apagecontent); boolean equals(in nsimicrosummarygenerator aother); astring generatemicrosummary(in nsidomnode apagecontent); attributes attribute type description loaded boolean has the generator itself (which may be a remote resource) been loaded.
nsIMicrosummaryService
if its value is null, then it's an async refresh, and the caller should register itself as an nsimicrosummaryobserver via nsimicrosummary.addobserver() to find out when the refresh completes.
nsIMsgAccount
outgoing identity list (array of nsimsgidentity's) incomingserver nsimsgincomingserver incoming server stuff key acstring internal key identifying itself methods addidentity() adds a new identity to this account.
nsIMsgFilterCustomAction
*/ attribute boolean allowduplicates; /* * the custom action itself * * generally for the apply method, folder-based methods give correct * results and are preferred if available.
nsIMsgIdentity
signaturedate long escapedvcard astring dofcc boolean fccfolder astring fccfolderpickermode astring fccreplyfollowsparent boolean draftsfolderpickermode astring tmplfolderpickermode astring bccself boolean note: don't call bccself, bccothers, and bcclist directly, they are only used for migration and backward compatability.
nsINavHistoryObserver
when the last visit for a history entry expires, the history entry itself is deleted and the awholeentry parameter is true.
nsINavHistoryQueryResultNode
1.0 66 introduced gecko 1.8 inherits from: nsinavhistorycontainerresultnode last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) note: if you request that places not be expanded in the options that generated the node, the node will report that it has no children and will never try to populate itself.
nsINavHistoryResultObserver
toolkit/components/places/nsinavhistoryservice.idlscriptable lets clients observe changes to a result as the result updates itself according to bookmark and history system events.
nsINavHistoryResultTreeViewer
1.0 66 introduced gecko 1.8 inherits from: nsinavhistoryresultobserver last changed in gecko 1.9 (firefox 3) this object removes itself from the associated result when the tree is detached; this prevents circular references.
nsIObserver
with this implementation, it's safe (and common practice) for an implementation of nsiobserver to remove itself as an observer during the observe callback, or to add or remove other observers.
nsIPrefBranch2
these cycles generally occur because an object both registers itself as an observer (causing the branch to hold a reference to the observer) and holds a reference to the branch object for the purpose of getting/setting preference values.
nsIPrivateBrowsingService
the browser itself stops caching, and also doesn't record history information.
nsIProxyInfo
constant value description transparent_proxy_resolves_host 1 << 0 this flag is set if the proxy is to perform name resolution itself.
nsIRequest
inherits from: nsisupports last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) for example nsichannel typically passes itself as the nsirequest argument to the nsistreamlistener on each onstartrequest, ondataavaliable, and onstoprequest invocation.
nsISHEntry
void seturi( in nsiuri auri ); parameters auri native code only!setviewerbounds void setviewerbounds( in nsintrect bounds ); parameters bounds syncpresentationstate() ensure that the cached presentation members are self-consistent.
nsIScriptableIO
you may specify an empty filename string if you wish to get a reference to the directory itself.
nsIStreamConverter
first of all the stream converter implementation must register itself with the component manager using a contractid in the format below.
nsITaskbarWindowPreview
by default, however, windows handles this drawing by itself.
nsITelemetry
this is true if the fhr data reporting service or the self-support service is enabled.
nsIToolkitProfile
inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) you should not create these objects yourself; to obtain them, use the nsitoolkitprofileservice interface to create and obtain them.
nsIURI
note: this is an optimization, allowing you to check the scheme of the uri without having to get the scheme and do the comparison yourself; this saves memory allocations.
nsIWebProgress
a nsiwebprogresslistener instance receives notifications for the nsiwebprogress instance to which it added itself, and it may also receive notifications from any nsiwebprogress instances that are children of that nsiwebprogress instance.
nsIWindowWatcher
return value an nsisimpleenumerator which will itself return nsisupports objects which can be nsisupports.queryinterface() (queryinterfaced) to an nsidomwindow.
nsIWorkerScope
methods close() allows the worker to terminate itself.
nsIXPConnect
3) the xpcom object implements nsiscriptobjectowner; i.e., is an idlc style dom object for which we can call getscriptobject to get the jsobject it uses to represent itself into javascript.
nsIXULTemplateQueryProcessor
the template builder will supply two variables, the reference variable and the member variable to further indicate what part of the datasource is to be examined in addition to the query itself.
nsIXULWindow
false to center it relative to arelative itself (arelative must be set in this case.) aalert true to move the window to an alert position, generally centered horizontally and 1/3 down from the top.
nsIZipWriter
= dirarr[i].directoryentries; while (direntries.hasmoreelements()) { var entry = direntries.getnext().queryinterface(ci.nsifile); //entry is instance of nsifile so here https://developer.mozilla.org/docs/xpcom_interface_reference/nsifile if (entry.path == xpi.path) { cu.reporterror('skipping entry - will not add this entry to the zip file - as this is the zip itself: "' + xpi.path + '" leafname:"' + xpi.leafname + '"'); continue; } if (entry.isdirectory()) { dirarr.push(entry); } var relpath = entry.path.replace(dirarr[0].path, ''); //need relative because we need to use this for telling addentryfile where in the zip it should create it, and because zip is a copy of the directory cu.rep...
Storage
as you step through each row, you can obtain each parameter by name through a helper object (mozistoragestatementrow) in javascript ( ) like so: while (statement.executestep()) { let value = statement.row.column_name; } you can create this helper object yourself if it's not available in your version of gecko.
The Thread Manager
application/extension javascript should consider using a chromeworker instead.") interfaces there are several interfaces that provide threading support: nsithreadmanager the thread manager itself lets you create threads.
Reference Manual
nsifoo* temp; nsresult rv = getfoo_withoutaddref(&temp); // note to self: must report |getfoo_withoutaddref| as a bug, all getters // must |addref| nscomptr<nsifoo> foo = temp; "in/out" parameters what about "in/out" parameters?
Weak reference
what is actually needed in this case, is either out-of-band signaling, where when the observer wants to go away, it unregisters itself from the observable, which then releases its owning reference, allowing the observer to die, or else a new kind of reference.
XPCOM tasks
like the standard libraries, xpcom must be a fairly self-contained library, so as not to encumber clients with any unnecessary external dependencies.
XPIDL Syntax
MozillaTechXPIDLSyntax
ens] raise_list = "raises" "(" *(scoped_name) ",") scoped_name ")" scoped_name = *(ident "::") ident / "::" ident ; in regex: [a-za-z_][a-za-z0-9_]*; identifiers beginning with _ cause warnings ident = (%x41-5a / %x61-7a / "_") *(%x41-5a / %x61-7a / %x30-39 / "_") parens = "(" 1*(any char except ")") ")" functionality not used in xpidl the libidl parser we use is more powerful than xpidl itself can understand.
Xray vision
the javascript code that along with the c++ core, implements the browser itself is called chrome code and runs using system privileges.
Address Book examples
in either case, you'll need: a factory object implementing nsiabdirfactory a directory object implementing nsiabdirectory if you are using c++, you can inherit from nsabdirproperty and override functions for your specific implementation to save implementing all the functions on nsiabdirectory yourself.
Filelink Providers
note: the setup dialog window should resize itself automatically in order to fit the content of the iframe without scrollbars.
Index
for new incoming messages, the protocol specific object that handles new messages calls nsimsgfilterlist::applyfilterstohdr and passes itself in as nsimsgfilterhitnotify interface to handle filter hits.
MailNews Filters
for new incoming messages, the protocol specific object that handles new messages calls nsimsgfilterlist::applyfilterstohdr and passes itself in as nsimsgfilterhitnotify interface to handle filter hits.
Mail client architecture overview
most of these modules have little dependancy on the mail reader itself: compose - the mail compose module is responsible for anything that has to do with sending mail.
Main Windows
messenger.xul the base mail window that you see when you first open thunderbird is messenger.xul: messenger.xul itself doesn’t contain a lot.
The libmime module
there is a class for each mime type, and each class is responsible for parsing itself, and/or handing the input data off to one of its child objects.
Demo Addon
it contains a collection of glodaconversation objects which itself is a thread that contains one or more glodamessages.
Access StringBundle from Overlay
y attaching them to an existing stringbundleset as such: <stringbundleset id="stringbundleset"> <stringbundle src="chrome://your_extension/locale/overlay.properties" id="your-extension-strings" /> </stringbundleset> now that your stringbundle is attached you can access it from javascript as follows: var str = document.getelementbyid("your-extension-strings"); //get the stringbundle object itself str.getstring("propertyname"); //get a string (and do something with it) alternative way let stringbundleservice = cc["@mozilla.org/intl/stringbundle;1"].getservice(ci.nsistringbundleservice); let bundle = stringbundleservice.createbundle("chrome://your_extension/locale/overlay.properties"); let str = bundle.getstringfromname("propertyname"); see nsistringbu...
Using the Multiple Accounts API
preference: mail.identity.identity.fcc_folder - uri of folder to put sent messages in preference: mail.identity.identity.bcc_self - boolean, should we blind carbon copy (bcc) this identity with each e-mail sent with this identity?
Toolkit version format
each version part is itself parsed as a sequence of four parts: <number-a><string-b><number-c><string-d>.
Using popup notifications
this code module is imported by the browser, so you don't need to do it explicitly yourself.
Virtualenv
here are a few such tools: carton: make a self-extracting virtualenv from directories or urls of packages; http://pypi.python.org/pypi/carton velcro: a script that sets up a python project for local installation; https://bitbucket.org/kumar303/velcro/ virtualenvwrapper: a set of extensions to ian bicking’s virtualenv tool for creating isolated python development environments; http://www.doughellmann.com/projects...tualenvwrapper th...
Zombie compartments
they can be caused by bugs in firefox itself, or by bugs in firefox add-ons.
Using COM from js-ctypes
the windows api mostly concerns itself with the interaction between the operating system and an application.
Using C struct and pointers
declaring a js-ctypes struct matching a c struct if we have a c structure like this: struct st_t { void *self; char *str; size_t buff_size; int i; float f; char c; }; we can use it in javascript by writing something like this: var st_t = new ctypes.structtype("st_t", [ { "self": ctypes.pointertype(ctypes.void_t) }, { "str": ctypes.pointertype(ctypes.char) }, { "buff_size": ctypes.size_t }, { "i": ctypes.int }, { "f": ctypes.float }, { "c": ctypes.char } ]); here we are using the structtype() factory method of the ctypes object to create a ctype obj...
Using Objective-C from js-ctypes
id objc_msgsend(id self, sel op, ...); id is defined as the following, in /usr/include/objc/objc.h, it's also an opaque type.
Declaring types
structures with next field it is common to see structures with a "next" field that is a pointer to itself.
Memory Management
this bypasses javascript's memory management and lets you handle memory management yourself.
Using js-ctypes
var msgerr = makestr("carbon says..."); var msgexp = makestr("we just called the standardalert carbon function from javascript!"); var err = stdalert(1, msgerr, msgexp, 0, hit); carbon.close(); the makestr() function is a utility routine that takes as input a standard javascript string and returns a carbon-style "pascal" string, which is a length byte followed by the characters of the string itself.
Initialization and Destruction - Plugins
it is called once after the last instance of the plug-in is destroyed, before releasing the plug-in library itself.
Structures - Plugins
npprint contains information the plug-in needs to print itself in full-page or embedded mode.
Introduction to DOM Inspector - Firefox Developer Tools
if you're inspecting a chrome document, as you select nodes in the dom nodes viewer, the rendered versions of those nodes are highlighted in the user interface itself.
DOM Inspector - Firefox Developer Tools
or, build thunderbird yourself with the following options: ac_add_options --enable-extensions="default inspector" ac_add_options --enable-inspector-apis mozilla suite and seamonkey select tools > web development > dom inspector.
Browser Toolbox - Firefox Developer Tools
you will be presented with a dialog like this (it can be removed by setting the devtools.debugger.prompt-connection property to false): click ok, and the browser toolbox will open in its own window: you'll be able to inspect the browser's chrome windows and see, and be able to debug, all the javascript files loaded by the browser itself and by any add-ons that are running.
Debugger.Environment - Firefox Developer Tools
we say an environmentbinds an identifier if that environment itself associates the identifier with a variable, independently of its outer environments.
Debugger.Frame - Firefox Developer Tools
note that frames only become inactive at times that are predictable for the debugger: when the debuggee runs, or when the debugger removes frames from the stack itself.
Debugger.Source - Firefox Developer Tools
debugger.source for javascript for a debugger.source instance representing a piece of javascript source code, its properties provide the source code itself as a string, and describe where it came from.
Tutorial: Set a breakpoint - Firefox Developer Tools
this page shows how you can try out the debugger api yourself using firefox’s scratchpad.
Index - Firefox Developer Tools
25 tutorial: set a breakpoint this page shows how you can try out the debugger api yourself using firefox’s scratchpad.
All keyboard shortcuts - Firefox Developer Tools
the first section lists the shortcut for opening each tool and the second section lists shortcuts that are applicable to the toolbox itself.
Migrating from Firebug - Firefox Developer Tools
like in firebug it lists the total execution time of each function call under total time as well as the number of calls under samples, the time spent within the function under self time and the related percentages in reference to the total execution time.
Network Monitor - Firefox Developer Tools
once the tool is monitoring network requests, the display looks like this: when it is actively monitoring activity, the network monitor records network requests any time the toolbox is open, even if the network monitor itself is not selected.
Examine and edit CSS - Firefox Developer Tools
in addition, the information that appears on the page itself show you what pseudo-class you are examining.
Select an element - Firefox Developer Tools
with the node picker to select an element in the page itself, activate the "node picker" by clicking its icon: (also called the select element icon).
Select and highlight elements - Firefox Developer Tools
with the node picker to select an element in the page itself, activate the "node picker" by clicking its icon: (also called the select element icon).
Flame Chart - Firefox Developer Tools
in the flame chart view itself, along the x-axis is time.
Waterfall - Firefox Developer Tools
the hint may be any of: self subtree latersiblings csstransitions cssanimations svgattranimations styleattribute styleattribute_animations force forcedescendants layout calculating the position and size of page elements.
Settings - Firefox Developer Tools
enable browser chrome and add-on debugging toolboxes enable you to use developer tools in the context of the browser itself, and not only web content.
Toolbox - Firefox Developer Tools
this is what it looks like when it's docked: the window itself is split into two parts: a toolbar along the top, and a main pane underneath: note: since firefox 62, you can drag and drop tabs in the main toolbar of the toolbox to reorder your tools as you wish (bug 1226272).
Console messages - Firefox Developer Tools
message the message itself.
Web Console Helpers - Firefox Developer Tools
you can supply any of the following: a selector string to be passed to document.queryselector to locate the iframe element the iframe element itself the content window inside the iframe see working with iframes.
The JavaScript input interpreter - Firefox Developer Tools
you can supply any of the following: a selector string that will be passed to document.queryselector to locate the iframe element the iframe element itself the content window inside the iframe see working with iframes.
Working with iframes - Firefox Developer Tools
you'll see a button in the toolbar: click it, and you'll see a popup listing all the iframes in the document, as well as the main document itself.
AddressErrors - Web APIs
in the example, we're handling a donation to an organization that will be sending a "thank you" gift to the donor, so it requests shipping information along with allowing the donation payment itself.
AnimationEvent() - Web APIs
if the animation doesn't run on a pseudo-element but on the element itself, specify an empty string: "".
AnimationTimeline - Web APIs
this interface exists to define timeline features (inherited by documenttimeline and future timeline types) and is not itself directly used by developers.
AudioTrackList.getTrackById() - Web APIs
the tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource.
Broadcast Channel API - Web APIs
// disconnect the channel bc.close(); conclusion the broadcast channel api's self-contained interface allows cross-context communication.
CDATASection - Web APIs
]]> for example: <foo>here is a cdata section: <![cdata[ < > & ]]> with all kinds of unescaped text.</foo> the only sequence which is not allowed within a cdata section is the closing sequence of a cdata section itself, ]]>: <![cdata[ ]]> will cause an error ]]> note that cdata sections should not be used within html; they only work in xml.
CSSStyleSheet.insertRule() - Web APIs
be changed selectorandrule.substring(0, openbracketpos), // the selector selectorandrule.substring(closebracketpos), // the rule arguments[3] // the insert index ); } // works by if the char code is a backslash, then isescaped // gets flipped (xor-ed by 1), and if it is not a backslash // then isescaped gets xored by itself, zeroing it isescaped ^= newcharcode===92?1:isescaped; // 92 = "\\".charcodeat(0) } // else, there is no unescaped bracket return originalinsertrule.call(this, selectorandrule, "", arguments[2]); }; } })(cssstylesheet.prototype); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.insertrul...
Using the CSS Painting API - Web APIs
r custom property .fancy { background-image: paint(headerhighlight); } h1 { --highcolour: hsla(155, 90%, 60%, 0.7); } h3 { --highcolour: hsla(255, 90%, 60%, 0.5); } h6 { --highcolour: hsla(355, 90%, 60%, 0.3); } and we register our worklet css.paintworklet.addmodule('https://mdn.github.io/houdini-examples/csspaint/intro/03partthree/header-highlight.js'); while you can't edit the worklet itself, you can play around with the css and html.
Cache.match() - Web APIs
WebAPICachematch
self.addeventlistener('fetch', function(event) { // we only want to call event.respondwith() if this is a get request for an html document.
CacheStorage.match() - Web APIs
self.addeventlistener('fetch', function(event) { event.respondwith(caches.match(event.request).then(function(response) { // caches.match() always resolves // but in case of success response will have value if (response !== undefined) { return response; } else { return fetch(event.request).then(function (response) { // response may be used only once // we n...
CacheStorage.open() - Web APIs
WebAPICacheStorageopen
self.addeventlistener('install', function(event) { event.waituntil( caches.open('v1').then(function(cache) { return cache.addall([ '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg', '/sw-test/gallery/bountyhunters.jpg', '/sw-test/gallery/mylittl...
CanvasRenderingContext2D.createImageData() - Web APIs
the image itself is not copied.
CanvasRenderingContext2D.getImageData() - Web APIs
securityerror the canvas contains or may contain pixels which were loaded from an origin other than the one from which the document itself was loaded.
Advanced animations - Web APIs
in this part we will have a closer look at the motion itself and are going to add some physics to make our animations more advanced.
Applying styles and colors - Web APIs
this is useful when a path intersects itself or is nested.
Basic animations - Web APIs
opacity: 1 } div#selector>div { flex-basis: 30% } @keyframes diss { from { opacity: 1 } to { opacity: 0 } } .keypress>div { border: dashed 3px #fff; height: 48%; width: 48%; display: flex; align-content: center; justify-content: center; align-self: center; align-items: center; font-size: -webkit-xxx-large; font-weight: 900; color: #fff; transition: .5s; opacity: .1; border-radius: 7px } .keypress { position: fixed; width: 100vw; height: 100vh; top: 0; left: 0; display: flex; flex-wrap: wrap; justify-content: spac...
Basic usage of canvas - Web APIs
« previousnext » let's start this tutorial by looking at the <canvas> html element itself.
Compositing and clipping - Web APIs
by default the <canvas> element has a clipping path that's the exact same size as the canvas itself.
Optimizing canvas - Web APIs
pre-render similar primitives or repeating objects on an offscreen canvas if you find yourself repeating some of the same drawing operations on each animation frame, consider offloading them to an offscreen canvas.
Transformations - Web APIs
a rotate example in this example, we'll use the rotate() method to first rotate a rectangle from the canvas origin and then from the center of the rectangle itself with the help of translate().
Channel Messaging API - Web APIs
nd messagechannel.port2 properties (which both return messageport objects.) the app that created the channel uses port1, and the app at the other end of the port uses port2 — you send a message to port2, and transfer the port over to the other browsing context using window.postmessage along with two arguments (the message to send, and the object to transfer ownership of, in this case the port itself.) when these transferable objects are transferred, they are 'neutered' on the previous context — the one they previously belonged to.
Client.type - Web APIs
WebAPIClienttype
a document) function sendmessage(message) { return new promise(function(resolve, reject) { // note that this is the serviceworker.postmessage version navigator.serviceworker.controller.postmessage(message); window.serviceworker.onmessage = function(e) { resolve(e.data); }; }); } // controlling service worker self.addeventlistener("message", function(e) { // e.source is a client object e.source.postmessage("hello!
Client.url - Web APIs
WebAPIClienturl
example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: 'window' }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) return client.focus(); } if (clients.openwindow) return clients.openwindow('/'); })); }); specifications specification status co...
Clients.matchAll() - Web APIs
WebAPIClientsmatchAll
syntax self.clients.matchall(options).then(function(clients) { // do something with your clients list }); parameters options optional an options object allowing you to set options for the matching operation.
console.log() - Web APIs
WebAPIConsolelog
difference between log() and dir() you might ask yourself what's the difference between console.dir() and console.log().
Constraint validation API - Web APIs
validation of constraints through the constraint validation api is done either on a single form element or at the form level, on the <form> element itself.
ContentIndex.add() - Web APIs
WebAPIContentIndexadd
// our content const item = { id: 'post-1', url: '/posts/amet.html', title: 'amet consectetur adipisicing', description: 'repellat et quia iste possimus ducimus aliquid a aut eaque nostrum.', icons: [{ src: '/media/dark.png', sizes: '128x128', type: 'image/png', }], category: 'article' }; self.registration.index.add(item); specifications specification status comment unknownthe definition of 'add' in that specification.
ContentIndex.delete() - Web APIs
self.registration.index.delete('my-id'); specifications specification status comment unknownthe definition of 'delete' in that specification.
ContentIndex - Web APIs
they are accessible from the workerglobalscope.self property: // service worker script self.registration.index.add(item); self.registration.index.delete(item.id); const contentindexitems = self.registration.index.getall(); specifications specification status comment unknownthe definition of 'contentindex' in that specification.
ContentIndexEvent.id - Web APIs
self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); specifications specification status comment unknownthe definition of 'id' in that specification.
ContentIndexEvent - Web APIs
self.addeventlistener('contentdelete', (event) => { console.log(event.id); // logs content index id, which can then be used to determine what content to delete from your cache }); specifications specification status comment unknownthe definition of 'contentindexevent' in that specification.
Crypto.getRandomValues() - Web APIs
user agents are instead urged to provide the best entropy they can when generating random numbers, using a well-defined, efficient pseudorandom number generator built into the user agent itself, but seeded with values taken from an external source of pseudorandom numbers, such as a platform-specific random number function, the unix /dev/urandom device, or other source of random or pseudorandom data.
DataTransfer.setDragImage() - Web APIs
this image is created automatically, so you do not need to create it yourself.
DataTransferItem.webkitGetAsEntry() - Web APIs
html content the html establishes the drop zone itself, which is a <div> element with the id "dropzone", and an unordered list element with the id "listing".
DedicatedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope.
DedicatedWorkerGlobalScope: message event - Web APIs
ler property onmessage examples this code creates a new worker and sends it a message using worker.postmessage(): const worker = new worker("static/scripts/worker.js"); worker.addeventlistener('message', (event) => { console.log(`received message from worker: ${event.data}`) }); the worker can listen for this message using addeventlistener(): // inside static/scripts/worker.js self.addeventlistener('message', (event) => { console.log(`received message from parent: ${event.data}`); }); alternatively, it could listen using the onmessage event handler property: // static/scripts/worker.js self.onmessage = (event) => { console.log(`received message from parent: ${event.data}`); }; specifications specification status html living standard ...
DedicatedWorkerGlobalScope: messageerror event - Web APIs
bubbles no cancelable no interface messageevent event handler property onmessageerror examples listen for messageerror using addeventlistener(): // inside worker.js self.addeventlistener('messageerror', (event) => { self.postmessage('error receiving message'); console.error(event); }); the same, but using the onmessageerror event handler property: // inside worker.js self.onmessageerror = (event) => { self.postmessage('error receiving message'); console.error(event); }; specifications specification status html living standard living standard ...
DedicatedWorkerGlobalScope.onmessage - Web APIs
syntax self.onmessage = function() { ...
Document.evaluate() - Web APIs
WebAPIDocumentevaluate
it will be used to resolve prefixes within the xpath itself, so that they can be matched with the document.
Document.getElementsByClassName() - Web APIs
<html> <body> <div id="parent-id"> <p>hello world 1</p> <p class="test">hello world 2</p> <p>hello world 3</p> <p>hello world 4</p> </div> <script> var parentdom = document.getelementbyid("parent-id"); var test = parentdom.getelementsbyclassname("test"); // a list of matching elements, *not* the element itself console.log(test); //htmlcollection[1] var testtarget = parentdom.getelementsbyclassname("test")[0]; // the first element, as we wanted console.log(testtarget); //<p class="test">hello world 2</p> </script> </body> </html> multiple classes example document.getelementsbyclassname works very similarly to document.queryselector and document.queryselectorall.
Document.origin - Web APIs
WebAPIDocumentorigin
use self.origin instead.
DocumentOrShadowRoot.elementFromPoint() - Web APIs
if the element at the specified point belongs to another document (for example, the document of an <iframe>), that document's parent element is returned (the <iframe> itself).
Events and the DOM - Web APIs
the event interface itself is described, as well as the interfaces for event registration on nodes in the dom, and event listeners, and several longer examples that show how the various event interfaces relate to one another.
Examples of web and XML development using the DOM - Web APIs
note that the table itself has an onclick event handler that ought to display a message when the table is clicked.
EffectTiming.fill - Web APIs
WebAPIEffectTimingfill
0px; border: 1px solid black; } .button { cursor: pointer; width: 300px; border: 1px solid black; font-size: 16px; text-align: center; margin-top: 0px; padding-top: 2px; padding-bottom: 4px; color: white; background-color: darkgreen; font: 14px "open sans", "arial", sans-serif; } #text { width: 160px; padding: 10px; position: relative; text-align: center; align-self: center; color: white; font: bold 2em "lucida grande", "open sans", sans-serif; } while there's other css involved in this example, the part that really matters for our purposes is the css that styles the "box" element that we'll be animating.
Element.classList - Web APIs
WebAPIElementclassList
the domtokenlist itself is read-only, although you can modify it using the add() and remove() methods.
Element.getElementsByTagNameNS() - Web APIs
note that only the descendants of this element are included in the search, not the node itself.
Element.innerHTML - Web APIs
WebAPIElementinnerHTML
the <div> whose class is "log" is the container for the log text itself.
Element.onfullscreenchange - Web APIs
this gives us a value, isfullscreen, which we pass into a function called adjustmycontrols(), which we imagine to be a function that makes adjustments to the app's user interface to present itself optimally when it's in full-screen mode versus being displayed in a window.
Element - Web APIs
WebAPIElement
element.closest() returns the element which is the closest ancestor of the current element (or the current element itself) which matches the selectors given in parameter.
Event.composed - Web APIs
WebAPIEventcomposed
w, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] in the second case, the event listeners only propagate as far as the <closed-shadow> element itself, but not to the nodes inside the shadow boundary.
Event.composedPath() - Web APIs
w, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] whereas the <closed-shadow> element's composed path is a follows: array [ closed-shadow, body, html, htmldocument https://mdn.github.io/web-components-examples/composed-composed-path/, window ] in the second case, the event listeners only propagate as far as the <closed-shadow> element itself, but not to the nodes inside the shadow boundary.
Event.isTrusted - Web APIs
WebAPIEventisTrusted
obsolete adds requirements regarding trusted and untrusted events, though it does not itself define the istrusted property.
Event - Web APIs
WebAPIEvent
event itself contains the properties and methods which are common to all events.
EventListener - Web APIs
buttonelement.addeventlistener('click', function (event) { alert('element clicked through function!'); }); // for compatibility, a non-function object with a `handleevent` property is // treated just the same as a function itself.
EventSource - Web APIs
additionally, the event source itself may send messages with an event field, which will create ad-hoc events keyed to that value.
EventTarget.removeEventListener() - Web APIs
the event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see matching event listeners for removal syntax target.removeeventlistener(type, listener[, options]); target.removeeventlistener(type, listener[, usecapture]); parameters type a string which specifies the type of event for which to remove an event listener.
ExtendableEvent - Web APIs
var cache_version = 1; var current_caches = { prefetch: 'prefetch-cache-v' + cache_version }; self.addeventlistener('install', function(event) { var urlstoprefetch = [ './static/pre_fetched.txt', './static/pre_fetched.html', 'https://www.chromium.org/_/rsrc/1302286216006/config/customlogo.gif' ]; console.log('handling install event.
ExtendableMessageEvent.data - Web APIs
var port; self.addeventlistener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { port.postmessage(obj); } else if(obj.action === 'init' || obj.action === 'chatmsg') { port.postmessage(obj); } }); self.onmessage = function(e) { console.log(e.data); port = e.ports[0]; } specifications specification status commen...
ExtendableMessageEvent.lastEventId - Web APIs
var port; self.addeventlistener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { port.postmessage(obj); } else if(obj.action === 'init' || obj.action === 'chatmsg') { port.postmessage(obj); } }); self.onmessage = function(e) { console.log(e.lasteventid); port = e.ports[0]; } specifications specification status ...
ExtendableMessageEvent.origin - Web APIs
var port; self.addeventlistener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { port.postmessage(obj); } else if(obj.action === 'init' || obj.action === 'chatmsg') { port.postmessage(obj); } }); self.onmessage = function(e) { console.log(e.origin); port = e.ports[0]; } specifications specification status comm...
ExtendableMessageEvent.ports - Web APIs
var port; self.addeventlistener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { port.postmessage(obj); } else if(obj.action === 'init' || obj.action === 'chatmsg') { port.postmessage(obj); } }); self.onmessage = function(e) { port = e.ports[0]; } specifications specification status comment service work...
ExtendableMessageEvent.source - Web APIs
var port; self.addeventlistener('push', function(e) { var obj = e.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { port.postmessage(obj); } else if(obj.action === 'init' || obj.action === 'chatmsg') { port.postmessage(obj); } }); self.onmessage = function(e) { console.log(e.source); port = e.ports[0]; } specifications specification status comm...
FetchEvent.client - Web APIs
WebAPIFetchEventclient
example self.addeventlistener('fetch', function(event) { console.log(event.client); ​}); ...
FetchEvent.clientId - Web APIs
example self.addeventlistener('fetch', function(event) { console.log(event.clientid); ​}); specifications specification status comment service workersthe definition of 'clientid' in that specification.
FetchEvent.isReload - Web APIs
example self.addeventlistener('fetch', function(event) { event.respondwith( if (event.isreload) { //return something } else { //return something else }; ); ​}); ...
FetchEvent.replacesClientId - Web APIs
example self.addeventlistener('fetch', function(event) { console.log(event.replacesclientid); }); specifications specification status comment service workersthe definition of 'replacesclientid' in that specification.
FetchEvent.request - Web APIs
self.addeventlistener('fetch', function(event) { console.log('handling fetch event for', event.request.url); event.respondwith( caches.match(event.request).then(function(response) { if (response) { console.log('found response in cache:', response); return response; } console.log('no response found in cache.
FetchEvent.resultingClientId - Web APIs
example self.addeventlistener('fetch', function(event) { console.log(event.resultingclientid); }); specifications specification status comment service workersthe definition of 'resultingclientid' in that specification.
Using files from web applications - Web APIs
function fileupload(img, file) { const reader = new filereader(); this.ctrl = createthrobber(img); const xhr = new xmlhttprequest(); 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.ctrl.ctx.canvas; canvas.parentnode.
FileSystemDirectoryEntry.createReader() - Web APIs
= []; let getentries = function() { dirreader.readentries(function(results) { if (results.length) { entries = entries.concat(toarray(results)); getentries(); } }, function(error) { /* handle error -- error is a fileerror object */ }); }; getentries(); return entries; } this works by creating an internal function, getentries(), which calls itself recursively to get all the entries in the directory, concatenating each batch to the array.
FileSystemDirectoryReader.readEntries() - Web APIs
html content the html establishes the drop zone itself, which is a <div> element with the id "dropzone", and an unordered list element with the id "listing".
FileSystemEntry.getParent() - Web APIs
the parent of the root directory is considered to be the root directory, itself, so be sure to watch for that.
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 xmlhttprequest (see using formdata objects).
Fullscreen API - Web APIs
the full-screen mode feature is identified by the string "fullscreen", with a default allow-list value of "self", meaning that full-screen mode is permitted in top-level document contexts, as well as to nested browsing contexts loaded from the same origin as the top-most document.
Using the Gamepad API - Web APIs
note: the gamepad object is available on the gamepadconnected event rather than the window object itself, for security reasons.
Using the Geolocation API - Web APIs
ng(position.coords.latitude, position.coords.longitude); } function error() { alert('sorry, no position available.'); } const options = { enablehighaccuracy: true, maximumage: 30000, timeout: 27000 }; const watchid = navigator.geolocation.watchposition(success, error, options); describing a position the user's location is described using a geolocationposition object instance, which itself contains a geolocationcoordinates object instance.
GlobalEventHandlers.onerror - Web APIs
<img src="imagenotfound.gif" onerror="this.onerror=null;this.src='imagefound.gif';" /> the reason we have the this.onerror=null in the function is that the browser will be stuck in an endless loop if the onerror image itself generates an error.
HTMLAnchorElement.relList - Web APIs
the property itself is read-only, meaning you can't substitute the domtokenlist with another one, but its contents can still be changed.
HTMLAreaElement.relList - Web APIs
the property itself is read-only, meaning you can't substitute the domtokenlist by another one, but the content of the returned list can be changed.
Audio() - Web APIs
the event-based approach is best: myaudioelement.addeventlistener("canplaythrough", event => { /* the audio is now playable; play it if permissions allow */ myaudioelement.play(); }); memory usage and management if all references to an audio element created using the audio() constructor are deleted, the element itself won't be removed from memory by the javascript runtime's garbage collection mechanism if playback is currently underway.
HTMLCanvasElement.toDataURL() - Web APIs
exceptions securityerror the canvas's bitmap is not origin clean; at least some of its contents have or may have been loaded from a site other than the one from which the document itself was loaded.
HTMLElement.contextMenu - Web APIs
the menu itself is created using the <menu> element.
HTMLElement.innerText - Web APIs
if the element itself is not being rendered (e.g detached from the document or is hidden from view), the returned value is the same as the node.textcontent property.
HTMLFormElement: submit event - Web APIs
bubbles yes (although specified as a simple event that doesn't bubble) cancelable yes interface submitevent event handler property globaleventhandlers.onsubmit note that the submit event fires on the <form> element itself, and not on any <button> or <input type="submit"> inside it.
HTMLIFrameElement.csp - Web APIs
the csp property of the htmliframeelement interface specifies the content security policy that an embedded document must agree to enforce upon itself.
HTMLImageElement.src - Web APIs
this can be set either within the html itself using the src content attribute, or programmatically by setting the element's src property.
HTMLImageElement.x - Web APIs
from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell.
HTMLImageElement.y - Web APIs
from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell.
HTMLLinkElement.relList - Web APIs
the property itself is read-only, meaning you can substitute the domtokenlist by another one, but the content of the returned list can be changed.
HTMLMediaElement.audioTracks - Web APIs
html the html establishes the element itself.
HTMLMedia​Element​.textTracks - Web APIs
however, these events aren't sent directly to the media element itself.
HTMLObjectElement - Web APIs
htmlobjectelement.code is a domstring representing the name of an applet class file, containing either the applet's subclass, or the path to get to the class, including the class file itself.
HTMLOrForeignElement.dataset - Web APIs
note that the dataset property itself can be read, but not directly written.
HTMLSelectElement.selectedOptions - Web APIs
javascript the javascript code that establishes the event handler for the button, as well as the event handler itself, looks like this: let orderbutton = document.getelementbyid("order"); let itemlist = document.getelementbyid("foods"); let outputbox = document.getelementbyid("output"); orderbutton.addeventlistener("click", function() { let collection = itemlist.selectedoptions; let output = ""; for (let i=0; i<collection.length; i++) { if (output === "") { output = "your order for the followi...
HTMLTableElement.rows - Web APIs
although the property itself is read-only, the returned object is live and allows the modification of its content.
Using microtasks in JavaScript with queueMicrotask() - Web APIs
queuemicrotask(() => { /* code to run in the microtask here */ }); the microtask function itself takes no parameters, and does not return a value.
The HTML DOM API - Web APIs
from node, the element inherits concepts surrounding the ability for the element to be contained by another element, and to contain other elements itself.
Working with the History API - Web APIs
the page itself will look like bar.html.
HkdfParams - Web APIs
it's important that this should be independent of the input key material itself.
IDBDatabaseException - Web APIs
unknown_err 1 the operation failed for reasons unrelated to the database itself, and it is not covered by any other error code--for example, a failure due to disk io errors.
IDBRequest.error - Web APIs
WebAPIIDBRequesterror
unknownerror if the operation failed for reasons unrelated to the database itself.
Basic concepts - Web APIs
while the database can't store data in a specific internationalized order, you can sort the data that you've read out of the database yourself.
Using IndexedDB - Web APIs
the cursor object itself is the result of the request (above we're using the shorthand, so it's event.target.result).
InstallEvent.activeWorker - Web APIs
examples self.addeventlistener('install', function(event) { var myactiveworker = event.activeworker; }); ...
InstallEvent - Web APIs
var cache_version = 1; var current_caches = { prefetch: 'prefetch-cache-v' + cache_version }; self.addeventlistener('install', function(event) { var urlstoprefetch = [ './static/pre_fetched.txt', './static/pre_fetched.html', 'https://www.chromium.org/_/rsrc/1302286216006/config/customlogo.gif' ]; console.log('handling install event.
IntersectionObserverEntry.intersectionRect - Web APIs
this rectangle is computed by taking the intersection of boundingclientrect with each of the target's ancestors' clip rectangles, with the exception of the intersection root itself.
KeyboardEvent - Web APIs
in the case of ui events, this is important for security reasons, as it prevents scripts from simulating user actions that interact with the browser itself.
LockManager.request() - Web APIs
the requested lock is passed to a callback, while the function itself returns a promise that resolves with undefined.
MediaDevices.getUserMedia() - Web APIs
for example, this line in the http headers will enable use of a camera for the document and any embedded <iframe> elements that are loaded from the same origin: feature-policy: camera 'self' this will request access to the microphone for the current origin and the specific origin https://developer.mozilla.org: feature-policy: microphone 'self' https://developer.mozilla.org if you're using getusermedia() within an <iframe>, you can request permission just for that frame, which is clearly more secure than requesting a more general permission.
MediaDevices.ondevicechange - Web APIs
elist(); }) .catch(err => log(err.name + ": " + err.message)); }, false); we set up global variables that contain references to the <ul> elements that are used to list the audio and video devices: let audiolist = document.getelementbyid("audiolist"); let videolist = document.getelementbyid("videolist"); getting and drawing the device list now let's take a look at updatedevicelist() itself.
MediaError.message - Web APIs
this lets us see the behavior of the error event handler, which is received by an event handler we add to the <audio> element itself.
MediaRecorderErrorEvent() - Web APIs
in general, you won't create these yourself; they are delivered to your implementation of mediarecorder.onerror when errors occur while recording media.
Media Session action types - Web APIs
description a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds.
MediaSessionActionDetails - Web APIs
description a media session action may be generated by any media session action source; these sources include anything from ui widgets within the browser itself to media control keys on the user's keyboard to buttons on the user's headset or earbuds.
MediaStreamAudioDestinationNode.stream - Web APIs
the stream property of the audiocontext interface represents a mediastream containing a single audiomediastreamtrack with the same number of channels as the node itself.
MediaStreamAudioDestinationNode - Web APIs
mediastreamaudiodestinationnode.stream is a mediastream containing a single audiomediastreamtrack with the same number of channels as the node itself.
MediaStreamAudioSourceNode.mediaStream - Web APIs
if the specific track matters to you, or you need to have access to the track itself, you should use a mediastreamtrackaudiosourcenode instead.
MediaStreamTrack.stop() - Web APIs
since multiple tracks may use the same source (for example, if two tabs are using the device's microphone), the source itself isn't necessarily immediately stopped.
MediaStreamTrackAudioSourceNode - Web APIs
the audio itself might be input from a microphone or other audio sampling device, or might be received through a rtcpeerconnection, among other posible options.
MediaTrackSettings - Web APIs
the value will be one of: "user" a camera facing the user (commonly known as a "selfie cam"), used for self-portraiture and video calling.
Transcoding assets for Media Source Extensions - Web APIs
to install, you'll need to build/compile the application yourself from the provided project files/source files, depending on your os and preferences.
MerchantValidationEvent() - Web APIs
you should not have to create these events yourself; instead, just handle the merchantvalidation event.
MimeType - Web APIs
WebAPIMimeType
mimetype.enabledplugin returns an instance of plugin containing information about the plugin itself.
MutationObserverInit.subtree - Web APIs
the default value, false, indicates only the target node itself is to be monitored for changes.
Web-based protocol handlers - Web APIs
basically, the web application uses registerprotocolhandler() to register itself with the browser as a potential handler for a given protocol.
Navigator.registerProtocolHandler() - Web APIs
this might happen if: the registered scheme (protocol) is invalid, such as a scheme the browser handles itself (https:, about:, etc.) the handler url’s origin does not match the origin of the page calling this api.
Online and offline events - Web APIs
this property existed in older versions of firefox and internet explorer (the specification based itself off of these prior implementations), so you can begin using it immediately.
Node.childNodes - Web APIs
WebAPINodechildNodes
(for example, to get the name of the first childnode: elementnodereference.childnodes[1].nodename.) the document object itself has 2 children: the doctype declaration and the root element, typically referred to as documentelement.
Node.nodeValue - Web APIs
WebAPINodenodeValue
for the document itself, nodevalue returns null.
Node.ownerDocument - Web APIs
if this property is used on a node that is itself a document, the value is null.
Notification.badge - Web APIs
the badge property of the notification interface returns the url of the image used to represent the notification when there is not enough space to display the notification itself.
Notification.lang - Web APIs
WebAPINotificationlang
the language itself is specified using a domstring representing a bcp 47 language tag.
NotificationEvent.action - Web APIs
example self.registration.shownotification("new articles available", { actions: [{action: "get", title: "get now."}] }); self.addeventlistener('notificationclick', function(event) { event.notification.close(); if (event.action === 'get') { synchronizereader(); } else { clients.openwindow("/reader"); } }, false); specifications specification status comment notif...
NotificationEvent.notification - Web APIs
example self.addeventlistener('notificationclick', function(event) { console.log('on notification click'); // data can be attached to the notification so that you // can process it in the notificationclick handler.
NotificationEvent - Web APIs
example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientli...
PaintWorklet.registerPaint - Web APIs
the file itself is loaded through css.paintworklet.addmodule() (documented here on the parent class of paintworklet, at worklet.addmodule().
PaymentDetailsUpdate - Web APIs
you must update this value yourself anytime the total amount due changes.
PaymentRequest: merchantvalidation event - Web APIs
merchantvalidation events are delivered by the payment request api to a paymentrequest object when a payment handler requires that the merchant requesting the purchase validate itself as permitted to use the payment handler.
PaymentRequest: paymentmethodchange event - Web APIs
ptions = { requestshipping: true }; const paymentrequest = new paymentrequest(paymentmethods, detailsforshipping("ground"), options); paymentrequest.addeventlistener("paymentmethodchange", handlepaymentchange, false); paymentrequest.show() .then(response => response.complete("success")) .catch(err => console.log("error handling payment request: " + err)); the event handler function itself, handlepaymentchange(), looks like this: handlepaymentchange = event => { const detailsupdate = {}; if (event.methodname === "https://apple.com/apple-pay") { const servicefeeinfo = calculateservicefee(event.methoddetails); object.assign(detailsupdate, servicefeeinfo); } event.updatewith(detailsupdate); }, false); this begins by looking at the event's methodname property; if t...
PaymentRequestEvent.respondWith() - Web APIs
the respondwith property of the paymentrequestevent interface prevents the default event handling and allows you to provide a promise for a paymentresponse object yourself.
PaymentRequestEvent - Web APIs
respondwith() prevents the default event handling and allows you to provide a promise for a paymentresponse object yourself.
PaymentRequestUpdateEvent.updateWith() - Web APIs
you must update this value yourself anytime the total amount due changes.
PaymentResponse.retry() - Web APIs
error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in specific fields in the payment form.
PaymentValidationErrors - Web APIs
error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in specific fields in the payment form.
Using the Payment Request API - Web APIs
}); the payment handler would include the following code: self.addeventlistener('canmakepayment', function(evt) { // pre-authorize here.
PeriodicWave - Web APIs
the periodicwave itself is created/returned by audiocontext.createperiodicwave().
Using the Permissions API - Web APIs
most of the code is simple and unremarkable — below we'll just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts.
ProgressEvent.loaded - Web APIs
when downloading a resource using http, this only represent the part of the content itself, not headers and other overhead.
ProgressEvent.total - Web APIs
when downloading a resource using http, this only represent the content itself, not headers and other overhead.
PublicKeyCredentialRequestOptions.extensions - Web APIs
examples var options = { extensions: { uvm: true, loc: false, txauthsimple: "could you please verify yourself?" }, challenge: new uint8array([/* bytes sent from the server */]) }; navigator.credentials.get({ "publickey": options }) .then(function (credentialinfoassertion) { // send assertion response back to the server // to proceed with the control of the credential }).catch(function (err) { console.error(err); }); specifications specification status comment ...
PublicKeyCredentialRequestOptions - Web APIs
transports: "usb", type: "public-key", id: new uint8array(26) // actually provided by the server }, { transports: "internal", type: "public-key", id: new uint8array(26) // actually provided by the server } ], extensions: { uvm: true, // rp wants to know how the user was verified loc: false, txauthsimple: "could you please verify yourself?" } }; navigator.credentials.get({ "publickey": options }) .then(function (credentialinfoassertion) { // send assertion response back to the server // to proceed with the control of the credential }).catch(function (err) { console.error(err); }); specifications specification status comment web authentication: an api for accessing public key cred...
PushEvent.data - Web APIs
WebAPIPushEventdata
self.addeventlistener('push', function(event) { if (!(self.notification && self.notification.permission === 'granted')) { return; } var data = {}; if (event.data) { data = event.data.json(); } var title = data.title || "something has happened"; var message = data.message || "here's something you might want to check out."; var icon = "images/new-notification.png"; var notification = new notification(title, { body: message, ...
PushManager.register() - Web APIs
note: if you do not need the url any more, please use pushmanager.unregister() to clean up after yourself.
PushMessageData.arrayBuffer() - Web APIs
examples self.addeventlistener('push', function(event) { var buffer = event.data.arraybuffer(); // do something with your array buffer }); specifications specification status comment push apithe definition of 'arraybuffer()' in that specification.
PushMessageData.blob() - Web APIs
examples self.addeventlistener('push', function(event) { var blob = event.data.blob(); // do something with your blob }); specifications specification status comment push apithe definition of 'blob()' in that specification.
PushMessageData.json() - Web APIs
examples self.addeventlistener('push', function(event) { var mydata = event.data.json(); // do something with your data }); specifications specification status comment push apithe definition of 'json()' in that specification.
PushMessageData.text() - Web APIs
examples self.addeventlistener('push', function(event) { var textobj = event.data.text(); // do something with your text }); specifications specification status comment push apithe definition of 'text()' in that specification.
PushMessageData - Web APIs
examples self.addeventlistener('push', function(event) { var obj = event.data.json(); if(obj.action === 'subscribe' || obj.action === 'unsubscribe') { firenotification(obj, event); port.postmessage(obj); } else if(obj.action === 'init' || obj.action === 'chatmsg') { port.postmessage(obj); } }); specifications specification status comment push apithe definition of ...
RTCConfiguration.iceTransportPolicy - Web APIs
the agent—or the browser itself—may still perform some form of ip filtering on the incoming candidates for reasons including privacy and security, as well as to simply limit the number of candidates.
RTCDataChannel.bufferedAmount - Web APIs
this only includes data buffered by the user agent itself; it doesn't include any framing overhead or buffering done by the operating system or network hardware.
RTCDataChannel.negotiated - Web APIs
syntax var negotiated = adatachannel.negotiated; value true if the rtcdatachannel's connection was negotiated by the web app itself; false if the negotiation was handled by the webrtc layer.
RTCDataChannel.onclose - Web APIs
the function receives as its sole input parameter the event itself, as an object of type event.
RTCDataChannel.onclosing - Web APIs
the function receives as its sole input parameter the event itself, as an object of type event.
RTCDataChannel.onopen - Web APIs
the function receives as its only input parameter the event itself, of type event.
RTCDataChannelEvent() - Web APIs
you will rarely if ever construct an rtcdatachannelevent by hand; these events are normally created and sent by the webrtc layer itself.
RTCIceCandidate.usernameFragment - Web APIs
example although the webrtc infrastructure will filter out obsolete candidates for you after an ice restart, you can do it yourself if you're trying to absolutely minimize the number of messages going back and forth.
RTCIceTransport.state - Web APIs
a value of "disconnected" means that a transient issue has occurred that has broken the connection, but that should resolve itself automatically without your code having to take any action.
RTCIceTransportState - Web APIs
a value of "disconnected" means that a transient issue has occurred that has broken the connection, but that should resolve itself automatically without your code having to take any action.
RTCPeerConnection.addTransceiver() - Web APIs
syntax rtptransceiver = rtcpeerconnection.addtransceiver(trackorkind, init); parameters trackorkind a mediastreamtrack to associate with the transceiver, or a domstring which is used as the kind of the receiver's track, and by extension of the rtcrtpreceiver itself.
RTCPeerConnection.generateCertificate() - Web APIs
rtcpeerconnection.generatecertificate() is a static method, so it is always called on the rtcpeerconnection interface itself, not an instance thereof.
RTCPeerConnection.onicecandidate - Web APIs
this lets the ice agent perform negotiation with the remote peer without the browser itself needing to know any specifics about the technology being used for signaling; simply implement this method to use whatever messaging technology you choose to send the ice candidate to the remote peer.
RTCPeerConnectionIceErrorEvent - Web APIs
you will not normally create an object of this type yourself.
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
the main networkteststop() function now let's look at the networkteststop() function itself.
RTCRtpCapabilities - Web APIs
don't be surprised to see these show up ijn the list; be prepared to ignore them if you're only interested in the actual codecs used for the media itself.
RTCSctpTransport - Web APIs
you don't create rtcsctptransport objects yourself; instead, you get access to the rtcsctptransport for a given rtcpeerconnection through its sctp property.
Using the Resource Timing API - Web APIs
the properties which are returned as 0 by default when loading a resource from a domain other than the one of the web page itself: redirectstart, redirectend, domainlookupstart, domainlookupend, connectstart, connectend, secureconnectionstart, requeststart, and responsestart.
Resource Timing API - Web APIs
the properties which are returned as 0 by default when loading a resource from a domain other than the one of the web page itself: redirectstart, redirectend, domainlookupstart, domainlookupend, connectstart, connectend, secureconnectionstart, requeststart, and responsestart.
RsaOaepParams - Web APIs
label optional a buffersource — an array of bytes that does not itself need to be encrypted but which should be bound to the ciphertext.
SVGAElement - Web APIs
var linkref = document.queryselector("a"); linkref.target = "_self"; linkref.onclick = function(){ if (linkref.target === "_blank") { console.log("blank!"); linkref.target = "_self"; } else { console.log("sorry!
SVGAnimatedPathData - Web APIs
if the given attribute or property is being animated, contains the current animated value of the attribute or property, and both the object itself and its contents are read only.
SVGMatrix - Web APIs
WebAPISVGMatrix
exceptions a domexception with the code no_modification_allowed_err is raised when attempting updating a read-only attribute or when the object itself is read-only.
Screen.availHeight - Web APIs
this can be no larger than the value of window.screen.height, and will be less if the device or user agent reserves any vertical space for itself.
Screen.height - Web APIs
WebAPIScreenheight
} notes note that not all of the height given by this property may be available to the window itself.
Screen.width - Web APIs
WebAPIScreenwidth
syntax lwidth = window.screen.width example // crude way to check that the screen is at least 1024x768 if (window.screen.width >= 1024 && window.screen.height >= 768) { // resolution is 1024x768 or above } notes note that not all of the width given by this property may be available to the window itself.
Screen Capture API - Web APIs
feature policy validation user agents that support feature policy (either using http's feature-policy header or the <iframe> attribute allow) can specify a desire to use the screen capture api using the policy control directive display-capture: <iframe allow="display-capture" src="/some-other-document.html"> the default allow list is self, which lets the any content within the document use screen capture.
Selection.selectAllChildren() - Web APIs
parentnode itself is not part of the selection.
ServiceWorkerGlobalScope.caches - Web APIs
syntax var mycachestorage = self.caches; value a cachestorage object.
ServiceWorkerGlobalScope.clients - Web APIs
syntax swclients = self.clients value the clients object associated with the specific worker.
ServiceWorkerGlobalScope: contentdelete event - Web APIs
self.addeventlistener('contentdelete', event => { event.waituntil( caches.open('cache-name').then(cache => { return promise.all([ cache.delete(`/icon/${event.id}`), cache.delete(`/content/${event.id}`) ]) }) ); }); you can also set up the event handler using the serviceworkerglobalscope.ondelete property: self.oncontentdelete = (event) => { ...
ServiceWorkerGlobalScope.oncontentdelete - Web APIs
self.addeventlistener('contentdelete', event => { event.waituntil( caches.open('cache-name').then(cache => { return promise.all([ cache.delete(`/icon/${event.id}`), cache.delete(`/content/${event.id}`) ]) }) ); }); specifications specification status comment unknownthe definition of 'contentdelete' in that specification.
ServiceWorkerGlobalScope.onfetch - Web APIs
self.addeventlistener('fetch', function(event) { console.log('handling fetch event for', event.request.url); event.respondwith( caches.match(event.request).then(function(response) { if (response) { console.log('found response in cache:', response); return response; } console.log('no response found in cache.
ServiceWorkerGlobalScope.onmessage - Web APIs
}; example self.addeventlistener('message', function(messageevent) { console.log('handling message event:', messageevent); }) specifications specification status comment service workersthe definition of 'event handlers' in that specification.
ServiceWorkerGlobalScope.onsync - Web APIs
} self.addeventlistener('sync', function(syncevent) { ...
ServiceWorkerGlobalScope: push event - Web APIs
self.addeventlistener("push", event => { let message = event.data.json(); switch(message.type) { case "init": doinit(); break; case "shutdown": doshutdown(); break; } }, false); specifications specification status comment push apithe definition of 'push' in that specification.
ServiceWorkerGlobalScope.registration - Web APIs
syntax serviceworkerregistration = self.registration value a serviceworkerregistration object.
ServiceWorkerGlobalScope - Web APIs
self.addeventlistener('fetch', function(event) { console.log('handling fetch event for', event.request.url); event.respondwith( caches.match(event.request).then(function(response) { if (response) { console.log('found response in cache:', response); return response; } console.log('no response found in cache.
ServiceWorkerRegistration.index - Web APIs
here is an example from the main script: // reference registration const registration = await navigator.serviceworker.ready; // feature detection if ('index' in registration) { // content index api functionality const contentindex = registration.index; } from the service worker: // service worker script const contentindex = self.registration.index; specifications specification status comment unknownthe definition of 'index' in that specification.
ServiceWorkerRegistration.showNotification() - Web APIs
badge: a usvstring containing the url of an image to represent the notification when there is not enough space to display the notification itself such as for example, the android notification bar.
SharedWorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you want to close your worker instance from inside the worker itself, you can call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope.
Storage API - Web APIs
if a box is marked as "persistent", the contents won't be cleared by the user agent without either the data's origin itself or the user specifically doing so.
Using readable streams - Web APIs
}, 1000); button.addeventlistener('click', function() { clearinterval(interval); readstream(); controller.close(); }) }, pull(controller) { // we don't really need a pull in this example }, cancel() { // this is called if the reader cancels, // so we should stop generating strings clearinterval(interval); } }); in the readstream() function itself, we lock a reader to the stream using readablestream.getreader(), then follow the same kind of pattern we saw earlier — reading each chunk with read(), checking whether done is true and then ending the process if so, and reading the next chunk and processing it if not, before running the read() method again.
getTrackById() - Web APIs
the tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource.
URL() - Web APIs
WebAPIURLURL
note: you can still use an existing url object for the base, which stringifies itself to the object's href property.
URLUtilsReadOnly.hash - Web APIs
syntax string = object.hash; examples // in a web worker, on the page https://developer.mozilla.org/docs/urlutilsreadonly.hash#example var result = window.self.hash; // returns:'#hash' specifications specification status comment urlthe definition of 'urlutilsreadonly.hash' in that specification.
URLUtilsReadOnly.host - Web APIs
syntax string = object.host; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.host var result = window.self.host; // returns:'developer.mozilla.org:80' specifications specification status comment urlthe definition of 'urlutilsreadonly.host' in that specification.
URLUtilsReadOnly.hostname - Web APIs
syntax string = object.hostname; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.hostname var result = window.self.hostname; // returns:'developer.mozilla.org' specifications specification status comment urlthe definition of 'urlutilsreadonly.hostname' in that specification.
URLUtilsReadOnly.href - Web APIs
syntax string = object.href; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.href var result = window.self.href; // returns:'https://developer.mozilla.org/urlutilsreadonly.href' specifications specification status comment urlthe definition of 'urlutilsreadonly.href' in that specification.
URLUtilsReadOnly.origin - Web APIs
syntax string = object.origin; examples // on this page, returns the origin var result = self.location.origin; // returns:'https://developer.mozilla.org:443' specifications specification status comment urlthe definition of 'urlutilsreadonly.origin' in that specification.
URLUtilsReadOnly.pathname - Web APIs
syntax string = object.pathname; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.pathname var result = window.self.pathname; // returns:'/urlutilsreadonly.pathname' specifications specification status comment urlthe definition of 'urlutilsreadonly.pathname' in that specification.
URLUtilsReadOnly.port - Web APIs
syntax string = object.port; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.port var result = window.self.port; // returns:'80' specifications specification status comment urlthe definition of 'urlutilsreadonly.port' in that specification.
URLUtilsReadOnly.protocol - Web APIs
syntax string = object.protocol; examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.href var result = window.self.protocol; // returns:'https:' specifications specification status comment urlthe definition of 'urlutilsreadonly.protocol' in that specification.
URLUtilsReadOnly.search - Web APIs
syntax string = object.search; examples // in a web worker, on the page https://developer.mozilla.org/docs/urlutilsreadonly.href?t=67 var result = window.self.search; // returns:'?t=67' specifications specification status comment urlthe definition of 'urlutilsreadonly.search' in that specification.
URLUtilsReadOnly.toString() - Web APIs
syntax string = object.tostring(); examples // in a web worker, on the page https://developer.mozilla.org/urlutilsreadonly.href var result = window.self.tostring(); // returns:'https://developer.mozilla.org/urlutilsreadonly.href' browser compatibility the compatibility table in this page is generated from structured data.
URL API - Web APIs
WebAPIURL API
more interesting to most developers is the api itself.
getTrackById - Web APIs
the tracks are searched in their natural order; that is, in the order defined by the media resource itself, or, if the resource doesn't define an order, the relative order in which the tracks are declared by the media resource.
Clearing by clicking - Web APIs
the event handler removes // itself, because it only needs to run once.
Detect WebGL - Web APIs
the canvas is not added to the // document itself, so it is never displayed in the // browser window.
Matrix math for the web - Web APIs
using the identity matrix it should return a matrix identical to the original, since a matrix multiplied by the identity matrix is always equal to itself: // sets identityresult to [4,3,2,1] let identityresult = multiplymatrixandpoint(identitymatrix, [4, 3, 2, 1]); returning the same point is not very useful, but there are other types of matrices that can perform helpful operations on points.
Lighting in WebGL - Web APIs
in other words, if you want lighting you have to calculate it yourself.
Using textures in WebGL - Web APIs
see this hacks.mozilla.org article for an explanation of how to use cors-approved images as webgl textures, with a self-contained example.
WebGL best practices - Web APIs
prefer to use rgba8 and ignore the alpha yourself for better performance.
WebGL model view projection - Web APIs
e the camera around var position = mdn.translatematrix(moveleftandright, 0, 50 + moveinandout ); // multiply together, make sure and read them in opposite order var matrix = mdn.multiplyarrayofmatrices([ // exercise: rotate the camera view position ]); // inverse the operation for camera movements, because we are actually // moving the geometry in the scene, not the camera itself.
WebRTC coding guide - Web APIs
how do you create a web application that uses two-way video or data streams without having to do all the hard work of compressing frames, building streams, and so forth by yourself?
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
things rtp doesn't do rtp itself doesn't provide every possible feature, which is why other protocols are also used by webrtc.
Introduction to WebRTC protocols - Web APIs
this is, in essence, the metadata describing the content and not the media content itself.
A simple RTCDataChannel sample - Web APIs
<div class="messagebox" id="receivebox"> <p>messages received:</p> </div> the javascript code while you can just look at the code itself on github, below we'll review the parts of the code that do the heavy lifting.
Writing WebSocket client applications - Web APIs
see the code, then try out the example for yourself.
Writing WebSocket servers - Web APIs
however, the server can deny them if they attempt too many connections in order to save itself from denial-of-service attacks.
Fundamentals of WebXR - Web APIs
general-purpose 3d frameworks these frameworks are good for general-purpose programming as well as for game development when you want to do the logic yourself.
WebXR application life cycle - Web APIs
to end the xr session yourself, call xrsession.end().
WebXR performance guide - Web APIs
as such, you may find yourself needing to make adjustments or compromises to optimize the performance of your webxr application to be as usable as possible on the broadest assortment of target devices.
Using the Web Animations API - Web APIs
to prevent the cake from eating itself up before the user has had the chance to click on it, we call animation.pause() on it immediately after it is defined, like so: nommingcake.pause(); we can now use the animation.play() method to run it whenever we’re ready: nommingcake.play(); specifically, we want to link it to alice’s animation, so she gets bigger as the cupcake gets eaten.
Web Animations API - Web APIs
this interface exists to define timeline features (inherited by documenttimeline and future timeline objects) and is not itself accessed by developers.
Example and tutorial: Simple synth keyboard - Web APIs
the first is the musical keyboard itself.
Using IIR filters - Web APIs
when you are using an iirfilternode instead of a biquadfilternode you are creating the filter yourself, rather than just choosing a pre-programmed type.
Using the Web Audio API - Web APIs
you can use the factory method on the context itself (e.g.
Web audio spatialization basics - Web APIs
if you are working with 3d games and/or webxr it's a good idea to harness a 3d library to create such functionality, rather than trying to do this all yourself from first principles.
Attestation and Assertion - Web APIs
(except in the case of self-attestation.) ...
Web Locks API - Web APIs
the request() method itself returns a promise which resolves once the lock has been released; within an async function, a script can await the call to make the asynchronous code flow linear.
Using the Web Storage API - Web APIs
as you can see above, the event object associated with this event has a number of properties containing useful information — the key of the data that changed, the old value before the change, the new value after that change, the url of the document that changed the storage, and the storage object itself (which we've stringified so you can see its content).
Window.crypto - Web APIs
WebAPIWindowcrypto
although the property itself is read-only, all of its methods (and the methods of its child object, subtlecrypto) are not read-only, and therefore vulnerable to attack by polyfill.
Window.devicePixelRatio - Web APIs
t.queryselector(".pixel-ratio"); let mqstring = `(resolution: ${window.devicepixelratio}dppx)`; const updatepixelratio = () => { let pr = window.devicepixelratio; let prstring = (pr * 100).tofixed(0); pixelratiobox.innertext = `${prstring}% (${pr.tofixed(2)})`; } updatepixelratio(); matchmedia(mqstring).addlistener(updatepixelratio); the string mqstring is set up to be the media query itself.
window.dump() - Web APIs
WebAPIWindowdump
it is therefore advisable to either check this preference yourself or use a debugging preference of your own to make sure you don't send lots of debugging content to a user's console when they might not be interested in it at all.
Window.frames - Web APIs
WebAPIWindowframes
returns the window itself, which is an array-like object, listing the direct sub-frames of the current window.
Window.getComputedStyle() - Web APIs
::unsupported is considered valid, even though the pseudo-element itself is not supported.
Window.innerHeight - Web APIs
example assuming a frameset var intframeheight = window.innerheight; // or var intframeheight = self.innerheight; // will return the height of the frame viewport within the frameset var intframesetheight = parent.innerheight; // will return the height of the viewport of the closest frameset var intouterframesetheight = top.innerheight; // will return the height of the viewport of the outermost frameset fixme: link to an interactive demo here to change the size of a window, see window.resize...
Window.innerWidth - Web APIs
WebAPIWindowinnerWidth
example // this will return the width of the viewport var intframewidth = window.innerwidth; // this will return the width of the frame viewport within a frameset var intframewidth = self.innerwidth; // this will return the width of the viewport of the closest frameset var intframesetwidth = parent.innerwidth; // this will return the width of the viewport of the outermost frameset var intouterframesetwidth = top.innerwidth; specification specification status comment css object model (cssom) view modulethe definition of 'window.innerwidth' in that sp...
Window.open() - Web APIs
WebAPIWindowopen
note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.
Window.openDialog() - Web APIs
WebAPIWindowopenDialog
it behaves the same, except that it can optionally take one or more parameters past windowfeatures, and windowfeatures itself is treated a little differently.
Window.parent - Web APIs
WebAPIWindowparent
if a window does not have a parent, its parent property is a reference to itself.
Window.requestAnimationFrame() - Web APIs
note: your callback routine must itself call requestanimationframe() if you want to animate another frame at the next repaint.
Window - Web APIs
WebAPIWindow
window.self read only returns an object reference to the window object itself.
WindowClient.focus() - Web APIs
example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; ...
WindowClient.focused - Web APIs
example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientlist[i]; if (client.url == '/' && 'focus' in client) { if(!client.focused) return client.focus(); } } } if (clients.openwindow) return clients.ope...
WindowClient - Web APIs
example self.addeventlistener('notificationclick', function(event) { console.log('on notification click: ', event.notification.tag); event.notification.close(); // this looks to see if the current is already open and // focuses if it is event.waituntil(clients.matchall({ type: "window" }).then(function(clientlist) { for (var i = 0; i < clientlist.length; i++) { var client = clientli...
WindowOrWorkerGlobalScope.caches - Web APIs
syntax var mycachestorage = self.caches; // or just caches value a cachestorage object.
WindowOrWorkerGlobalScope.crossOriginIsolated - Web APIs
syntax var mycrossoriginisolated = self.crossoriginisolated; // or just crossoriginisolated value a boolean value examples if(crossoriginisolated) { // post sharedarraybuffer } else { // do something else } specifications specification status comment html living standardthe definition of 'crossoriginisolated' in that specification.
WindowOrWorkerGlobalScope.indexedDB - Web APIs
syntax var idbfactory = self.indexeddb; value an idbfactory object.
WindowOrWorkerGlobalScope.isSecureContext - Web APIs
syntax var isitsecure = self.issecurecontext; // or just issecurecontext value a boolean.
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
the prefs that control this behaviour are: dom.min_tracking_timeout_value: 4 dom.min_tracking_background_timeout_value: 10000 dom.timeout.tracking_throttling_delay: 30000 late timeouts in addition to "clamping", the timeout can also fire later when the page (or the os/browser itself) is busy with other tasks.
Worker: message event - Web APIs
cripts/worker.js"); worker.addeventlistener('message', (event) => { console.log(`received message from worker: ${event.data}`) }); alternatively, it could listen using the onmessage event handler property: const worker = new worker("static/scripts/worker.js"); worker.onmessage = (event) => { console.log(`received message from worker: ${event.data}`) }; the worker posts messages using self.postmessage(): // static/scripts/worker.js self.postmessage('i\'m alive!'); specifications specification status html living standard living standard ...
WorkerGlobalScope.close() - Web APIs
syntax self.close(); example if you wanted to close your worker instance from inside the worker itself, you could call the following: close(); close() and self.close() are effectively equivalent — both represent close() being called from inside the worker's inner scope.
WorkerLocation - Web APIs
such an object is initialized for each worker and is available via the workerglobalscope.location property obtained by calling self.location.
WorkerNavigator.connection - Web APIs
syntax connectioninfo = self.navigator.connection specifications specification status comment network information apithe definition of 'navigator.connection' in that specification.
WorkerNavigator - Web APIs
such an object is initialized for each worker and is available via the workerglobalscope.navigator property obtained by calling window.self.navigator.
Sending and Receiving Binary Data - Web APIs
in that case, you don't have to set the content-length header yourself, as the information is fetched from the stream automatically: // make a stream from a file.
Synchronous and asynchronous requests - Web APIs
mytask.js (the worker): self.onmessage = function (event) { if (event.data === "hello") { var xhr = new xmlhttprequest(); xhr.open("get", "myfile.txt", false); // synchronous request xhr.send(null); self.postmessage(xhr.responsetext); } }; note: the effect is asynchronous, because of the use of the worker.
XMLSerializer.serializeToString() - Web APIs
the root node itself must be either a node or attr object.
XRInputSource.targetRaySpace - Web APIs
its native origin tracks the position of the origin point of the target ray, and its orientation indicates the orientation of the controller device itself.
XRInputSourceEventInit.frame - Web APIs
of course, as a general rule, you won't need to create xrinputsourceeventinit objects yourself.
XRInputSourceEventInit.inputSource - Web APIs
of course, as a general rule, you won't need to create xrinputsourceeventinit objects yourself.
XRInputSourcesChangeEvent() - Web APIs
you won't typically call this constructor yourself, as these events are created and sent to you by the webxr system.
XRReferenceSpace: reset event - Web APIs
most common among them are the following: the user has manually reset the coordinate system, such as by requesting that the headset recalibrate itself to ensure that the facing direction and hand controllers are synchronized with the user's actual position and facing.
XRSession.oninputsourceschange - Web APIs
the list itself is accessible via xrsession.inputsources.
XRSession.visibilityState - Web APIs
for instance, if the viewer is using a headset tethered to a computer and the immersive scene is obscured by a configuration ui, the user could peek out from behind the headset and still be able to see the document itself on their computer's monitor.
XRSessionEventInit - Web APIs
you're unlikely to need to create these events yourself, however, as they're created by the xr system.
XRSpace - Web APIs
WebAPIXRSpace
while objects may move within the space, the space itself remains fixed in place.
XRWebGLLayer.ignoreDepthValues - Web APIs
as a parameter you're likely to set yourself, it is unlikely you'll need to read it later, but it's available if the need arises.
Using the aria-labelledby attribute - Accessibility
dialog contents </div> example 5: inline definition in the example below, the definition of a term that is described in the natural flow of the narrative is associated with the term itself using the aria-labelledby attribute: <p>the doctor explained it had been a <dfn id="placebo">placebo</dfn>, or <span role="definition" aria-labelledby="placebo"> an inert preparation prescribed more for the mental relief of the patient than for its actual effect on a disorder.</span> </p> example 6: definition lists in the example below, the definitions in a formal definition list are associa...
ARIA: feed role - Accessibility
if the addition of articles occupies the main browser thread, make sure to set aria-busy="true" on the feed itself, and make sure to set it back to false when processing ends, or the user may not see the updates.
ARIA: tab role - Accessibility
le="tabpanel"]') .foreach(p => p.setattribute("hidden", true)); // show the selected panel grandparent.parentnode .queryselector(`#${target.getattribute("aria-controls")}`) .removeattribute("hidden"); } best practices it is recommended to use a button element with the role tab for their built-in functional and accessible features instead, as opposed to needing to add them yourself.
ARIA: table role - Accessibility
if the table contains sortable columns or rows, the aria-sort attribute should be added on the header cell element (not the table itself).
ARIA: button role - Accessibility
if the button role is added to an element that is not focusable by itself (such as <span>, <div> or <p>) then, the tabindex attribute has to be used to make the button focusable.
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
problem you have a form where you ask your user a question, but the answer is mentioned in the question itself.
ARIA - Accessibility
standardization efforts wai-aria specification the w3c specification itself.
Architecture - Accessibility
nstextaccessible serves 2 purposes it is used by nshypertextaccessible to collect information about itself it is still exposed in msaa for backward compatibility by old windows assistive technologies.
Web Accessibility: Understanding Colors and Luminance - Accessibility
in addition, the "shape" of the text itself will matter.
-moz-user-focus - CSS: Cascading Style Sheets
initial valuenoneapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete note: this property doesn't work for xul <xul:textbox> elements, because the textbox itself never takes focus.
:dir() - CSS: Cascading Style Sheets
WebCSS:dir
/* selects any element with right-to-left text */ :dir(rtl) { background-color: red; } the :dir() pseudo-class uses only the semantic value of the directionality, i.e., the one defined in the document itself.
:focus-within - CSS: Cascading Style Sheets
in other words, it represents an element that is itself matched by the :focus pseudo-class or has a descendant that is matched by :focus.
:focus - CSS: Cascading Style Sheets
WebCSS:focus
/* selects any <input> when focused */ input:focus { color: red; } note: this pseudo-class applies only to the focused element itself.
negative - CSS: Cascading Style Sheets
the negative descriptor has effect only if the system value is symbolic, alphabetic, numeric, additive, or extends, if the extended counter style itself uses a negative sign.
system - CSS: Cascading Style Sheets
if you need to represent counter values as roman numerals, you could use either one of the predefined counter styles, upper-roman or lower-roman, rather than recreating the rule yourself.
max-zoom - CSS: Cascading Style Sheets
formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative number or percentage as specified formal syntax auto | <number> | <percentage> examples setting max-zoom @viewport { max-zoom: 1.5; } specifications specification status comment css device adaptationthe definition of '"max-zoom" descriptor' in that specification.
min-zoom - CSS: Cascading Style Sheets
formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative number or percentage as specified formal syntax auto | <number> | <percentage> examples setting min zoom factor @viewport { min-zoom: 2.0; } specifications specification status comment css device adaptationthe definition of '"min-zoom" descriptor' in that specification.
zoom - CSS: Cascading Style Sheets
WebCSS@viewportzoom
formal definition related at-rule@viewportinitial valueautopercentagesthe zoom factor itselfcomputed valueauto, or a non-negative number or percentage as specified formal syntax auto | <number> | <percentage> examples setting viewport zoom factor @viewport { zoom: 2.0; } specifications specification status comment css device adaptationthe definition of '"zoom" descriptor' in that specification.
Alternative style sheets - CSS: Cascading Style Sheets
recommendation earlier, the html specification itself defined the concept of preferred and alternate stylesheets.
Styling Columns - CSS: Cascading Style Sheets
note that the rule itself does not take up any space: a wide rule will not push the columns apart to make space for the rule.
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
css creates anonymous boxes to represent these items so that you do not need to wrap each item in a wrapper to represent the html table row, and a second one to represent the table element itself, you can’t see or style these anonymous boxes; they are there purely to fix up the tree.
Typical use cases of Flexbox - CSS: Cascading Style Sheets
as in the above example, make a container into a flex container, and then use either align-items on the parent element or target the flex item itself with align-self.
Block and inline layout in normal flow - CSS: Cascading Style Sheets
the box itself has an outer display type, so it knows how to behave alongside other boxes.
OpenType font features guide - CSS: Cascading Style Sheets
in cases such as these it's more than just a nicety, but rather an integral part of the content itself.
CSS Fonts - CSS: Cascading Style Sheets
WebCSSCSS Fonts
p { width: 600px; margin: 0 auto; font-family: "helvetica neue", "arial", sans-serif; font-style: italic; font-weight: 100; font-variant-ligatures: normal; font-size: 2rem; letter-spacing: 1px; } <p>three hundred years ago<br> i thought i might get some sleep<br> i stretched myself out onna antique bed<br> an' my spirit did a midnite creep</p> the result is as follows: variable fonts examples you can find a number of variable fonts examples at v-fonts.com and axis-praxis.org; see also our variable fonts guide for more information and usage information.
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
rder-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } .wrapper { writing-mode: vertical-lr; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); grid-gap: 10px; } .item1 { grid-column: 1 / 4; align-self: start; } .item2 { grid-column: 1 / 3; grid-row: 2 / 4; align-self: start; } .item3 { grid-column: 3; grid-row: 2 / 4; align-self: end; justify-self: end; } <div class="wrapper"> <div class="item1">item 1</div> <div class="item2">item 2</div> <div class="item3">item 3</div> </div> if you want to see how these work, with a right to left as well as top to ...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
returning to the source if at any time in the design process you find yourself using grid to relocate the position of an element, consider whether you should return to your document and make a change to the logical order too.
Grid template areas - CSS: Cascading Style Sheets
these can quickly become difficult to read for other developers, or even your future self.
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
you could also use the line index itself if you prefer and avoid using named lines at all.
Using CSS gradients - CSS: Cascading Style Sheets
the following are valid for all gradient functions: using more than two colors you don't have to limit yourself to two colors—you may use as many as you like!
Consistent list indentation - CSS: Cascading Style Sheets
this list item has no marker (otherwise known as a "bullet") and is not yet part of a list itself.
The stacking context - CSS: Cascading Style Sheets
each stacking context is self-contained: after the element's contents are stacked, the whole element is considered in the stacking order of the parent stacking context.
Overview of CSS Shapes - CSS: Cascading Style Sheets
this will further shorten the line boxes of any content wrapping the shape, pushing it away from the shape itself.
Using CSS transforms - CSS: Cascading Style Sheets
it also includes classes for the container box and the cube itself, as well as each of its faces.
Introducing the CSS Cascade - CSS: Cascading Style Sheets
WebCSSCascade
resetting styles after your content has finished altering styles, it may find itself in a situation where it needs to restore them to a known state.
Layout and the containing block - CSS: Cascading Style Sheets
of the element's position property: if the position property is static, relative, or sticky, the containing block is formed by the edge of the content box of the nearest ancestor element that is either a block container (such as an inline-block, block, or list-item element) or establishes a formatting context (such as a table container, flex container, grid container, or the block container itself).
Pagination - CSS: Cascading Style Sheets
the list itself also becomes a flex container to lay the items out as a row.
Layout mode - CSS: Cascading Style Sheets
float layout, designed to cause an item to position itself left or right with the rest of the content in normal flow wrapping around it.
Replaced elements - CSS: Cascading Style Sheets
the position of the replaced element can be affected using css, but not the contents of the replaced element itself.
Shorthand properties - CSS: Cascading Style Sheets
shorthand properties: animation, background, border, border-bottom, border-color, border-left, border-radius, border-right, border-style, border-top, border-width, column-rule, columns, flex, flex-flow, font, grid, grid-area, grid-column, grid-row, grid-template, list-style, margin, offset, outline, overflow, padding, place-content, place-items, place-self, text-decoration, transition ...
Syntax - CSS: Cascading Style Sheets
WebCSSSyntax
it is important to note that even if a ruleset characterized by a group of selectors is a kind of shorthand replacing rulesets with a single selector each, this doesn't apply to the validity of the ruleset itself.
CSS Tutorials - CSS: Cascading Style Sheets
WebCSSTutorials
some of them are fancy and are pretty self contained.
Viewport concepts - CSS: Cascading Style Sheets
the width media query in the svg is based on the element in which the svg is contained — the <img> if the source is an svg file, the svg itself if the svg is included directly into the html, or the parent if the parent element has a width assigned and — not the viewport’s width.
background-attachment - CSS: Cascading Style Sheets
scroll the background is fixed relative to the element itself and does not scroll with its contents.
break-after - CSS: Cascading Style Sheets
if more than one of them are such a break, the one of the element that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-inside value).
break-before - CSS: Cascading Style Sheets
if more than one of them are such a break, the one of the element that appears the latest in the flow is taken (i.e., the break-before value has precedence over the break-after value, which itself has precedence over the break-inside value).
calc() - CSS: Cascading Style Sheets
WebCSScalc
let's look at some css: input { padding: 2px; display: block; width: calc(100% - 1em); } #formbox { width: calc(100% / 6); border: 1px solid black; padding: 4px; } here, the form itself is established to use 1/6 of the available window width.
clear - CSS: Cascading Style Sheets
WebCSSclear
if you want it to always be able to resize, so that it contains floating elements inside it, you need to self-clear its children.
clip-path - CSS: Cascading Style Sheets
WebCSSclip-path
if specified by itself, it causes the edges of the specified box, including any corner shaping (such as a border-radius), to be the clipping path.
color-adjust - CSS: Cascading Style Sheets
not only can the user override the behavior, but each user agent is allowed to decide for itself how to handle color-adjust in any given situation.
counter() - CSS: Cascading Style Sheets
WebCSScounter
/* simple usage */ counter(countername); /* changing the counter display */ counter(countername, upper-roman) a counter has no visible effect by itself.
counters() - CSS: Cascading Style Sheets
WebCSScounters
/* simple usage - style defaults to decimal */ counters(countername, '-'); /* changing the counter display */ counters(countername, '.', upper-roman) a counter has no visible effect by itself.
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
if you consider the outer and inner values when you change the value of display, you will understand immediately what impact the value will have on the box itself, and how it displays and behaves in the layout, and the direct children.
<display-inside> - CSS: Cascading Style Sheets
depending on the value of other properties (such as position, float, or overflow) and whether it is itself participating in a block or inline formatting context, it either establishes a new block formatting context (bfc) for its contents or integrates its contents into its parent formatting context.
drop-shadow() - CSS: Cascading Style Sheets
the box-shadow property creates a rectangular shadow behind an element's entire box, while the drop-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself.
font - CSS: Cascading Style Sheets
WebCSSfont
it also applies to ::first-letter and ::first-line.inheritedyespercentagesas each of the properties of the shorthand:font-size: refer to the parent element's font sizeline-height: refer to the font size of the element itselfcomputed valueas each of the properties of the shorthand:font-style: as specifiedfont-variant: as specifiedfont-weight: the keyword or the numerical value as specified, with bolder and lighter transformed to the real valuefont-stretch: as specifiedfont-size: as specified, but with relative lengths converted into absolute lengthsline-height: for percentage and length values, the absolute length, ot...
image-rendering - CSS: Cascading Style Sheets
the property applies to an element itself, to any images set in its other properties, and to its descendants.
image() - CSS: Cascading Style Sheets
examples directionally-sensitive images <ul> <li dir="ltr">bullet is a right facing arrow on the left</li> <li dir="rtl">bullet is the same arrow, flipped to point left.</li> </ul> ul { list-style-image: image(ltr 'https://mdn.mozillademos.org/files/16412/rightarrow.png'); } in the left-to-right list items — those with dir="ltr" set on the element itself or inheriting the directionality from an ancestor or default value for the page — the image will be used as-is.
justify-content - CSS: Cascading Style Sheets
baseline, self-start, self-end, start, end, left, right, unsafe | safe values.
left - CSS: Cascading Style Sheets
WebCSSleft
ecified as a percentage, the specified value; otherwise, autoanimation typea length, percentage or calc(); formal syntax <length> | <percentage> | auto examples positioning elements html <div id="wrap"> <div id="example_1"> <pre> position: absolute; left: 20px; top: 20px; </pre> <p>the only containing element for this div is the main window, so it positions itself in relation to it.</p> </div> <div id="example_2"> <pre> position: relative; top: 0; right: 0; </pre> <p>relative position in relation to its siblings.</p> </div> <div id="example_3"> <pre> float: right; position: relative; top: 20px; left: 20px; </pre> <p>relative to its sibling div above, but removed from flow of conten...
<length> - CSS: Cascading Style Sheets
WebCSSlength
if used on the font-size property itself, it represents the inherited font-size of the element.
mask-type - CSS: Cascading Style Sheets
WebCSSmask-type
it applies to the <mask> element itself.
max() - CSS: Cascading Style Sheets
WebCSSmax
the expressions are full math expressions, so you can use direct addition, subtraction, multiplication and division without using the calc() function itself.
perspective - CSS: Cascading Style Sheets
it also includes classes for the container box and the cube itself, as well as each of its faces.
position - CSS: Cascading Style Sheets
WebCSSposition
relative the element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top, right, bottom, and left.
scroll-margin-inline-end - CSS: Cascading Style Sheets
result try it for yourself: specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-inline-end' in that specification.
scroll-margin-inline-start - CSS: Cascading Style Sheets
result try it for yourself: specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-inline-start' in that specification.
scroll-margin-inline - CSS: Cascading Style Sheets
result try it for yourself: specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin-inline' in that specification.
scroll-margin - CSS: Cascading Style Sheets
result try it for yourself: specifications specification status comment css scroll snap module level 1the definition of 'scroll-margin' in that specification.
<string> - CSS: Cascading Style Sheets
WebCSSstring
these include double quotes when used inside a double-quoted string, single quotes when used inside a single-quoted string, and the backslash itself.
text-align - CSS: Cascading Style Sheets
</p> css .example { text-align: justify; border: solid; } result notes the standard-compatible way to center a block itself without centering its inline content is setting the left and right margin to auto, e.g.: .something { margin: auto; } .something { margin: 0 auto; } .something { margin-left: auto; margin-right: auto; } specifications specification status comment css logical properties and values level 1the definition of 'text-align' in that specification.
text-decoration-thickness - CSS: Cascading Style Sheets
it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the font size of the element itselfcomputed valueas specifiedanimation typeby computed value type formal syntax auto | from-font | <length> | <percentage> examples varying thickness html <p class="thin">here's some text with a 1px red underline.</p> <p class="thick">this one has a 5px red underline.</p> <p class="shorthand">this uses the equivalent shorthand.</p> css .thin { text-decoration-line: underline; text-decorat...
text-overflow - CSS: Cascading Style Sheets
if there is not enough space to display the string itself, it is clipped.
text-underline-offset - CSS: Cascading Style Sheets
it also applies to ::first-letter and ::first-line.inheritedyespercentagesrefer to the font size of the element itselfcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length> | <percentage> examples <p class="oneline">here's some text with an offset wavy red underline!</p> <br> <p class="twolines">this text has lines both above and below it.
touch-action - CSS: Cascading Style Sheets
this is an alias for "pan-x pan-y pinch-zoom" (which, for compatibility, is itself still valid).
transform-style - CSS: Cascading Style Sheets
syntax /* keyword values */ transform-style: flat; transform-style: preserve-3d; /* global values */ transform-style: inherit; transform-style: initial; transform-style: unset; values flat indicates that the children of the element are lying in the plane of the element itself.
vertical-align - CSS: Cascading Style Sheets
it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the line-height of the element itselfcomputed valuefor percentage and length values, the absolute length, otherwise the keyword as specifiedanimation typea length formal syntax baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length> examples basic example html <div>an <img src="https://udn.realityripple.com/samples/b4/e1f0faff5b.svg" alt="link" width="32" height="32" /> image with a def...
Ajax - Developer guides
WebGuideAJAX
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 xmlhttprequest object.
Video player styling basics - Developer guides
basic styling the html video and its controls are all contained within a <figure> element, which is given a maximum width and height (based on the dimensions of the video used) and centered within the page: figure { max-width:64rem; width:100%; max-height:30.875rem; height:100%; margin:1.25rem auto; padding:1.051%; background-color:#666; } the video controls container itself also needs some styling so that it is set up the correct way: .controls { width:100%; height:8.0971659919028340080971659919028%; /* of figure's height */ position:relative; } the height of the .controls class is set to be (a very precise!) percentage of the enclosing <figure> element (this was worked out with experimentation based on the required button height).
Block formatting context - Developer guides
0px; background-color: rgba(255, 255, 255, .5); border:1px solid black; padding: 10px; } exclude external floats in the following example, we are using display:flow-root and floats to implement double columns layout, beacuse an element in the normal flow that establishes a new bfc must not overlap the margin box of any floats in the same block formatting context as the element itself.
Event developer guide - Developer guides
WebGuideEvents
such events are commonly called synthetic events, as opposed to the events fired by the browser itself.dom on-event handlersthe web platform provides several ways to get notified of dom events.
Rich-Text Editing in Mozilla - Developer guides
the function executed the requested command using execcommand() and then sets focus back to the editable document, as clicking on a button will set focus on the button itself, which breaks the editing flow.
Localizations and character encodings - Developer guides
the mapping from locales onto fallback encodings is now built into gecko itself.
A hybrid approach - Developer guides
it can’t hurt to dig down and ask yourself which axis you are actually looking to adjust your content around.
Parsing and serializing XML - Developer guides
xmlhttprequest loads content from a url; xml content is returned as an xml document object with a dom tree built from the xml itself.
Printing - Developer guides
head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>javascript window close example </title> <script type="text/javascript"> function popuponclick() { my_window = window.open('', 'mywindow', 'status=1,width=350,height=150'); my_window.document.write('<html><head><title>print me</title></head>'); my_window.document.write('<body onafterprint="self.close()">'); my_window.document.write('<p>when you print this window, it will close afterward.</p>'); my_window.document.write('</body></html>'); } </script> </head> <body> <p>to try out the <code>afterprint</code> event, click the link below to open the window to print.
Writing forward-compatible websites - Developer guides
javascript prefix all global variable access in onfoo attributes with “window.” when an event handler content attribute (onclick, onmouseover, and so forth) is used on html element, all name lookup in the attribute first happens on the element itself, then on the element's form if the element is a form control, then on the document, and then on the window (where the global variables you have defined are).
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
in addition, ink can be expensive, and if a user is printing your page, they don't necessarily need all the backgrounds and such using up their precious ink when all that matters is the text itself.
HTML attribute: capture - HTML: Hypertext Markup Language
<p> <label for="soundfile">what does your voice sound like?:</label> <input type="file" id="soundfile" capture="user" accept="audio/*"> </p> <p> <label for="videofile">upload a video:</label> <input type="file" id="videofile" capture="environment" accept="video/*"> </p> <p> <label for="imagefile">upload a photo of yourself:</label> <input type="file" id="imagefile" capture="user" accept="image/*"> </p> note these work better on mobile devices; if your device is a desktop computer, you'll likely get a typical file picker.
HTML attribute reference - HTML: Hypertext Markup Language
crossorigin <audio>, <img>, <link>, <script>, <video> how the element handles cross-origin requests csp <iframe> specifies the content security policy that an embedded document must agree to enforce upon itself.
<article>: The Article Contents element - HTML: Hypertext Markup Language
WebHTMLElementarticle
the html <article> element represents a self-contained composition in a document, page, application, or site, which is intended to be independently distributable or reusable (e.g., in syndication).
<bgsound>: The Background Sound element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementbgsound
you can write <bgsound> as a self-closing tag (<bgsound />); however, since this element is non-standard, doing so will still not validate.
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
WebHTMLElementblink
if you don't believe us, see for yourself in the html spec.
<code>: The Inline Code element - HTML: Hypertext Markup Language
WebHTMLElementcode
the <code> element by itself only represents a single phrase of code or line of code.
<command>: The HTML Command element - HTML: Hypertext Markup Language
WebHTMLElementcommand
radiogroup this attribute gives the name of the group of commands, with a type of radio, that will be toggled when the command itself is toggled.
<details>: The Details disclosure element - HTML: Hypertext Markup Language
WebHTMLElementdetails
an input device as well as some form of output device is recommended.</p> </details> result customizing the disclosure widget the disclosure triangle itself can be customized, although this is not as broadly supported.
<em>: The Emphasis element - HTML: Hypertext Markup Language
WebHTMLElementem
usage notes the <em> element is for words that have a stressed emphasis compared to surrounding text, which is often limited to a word or words of a sentence and affects the meaning of the sentence itself.
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
WebHTMLElementfigure
the html <figure> (figure with optional caption) element represents self-contained content, potentially with an optional caption, which is specified using the (<figcaption>) element.
<img>: The Image Embed element - HTML: Hypertext Markup Language
WebHTMLElementimg
it should not describe the presence of the image itself or the file name of the image.
<input type="checkbox"> - HTML: Hypertext Markup Language
WebHTMLElementinputcheckbox
ding" checked> <label for="coding">coding</label> </div> <div> <input type="checkbox" id="music" name="interest" value="music"> <label for="music">music</label> </div> </fieldset> providing a bigger hit area for your checkboxes in the above examples, you may have noticed that you can toggle a checkbox by clicking on its associated <label> element as well as on the checkbox itself.
<input type="date"> - HTML: Hypertext Markup Language
WebHTMLElementinputdate
we had to put the icon on a <span> next to the input, not on the input itself, because in chrome at least the input's generated content is placed inside the form control, and can't be styled or shown effectively.
<input type="datetime-local"> - HTML: Hypertext Markup Language
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
<input type="file"> - HTML: Hypertext Markup Language
WebHTMLElementinputfile
in the first lines of script, we get references to the form input itself, and the <div> element with the class of .preview.
<input type="month"> - HTML: Hypertext Markup Language
WebHTMLElementinputmonth
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
<input type="radio"> - HTML: Hypertext Markup Language
WebHTMLElementinputradio
providing a bigger hit area for your radio buttons in the above examples, you may have noticed that you can select a radio button by clicking on its associated <label> element, as well as on the radio button itself.
<input type="search"> - HTML: Hypertext Markup Language
WebHTMLElementinputsearch
if that isn't enough, you can use an aria-label attribute on the <input> itself.
<input type="time"> - HTML: Hypertext Markup Language
WebHTMLElementinputtime
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
<input type="week"> - HTML: Hypertext Markup Language
WebHTMLElementinputweek
we had to put the icons on a <span> next to the input, not on the input itself, because in chrome the generated content is placed inside the form control, and can't be styled or shown effectively.
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
WebHTMLElementinput
placeholders are not accessible the placeholder attribute lets you specify a text that appears within the <input> element's content area itself when empty.
<label> - HTML: Hypertext Markup Language
WebHTMLElementlabel
you can click the associated label to focus/activate the input, as well as the input itself.
<menuitem> - HTML: Hypertext Markup Language
WebHTMLElementmenuitem
(if specified, the type attribute of the <menu> element must be popup; if missing, the parent element of the <menu> must itself be a <menu> in the popup menu state.) permitted aria roles none dom interface htmlmenuitemelement attributes this element includes the global attributes; in particular title can be used to describe the command, or provide usage hints.
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
WebHTMLElementmeta
if the http-equiv is not an encoding declaration, it can also be inside a <noscript> element, itself inside a <head> element.
<p>: The Paragraph element - HTML: Hypertext Markup Language
WebHTMLElementp
see for yourself: <button data-toggle-text="oh no!
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
WebHTMLElementtd
some user-agents, such as speech readers, may present this description before the content itself.
<th> - HTML: Hypertext Markup Language
WebHTMLElementth
some user-agents, such as speech readers, may present this description before the content itself.
<video>: The Video Embed element - HTML: Hypertext Markup Language
WebHTMLElementvideo
however, these events aren't sent directly to the <video> element itself.
Link types: noopener - HTML: Hypertext Markup Language
note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.
Link types - HTML: Hypertext Markup Language
note that when noopener is used, nonempty target names other than _top, _self, and _parent are all treated like _blank in terms of deciding whether to open a new window/tab.
HTTP authentication - HTTP
a client that wants to authenticate itself with the server can then do so by including an authorization request header with the credentials.
Data URLs - HTTP
syntax data urls are composed of four parts: a prefix (data:), a mime type indicating the type of data, an optional base64 token if non-textual, and the data itself: data:[<mediatype>][;base64],<data> the mediatype is a mime type string, such as 'image/jpeg' for a jpeg image file.
Identifying resources on the Web - HTTP
fragment #somewhereinthedocument is an anchor to another part of the resource itself.
Reason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz' - HTTP
the header itself accepts a comma-delineated list of origins, so adding a new origin is not difficult.
HTTP caching - HTTP
WebHTTPCaching
this achieves several goals: it eases the load of the server that doesn’t need to serve all clients itself, and it improves performance by being closer to the client, i.e., it takes less time to transmit the resource back.
Connection management in HTTP/1.x - HTTP
the tcp handshake itself is time-consuming, but a tcp connection adapts to its load, becoming more efficient with more sustained (or warm) connections.
Content-Disposition - HTTP
used on the body itself, content-disposition has no effect.
CSP: child-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: font-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: frame-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: manifest-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: media-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: object-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: prefetch-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: report-to - HTTP
content-security-policy: ...; report-to groupname the directive has no effect in and of itself, but only gains meaning in combination with other directives.
CSP: report-uri - HTTP
the directive has no effect in and of itself, but only gains meaning in combination with other directives.
CSP: style-src-attr - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: style-src-elem - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: style-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
CSP: worker-src - HTTP
'self' refers to the origin from which the protected document is being served, including the same url scheme and port number.
Cross-Origin-Opener-Policy - HTTP
allows the document to be added to its opener's browsing context group unless the opener itself has a coop of same-origin or same-origin-allow-popups.
Digest - HTTP
WebHTTPHeadersDigest
the representation itself may be: fully contained in the response message body not at all contained in the message body (for example, in a response to a head request) partially contained in the message body (for example, in a response to a range request).
Index - HTTP
WebHTTPHeadersIndex
used on the body itself, content-disposition has no effect.
Trailer - HTTP
WebHTTPHeadersTrailer
these header fields are disallowed: message framing headers (e.g., transfer-encoding and content-length), routing headers (e.g., host), request modifiers (e.g., controls and conditionals, like cache-control, max-forwards, or te), authentication headers (e.g., authorization or set-cookie), or content-encoding, content-type, content-range, and trailer itself.
Firefox user agent string reference - HTTP
general form the ua string of firefox itself is broken down into four components: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion mozilla/5.0 is the general token that says the browser is mozilla compatible, and is common to almost every browser today.
X-DNS-Prefetch-Control - HTTP
resolve hostnames without providing a complete url, but only, by preceding the hostname with two slashes: <link rel="dns-prefetch" href="//www.mozilla.org/contribute/"> forced prefetching of hostnames might be useful, for example, on the homepage of a site to force pre-resolution of domain names that are referenced frequently throughout the site even though they are not used on the home page itself.
X-Frame-Options - HTTP
sameorigin the page can only be displayed in a frame on the same origin as the page itself.
An overview of HTTP - HTTP
WebHTTPOverview
but while the core of http itself is stateless, http cookies allow the use of stateful sessions.
Protocol upgrade mechanism - HTTP
if you need to create a websocket connection from scratch, you'll have to handle the handshaking process yourself.
Proxy servers and tunneling - HTTP
to provide information about the proxy itself (not about the client connecting to it), the via header can be used.
414 URI Too Long - HTTP
WebHTTPStatus414
there are a few rare conditions when this might occur: when a client has improperly converted a post request to a get request with long query information, when the client has descended into a loop of redirection (for example, a redirected uri prefix that points to a suffix of itself), or when the server is under attack by a client attempting to exploit potential security holes.
506 Variant Also Negotiates - HTTP
WebHTTPStatus506
the variant also negotiates status code indicates an internal server configuration error in which the chosen variant is itself configured to engage in content negotiation, so is not a proper negotiation endpoint.
Closures - JavaScript
closure scope chain every closure has three scopes: local scope (own scope) outer functions scope global scope a common mistake is not realizing that, in the case where the outer function is itself a nested function, access to the outer function's scope includes the enclosing scope of the outer function—effectively creating a chain of function scopes.
Control flow and error handling - JavaScript
in older javascript, variables introduced within a block are scoped to the containing function or script, and the effects of setting them persist beyond the block itself.
Details of the object model - JavaScript
as these examples show, if you want to have default values for object properties and you want to be able to change the default values at run time, you should set the properties in the constructor's prototype, not in the constructor function itself.
Expressions and operators - JavaScript
the expression itself evaluates to seven.
Indexed collections - JavaScript
typed array views typed array views have self descriptive names and provide views for all the usual numeric types like int8, uint32, float64 and so forth.
Introduction - JavaScript
although the description of the language may differ in ecmascript, the language itself remains the same.
Keyed collections - JavaScript
nan is considered equal to itself (contrary to ===).
JavaScript modules - JavaScript
the modules directory's two modules are described below: canvas.js — contains functions related to setting up the canvas: create() — creates a canvas with a specified width and height inside a wrapper <div> with a specified id, which is itself appended inside a specified parent element.
Numbers and dates - JavaScript
cannot change the values of these properties and you use them as follows: var biggestnum = number.max_value; var smallestnum = number.min_value; var infinitenum = number.positive_infinity; var neginfinitenum = number.negative_infinity; var notanum = number.nan; you always refer to a property of the predefined number object as shown above, and not as a property of a number object you create yourself.
Character classes - JavaScript
to match this character literally, escape it with itself.
Regular expression syntax cheatsheet - JavaScript
to match this character literally, escape it with itself.
Text formatting - JavaScript
a string object has a variety of methods: for example those that return a variation on the string itself, such as substring and touppercase.
static - JavaScript
instead, they're called on the class itself.
Classes - JavaScript
public field declarations with the javascript field declaration syntax, the above example can be written as: class rectangle { height = 0; width; constructor(height, width) { this.height = height; this.width = width; } } by declaring fields up-front, class definitions become more self-documenting, and the fields are always present.
TypeError: invalid assignment to const "x" - JavaScript
for instance, in case the content is an object, this means the object itself can still be altered.
getter - JavaScript
const o = {a: 0}; object.defineproperty(o, 'b', { get: function() { return this.a + 1; } }); console.log(o.b) // runs the getter, which yields a + 1 (which is 1) using a computed property name const expr = 'foo'; const obj = { get [expr]() { return 'bar'; } }; console.log(obj.foo); // "bar" smart / self-overwriting / lazy getters getters give you a way to define a property of an object, but they do not calculate the property's value until it is accessed.
Rest parameters - JavaScript
formally defined in function expression), while the arguments object contains all arguments passed to the function; the arguments object is not a real array, while rest parameters are array instances, meaning methods like sort, map, foreach or pop can be applied on it directly; the arguments object has additional functionality specific to itself (like the callee property).
Array.prototype.concat() - JavaScript
description the concat method creates a new array consisting of the elements in the object on which it is called, followed in order by, for each argument, the elements of that argument (if the argument is an array) or the argument itself (if the argument is not an array).
Array.prototype.fill() - JavaScript
fill is a mutator method: it will change the array itself and return it, not a copy of it.
Array.prototype.filter() - JavaScript
// notice there are three words below length 6, but since they've been modified one is returned // ["spray"] // appending new words words = ['spray', 'limit', 'exuberant', 'destruction','elite', 'present'] const appendedwords = words.filter( (word, index, arr) => { arr.push('new') return word.length < 6 }) console.log(appendedwords) // only three fits the condition even though the `words` itself now has a lot more words with character length less than 6 // ["spray" ,"limit" ,"elite"] // deleting words words = ['spray', 'limit', 'exuberant', 'destruction', 'elite', 'present'] const deletewords = words.filter( (word, index, arr) => { arr.pop() return word.length < 6 }) console.log(deletewords) // notice 'elite' is not even obtained as its been popped off `words` before filter can eve...
Array.prototype.flatMap() - JavaScript
https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 examples map() and flatmap() let arr1 = [1, 2, 3, 4]; arr1.map(x => [x * 2]); // [[2], [4], [6], [8]] arr1.flatmap(x => [x * 2]); // [2, 4, 6, 8] // only one level is flattened arr1.flatmap(x => [[x * 2]]); // [[2], [4], [6], [8]] while the above could have been achieved by using map itself, here is an example that better showcases the use of flatmap.
Array.isArray() - JavaScript
if (!array.isarray) { array.isarray = function(arg) { return object.prototype.tostring.call(arg) === '[object array]'; }; } examples using array.isarray // all following calls return true array.isarray([]); array.isarray([1]); array.isarray(new array()); array.isarray(new array('a', 'b', 'c', 'd')); array.isarray(new array(3)); // little known fact: array.prototype itself is an array: array.isarray(array.prototype); // all following calls return false array.isarray(); array.isarray({}); array.isarray(null); array.isarray(undefined); array.isarray(17); array.isarray('array'); array.isarray(true); array.isarray(false); array.isarray(new uint8array(32)); array.isarray({ __proto__: array.prototype }); instanceof vs isarray when checking for array instance, array.i...
Array.prototype.push() - JavaScript
instead, we store the collection on the object itself and use call on array.prototype.push to trick the method into thinking we are dealing with an array—and it just works, thanks to the way javascript allows us to establish the execution context in any way we want.
Array - JavaScript
setting or accessing via non-integers using bracket notation (or dot notation) will not set or retrieve an element from the array list itself, but will set or access a variable associated with that array's object property collection.
Date.prototype[@@toPrimitive] - JavaScript
you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
EvalError() constructor - JavaScript
however, the object itself remains for backwards compatibility with earlier versions of the specification.
EvalError - JavaScript
however, the object itself remains for backwards compatibility with earlier versions of the specification.
FinalizationRegistry.prototype.register() - JavaScript
examples using register the following registers the target object referenced by target, passing in the held value "some value" and passing the target object itself as the unregistration token: registry.register(target, "some value", target); the following registers the target object referenced by target, passing in another object as the held value, and not passing in any unregistration token (which means target can't be unregistered): registry.register(target, {"useful": "info about target"}); specifications specification weakre...
Function.length - JavaScript
data property of the function constructor the function constructor is itself a function object.
JSON.parse() - JavaScript
specifically, the computed value and all its properties (beginning with the most nested properties and proceeding to the original value itself) are individually run through the reviver.
Math.random() - JavaScript
examples note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
Math.random() - JavaScript
examples note that as numbers in javascript are ieee 754 floating point numbers with round-to-nearest-even behavior, the ranges claimed for the functions below (excluding the one for math.random() itself) aren't exact.
NaN - JavaScript
or perform a self-comparison: nan, and only nan, will compare unequal to itself.
Number.isNaN() - JavaScript
polyfill the following works because nan is the only value in javascript which is not equal to itself.
Object.assign() - JavaScript
= { a: 0 , b: { c: 0}}; let obj3 = json.parse(json.stringify(obj1)); obj1.a = 4; obj1.b.c = 4; console.log(json.stringify(obj3)); // { "a": 0, "b": { "c": 0}} } test(); merging objects const o1 = { a: 1 }; const o2 = { b: 2 }; const o3 = { c: 3 }; const obj = object.assign(o1, o2, o3); console.log(obj); // { a: 1, b: 2, c: 3 } console.log(o1); // { a: 1, b: 2, c: 3 }, target object itself is changed.
Object.create() - JavaScript
propertiesobject optional if specified and not undefined, an object whose enumerable own properties (that is, those properties defined upon itself and not enumerable properties along its prototype chain) specify property descriptors to be added to the newly-created object, with the corresponding property names.
Object.getOwnPropertySymbols() - JavaScript
note that object.getownpropertynames() itself does not contain the symbol properties of an object and only the string properties.
Object.prototype.hasOwnProperty() - JavaScript
note that the for...in loop is already only iterating enumerable items, so one should not assume based on the lack of non-enumerable properties shown in the loop that hasownproperty itself is confined strictly to enumerable items (as with object.getownpropertynames()).
Object.prototype.isPrototypeOf() - JavaScript
in the expression "object instanceof afunction", the object prototype chain is checked against afunction.prototype, not against afunction itself.
Object.prototype.toSource() - JavaScript
a cyclically linked list or a tree that can be traversed both ways, tosource() will not recreate the self-reference, as of firefox 24.
Object - JavaScript
deleting a property from an object there isn't any method in an object itself to delete its own properties (such as map.prototype.delete()).
Promise.prototype.catch() - JavaScript
the promise returned by catch() is rejected if onrejected throws an error or returns a promise which is itself rejected; otherwise, it is resolved.
Promise - JavaScript
the function promisegetword() illustrates how an api function might generate and return a promise in a self contained manner.
handler.apply() - JavaScript
the target must be a callable itself.
handler.set() - JavaScript
this is usually the proxy itself.
String.prototype.blink() - JavaScript
the <blink> element itself is non-standard and deprecated!
String.prototype.substring() - JavaScript
th news in the string fulls function replacestring(olds, news, fulls) { for (let i = 0; i < fulls.length; ++i) { if (fulls.substring(i, i + olds.length) == olds) { fulls = fulls.substring(0, i) + news + fulls.substring(i + olds.length, fulls.length) } } return fulls } replacestring('world', 'web', 'brave new world') note that this can result in an infinite loop if olds is itself a substring of news — for example, if you attempted to replace 'world' with 'otherworld' here.
String.prototype.toLocaleLowerCase() - JavaScript
tolocalelowercase() does not affect the value of the string itself.
String.prototype.toLocaleUpperCase() - JavaScript
tolocaleuppercase() does not affect the value of the string itself.
String.prototype.toLowerCase() - JavaScript
tolowercase() does not affect the value of the string str itself.
String.prototype.toUpperCase() - JavaScript
this method does not affect the value of the string itself since javascript strings are immutable.
String.prototype.trim() - JavaScript
trim() does not affect the value of the str itself.
String.prototype.trimEnd() - JavaScript
trimend() or trimright() do not affect the value of the string itself.
String.prototype.trimStart() - JavaScript
trimleft() or trimstart() do not affect the value of the string itself.
Symbol.prototype[@@toPrimitive] - JavaScript
you rarely need to invoke the [@@toprimitive]() method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
Symbol() constructor - JavaScript
a description of the symbol which can be used for debugging but not to access the symbol itself.
Symbol.prototype.description - JavaScript
description symbol objects can be created with an optional description which can be used for debugging but not to access the symbol itself.
Symbol.prototype.valueOf() - JavaScript
you rarely need to invoke the valueof method yourself; javascript automatically invokes it when encountering an object where a primitive value is expected.
WeakMap() constructor - JavaScript
wm1.get(o2); // "azerty" wm2.get(o2); // undefined, because there is no key for o2 on wm2 wm2.get(o3); // undefined, because that is the set value wm1.has(o2); // true wm2.has(o2); // false wm2.has(o3); // true (even if the value itself is 'undefined') wm3.set(o1, 37); wm3.get(o1); // 37 wm1.has(o1); // true wm1.delete(o1); wm1.has(o1); // false specifications specification ecmascript (ecma-262)the definition of 'weakmap constructor' in that specification.
WeakMap - JavaScript
wm1.get(o2); // "azerty" wm2.get(o2); // undefined, because there is no key for o2 on wm2 wm2.get(o3); // undefined, because that is the set value wm1.has(o2); // true wm2.has(o2); // false wm2.has(o3); // true (even if the value itself is 'undefined') wm3.set(o1, 37); wm3.get(o1); // 37 wm1.has(o1); // true wm1.delete(o1); wm1.has(o1); // false implementing a weakmap-like class with a .clear() method class clearableweakmap { constructor(init) { this._wm = new weakmap(init); } clear() { this._wm = new weakmap(); } delete(k) { return this._wm.delete(k); } get(k) { return this._wm.get(k); } h...
encodeURI() - JavaScript
euri(set1)); // ;,/?:@&=+$# console.log(encodeuri(set2)); // -_.!~*'() 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 xmlhttprequest, because "&", "+", and "=" are not encoded, which are treated as special characters in get and post requests.
isNaN() - JavaScript
a polyfill for isnan would be (the polyfill leverages the unique never-equal-to-itself characteristic of nan): var isnan = function(value) { var n = number(value); return n !== n; }; examples isnan(nan); // true isnan(undefined); // true isnan({}); // true isnan(true); // false isnan(null); // false isnan(37); // false // strings isnan('37'); // false: "37" is converted to the number 37 which is not nan isnan('37.37'); // false: "37...
Standard built-in objects - JavaScript
the global object itself can be accessed using the this operator in the global scope.
Iteration protocols - JavaScript
) { yield 1; yield 2; yield 3; }(); console.log(typeof ageneratorobject.next); // "function", because it has a next method, so it's an iterator console.log(typeof ageneratorobject[symbol.iterator]); // "function", because it has an @@iterator method, so it's an iterable console.log(ageneratorobject[symbol.iterator]() === ageneratorobject); // true, because its @@iterator method returns itself (an iterator), so it's an well-formed iterable console.log([...ageneratorobject]); // [1, 2, 3] console.log(symbol.iterator in ageneratorobject) // true, because @@iterator method is a property of ageneratorobject specifications specification ecmascript (ecma-262)the definition of 'iteration' in that specification.
await - JavaScript
rv returns the fulfilled value of the promise, or the value itself if it's not a promise.
class expression - JavaScript
the name is only visible within the scope of the class expression itself.
new.target - JavaScript
in ordinary functions, it refers to the function itself, assuming it was invoked via the new operator; otherwise new.target is undefined.
async function - JavaScript
on getprocesseddata(url) { let v try { v = await downloaddata(url) } catch(e) { v = await downloadfallbackdata(url) } return processdatainworker(v) } in the above example, notice there is no await statement after the return keyword, although that would be valid too: the return value of an async function is implicitly wrapped in promise.resolve - if it's not already a promise itself (as in this example).
block - JavaScript
variables introduced within a block are scoped to the containing function or script, and the effects of setting them persist beyond the block itself.
break - JavaScript
a break statement, with or without a following label, cannot be used within the body of a function that is itself nested within the current loop, switch, or label statement that the break statement is intended to break out of.
JavaScript typed arrays - JavaScript
typed array views typed array views have self-descriptive names and provide views for all the usual numeric types like int8, uint32, float64 and so forth.
JavaScript
this section is dedicated to the javascript language itself, and not the parts that are specific to web pages or other host environments.
<maction> - MathML
the action itself is specified by the actiontype attribute, which accepts several values.
<mroot> - MathML
WebMathMLElementmroot
mathcolor the text color and also the color of the root symbol itself.
<msqrt> - MathML
WebMathMLElementmsqrt
mathcolor the text color and also the color of the root symbol itself.
Image file type and format guide - Web media technologies
compression lossless (lzw) licensing while the gif format itself is open, the lzw compression algorithm was covered by patents until the early 2000s.
Handling media support issues in web content - Web media technologies
a good poster frame is one which is either a representative of the video's contents, or is an image which isn't even from the video itself but contains imagery and/or text which gives the reader a useful idea of the video's contents.
Web video codec guide - Web media technologies
choosing a video codec the decision as to which codec or codecs to use begins with a series of questions to prepare yourself: do you wish to use an open format, or are proprietary formats also to be considered?
Codecs used by WebRTC - Web media technologies
support for other packetization modes is optional, and the parameter itself is not required to be specified.
Media type and format guide: image, audio, and video content - Web media technologies
WebMediaFormats
codecs used by webrtc webrtc doesn't use a container, but instead streams the encoded media itself from peer to peer using mediastreamtrack objects to represent each audio or video track.
Privacy, permissions, and information security
these start at the web server, include the very communication layer used over the network, and then extend through the web browser's security offerings before reaching your web app code and the efforts it takes to secure itself and the data the user entrusts to it.
Installing and uninstalling web apps - Progressive web apps (PWAs)
the application itself may then manifest as in a chromeless view (without the full browser chrome) but it nevertheless is executing effectively as a tab within the browser.
How to make PWAs installable - Progressive web apps (PWAs)
{ "src": "icons/icon-512.png", "sizes": "512x512", "type": "image/png" } ], "start_url": "/pwa-examples/js13kpwa/index.html", "display": "fullscreen", "theme_color": "#b12a34", "background_color": "#b12a34" } most of the fields are self-explanatory, but to be certain we're on the same page: name: the full name of your web app.
Introduction to progressive web apps - Progressive web apps (PWAs)
it's well worth trying out a pwa approach, so you can see for yourself if it works for your app.
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
everything else specifies details about the gradient mask itself.
pointer-events - SVG: Scalable Vector Graphics
the rect underneath will change color whether you are clicking on the circle or the rect itself --> <rect x="10" y="0" height="10" width="10" fill="black" /> <circle cx="15" cy="5" r="4" fill="white" pointer-events="none" /> </svg> window.addeventlistener('mouseup', (e) => { // let's pick a random color between #000000 and #ffffff const color = math.round(math.random() * 0xffffff) // let's format the color to fit css requirements const fill = '#' + color.tostring(1...
requiredExtensions - SVG: Scalable Vector Graphics
note: if a given extension reference contains white space within itself, that white space must be escaped.
textLength - SVG: Scalable Vector Graphics
then <text> is used to create the text element itself, with an id of "hello".
xlink:show - SVG: Scalable Vector Graphics
this is similar to the effect achieved by an html <a> element with target set to _self.
<a> - SVG: Scalable Vector Graphics
WebSVGElementa
value type: _self|_parent|_top|_blank|<name> ; default value: _self; animatable: yes type a mime type for the linked url.
<filter> - SVG: Scalable Vector Graphics
WebSVGElementfilter
it is never rendered itself, but must be used by the filter attribute on svg elements, or the filter css property for svg/html elements.
<solidcolor> - SVG: Scalable Vector Graphics
this is less elegant, and unlike <solidcolor>, cannot itself be used in the definition of gradients.
<symbol> - SVG: Scalable Vector Graphics
WebSVGElementsymbol
element, structural elementpermitted contentany number of the following elements, in any order:animation elementsdescriptive elementsshape elementsstructural elementsgradient elements<a>, <altglyphdef>, <clippath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <foreignobject>, <image>, <marker>, <mask>, <pattern>, <script>, <style>, <switch>, <text>, <view> note: a <symbol> element itself is not meant to be rendered.
SVG documentation index - SVG: Scalable Vector Graphics
WebSVGIndex
it is never rendered itself, but must be used by the filter attribute on svg elements, or the filter css property for svg/html elements.
Namespaces crash course - SVG: Scalable Vector Graphics
by default, parameters don't have a namespace at all, and are only known to be unique because they appear on an element that itself has a unique name.
Getting started - SVG: Scalable Vector Graphics
if you have problems convincing them to correctly configure their servers for svg, there may be ways to do it yourself.
Gradients in SVG - SVG: Scalable Vector Graphics
gradients are defined in a defs section as opposed to on a shape itself to promote reusability.
SVG In HTML Introduction - SVG: Scalable Vector Graphics
error message appear.) this approach has the following points in its favor: we have taken a regular html form that could have been part of an existing web site, and added an attractive, interactive background the approach is backwards compatible to browsers that do not support svg; simply, no background appears in them it's very simple and performs very well the picture dynamically sizes itself to the required size in an intelligent way we can have declarative style rules applying to both html and svg the same script manipulates both html and svg the document is entirely standards-based to add a linked image with dom methods to an embedded svg element, one has to use setattributens to set href.
Same-origin policy - Web security
window.self read only.
How to turn off form autocompletion - Web security
this means that the criterion can be passed (by adding the relevant autocomplete attributes to individual form fields) even when autocompletion for the form itself has been turned off.
Types of attacks - Web security
that is, the page itself does not change, but the client side code contained in the page runs in an unexpected manner because of the malicious modifications to the dom environment.
HTML Imports - Web Components
html imports is intended to be the packaging mechanism for web components, but you can also use html imports by itself.
Using custom elements - Web Components
class customelement extends htmlelement { constructor(...args) { const self = super(...args); // self functionality written in here // self.addeventlistener(...) // return the right context return self; } } if you don't need to perform any operation in the constructor, you can simply omit it so that its native behavior (see following) will be preserved.
Comparison of CSS Selectors and XPath - XPath
xpath feature css equivalent ancestor, parent or preceding-sibling axis :has() selector attribute axis attribute selectors child axis child combinator descendant axis descendant combinator following-sibling axis general sibling combinator or adjacent sibling combinator self axis :scope or :host selector ...
current - XPath
or self syntax).
Introduction to using XPath in JavaScript - XPath
since we wish to search over the entire document for the headings, we have used the document object itself as the contextnode.
Index - XSLT: Extensible Stylesheet Language Transformations
WebXSLTIndex
the structure of an xml document is designed to reflect and clarify important relationships among the individual aspects of the content itself, unhindered by a need to provide any indication about how this data should eventually be presented.
An Overview - XSLT: Extensible Stylesheet Language Transformations
the simplest way to indicate which xslt stylesheet should be used to process a particular xml document is to include a processing instruction in the xml document itself.
The Netscape XSLT/XPath Reference - XSLT: Extensible Stylesheet Language Transformations
(supported) xsl:preserve-space (supported) xsl:processing-instruction xsl:sort (supported) xsl:strip-space (supported) xsl:stylesheet (partially supported) xsl:template (supported) xsl:text (partially supported) xsl:transform (supported) xsl:value-of (partially supported) xsl:variable (supported) xsl:when (supported) xsl:with-param (supported) axes ancestor ancestor-or-self attribute child descendant descendant-or-self following following-sibling namespace (not supported) parent preceding preceding-sibling self functions boolean() (supported) ceiling() (supported) concat() (supported) contains() (supported) count() (supported) current() (supported) document() (supported) element-available() (supported) false() (supported) floor() ...
Web technology for developers
many of these samples can also be used in xulrunner applications, as well as in actual mozilla code itself.
WebAssembly Concepts - WebAssembly
by itself, webassembly cannot currently directly access the dom; it can only call javascript, passing in integer and floating point primitive data types.