Search completed in 2.12 seconds.
SavedFrame
savedframe a
savedframe instance is a singly linked list of stack frames.
...
savedframe stacks should generally be captured, allocated, and live within the compartment that is being observed or debugged.
...capturing
savedframe stacks from c++ use js::capturecurrentstack declared in jsapi.h.
...And 5 more matches
NPSavedData - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary block of instance information
saved after the plug-in instance is deleted; can be returned to the plug-in to restore the data in future instances of the plug-in.
... syntax typedef struct _np
saveddata { int32 len; void* buf; } np
saveddata; fields the data structure has the following fields: len length in bytes of the buffer pointed to by buf; set by the plug-in.
... description the np
saveddata object contains a block of per-instance information that the browser
saves after the instance is deleted.
...And 3 more matches
JS_SaveFrameChain
saves and restores frame chains.
... syntax bool js_
saveframechain(jscontext *cx); void js_restoreframechain(jscontext *cx); name type description cx jscontext * the context to query.
...after a call to js_
saveframechain, it looks as if there is no code running on cx.
...And 3 more matches
Helper Apps (and a bit of Save As) - Archive of obsolete content
knows how to
save the data to disk at a given location if the user decides to do so.
... decides on a suggested filename for the data in case it will be
saved.
... nsexternalapphandler::onstoprequest set a flag that we're done, then do whatever the user wants if the user has decided (
save to disk and open in helper are the current options the user has).
...And 2 more matches
Open and Save Dialogs - Archive of obsolete content
« previousnext » a common type of dialog is one where the user can select a file to open or
save.
...it is most commonly used for the open and
save menu commands, but you can use it any place in which the user needs to select a file.
...
save - the user is asked to select the name to
save a file to.
...And 2 more matches
JS::AutoSaveExceptionState
this article covers features introduced in spidermonkey 31
save and later restore the current exception state of a given jscontext.
... syntax js::auto
saveexceptionstate(jscontext *cx); name type description cx jscontext * pointer to a js context from which to derive runtime information.
... description js::auto
saveexceptionstate
saves and later restores the current exception state of a given jscontext.
...And 2 more matches
JS_SaveExceptionState
saves the exception state from the specified context.
... syntax jsexceptionstate * js_
saveexceptionstate(jscontext *cx); name type description cx jscontext * pointer to a js context from which to derive runtime information.
... description
saves the current exception state (that is, any pending exception, or a cleared exception state) associated with the specified context cx, and returns a jsexceptionstate object holding this state.
...see also mxr id search for js_
saveexceptionstate jsexceptionstate js_restoreexceptionstate js_dropexceptionstate ...
CanvasRenderingContext2D.save() - Web APIs
the canvasrenderingcontext2d.
save() method of the canvas 2d api
saves the entire state of the canvas by pushing the current state onto a stack.
... the drawing state the drawing state that gets
saved onto a stack consists of: the current transformation matrix.
... syntax void ctx.
save(); examples saving the drawing state this example uses the
save() method to
save the default state and restore() to restore it later, so that you are able to draw a rect with the default state later.
... html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); //
save the default state ctx.
save(); ctx.fillstyle = 'green'; ctx.fillrect(10, 10, 100, 100); // restore the default state ctx.restore(); ctx.fillrect(150, 40, 100, 100); result specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d.
save' in that specification.
Save-Data - HTTP
the
save-data header field is a boolean which, in requests, indicates the client's preference for reduced data usage.
... syntax
save-data: <sd-token> directives <sd-token> a numerical value indicating whether the client wants to opt in to reduced data usage mode.
... examples the vary header ensures that the content is cached properly (for instance ensuring that the user is not served a lower-quality image from the cache when
save-data header is no longer present [e.g.
... with
save-data: on request: get /image.jpg http/1.0 host: example.com
save-data: on response: http/1.0 200 ok content-length: 102832 vary: accept-encoding,
save-data cache-control: public, max-age=31536000 content-type: image/jpeg [...] without
save-data request: get /image.jpg http/1.0 host: example.com response: http/1.0 200 ok content-length: 481770 vary: accept-encoding,
save-data cache-control: public, max-age=31536000 content-type: image/jpeg [...] specifications specification title draft-grigorik-http-client-hints-03, section 7:
save-data http client hints ...
msSaveBlob - Web APIs
the navigator.ms
saveblob() method
saves the file or blob to disk.
... this method behaves in the same way as navigator.ms
saveoropenblob() except that this disables the file open option.
... syntax navigator.ms
saveblob(blob, defaultname); parameters blob a blob to be
saved.
msSaveOrOpenBlob - Web APIs
the navigator.ms
saveoropenblob() method
saves the file or blob to disk.
... this method behaves in the same way as navigator.ms
saveblob() except that this enables the file open option.
... syntax navigator.ms
saveoropenblob(blob, defaultname); parameters blob a blob to be
saved.
NetworkInformation.saveData - Web APIs
the networkinformation.
savedata read-only property of the networkinformation interface returns true if the user has set a reduced data usage option on the user agent.
... syntax var
savedata = networkinformation.
savedata; value a boolean.
... specifications specification
save data api ...
browser.altClickSave
the preference browser.altclick
save controls whether clicking a link while holding the alt key starts the download of that link.
browser.download.lastDir.savePerSite
browser.download.lastdir.
savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base.
places/bookmarks - Archive of obsolete content
usage this module exports: three constructors: bookmark, group, and separator, corresponding to the types of objects, referred to as bookmark items, in the bookmarks database in firefox two additional functions,
save() to create, update, and remove bookmark items, and search() to retrieve the bookmark items that match a particular set of criteria.
...
save() and search() are both asynchronous functions: they synchronously return a placesemitter object, which then asynchronously emits events as the operation progresses and completes.
... examples creating a new bookmark let { bookmark,
save } = require("sdk/places/bookmarks"); // create a new bookmark instance, un
saved let bookmark = bookmark({ title: "mozilla", url: "http://mozilla.org" }); // attempt to
save the bookmark instance to the bookmarks database // and store the emitter let emitter =
save(bookmark); // listen for events emitter.on("data", function (
saved, inputitem) { // on a "data" event, an item has been updated, passing in the // latest snapshot from the server as `
saved` (with properties // such as `updat...
...And 39 more matches
nsIMessenger
ean canundo(); boolean canredo(); unsigned long getundotransactiontype(); unsigned long getredotransactiontype(); void undo(in nsimsgwindow msgwindow); void redo(in nsimsgwindow msgwindow); void sendunsentmessages(in nsimsgidentity aidentity, in nsimsgwindow amsgwindow); void setdocumentcharset(in acstring characterset); void
saveas(in acstring auri, in boolean aasfile, in nsimsgidentity aidentity, in astring amsgfilename); void openattachment(in acstring contenttpe, in acstring url, in acstring displayname, in acstring messageuri, in boolean isexternalattachment); void
saveattachment(in acstring contenttpe, in acstring url, in acstring displayname, in acstring messageuri, in boolean isexternalattachment)...
...; void
saveallattachments(in unsigned long count, [array, size_is(count)] in string contenttypearray, [array, size_is(count)] in string urlarray, [array, size_is(count)] in string displaynamearray, [array, size_is(count)] in string messageuriarray); void
saveattachmenttofile(in nsifile afile, in acstring aurl, in acstring amessageuri, in acstring acontenttype, in nsiurllistener alistener); void detachattachment(in string contenttpe, in string url, in string displayname, in string messageuri, in boolean
savefirst, [optional] in boolean withoutwarning); void detachallattachments(in unsigned long count, [array, size_is(count)] in string contenttypearray, [array, size_is(count)] in string urlarray, [array, size_is(count)] in string displaynamearray, [array, size...
..._is(count)] in string messageuriarray, in boolean
savefirst, [optional] in boolean withoutwarning); nsilocalfile
saveattachmenttofolder(in acstring contenttype, in acstring url, in acstring displayname, in acstring messageuri, in nsilocalfile adestfolder); nsimsgmessageservice messageservicefromuri(in acstring auri); nsimsgdbhdr msghdrfromuri(in acstring auri); acstring getmsguriatnavigatepos(in long apos); acstring getfolderuriatnavigatepos(in long apos); void getnavigatehistory(out unsigned long acurpos, out unsigned long acount, [array, size_is(acount)] out string ahistory); note: prior to gecko 8.0, all references to nsidomwindow used in this interface were nsidomwindow.
...And 22 more matches
nsIWebBrowserPersist
to create an instance, use: var webbrowserpersist = components.classes["@mozilla.org/embedding/browser/nswebbrowserpersist;1"] .createinstance(components.interfaces.nsiwebbrowserpersist); method overview void cancel
save(); void
savechannel(in nsichannel achannel, in nsisupports afile); void
savedocument(in nsidomdocument adocument, in nsisupports afile, in nsisupports adatapath, in string aoutputcontenttype, in unsigned long aencodingflags, in unsigned long awrapcolumn); void
saveuri(in nsiuri auri, in nsisupports acachekey, in nsiuri areferrer, in long areferrerpolicy, in nsiinputstr...
...eam apostdata, in string aextraheaders, in nsisupports afile, in nsiloadcontext aprivacycontext); void
saveprivacyawareuri(in nsiuri auri, in nsisupports acachekey, in nsiuri areferrer, in long areferrerpolicy, in nsiinputstream apostdata, in string aextraheaders, in nsisupports afile, in boolean aisprivate); attributes attribute type description currentstate unsigned long current state of the persister object.
... persistflags unsigned long flags governing how data is fetched and
saved from the network.
...And 19 more matches
Index - Archive of obsolete content
181 downloading files code snippets to download a file, create an instance of nsiwebbrowserpersist and call its nsiwebbrowserpersist.
saveuri() method, passing it a url to download and an nsifile instance representing the local file name/path.
...these are the sort of things that super-review should be catching for code that goes into the tree; avoiding these to start with
saves super-reviewers a lot of effort.
... 297 session store api add-ons, extensions, firefox, guide, obsolete session store makes it possible for extensions to easily
save and restore data across firefox sessions.
...And 15 more matches
Initialization and Destruction - Plugins
nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, int16 argc, char *argn[], char *argv[], np
saveddata *
saved); the plugintype parameter represents the mime type of this instance of the plug-in.
...for example, the following embed element has the standard attributes src, height, and width and the private attribute loop: <embed src="movie.avi" height="100" width="100" loop="true"> with the embed element in the example, the browser passes the values in argv to the plug-in instance: argc = 4 argn = { "src", "height", "width", "loop" } argv = { "movie.avi", "100", "100", "true" } the
saved parameter allows an instance of a plug-in to
save its data and, when the instance is destroyed, pass the data to the next instance of the plug-in at the same url.
... the data is
saved in the history list.
...And 13 more matches
Transformations - Web APIs
save()
saves the entire state of the canvas.
... restore() restores the most recently
saved canvas state.
...every time the
save() method is called, the current drawing state is pushed onto the stack.
...And 13 more matches
Index - Web APIs
this can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to
save changes before the battery runs out in order to prevent data loss.
... 592 canvasrenderingcontext2d.restore() api, canvas, canvasrenderingcontext2d, method, reference the canvasrenderingcontext2d.restore() method of the canvas 2d api restores the most recently
saved canvas state by popping the top entry in the drawing state stack.
... if there is no
saved state, this method does nothing.
...And 12 more matches
Persistent Data - Archive of obsolete content
« previousnext » this section describes how to
save the state of a xul window.
... remembering state when building a large application, you will typically want to be able to
save some of the state of a window across sessions.
...one possibility would be to write a script to collect information about what you would like to
save and then
save it to a file.
...And 11 more matches
nsIAuthPrompt
to create an instance, use: var authprompt = components.classes["@mozilla.org/login-manager/prompter;1"] .createinstance(components.interfaces.nsiauthprompt); method overview boolean prompt(in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32
savepassword, in wstring defaulttext, out wstring result); boolean promptpassword(in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32
savepassword, inout wstring pwd); boolean promptusernameandpassword(in wstring dialogtitle, in wstring text, in wstring passwordrealm, in pruint32
savepassword, inout wstring user, inout wstring pwd); constants ...
... constant value description
save_password_never 0 never
saves the password.
...
save_password_for_session 1
saves the password for the session.
...And 11 more matches
Introduction to automated testing - Learn web development
for example, this could be every time you
save a file, or at some other point.
... first, install gulp globally (meaning, it will be available across all projects) using the following command: npm install --global gulp-cli next, run the following command inside your npm project directory root to set up gulp as a dependency of your project: npm install --
save-dev gulp now create a new file inside your project directory called gulpfile.js.
... html-tidy install using the following line: npm install --
save-dev gulp-htmltidy note: --
save-dev adds the package as a dependency to your project.
...And 9 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
this will allow the user to
save and restore session snapshots (browser window states) at any time.
...under the tool menu, the session store submenu contains two items—
save session and clear sessions; in between them is a list of previously
saved sessions that you can restore, most recent first.
...content for overlay.xul <?xml version="1.0"?> <overlay id="sessionstoreoverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://sessionstore/content/overlay.js" /> <menupopup id="menu_toolspopup"> <menu label="session store" insertbefore="sanitizeseparator"> <menupopup> <menuitem label="
save session" /> <menuseparator /> <!-- dynamically generated menu items go here --> <menuseparator /> <menuitem label="clear sessions" /> </menupopup> </menu> </menupopup> </overlay> test install perform a test install using pointer files as you did in the previous section.
...And 8 more matches
Componentizing our Svelte app - Learn web development
when the todo is in editing mode, the user can
save or cancel the changes.
... add the following set of functions below your previous function to handle these actions: function oncancel() { name = todo.name // restores name to its initial value and editing = false // and exit editing mode } function on
save() { update({ name: name }) // updates todo name editing = false // and exit editing mode } function onremove() { dispatch('remove', todo) // emit remove event } function onedit() { editing = true // enter editing mode } function ontoggle() { update({ completed: !todo.completed}) // updates todo status } upda...
...when it's true, it should display the <input> field for editing the todo name, and the cancel and
save buttons.
...And 8 more matches
Address Book examples
editing contacts once you have obtained a card from an nsiabdirectory (see above), you can edit it in a two step process, firstly, change the properties that you to edit: card.setproperty("firstname", "jane"); card.setproperty("lastname", "doe"); secondly, call modifycard to
save the card in the database.
...createinstance(components.interfaces.nsiabdirectory); maillist.ismaillist = true; now fill in the details you want to store: maillist.dirname = "my mailing list"; maillist.listnickname = "nickname for list"; maillist.description = "list description"; add the cards you want to include in the list: for (let i = 0; i < numcards; i++) maillist.addresslists.appendelement(card[i], false); now
save the list: var parentdirectory = ...; // an nsiabdirectory for the parent of the mailing list.
...ent mailing list object that implements nsiabdirectory: let abmanager = components.classes["@mozilla.org/abmanager;1"] .getservice(components.interfaces.nsiabmanager); let maillistdirectory = abmanager.getdirectory(maillistcard.maillisturi); you can then adjust the items in the actual mailing list: maillistdirectory.addresslists.appendelement(newcard, false); then
save the updated list to the database: maillistdirectory.editmaillisttodatabase(maillistcard); deleting a mailing list there are two ways to delete a mailing list.
...And 8 more matches
Session store API - Archive of obsolete content
session store makes it possible for extensions to easily
save and restore data across firefox sessions.
...in order to properly restore your extension's state when a tab is restored, it needs to use the session store api's settabvalue() method to
save any data it will need in order to restore its state, and then call gettabvalue() to retrieve the previous setting when the tab is restored.
... firefox 3.6 knows how to
save session store data when the last browser window closes, even if there are still other windows open.
...And 7 more matches
Drawing graphics - Learn web development
if you
save and load your example in a browser now, you'll see nothing, which is fine, but you'll also see scrollbars — this is a problem for us, which happens because the <body> element has a margin that, added to our full-window-size canvas, results in a document that's wider than the window.
... next, add the following lines to the bottom of your javascript: ctx.fillstyle = 'rgb(255, 0, 0)'; ctx.fillrect(50, 50, 100, 150); if you
save and refresh, you should see a red rectangle has appeared on your canvas.
...add the following at the bottom of your javascript: ctx.fillstyle = 'rgb(0, 255, 0)'; ctx.fillrect(75, 75, 100, 100);
save and refresh, and you'll see your new rectangle.
...And 7 more matches
Introducing a complete toolchain - Learn web development
prettier understands this to mean "if there's problems in my code format, go ahead and fix them, then
save my file".
... using code editor plugins to run prettier commands each time a file is
saved.
...all the editor needs is "format on
save" enabled.
...And 7 more matches
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
ns_cert_vfy_trailer "-----end certificate for signature verification-----" #define ns_sig_header "-----begin signature-----" #define ns_sig_trailer "-----end signature-----" #define ns_cert_header "-----begin certificate-----" #define ns_cert_trailer "-----end certificate-----" /* sample 6 commands */ typedef enum { generate_csr, add_cert_to_db,
save_cert_to_header, encrypt, decrypt, sign, verify, unknown } commandtype; typedef enum { symkey = 0, mackey = 1, iv = 2, mac = 3, pad = 4, pubkey = 5, lab = 6, certenc= 7, certvfy= 8, sig = 9 } headertype; /* * print usage message and exit */ static void usage(const char *progname) { fprintf(stderr, "\...
...rintf(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, ...
... %s \n\n", progname, " -a -d <dbdirpath> -n <nickname> -t <trust> -c <cert> \n"); fprintf(stderr, " or\n"); fprintf(stderr, "\nusage: %s %s \n\n", progname, "-a -d <dbdirpath> -n <nickname> -t <trust> -c <cert> -r <csr> -u <issuernickname> -m <serialnumber> [-x <\"\">] \n"); exit(-1); } } /* * validate the options used for
save cert to header command */ static void validate
savecerttoheadercommand(const char *progname, const char *dbdir, const char *nicknamestr, const char *headerfilename) { prbool validationfailed = pr_false; if (!nicknamestr) { pr_fprintf(pr_stderr, "%s -s -d %s -n : nick name is m...
...And 7 more matches
sample2
*/ #ifndef port_errortostring #define port_errortostring(err) pr_errortostring((err), pr_language_i_default) #endif /* sample 6 commands */ typedef enum { generate_csr, add_cert_to_db,
save_cert_to_header, encrypt, decrypt, sign, verify, unknown } commandtype; typedef enum { symkey = 0, mackey = 1, iv = 2, mac = 3, pad = 4, pubkey = 5, lab = 6, certenc= 7, certvfy= 8, sig = 9 } headertype; /* * print usage message and exit */ static void usage(const char *progname) { fprintf(stderr, "\nusage: %s %s %s %s %s %s %s %s %s %s\n\n", progname, " -<g|a|h|e|ds|v> -d <dbdirpath> ", "[-p <dbp...
...e>"); 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, const char *certreqfilename) { prbool validationfailed = pr_false; if (!subject) { pr_fprintf(pr_stderr, "%s -g -d %s -s: improperly f...
...nfailed = pr_true; } } if (validationfailed) { fprintf(stderr, "\nusage: %s %s \n\n", progname, " -a -d <dbdirpath> -n <nickname> -t <trust> -c <cert> \n"); fprintf(stderr, " or\n"); fprintf(stderr, "\nusage: %s %s \n\n", progname, "-a -d <dbdirpath> -n <nickname> -t <trust> -c <cert> -r <csr> -u <issuernickname> -m <serialnumber> [-x <\"\">] \n"); exit(-1); } } /* * validate the options used for
save cert to header command */ static void validate
savecerttoheadercommand(const char *progname, const char *dbdir, const char *nicknamestr, const char *headerfilename) { prbool validationfailed = pr_false; if (!nicknamestr) { pr_fprintf(pr_stderr, "%s -s -d %s -n : nick name is missing\n", progname, dbdir); validationfailed = pr_true; } if (!headerfilename) { pr_fprintf(pr_stderr, "%s -s -d %s -n %s ...
...And 7 more matches
Index
24 js::auto
saveexceptionstate jsapi reference, reference, référence(2), spidermonkey js::auto
saveexceptionstate
saves and later restores the current exception state of a given jscontext.
... 99 jsexceptionstate jsapi reference, spidermonkey a jsexceptionstate object is returned by the js_
saveexceptionstate function, and is passed to functions js_restoreexceptionstate and js_dropexceptionstate.
...it
saves you from having to write separate tests and elaborate if...else statements in your function code to retrieve and translate multiple js values for use with your own functions.
...And 7 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
for example, there is the mozilla amazon browser, which helps with shopping at amazon, and the presentation method in xul, a tool for writing and displaying presentations to try out the code samples in this chapter,
save them as text files with .xul extensions and drag and drop them into the firefox browser window.
...enter the names of the other attributes whose values you want to store as a space-delimited ascii string into the value for persist; the next time that xul document is opened, the
saved values will automatically be restored4.
... the settings system, which we will explore in chapter 4, makes it possible to
save simple states without any complex scripts.
...And 6 more matches
Application Translation with Mercurial
save the file and close it.
... after scrapbook has
saved the web page to your local disk, click with the right mouse button on the page in the sidebar and choose "properties" from the context menu which gets opened.
... after you
saved the dialog, click with the left mouse button on the page in the sidebar to open the locally
saved copy.
...And 6 more matches
Shell global objects
savebytecode if true, and if the source is a cacheentryobject, the bytecode would be encoded and
saved into the cache entry after the script execution.
... asserteqbytecode if true, and if both loadbytecode and
savebytecode are true, then the loaded bytecode and the encoded bytecode are compared.
...the cache entry is filled and read by the evaluate function by using it in place of the source, and by setting
savebytecode and loadbytecode options.
...And 6 more matches
nsIFaviconService
an async request will be created for this uri and if the data is available, it will asynchronously get
saved in the database without any further work from the caller.
...setfaviconurlforpage() and setfavicondata() will take any url you provide and
save it.
... this function is intended for automatic usage, and will only
save favicons for "good" urls, as defined by what gets added to history.
...And 6 more matches
Mail composition back end
you also have the ability to
save rfc822 files to disk, should you need this data for some reason.
... createandsendmessage the createandsendmessage method will create an rfc822 message and send it all in one operation as well as providing the ability to
save disk files for later use.
...these can include nsmsgdelivernow, nsmsgqueueforlater, nsmsg
save, nsmsg
saveas, nsmsg
saveasdraft, nsmsg
saveastemplate.
...And 6 more matches
Promises - Archive of obsolete content
yield promise.all([download_1, download_2.start()]); // do something with the
saved files.
...after any changes are made to this property, the
save() method must be called to queue the changes to be written to disk.
... unless the flush() method is called, no writes will happen until a full second has elapsed between
save() calls.
...And 5 more matches
NPP_Destroy - Archive of obsolete content
syntax #include <npapi.h> nperror npp_destroy(npp instance, np
saveddata **
save); parameters the function has the following parameters: instance pointer to the plug-in instance to delete.
... **
save state or other information to
save for reuse by a new instance of this plug-in at the same url.
... use the optional
save parameter if you want to
save and reuse some state or other information.
...And 5 more matches
HTML text fundamentals - Learn web development
you should
save a copy of this file on your local machine, as you'll need it for the exercises later on.
...aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; why do we need se...
...aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; ordered ordered ...
...And 5 more matches
What’s in the head? Metadata in HTML - Learn web development
to do this, either copy and paste the code out of the page and into a new text file in your code editor, then
save it in a sensible place.
...next, choose your browser's file >
save page as...
... menu and choose a sensible place to
save the file.
...And 5 more matches
Getting started with React - Learn web development
this file contains our first component, app, and a few other lines of code: import react from 'react'; import logo from './logo.svg'; import './app.css'; function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo" alt="logo" /> <p> edit <code>src/app.js</code> and
save to reload.
... function app() { return ( <div classname="app"> <header classname="app-header"> <img src={logo} classname="app-logo" alt="logo" /> <p> edit <code>src/app.js</code> and
save to reload.
... take a moment to change the <p> tag on line 6 so that it reads "hello, world!", then
save your file.
...And 5 more matches
Dialogs in XULRunner - Archive of obsolete content
file open and
save dialogs are good examples of these.
... xul dialog: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <dialog id="mydialog" title="my dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizetocontent();" buttons="accept,cancel" buttonlabelaccept="set favorite" buttonaccesskeyaccept="s" ondialogaccept="return do
save();" buttonlabelcancel="cancel" buttonaccesskeycancel="n" ondialogcancel="return docancel();"> <script> function do
save(){ //dosomething() return true; } function docancel(){ return true; } </script> <dialogheader title="my dialog" description="example dialog"/> <groupbox flex="1"> <caption label="select favorite fruit"/> <...
...not too sure if i’ll use the <dialogheader>, but if i did, the single element would be a big time
saver over building the header from scratch.
...And 4 more matches
Windows and menus in XULRunner - Archive of obsolete content
tle="&title;" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script src="main.js"/> <toolbox> <menubar id="menubar"> <menu id="file-menu" label="&file;"> <menupopup id="file-popup"> <menuitem label="&file.new;" oncommand="dofilenew();"/> <menuitem label="&file.open;" oncommand="dofileopen();"/> <menuitem label="&file.
save;" oncommand="dofile
save();"/> <menuseparator/> <menuitem label="&file.exit;" oncommand="dofileexit();"/> </menupopup> </menu> <menu id="edit-menu" label="&edit;"> <menupopup id="edit-popup"> <menuitem label="&edit.undo;" oncommand="doeditundo();"/> <menuitem label="&edit.redo;" oncommand="doeditredo();"/> </menupopup> ...
... </menu> </menubar> <toolbar id="main-toolbar"> <toolbarbutton id="open" label="&file.open;" oncommand="dofileopen();"/> <toolbarbutton id="
save" label="&file.
save;" oncommand="dofile
save();"/> </toolbar> </toolbox> ...
...xul has a way to centralize commands and event handlers for menus and toolbars that do the same thing, like open and
save in the above example.
...And 4 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
never fear — this article aims to
save you from tearing your hair out over such problems by providing you with some tips on how to find and fix errors in javascript programs.
...here's a shortcut to
save you some time in this instance: addeventlistener().
... syntax errors round two
save your page and refresh, and you should see the error has gone.
...And 4 more matches
Working with Svelte stores - Learn web development
we could implement some code in our app.svelte component to read and
save our todos to web storage or to a web service.
... saving our todos so let's start by using a regular writable store to
save our todos.
... so, to implement a custom store that
saves its content to web storage, we will need a writable store that: initially reads the value from web storage, and if it's not present initializes it with a default value.
...And 4 more matches
CustomizableUI.jsm
if your toolbar does not have a defaultset attribute, the node will be
saved for processing when you call registerarea.
... furthermore, by default the placements of the area will be kept in the
saved state (!) and restored if you re-register the area at a later point.
... you can override this last behavior (and destroy the placements information in the
saved state) by passing true for adestroyplacements.
...And 4 more matches
Index
174 hashing - sample 1 html, hashing sample, javascript, nss, web development, hashing the nss same code below computes the hash of a file and
saves it to another file, this illustrates the use of nss message apis.
... this program shows the following: 177 nss sample code sample_1_hashing examples, nss, security this is an example program that demonstrates how to compute the hash of a file and
save it to another file.
...a program to compute the hash of a file and
save it to another file.
...And 4 more matches
Streams - Plugins
stream data can be pushed by the browser, pulled by the plug-in, or
saved to a local file and passed to the plug-in.
... file mode: the browser
saves the entire stream to a local file and passes the file path to the plug-in instance through the npp_streamasfile method.
...the browser
saves stream data to a local file, and, when the stream is complete, delivers the path of the file through a call to npp_streamasfile.
...And 4 more matches
Key Values - Web APIs
captures the screen and prints it or
saves it to disk.
...this
saves the state of the computer to disk and then shuts down; the computer can be returned to its previous state by restoring the
saved state information.
... vk_next_favorite_channel "nextuserprofile" cycles to the next
saved user profile, if this feature is supported and multiple profiles exist.
...And 4 more matches
MenuButtons - Archive of obsolete content
<toolbarbutton type="menu-button" label="
save" oncommand="alert('
save');"> <menupopup> <menuitem label="
save this document"/> <menuitem label="
save all" oncommand="alert('
save all'); event.stoppropagation();"/> </menupopup> </toolbarbutton> here, the '
save' button has a type of 'menu-button', so a small arrow button will appear which will open the menu when pressed.
... pressing the label part of the button will invoke the command event on the button, so the '
save' alert will appear.
...when the first item on the menu ('
save this document') is activated, it will also display the '
save' alert as the command event bubbles up to the button.
...And 3 more matches
NPP_New - Archive of obsolete content
syntax #include <npapi.h> nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, int16 argc, char *argn[], char *argv[], np
saveddata *
saved); parameters the function has the following parameters: plugintype pointer to the mime type for new plug-in instance.
...
saved pointer to data
saved by npp_destroy for a previous instance of this plug-in at the same url.
... if non-null, the browser passes ownership of the np
saveddata object back to the plug-in.
...And 3 more matches
NPP_NewStream - Archive of obsolete content
np_asfileonly:
saves stream data to a file in the local cache.
...like np_asfileonly except that data is delivered to the plug-in as it is
saved to the file (as in mode np_normal).
... np_asfileonly: the browser
saves stream data to a file in the local cache.
...And 3 more matches
Client-side storage - Learn web development
this lets you persist data for long-term storage,
save sites or documents for offline use, retain user-specific settings for your site, and more.
... the storage.setitem() method allows you to
save a data item in storage — it takes two parameters: the name of the item, and its value.
...all that remains now is to
save your code and test your html page in a browser.
...And 3 more matches
A brief guide to Mozilla preferences
the values are
saved to the user profile (in prefs.js), for both firefox and thunderbird.
... preferences saving usually when the user specifically commits a preference change via user interface such as the preferences dialog, the application
saves the change by overwriting prefs.js .
... on application exit, all user-set preferences are
saved to prefs.js .
...And 3 more matches
nsIEditorSpellCheck
wstring getpersonaldictionaryword(); wstring getsuggestedword(); void ignorewordalloccurrences(in wstring word); void initspellchecker(in nsieditor editor, in boolean enableselectionchecking); void removewordfromdictionary(in wstring word); void replaceword(in wstring misspelledword, in wstring replaceword, in boolean alloccurrences); void
savedefaultdictionary(); obsolete since gecko 9.0 void setcurrentdictionary(in astring dictionary); void setfilter(in nsitextservicesfilter filter); void uninitspellchecker(); void updatecurrentdictionary(); methods addwordtodictionary() adds the specified word to the current personal dictionary.
...
savedefaultdictionary() obsolete since gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6)this feature is obsolete.
...
saves the currently selected dictionary as the default.
...And 3 more matches
nsIHttpServer
*/ readonly attribute nsihttpserveridentity identity; /** * retrieves the string associated with the given key in this, for the given * path's
saved state.
... */ astring getstate(in astring path, in astring key); /** * sets the string associated with the given key in this, for the given path's *
saved state.
... */ void setstate(in astring path, in astring key, in astring value); /** * retrieves the string associated with the given key in this, in * entire-server
saved state.
...And 3 more matches
nsIPromptService
it typically has the label "ok", "yes", or "
save".
...for instance, it might have the label "don't
save".
... button_title_cancel 2 button_title_yes 3 button_title_no 4 button_title_
save 5 button_title_dont_
save 6 button_title_revert 7 button_title_is_string 127 this flag indicates that the label is passed as a separate string.
...And 3 more matches
nsISHEntry
refreshurilist nsisupportsarray
saved refresh uri list for the content viewer.
...
savelayoutstateflag boolean indicate whether layouthistorystate should be
saved.
...(prior to gecko 6.0 returned a json encoded string.) sticky boolean whether the content viewer is marked "sticky" windowstate nsisupports
saved state of the global window object.
...And 3 more matches
nsIZipWriter
zip'); //this file will be creatd in c drive var pr = {pr_rdonly: 0x01, pr_wronly: 0x02, pr_rdwr: 0x04, pr_create_file: 0x08, pr_append: 0x10, pr_truncate: 0x20, pr_sync: 0x40, pr_excl: 0x80}; zw.open(xpi, pr.pr_wronly | pr.pr_create_file | pr.pr_truncate); //xpi file is created if not there, if it is there it is truncated/deleted var filetoaddtozip = fileutils.file('c:\\add this file.txt'); var
saveinzipas = 'blah.txt'; zw.addentryfile(
saveinzipas, ci.nsizipwriter.compression_none, filetoaddtozip, false); in the above example, the file ("add this file.txt") located at "c:\add this file.txt" will be added to the zip file "c:\myzipfile.zip", however in the zip file this file ("add this file.txt") will be named "blah.txt".
... if
saveinzipas was equal to "add this file.txt" then in the zip file it will also be named "add this file.txt" further detail: this example gives futher detail on the importance of forward slashes var filetoaddtozip = fileutils.file('c:\\add this file.txt'); var
saveinzipas = 'sub folder/blah.txt'; //do not use backward slash for example do not do: 'sub folder\\blah.txt'.
...zw.addentryfile(
saveinzipas, ci.nsizipwriter.compression_none, filetoaddtozip, false); this example creates a folder in the zip called "sub folder" and then adds "c:\add this file.txt" to it, but it will be called "blah.txt".
...And 3 more matches
Drawing and Event Handling - Plugins
however, for the plug-in to draw at any other time, for example, to highlight on a mouse-down event or draw animation at idle time, it must
save the current setting of the port, set up its drawing environment as appropriate, draw, and then restore the port to the previous settings.
... in this case, the plug-in makes it unnecessary for the browser to
save and restore its port settings before and after every call into the plug-in.
...the instance must restrict its drawing to a specified area of the shared window, and it must always
save the current settings, set up the drawing environment, and restore the shared drawing environment to the previous settings.
...And 3 more matches
Basic animations - Web APIs
save the canvas state if you're changing any setting (such as styles, transformations, etc.) which affect the canvas state and you want to make sure the original state is used each time a frame is drawn, you need to
save that original state.
... restore the canvas state if you've
saved the state, restore it before drawing a new frame.
....png'; earth.src = 'https://mdn.mozillademos.org/files/1429/canvas_earth.png'; window.requestanimationframe(draw); } function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.globalcompositeoperation = 'destination-over'; ctx.clearrect(0, 0, 300, 300); // clear canvas ctx.fillstyle = 'rgba(0, 0, 0, 0.4)'; ctx.strokestyle = 'rgba(0, 153, 255, 0.4)'; ctx.
save(); ctx.translate(150, 150); // earth var time = new date(); ctx.rotate(((2 * math.pi) / 60) * time.getseconds() + ((2 * math.pi) / 60000) * time.getmilliseconds()); ctx.translate(105, 0); ctx.fillrect(0, -12, 40, 24); // shadow ctx.drawimage(earth, -12, -12); // moon ctx.
save(); ctx.rotate(((2 * math.pi) / 6) * time.getseconds() + ((2 * math.pi) / 6000) * time.getmillisecond...
...And 3 more matches
Using IndexedDB - Web APIs
the request here was generated with a call to indexeddb.open(), so request.result is an instance of idbdatabase, and you definitely want to
save that for later.
...in the handler for the upgradeneeded event, you should create the object stores needed for this version of the database: // this event is only implemented in recent browsers request.onupgradeneeded = function(event) { //
save the idbdatabase interface var db = event.target.result; // create an objectstore for this database var objectstore = db.createobjectstore("name", { keypath: "mykey" }); }; in this case, the database will already have the object stores from the previous version of the database, so you do not have to create these object stores again.
...if you need to
save that information, you should read it out and
save it somewhere else before upgrading the database.) trying to create an object store with a name that already exists (or trying to delete an object store with a name that does not already exist) will throw an error.
...And 3 more matches
Creating annotations - Archive of obsolete content
atchedelement).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.
... because this code uses jquery, you'll need to download that as well, and
save it in data.
...
save the file and execute cfx run again.
...And 2 more matches
Canvas code snippets - Archive of obsolete content
is.context = this.ctx = canvas.getcontext('2d'); if (!canvas2dcontext.prototype.arc) { canvas2dcontext.setup.call(this, this.ctx); } } canvas2dcontext.setup = function() { var methods = ['arc', 'arcto', 'beginpath', 'beziercurveto', 'clearrect', 'clip', 'closepath', 'drawimage', 'fill', 'fillrect', 'filltext', 'lineto', 'moveto', 'quadraticcurveto', 'rect', 'restore', 'rotate', '
save', 'scale', 'settransform', 'stroke', 'strokerect', 'stroketext', 'transform', 'translate']; var gettermethods = ['createpattern', 'drawfocusring', 'ispointinpath', 'measuretext', // drawfocusring not currently supported // the following might instead be wrapped to be able to chain their child objects 'createimagedata', 'createlineargradient', 'createradialgradient', 'getimageda...
...the canvas is converted to a png file and
saved to the specified location.
... the function returns a promise which resolves when the file has been completely
saved.
...And 2 more matches
Downloading Files - Archive of obsolete content
downloading files to download a file, create an instance of nsiwebbrowserpersist and call its nsiwebbrowserpersist.
saveuri() method, passing it a url to download and an nsifile instance representing the local file name/path.
...var privacy = privatebrowsingutils.privacycontextfromwindow(urlsourcewindow); persist.persistflags = persist.persist_flags_from_cache | persist.persist_flags_replace_existing_files; persist.
saveuri(urito
save, null, null, null, "", targetfile, privacy); if you don't need detailed progress information, you might be happier with nsidownloader.
...resslistener = { 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 files that require credentials before calling nsiwebbrowserpersist.
saveuri(), you need to set the progresslistener property of the nsiwebbrowserpersist instance to an object that implements nsiauthprompt.
...And 2 more matches
Search Extension Tutorial (Draft) - Archive of obsolete content
var defaultprefs = services.prefs.getdefaultbranch(""); //
save the original values.
... var
savedprefs = {} // change the default value of the preference *name* to *value*.
... if (localized) value = "data:text/plain," + encodeuricomponent(name + "=" + value.replace(/ /g, "\\u0020")); //
save the original and new values.
...And 2 more matches
Localization - Archive of obsolete content
that is, you should
save them in utf-8 format (without bom).
...y;"/> <key id="close_cmd" keycode="vk_escape" oncommand="window.close();"/> </keyset> <vbox flex="1"> <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="&filemenu.label;" accesskey="&filemenu.accesskey;"> <menupopup id="file-popup"> <menuitem label="&opencmd.label;" accesskey="&opencmd.accesskey;"/> <menuitem label="&
savecmd.label;" accesskey="&
savecmd.accesskey;"/> <menuseparator/> <menuitem label="&closecmd.label;" accesskey="&closecmd.accesskey;" key="close_cmd" oncommand="window.close();"/> </menupopup> </menu> <menu id="edit-menu" label="&editmenu.label;" accesskey="&editmenu.accesskey;"> <menupopup id="edit-popup"> <men...
...<menuitem label="©cmd.label;" accesskey="©cmd.accesskey;" key="copy_cmd"/> <menuitem label="&pastecmd.label;" accesskey="&pastecmd.accesskey;" key="paste_cmd" disabled="true"/> </menupopup> </menu> </menubar> <toolbar id="findfiles-toolbar"> <toolbarbutton id="opensearch" label="&opencmdtoolbar.label;"/> <toolbarbutton id="
savesearch" label="&
savecmdtoolbar.label;"/> </toolbar> </toolbox> <tabbox> <tabs> <tab label="&searchtab;" selected="true"/> <tab label="&optionstab;"/> </tabs> <tabpanels> <tabpanel id="searchpanel" orient="vertical" context="editpopup"> <description> &finddescription; </description> <spacer class="titlespace"/> <groupbox orient="horizontal"> <caption...
...And 2 more matches
Positioning - Learn web development
</p> now add the following rule to the bottom of your css: .positioned { position: static; background: yellow; } if you now
save and refresh, you'll see no difference at all, except for the updated background color of the 2nd paragraph.
...go ahead and update the position declaration in your code: position: relative; if you
save and refresh at this stage, you won't see a change in the result at all.
... if you now
save and refresh, you'll get a result something like this: <h1>relative positioning</h1> <p>i am a basic block level element.
...And 2 more matches
JavaScript basics - Learn web development
within the scripts folder, create a new file called main.js, and
save it.
... add this code to the main.js file: const myheading = document.queryselector('h1'); myheading.textcontent = 'hello world!'; make sure the html and javascript files are
saved.
...
save this image in your images folder.
...And 2 more matches
Getting started with Svelte - Learn web development
node_modules: this is where node
saves the project dependencies.
... at this point you can try updating your app.svelte component — for example change the <h1> element on line 6 of app.svelte so that it reads like this: <h1>hello {name} from mdn!</h1> just
save your changes and the app running at localhost:5000 will be automatically updated.
...it's an online tool that allows you to create complete apps,
save them online, and share with others.
...And 2 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
and if you click on cancel or
save, the focus disappears again.
... we'd also like to add some usability features, like disabling the
save button when required fields are empty, giving focus to certain html elements or auto-selecting contents when a text input receives focus.
... our onedit() function can now be much simpler: function onedit() { editing = true // enter editing mode } as a last example before we move on, let's go back to our todo.svelte component and give focus to the edit button after the user presses
save or cancel.
...And 2 more matches
Setting up your own test automation environment - Learn web development
paste the following into the bottom of your file (updating the path as it actually is on your machine): #add webdriver browser drivers to path export path=$path:/users/bob
save and close this file, then restart your terminal/command prompt to reapply your bash configuration.
... create a new file inside your project directory called google_test.js: give it the following contents, then
save it: const webdriver = require('selenium-webdriver'), by = webdriver.by, until = webdriver.until; const driver = new webdriver.builder() .forbrowser('firefox') .build(); driver.get('http://www.google.com'); driver.findelement(by.name('q')).sendkeys('webdriver'); driver.sleep(1000).then(function() { driver.findelement(by.name('q')).sendkeys(webdriver.key.tab); }); driver.fi...
... give it the following contents, then
save it: const webdriver = require('selenium-webdriver'), by = webdriver.by, until = webdriver.until; let driver_fx = new webdriver.builder() .forbrowser('firefox') .build(); let driver_chr = new webdriver.builder() .forbrowser('chrome') .build(); searchtest(driver_fx); searchtest(driver_chr); function searchtest(driver) { driver.get('http://www.google.com'); driver.f...
...And 2 more matches
Command line crash course - Learn web development
prettier can:
save the cognitive overhead of getting the style consistent manually across all your code files; prettier can do this for you automatically.
... be configured to run upon
save, as you type, or even before publishing your code (with additional tooling that we’ll see later on in the module).
... now
save the following code in a new file called index.js, inside your test directory: const myobj = { a:1,b:{c:2}} function printme(obj){console.log(obj.b.c)} printme(myobj) we can run prettier against a codebase to just check if our code wants adjusting.
...And 2 more matches
Embedding Tips
how do i
save a document or data to disk?
... query for the nsiwebbrowserpersist interface implemented on the web browser object and call the
saveuri() or
savedocument() methods on that.
... alternatively, create a standalone webbrowser persist object and call the nsiwebbrowserpersist interface on that to
save uris and documents.
...And 2 more matches
DeferredTask.jsm
a common use case occurs when a data structure should be
saved into a file every time the data changes, using asynchronous calls, and multiple changes to the data may happen within a short time: let
savedeferredtask = new deferredtask(function* () { yield os.file.writeatomic(...); // any uncaught exception will be reported.
...multiple attempts to arm the timer don't introduce further delays:
savedeferredtask.arm(); // the task will be executed in 2 seconds from now.
... yield waitonesecond();
savedeferredtask.arm(); // the task will be executed in 1 second from now.
...And 2 more matches
Download
whether partial data can actually be retained depends on the
saver and the download source, and may not be known before the download is started.
...this depends on the
saver and the download source.
...
saver read only download
saver
saver object associated with this download.
...And 2 more matches
source-editor.jsm
l] number aalign); void setselection(number astart, number aend); breakpoint management void addbreakpoint(number alineindex, [optional] string acondition); array getbreakpoints(); boolean removebreakpoint(number alineindex); properties attribute type description dirty boolean set this value to false whenever you
save the text; the editor will update it to true when the content is changed.
... you can then use this value to detect when the contents of the text are different from your most recent
save.
...the dirty state indicates whether or not there are un
saved changes to the text.
...And 2 more matches
DMD
for instance, on osx, you can run something like: dmd=1 /applications/firefox\ nightly.app/contents/macos/firefox you can tell it is working by going to about:memory and looking for "
save dmd output".
... if dmd has been properly enabled, the "
save" button won't be grayed out.
... visit about:memory and click the dmd button (depending on how old your build is, it might be labelled "
save" or "analyze reports" or "dmd").
...And 2 more matches
about:memory
about:memory is a special page within firefox that lets you view,
save, load, and diff detailed measurements of firefox's memory usage.
... if you are using a communication channel where files can be sent, such as bugzilla or email, click on the "measure and
save..." button.
... this will open a file dialog that lets you
save the memory reports to a file of your choosing.
...And 2 more matches
JS_RestoreExceptionState
restores the exception state from a jsexceptionstate object previously created using js_
saveexceptionstate.
... description this function permits to restore any previously
saved exception state which was
saved into a jsexceptionstate object created by the js_
saveexceptionstate function.
... if any exception was pending when js_
saveexceptionstate was called, the same exception will be set to pend for the current context.
...And 2 more matches
mozIAsyncFavicons
setandfetchfaviconforpage() declares that a given page uses a favicon with the given uri and attempts to fetch and
save the icon data by loading the favicon uri through a asynchronous network request.
...this function will only
save favicons for "good" uris, as defined by what gets added to history or is a bookmark.
...icons that fail to load will automatically be added to the failed favicon cache, and this function will not
save favicons for non-bookmarked uris when history is disabled.
...And 2 more matches
nsIMsgMessageService
d displaymessage(in string amessageuri, in nsisupports adisplayconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener, in string acharsetoverride, out nsiuri aurl); void openattachment(in string acontenttype, in string afilename, in string aurl, in string amessageuri, in nsisupports adisplayconsumer, in nsimsgwindow amsgwindow, in nsiurllistener aurllistener); void
savemessagetodisk(in string amessageuri, in nsifilespec afile, in boolean ageneratedummyenvelope, in nsiurllistener aurllistener, out nsiuri aurl, in boolean canonicallineending, in nsimsgwindow amsgwindow); void geturlforuri(in string amessageuri, out nsiuri aurl, in nsimsgwindow amsgwindow); void displaymessageforprinting(in string amessageuri, in nsisupports adisplayconsumer, in n...
...
savemessagetodisk() when you want to spool a message out to a file on disk.
... void
savemessagetodisk(in string amessageuri, in nsifilespec afile, in boolean ageneratedummyenvelope, in nsiurllistener aurllistener, out nsiuri aurl, in boolean canonicallineending, in nsimsgwindow amsgwindow); parameters amessageuri url representing the message to spool out to disk.
...And 2 more matches
nsISessionStore
if the previously
saved value was originally a complex data (ie a javascript object) it can then be deserialized using json.parse cf.
... if the previously
saved value was originally a complex data (ie a javascript object) it can then be deserialized using json.parse cf.
... persisttabattribute() sets the name of a tab attribute to be
saved and restored for all xul tabs.
...And 2 more matches
The JavaScript input interpreter - Firefox Developer Tools
you can open files when in multi-line mode, and
save the current contents of the editing pane to a file.
... to
save the contents of the editing pane, press ctrl+s (cmd+s on macos).
... a file dialog box opens so you can specify the location to
save to.
...And 2 more matches
CanvasRenderingContext2D.restore() - Web APIs
the canvasrenderingcontext2d.restore() method of the canvas 2d api restores the most recently
saved canvas state by popping the top entry in the drawing state stack.
... if there is no
saved state, this method does nothing.
... fore more information about the drawing state, see canvasrenderingcontext2d.
save().
...And 2 more matches
Allowing cross-origin use of images and canvas - HTML: Hypertext Markup Language
storing an image from a foreign origin in this example, we wish to permit images from a foreign origin to be retrieved and
saved to local storage.
... implementing the
save feature now that the server has been configured to allow retrieval of the images cross-origin, we can write the code that allows the user to
save them to local local storage, just as if they were being served from the same domain the code is running on.
...ge the code that handles the newly-downloaded image is found in the imagereceived() method: function imagereceived() { let canvas = document.createelement("canvas"); let context = canvas.getcontext("2d"); canvas.width = downloadedimg.width; canvas.height = downloadedimg.height; context.drawimage(downloadedimg, 0, 0); imagebox.appendchild(canvas); try { localstorage.setitem("
saved-image-example", canvas.todataurl("image/png")); } catch(err) { console.log("error: " + err); } } imagereceived() is called to handle the "load" event on the htmlimageelement that receives the downloaded image.
...And 2 more matches
Content-Disposition - HTTP
in a regular http response, the content-disposition response header is a header indicating if the content is expected to be displayed inline in the browser, that is, as a web page or as part of a web page, or as an attachment, that is downloaded and
saved locally.
...e header (for the main body) general header (for a subpart of a multipart body) forbidden header name no syntax as a response header for the main body the first parameter in the http context is either inline (default value, indicating it can be displayed inside the web page, or as the web page) or attachment (indicating it should be downloaded; most browsers presenting a '
save as' dialog, prefilled with the value of the filename parameters if present).
...when used in combination with content-disposition: attachment, it is used as the default filename for an eventual "
save as" dialog presented to the user.
...And 2 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").
...it's usually better practice to use contentscriptfile, which is a url pointing to a script file
saved under your add-on's data directory.
... the add-on consists of six files: main.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 "main.js" is
saved in your add-on's lib directory, and the other files go in your add-on's data directory: my-addon/ data/ get-text.js icon-16.png icon-32.png icon-64.png text-entry.html lib/ main.js the "main.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...
...t.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 to learn much more about content scripts, see the working with content scripts guide.
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:...
...this html file, and the icon files it references, are
saved in the add-on's data directory.
... 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".
... id string a string used to identify your widget in order to
save its location when the user moves it in the browser.
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
try inserting one within the quicknote_
savenote function, around line 345 (figure 3).
... fixme: figure 3: inserting a breakpoint start debugger type in some text into the quicknote screen, and then select
save current tab from the menu.
...
save this as a file called calc.js.
...select the menu item file:new, and
save test_calc.js in the same directory as the file that is the test target.
Updating addons broken by private browsing changes - Archive of obsolete content
the following interfaces: ff 15: nsidomstoragemanager ff 16: nsitransferable ff 18: imgicache moziasyncfavicons nsifaviconservice nsiwebbrowserpersist ff 19: nsicontentprefservice nsidownloadmanager nsidownload nsihttpauthmanager nsistricttransportsecurityservice ff 20: nsiprivatebrowsingservice nsirecentbadcertservice furthermore, if your code uses any of these common chrome apis: ff 19:
saveurl
saveinternal openlinkin ff 20: openbrowserwindow gprivatebrowsingui finally, if your code watches for any of these observer notifications: private-browsing private-browsing-cancel-vote private-browsing-change-granted private-browsing-transition-complete then your addon will require updating to correctly support the new per-window private browser feature in firefox 20 (and will requir...
... nsiwebbrowserpersist:
saveuri gained a new argument; see the nsiwebbrowserpersist docs for more information.
... internal
save: takes a new required document argument (prior to the optional boolean and string arguments) indicating the document that originated the
save action.
...
saveurl: takes a new required document argument indicating the source of the url being
saved.
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
ar env_user = getenv("user"); var env_home = getenv("home"); } else { // windows settings var env_user = getenv("username"); var env_home = getenv("homepath"); } var env_mozdebug= getenv("mozilla_debug"); // var env_user = prompt("indiquez votre login", toto); // 2) lock general preferences //ldap address book lockpref("ldap_2.prefs_migrated", true); lockpref("ldap_2.servers.ldapint.auth.
savepassword", true); lockpref("ldap_2.servers.ldapint.description", "ldap int"); lockpref("ldap_2.servers.ldapint.filename", "abook-1.mab"); lockpref("ldap_2.servers.ldapint.uri", "ldap://ldap1.int-evry.fr:389/ou=people,dc=int-evry,dc=fr??sub"); lockpref("ldap_2.servers.history.filename", "history.mab"); lockpref("ldap_2.servers.history.replication.lastchangenumber", 0); lockpref("ldap_2.servers.pab.
...konce", true); lockpref("mail.ui.folderpane.version", 3); lockpref("mailnews.ui.threadpane.version", 2); //ldap config lockpref("mail.identity.id1.directoryserver", "ldap_2.servers.ldapint"); lockpref("ldap_2.prefs_migrated", true); lockpref("ldap_2.servers.history.filename", "history.mab"); lockpref("ldap_2.servers.history.replication.lastchangenumber", 0); lockpref("ldap_2.servers.ldapint.auth.
savepassword", true); lockpref("ldap_2.servers.ldapint.description", "ldap-int"); lockpref("ldap_2.servers.ldapint.filename", "abook-1.mab"); lockpref("ldap_2.servers.ldapint.position", 3); lockpref("ldap_2.servers.ldapint.uri", "ldap://ldap1.int-evry.fr:389/ou=people,dc=int-evry,dc=fr??sub"); lockpref("ldap_2.servers.pab.filename", "abook.mab"); lockpref("ldap_2.servers.pab.replication.lastchangenumb...
...konce", true); lockpref("mail.ui.folderpane.version", 3); lockpref("mailnews.ui.threadpane.version", 2); //ldap config lockpref("mail.identity.id1.directoryserver", "ldap_2.servers.ldapint"); lockpref("ldap_2.prefs_migrated", true); lockpref("ldap_2.servers.history.filename", "history.mab"); lockpref("ldap_2.servers.history.replication.lastchangenumber", 0); lockpref("ldap_2.servers.ldapint.auth.
savepassword", true); lockpref("ldap_2.servers.ldapint.description", "ldap-int"); lockpref("ldap_2.servers.ldapint.filename", "abook-1.mab"); lockpref("ldap_2.servers.ldapint.position", 3); lockpref("ldap_2.servers.ldapint.uri", "ldap://ldap1.int-evry.fr:389/ou=people,dc=int-evry,dc=fr??sub"); lockpref("ldap_2.servers.pab.filename", "abook.mab"); lockpref("ldap_2.servers.pab.replication.lastchangenumb...
...beware that in windows, that file is already there, so it must be
saved before being replaced by ours, in order to come back to a normal state in case of problem.
Running Tamarin performance tests - Archive of obsolete content
f not specified --vmargs will be used --nooptimize do not optimize files when compiling --perfm parse the perfm results from avm --csv= also output to csv file, filename required --csvappend append to csv file instead of overwriting --score compute and print geometric mean of scores --index= index file to use (must end with .py) --
saveindex=
save results to given index file name option details indexing: there are two command line flags that control indexing: --index and —
saveindex both require an index filename to be specified after the flag.
... "--
saveindex indexname.py" will run the specified tests and
save the values to the give index file.
... specifying both --index and --
saveindex will merge the values specified in --index to the new
saved indexfile.
... really most useful with an index file (or v8 tests), since running with raw time values will skew the results towards longer running tests csv output: "--csv filename" will
save run results to a csv file that can be analyzed using excel pivottables.
IO - Archive of obsolete content
other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and
save dialogs, reading textual data, writing textual data, list of file-related error codes.
...open and
save dialogs you can show a dialog to the user to allow them to select a file to open or enter a filename for saving.
... for details about this, see open and
save dialogs.
...download files to learn how to download and
save a file from a web site to disk, see downloading files.
Creating a Skin - Archive of obsolete content
mozilla composer provides some icons for open and
save buttons, which we'll just use here to
save time.
... #opensearch { list-style-image: url("chrome://editor/skin/icons/btn1.gif"); -moz-image-region: rect(48px 16px 64px 0); -moz-box-orient: vertical; } #
savesearch { list-style-image: url("chrome://editor/skin/icons/btn1.gif"); -moz-image-region: rect(80px 16px 96px 0); -moz-box-orient: vertical; } mozilla provides a custom style property -moz-image-region which can be used to make an element use part of an image.
...when you have lots of buttons, with states for hover, active and disabled, this
saves space that would normally be occupied by mutliple images.
... other changes next, we'll make a couple of changes to the buttons along the bottom, again reusing some icons from mozilla to
save time.
More Tree Features - Archive of obsolete content
remembering state of columns as with all elements, the persist attribute can be used to
save the state of the columns in-between sessions.
...thus, once the user has decided on a column layout they like, it will automatically be
saved for next time.
... you will need to
save a number of attributes as indicated in the example below: example 2 : source view <tree enablecolumndrag="true" flex="1"> <treecols> <treecol id="runner" label="runner" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="city" label="home city" flex="2" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="starttime" label="start time" flex="1" persist="width ordinal hidden" /> <splitter class="tree-splitter" /> <treecol id="endtime" label="end time" flex="1" persist="width ordinal hidden" /> </treecols> <treechildren> <treeitem> <treerow> <treecell label="joshua granville" /> <treecell label="vancouver" /> <treecell label="7:06:00" /> ...
... <treecell label="9:10:26" /> </treerow> </treeitem> <treeitem> <treerow> <treecell label="robert valhalla" /> <treecell label="seattle" /> <treecell label="7:08:00" /> <treecell label="9:15:51" /> </treerow> </treeitem> </treechildren> </tree> three attributes of the columns must be persisted, the width attribute to
save the column widths, the ordinal attribute which holds the position of the column, and the hidden attribute which holds whether the column is hidden or visible.
The Implementation of the Application Object Model - Archive of obsolete content
the second reason to have local/remote merging is to
save state and/or to record customizations that the user has made to his or her user interface.
...what the user needs to be able to do is make a local annotation to the remote file, e.g., to
save somewhere on the local hard drive the fact that the aol instant messenger button shouldn't be on the toolbar.
...the additional cost up front to implement xul is worth it for the amount of time it will
save in future versions of the browser.
...changes such as sorting and column ordering must be remembered across application sessions, and that means that these changes to the intermediate representation of data must be
saved.
XULRunner tips - Archive of obsolete content
r classic/1.0 skin/communicator/ add a skin folder named "communicator" and add a single css file named "communicator.css" with this content: @import url("chrome://global/skin"); dom inspector to add dom inspector 2.0.* to your xulrunner 1.9.0.* application follow these steps: download the dom inspector (instead of clicking the "add to..." button, right-click and select "
save link as...").
...
save the dom_inspector-*.xpi package to a temporary directory unzip the package copy the following files: chrome/inspector.jar to the chrome directory of your xulrunner application components/inspector-cmdline.js to your components directory defaults/preferences/inspector.js to your preferences directory open your chrome.manifest file and add these lines: content inspector jar:inspector.jar!/content/inspector/ xpcnativewrappers=no locale inspector en-us jar:inspector.jar!/locale/inspector/ skin inspector modern/1.0 jar:inspector.jar!/skin/modern/inspector/ skin inspector classic/1.0 jar:inspector.jar!/skin/classic/inspector/ overlay chrome://inspector/content/popupoverlay.xul chrome://inspector/content/viewe...
...in order to satisfy these dependencies, you can
save firefox's brand.dtd/brand.properties to chrome/locale/branding folder, modify them appropriately, and register a locale provider for branding by adding the following line to your chrome manifest: locale branding en-us chrome/locale/branding/ the location you put the branding files in doesn't matter, as long as you register it appropriately in the manifest.
... making windows display correct application name and icon when buttons are grouped by default, the task bar on windows might group windows belonging to the same process into one button to
save space.
Visual-js game engine - Game development
save on drop menu or better with ctrl+s before testing in browsers.
... adding new script explanation : after adding new script and
save script if you have extra changes , open starter/run.js and you will found line : sys.script.load("scripts/new_script.js") ctrl+s use from menu run->choose browser for testing .
...path object can be
saved intro localhost , you can collect object and put it direct source code .
... npm install typescript npm i clean-webpack-plugin --
save-dev npm i html-webpack-plugin --
save-dev possible fix : npm i webpack --
save-dev npm i extract-text-webpack-plugin --
save-dev fix code format : tslint -c tslint.json 'src/**/*.ts' --fix download project link : download link from bitbucket.
Getting started with CSS - Learn web development
save the code below as index.html in a folder on your machine.
... create a file in the same folder as your html document and
save it as styles.css.
...using your code editor add the following to your css file: h1 { color: red; }
save your html and css files and reload the page in a web browser.
...add the following to your css file: .special { color: orange; font-weight: bold; }
save and refresh to see what the result is.
Getting started with HTML - Learn web development
aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; nesting elements ...
...aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; boolean attribute...
...
save the file as index.html.
...aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; whitespace in htm...
Mozilla splash page - Learn web development
save the contents of index.html in a file called index.html on your local drive, in a new directory.
... then
save pattern.png in the same directory (right click on the image to get an option to
save it.) access the different images in the originals directory and
save them in the same way; you'll want to
save them in a different directory for now, as you'll need to manipulate (some of) them using a graphics editor before they're ready to be used.
...
save copies of all these inside the same directory as index.html.
...
save a copy of both of these inside the same directory as index.html.
What is JavaScript? - Learn web development
save it in a directory somewhere sensible.
... document.addeventlistener("domcontentloaded", function() { function createparagraph() { let para = document.createelement('p'); para.textcontent = 'you clicked the button!'; document.body.appendchild(para); } const buttons = document.queryselectorall('button'); for(let i = 0; i < buttons.length ; i++) { buttons[i].addeventlistener('click', createparagraph); } });
save your file and refresh the browser — now you should see that when you click the button, a new paragraph is generated and placed below.
...did you
save your local copy of the starting code as a .html file?
...pt src="script.js" defer></script> inside script.js, add the following script: function createparagraph() { let para = document.createelement('p'); para.textcontent = 'you clicked the button!'; document.body.appendchild(para); } const buttons = document.queryselectorall('button'); for(let i = 0; i < buttons.length ; i++) { buttons[i].addeventlistener('click', createparagraph); }
save and refresh your browser, and you should see the same thing!
Vue conditional rendering: editing existing todos - Learn web development
ass="edit-label">edit name for "{{label}}"</label> <input :id="id" type="text" autocomplete="off" v-model.lazy.trim="newlabel" /> </div> <div class="btn-group"> <button type="button" class="btn" @click="oncancel"> cancel <span class="visually-hidden">editing {{label}}</span> </button> <button type="submit" class="btn btn__primary">
save <span class="visually-hidden">edit for {{label}}</span> </button> </div> </form> </template> <script> export default { props: { label: { type: string, required: true }, id: { type: string, required: true } }, data() { return { newlabel: this.label }; }, methods: { onsubmit() { if (this.newlabel && this.n...
... there is a "
save" button and a "cancel" button: when the "
save" button is clicked, the component emits the new label via an item-edited event.
... fixing this is fortunately quite easy — we can do this by converting our isdone data item into a computed property — another advantage of computed properties is that they preserve reactivity, meaning (among other things) that their state is
saved when the template changes like ours is now doing.
... so, let's implement the fix: remove the following line from inside our data() property: isdone: this.done, add the following block below the data() { } block: computed: { isdone() { return this.done; } }, now when you
save and reload, you'll find that the problem is solved — the checkbox state is now preserved when you switch between todo item templates.
Getting started with Vue - Learn web development
select "lint on
save".
... this will check for errors when we
save a file inside the project.
... finally, you are asked if you want to
save this as a preset for future options.
... first of all delete this line: <helloworld msg="welcome to your vue.js app"/> if you
save your app.vue file now, the rendered app will throw an error because we’ve registered the component but are not using it.
Focus management with Vue refs - Learn web development
similarly, if you
save or cancel your edit, focus will disappear again as you move back to the non-edit view.
...we'll also want to put focus back on the "edit" button when a user cancels or
saves their edit.
... vue's $nexttick() method we want to set focus on the "edit" button when a user
saves or cancels their edit.
... focusoneditbutton() { this.$nexttick(() => { const editbuttonref = this.$refs.editbutton; editbuttonref.focus(); }); } now when you activate the "edit" button and then cancel or
save your changes via the keyboard, focus should be returned to the "edit" button.
Implementing feature detection - Learn web development
save them in a new directory.
... when you
save everything and try out your example, you should see the flexbox layout applied to the page if the browser supports modern flexbox, and the float layout if not.
...
save it somewhere sensible, like the directory you've been creating your other examples for in this article.
...
save them as modernizr-css.html and modernizr-css.css.
Embedding the editor
ate specific interdependencies between composer and the xul document, via nsieditoruserinterface create bottleneck for getting to the focussed editor; ensure that focus changes update state move editor ownership to docshell, creating nsieditorframe created the editing session api which copes with collections of editors (or make editor refocussable) open questions where should file open and
save logic live?
... it seems that some embedders will want composer open and
save file logic, and some won't.
...of course, an embedder should be able to use its own open and
save dialogs, and communicate with composer to coordinate the open or
save process.
... possible answer the embedder provides open and
save dialogs if they want to.
Investigating leaks using DMD heap scan mode
moz_cc_log_directory=$logdir: this selects the location for cycle collector logs to be
saved.
... moz_dmd_shutdown_log=$logdir: this option specifies that we want a dmd log to be taken very late in xpcom shutdown, and the location for that log to be
saved.
...--mode=scan is needed so that when we get a dmd log the entire contents of each block of memory is
saved for later analysis.
...you'll want to
save a copy of this output for later.
Preference reference
accessibility.tabfocusthe preference accessibility.tabfocus controls what elements receive focus when the user presses the tab key.browser.altclick
savethe preference browser.altclick
save controls whether clicking a link while holding the alt key starts the download of that link.browser.dom.window.dump.enabledthis setting enables the dump function, which sends messages to the system console.
...changes require an application restart.browser.download.lastdir.
savepersitebrowser.download.lastdir.
savepersite controls whether the directory preselected in the file picker for saving a file download is being remembered on a per-website (host) base.
...the xul cache is serialized and
saved between mozilla sessions in the xul fastload file, which
saves a “compiled” version of the xul and javascript in a document to disk for faster startup the next time the application runs.reader.parse-on-load.force-enabledthe preference reader.parse-on-load.force-enabled controls if the reader mode used in firefox mobile should be enabled independent of the memory available in the device.
...n from which popup notifications invoked by nsialertsservice are sliding in.ui.spellcheckerunderlineui.spellcheckerunderline holds the colour which is used to underline words not recognized by the spellchecker.ui.spellcheckerunderlinestyleui.spellcheckerunderlinestyle holds the style which is used to underline words not recognized by the spellchecker.ui.textselectbackgroundui.textselectbackground
saves the color in which the background of a text selection in the user interface or in content will be styled.ui.textselectforegroundui.textselectforeground
saves the color in which the text of a text selection in the user interface or the content will be styled.ui.tooltipdelayui.tooltipdelay stores the delay in milliseconds between the mouse stopping over an element and the appearing of its tooltip.
Encrypt Decrypt_MAC_Using Token
< paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /*
save the last block of ciphertext as the next iv.
...*/ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /*
save last block of ciphertext.
... *
save last block of ciphertext.
... * replace iv with
saved last block of ciphertext.
EncDecMAC using token object - sample 3
encdecmac using token object example: <h2 id="nss_sample_code_3_hashing.">nss sample code 3: enc/dec/mac using token object id.</h2> <p class="summary">computes the hash of a file and
saves it to another file, illustrates the use of nss message apis.</p> <pre class="brush: cpp"> /* this source code form is subject to the terms of the mozilla public * license, v.
...ncrypt using it using cbc, using previously created iv */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /*
save the last block of ciphertext as the next iv */ iv = encbuf; ivlen = encbuflen; /* write the cipher text to intermediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { pr_fprintf(pr_stderr, "macfinal failure\n"); goto cleanup; } if (mac...
...stderr, "decrypt failure\n"); goto cleanup; } if (decbuflen == 0) break; rv = macupdate(ctxmac, decbuf, decbuflen); if (rv != secsuccess) { goto cleanup; } if (count == filelength) { decbuflen = decbuflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /*
save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_stderr, "check mac : failure\n"); pr_fprintf(pr_stderr, "extracted ...
...ot, const char *dbdir, const char *outfilename, const char *headerfilename, char *encryptedfilename, secupwdata *pwdata, prbool ascii) { /* * the db is open read only and we have authenticated to it * open input file, read in header, get iv and cka_ids of two keys from it * find those keys in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file, *
save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with
saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; secitem mackeyitem; secitem cipheritem; secitem macitem; secitem paditem; pk11symkey *enckey = null; ...
JIT Optimization Strategies
the function containing the arguments.length is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i]
save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions.
...the function containing the arguments.callee is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i]
save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions.
...the function containing the arguments.length is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i]
save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions.
...the function containing the arguments.length is allowed to use the arguments object in the following ways without disabling this optimization: access arguments.length access arguments.callee access individual args using arguments[i]
save arguments into variables, as long as those variables cannot be accessed by any nested function, and as long as there exists no eval anywhere within the function or nested function definitions.
JSAPI Cookbook
to avoid this, your jsapi code implementing the finally block must:
save the old exception, if any clear the pending exception so that your cleanup code can run do your cleanup restore the old exception, if any return false if an exception occurred, so that the exception is propagated up.
... * it will be automatically restored when we return, unless we call
savedstate.drop().
... */ js::auto
saveexceptionstate
savedstate(cx); if (!js_callfunctionname(cx, global, "cleanup", 0, null, &r)) { /* the new error replaces the previous one, so discard the
saved exception state.
... */
savedstate.drop(); return false; } return success; object properties getting a property // javascript var x = y.myprop; the jsapi function that does this is js_getproperty.
JS_SuspendRequest
syntax jsrefcount js_suspendrequest(jscontext *cx); void js_resumerequest(jscontext *cx, jsrefcount
savedepth); name type description cx jscontext * the context whose current request is to be suspended or resumed.
...
savedepth jsrefcount (only in js_resumerequest) the valued returned by the matching js_suspendrequest call.
...the
savedepth argument must be the value returned by the matching js_suspendrequest call.
... if
savedepth is nonzero and garbage collection is underway, js_resumerequest blocks until the garbage collector is done.
Places utilities for JavaScript
its not an interface, and as such it will never be frozen, but it provides some easy to use functions that can
save you from reinventing the wheel and cluttering up your own classes/functions when you need it.
...for instance, normally in order to get access to the bookmarks service, you have to run something like: components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); with places utils all you need to write is: placesutils.bookmarks this should
save on the number of references to the service that are needed, and can help clean up interfaces that are already fairly cluttered.
...they can
save you time calling the service and searching for a particular folder on your own.
...using the functions can
save you some implementation work.
nsIContentPrefService
provides a way for extensions and browser code to
save preferences for specific websites.
... preferences are
saved as key/value pairs on a per-website basis.
... getpref() returns the value of a preference
saved for a particular site.
...the result may be null (nsidatatype:vtype_empty) if the preference's value is either null, or undefined (nsidatatype:vtype_void) if there is no
saved preference by the specified name.
nsIDownloadManager
ce gecko 1.9.1 void pausedownload(in unsigned long aid); void removedownload(in unsigned long aid); void removedownloadsbytimeframe(in long long abegintime, in long long aendtime); void removelistener(in nsidownloadprogresslistener alistener); void resumedownload(in unsigned long aid); void retrydownload(in unsigned long aid); void
savestate(); obsolete since gecko 1.8 void startbatchupdate(); obsolete since gecko 1.9.1 attributes attribute type description activedownloadcount long the number of files currently being downloaded.
...if you want to both add and start a download, you need to create an nsiwebbrowserpersist object, call this method, set the progresslistener to the returned nsidownload object, and then call the nsiwebbrowserpersist.
saveuri() method.
...
savestate() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) update the download datasource.
... void
savestate(); parameters none.
nsIPasswordManager
addreject() blocks a hostname from having its passwords
saved.
... void addreject(in autf8string ahost); parameters ahost the name of the hostname for which passwords should no longer be
saved.
... removereject() unblocks a hostname from having its passwords
saved.
... void removereject(in autf8string ahost); parameters ahost the name of the hostname for which passwords can be
saved again.
Taking screenshots - Firefox Developer Tools
the screenshot is
saved to your browser's "downloads" directory: taking a screenshot of an element to take a screenshot of a single element in the page, activate the context menu on that element in the inspector's html pane, and select "screenshot node".
... the screenshot is
saved to the browser's "downloads" directory: copying screenshots to the clipboard from firefox 53, you can also copy the screenshot to the clipboard.
... --file boolean when present, the screenshot will be
saved to a file, even if other options (e.g.
... --fullpage boolean if included, the full webpage will be
saved.
Authoring MathML - MathML
once you are done, you can
save your document as a xhtml page.
...the editor uses its own syntax "starmath" for the source but mathml is also generated when the document is
saved.
... to get the mathml code,
save the document as mml and open it with any text editor.
...once you are done, you can directly
save your xhtml page and open it in mozilla.
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").
...with contentscriptfile you pass a url which points to a script
saved under your add-on's data directory.
...so if your content script is
saved under data as "my-script.js", you need a line like <script src="my-script.js"></script> in the page header.
Displaying annotations - Archive of obsolete content
ction() { 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.
..."http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>annotation</title> <style media="all" type="text/css"> body { font: 100% arial, helvetica, sans-serif; background-color: #f5f5f5; } div { text-align:left; } </style> </head> <body> <div id="annotation"> </div> </body> </html>
save this in data/annotation as annotation.html.
... 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.
Storing annotations - Archive of obsolete content
save this file in data/list as annotation-list.js.
... annotation list html and css here's the html for the annotation list: <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>
saved annotations</title> <link rel="stylesheet" type="text/css" href="annotation-list.css" /> </head> <body> <div id="annotation-list"> </div> <div id="template"> <div class="annotation-details"> <a class="url"></a> <div class="selection-text"></div> <div class="annotation-text"></div> </div> </div> </body> </html> here's the corresponding css: #annotation-list .annotation-details { padding: 10px; margin: 10px; border: solid 3px #eee; background-color: white; } #annotation-list .url, .selection-text, .annotation-text { padding: 5px; margin: 5px; } #annotation-list .selection-text...
...,#annotation-list .annotation-text { border: solid 1px #eee; } #annotation-list .annotation-text { font-style: italic; } body { background-color: #f5f5f5; font: 100% arial, helvetica, sans-serif; } h1 { font-family: georgia,serif; font-size: 1.5em; text-align:center; }
save these in data/list as annotation-list.html and annotation-list.css respectively.
Using third-party modules (jpm) - Archive of obsolete content
summary first, while in the root of your add-on, install the package that contains the modules you want to use: npm install menuitem --
save now you'll see a new directory in your add-on root called "node_modules" that contains a directory "menuitem".
...your add-on code, you can require() modules by passing a path to the module starting from, but not including "node_modules": var menuitems = require("menuitem"); details create a new directory called, for example, "my-menuitem", navigate to it, type "jpm init" and accept all the defaults: mkdir my-menuitem cd my-menuitem jpm init install the menuitem package from npm: npm install menuitem --
save this will install the package in the current directory, under a directory called "node_modules".
... the --
save argument instructs npm to add this package to the dependencies key in the add-on's package.json file.
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.
...example: setting and retrieving preferences this example demonstrates how to
save a preference and then retrieve its value.
... var iosvc = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var prefservice = components.classes["@mozilla.org/content-pref/service;1"] .getservice(components.interfaces.nsicontentprefservice); // create a uri object referencing the site to
save a preference for var uri = iosvc.newuri("http://developer.mozilla.org/", null, null); // set the value of the "devmo.somesetting" preference to "foo".
Getting Started - Archive of obsolete content
delete the bolded text: original skin,install,url,jar:resource:/chrome/classic.jar!/skin/classic/global/ modified skin,install,url,resource:/chrome/classic/skin/classic/global/ once you have made these modifications,
save them and run mozilla.
...
save the file and run mozilla.
..."urn:mozilla:skin:myskin/1.0:communicator"/> <rdf:description chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:editor"/> <rdf:description chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:global"/> <rdf:description chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:messenger"/> <rdf:description chrome:skinversion="1.0" about="urn:mozilla:skin:myskin/1.0:navigator"/>
save the file and exit the text editor.
Using Dehydra - Archive of obsolete content
example: printing the location of type declarations
save the following c++ code dumptypes.cc: typedef int myint; struct foo { int i; char *c; };
save the following analysis script dumptypes.js: function process_type(t) { print("type found: " + t.name + " location: " + t.loc); } function input_end() { print("hello, world!"); } compile using the following command: $ g++ -fplugin=~/dehydra/gcc_dehydra.so -fplugin-arg=~/dumptypes.js -o/dev/null -c dumptypes.cc note:for g++4.5 and up use -fplugin-arg-gcc_dehydra-script= rather than -fplugin-arg it should print the following results: type fo...
... see documentation for: process_type, input_end, print, .loc property example: using attributes to mark a class as "final"
save the following code as final.cc: // this class should not be subclassed!
... class __attribute__((user("final"))) myclass { }; // this subclass should be an error class subclass : public myclass { };
save the following analysis script final.js: /** * helper function: returns true if a class is marked with the "final" attribute.
Overview of how downloads work - Archive of obsolete content
one way is to encounter a file with an unknown content type, the other is to choose "
save link target as" from the context menu of a link.
... things like file|
save page as,
save image as, etc.
...get the .dia file here: mozilla_downloads.dia downloads via "
save link target as" and friends this diagram is an uml sequence diagram, and was created using dia.
Proxy UI - Archive of obsolete content
the "ok" button
saves the preferences.
...saving changes click "ok" to
save changes to prefs.
...but should be noted that if you cut and paste from ie, the semi-colons are automatically converted to commas when you
save changes (ff, tb, sm).
Treehydra Manual - Archive of obsolete content
example treehydra script: function process_cp_pre_genericize(fn) { // fn is a function_decl, decl_
saved_tree(fn) is ast print(fn); } gimple asts gimple asts are provided via the process_tree callback.
...example: function process_tree(fn) { // fn is a function_decl, decl_
saved_tree(fn) is ast print(fn); } gimple cfgs process_tree can also provide gimple cfgs.
...in this case, gimple asts will not be available, as gcc does not
save earlier intermediate representations--they are modified in place.
Creating a Wizard - Archive of obsolete content
this script might be used to
save the information that the user entered during the wizard.
... for example: <wizard id="example-window" title="select a dog wizard" onwizardfinish="return
savedoginfo();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> when the user clicks the finish button, the function
savedoginfo() will be called, which would be defined in a script file to
save the information that was entered.
...if it returns false, then the wizard does not close, which might occur if the function
savedoginfo() encountered invalid input, for example.
More Menu Features - Archive of obsolete content
e 1 : source view <toolbox flex="1"> <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menu id="new-menu" label="new"> <menupopup id="new-popup"> <menuitem label="window"/> <menuitem label="message"/> </menupopup> </menu> <menuitem label="open"/> <menuitem label="
save"/> <menuseparator/> <menuitem label="exit"/> </menupopup> </menu> </menubar> </toolbox> adding a menu to our find files example let's add a menu to the find files dialog.
... <toolbox> <menubar id="findfiles-menubar"> <menu id="file-menu" label="file" accesskey="f"> <menupopup id="file-popup"> <menuitem label="open search..." accesskey="o"/> <menuitem label="
save search..." accesskey="s"/> <menuseparator/> <menuitem label="close" accesskey="c"/> </menupopup> </menu> <menu id="edit-menu" label="edit" accesskey="e"> <menupopup id="edit-popup"> <menuitem label="cut" accesskey="t"/> <menuitem label="copy" accesskey="c"/> <menuitem label="paste" accesskey="p" disabled="true"/> </menupopup> </menu> </menubar> <toolbar id="findfiles-toolbar> here we have added two menus with various ...
...the three dots after open search and
save search are the usual way that you indicate to the user that a dialog will open when selecting the command.
Toolbars - Archive of obsolete content
two buttons will be added, an open button and a
save button.
... presumably, they would allow the user to
save search results and re-open them later.
... <vbox flex="1"> <toolbox> <toolbar id="findfiles-toolbar"> <toolbarbutton id="opensearch" label="open"/> <toolbarbutton id="
savesearch" label="
save"/> </toolbar> </toolbox> <tabbox> a toolbar with two buttons has been added here.
prefwindow - Archive of obsolete content
roperties buttons, currentpane, defaultbutton, lastselected, preferencepanes, type methods acceptdialog, addpane, canceldialog, centerwindowonscreen, getbutton, opensubdialog, openwindow, showpane examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <prefwindow xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <prefpane id="
saveoptions" label="backups"> <preferences> <preference id="pref-backup" name="myapp.mybackups" type="bool"/> <preference id="pref-backupduration" name="myapp.mybackups.duration" type="int"/> </preferences> <checkbox label="automatically
save backups" preference="pref-backup"/> <textbox label="duration:" preference="pref-backupduration"/> </prefpane> </prefwindow> attri...
...this ensures that the preferences are only
saved when the main dialog is closed, if this is the appropriate behaviour for the platform.
...if the child dialog is also a prefwindow, set its type attribute to child so that preferences will be
saved properly when the main dialog is closed.
2006-10-13 - Archive of obsolete content
annoying firefox 2
save dialog instead of open/
save ones.
... user questions about a open/
saveas bug that already exisits: https://bugzilla.mozilla.org/show_bug.cgi?id=347230 installer for 2.0rc2 ehume gives the developers a thumbs up for the new installer for 2.0rc2 having a textfield where you can type in the installation directory.
... firefox add-on wanted user is inquiring if there is such an application to automatically
save pieces of a webpage everytime is it updated.
Logging Multi-Process Plugins - Archive of obsolete content
make sure you have write permissions to wherever you wish to
save the log.
...from within a command prompt: c:\> set nspr_log_modules=ipcplugins:5 c:\> set nspr_log_file=c:\plugins.log c:\> cd c:\program files\mozilla firefox c:\> firefox.exe the log file will be
saved to c:\plugins.log (or wherever nspr_log_file is set).
...from within a bash shell: $ export nspr_log_modules=ipcplugins:5 $ export nspr_log_file=~/plugins.log $ /usr/bin/firefox the file will be
saved to ~/plugins.log (or wherever nspr_log_file is set).
Writing JavaScript for XHTML - Archive of obsolete content
just write an ordinary (x)html file and
save it once as test.html and once as test.xhtml.
... problem: my cookie isn't
saved!
...that is, you can write something like document.cookie = "key=value"; in xml as well, but nothing is
saved in cookie storage.
Building up a basic demo with A-Frame - Game development
save a copy of the latest a-frame javascript library file inside your directory (check the github repository for latest stable a dev builds).
... html structure the first step is to create an html document — inside your project directory, create a new index.html file, and
save the follow html inside it: <!doctype html> <html> <head> <meta charset="utf-8"> <title>mdn games: a-frame demo</title> <script src="aframe.min.js"></script> </head> <body> <!-- html goes here --> </body> </html> this contains some basic information like the document charset and <title>.
...add the following html before the <a-cube> element: <a-sky color="#dddddd"></a-sky> at this point, if you
save the code and refresh your browser you can already see the cube on the screen with our custom background: here's the code we have created so far: you can also check it out on github.
Building up a basic demo with Three.js - Game development
save a copy of the latest minimized three.js library inside your directory.
... before reading further, copy this code to a new text file, and
save it in your working directory as index.html.
...add this line below the previous one: scene.add(cube); if you
save, and refresh your web browser, our object will now look like a square, because it's facing the camera.
GLSL Shaders - Game development
save a copy of the latest minimized three.js library inside your directory.
... before reading on, copy this code to a new text file and
save it in your working directory as index.html.
...
save and load index.html in your browser — you should see a blue cube.
Accessible multimedia - Learn web development
basic setup first, grab a copy of our custom-controls-start.html, custom-controls.css, rabbit320.mp4, and rabbit320.webm files and
save them in a new directory on your hard drive.
... create a new file called main.js and
save it in the same directory.
... to get this displayed along with the html media playback, you need to:
save it as a .vtt file in a sensible place.
Legacy layout methods - Learn web development
this takes a bit of time with a calculator; to
save you some effort, we've done it for you below.
...*/ .col.span4 { width: 31.24999999%; } .col.span5 { width: 39.58333332%; } .col.span6 { width: 47.91666665%; } .col.span7 { width: 56.24999998%; } .col.span8 { width: 64.58333331%; } .col.span9 { width: 72.91666664%; } .col.span10 { width: 81.24999997%; } .col.span11 { width: 89.5833333%; } .col.span12 { width: 97.91666663%; } now
save your code, load it in a browser, and try changing the viewport width — you should see the column widths adjust nicely to suit.
... make a copy of our html-skeleton.html file and
save it in the same directory as the skeleton and normalize css.
Practical positioning examples - Learn web development
you might be thinking "why not just create the separate tabs as separate webpages, and just have the tabs clicking through to the separate pages to create the effect?" this code would be simpler, yes, but then each separate "page" view would actually be a newly-loaded webpage, which would make it harder to
save information across views, and integrate this feature into a larger ui design.
...
save this somewhere sensible on your local computer, and open it up in your text editor.
... var tab = tabs[i]; settabhandler(tab, i); } function settabhandler(tab, tabpos) { tab.onclick = function() { for(i = 0; i < tabs.length; i++) { tabs[i].classname = ''; } tab.classname = 'active'; for(i = 0; i < panels.length; i++) { panels[i].classname = ''; } panels[tabpos].classname = 'active-panel'; } } this code does the following: first we
save a reference to all the tabs and all the panels in two variables called tabs and panels, so we can easily do things to them later on.
What text editors are available? - Learn web development
in particular (if possible in your editor), try to: change syntax highlighting settings and colors play with indentation width, setting it to an appropriate setting for your needs check auto
save and session saving settings configure any available plugins and investigate how to get new ones change color schemes adjust view settings and see how you can change the layout of the views check what programming languages/technologies your editor supports while you're learning the default settings of most text editors should be fine to use, but it is important to become familiar with your c...
...
save you time by auto-completing recurring structures (for example, automatically close html tags, or suggesting valid values for a given css property).
...
save yourself the hassle of retyping all this by using a code snippet to pre-fill your document.
CSS basics - Learn web development
save the file as style.css in a directory named styles.
...paste the following line in the head (between the <head> and </head> tags): <link href="styles/style.css" rel="stylesheet">
save index.html and load it in your browser.
... first, find the output from google fonts that you previously
saved from what will your website look like?.
Advanced text formatting - Learn web development
pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; quotations html ...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; abbreviations an...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; marking up contac...
Adding vector graphics to the Web - Learn web development
note: in inkscape,
save your files as plain svg to
save space.
...make sure your svg code snippet begins and ends with the <svg></svg> tags (don't include anything outside those.) here's a very simple example of what you might paste into your document: <svg width="300" height="200"> <rect width="100%" height="100%" fill="green" /> </svg> pros putting your svg inline
saves an http request, and therefore can reduce a bit your loading time.
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; summary this art...
HTML table advanced features and accessibility - Learn web development
save your code and open it in a browser to see what it looks like.
...
save and refresh, and you'll see that adding the <tfoot> element has caused the "sum" row to go down to the bottom of the table.
...inside this element, add the following lines of css code: tbody { font-size: 95%; font-style: italic; } tfoot { font-weight: bold; }
save and refresh, and have a look at the result.
Graceful asynchronous programming with Promises - Learn web development
if you
save the html file you've just created and load it in your browser, you'll see that the image is displayed in the page as expected.
...es[2]; // display the images in <img> elements let image1 = document.createelement('img'); let image2 = document.createelement('img'); image1.src = objecturl1; image2.src = objecturl2; document.body.appendchild(image1); document.body.appendchild(image2); // display the text in a paragraph let para = document.createelement('p'); para.textcontent = desctext; document.body.appendchild(para);
save and refresh and you should see your ui components all loaded, albeit in a not particularly attractive way!
...let's use it now — replace the previous timeoutpromise usage with this one: timeoutpromise('hello there!', 1000) .then(message => { alert(message); }) .catch(e => { console.log('error: ' + e); }); when you
save and run the code as is, after one second you'll get the message alerted.
Functions — reusable blocks of code - Learn web development
try editing a() and b() so they look like this: function a() { let y = 2; output(y); } function b() { let z = 3; output(z); }
save the code and reload it in your browser, then try calling the a() and b() functions from the javascript console: a(); b(); you should see the y and z values output in the page.
... now try updating your code like this: function a() { let y = 2; output(x); } function b() { let z = 3; output(x); }
save and reload again, and try this again in your javascript console: a(); b(); both the a() and b() call should output the value of x — 1.
... finally, try updating your code like this: function a() { let y = 2; output(z); } function b() { let z = 3; output(y); }
save and reload again, and try this again in your javascript console: a(); b(); this time the a() and b() calls will both return an annoying referenceerror: variable name is not defined error — this is because the output() calls and the variables they are trying to print are not in the same function scopes — the variables are effectively invisible to those function calls.
A first splash into JavaScript - Learn web development
save your code and refresh the page in your browser.
... if you haven't already done so,
save your code, refresh the page in your browser, and open the developer tools javascript console.
...add the following line just below the let resetbutton; line near the top of your javascript, then
save your file: guessfield.focus(); this line uses the focus() method to automatically put the text cursor into the <input> text field as soon as the page loads, meaning that the user can start typing their first guess right away, without having to click the form field first.
Arrays - Learn web development
to
save that item in a new variable, you could do this: let removeditem = myarray.pop(); myarray; removeditem; unshift() and shift() work in exactly the same way as push() and pop(), respectively, except that they work on the beginning of the array, not the end.
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; html { font-family...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; test your skills!
Useful string methods - Learn web development
pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; fixing capitaliza...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; making new string...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; test your skills!
Introduction to the server side - Learn web development
sites like google maps can use
saved or current locations for providing routing information, and search or travel history to highlight local businesses in search results.
... note: google maps
saves your search and visit history.
... this allows, for example, a site to know that a user has previously logged in and display links to their emails or order history, or perhaps
save the state of a simple game so that the user can go to a site again and carry on where they left it.
Starting our Svelte Todo list app - Learn web development
objective: to learn how to create a svelte component, render it inside another component, pass data into it using props, and
save its state.
... <input type="text" id="todo-1" autocomplete="off" class="todo-text" /> </div> <div class="btn-group"> <button class="btn todo-cancel" type="button"> cancel <span class="visually-hidden">renaming create a svelte starter app</span> </button> <button class="btn btn__primary todo-edit" type="submit">
save <span class="visually-hidden">new name for create a svelte starter app</span> </button> </div> </form> </div> </li> <!-- todo-2 --> <li class="todo"> <div class="stack-small"> <div class="c-cb"> <input type="checkbox" id="todo-2" checked/> <label for="todo-2" class="todo-label"> create you...
... when the task is being edited, the list item has an input and two button to cancel or
save modifications.
TypeScript support in Svelte - Learn web development
alue) => json.stringify(value, null, 2) // helper function const toobj = json.parse // helper function if (localstorage.getitem(key) === null) { // item not present in local storage localstorage.setitem(key, tostring(initial)) // initialize local storage with initial value } const
saved = toobj(localstorage.getitem(key)) // convert to object const { subscribe, set, update } = writable(
saved) // create the underlying writable store return { subscribe, set: (value: jsonvalue) => { localstorage.setitem(key, tostring(value)) //
save also to local storage as a string return set(value) ...
...if we try to
save an invalid value to our todos store using the $store syntax, like this: <!-- app.svelte --> <script lang="ts"> import todos from './components/todos.svelte' import alert from './components/alert.svelte' import { todos } from './stores' // this is invalid, the content cannot be converted to json using json.stringify $todos = { handler: () => {} } </script> the validate script will report the following error: > npm run validate getting svelte diagnostics...
... json.stringify(value, null, 2) // helper function const toobj = json.parse // helper function if (localstorage.getitem(key) === null) { // item not present in local storage localstorage.setitem(key, tostring(initial)) // initialize local storage with initial value } const
saved = toobj(localstorage.getitem(key)) // convert to object const { subscribe, set, update } = writable<t>(
saved) // create the underlying writable store return { subscribe, set: (value: t) => { localstorage.setitem(key, tostring(value)) //
save also to local storage as a string return set(value) }, ...
Package management basics - Learn web development
we’ll call it parcel-experiment, but you can call it whatever you like: mkdir parcel-experiment cd parcel-experiment next, let's initialise our app as an npm package, which creates a config file — package.json — that allows us to
save our configuration details in case we want to recreate this environment later on, or even publish the package to the npm registry (although this is somewhat beyond the scope of this article).
... in the index.js file, add the following code and
save it: import { formatdistancetonow } from 'date-fns' const date = '1996-09-13 10:00:00'; document.body.textcontent = formatdistancetonow(new date(date)) + ' ago'; go back to http://localhost:1234 and you'll see how long ago it is since the author turned 18.
...open it up, and its scripts member should look like this: "scripts": { "test": "echo \"error: no test specified\" && exit 1", }, update it so that it looks like this, and
save the file: "scripts": { "test": "echo \"error: no test specified\" && exit 1", "dev": "parcel serve index.html" }, we’ve added a custom dev command as an npm script.
Overview of Mozilla embedding APIs
the default implementation of this service displays a dialog box asking the user if the content should be
saved to disk...
... //
save webbrowser before it goes out of scope :-) web navigation the nsiwebnavigation interface is used to load uris into the webbrowser and provide access to session history capabilities - such as back and forward.
...being reviewed interface definition: nsiwebnavigation.idl nsiwebbrowserpersist this interface exposes the
save-as functionality of the nswebbrowser component.
How to get a stacktrace with WinDbg
you will also want to open a log file to
save data you collect.
... q: should i click yes or no when windbg asks me to "
save information for workspace?" a: click yes and windbg will
save you from having to enter in the symbol location for firefox.exe in the future.
... click no if you'd rather not having windbg
save this information.
OS.File for the main thread
writestream = function writestream(data, outfile, chunksize) { return task.spawn(function() { let view = new uint8array(data); let pos = 0; while (pos < view.bytelength) { pos += yield outfile.write(view.subarray(pos, chunksize)); } outfile.close(); }).then( null, function onfailure(reason) { outfile.close(); throw reason; } ); } example:
save canvas to disk this exmaple uses image to load an image from a path (note: if your path is a file on disk you must use local file; this is accomplished with os.path.tofileuri, which accepts a string).
... after image loads it then draws it to canvas, makes it a blob, and uses filereader to turn it into arraybuffer(view), then uses os.file.writeatomic to
save to disk.
... var writepath = os.path.join(os.constants.path.desktopdir, '
savedimage.png'); var promise = os.file.writeatomic(writepath, new uint8array(r.result), { tmppath: writepath + '.tmp' }); promise.then( function(aval) { console.log('successfully
saved image to disk'); }, function(areason) { console.log('writeatomic failed for reason:', areason); ...
Webapps.jsm
importing components.utils.import("resource://gre/modules/webapps.jsm"); // exported symbol is domapplicationregistry method overview init: function() loadcurrentregistry: function() notifyappsregistrystart: function notifyappsregistrystart() notifyappsregistryready: function notifyappsregistryready() sanitizeredirects: function sanitizeredirects(asource) _
savewidgetsfullpath: function(amanifest, adestapp) appkind: function(aapp, amanifest) updatepermissionsforapp: function(aid, aispreinstalled) updateofflinecacheforapp: function(aid) installpreinstalledapp: function installpreinstalledapp(aid) removeifhttpsduplicate: function(aid) installsystemapps: function() loadandupdateapps: function() updatedatastore: function(aid, aorigin, amanifesturl, a...
...tentaction: function(windowid) popcontentaction: function(windowid) actioncancelled: function(windowid) denyinstall: function(adata) _setupapp: function(adata, aid) _cloneapp: function(adata, anewapp, alocalemanifest, amanifest, aid, alocalid) _writemanifestfile: function(aid, aispackage, ajsonmanifest) _nextlocalid: function() _appidformanifesturl: function(auri) makeappid: function() _
saveapps: function() _readmanifests: function(adata) _ensuresufficientstorage: function(anewapp) _checkdownloadsize: function(afreebytes, anewapp) _getrequestchannel: function(afullpackagepath, aislocalfileinstall, aoldapp,) _senddownloadprogressevent: function(anewapp, aprogress) _getpackage: function(arequestchannel, aid, aoldapp, anewapp) _computefilehash: function(afilepath) _sendappliedev...
...ent: function(aapp) _openandreadpackage: function(azipfile, aoldapp, anewapp, aislocalfileinstall,) _openpackage: function(azipfile, aapp, aislocalfileinstall) _opensignedpackage: function(ainstallorigin, amanifesturl, azipfile, acertdb) _readpackage: function(aoldapp, anewapp, aislocalfileinstall, aisupdate,) _checksignature: function(aapp, aissigned, aislocalfileinstall) _
saveetag: function(aisupdate, aoldapp, arequestchannel, ahash, amanifest) _checkorigin: function(aissigned, aoldapp, amanifest, aisupdate) _getids: function(aissigned, azipreader, aconverter, anewapp, aoldapp,) _checkforstoreidmatch: function(aisupdate, anewapp, astoreid, astoreversion) revertdownloadpackage: function(aid, aoldapp, anewapp, aisupdate, aerror) uninstall: function(amanifesturl) _promptforuninstall...
Localization content best practices
it might be tempting to '
save time' by presenting this as the url of this feed %s and then is invalid; cannot be reached and cannot be parsed.
...'do you want to
save the text?' suffixes in basque: where english tends to use expressions such as 'to the' or 'from the', basque adds an ending to a word to express the same concept.
...
save document?
nglayout.debug.disable_xul_cache
the xul cache is serialized and
saved between mozilla sessions in the xul fastload file, which
saves a “compiled” version of the xul and javascript in a document to disk for faster startup the next time the application runs.
...possible values and their effects: true: do not cache parsed xul documents and do not
save the cache to the xul fastload file on exit; re-read the source files each time the window or dialog needs to be displayed.
... false: cache xul documents in memory and
save the cache to disk on exit to improve performance.
Encrypt Decrypt MAC Keys As Session Objects
< paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /*
save the last block of ciphertext as the next iv */ iv = encbuf; ivlen = encbuflen; /* write the cipher text to intermediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { ...
...; if (rv != secsuccess) { goto cleanup; } if (count == filelength) { decbuflen = decbuflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /*
save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_...
...*encryptedfilename, secupwdata *pwdata, prbool ascii) { /* * the db is open read only and we have authenticated to it * open input file, read in header, get iv and cka_ids of two keys from it * find those keys in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file, *
save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with
saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; ...
Encrypt and decrypt MAC using token
< paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /*
save the last block of ciphertext as the next iv */ iv = encbuf; ivlen = encbuflen; /* write the cipher text to intermediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { ...
...; if (rv != secsuccess) { goto cleanup; } if (count == filelength) { decbuflen = decbuflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /*
save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_...
...*encryptedfilename, secupwdata *pwdata, prbool ascii) { /* * the db is open read only and we have authenticated to it * open input file, read in header, get iv and cka_ids of two keys from it * find those keys in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file, *
save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with
saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; ...
Enc Dec MAC Output Public Key as CSR
< paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /*
save the last block of ciphertext as the next iv */ iv = encbuf; ivlen = encbuflen; /* write the cipher text to intermediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); if (rv != secsuccess) goto cleanup; } rv = macfinal(ctxmac, mac,...
... char *encryptedfilename, secupwdata *pwdata, prbool ascii) { /* * the db is open read only and we have authenticated to it * open input file, read in header, get iv and wrapped keys and * public key * unwrap the wrapped keys * loop until eof(input): * read a buffer of ciphertext from input file, *
save last block of ciphertext * decrypt ciphertext buffer using cbc and iv, * compute and check mac, then remove mac from plaintext * replace iv with
saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem wrappedenckeyit...
...); if (rv != secsuccess) { pr_fprintf(pr_stderr, "could not authenticate to token %s.\n", pk11_gettokenname(slot)); goto cleanup; } switch (cmd) { case gen_csr: /* validate command for generate csr */ if (!certreqfilename || !subject) { usage(progname); } /* * generate the cert request and
save it * in a file so public key can be retrieved later to wrap the symmetric key */ rv = createcertificaterequest(slot, dbdir, &pwdata, subject, certreqfilename, ascii); if (rv != secsuccess) { pr_fprintf(pr_stderr, "create certificate request: failed\n"); goto cleanup; } break; case encrypt: /* validate command fo...
NSS Sample Code Sample_3_Basic Encryption and MACing
< paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /*
save the last block of ciphertext as the next iv */ iv = encbuf; ivlen = encbuflen; /* write the cipher text to intermediate file */ nwritten = pr_write(encfile, encbuf, encbuflen); /*pr_assert(nwritten == encbuflen);*/ rv = macupdate(ctxmac, ptext, ptextlen); } rv = macfinal(ctxmac, mac, &maclen, digestsize); if (rv != secsuccess) { ...
...; if (rv != secsuccess) { goto cleanup; } if (count == filelength) { decbuflen = decbuflen-paddinglength; } /* write the plain text to out file */ temp = pr_write(outfile, decbuf, decbuflen); if (temp != decbuflen) { pr_fprintf(pr_stderr, "write error\n"); rv = secfailure; break; } /*
save last block of ciphertext */ memcpy(iv, decbuf, decbuflen); ivlen = decbuflen; blocknumber++; } if (rv != secsuccess) { goto cleanup; } rv = macfinal(ctxmac, newmac, &newmaclen, sizeof(newmac)); if (rv != secsuccess) { goto cleanup; } if (port_memcmp(macitem->data, newmac, newmaclen) == 0) { rv = secsuccess; } else { pr_fprintf(pr_...
... *encryptedfilename, secupwdata *pwdata, prbool ascii) { /* * the db is open read only and we have authenticated to it * open input file, read in header, get iv and cka_ids of two keys from it * find those keys in the db token * open output file * loop until eof(input): * read a buffer of ciphertext from input file *
save last block of ciphertext * decrypt ciphertext buffer using cbc and iv * compute and check mac, then remove mac from plaintext * replace iv with
saved last block of ciphertext * write the plain text to output file * close files * report success */ secstatus rv; secitem ivitem; secitem enckeyitem; ...
NSS functions
ficate mxr 3.12 and later cert_nicknamestringsfromcertlist mxr 3.4 and later cert_opencertdbfilename mxr 3.2 and later cert_ocspcachesettings mxr 3.11.7 and later cert_pkixverifycert mxr 3.12 and later cert_removecertlistnode mxr 3.6 and later cert_rfc1485_escapeandquote mxr 3.2 and later cert_
savesmimeprofile mxr 3.2 and later cert_setsloptime mxr 3.2 and later cert_setocspfailuremode mxr 3.11.7 and later cert_setocsptimeout mxr 3.12 and later cert_setusepkixforvalidation mxr 3.12 and later cert_startcertextensions mxr 3.5 and later cert_startcertificaterequestattributes mxr 3.10 and later ...
... pk11_pubwrapsymkey mxr 3.2 and later pk11_randomupdate mxr 3.2 and later pk11_readrawattribute mxr 3.9.2 and later pk11_referencesymkey mxr 3.2 and later pk11_resettoken mxr 3.4 and later pk11_restorecontext mxr 3.2 and later pk11_
savecontext mxr 3.2 and later pk11_
savecontextalloc mxr 3.6 and later pk11_setfortezzahack mxr 3.2 and later pk11_setpasswordfunc mxr 3.2 and later pk11_setprivatekeynickname mxr 3.4 and later pk11_setpublickeynickname mxr 3.4 and later ...
...igningtime mxr 3.2 and later nss_cmssignerinfo_getverificationstatus mxr 3.2 and later nss_cmssignerinfo_getversion mxr 3.2 and later nss_cmssignerinfo_includecerts mxr 3.2 and later nss_cmsutil_verificationstatustostring mxr 3.2 and later nss_smimesignerinfo_
savesmimeprofile mxr 3.4 and later nss_smimeutil_findbulkalgforrecipients mxr 3.2 and later pkcs #7 functions the public functions listed here perform pkcs #7 operations required by mail and news applications and by some of the nss tools.
NSS tools : ssltab
if the tool detects a certificate chain, it
saves the der-encoded certificates into files in the current directory.
...} cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } 0: 0b 00 02 c5 |...Å type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } 0: 0c 00 00 ca |....
...ype = 22 (handshake) version = { 3,0 } length = 997 (0x3e5) handshake { type = 2 (server_hello) length = 70 (0x000046) serverhello { server_version = {3, 0} random = {...} session id = { length = 32 contents = {..} } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_done) length = 0 (0x000000) } } ] --> [ sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { type = 20 (change_cipher_spec) version = { 3,0 } leng...
NSS tools : ssltap
if the tool detects a certificate chain, it
saves the der-encoded certificates into files in the current directory.
...} cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } 0: 0b 00 02 c5 |...Å type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } 0: 0c 00 00 ca |....
...ype = 22 (handshake) version = { 3,0 } length = 997 (0x3e5) handshake { type = 2 (server_hello) length = 70 (0x000046) serverhello { server_version = {3, 0} random = {...} session id = { length = 32 contents = {..} } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_done) length = 0 (0x000000) } } ] --> [ sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { message = {...} } } } ] --> [ sslrecord { type = 20 (change_cipher_spec) version = { 3,0 } leng...
NSS Tools ssltap
if the tool detects a certificate chain, it
saves the der-encoded certificates into files in the current directory.
... } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } 0: 0b 00 02 c5 |...Å type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } 0: 0c 00 00 ca |....
......} session id = { length = 32 contents = {..} } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_done) length = 0 (0x000000) }}]--> [sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040) clientkeyexchange { ...
NSS tools : ssltap
if the tool detects a certificate chain, it
saves the der-encoded certificates into files in the current directory.
... } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } 0: 0b 00 02 c5 |...Å type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } 0: 0c 00 00 ca |....
...id = { length = 32 contents = {..} } cipher_suite = (0x0003) ssl3/rsa/rc4-40/md5 } type = 11 (certificate) length = 709 (0x0002c5) certificatechain { chainlength = 706 (0x02c2) certificate { size = 703 (0x02bf) data = {
saved in file 'cert.001' } } } type = 12 (server_key_exchange) length = 202 (0x0000ca) type = 14 (server_hello_done) length = 0 (0x000000) } } ] --> [ sslrecord { type = 22 (handshake) version = { 3,0 } length = 68 (0x44) handshake { type = 16 (client_key_exchange) length = 64 (0x000040...
Rhino serialization
serialization provides a way to
save the state of an object and write it out to a file or send it across a network connection.
...these objects will also be
saved as markers upon serialization and resolved in the new scope upon deserialization.
...(it might be possible to
save the java bytecodes in an array and then load the class upon deserialization, but at best that would eat up a lot of memory for just this feature.) one way around this is to compile the functions using the jsc tool: $ cat f.js function f() { return 3; } $ java -classpath js.jarorg.mozilla.javascript.tools.jsc.main f.js $ cat test2.js loadclass("f"); serialize(f, "f.ser"); g = deserialize("f.ser");...
JSExceptionState
this is used to
save and restore exception states.
... syntax struct jsexceptionstate; description a jsexceptionstate object is returned by the js_
saveexceptionstate function, and is passed to functions js_restoreexceptionstate and js_dropexceptionstate.
... see also mxr id search for jsexceptionstate js_
saveexceptionstate js_restoreexceptionstate js_dropexceptionstate ...
JS_DropExceptionState
destroys a jsexceptionstate object previously created using js_
saveexceptionstate.
...this object should previously have been created using js_
saveexceptionstate.
... see also mxr id search for js_dropstateexception jsexceptionstate js_
saveexceptionstate js_restoreexceptionstate ...
JSAPI reference
obsolete since jsapi 25 js::currentglobalornull added in spidermonkey 31 js_getglobalforscopechain obsolete since jsapi 25 js_getglobalobject obsolete since jsapi 24 js_setglobalobject obsolete since jsapi 25 js_initclass js_initstandardclasses js_resolvestandardclass js_enumeratestandardclasses js_enumerateresolvedstandardclasses obsolete since jsapi 24 js_isrunning js_
saveframechain js_restoreframechain js_isassigning obsolete since javascript 1.8.5 js_isconstructing obsolete since jsapi 26 js_isconstructing_possiblywithgiventhisobject obsolete since jsapi 17 js_getscopechain obsolete since javascript 1.8.7 compartments: class jsautocompartment added in spidermonkey 24 js_newglobalobject added in spidermonkey 17 js_entercompartment added in spiderm...
...efunction added in spidermonkey 17 js_decompilefunction js_decompilefunctionbody js_compilefunction obsolete since jsapi 36 js_compilefunctionforprincipals obsolete since jsapi 28 js_compileucfunction obsolete since jsapi 36 js_compileucfunctionforprincipals obsolete since jsapi 28 error handling struct jserrorformatstring added in spidermonkey 17 class jserrorreport class js::auto
saveexceptionstate added in spidermonkey 31 enum jsexntype added in spidermonkey 17 js_reporterror js_reportwarning js_reporterrornumber js_reporterrornumberuc js_reporterrorflagsandnumber js_reporterrorflagsandnumberuc js_reporterrornumberucarray added in spidermonkey 24 js_reportoutofmemory js_reportallocationoverflow added in spidermonkey 1.8 js_geterrorreporter js_seterrorreporterobsol...
...is_warning jsreport_is_strict_mode_error the following functions allow c/c++ functions to throw and catch javascript exceptions: js::createerror added in spidermonkey 38 js_isexceptionpending js_getpendingexception js_setpendingexception js_clearpendingexception js_throwstopiteration added in spidermonkey 1.8 js_isstopiteration added in spidermonkey 31 typedef jsexceptionstate js_
saveexceptionstate js_restoreexceptionstate js_dropexceptionstate these functions translate errors into exceptions and vice versa: js_reportpendingexception js_errorfromexception js_throwreportederror obsolete since jsapi 29 values and types typedef jsval js::value js::value constructors: js::nullvalue added in spidermonkey 24 js::undefinedvalue added in spidermonkey 24 js::...
Web Replay
open a
saved recording in a new tab click the 'tools -> web developer -> web replay -> open new recording tab' menu item to open a new blank tab that is recorded.
...
save recording and replay on the same machine clicking the 'tools -> web developer -> web replay ->
save recording' menu item when a recording tab is open will allow the entire recording to be
saved to a file.
...
save recording and replay on a different machine (partially implemented) recordings can be replayed on a different machine from the one which recorded them.
Places Developer Guide
saved searches new in firefox 3 is the ability to
save searches of bookmarks or history.
... these
saved searches appear as folders in your bookmarks, with a special icon to signify their difference from normal folders.
...
saved searches can be formulated as uris, and added to the bookmarks collection as a normal bookmark.
Using XPCOM Utilities to Make Things Easier
to avoid these kinds of redundancies, to regulate the way generic code is written, and to
save typing, xpcom providesgeneric module macros that expand into the module code you've already seen.
... using these declaration macros not only
saves a tremendous amount of time when you're writing the code, it can also
save time if you make changes to your idl file, since the c++ header file will then automatically include the updated list of methods to be supported.
...in xpcom, this tool is the nscomptr, orsmart pointer class, which can
save you countless hours and simplify your code when you're dealing with interface pointers.
mozIPersonalDictionary
n wstring word, in wstring lang); boolean check(in wstring word, in wstring lang); void endsession(); void getcorrection(in wstring word, [array, size_is(count)] out wstring words, out pruint32 count); void ignoreword(in wstring word); void load(); void removecorrection(in wstring word,in wstring correction, in wstring lang); void removeword(in wstring word, in wstring lang); void
save(); attributes attribute type description wordlist nsistringenumerator get the (lexicographically sorted) list of words.
...
save()
saves the dictionary.
... void
save(); parameters none.
nsIContentViewer
aprintsettings); 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.
...this is used to clear out the
saved presentation state.
... note: if the document is currently being printed, it will not be
saved in session history.
nsIExternalHelperAppService
riloader/external-helper-app-service;1"] .getservice(components.interfaces.nsiexternalhelperappservice); method overview boolean applydecodingforextension(in autf8string aextension, in acstring aencodingtype); nsistreamlistener docontent(in acstring amimecontenttype, in nsirequest arequest, in nsiinterfacerequestor awindowcontext, in boolean aforce
save); methods applydecodingforextension() determines whether or not data whose filename has the specified extension should be decoded from the specified encoding type before being
saved or delivered to helper applications.
...nsistreamlistener docontent( in acstring amimecontenttype, in nsirequest arequest, in nsiinterfacerequestor awindowcontext, in boolean aforce
save ); parameters amimecontenttype the content type of the incoming data.
... aforce
save true to always
save this content to disk, regardless of nsimimeinfo and other such influences.
nsIPrefService
inherits from: nsisupports last changed in gecko 1.7 method overview nsiprefbranch getbranch(in string aprefroot); nsiprefbranch getdefaultbranch(in string aprefroot); void readuserprefs(in nsifile afile); void resetprefs(); void resetuserprefs(); void
savepreffile(in nsifile afile); methods getbranch() call to get a preferences "branch" which accesses user preference data.
...
savepreffile() called to write current preferences state to a file.
... note: if nsnull is passed in for the afile parameter the preference data is written out to the current preferences file (usually prefs.js.) void
savepreffile( in nsifile afile ); parameters afile the file to be written.
nsISmsDatabaseService
to create an instance, use: var smsservice = components.classes["@mozilla.org/sms/smsdatabaseservice;1"] .createinstance(components.interfaces.nsismsdatabaseservice); method overview long
savereceivedmessage(in domstring asender, in domstring abody, in unsigned long long adate); long
savesentmessage(in domstring areceiver, in domstring abody, in unsigned long long adate); void getmessage(in long messageid, in long requestid, [optional] in unsigned long long processid); void deletemessage(in long messageid, in long requestid, [optional] in unsigned long long processid); void cre...
...t(in nsidommozsmsfilter filter, in boolean reverse, in long requestid, [optional] in unsigned long long processid); void getnextmessageinlist(in long listid, in long requestid, [optional] in unsigned long long processid); void clearmessagelist(in long listid); void markmessageread(in long messageid, in boolean value, in long requestid, [optional] in unsigned long long processid) methods
savereceivedmessage() void
savereceivedmessage( in domstring asender, in domstring abody, in unsigned long long adate ); parameters asender a domstring with the sender of the text message.
...
savesentmessage() void
savesentmessage( in domstring a receiver, in domstring abody, in unsigned long long adate ); parameters areceiver a domstring with the receiver of the text message.
nsIUpdateManager
1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsiupdate getupdateat(in long index); void
saveupdates(); attributes attribute type description activeupdate nsiupdate an nsiupdate object describing the currently in use update.
...
saveupdates()
saves all updates to disk.
... void
saveupdates(); parameters none.
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
the
saved stacks // are new, and firefox doesn't yet understand that they // are safe for chrome code to use, so we must tell it // so explicitly.
... var totals = new map; for (let [site, count] of counts) { for(;;) { if (!totals.has(site)) totals.set(site, 0); totals.set(site, totals.get(site) + count); if (!site) break; site = site.parent; } } // compute parent-to-child links, since
saved stack frames // have only parent links.
...(if you get an error complaining that components.utils is not defined, be sure you've selected browser from the scratchpad's environment menu, as described in step 2.)
save the following html text to a file, and visit the file in your browser.
Edit CSS filters - Firefox Developer Tools
you can
save the current filter to the preset list: click to edit the filter, display the preset list by clicking the icon as shown below.
... you can then apply
saved filters to new elements.
... to apply one of your
saved presets, click its name in the list.
UI Tour - Firefox Developer Tools
the performance tool's ui consists of 4 main pieces: toolbar recordings pane recording overview details pane, which may contain any one of: waterfall call tree flame chart toolbar the toolbar contains buttons to: start and stop a recording import a recording you previously
saved clear the recordings pane.
... note that if you do this, you lose any recordings you have not
saved.
...to
save the recording as a json file click "
save".
Responsive Design Mode - Firefox Developer Tools
note: the device you select when in responsive design mode and the orientation (portrait or landscape) is
saved between sessions.
... orientation (portrait or landscape) - this setting persists between sessions screenshots are
saved to firefox's default download location.
... creating custom devices you can create and
save custom devices in responsive design mode by clicking the add custom device button.
Style Editor - Firefox Developer Tools
you can
save any changes you've made to the style sheet to your local computer by clicking the
save button in the bottom-right corner of each sheet's entry in the list.
...once you're satisfied with your changes, you can
save a copy locally by clicking the
save button on the sheet's entry in the style sheet pane.
...with sass you can do this simply by passing the --watch option: sass index.scss:index.css --watch next,
save the original source in the style editor by clicking the "
save" button next to the file, and saving it over the original file.
Compositing example - Web APIs
dd = document.createelement("dd"); var p = document.createelement("p"); p.textcontent = gcotext.pop(); dd.appendchild(p); var canvastodrawon = createcanvas(); var canvastodrawfrom = createcanvas(); var canvastodrawresult = createcanvas(); var ctx = canvastodrawresult.getcontext('2d'); ctx.clearrect(0, 0, width, height) ctx.
save(); ctx.drawimage(canvas1, 0, 0, width/2, height/2); ctx.globalcompositeoperation = pop; ctx.drawimage(canvas2, 0, 0, width/2, height/2); ctx.globalcompositeoperation = "source-over"; ctx.fillstyle = "rgba(0,0,0,0.8)"; ctx.fillrect(0, height/2 - 20, width/2, 20); ctx.fillstyle = "#fff"; ctx.font = "14px arial"; ctx.filltext(po...
...p, 5, height/2 - 5); ctx.restore(); var ctx = canvastodrawon.getcontext('2d'); ctx.clearrect(0, 0, width, height) ctx.
save(); ctx.drawimage(canvas1, 0, 0, width/2, height/2); ctx.fillstyle = "rgba(0,0,0,0.8)"; ctx.fillrect(0, height/2 - 20, width/2, 20); ctx.fillstyle = "#fff"; ctx.font = "14px arial"; ctx.filltext('existing content', 5, height/2 - 5); ctx.restore(); var ctx = canvastodrawfrom.getcontext('2d'); ctx.clearrect(0, 0, width, height) ctx.
save(); ctx.drawimage(canvas2, 0, 0, width/2, height/2); ctx.fillstyle = "rgba(0,0,0,0.8)"; ctx.fillrect(0, height/2 - 20, width/2, 20); ctx.fillstyle = "#fff"; ctx.font = "14px arial"; ct...
... var lightmix = function() { var ctx = canvas2.getcontext("2d"); ctx.
save(); ctx.globalcompositeoperation = "lighter"; ctx.beginpath(); ctx.fillstyle = "rgba(255,0,0,1)"; ctx.arc(100, 200, 100, math.pi*2, 0, false); ctx.fill() ctx.beginpath(); ctx.fillstyle = "rgba(0,0,255,1)"; ctx.arc(220, 200, 100, math.pi*2, 0, false); ctx.fill() ctx.beginpath(); ctx.fillstyle = "rgba(0,255,0,1)"; ctx.arc(160, 100, 100, math.pi*2, 0, false); ctx.fi...
Compositing and clipping - Web APIs
75, 75); // create a circular clipping path ctx.beginpath(); ctx.arc(0, 0, 60, 0, math.pi * 2, true); ctx.clip(); // draw background var lingrad = ctx.createlineargradient(0, -75, 0, 75); lingrad.addcolorstop(0, '#232256'); lingrad.addcolorstop(1, '#143778'); ctx.fillstyle = lingrad; ctx.fillrect(-75, -75, 150, 150); // draw stars for (var j = 1; j < 50; j++) { ctx.
save(); ctx.fillstyle = '#fff'; ctx.translate(75 - math.floor(math.random() * 150), 75 - math.floor(math.random() * 150)); drawstar(ctx, math.floor(math.random() * 4) + 2); ctx.restore(); } } function drawstar(ctx, r) { ctx.
save(); ctx.beginpath(); ctx.moveto(r, 0); for (var i = 0; i < 9; i++) { ctx.rotate(math.pi / 5); if (i % 2 === 0) { ctx...
...clipping paths are also part of the canvas
save state.
... if we wanted to keep the original clipping path we could have
saved the canvas state before creating the new one.
Pixel manipulation with canvas - Web APIs
we will also look into how image smoothing (anti-aliasing) can be controlled and how to
save images from your canvas.
... note: be aware that if the canvas contains any pixels that were obtained from another origin without using cors, the canvas is tainted and its contents can no longer be read and
saved.
... once you have generated a data uri from you canvas, you are able to use it as the source of any <image> or put it into a hyper link with a download attribute to
save it to disc, for example.
Timing element visibility with the Intersection Observer API - Web APIs
since it's theoretically possible to get called multiple times, we only proceed if we haven't already paused the timers and
saved the visibility states of the existing ads.
... then, for each of the visible ads, we
save the value of dataset.totalviewtime (the total number of milliseconds the ad has currently been visible, as of the last time it was updated) and then call updateadtimer() to update the time.
...we then report that data; in this case, by logging it to console, but in the real world, you'd submit the information to an ad service's api or
save it into a database.
WebGL model view projection - Web APIs
etelementbyid('canvas'); this.canvas.width = window.innerwidth; this.canvas.height = window.innerheight; this.gl = mdn.createcontext(canvas); var gl = this.gl; // setup a webgl program, anything part of the mdn object is defined outside of this article this.webglprogram = mdn.createwebglprogramfromids(gl, 'vertex-shader', 'fragment-shader'); gl.useprogram(this.webglprogram); //
save the attribute and uniform locations this.positionlocation = gl.getattriblocation(this.webglprogram, 'position'); this.colorlocation = gl.getuniformlocation(this.webglprogram, 'color'); // tell webgl to test the depth when drawing, so if a square is behind // another square it won't be drawn gl.enable(gl.depth_test); } webglbox draw now we'll create a method to draw a box on the scr...
...the locations for the uniforms are
saved in the locations object shown below: this.locations.model = gl.getuniformlocation(webglprogram, 'model'); and finally the uniform is set to that location.
...float w = (1.0 + transformedposition.z) * scalefactor; //
save the new gl_position with the custom w component gl_position = vec4(transformedposition.xyz, w); the results view on jsfiddle see that small dark blue triangle?
A simple RTCDataChannel sample - Web APIs
we'll cover the mechanics of accomplishing the connection and transmitting and receiving data, but we will
save the bits about locating and linking to a remote computer for another example.
...this is
saved, and we set up, on the channel, event listeners for the events we want to handle.
...then all the
saved references to these objects are set to null to avoid accidental reuse, and the user interface is updated to reflect the fact that the connection has been closed.
Rendering and the WebXR frame animation callback - Web APIs
next, the time elapsed since the previous frame was rendered is calculated by subtracting from the current time as specified by the currentframetime parameter the
saved time at which the last frame was rendered, lastframetime.
...this elapsed time is
saved in the variable deltatime, and the value of lastframetime is replaced with this frame's time, ready to compute the differential for the next frame.
...in some cases, this
saves time later.
The HTML autocomplete attribute - HTML: Hypertext Markup Language
for instance, a browser might let the user
save their name, address, phone number, and email addresses for autocomplete purposes.
... perhaps the browser offers the ability to
save encrypted credit card information, for autocompletion following an authentication procedure.
... note: in most modern browsers, setting autocomplete to "off" will not prevent a password manager from asking the user if they would like to
save username and password information, or from automatically filling in those values in a site's login form.
MIME types (IANA media types) - HTTP
with the exception of multipart/form-data, used in the post method of html forms, and multipart/byteranges, used with 206 partial content to send part of a document, http doesn't handle multipart documents in a special way: the message is transmitted to the browser (which will likely show a "
save as" window if it doesn't know how to display the document).
...they treat it as if the content-disposition header was set to attachment, and propose a "
save as" dialog.
...for security reasons, most browsers do not allow setting a custom default action for such resources, forcing the user to
save it to disk to use it.
HTTP Index - HTTP
it lets caches be more efficient and
save bandwidth, as a web server does not need to resend a full response if the content has not changed.
...there are three main cases this header is used: 177
save-data http, http header, reference, request header,
save-data, header the
save-data header field is a boolean which, in requests, indicates the client's preference for reduced data usage.
...such a request can be done before deciding to download a large resource to
save bandwidth, for example.
Proxy Auto-Configuration (PAC) file - HTTP
the auto-config file should be
saved to a file with a .pac filename extension: proxy.pac and the mime type should be set to: application/x-ns-proxy-autoconfig next, you should configure your server to map the .pac filename extension to the mime type.
... 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.
...there is no additional syntax needed to
save it into a file and use it.
Namespaces crash course - SVG: Scalable Vector Graphics
take some time to understand namespaces now and it will
save you all sorts of headaches in the future.
...knowing this will
save you some confusion if you come across markup like in the following example: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <body> <h1>svg embedded inline in xhtml</h1> <svg:svg width="300px" height="200px"> <svg:circle cx="150" cy="100" r="50" fill="#ff0000"/> </svg:svg> </body> </html> note that because a namespace prefix is used...
...it may
save you from some annoying errors if you end up adding content from one of the unused namespaces at a later date.
Compiling a New C/C++ Module to WebAssembly - WebAssembly
take a copy of the following simple c example, and
save it in a file called hello.c in a new directory on your local drive: #include <stdio.h> int main(int argc, char ** argv) { printf("hello world\n"); } now, using the terminal window you used to enter the emscripten compiler environment, navigate to the same directory as your hello.c file, and run the following command: emcc hello.c -s wasm=1 -o hello.html the options we’ve passed...
... first of all,
save the following c code in a file called hello2.c, in a new directory: #include <stdio.h> int main(int argc, char ** argv) { printf("hello world\n"); } search for the file shell_minimal.html in your emsdk repo.
... to start with,
save the following code as hello3.c in a new directory: #include <stdio.h> #include <emscripten/emscripten.h> int main(int argc, char ** argv) { printf("hello world\n"); } #ifdef __cplusplus extern "c" { #endif void emscripten_keepalive myfunction(int argc, char ** argv) { printf("myfunction called\n"); } #ifdef __cplusplus } #endif by default, emscripten-generated code always just c...
Using the WebAssembly JavaScript API - WebAssembly
grab our simple.wasm file and
save a copy in a new directory on your local machine.
...if you
save your example code now and load it a browser that supports webassembly, you’ll see this in action!
...for example, to write 42 directly into the first word of linear memory, you can do this: new uint32array(memory.buffer)[0] = 42; you can then return the same value using: new uint32array(memory.buffer)[0] try this now in your demo —
save what you’ve added so far, load it in your browser, then try entering the above two lines in your javascript console.
simple-storage - Archive of obsolete content
var ss = require("sdk/simple-storage"); ss.foo = "i will not be
saved!
....storage.value); } }); require("sdk/ui/button/action").actionbutton({ id: "delete", label: "delete", icon: "./delete.png", onclick: function() { delete ss.storage.value; console.log("deleting value"); } }); if you run it, you'll see that after clicking "read" after clicking "delete" gives you the expected output: info: undefined note that to run this add-on you'll have to
save icon files named "write.png", "read.png", and "delete.png" to the add-on's "data" directory.
Implementing the widget - Archive of obsolete content
ontent 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.
... either way,
save them in your data/widget directory.
Getting Started (jpm) - Archive of obsolete content
save the file.
... next, create a directory called "data" in your add-on's root, mkdir data and
save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png back at the command prompt, type: jpm run this is the jpm command to run a new instance of firefox with your add-on installed.
Getting started (cfx) - Archive of obsolete content
open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://www.mozilla.org/"); }
save the file.
... next,
save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png back at the command prompt, type: cfx run this is the sdk command to run a new instance of firefox with your add-on installed.
Modifying Web Pages Based on URL - Archive of obsolete content
to do this, you need to:
save the script in add-on's data directory.
... 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...
Modifying the Page Hosted by a Tab - Archive of obsolete content
here's a simple example: 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({ contentscript: 'document.body.style.border = "5px solid red";' }); } }); to run this example,
save an icon file named "icon-16.png" in add-on's "data" directory.
... 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...
Dialogs and Prompts - Archive of obsolete content
displaying the standard "open file"/"
save file"/"select folder" dialogs nsifilepicker prompts and the prompt service now that you understand dialogs, let's examine prompts.
... links nsipromptservice open and
save dialogs see also alerts and notifications ...
File I/O - Archive of obsolete content
eunique(): components.utils.import("resource://gre/modules/fileutils.jsm"); var file = fileutils.getfile("tmpd", ["suggestedname.tmp"]); file.createunique(components.interfaces.nsifile.normal_file_type, fileutils.perms_file); // do whatever you need to the created file alert(file.path); user input via nsifilepicker the file picker component, nsifilepicker, can be used to open standard open /
save dialogs.
...an example below shows how you should
save a path in user prefs.
Preferences - Archive of obsolete content
however, there is a concept of complex types, which makes it easier for developers to
save and load nsilocalfile and nsisupportsstring objects in preferences (as strings — note that from the preferences system's point of view, complex values have a nsiprefbranch.pref_string type.) there are two nsiprefbranch methods implementing the concept — setcomplexvalue() and getcomplexvalue().
... javascript wrappers for preferences system there are a few javascript wrappers to make your life easier: http://mozilla.doslash.org/prefutils chrome://global/content/nsusersettings.js https://wiki.mozilla.org/labs/js_modules how to
save preferences to
save preferences into the default location: var prefservice = components.classes["@mozilla.org/preferences-service;1"] .getservice(components.interfaces.nsiprefservice); prefservice.
savepreffile(null); checking for existence of a key if you try to get the value of a nonexistent preference, an error will be thrown: error: ns_error_unexpected: com...
Installing Extensions and Themes From Web Pages - Archive of obsolete content
users can
save the xpi file to disk easily by right clicking on the link and choosing "
save link as..." when the link is clicked it calls the function install passing the event object as the parameter.
...well, xpi is a mozilla-specific extension and so we can have special handling for it, but jar is not - not all .jar files are firefox themes, so if you click on a .jar link you'll be shown the
save as decision dialog.
Adding windows and dialogs - Archive of obsolete content
they have been thoroughly tested for os integration, accessbility and localization, so you
save yourself a lot of work and favor them.
... using the prompt service will
save you a lot of xul coding, and you'll be at ease knowing that you're using mozilla's tried and tested code.
Index of archived content - Archive of obsolete content
syncing custom preferences force rtl gre gre registration gecko coding help wanted http class overview hacking wiki help viewer creating a help content pack helper apps (and a bit of
save as) hidden prefs how to write and land nanojit patches io guide/directory keys introducing the audio api extension isp data java in firefox extensions javascript os.shared javascript crypto crmf request object generatecrmfrequest() importusercertificates ...
...p_destroystream npp_getvalue npp_handleevent npp_new npp_newstream npp_print npp_setvalue npp_setwindow npp_streamasfile npp_urlnotify npp_write npp_writeready npprint npprintcallbackstruct nprect npregion np
saveddata npsetwindowcallbackstruct npstream npstring nputf8 npvariant npvarianttype npwindow np_getmimedescription np_getvalue np_initialize np_port np_shutdown samples and test cases shipping a plugin as a toolkit b...
Working with BFCache - Archive of obsolete content
or is the dom
saved in some way as if the window was there but invisible?
...q: hmm, so what event tells me “you'll never get a pageshow so you can drop the megabytes of info you've
saved in firebug side table for that page?” a: an observer notification with the topic "inner-window-destroyed" whose subject is an nsisupportspruint64 containing the window id of the inner window being destroyed.
Getting Started - Archive of obsolete content
:chrome/my_theme.jar!/mozapps/ skin messenger my_theme jar:chrome/my_theme.jar!/messenger/ skin messenger-newsblog my_theme jar:chrome/my_theme.jar!/messenger-newsblog/ skin communicator my_theme jar:chrome/my_theme.jar!/communicator/ skin help my_theme jar:chrome/my_theme.jar!/help/ skin navigator my_theme jar:chrome/my_theme.jar!/navigator/ skin editor my_theme jar:chrome/my_theme.jar!/editor/
save the file and exit the text editor.
...change the background-color: to darkblue and the color: to white, and
save the file.
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
<rdf:li resource="urn:mozilla:skin:my_theme:communicator"/> <rdf:li resource="urn:mozilla:skin:my_theme:editor"/> <rdf:li resource="urn:mozilla:skin:my_theme:global"/> <rdf:li resource="urn:mozilla:skin:my_theme:messenger"/> <rdf:li resource="urn:mozilla:skin:my_theme:navigator"/>
save the file and exit the text editor.
... change the background-color: to darkblue and the color: to white, and
save the file.
Download Manager preferences - Archive of obsolete content
browser.download.usedownloaddir a boolean value that indicates whether or not the user's preference is to automatically
save files into the download directory.
... preference description browser.download.dir a local folder the user may have selected for downloaded files to be
saved.
Code snippets - Archive of obsolete content
choose "
save link".
...resource://services-sync/main.js"); components.utils.import("resource://services-sync/resource.js"); components.utils.import("resource://services-sync/record.js"); // for example: let id = "iasokuozpixz" let collection = "bookmarks"; let resource = new resource(weave.service.storageurl + collection + "/" + id); let del = new cryptowrapper(collection, id); del.deleted = true; del.encrypt(); //
save the old value.
JavaScript Client API - Archive of obsolete content
mplementation: function foorecord(collection, id) { cryptowrapper.call(this, collection, id); } foorecord.prototype = { __proto__: cryptowrapper.prototype, _logname: "record.foo", ttl: foo_ttl, // optional get bar() this.cleartext.bar, set bar(value) { this.cleartext.bar = value; }, get baz() this.cleartext.baz, set baz(value) { this.cleartext.baz = value; } }; to
save all that typing for declaring the getters and setters, you can also use utils.defergetset: function foorecord(collection, id) { cryptowrapper.call(this, collection, id); } foorecord.prototype = { __proto__: cryptowrapper.prototype, _logname: "record.foo", ttl: foo_ttl // optional }; utils.defergetset(foorec, "cleartext", ["bar", "baz"]); the store object the store object (which exten...
...i
saved it for last because it requires the least code.
Supporting private browsing mode - Archive of obsolete content
var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); var inprivatebrowsingmode = pbs.privatebrowsingenabled; if (!inprivatebrowsingmode) { /*
save private information */ } in the above example, we only
save the user's private information if not in private browsing mode.
...var pbs = components.classes["@mozilla.org/privatebrowsing;1"] .getservice(components.interfaces.nsiprivatebrowsingservice); var oldprivatemode = pbs.privatebrowsingmode; pbs.privatebrowsingenabled = true; /* this is all private */ pbs.privatebrowsingenabled = oldprivatemode; in this example, we
save the current state of the private browsing mode setting in the oldprivatemode variable, then turn on private browsing by setting its value to true.
Tamarin mercurial commit hook - Archive of obsolete content
if you choose to abort the commit, the commit message will be
saved to .hg/commit.
save.
... this allows you to reuse the commit message after fixing the issue by using the -l (--logfile) option: hg commit -l /reporoot/.hg/commit.
save notes at the moment this is a local-only hook and is not enforced on the server.
XML in Mozilla - Archive of obsolete content
w3c recommendation xpointer xmlns() scheme obsolete since gecko 1.9.1 w3c recommendation xpointer fixptr() scheme obsolete since gecko 1.9.1 this scheme is simply a wrapper for fixptr xpointer xpath1() scheme obsolete since gecko 1.9.1 internet-draft document.load(), document.async part of dom level 3 load &
save module, a w3c working draft xhtml we have reasonable xhtml support, most things should work.
...add this line: pref("layout.selectanchor", true); dom load and
save methods document.load() is a part of an old version of the w3c dom level 3 load &
save module.
setPackageFolder - Archive of obsolete content
description the setpackagefolder method to set the default package folder that is
saved with the root node.
...if you call setpackagefolder multiple times, the last folder set is the folder that is
saved in the client version registry and used as the default for other installations.
Accessing Files - Archive of obsolete content
other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and
save dialogs, reading textual data, writing textual data, list of file-related error codes.
...this is a convenient location where an extension might
save a file it needs to use.
Getting File Information - Archive of obsolete content
other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and
save dialogs, reading textual data, writing textual data, list of file-related error codes.
... var filesize = 0; var file = io.getfile("desktop", "
saved file"); if (file.exists()) filesize = file.filesize; it is also possible to modify the size of a file by setting the filesize (nsifile.attributes) attribute to a value.
Menus - Archive of obsolete content
editable text context-openlink opens a link in a new window links context-openlinkintab opens a link in a new tab links context-bookmarklink bookmarks a link links context-
savelink
saves a link links context-sendlink sends a link in an email links context-copyemail copies an email address mailto: links context-copylink copies a link links context-viewimage views an image at full size images context-copyimage-contents copies an image to the clipboard images context-copyimage copi...
...es the url of an image to the clipboard images context-
saveimage
saves an image images context-sendimage sends an image in an email images context-setdesktopbackground sets an image as the desktop background images context-blockimage blocks an image images context-back goes back a page context-forward goes forward a page context-reload reloads a page context-stop stops loading a page context-bookmarkpage bookmarks a page context-
savepage
saves a page context-sendpagetodevice send page to device context-sendpage send page in an email context-viewbgimage views a background image ...
How to Quit a XUL Application - Archive of obsolete content
getservice(components.interfaces.nsiappstartup); // eattemptquit will try to close each xul window, but the xul window can cancel the quit // process if there is un
saved data.
...terfaces.nsiappstartup.eforcequit : components.interfaces.nsiappstartup.eattemptquit; appstartup.quit(quitseverity); } </script> calling this function if there is an uncaught exception, to force the application to quit: <script> try { dosomething(); } catch (e) { quit(true); } </script> the "quit" menuitem should typically prompt the user if there is un
saved data: <menuitem label="quit" oncommand="quit(false);"/> ...
Index - Archive of obsolete content
337 sizemode xul attributes, xul reference this attribute is used to
save and restore the state of a window (together with the persist attribute) and for css styles (e.g.
... 1050 open and
save dialogs tutorials, xul, xul_tutorial a common type of dialog is one where the user can select a file to open or
save.
List of commands - Archive of obsolete content
ksoverlay.xul http://lxr.mozilla.org/seamonkey/sou...okmarkstree.js list of commands (listed alphabetically) browser:addbookmark browser:addbookmarkas browser:addgroupmarkas browser:back browser:editpage browser:find browser:findagain browser:findprev browser:forward browser:home browser:managebookmark browser:open browser:openfile browser:print browser:printpreview browser:
savepage browser:searchinternet browser:sendpage browser:uploadfile cmd_bm_copy cmd_bm_cut cmd_bm_delete cmd_bm_expandfolder cmd_bm_export cmd_bm_find cmd_bm_import cmd_bm_managefolder cmd_bm_movebookmark cmd_bm_newbookmark cmd_bm_newfolder cmd_bm_newseparator cmd_bm_open cmd_bm_openinnewtab cmd_bm_openinnewwindow cmd_bm_paste cmd_bm_properties cmd_bm_rename cmd_bm_selectall cmd...
...opyimage cmd_copylink cmd_cut cmd_delete cmd_editpage cmd_findtypelinks cmd_findtypetext cmd_gotoline cmd_handlebackspace cmd_handleshiftbackspace cmd_minimizewindow cmd_neweditor cmd_neweditordraft cmd_neweditortemplate cmd_newnavigator cmd_newnavigatortab cmd_newtabwithtarget cmd_openhelp cmd_paste - paste a selection from the clipboard cmd_printsetup cmd_quit cmd_redo cmd_
savepage cmd_scrollpagedown cmd_scrollpageup cmd_selectall cmd_switchdocumentdirection cmd_switchtextdirection cmd_textzoomenlarge cmd_textzoomreduce cmd_textzoomreset cmd_undo cmd_viewcomponentbar cmd_viewlinktoolbar cmd_viewlinktoolbar_false cmd_viewlinktoolbar_maybe cmd_viewlinktoolbar_true cmd_viewnavbar cmd_viewpersonaltoolbar cmd_viewtaskbar cmd_zoomwindow thanks for help of ...
Adding Methods to XBL-defined Elements - Archive of obsolete content
this might be used to
save information.
...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.
Creating Dialogs - Archive of obsolete content
amongst other useful attributes are buttonlabelaccept - label to appear on the accept button eg
save buttonaccesskeyaccept - access key to use for the accept button egs defaultbutton - button is activated when the enter key is pressed note: the label attributes are required by remote sites and are probably missing in the above examples due to bug 224996.
...s <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="mydialog" title="my dialog" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="window.sizetocontent();" buttons="accept,cancel" buttonlabelaccept="set favourite" buttonaccesskeyaccept="s" ondialogaccept="return do
save();" buttonlabelcancel="cancel" buttonaccesskeycancel="n" ondialogcancel="return docancel();"> <script> function do
save(){ //dosomething() return true; } function docancel(){ return true; } </script> <dialogheader title="my dialog" description="example dialog"/> <groupbox flex="1"> <caption label="select favourite fruit"/> <radio id="orange" label="oranges because...
Features of a Window - Archive of obsolete content
gecko 1.9.2 note starting in gecko 1.9.2 (firefox 3.6), overriding the position of a window using window features will not change the persisted values
saved by the session store feature.
... that means the next time the window is opened, it will still open in the
saved location.
Property Files - Archive of obsolete content
you can and should write non-ascii characters directly without escape sequences, and
save the file as utf-8 without bom.
... double-check the
save options of your text editor, because many don't do this by default.
Simple Menu Bars - Archive of obsolete content
example of a simple menu bar example 1 : source view <toolbox flex="1"> <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menuitem label="new"/> <menuitem label="open"/> <menuitem label="
save"/> <menuseparator/> <menuitem label="exit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> </toolbox> here, a simple menu bar is created using the menubar element.
... label the text to appear on the menu item, such as open or
save.
Skinning XUL Files by Hand - Archive of obsolete content
to work with this xul file,
save it locally and rename itsample1.xul.
... add the following lines to the file: @import url(chrome://global/skin/); box#bbox { background-color: lightgrey; } button#rd { background-color: red; color: white; }
save it in the same directory as your xul file.
Using the Editor from XUL - Archive of obsolete content
in both cases, the editorcanclose() method is the javascript is called, which causes the nseditorshell to display a dialog asking the user if they want to
save the document, throw away their changes, or cancel.
... if the user chooses to
save the document, or throw away their changes, then the window is closed.
window - Archive of obsolete content
<radiogroup> <vbox> <hbox> <label control="your-fname" value="enter first name:"/> <textbox id="your-fname" value="johan"/> </hbox> <hbox> <label control="your-lname" value="enter last name:"/> <textbox id="your-lname" value="hernandez"/> </hbox> <hbox> <button oncommand="alert('
save!')"> <description>
save</description> </button> </hbox> </vbox> </radiogroup> </groupbox> </vbox> </window> attributes accelerated type: booleanset this attribute to true to allow hardware layer managers to accelerate the window.
... this attribute is used to
save and restore the state of a window (together with the persist attribute) and for css styles (e.g.
NPN_MemAlloc - Archive of obsolete content
if you allocate
saved instance data with npp_destroy, be sure to use npn_memalloc to allocate memory.
... this ensures that the browser can free the
saved data at a later time with the equivalent of npn_memfree.
Scratchpad - Archive of obsolete content
editing the scratchpad window looks something like this (on macos the menu bar is at the top of the screen): the file menu offers options to
save and load javascript code snippets, so you can reuse code later if you like.
... run scratchpad code, display the result in the object inspector ctrl + i cmd + i ctrl + i run scratchpad code, insert the result as a comment ctrl + l cmd + l ctrl + l re-evaluate current function ctrl + e cmd + e ctrl + e reload the current page, then run scratchpad code ctrl + shift + r cmd + shift + r ctrl + shift + r
save the pad ctrl + s cmd + s ctrl + s open an existing pad ctrl + o cmd + o ctrl + o create a new pad ctrl + n cmd + n ctrl + n close scratchpad ctrl + w cmd + w ctrl + w pretty print the code in scratchpad ctrl + p cmd + p ctrl + p show autocomplete suggestions ctrl + space ctrl + space ctrl + space ...
ActiveXObject - Archive of obsolete content
excelsheet.activesheet.cells(1,1).value = "this is column a, row 1"; //
save the sheet.
... excelsheet.
saveas("c:\\test.xls"); // close excel with the quit method on the application object.
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
npp_getvalue implementation and possible scenario of scriptable object life cycle #include "nsitestplugin.h" nperror npp_new(npmimetype plugintype, npp instance, uint16 mode, int16 argc, char* argn[], char* argv[], np
saveddata*
saved) { if(instance == null) return nperr_invalid_instance_error; // just prime instance->pdata with null for the purpose of this example // it will be assigned to the scriptable interface later to keep its // association with the specific plugin instance instance->pdata = null; return rv; } nperror npp_getvalue(npp instance, nppvariable variable, void *valu...
...ion } // add reference for the caller requesting the object ns_addref(scriptablepeer); *(nsisupports **)value = scriptablepeer; } else if (variable == nppvpluginscriptableiid) { nsiid* ptr = (nsiid *)npn_memalloc(sizeof(nsiid)); *ptr = scriptableiid; *(nsiid **)value = ptr; } return rv; } nperror npp_destroy (npp instance, np
saveddata**
save) { if(instance == null) return nperr_invalid_instance_error; // release the scriptable object ns_if_release(instance->pdata); } original document information author(s): arun k.
Move the ball - Game development
add the following two new lines indicated below to your draw() function: function draw() { ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; }
save your code again and try it in your browser.
... add the following highlighted new line to the draw() function: function draw() { ctx.clearrect(0, 0, canvas.width, canvas.height); ctx.beginpath(); ctx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; }
save your code and try again, and this time you'll see the ball move without a trail.
Initialize the framework - Game development
using your favourite text editor, create a new html document,
save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev phaser workshop - lesson 01: initialize the framework</title> <style>* { padding: 0; margin: 0; }</style> <script src="js/phaser.min.js"></script> </head> <body> <script> var game = new phaser.game(480, 320, phaser.canvas, null, { ...
...
save the phaser code inside a /js directory in the same location as your index.html file.
WAI-ARIA basics - Learn web development
at this point, take a copy of our form-validation.html and validation.js files, and
save them in a local directory.
...update the <input> elements like so: <input type="text" name="name" id="name" aria-required="true"> <input type="number" name="age" id="age" aria-required="true"> if you
save the example now and test it with a screenreader, you should hear something like "enter your name star, required, edit text".
Creating fancy letterheaded paper - Learn web development
starting point to get this assessment started, you should: make local copies of the html and css —
save them as index.html and style.css in a new directory.
...
save local copies of the top, bottom and logo images in the same directory as your code files.
Floats - Learn web development
turient montes, nascetur ridiculus mus.</p> now apply the following css to your html (using a <style> element or a <link> to a separate .css file — your choice): body { width: 90%; max-width: 900px; margin: 0 auto; font: .9em/1.2 arial, helvetica, sans-serif } .box { width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } if you
save and refresh now, you'll see something much like what you'd expect — the box is sitting above the text, in normal flow.
... to float the text around it add the float and margin-right properties to the .box rule: .box { float: left; margin-right: 15px; width: 150px; height: 100px; border-radius: 5px; background-color: rgb(207,232,220); padding: 1em; } now if you
save and refresh you'll see something like the following: float example 1 <h1>simple float example</h1> <div class="box">float</div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit.
Web fonts - Learn web development
when you find each font, press on the download button, and
save the file inside the same directory as the html and css files you
saved earlier.
... after the generator has finished processing, you should get a zip file to download —
save it in the same directory as your html and css.
The HTML5 input types - Learn web development
it is a helpful aid to guide users to fill out a form accurately, and it can
save time — it is useful to know that your data is not correct immediately, rather than having to wait for a round trip to the server.
... another feature worth noting is that the values of a search field can be automatically
saved and re-used to offer auto-completion across multiple pages of the same website; this tends to happen automatically in most modern browsers.
Dealing with files - Learn web development
using your text editor, create a new file called index.html and
save it just inside your test-site folder.
...
save your html file, then load it in your web browser (double-click the file).
What will your website look like? - Learn web development
right-click the image (ctrl + click on a mac), choose
save image as..., and choose a safe place to
save your image.
... in the popup box, you can see and copy the lines of code google gives you into your text editor to
save for later.
Images in HTML - Learn web development
aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; annotating images...
...aretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; css background im...
From object to iframe — other embedding technologies - Learn web development
pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; iframes in detail...
... 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.
Video and audio content - Learn web development
to get this displayed along with the html media playback, you need to:
save it as a .vtt file in a sensible place.
... we would like you to:
save your audio and video files in a new directory on your computer.
HTML table basics - Learn web development
save your html and load it in a browser, and you should see that the headers now look like headers.
...
save and open your code in a browser to see the improvement.
Build your own function - Learn web development
when you
save your code and reload it in the browser, you'll see the little message box appear immediately, only once.
...
save them in a new folder called icons in the same location as your html file.
Looping code - Learn web development
pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; active learning...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; which loop type s...
Making decisions in your code — conditionals - Learn web development
pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; active learning: ...
...pos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caretpos = caretpos + text.length; textarea.selectionstart = caretpos; textarea.selectionend = caretpos; textarea.focus(); textarea.scrolltop = scrollpos; } // update the
saved usercode every time the user updates the text area code textarea.onkeyup = function(){ // we only want to
save the state when the user code is being shown, // not the solution, so that solution is not
saved over the user code if(solution.value === 'show solution') { userentry = textarea.value; } else { solutionentry = textarea.value; } updatecode(); }; test your skills!
Introduction to web APIs - Learn web development
client-side storage apis are becoming a lot more widespread in web browsers — the ability to store data on the client-side is very useful if you want to create an app that will
save its state between page loads, and perhaps even work when the device is offline.
...we know the response will be successfully returned and available after the load event has fired (unless an error occurred), so we
save the response containing the returned json in the superheroes variable, then pass it to two different functions for further processing.
Manipulating documents - Learn web development
add the following two lines below your first ones: div.style.width = winwidth + 'px'; div.style.height = winheight + 'px';
save and try refreshing your browser — you should now see the div become as big as your viewport, whatever size of screen your are using.
... set the text content of the span to the input element value you
saved earlier, and the text content of the button to 'delete'.
Test your skills: Strings - Learn web development
save the result inside a variable called finalquote.
... there is one more small fix to do — add a full stop onto the end of the quote, and
save the final version in a variable called finalquote.
Inheritance in JavaScript - Learn web development
you can do so by going back to your source code and adding the following line at the bottom: object.defineproperty(teacher.prototype, 'constructor', { value: teacher, enumerable: false, // so that it does not appear in 'for in' loop writable: true }); now if you
save and refresh, entering teacher.prototype.constructor should return teacher(), as desired, plus we are now inheriting from person()!
... trying the example out now that you've entered all the code, try creating an object instance from teacher() by putting the following at the bottom of your javascript (or something similar of your choosing): let teacher1 = new teacher('dave', 'griffiths', 31, 'male', ['football', 'cookery'], 'mathematics'); now
save and refresh, and try accessing the properties and methods of your new teacher1 object, for example: teacher1.name.first; teacher1.interests[0]; teacher1.bio(); teacher1.subject; teacher1.greeting(); teacher1.farewell(); these should all work just fine.
Object building practice - Learn web development
save the code so far, and load the html file in a browser.
...add the following below the balls[i].update(); line: balls[i].collisiondetect();
save and refresh the demo again, and you'll see your balls change color when they collide!
Client-Server Overview - Learn web development
a method that defines the required action (for example, to get a file or to
save or update some data).
... post request/response example an http post is made when you submit a form containing information to be
saved on the server.
Introduction to client-side frameworks - Learn web development
you can
save this new url and come back to the page later on, or share it with others so they can easily find the same page.
...they're a good solution for large projects, especially projects that require input from content writers who have limited coding ability, or for programmers who want to
save time.
React interactivity: Events and state - Learn web development
update your newtask constant declaration to this: const newtask = { id: "todo-" + nanoid(), name: name, completed: false };
save everything, and try your app again — now you can add tasks without getting that warning about duplicate ids.
...the <input /> should now look like this: <input id={props.id} type="checkbox" defaultchecked={props.completed} onchange={() => props.toggletaskcompleted(props.id)} />
save everything and return to your browser and notice that our first task, eat, is checked.
Creating our first Vue component - Learn web development
objective: to learn how to create a vue component, render it inside another component, pass data into it using props, and
save its state.
... let’s add the package to our project with npm; stop your server and enter the following command into your terminal: npm install --
save lodash.uniqueid note: if you prefer yarn, you could instead use yarn add lodash.uniqueid.
Handling common JavaScript problems - Learn web development
a lot of javascript libraries probably came into existence because their developer was writing a set of common utility functions to
save them time when writing future projects, and decided to release them into the wild because other people might find them useful too.
... next,
save copies of the fetch polyfill and the es6-promises polyfill in the same directory as the html.
Frequently Asked Questions for Lightweight themes
once a theme is installed, it is
saved in the add-ons manager, where you can enable or disable them as you wish.
... once a theme is installed, it is
saved in the add-ons manager, where you can enable or disable them as you wish.
Debugging a hang on OS X (Archived)
if you need to upload the sample to bugzilla, select all the sample text, copy it into your favorite text editor, and
save as a plain-text file.
... when you have the raw sample data, you can't just
save that and attach it to a bug, because the format is not very usable (unless the developer is a mac hacker).
Debugging on Windows
e easier: ;; mozilla (1.7beta and later) nsautostring=<mdata,su> nsstring=<mdata,su> nscstring=<mdata,s> nscautostring=<mdata,s> nsrect=x=<x,d> y=<y,d> width=<width,d>; height=<height,d> nsstaticatomwrapper=<mstaticatom->mstring,s> nsiatom=<mstring,su> ; the following are not necessary in vc8 nscomptr<*>=<mrawptr,x> nsrefptr=<mrawptr,x> nsautoptr=<mrawptr,x> after you have made the changes and
saved the file, you will need to restart visual c++ for the changes to take effect.
... (and just in-case those links die, the work-around is to execute bcdedit /set x
savedisable 1 from an elevated command-prompt to disable avx support.) got a tip?
HTTP logging
this
saves a log of http-related information from your browser run into a file that you can examine (or upload to bugzilla if a developer has asked you for a log).
... if you are using firefox >= 51, setting this option
saves only the last n megabytes of logging data, which helps keep them manageable in size.
Configuring Build Options
this
saves a considerable amount of time directly after a clobber build, so pulling in new updates and rebasing is less time-consuming.
...it also
saves you from having to export the mozconfig variable each time.
Obsolete Build Caveats and Tips
you may choose not to install the sample code and documentation to
save space and download time.
... for all sdks, you may choose not to install sample code and documentation to
save space and download time.
SVG Guidelines
if
saved as a raster image then the work to rasterize the gradients and filters takes place on the authors computer before the result is stored in the raster file.
...on the other hand, if the image is
saved as an svg image then all this work needs to be done each time the svg is displayed on someone else's computer.
Downloads.jsm
saver: optional string representing the class of the download operation.
...alternatively, may be the serializable representation of a download
saver object.
Bootstrapping a new locale
untrusted connection in the example above), like so (example for polish): <!entity certerror.pagetitle "niezaufane połączenie"> once you have translated all the <!entity> strings in this file, you should
save your work and open the next .dtd or .property file.
... for instance, if you have finished translating all the .dtd and .property files in your ~/ab-cd/browser/ directory, then you should $ cd ~/ab-cd/ $ hg status $ hg commit -m "translated browser/" $ hg push http://bitbucket.org/mozillal10n/ab-cd/ note that due to the distributed nature of hg, hg commit
saves the changes locally, i.e.
Localizing with Koala
when you are done with translating the cmd_enginemanager.label entity,
save the file.
...
save the file to
save your work.
Localizing with Mozilla Translator
if you are starting a new localization, all strings will be marked as new or updated.mt puts a fuzzy flag on each flag and
saves it in its database.
...you can
save your work in progress and reopen it to continue working by selecting view fuzzy from the edit menu.
Localizing with Pontoon
click the
save button to
save your translation.
... click the
save button to
save your translation.
Localizing without a specialized tool
<!entity cmd_enginemanager.label "manage search engines..."> <!entity searchendcap.label "search">
save the file.
...untrusted connection in the example above), like so (example for polish): <!entity certerror.pagetitle "niezaufane połączenie"> once you have translated all the <!entity> strings in this file, you should
save your work and open the next .dtd or .properties file.
SVN for Localizers
translate the content in those files,
save them and check for differences by entering this command from the command-line: svn diff this command produces output with every change made to each file.
... it's a bit hard to read, but you can also create a diff file (aka a diff patch) use svn diff > /path/to/output/file.diff to
save the output to a file.
Mozilla Development Strategies
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.
GC and CC logs
generating logs from within firefox to manually generate gc and cc logs, navigate to about:memory and use the buttons under "
save gc & cc logs." "
save concise" will generate a smaller cc log, "
save verbose" will provide a more detailed cc log.
...on firefox for android you can use the cc-dump extension to
save the files to /sdcard.
Profiling with the Firefox Profiler
sharing, saving and loading profiles after capturing and viewing a profile you will see "share..." and "
save as file..." buttons in the top-right of the window.
... type in2, : p (void)profiler_
save_profile_to_file("somepath/profile.txt") clone mstange’s handy profile analysis repository.
L20n HTML Bindings
consider the following source html: <p data-l10n-id="
save"> <input type="submit"> <a href="/main" class="btn-cancel"></a> </p> assume the following malicious translation: <
save """ <input value="
save" type="text"> or <a href="http://myevilwebsite.com" onclick="alert('pwnd!')" title="back to the homepage">cancel</a>.
... """> the result will be: <p data-l10n-id="back"> <input value="
save" type="submit"> or <a href="/main" class="btn-cancel" title="back to the homepage">cancel</a>.
AsyncTestUtils extended framework
example: let [folder, messageset] = make_folder_with_sets([{count: 3}]); this creates a new folder with a set of three messages in it and
saves the folder handle into 'folder' and the message set into 'messageset'.
... get / create the junk folder let junkfolder = get_junk_folder(); create a virtual folder (a folder whose contents are the result of a
saved search) let virtualfolder = make_virtual_folder([afoldertosearch1, afoldertosearch2, ...], {subject: "", body: "", from: "", to: "", cc: "", recipient: "", involves: ""}, aandtermstogether, aoptionalname); this is a convenience function to help you create a new virtual folder.
NSS Sample Code Sample_1_Hashing
this is an example program that demonstrates how to compute the hash of a file and
save it to another file.
... */ printashex(outfile, digest, len); } while (0); /* cleanup */ if (hashcontext != null) hash_destroy(hashcontext); return secsuccess; } /* * this sample computes the hash of a file and
saves it * to another file.
Hashing - sample 1
the nss same code below computes the hash of a file and
saves it to another file, this illustrates the use of nss message apis.
... */ printashex(outfile, digest, len); } while (0); /* cleanup */ if (hashcontext != null) hash_destroy(hashcontext); return secsuccess; } /* * this sample computes the hash of a file and
saves it * to another file.
sample1
a program to compute the hash of a file and
save it to another file.
... */ printashex(outfile, digest, len); } while (0); /* cleanup */ if (hashcontext != null) hash_destroy(hashcontext); return secsuccess; } /* * this sample computes the hash of a file and
saves it to another file.
nss tech note1
it is only needed if the template instructs the decoder to
save some data, such as for primitive component types, or for some modifiers where noted.when needed, it tells the decoder where in the target data to
save the current component.
...sec_quickderdecodeitem supports skipping the decoding of optional components if you define the tag of the component in the template sec_asn1_inner: recurse into the component and
saves its content, without the surrounding asn.1 tag and length sec_asn1_
save:
saves the component data, but does not proceed to the next component if within a sequence template array.
PKCS11 Implement
if it runs out of sessions, it uses the initial session for
saves and restores.
..._rsa_pkcs ckm_dsa c_verifyrecover ckm_rsa_pkcs c_generatekey c_generatekeypair (if token is read/write)c_generatekeypair (if token is read/write) c_generatekeypair (if token is read/write)c_generatekeypair (if token is read/write) c_wrapkey c_unwrapkey ckm_rsa_pkcs c_unwrapkey ckm_rsa_pkcs c_unwrapkey ckm_rsa_pkcs c_unwrapkey ckm_rsa_pkcs c_generaterandom c_
save (when token runs out of sessions) c_restore (when token runs out of sessions) external key tokens need to support c_decrypt and c_sign.
Renaming With Pork
this isn't strictly required, but will
save time.
...typically, make cxxflags="-wp,-k,-w0 -
save-temps" will work.
Rhino JavaScript compiler
-nosource does not
save the source in the class file.
...this option can be used to avoid distributing source or simply to
save space in the resulting class file.
Redis Tips
if you change your mind, and you want to
save the key from oblivion, you can persist it to undo the expire command.
... this adds processing time and complexity for your application, but could
save you space in redis for large data sets.
History Service Design
since places is actually not thread-safe and doing most of the work in the main-thread, adding visits (the most common action usually executed on user interaction) could end up locking the ui till the database i/o to
save data is complete.
...a smart bookmark can update itself automatically when bookmarks or visits change, providing a sort of
saved search.
Building the WebLock UI
you can
save this first, outermost part of the web lock dialog in a file called weblock.xul, which you'll be adding to an installer archive in appendix b in this book.
...note that the weblock.xul file in which the manager is defined imports only the global skin: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
save weblock.css in your working directory.
Mozilla internal string guide
nsautostring value; getvalue(value); // if the result is less than 64 code units, // then this just
saved us an allocation ...
...don't do this: class foo { public: foo() { mlocalname = new nscstring(); mtitle = new nsstring(); } ~foo() { delete mlocalname; delete mtitle; } private: // these store utf-8 and utf-16 values respectively nscstring* mlocalname; nsstring* mtitle; }; the above code may appear to
save the cost of the string objects, but nsstring/nscstring are small objects - the overhead of the allocation outweighs the few bytes you'd
save by keeping a pointer.
Index
this allows the file reference to be
saved when the form is submitted while the user is using a web application offline, so that the data can be retrieved and uploaded once the internet connection is restored.
... when firefox is in private browsing mode, firefox shouldn't
save any potentially private information.
Observer Notifications
unlike the user-interaction-active and user-interaction-inactive topics listed above, the idle service monitors user activity in general, whether related to the mozilla application or not (acting somewhat like the user activity/inactivity events a screen
saver would be interested in).
... inspector-editor-
saved - sent when changes have been
saved in the attribute-value editor.
IAccessibleText
servers only need to
save the last inserted block of text() and a scope of the entire application is adequate.
...servers only need to
save the last removed block of text() and a scope of the entire application is adequate.
nsIAnnotationService
adata binary contents of the page to
save.
... adata binary contents of the item to
save.
nsIDOMMozNetworkStatsManager
getavailablenetworks() returns available networks that used to be
saved in the database.
... getavailableservicetypes() returns available service types that used to be
saved in the database.
nsIINIParser
// get all sections in the ini file var sectenum = iniparser.getsections(); //
save the sections in an array var sections = []; while (sectenum && sectenum.hasmore()) { var section = sectenum.getnext(); // add an array entry for each section sections.push(section); } enumerating keys this example shows how to fetch the values for all the keys in the section named "setting".
... // get all keys for the "setting" section var keysenum = iniparser.getkeys("setting"); //
save the keys and values in an object var keys = {}; while (keysenum && keysenum.hasmore()) { var key = keysenum.getnext(); // create a property for each key and assing the ini value.
nsILoginManagerPrompter
.getservice(components.interfaces.nsiloginmanagerprompter); method overview void init(in nsidomwindow awindow); void prompttochangepassword(in nsilogininfo aoldlogin, in nsilogininfo anewlogin); void prompttochangepasswordwithusernames([array, size_is(count)] in nsilogininfo logins, in pruint32 count, in nsilogininfo anewlogin); void promptto
savepassword(in nsilogininfo alogin); methods init() initialize the prompter.
... promptto
savepassword() ask the user if they want to
save a login (yes, never, not now) void promptto
savepassword( in nsilogininfo alogin ); parameters alogin the login to be
saved.
Building an Account Manager Extension
the javascript file has to be
saved either in the extension's or thunderbird's component directory.
... function onpreinit(account, accountvalues) { } function oninit(pageid, serverid) { } function onaccepteditor() { } function on
save() { } function updatepage() {} step5: putting it all together // todo build an demo extension for this tutorial...
nsIPlacesImportExportService
exporthtmltofile()
saves the current bookmarks hierarchy to a bookmarks.html file.
... void exporthtmltofile( in nsilocalfile afile ); parameters afile an nsilocalfile indicating where to
save the new bookmarks.html file.
nsIScriptableIO
other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and
save dialogs, reading textual data, writing textual data, list of file-related error codes.
... sync
save: writing methods do not return until the data is properly
saved.
XUL Overlays
<menu id="file-menu"> <menupopup id="menu_filepopup"> <menuitem name="new"/> <menuitem name="open"/> <menuitem name="
save"/> <menuitem name="close"/> </menupopup> </menu> ...
...<menu id="file-menu"> <menupopup id="menu_filepopup"> <menuitem name="new"/> <menuitem name="open"/> <menuitem name="
save"/> <menuitem name="close"/> <menuitem name="super stream player"/> </menupopup> </menu> ...
Filelink Providers
saving custom settings in preferences custom settings for a provider are
saved using the preferences api.
...providers need only provide an extraargs function in the iframe content which returns an object specifying the name, type, and value to
save.
Add to iPhoto
that's not really the ideal way to do things but
saved some time for this simple example.
...instance(components.interfaces.nsiwebbrowserpersist); var ios = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri(src, document.characterset, gbrowser.selectedbrowser.contentdocument.documenturiobject); wbp.persistflags &= ~components.interfaces.nsiwebbrowserpersist.persist_flags_no_conversion; // don't
save gzipped wbp.
saveuri(uri, null, null, null, null, dest); return dest.path; } this is pretty straightforward, typical mozilla code.
Using COM from js-ctypes
e, null, clsctx_all, iid_ispvoice, (void**)&pvoice); if (succeeded(hr)) { pvoice->speak(l"hello, firefox!", spf_default, null); pvoice->release(); } } // msdn documentation says that even if coinitalize fails, counitialize // must be called couninitialize(); return 0; } to run the code,
save it as test.cpp, and run following command in the directory (needs visual studio).
... &iid_ispvoice, (void**)&pvoice); if (succeeded(hr)) { pvoice->lpvtbl->speak(pvoice, l"hello, firefox!", 0, null); pvoice->lpvtbl->release(pvoice); } } // msdn documentation says that even if coinitalize fails, counitialize // must be called couninitialize(); return 0; } to run the code,
save it as test.c, and run following command in the directory.
Using Objective-C from js-ctypes
while ([synth isspeaking]) {} [synth release]; return 0; }
save this file as test.m, and run with the following command, inside the same directory as the
saved file (needs xcode).
... // [synth isspeaking] while (objc_msgsend(synth, isspeaking)) {} sel release = sel_registername("release"); // [synth release]; objc_msgsend(synth, release); // [text release]; objc_msgsend(text, release); return 0; } to run this code,
save it as test.c, and run the following command in the same directory.
Set event listener breakpoints - Firefox Developer Tools
if however you have multiple elements, all of which have event listeners attached that you want to break on, this becomes an enormous time
saver.
... this is also useful when debugging code that you're unfamiliar with, to
save time over hunting down your event handler within your code, or when trying to understand why a web site isn't working as expected in your browser.
Basic operations - Firefox Developer Tools
on the left, you'll see an entry for the new snapshot, including its timestamp, size, and controls to
save or clear this snapshot: clearing a snapshot to remove a snapshot, click the "x" icon: saving and loading snapshots if you close the memory tool, all un
saved snapshots will be discarded.
... to
save a snapshot click "
save": you'll be prompted for a name and location, and the file will be
saved with an .fxsnapshot extension.
Network request list - Firefox Developer Tools
save all as har creates an http archive (har) for all requests listed, and opens a file dialog, so you can
save it to a file.
...in addition to the copy and
save menu items for har in the context menu, similar menu items are available in the har dropdown menu in the toolbar, as well as an import menuitem.
How to - Firefox Developer Tools
save a profile to
save a profile, click the link labeled "
save" in the recordings pane: load a profile to load a profile, click "import..." and choose the file: clear all loaded profiles to clear all loaded profiles, click "clear".
... if you do this, you'll lose any loaded profiles that you have not
saved.
Console messages - Firefox Developer Tools
file opens a file dialog box so you can
save an export of all messages available in the display pane.
...in this way the browser can
save up a collection of invalidating changes and recalculate their effect at once.
Web Console remoting - Firefox Developer Tools
actor preferences to allow the web console to configure logging options while it is running, we have added the setpreferences packet: { "to": "conn0.console9", "type": "setpreferences", "preferences": { "networkmonitor.
saverequestandresponsebodies": false } } reply: { "updated": [ "networkmonitor.
saverequestandresponsebodies" ], "from": "conn0.console10" } for convenience you can use webconsoleclient.setpreferences(prefs, onresponse).
... in firefox 25 we added the getpreferences request packet: { "to": "conn0.console34", "type": "getpreferences", "preferences": [ "networkmonitor.
saverequestandresponsebodies" ] } reply packet: { "preferences": { "networkmonitor.
saverequestandresponsebodies": false }, "from": "conn0.console34" } you can also use the webconsoleclient.getpreferences(prefs, onresponse).
CanvasRenderingContext2D - Web APIs
the following methods help you to work with that state: canvasrenderingcontext2d.
save()
saves the current drawing style state using a stack so you can revert any change you make to it using restore().
... canvasrenderingcontext2d.restore() restores the drawing style state to the last element on the 'state stack'
saved by
save().
Using the Frame Timing API - Web APIs
var threshold = 1500; var observe_frame = new performanceobserver(function(list) { var perfentries = list.getentriesbytype("frame"); for (var i=0; i < perfentries.length; i++) { if (perfentries[i].duration > threshold) { console.log("warning: frame '" + threshold + "' exceeded!"); } } }); observe_frame.observe({entrytypes: ['frame']}); the tools will
save you!
... first, perhaps using the tools will
save you is a bit too strong but performance tools can certainly help identify code that is not conformant to some expected time threshold.
HTMLCanvasElement.mozFetchAsStream() - Web APIs
examples
save to disk with mozfetchasstream (chrome context only) this technique also converts it to ico, however it will not work in windows xp as winxp cannot convert from png to ico.
... it
saves to the desktop it uses fileutils.jsm.
MediaRecorder - Web APIs
mediarecorder.requestdata() requests a blob containing the
saved data received thus far (or since the last time requestdata() was called.
... mediarecorder.stop() stops recording, at which point a dataavailable event containing the final blob of
saved data is fired.
OffscreenCanvas - Web APIs
once a new frame has finished rendering in this context, the transfertoimagebitmap() method can be called to
save the most recent rendered image.
...a call to imagebitmaprenderingcontext.transferfromimagebitmap() with the previously rendered and
saved imagebitmap from the offscreencanvas, will display the imagebitmap on the canvas and transfer its ownership to the canvas.
PointerEvent.pointerId - Web APIs
example the following code snippet compares a previously
saved pointerid with the one of the pointerdown event that was just fired.
... let id; // let's assume that this is a previously
saved pointerid target.addeventlistener('pointerdown', function(event) { // compare previous event's id that was cached // to current event's id and handle accordingly if (id === event.pointerid) process_event(event); }, false); specifications specification status comment pointer events – level 2the definition of 'pointerid' in that specification.
Multi-touch interaction - Web APIs
//
save this event for later processing (this could be part of a // multi-touch interaction) and update the background color push_event(ev); if (logevents) log("pointerdown: name = " + ev.target.id, ev); update_background(ev); } pointer move the pointermove handler is called when the pointer moves.
... function get_cache(ev) { // return the cache for this event's target element switch(ev.target.id) { case "target1": return evcache1; case "target2": return evcache2; case "target3": return evcache3; default: log("error with cache handling",ev); } } function push_event(ev) { //
save this event in the target's cache var cache = get_cache(ev); cache.push(ev); } function remove_event(ev) { // remove this event from the target's cache var cache = get_cache(ev); for (var i = 0; i < cache.length; i++) { if (cache[i].pointerid == ev.pointerid) { cache.splice(i, 1); break; } } } update background color the background color of the touch areas will change as ...
Screen Wake Lock API - Web APIs
modern devices do this to
save on battery power.
...a request may be rejected for a number of reasons, including system settings (such as power
save mode or low battery level) or if the document is not active or visible.
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
since most users would prefer that you maintain the same viewer position and facing direction while performing this transition, you can use the xrframe method getviewerpose() to obtain the current xrviewerpose, switch the session, then use the
saved viewer pose to restore the viewer's position and facing.
... finally, the
saved viewerpose is converted to the new world space's coordinate system by calling the new reference system's getoffsetreferencespace() method.
Window.sessionStorage - Web APIs
sessionstorage.setitem('mycat', 'tom'); the following example auto
saves the contents of a text field, and if the browser is refreshed, restores the text field content so that no writing is lost.
... // get the text field that we're going to track let field = document.getelementbyid("field"); // see if we have an auto
save value // (this will only happen if the page is accidentally refreshed) if (sessionstorage.getitem("auto
save")) { // restore the contents of the text field field.value = sessionstorage.getitem("auto
save"); } // listen for changes in the text field field.addeventlistener("change", function() { // and
save the results into the session storage object sessionstorage.setitem("auto
save", field.value); }); note: please refer to the using the web storage api article for a full example.
XMLDocument.load() - Web APIs
document.load() is a part of an old version of the w3c dom level 3 load &
save module.
...(to test this functionality, create the files on your local disk or on a webserver rather than loading the load.html file from the lxr-generated page, which will serve the text.xml file as html.) specifications old w3c working draft of the dom level 3 load &
save module ...
ARIA: button role - Accessibility
<div id="
savechanges" tabindex="0" role="button" aria-pressed="false">
save</div> the above example creates a simple button which is first in the focus order, though <button> or <input> with type="button" should be used for buttons: <button id="
savechanges">
save</button> note: if using role="button" instead of the semantic <button> or <input type="button"> elements, you will need to make the element focusable and have to define event handlers for click and keydown events, including the enter and space ke...
... a common convention to inform users a button will launch a dialog is to append "…" (ellipsis) to the button's label, e.g., "
save as…".
-moz-image-rect - CSS: Cascading Style Sheets
function rotate() { var prevstyle = window.getcomputedstyle(document.getelementbyid("box4"), null).getpropertyvalue("background-image"); // now that we've
saved the last one, start rotating for (var i=1; i<=4; i++) { var curid = "box" + i; // shift the background images var curstyle = window.getcomputedstyle(document.getelementbyid(curid), null).getpropertyvalue("background-image"); document.getelementbyid(curid).style.backgroundimage = prevstyle; prevstyle = curstyle; } } this uses window.getcomputedstyle() to fetch the styl...
...notice that before it begins doing so it
saves a copy of the last box's style since it will be overwritten by the third element's style.
<a>: The Anchor element - HTML: Hypertext Markup Language
downloadhtml5 prompts the user to
save the linked url instead of navigating to it.
... using the download attribute to
save a <canvas> as a png to
save a <canvas> element’s contents as an image, you can create a link with a download attribute and the canvas data as a data: url: example painting app with
save link html <p>paint by holding down the mouse button and moving it.
Browser detection using the user agent - HTTP
on a large screen, it
saves space to have multiple columns to reduce the space wasted to the left and to the right of the pictures.
...in such cases, it might be beneficial to use user agent sniffing to
save on performance.
Cross-Origin Resource Sharing (CORS) - HTTP
agent (for example, connection, user-agent, or the other headers defined in the fetch spec as a “forbidden header name”), the only headers which are allowed to be manually set are those which the fetch spec defines as a “cors-safelisted request-header”, which are: accept accept-language content-language content-type (but note the additional requirements below) dpr downlink
save-data viewport-width width the only allowed values for the content-type header are: application/x-www-form-urlencoded multipart/form-data text/plain no event listeners are registered on any xmlhttprequestupload object used in the request; these are accessed using the xmlhttprequest.upload property.
...in the example above, the page is loaded from foo.example, but the cookie on line 20 is sent by bar.other, and would thus not be
saved if the user has configured their browser to reject all third-party cookies.
HTTP headers - HTTP
save-data a boolean that indicates the user agent's preference for reduced data usage.
... downloads content-disposition indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “
save as” dialog.
How to turn off form autocompletion - Web security
is either for an entire form, or for specific input elements in a form: <form method="post" action="/form" autocomplete="off"> […] </form> <form method="post" action="/form"> […] <div> <label for="cc">credit card:</label> <input type="text" id="cc" name="cc" autocomplete="off"> </div> </form> setting autocomplete="off" on fields has two effects: it tells the browser not to
save data inputted by the user for later autocompletion on similar forms, though heuristics for complying vary by browser.
...for example, firefox version 67 (see bug 1119063) stopped autofilling in this case; however, firefox 70 (see bug 1565407) can suggest securely-generated passwords, but does not autofill a
saved password.
XUL Migration Guide - Archive of obsolete content
getservice(ci.nsipromptservice); exports.alert = function(title, text) { promptsvc.alert(null, title, text); }; if we
save this as "alert.js" in our add-on's lib directory, we can rewrite main.js to use it as follows: require("sdk/ui/button/action").actionbutton({ id: "xpcom-example", label: "hello from xpcom", icon: "./icon-16.png", onclick: function() { require("./alert").alert("my add-on", "hello from xpcom"); } }); one of the benefits of this is that we can control which parts of the add-on are g...
hotkeys - Archive of obsolete content
for example, accel-s is typically used to
save a file, but if you use it for something completely different, then it would be extremely confusing for users.
page-mod - Archive of obsolete content
on: "./icon-16.png", onclick: function() { require("sdk/tabs").activetab.attach({ contentscript: 'var divs = document.getelementsbytagname("div");' + 'for (var i = 0; i < divs.length; ++i) {' + 'divs[i].setattribute("style", "border: solid red 1px;");' + '}' }); } }); to run this example you'll also have to have an icon file named "icon-16.png"
saved in your add-on's "data" directory.
ui/frame - Archive of obsolete content
nd a javascript script to implement behavior: <!doctype html> <html> <head> <link href="city-info.css" rel="stylesheet"></link> </head> <body> <select name="city" id="city-selector"></select> <span id="time" class="info-element"></span> <span id="weather" class="info-element"></span> <script type="text/javascript" src="city-info.js"></script> </body> </html> if we
save this document as "city-info.html" under the add-on's "data" directory, we can create a frame hosting it and add the frame to a toolbar like this: var { frame } = require("sdk/ui/frame"); var { toolbar } = require("sdk/ui/toolbar"); var frame = new frame({ url: "./city-info.html" }); var toolbar = toolbar({ name: "city-info", title: "city info", items: [frame] }); the toolbar is positi...
Adding a Button to the Toolbar - Archive of obsolete content
create a directory called "data", mkdir data and
save these three icon files to the "data" directory: icon-16.png icon-32.png icon-64.png then open the file called "index.js" in the root of your addon directory and add the following code to it: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, ...
Display a Popup - Archive of obsolete content
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/ data/ get-text.js icon-16.png icon-32.png icon-64.png text-entry.html index.js run the add-on, c...
List Open Tabs - Archive of obsolete content
the following add-on adds an action button that logs the urls of open tabs when the user clicks it: require("sdk/ui/button/action").actionbutton({ id: "list-tabs", label: "list tabs", icon: "./icon-16.png", onclick: listtabs }); function listtabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) console.log(tab.url); } note: to get this working, you will need to
save an icon for the button to your add-on's "data" directory as "icon-16.png".
Unit Testing - Archive of obsolete content
follows: var base64 = require("./base64"); var button = require("sdk/ui/button/action").actionbutton({ id: "base64", label: "base64", icon: "./icon-16.png", onclick: function() { encoded = base64.btoa("hello"); console.log(encoded); decoded = base64.atob(encoded); console.log(decoded); } }); to run this example you'll also have to have an icon file named "icon-16.png"
saved in your add-ons "data" directory.
HTML in XUL for rich tooltips - Archive of obsolete content
var htmltip = { onload: function() { //at any point you can
save an html string to a xul attribute for later injection into the tooltip document.getelementbyid("htmltip1").setattribute("tooltiphtml", "<font color='red'>red foo</font>") document.getelementbyid("htmltip2").setattribute("tooltiphtml", "<font color='green'>green foo</font>") }, onmousetooltip: function(event) { //get the html tooltip string assigned to the element that the mouse is over (wh...
Miscellaneous - Archive of obsolete content
t; element.focus(); //put the cursor after the inserted text element.setselectionrange(selectionend, selectionend); } inserttext(document.getelementbyid("example"), "the text to be inserted"); disabling javascript programmatically // disable js in the currently active tab from the context of browser.xul gbrowser.docshell.allowjavascript = false; if this isn't your browser, you should
save the value and restore it when finished.
Signing an XPI - Archive of obsolete content
i downloaded the certum root ca and certum level iii ca digital id for web and ssl/tls servers, copied the text and
saved them to the files c:\projects\codesigning\certum root ca.cer and c:\projects\codesigning\certum level iii ca.cer.
Tabbed browser - Archive of obsolete content
openuilinkin( url, where, allowthirdpartyfixup, postdata, referrerurl ) where: "current" current tab (if there aren't any browser windows, then in a new window instead) "tab" new tab (if there aren't any browser windows, then in a new window instead) "tabshifted" same as "tab" but in background if default is to select new tabs, and vice versa "window" new window "
save"
save to disk (with no filename hint!) openuilink( url, e, ignorebutton, ignorealt, allowkeywordfixup, postdata, referrerurl ) the following code will open a url in a new tab, an existing tab, or an existing window based on which mouse button was pressed and which hotkeys (ex: ctrl) are being held.
MMgc - Archive of obsolete content
one is to
save all the addresses of all pages that had cards marked (so you don't have to bring every page into memory to check its hand, so to speak).
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.
Finding the code to modify - Archive of obsolete content
inspectorwidget the inspectorwidget extension adds a toolbar button and context menus for invoking the dom inspector (domi) for either chrome or content elements.thus this makes it possible to
save all the above dom inspector user interface diggings.
chrome.manifest - Archive of obsolete content
copy the following text and paste it into a text file, then
save that file as "chrome.manifest": skin global my_theme jar:chrome/my_theme.jar!/global/ skin mozapps my_theme jar:chrome/my_theme.jar!/mozapps/ skin messenger my_theme jar:chrome/my_theme.jar!/messenger/ skin messenger-newsblog my_theme jar:chrome/my_theme.jar!/messenger-newsblog/ skin communicator my_theme jar:chrome/my_theme.jar!/communicator/ skin help my_theme jar:chrome/my_theme.jar!/help/ skin navigator my_theme jar:chrome/my_theme.jar!/navigator/ skin editor my_theme jar:chrome/my_theme.jar!/editor/ ...
install.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then
save that file as "install.rdf": <?xml version="1.0"?> <rdf xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"> <description about="urn:mozilla:install-manifest"> <em:id>author@oftheme.com</em:id> <em:version>2.0b1</em:version> <!-- seamonkey --> <em:targetapplication> <description> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:minversion>2.0b1pre</em:minversion> <em:maxversion>2.0b2pre</em:maxversion> </description> </em:targetapplication> <!-- front end metadata --> <em:name>my_theme</em:name> <em:description>my first theme</em:description> <!-- front end integration hooks (used by t...
contents.rdf - Archive of obsolete content
copy the following text and paste it into a text file, then
save that file as "contents.rdf": <?xml version="1.0"?> <rdf:rdf xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:chrome="http://www.mozilla.org/rdf/chrome#"> <!-- list all the skins being supplied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:myskin/1.0" /> </rdf:seq> <rdf:description about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:description="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="preview.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:myskin/1.0:packages"> <rdf:li resource="...
Abc Assembler Tests - Archive of obsolete content
l convert_o pop findproperty fail pushstring "convert_o null" pushstring "exception should have been thrown: typeerror: error #1009: cannot access a property or method of a null object reference." getlocal1 callpropvoid fail 3 jump finished_convert_o_null } .catch { getlocal0 pushscope setlocal2 //
save typeerror findproperty compare_typeerror pushstring "convert_o null" // test name pushstring "typeerror: error #1009" // expected getlocal2 // actual callpropvoid compare_typeerror 3 } finished_convert_o_null: } ...
confirm - Archive of obsolete content
button position constants button_pos_0: the first logical button button_pos_1: the second logical button button_pos_2: the third logical button button title constants button_title_ok: an 'ok' button button_title_cancel: a 'cancel' button button_title_yes: a 'yes' button button_title_no: a 'no' button button_title_
save: a '
save' button button_title_dont_
save: a 'don't
save' button button_title_revert: a 'revert' button button_title_is_string: custom title specified by the corresponding abuttonxtitle parameter other constants button_pos_0_default: specifies button 0 as the default button.
icon - Archive of obsolete content
possible values include: accept, cancel, help, open,
save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network.
Reading from Files - Archive of obsolete content
other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and
save dialogs, reading textual data, writing textual data, list of file-related error codes.
Writing to Files - Archive of obsolete content
other documentation on files and i/o not using the unavailable nsiscriptableio apis: code snippets: file i/o, open and
save dialogs, reading textual data, writing textual data, list of file-related error codes.
Popup Menus - Archive of obsolete content
example 2 : source view <button label="
save" tooltiptext="click here to
save your stuff"/> <popupset> <tooltip id="moretip" orient="vertical" style="background-color: #33dd00;"> <description value="click here to see more information"/> <description value="really!" style="color: red;"/> </tooltip> </popupset> <button label="more" tooltip="moretip"/> these two buttons each have a tooltip.
Trees and Templates - Archive of obsolete content
there are five attributes of columns that need to be persisted, to
save the column width, the column order, whether the column is visible, which column is currently sorted and the sort direction.
XUL Tutorial - Archive of obsolete content
tree modifying the default skin creating a skin skinning xul files by hand localization property files bindings introduction to xbl anonymous content xbl attribute inheritance adding properties adding methods adding event handlers xbl inheritance creating reusable content using css and xbl xbl example specialized window types features of a window creating dialogs open and
save dialogs creating a wizard more wizards overlays cross package overlays installation creating an installer install scripts additional install features this xul tutorial was originally created by neil deakin.
XUL Changes for Firefox 1.5 - Archive of obsolete content
this is used typically on gnome systems where possible values are: accept, cancel, help, open,
save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network.
XUL Questions and Answers - Archive of obsolete content
possible values include: accept, cancel, help, open,
save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network.
button - Archive of obsolete content
possible values include: accept, cancel, help, open,
save, find, clear, yes, no, apply, close, print, add, remove, refresh, go-forward, go-back, properties, select-font, select-color, network.
dialog - Archive of obsolete content
n methods acceptdialog, canceldialog, centerwindowonscreen, getbutton, movetoalertposition examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?> <dialog id="donothing" title="dialog example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" buttons="accept,cancel" buttonlabelcancel="cancel" buttonlabelaccept="
save"> <dialogheader title="options" description="my preferences"/> <groupbox> <caption label="colour"/> <radiogroup> <radio label="red"/> <radio label="green" selected="true"/> <radio label="blue"/> </radiogroup> <label value="nickname"/> <textbox/> </groupbox> </dialog> attributes activetitlebarcolor type: color string specify background color of ...
menu - Archive of obsolete content
, itemcount, label, labelelement, menupopup, open, parentcontainer, selected, tabindex, value methods appenditem, getindexofitem, getitematindex, insertitemat, removeitemat style classes menu-iconic example <menubar id="sample-menubar"> <menu id="file-menu" label="file"> <menupopup id="file-popup"> <menuitem label="new"/> <menuitem label="open"/> <menuitem label="
save"/> <menuseparator/> <menuitem label="exit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> attributes acceltext type: string text that appears beside the menu label to indicate the shortcut key (accelerator key...
menubar - Archive of obsolete content
attributes grippyhidden, statusbar properties accessibletype, statusbar examples <menubar id="sample-menubar"> <menu id="action-menu" label="action"> <menupopup id="action-popup"> <menuitem label="new"/> <menuitem label="
save" disabled="true"/> <menuitem label="close"/> <menuseparator/> <menuitem label="quit"/> </menupopup> </menu> <menu id="edit-menu" label="edit"> <menupopup id="edit-popup"> <menuitem label="undo"/> <menuitem label="redo"/> </menupopup> </menu> </menubar> attributes grippyhidden seamonkey only type: boolean when set to true, the grippy will ...
Examples - Game development
save the day fly your rescue chopper around the disaster area and
save the stranded victims (ga.me.) polycraft a shipwreck 'n survive game.
2D collision detection - Game development
crafty.init(200, 200); var dim1 = {x: 5, y: 5} var dim2 = {x: 20, y: 20} crafty.c("circle", { circle: function(radius, color) { this.radius = radius; this.w = this.h = radius * 2; this.color = color || "#000000"; this.bind("move", crafty.drawmanager.drawall) return this; }, draw: function() { var ctx = crafty.canvas.context; ctx.
save(); ctx.fillstyle = this.color; ctx.beginpath(); ctx.arc( this.x + this.radius, this.y + this.radius, this.radius, 0, math.pi * 2 ); ctx.closepath(); ctx.fill(); ctx.restore(); } }); var circle1 = crafty.e("2d, canvas, circle").attr(dim1).circle(15, "red"); var circle2 = crafty.e("2d, canv...
Implementing controls using the Gamepad API - Game development
tons[b]); } } } // loop through axes and push their values to the array var axes = []; if(c.axes) { for(var a=0,x=c.axes.length; a<x; a++) { axes.push(c.axes[a].tofixed(2)); } } // assign received values gamepadapi.axesstatus = axes; gamepadapi.buttonsstatus = pressed; // return buttons for debugging purposes return pressed; }, on every frame, update()
saves buttons pressed during the previous frame to the buttonscache array and takes fresh ones from the gamepadapi.controller object.
Efficient animation for web games - Game development
to
save battery life, it is best to only draw when there are things going on, so that would mean calling requestanimationframe (or your refresh function, which in turn calls that) in response to events happening in your game.
Bounce off the walls - Game development
we could merge those two statements into one to
save on code verbosity: if(y + dy > canvas.height || y + dy < 0) { dy = -dy; } if either of the two statements is true, reverse the movement of the ball.
Create the Canvas and draw on it - Game development
using your favourite text editor, create a new html document,
save it as index.html, in a sensible location, and add the following code to it: <!doctype html> <html> <head> <meta charset="utf-8" /> <title>gamedev canvas workshop</title> <style> * { padding: 0; margin: 0; } canvas { background: #eee; display: block; margin: 0 auto; } </style> </head> <body> <canvas id="mycanvas" width="480" height="320"></canvas> <script> // javascri...
Capturing a minidump
capturing a minidump: application hang on windows vista and windows 7, you can follow these instructions to capture a dump file and locate it after it's been
saved.
Debugging on Mac OS X
having a profile for debugging purposes it is recommended to create a separate profile to debug with, whatever your task, so that you don't lose precious data like bookmarks,
saved passwords, etc.
pymake
type touch .profile using any appropriate text editor open .profile and add the following line in the file (assuming your mozilla-central is at c:/mozilla-central, if not, adjust your path accordingly.) alias pymake=c:/mozilla-central/build/pymake/make.py
save your .profile edit and close the shell, then restart the shell.
The Firefox codebase: CSS Guidelines
colors for common areas of the firefox interface (panels, toolbar buttons, etc.), mozilla-central often comes with some useful css variables that are adjusted with the correct values for different platform configurations, so using those css variables can definitively
save some testing time, as you can assume they already work correctly.
Eclipse CDT
furthermore, the results are not
saved so if you immediately search for the exact same text again without any changes to the source files having occurred, eclipse will do a slow search all over again.
Eclipse CDT Manual Setup
(sadly, there is no auto-activation option to activate autocomplete suggestion., so as soon as you type any alphabetical character that may begin with a symbol name like there is in other ides.) select "c/c++ > editor >
save actions" and deselect "ensure newline at the end of file".
Displaying Places information using views
the built-in views if you need to show the contents of bookmarks or history in your extension or application, you may want to use the built-in places views, which are generic and will
save you a lot of time writing basic functionality so that you can focus on building your extension or application.
Multiple Firefox profiles
"don't delete files" is the preferred option, because it
saves the old profile's folder, allowing you to recover the files to a new profile.
Firefox and the "about" protocol
about:devtools summarizes the developer tools and provides links to documentation for each tool about:downloads displays all downloads done within firefox about:home start page of firefox when opening a new window about:license displays licensing information about:logo firefox logo about:memory provides a way to display memory usage,
save it as report and run the gc and cc about:mozilla special page showing a message from "the book of mozilla" about:networking displays networking information about:newtab start page when opening a new tab about:performance displays memory and performance information about firefox subprocesses/add-ons/tabs about:plugins displays information...
Gecko's "Almost Standards" Mode
"almost standards" rendering mode is exactly the same as "standards" mode in all details
save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them.
IME handling guide
at this time, tsftextstore
saves the requests of modification into the queue called pendingaction.
AsyncShutdown.jsm
since the data is
saved to the profile, this must be completed during phase profilebeforechange.
Interfacing with the Add-on Repository
fsservice.getbranch("extensions."); var recurl = ""; try { recurl = prefbranch.getcharpref("getaddons.recommended.url"); } catch(e) { recurl = ""; } if (recurl == "") { prefbranch.setcharpref("getaddons.recommended.url", "https://services.addons.mozilla.org/%locale%/%app%/api/%api_version%/list/recommended/all/%max_results%/%os%/%version%?src=firefox"); prefsservice.
savepreffile(null); } this fetches the value of the extensions.getaddons.recommended.url preference, and, if the preference doesn't exist or has no value, sets the value of the preference to the correct one for the amo site.
Sqlite.jsm
this
saves time associated with parsing the sql statement and creating a new statement object.
openLocationLastURL.jsm
he open location edit box, simply read the value of, or set the value of, the openlocationlasturl.value field: var url = openlocationlasturl.value; openlocationlasturl.value = "http://www.mozilla.org/"; to reset the value of the edit box to the default (which is an empty string), you can call the reset() method: method overview reset() methods reset the reset() method resets the
saved url to the default, which is an empty string.
L10n Checks
0 - quiet; 5 - show all messages merge in the source mode you can tell l10n checks to merge missing strings and files into the locale files by setting a merge directory, e.g.: check-l10n-completeness -m output_dir suite/locales/l10n.ini ../l10n/ de note: only files which were merged will be
saved in that directory.
Localization and Plurals
so for your extension, specify a pluralrule value in the .properties, and call pluralform.makegetter(pluralrulefromproperties), making sure to
save the 2 returned functions.
Localizing XLIFF files for iOS
<trans-unit id="add to bookmarks"> <source>add to bookmarks</source> <target>agregar a marcadores</target> <note>no comment provided by engineer.</note> </trans-unit>
save your translations along the way.
Localizing with Mercurial
save the file as either .hgrc (unix systems) or mercurial.ini (windows) and
save it in either $home/ or c:\mozilla-build\hg\ or c:\program files\mercurial\.
QA phase
for instance, if you have finished translating all the .dtd and .properties files in your x-testing/browser/chrome/browser/ directory, then you should run these commands: $ hg status $ hg commit -m "translated browser/chrome/browser/" $ hg outgoing $ hg push http://hg.mozilla.org/l10n-central/x-testing note that due to the distributed nature of hg, hg commit
saves the changes locally (i.e., in your computer's hg repository).
Release phase
keep in mind that the hg commit command will
save your changes locally (in the local clone).
Localization formats
ng tools will not allow localizers to edit the l10n file where they shouldn't separates localizable strings available for localizers for the rest of the code, protecting it from unintended changes disadvantage of gettext .po file needs to be compiled into a .mo file for localizer to see changes using regular diff to see changes to a file is sometimes impossible because the editing tool can
save the .po file using a completely different structure or order of entities.
Mozilla Style System Documentation
for example, suppose we had the css stylesheet: /* rule 1 */ doc { display: block; text-indent: 1em; } /* rule 2 */ title { display: block; font-size: 3em; } /* rule 3 */ para { display: block; } /* rule 4 */ [class="emph"] { font-style: italic; } and the following document: <doc> <title>a few quotes</title> <para class="emph">benjamin franklin said that <quote>"a penny
saved is a penny earned."</quote></para> <para>franklin d.
Invariants
we do this in order to
save some cpu cycles (in other words, for no good reason whatsoever).
Property cache
a cache hit of this type
saves a property lookup, but the interpreter still has to examine vword.toshape() to determine what to do next.
SpiderMonkey Internals
for no good reason
save lack of time, the %e, %f, and %g formats cause your system's native sprintf, rather than js_dtoa(), to be used.
JS::CompileOptions
for example, js::compileoffthread needs to
save compilation options where a worker thread can find them, and then return immediately.
JS_ConstructObject
the preferred alternative is to
save a copy of the constructor function for the class, then to call it using js_new.
JS_ConvertArguments
it
saves you from having to write separate tests and elaborate if...else statements in your function code to retrieve and translate multiple js values for use with your own functions.
JS_EnterLocalRootScope
to remove a gc thing from a local root scope (perhaps to
save memory), use js_forgetlocalroot.
JS_GetFunctionId
the returned string lives as long as fun, so you don't need to root a
saved reference to it if fun is well-connected or rooted, and provided you bound the use of the
saved reference by fun's lifetime.
JS_IsExceptionPending
example /* jsapi */ bool pending; js::rootedvalue exception(cx); /* if an exception is pending,
save and clear it.
JS_NewExternalString
js_newexternalstringwithclosure works similarly, except it accepts an additional parameter, closure, which is
saved in the string's internal data structure.
SpiderMonkey 45
469) js::mapforeach (bug 1159469) js::newsetobject (bug 1159469) js::setsize (bug 1159469) js::sethas (bug 1159469) js::setdelete (bug 1159469) js::setadd (bug 1159469) js::setclear (bug 1159469) js::setkeys (bug 1159469) js::setvalues (bug 1159469) js::setentries (bug 1159469) js::setforeach (bug 1159469) js::exceptionstackornull (bug 814497) js::copyasyncstack (bug 1160307) js::get
savedframesource (bug 1216819) js::get
savedframeline (bug 1216819) js::get
savedframecolumn (bug 1216819) js::get
savedframefunctiondisplayname (bug 1216819) js::get
savedframeasynccause (bug 1216819) js::get
savedframeasyncparent (bug 1216819) js::get
savedframeparent (bug 1216819) js::buildstackstring (bug 1133191) js::flushperformancemonitoring (bug 1181175) js::resetperformancemonitoring (bug ...
Secure Development Guidelines
uction pointer (eip) points to register being executed; can’t be modified directly introduction: gaining control (2) eip is modified using call or jump instructions attacks usually rely on obtaining control over the eip otherwise the attacker can try to control memory pointed to by an existing function pointer a vulnerability is required to modify the eip or sensitive memory
saved return addr or function pointer get altered introduction: gaining control (3) common issues used to gain control buffer overflows format string bugs integer overflows/underflows writing secure code: input validation input validation most vulnerabilities are a result of un-validated input always perform input validation could
save you without knowing it examples: ...
Using the Places annotation service
from c++ you must use the setter for the explicit data type being
saved: setpageannotationstring(auri, aname, avalue, aflags, aexpiration); setpageannotationint32(auri, aname, avalue, aflags, aexpiration); setpageannotationint64(auri, aname, avalue, aflags, aexpiration); setpageannotationdouble(auri, aname, avalue, aflags, aexpiration); setpageannotationbinary(auri, aname, adata, adatalen, aflags, aexpiration); and likewise for items in the places database:...
Preferences API
preferences api allows you to
save and read strings, numbers, booleans, and references to files to the preferences store.
An Overview of XPCOM
another state that a factory can
save is whether or not an object is a singleton.
nsIXMLHttpRequest
hing xhr.send(null); } xhr('https://www.gravatar.com/avatar/eb9895ade1bd6627e054429d1e18b576?s=24&d=identicon&r=pg&f=1', data => { services.prompt.alert(null, 'xhr success', data); var file = os.path.join(os.constants.path.desktopdir, "test.png"); var promised = os.file.writeatomic(file, new uint8array(data)); promised.then( function() { alert('succesfully
saved image to desktop') }, function(ex) { alert('failed in saving image to desktop') } ); }); ...
nsMsgFolderFlagType
const nsmsgfolderflagtype sentmail = 0x00000200; /// whether this is the folder in which unfinised, unsent messages are
saved for later editing.
XPCOM tasks
p1 we would like to move to a scheme where no one writes queryinterface, and we
save code-space with a table driven implementation.
XPIDL
however, scriptable methods must contain parameters and a return type that can be translated to script: any native type,
save those declared with an nsid, utf8string, cstring, astring, or jsval property, may not be used in a scriptable method or attribute.
DB Views (message lists)
advanced search results are displayed with an nsmsgsearchdbview, and cross-folder
saved searches use nsmsgxfvirtualfolderdbview, which inherits from nsmsgsearchdbview.
Events
saved searches, virtual folders, a quicksearch onsortchanged the sort method in the messages list has been changed ...
MailNews Filters
ter action add your new action to nsimsgfilteraction add code to file out the new action here add new action to the rulesactiontable add string for the new action to the filter editor dtd file add new action to the filter editor js code add new action to the xbl widget in the filter editor if your action has a parameter, add code to initialize the ui editing an existing filter here and to
save to the filter here add your action to filter.properties so it will show up in the filter log.
Thunderbird Configuration Files
locate your profile folder before the configuration files are presented, you should know how to find your profile folder, which is where thunderbird
saves all your settings on your hard drive.
Building a Thunderbird extension 6: Adding JavaScript
depending on the installed theme the result will look something like this: modify xul elements with javascript
save the following javascript code into the content/ folder next to your myhelloworld.xul file and name it overlay.js.
Tips and Tricks from the newsgroups
extensions load an extension in its own tab run shell scripts from an extension (for example, to create a symlink) get extension metadata call java from thunderbird extensions (also an example here, written for firefox but compatible with thunderbird 3.x) define a custom protocol handler to call an external program
save attachment and send it repeat image display using css sprites messages use reminderfox to open a message in the default thunderbird message window (when messageuri, folderuri and gdbview are unknown) determine whether a message has been flagged as junk imap: getting message key of copied message by nsimsgcopyservice::copyfilemessage access the plain text content of the email bod...
Using the Multiple Accounts API
currently, you can set the default smtp server to something else by setting the defaultserver property on the smtpservice, but that will not be
saved to disk.
Mozilla
gecko's "almost standards" mode "almost standards" rendering mode is exactly the same as "standards" mode in all details
save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them.
Flash Activation: Browser Comparison - Plugins
on/x-shockwave-flash' in navigator.mimetypes when user enables flash yes yes yes <object> with fallback content triggers ui yes, with exceptions no yes small/hidden flash triggers additional ui yes no no enabling flash automatically reloads the page no yes yes other features related to flash domain blocking plugin power
saver peripheral content pause each of the browser vendors has a roadmap about the future of flash and changes to the user experience.
Performance - Firefox Developer Tools
how to basic tasks: open the tool, create,
save, load, and configure recordings components of the performance tool frame rate understand your site's overall responsiveness.
Settings - Firefox Developer Tools
screenshot behavior screenshot to clipboard when you click the icon for the screenshot tool, copy the screenshot image to the clipboard (the image will still be
saved to your downloads directory).
Toolbox - Firefox Developer Tools
the following tools are not included in the toolbar by default, but you can add them in the settings: highlight painted area 3d view (note that this is not available in firefox 40) scratchpad grab a color from the page take a screenshot of the entire page: take a screenshot of the complete web page and
saves it in your downloads directory toggle rulers for the page measure a portion of the page: measure a part of the website by selecting areas within the page toolbox controls finally there's a row of buttons to: close the window toggle the window between attached to the bottom of the browser window, and attached to the side of the browser window toggle the window between standalone and att...
Rich output - Firefox Developer Tools
export output to the clipboard once you have output in the console window, you can
save it to the clipboard by right-clicking on the output and selecting export visible messages to clipboard: this will copy all of the output to the clipboard.
Battery Status API - Web APIs
this can be used to adjust your app's resource usage to reduce battery drain when the battery is low, or to
save changes before the battery runs out in order to prevent data loss.
Cache - Web APIs
// we call .clone() on the response to
save a copy of it to the cache.
CacheStorage.match() - Web APIs
ntlistener('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('/sw-test/gallery/mylittlevader.jpg'); }); } })); }); specifications s...
CacheStorage - Web APIs
ntlistener('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('/sw-test/gallery/mylittlevader.jpg'); }); } })); }); this snippet shows how the...
CanvasRenderingContext2D.clip() - Web APIs
s = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create circular clipping region ctx.beginpath(); ctx.arc(100, 75, 50, 0, math.pi * 2); ctx.clip(); // draw stuff that gets clipped ctx.fillstyle = 'blue'; ctx.fillrect(0, 0, canvas.width, canvas.height); ctx.fillstyle = 'orange'; ctx.fillrect(0, 0, 100, 100); result specifying a path and a fillrule this example
saves two rectangles to a path2d object, which is then made the current clipping region using the clip() method.
CanvasRenderingContext2D.fill() - Web APIs
html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.rect(10, 10, 150, 100); ctx.fill(); result specifying a path and a fillrule this example
saves some intersecting lines to a path2d object.
Manipulating video using canvas - Web APIs
&& r > 100 && b < 43) frame.data[i * 4 + 3] = 0; } this.ctx2.putimagedata(frame, 0, 0); return; } when this routine is called, the video element is displaying the most recent frame of video data, which looks like this: in line 2, that frame of video is copied into the graphics context ctx1 of the first canvas, specifying as the height and width the values we previously
saved to draw the frame at half size.
Using channel messaging - Web APIs
this
saves the transferred port and register an onmessage handler that will be called each time a message is passed through our messagechannel.
ContentIndex.getAll() - Web APIs
ator.serviceworker.ready; // get our index entries const entries = await registration.index.getall(); // create a containing element const readinglistelem = document.createelement('div'); // test for entries if (!array.length) { // if there are no entries, display a message const message = document.createelement('p'); message.innertext = 'you currently have no articles
saved for offline reading.' readinglistelem.append(message); } else { // if entries are present, display in a list of links to the content const listelem = document.createelement('ul'); for (const entry of entries) { const listitem = document.createelement('li'); const anchorelem = document.createelement('a'); anchorelem.innertext = entry.title; anchorele...
ContentIndex - Web APIs
ator.serviceworker.ready; // get our index entries const entries = await registration.index.getall(); // create a containing element const readinglistelem = document.createelement('div'); // test for entries if (!array.length) { // if there are no entries, display a message const message = document.createelement('p'); message.innertext = 'you currently have no articles
saved for offline reading.' readinglistelem.append(message); } else { // if entries are present, display in a list of links to the content const listelem = document.createelement('ul'); for (const entry of entries) { const listitem = document.createelement('li'); const anchorelem = document.createelement('a'); anchorelem.innertext = entry.title; anchorele...
Content Index API - Web APIs
ator.serviceworker.ready; // get our index entries const entries = await registration.index.getall(); // create a containing element const readinglistelem = document.createelement('div'); // test for entries if (!array.length) { // if there are no entries, display a message const message = document.createelement('p'); message.innertext = 'you currently have no articles
saved for offline reading.' readinglistelem.append(message); } else { // if entries are present, display in a list of links to the content const listelem = document.createelement('ul'); for (const entry of entries) { const listitem = document.createelement('li'); const anchorelem = document.createelement('a'); anchorelem.innertext = entry.title; anchorele...
DeviceLightEvent - Web APIs
for example this may be useful to adjust the screen's brightness based on the current ambient light level in order to
save energy or provide better readability.
How to create a DOM tree - Web APIs
another application is that, since xul is xml, the ui of your application can be dynamically manipulated, downloaded, uploaded,
saved, loaded, converted, or transformed quite easily.
HTMLCanvasElement.toBlob() - Web APIs
bcallback(iconname) { return function(b) { var a = document.createelement('a'); a.textcontent = 'download'; document.body.appendchild(a); a.style.display = 'block'; a.download = iconname + '.ico'; a.href = window.url.createobjecturl(b); } } canvas.toblob(blobcallback('passthisstring'), 'image/vnd.microsoft.icon', '-moz-parse-options:format=bmp;bpp=32');
save toblob to disk with os.file (chrome/add-on context only) this technique
saves it to the desktop and is only useful in firefox chrome context or add-on code as os apis are not present on web sites.
HTMLImageElement.lowSrc - Web APIs
there are a number of ways to achieve this; primary among them: higher compression levels (for example, a primary image
saved as a jpeg using 85% quality might have a lowsrc version
saved at 15%.
PositionOptions - Web APIs
on the other hand, if false, the device can take the liberty to
save resources by responding more quickly and/or using less power.
PushSubscription.endpoint - Web APIs
example navigator.serviceworker.ready.then(function(reg) { reg.pushmanager.subscribe({uservisibleonly: true}).then(function(subscription) { console.log(subscription.endpoint); // at this point you would most likely send the subscription // endpoint to your server,
save it, then use it to send a // push message at a later date }) }) specifications specification status comment push apithe definition of 'endpoint' in that specification.
RTCDataChannelEvent.channel - Web APIs
example the first line of code in the datachannel event handler shown below takes the channel from the event object and
saves it locally for use by the code handling data traffic.
RTCDataChannelEvent - Web APIs
channelevent() the rtcdatachannelevent() constructor creates a new rtcdatachannelevent.propertiesalso inherits properties from: eventchannel read only the read-only property rtcdatachannelevent.channel returns the rtcdatachannel associated with the event.methodsthis interface has no methods, but inherits methods from: event examples in this example, the datachannel event handler is set up to
save the data channel reference and set up handlers for the events which need to be monitored.
RTCRtpSender.replaceTrack() - Web APIs
examples switching video cameras // example to change video camera, suppose selected value
saved into window.selectedcamera navigator.mediadevices .getusermedia({ video: { deviceid: { exact: window.selectedcamera } } }) .then(function(stream) { let videotrack = stream.getvideotracks()[0]; pcs.foreach(function(pc) { var sender = pc.getsenders().find(function(s) { return s.track.kind == videotrack.kind; }); console.log('foun...
Request.context - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request context in a variable: var myrequest = new request('flowers.jpg'); var mycontext = myrequest.context; // returns the empty string by default ...
Request.credentials - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request credentials in a variable: var myrequest = new request('flowers.jpg'); var mycred = myrequest.credentials; // returns "same-origin" by default specifications specification status comment fetchthe definition of 'credentials' in that specification.
Request.destination - Web APIs
example in the following snippet, we create a new request using the request() constructor (for an image file in the same directory as the script), then
save the request's destination: var myrequest = new request('flowers.jpg'); var mydestination = myrequest.destination; // returns the empty string by default specifications specification status comment fetchthe definition of 'destination' in that specification.
Request.headers - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request headers in a variable: var myrequest = new request('flowers.jpg'); var myheaders = myrequest.headers; // headers {} to add a header to the headers object we use headers.append; we then create a new request along with a 2nd init parameter, passing headers in as an init option: var myheaders = new headers(); myheaders.append('content-type', 'image/jpeg'); var myinit = { method: 'get', headers: myheaders, mode: 'cors', cache: 'def...
Request.integrity - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request integrity value in a variable: var myrequest = new request('flowers.jpg'); var myintegrity = myrequest.integrity; specifications specification status comment fetchthe definition of 'integrity' in that specification.
Request.method - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the method of the request in a variable: var myrequest = new request('flowers.jpg'); var mymethod = myrequest.method; // get specifications specification status comment fetchthe definition of 'method' in that specification.
Request.mode - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request mode in a variable: var myrequest = new request('flowers.jpg'); var mymode = myrequest.mode; // returns "cors" by default specifications specification status comment fetchthe definition of 'mode' in that specification.
Request.redirect - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request redirect value in a variable: var myrequest = new request('flowers.jpg'); var mycred = myrequest.redirect; specifications specification status comment fetchthe definition of 'redirect' in that specification.
Request.referrer - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request referrer in a variable: var myrequest = new request('flowers.jpg'); var myreferrer = myrequest.referrer; // returns "about:client" by default specifications specification status comment fetchthe definition of 'referrer' in that specification.
Request.referrerPolicy - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the request referrer policy in a variable: var myrequest = new request('flowers.jpg'); var myreferrer = myrequest.referrerpolicy; // returns "" by default specifications specification status comment fetchthe definition of 'referrerpolicy' in that specification.
Request.url - Web APIs
example in the following snippet, we create a new request using the request.request() constructor (for an image file in the same directory as the script), then
save the url of the request in a variable: var myrequest = new request('flowers.jpg'); var myurl = myrequest.url; // "http://mdn.github.io/fetch-examples/fetch-request/flowers.jpg" specifications specification status comment fetchthe definition of 'url' in that specification.
Using Service Workers - Web APIs
if we were being really clever, we would not only request the resource from the network; we would also
save it into the cache so that later requests for that resource could be retrieved offline too!
Storage API - Web APIs
site storage—the data stored for a web site which is managed by the storage standard—includes: indexeddb databases cache api data service worker registrations web storage api data managed using window.localstorage history state information
saved using history.pushstate() application caches notification data other kinds of site-accessible, site-specific data that may be maintained site storage units the site storage system described by the storage standard and interacted with using the storage api consists of a single site storage unit for each origin.
Text.splitText() - Web APIs
html <p>foobar</p> javascript const p = document.queryselector('p'); // get contents of <p> as a text node const foobar = p.firstchild; // split 'foobar' into two text nodes, 'foo' and 'bar', // and
save 'bar' as a const const bar = foobar.splittext(3); // create a <u> element containing ' new content ' const u = document.createelement('u'); u.appendchild(document.createtextnode(' new content ')); // add <u> before 'bar' p.insertbefore(u, bar); // the result is: <p>foo<u> new content </u>bar</p> result specifications specification status comment domthe definiti...
WakeLockSentinel - Web APIs
this can happen if the document becomes inactive or looses visibility, if the device is low on power or the user turns on a power
save mode.
A basic 2D WebGL animation example - Web APIs
we use that and the
saved time at which the last frame was drawn, previoustime, along with the number of degrees per second the square should rotate (degreespersecond) to calculate the new value of currentangle.
WebSocket: close event - Web APIs
bubbles no cancelable no interface closeevent event handler property onclose examples you might want to know when the connection has been closed so that you can update the ui or, perhaps,
save data about the closed connection.
Inputs and input sources - Web APIs
the sequence of events is identical to those sent by the primary action,
save for the name of each event: an squeezestart event is sent to the xrsession, indicating that the user has begun a squeeze action.
Using the Web Audio API - Web APIs
you have input nodes, which are the source of the sounds you are manipulating, modification nodes that change those sounds as desired, and output nodes (destinations), which allow you to
save or hear those sounds.
Web Storage API - Web APIs
note: from firefox 45 onwards, when the browser crashes/restarts, the amount of data
saved per origin is limited to 10mb.
Window.localStorage - Web APIs
the read-only localstorage property allows you to access a storage object for the document's origin; the stored data is
saved across browser sessions.
Window.open() - Web APIs
this function is the lonely key to get back the handle on a window if the developer has access only to its name (the name can be
saved with cookies or local storage but not the window object handle).
Window: popstate event - Web APIs
if new-entry has serialized state information
saved with it, that information is deserialized into history.state; otherwise, state is null.
Window - Web APIs
window.onbeforeinstallprompt an event handler property dispatched before a user is prompted to
save a web site to a home screen on mobile.
WritableStreamDefaultWriter.write() - Web APIs
note that what "success" means is up to the underlying sink; it might indicate simply that the chunk has been accepted, and not necessarily that it is safely
saved to its ultimate destination.
XMLSerializer - Web APIs
var s = new xmlserializer(); var d = document; var str = s.serializetostring(d);
savexml(str); this involves creating a new xmlserializer object, then passing the document to be serialized into serializetostring(), which returns the xml equivalent of the document.
XRSession.inputSources - Web APIs
you can then either get the value of inputsources to examine the list, or you can refer to a reference to the list that you've previously
saved.
XRView - Web APIs
vec3.cross(vecx, vecy, cubeorientation); vec3.cross(vecy, cubeorientation, vecx); // now compute the transform that teleports the object to the // specified point and
save a copy of it to display to the user // later; otherwise we probably wouldn't need to
save mousematrix // at all.
Using the alert role - Accessibility
the alert role is most useful for information that requires the user's immediate attention, for example: an invalid value was entered into a form field the user's login session is about to expire the connection to the server was lost, local changes will not be
saved because of its intrusive nature, the alert role must be used sparingly and only in situations where the user's immediate attention is required.
Using the aria-labelledby attribute - Accessibility
y="homily">a lecture or discourse on or of a moral theme</dd> </dl> example 7: menus in the example below, a popup menu is associated with its label using the aria-labelledby attribute: <div role="menubar"> <div role="menuitem" aria-haspopup="true" id="filemenu">file</div> <div role="menu" aria-labelledby="filemenu"> <div role="menuitem">open</div> <div role="menuitem">
save</div> <div role="menuitem">
save as ...</div> ...
Using the status role - Accessibility
<p role="status">your changes were automatically
saved.</p> working examples: notes aria attributes used status related aria techniques alert role live region roles live region attributes compatibility the paciello group published some data on compatibility via their 2014 blog post: screen reader support for aria live regions tbd: add updated support information for common ua and at product combinations additiona...
ARIA: contentinfo role - Accessibility
best practices prefer html when it is an immediate descendant of the <body> element, using the <footer> element will automatically communicate a section has a role of contentinfo (
save for a known issue in voiceover).
ARIA: form role - Accessibility
<div role="form" id="contact-info" aria-label="contact information"> <!-- form content --> </div> this is a form that collects and
saves a user's contact information.
ARIA: dialog role - Accessibility
text" /> </p> <p> <label for="lastname">last name</label> <input id="lastname" type="text"/> </p> <p> <label for="interests">interests</label> <textarea id="interests"></textarea> </p> <p> <input type="checkbox" id="autologin"/> <label for="autologin">auto-login?</label> </p> <p> <input type="submit" value="
save information"/> </p> </form> </div> working examples: jquery-ui dialog notes note: while it is possible to prevent keyboard users from moving focus to elements outside of the dialog, screen reader users may still be able to navigate to that content using their screen reader's virtual cursor.
Basic form hints - Accessibility
<button aria-describedby="descriptionrevert">revert</button> <div id="descriptionrevert">reverting will undo any changes that have been made since the last
save.</div> note: the aria-describedby attribute is used for other purposes, in addition to form controls.
Alerts - Accessibility
this is similar to the notification bar in firefox that prompts you whether you want to
save a password.
Architecture - Accessibility
not only can this
save extra calls, but it will always return the visual line of text when used with the gettext methods and line boundaries.
Understandable - Accessibility
for example, if pressing a button causes the application to exit the current view, the user should be asked to confirm this action,
save their work if appropriate, etc.
::-webkit-scrollbar - CSS: Cascading Style Sheets
</div> <div class="invisible-scrollbar"> thisi
saveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylongword </div> <div class="mostly-customized-scrollbar"> thisi
saveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylongword<br> and pretty tall<br> thing with weird scrollbars.<br> who thought scrollbars could be made weeeeird?
Resizing background images with background-size - CSS: Cascading Style Sheets
here we scale a 32x32 pixel favicon to 300x300 pixels: .square2 { background-image: url(favicon.png); background-size: 300px; width: 300px; height: 300px; border: 2px solid; text-shadow: white 0px 0px 2px; font-size: 16px; } as you can see, the css is actually essentially identical,
save the name of the image file.
CSS Images - CSS: Cascading Style Sheets
implementing image sprites in css describes the common technique grouping several images in one single document to
save download requests and speed up the availability of a page.
Specificity - CSS: Cascading Style Sheets
https://stackoverflow.com/questions/3706819/what-are-the-implications-of-using-important-in-css https://stackoverflow.com/questions/9245353/what-does-important-in-css-mean https://stackoverflow.com/questions/5701149/when-to-use-important-property-in-css https://stackoverflow.com/questions/11178673/how-to-override-important https://stackoverflow.com/questions/2042497/when-to-use-important-to-
save-the-day-when-working-with-css the :is() and :not() exceptions the matches-any pseudo-class :is() and the negation pseudo-class :not() are not considered a pseudo-class in the specificity calculation.
Cubic Bezier Generator - CSS: Cascading Style Sheets
x.moveto(-2 * basic_scale_size + cx(0), ly(i)); ctx.filltext(math.round(i * 10) / 10, -3 * basic_scale_size + cx(0), cy(i) + 4); // limitation the constant 4 should be font size dependant } ctx.lineto(cx(0), ly(i)); } ctx.stroke(); ctx.closepath(); ctx.beginpath(); // draw the y axis label ctx.
save(); ctx.rotate(-math.pi / 2); ctx.textalign = "left"; ctx.filltext("output (value ratio)", -cy(0), -3 * basic_scale_size + cx(0)); ctx.restore(); // draw the x axis ctx.moveto(cx(0), cy(0)); ctx.lineto(cx(0), cy(1)); ctx.textalign = "center"; for (i = 0.1; i <= 1; i = i + 0.1) { ctx.moveto(lx(i), basic_scale_size ...
rotate - CSS: Cascading Style Sheets
this maps better to typical user interface usage, and
saves having to remember the exact order of transform functions to specify in the transform property.
scale - CSS: Cascading Style Sheets
this maps better to typical user interface usage, and
saves having to remember the exact order of transform functions to specify in the transform value.
Event reference
beforeinstallprompt event chrome specific a user is prompted to
save a website to a home screen on mobile.
User input and controls - Developer guides
contenteditable demo this is a working example showing how contenteditable can be used to create an editable document section, the state of which is then
saved using localstorage.
<form> - HTML: Hypertext Markup Language
examples html <!-- form which will send a get request to the current url --> <form> <label>name: <input name="submitted-name" autocomplete="name"> </label> <button>
save</button> </form> <!-- form which will send a post request to the current url --> <form method="post"> <label>name: <input name="submitted-name" autocomplete="name"> </label> <button>
save</button> </form> <!-- form with fieldset, legend, and label --> <form method="post"> <fieldset> <legend>title</legend> <label><input type="radio" name="radio"> select me</label> </fieldset...
<menu> - HTML: Hypertext Markup Language
--> <menu type="toolbar"> <li> <button type="menu" menu="file-menu">file</button> <menu type="context" id="file-menu"> <menuitem label="new..." onclick="newfile()"> <menuitem label="
save..." onclick="
savefile()"> </menu> </li> <li> <button type="menu" menu="edit-menu">edit</button> <menu type="context" id="edit-menu"> <menuitem label="cut..." onclick="cutedit()"> <menuitem label="copy..." onclick="copyedit()"> <menuitem label="paste..." onclick="pasteedit()"> </menu> </li> </menu> result specifications specification status...
ETag - HTTP
it lets caches be more efficient and
save bandwidth, as a web server does not need to resend a full response if the content has not changed.
If-None-Match - HTTP
for other methods, and in particular for put, if-none-match used with the * value can be used to
save a file not known to exist, guaranteeing that another upload didn't happen before, losing the data of the previous put; this problem is a variation of the lost update problem.
Index - HTTP
it allows caches to be more efficient, and
saves bandwidth, as a web server does not need to send a full response if the content has not changed.
Set-Cookie - HTTP
warning: many web browsers have a session restore feature that will
save all tabs and restore them next time the browser is used.
Proxy servers and tunneling - HTTP
the javascript function contained in the pac file defines the function: the auto-config file should be
saved to a file with a .pac filename extension: proxy.pac and the mime type set to: application/x-ns-proxy-autoconfig the file consists of a function called findproxyforurl.
HTTP resources and specifications - HTTP
ndard rfc 7540 hypertext transfer protocol version 2 (http/2) proposed standard rfc 7541 hpack: header compression for http/2 on the standard track rfc 7838 http alternative services on the standard track rfc 7301 transport layer security (tls) application-layer protocol negotiation extension used to negotiate http/2 at the transport to
save an extra request/response round trip.
Indexed collections - JavaScript
let array = ['first', 'second', , 'fourth'] array.foreach(function(element) { console.log(element) }) // first // second // fourth if (array[2] === undefined) { console.log('array[2] is undefined') // true } array = ['first', 'second', undefined, 'fourth'] array.foreach(function(element) { console.log(element) }) // first // second // undefined // fourth since javascript elements are
saved as standard object properties, it is not advisable to iterate through javascript arrays using for...in loops, because normal elements and all enumerable properties will be listed.
Error.prototype.stack - JavaScript
<!doctype html> <meta charset="utf-8"> <title>stack trace example</title> <body> <script> function trace() { try { throw new error('myerror'); } catch(e) { alert(e.stack); } } function b() { trace(); } function a() { b(3, 4, '\n\n', undefined, {}); } a('first call, firstarg'); </script> assuming the above markup is
saved as c:\example.html on a windows file system it produces an alert message box with the following text: starting with firefox 30 and later containing the column number: trace@file:///c:/example.html:9:17 b@file:///c:/example.html:16:13 a@file:///c:/example.html:19:13 @file:///c:/example.html:21:9 firefox 14 to firefox 29: trace@file:///c:/example.html:9 b@file:///c:/example.html:16 a@file:///c...
JSON.stringify() - JavaScript
ession.screens.push({ 'name': 'screene', 'width': 390, 'height': 120 }); session.screens.push({ 'name': 'screenf', 'width': 1240, 'height': 650 }); // converting the json string with json.stringify() // then saving with localstorage in the name of session localstorage.setitem('session', json.stringify(session)); // example of how to transform the string generated through // json.stringify() and
saved in localstorage in json object again var restoredsession = json.parse(localstorage.getitem('session')); // now restoredsession variable contains the object that was
saved // in localstorage console.log(restoredsession); well-formed json.stringify() engines implementing the well-formed json.stringify specification will stringify lone surrogates, any code point from u+d800 to u+dfff, using uni...
TypedArray - JavaScript
the buffer address is
saved as an internal property of the instance and all the methods of %typedarray%.prototype, i.e.
Mobile first - Progressive web apps (PWAs)
you could create a block to only load the library in the case of narrow screen devices: if(window.matchmedia("(min-width: 481px)").matches) { require('three'); } we can, therefore,
save the bandwidth for browsers that don't need it.
<a> - SVG: Scalable Vector Graphics
attributes download instructs browsers to download a url instead of navigating to it, so the user will be prompted to
save it as a local file.