Search completed in 1.54 seconds.
34 results for "XPCShell":
Your results are loading. Please wait...
xpcshell
xpcshell is an xpconnect-enabled javascript shell.
...unlike the ordinary js shell (js), xpcshell lets the scripts running in it access xpcom functionality.
... prerequisites you need your own build of mozilla to use xpcshell.
...And 9 more matches
XPCShell Reference
the command line the command-line syntax for xpcshell is: xpcshell [-s] [-w] [-w] [-v version] [-f scriptfile] [scriptfile] [scriptarg...] -c this option turns on the "compile-only" mode.
...xpcshell terminates upon script completion.
... furthermore, xpcshell looks for xpcshell.js in the current directory.
...And 2 more matches
Profiling XPCShell
in those cases, an xpcshell script can help.
...xpctools there is profiler in the tree that can profile xpcshell scripts.
...for example, on linux or macosx you do: export mozilla_js_profiler_output=/tmp/profile.txt now, run the script using xpcshell.
XPCshell Test Manifest Expressions
xpcshell unit tests are run by specifying them in a manifest file.
Index
MozillaTechXPCOMIndex
60 using components deprecated, guide, needscontent, xpcom, xpcom:language bindings, xpconnect xpconnect works transparently in mozilla and xpcshell to give you access to xpcom components.
... 64 nsiregistry xpcom:language bindings, xpconnect nsiregistry on mxr 65 xpcshell automated testing, developing mozilla, guide, javascript, javascript:tools, tools, xpcom, xpcom:language bindings, xpconnect xpcshell is an xpconnect-enabled javascript shell.
...unlike the ordinary js shell (js), xpcshell lets the scripts running in it access xpcom functionality.
...And 3 more matches
HOWTO
async network requests problem you want to make network requests or do other asynchronous work in xpcshell.
...put the following at the end of your script: // do async processing // from <https://developer.mozilla.org/en/xpconnect/xpcshell/howto> print("doing async work"); gscriptdone = false; var gthreadmanager = cc["@mozilla.org/thread-manager;1"] .getservice(ci.nsithreadmanager); var mainthread = gthreadmanager.currentthread; while (!gscriptdone) mainthread.processnextevent(true); while (mainthread.haspendingevents()) mainthread.processnextevent(true); 2.
...this is of course a massive, ugly hack prone to error, but this is what the xpcshell test harness does.
...And 3 more matches
How to add a build-time test
xpcshell tests here are the simple guidelines for adding an xpcshell test to the build system.
... for example, to add an xpcshell test to a module, do the following: copy tools/test-harness/xpcshell-simple/example to yourmoduledir/tests_type, wheretests_type is something that describes your tests.
... in <tt>yourmoduledir/tests_type/makefile.in</tt> change depth, module, and xpcshell_tests appropriately: depth should be a relative path pointing to <tt>mozilla/</tt>, e.g.
... xpcshell_tests be a list of subdirectories of the current directory which contain xpcshell tests.
MailNews automated testing
functional testing xpcshell-tests and make check these are core test harnesses to which mailnews adds its own tests.
... xpcshell-tests are run in javascript without any chrome present.
...xpcshell-tests are the quickest tests to run.
...these tests can go beyond the limitations of xpcshell-tests (for example, access c++ code) and other testing options that don't test at the right level.
Profiling with the Firefox Profiler
profiling js benchmark (xpcshell) to profile the script run.js with ionmonkey (-i), type inference (-n) and jäegermonkey (-m).
... thgis requires the following command: $ xpcshell -m -i -n -e ' const ci = components.interfaces; const cc = components.classes; var profiler = cc["@mozilla.org/tools/profiler;1"].getservice(ci.nsiprofiler); profiler.startprofiler( 10000000 /* = profiler memory */, 1 /* = sample rate: 100µs with patch, 1ms without */, ["stackwalk", "js"], 2 /* = features, and number of features.
... */ ); ' -f ./run.js -e ' var profileobj = profiler.getprofiledata(); print(json.stringify(profileobj)); ' | tail -n 1 > run.cleo the xpcshell output all benchmark information and on its last line it output the result of the profiling, you can filter it with tail -n 1 and redirect it to a file to prevent printing it in your shell.
MailNews fakeserver
using fakeserver in xpcshell tests since there are three different components of fakeserver, a total of four objects need to be set up in a fakeserver test on top of other testing.
...the server provides the following api to xpcshell tests: <caption> nsmailserver xpcshell api </caption> name arguments returns description performtest none nothing runs until the test is forcibly aborted or stopped normally isstopped none if the server is stopped helper for performtest istestfinished none if the test is finished helper for performtest playtransaction none the transaction the transaction is an object with two propertie...
...for xpcshell tests in mailnews/news, all files in mailnews/news/test/postings/auto-add are automatically added based on the newsgroups header.
Using nsIXULAppInfo - Archive of obsolete content
obtaining platform version information is done like this: var appinfo = components.classes["@mozilla.org/xre/app-info;1"] .getservice(components.interfaces.nsixulappinfo); var platformver = appinfo.platformversion; var platformbuildid = appinfo.platformbuildid; getting nsixulappinfo in xpcshell tests in firefox 21, a testing module was added that provides access to app info during the execution of xpcshell tests.
... see bug 809920, and in summary: // work around the fact that xpcshell doesn't have a proper app-info xpcom object.
Profiling SpiderMonkey
here's a sample mozconfig: mk_add_options moz_objdir=@topsrcdir@/ff-opt-libxul mk_add_options moz_make_flags=-j3 ac_add_options --enable-optimize ac_add_options --enable-libxul ac_add_options --enable-shark ac_add_options --enable-debugger-info-modules ac_add_options --enable-application=browser 2.) you'll want to run shark on both the browser and [xpcshell], since the host environments differ.
...if you're looking to investigate that, build a standalone copy of spidermonkey and compare it with xpcshell.
Using components
xpconnect works transparently in mozilla and xpcshell to give you access to xpcom components.
... commonly, we start our scripts like so: var cc = components.classes; var ci = components.interfaces; if we want to get a hold of a component, we then do something like: var rc = cc["@mozilla.org/registry;1"]; var rs = rc.getservice(ci.nsiregistry); see also: xpcshell -- how to get a command line interface to javascript more info as was already stated, it is common to start addon scripts like: var cc = components.classes; var ci = components.interfaces; there is also another way to start, which is exactly equivalent to the above.
nsIDOMParser
to create a domparser when the constructor is not available (e.g., from a js xpcom component, a js module, or an xpcshell test), use: var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); // optionally, call parser.init(principal, documenturi, baseuri); principals, document and base uri note: this section covers changes introduced to domparser in gecko 1.9.
...examples within the context of a window: var parser = new domparser(); var doc = parser.parsefromstring(astr, "application/xml"); outside of a window (e.g., a js xpcom component, a js module, or an xpcshell test): var parser = components.classes["@mozilla.org/xmlextras/domparser;1"] .createinstance(components.interfaces.nsidomparser); var doc = parser.parsefromstring(astr, "application/xml"); using components.constructor(): const domparser = new components.constructor("@mozilla.org/xmlextras/domparser;1", "nsidomparser"); var parser = new domparser(); parser.init(principal, documenturi...
Index
41 mailnews xpcshell-tests automated testing, developing mozilla, mailnews, seamonkey, thunderbird mailnews xpcshell-tests are written and run in the same manner as the core xpcshell-tests.
... this page describes additional resources and facilities that mailnews has developed to support the xpcshell-tests; see the core xpcshell-tests page for more information on how to develop these.
Mailnews and Mail code review requirements
for xpcshell tests, it has either passed on try or has been run locally on the appropriate platform(s).
... specifically, if the xpcshell test will do different things on windows than it will do on os x or linux, it must be run on windows and one of os x / linux.
Getting started with XULRunner - Archive of obsolete content
rytime you want to install a new version: firefox_version=`grep -po "\d{2}\.\d+" /usr/lib/firefox/platform.ini` arch=`uname -p` xurl=https://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/$firefox_version/runtimes/xulrunner-$firefox_version.en-us.linux-$arch.tar.bz2 cd /opt sudo sh -c "wget -o- $xurl | tar -xj" sudo ln -s /opt/xulrunner/xulrunner /usr/bin/xulrunner sudo ln -s /opt/xulrunner/xpcshell /usr/bin/xpcshell you could also save this script to a file for convenience.
2006-11-03 - Archive of obsolete content
john gaunt discusses a proposed xulrunner unit-tests like xpcshell.
2006-11-10 - Archive of obsolete content
summary: mozilla.dev.platform - november 4th - november 10th, 2006 announcements no announcements this week traffic beaufour moves the discussion about xulrunner unit-tests like xpcshell from mozilla.dev.platform to mozilla.dev.quality.
2006-10-27 - Archive of obsolete content
he recommends that a non-xpcshell environment is needed really badly, but the big issue is that the xpcshell doesn't have an event loop, so nothing asynchronous can be tested.
2006-11-10 - Archive of obsolete content
discussions xulrunner unit-tests like xpcshell - allan hacked the xpcshell-simple harness so it fits his needs.
JS-Engine FAQ - Archive of obsolete content
to write wrappers in pure javascript to interface with any c library on the system there are mechanisms such as xpcshell, wxjs, jsdb, jsni coding spidermonkey in c check out this tutorial how to compile tamarin on linux/x86 there is a patch that allows you to compile it.
Makefile - variables
python_unit_tests list of python scripts to check exit status for make check xpc_shell_tests no_xpcshell_manifest_check inhibit validating manifest files when running xpcshell tests.
ESLint
ensure there is a .eslintrc.js file that extends one of: "plugin:mozilla/browser-test" "plugin:mozilla/chrome-test" "plugin:mozilla/mochitest-test" "plugin:mozilla/xpcshell-test" see other test directories for how to do this.
Reviewer Checklist
if it's js, try to design and build so that xpcshell can exercise most functionality.
mach
if it works, you can look at compiler warnings: $ ./mach warnings-list try running the program: $ ./mach run try running your program in a debugger: $ ./mach run --debug try running some tests: $ ./mach xpcshell-test services/common/tests/unit/ or run an individual test: $ ./mach mochitest browser/base/content/test/general/browser_pinnedtabs.js you run mach from the source directory, so you should be able to use your shell's tab completion to tab-complete paths to tests.
Creating a New Protocol
it may be possible to test protocols unrelated to a particular window using the xpcshell testing framework, which has additional primitives in electrolysis for launching and running js commands in a content process.
Assert.jsm
this report method only throws errors on assertion failures, as per spec, but consumers of this module (think: xpcshell-test, mochitest) may want to override this default implementation.
Hacking Tips
using the gecko profiler (browser / xpcshell) see the section dedicated to profiling with the gecko profiler.
Using XPCOM Components
xpconnect is what binds the application code to the user interface of the mozilla browser, to other gecko-based xul, and to javascript environments like xpcshell, which is a command-line javascript interpreter and xpcom tool is built with mozilla.
Architecture basics
xpcshell is a command line interface to mozilla javascript.
appShellService
then again, there's a much easier way; one of the xpcshell extensions is a quit function: quit(3) ...
XPConnect
wrappers what sorts of wrappers xpconnect generates and uses xpconnect security membranes tools xpcshell join the xpcom community choose your preferred method for joining the discussion: mailing list newsgroup rss feed irc: #developers (learn more)tools: javascript component wizard, visual c++ component wizard, visual c++ component wizard for visual studio 2010 ...
JavaScript shells - JavaScript
javascript shell (js) - a command line interpreter for javascript xpcshell is an xpconnect - enabled shell, sometimes useful for mozilla development.