Search completed in 0.83 seconds.
22 results for "ChromeWorker":
Your results are loading. Please wait...
ChromeWorker
summary if you're developing privileged code, and would like to create a worker that can use js-ctypes to perform calls to native code, you can do so by using chromeworker instead of the standard worker object.
...examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below.
... to use a postmessage with callback version of chromeworker that features promises, see promiseworker.
...And 4 more matches
ChromeWorkers and the Chrome worker loader
to complement the open web worker functionality, mozilla has introduced the chromeworker interface, which provides this capability within application chrome.
PromiseWorker.jsm
summary a promiseworker is a chromeworker except instead of calling postmessage() to send a message, you call post(), which returns a promise.
...like chromeworker objects, promiseworker is mostly used for js-ctypes but it is not limited to that.
... there is no xpcom access, similar to chromeworker.
... this answers the question "when should i use a promiseworker?", and the answer is, whenever you would normally use a chromeworker, but want postmessage to return promises.
nsIWorkerFactory
instead, you can just do new worker or new chromeworker.
...to create an instance, use: var workerfactory = components.classes['@mozilla.org/threads/workerfactory;1'] .createinstance(components.interfaces.nsiworkerfactory); method overview nsiworker newchromeworker(in domstring ascripturl); methods newchromeworker() returns a new chromeworker that will run a specified script.
... nsiworker newchromeworker( in domstring ascripturl ); parameters ascripturl the url of the script to load into the new worker.
... return value an nsiworker object representing the new chromeworker.
Worker.prototype.postMessage() - Web APIs
transfer example this example shows a firefox add-on that transfers an arraybuffer from the main thread to the chromeworker, and then the chromeworker transfers it back to the main thread.
... main thread code: var myworker = new chromeworker(self.path + 'myworker.js'); function handlemessagefromworker(msg) { console.log('incoming message from worker, msg:', msg); switch (msg.data.atopic) { case 'do_sendmainarrbuff': sendmainarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } myworker.addeventlistener('message', handlemessagefromworker); // ok lets create the buffer and send it var arrbuf = new arraybuffer(8); console.info('arrbuf.bytelength pre transfer:', arrbuf.bytelength); myworker.postmessage( { atopic: 'do_sendworkerarrbuff', abuf: arrbuf // the array buffer that we passed to the transferrable section 3 lines below }, [ arrbuf // the ...
...array buffer we created 9 lines above ] ); console.info('arrbuf.bytelength post transfer:', arrbuf.bytelength); worker code self.onmessage = function (msg) { switch (msg.data.atopic) { case 'do_sendworkerarrbuff': sendworkerarrbuff(msg.data.abuf) break; default: throw 'no atopic on incoming message to chromeworker'; } } function sendworkerarrbuff(abuf) { console.info('from worker, pre send back abuf.bytelength:', abuf.bytelength); self.postmessage({atopic:'do_sendmainarrbuff', abuf:abuf}, [abuf]); console.info('from worker, post send back abuf.bytelength:', abuf.bytelength); } output logged arrbuf.bytelength pre transfer: 8 bootstrap.js:40 arrbuf.bytelength post transfer: 0 ...
...to see a full working example of this firefox demo add-on see here: github :: chromeworker - demo-transfer-arraybuffer specifications specification status comment html living standardthe definition of 'worker.postmessage()' in that specification.
Chrome-only API reference
MozillaGeckoChromeAPI
it currently works in (privileged) chrome code on firefox desktop (version 47 and above).chromeworkerif you're developing privileged code, and would like to create a worker that can use js-ctypes to perform calls to native code, you can do so by using chromeworker instead of the standard worker object.
...examples of chromeworker's using js-ctypes are availabe on github and are linked to from the see also section below.
... to use a postmessage with callback version of chromeworker that features promises, see promiseworker.
Appendix D: Loading Scripts - Archive of obsolete content
const { services } = module("resource://gre/modules/services.jsm"); const { bar, foo } = module("my-module"); dom workers: worker and chromeworker dom workers can be used to load scripts into their own global contexts which run in their own threads.
...chromeworkers also have access to ctypes and a limited number of thread safe xpcom classes, but are otherwise limited to simple computation based on data passed via messages and xmlhttprequests.
Using workers in JavaScript code modules
you can do so by using chromeworker instead of the standard worker object.
...to create a chromeworker for this purpose, you need to use the nsiworkerfactory interface: var workerfactory = components.classes['@mozilla.org/threads/workerfactory;1'] .createinstance(components.interfaces.nsiworkerfactory); var worker = workerfactory.newchromeworker('script_url.js'); this will create a new chrome worker that will immediately begin to run the script at the specified ur...
Performance best practices in extensions - Archive of obsolete content
consider using chrome workers you can use a chromeworker to execute long running tasks or do data processing.
Using workers in extensions - Archive of obsolete content
a note about chromeworkers requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) gecko 2.0 added the new chromeworker object, which provides a special chrome-only worker that can be used by applications and extensions.
Performance best practices for Firefox front-end engineers
if you need more elevated privileges than a standard worker allows, consider using a chromeworker, which is a firefox-only api which lets you create workers with more elevated privileges.
JavaScript code modules
promiseworker.jsm a version of chromeworker which uses promises to return the worker's result instead of using an event to do so.
Making cross-thread calls using runnables
} see also chromeworker using workers in javascript code modules the thread manager ...
The Thread Manager
application/extension javascript should consider using a chromeworker instead.") interfaces there are several interfaces that provide threading support: nsithreadmanager the thread manager itself lets you create threads.
WebIDL bindings
this can be safely used for apis exposed in workers; there it will indicate whether the worker involved is a chromeworker or not.
Using COM from js-ctypes
if this code were used in a production add-on, then to avoid firefox locking up, run this code from a chromeworker.
Using Objective-C from js-ctypes
if this code were to be used in a production add-on, then to avoid firefox locking up, run this code from a chromeworker.
Standard OS Libraries
if you would like to do stuff off of the main thread, in chromeworker's, then you should use xcb.
js-ctypes
using js-ctypes ctypes.open custom native file standard os libraries finding window handles working with data working with arraybuffers declaring types declaring and calling functions declaring and using callbacks type conversion memory management chromeworker js-ctypes reference a reference guide to the js-ctypes api.
Using Web Workers - Web APIs
see chromeworker for more details.
Web Workers API - Web APIs
see chromeworker for more details.
Worker - Web APIs
WebAPIWorker
(fetch is also available, with no such restrictions.) in firefox extensions, if you want to use workers with access to js-ctypes, use chromeworker object instead.