Electrolysis/e10s test tips: Difference between revisions

Jump to navigation Jump to search
→‎Mochitest (plain): Add more details on loadChromeScript
(waitForFocus takes a browser)
(→‎Mochitest (plain): Add more details on loadChromeScript)
Line 26: Line 26:
** Some services are only available in the parent process (form history, window watcher, etc).
** Some services are only available in the parent process (form history, window watcher, etc).
** <code>SpecialPowers.loadChromeScript</code> allows you to have a "worker" in the parent process with which to communicate.
** <code>SpecialPowers.loadChromeScript</code> allows you to have a "worker" in the parent process with which to communicate.
*** One nice thing for porting synchronous tests is that the chrome script is run synchronously.
*** After {{bug|1251139}}, you can pass a function to run in the parent instead of a URL (since data URIs don't work with loadChromeScript).
*** {{bug|1153128}} is adding sendSyncMessage to the return value of loadChromeScript. Currently its sendAsyncMessage method is sync even though it's labelled as Async ({{bug|1251141}})
** <code>SpecialPowers.importInMainProcess("resource://gre/modules/SomeService.jsm")</code> will call Cu.import in the main process with the given URI, which is useful when your test needs to start some main process service.
** <code>SpecialPowers.importInMainProcess("resource://gre/modules/SomeService.jsm")</code> will call Cu.import in the main process with the given URI, which is useful when your test needs to start some main process service.


Confirmed users
933

edits

Navigation menu