Electrolysis/e10s test tips: Difference between revisions

waitForFocus takes a browser
(Adjust about page reference)
(waitForFocus takes a browser)
Line 114: Line 114:


There is a separate focus manager in each process. When a child process is focused, the parent's focus manager will have its current focus on on that child's corresponding &lt;browser&gt; element. You can check <code>document.activeElement</code> in the parent process for this (or <code>Services.focus.focusedElement</code>). An existing test may be trying to retrieve <code>Services.focus.focusedElement</code> or using the commandDispatcher and these usages may need to be changed. To retrieve the focused element in a child process, use a ContentTask and check it from within there.
There is a separate focus manager in each process. When a child process is focused, the parent's focus manager will have its current focus on on that child's corresponding &lt;browser&gt; element. You can check <code>document.activeElement</code> in the parent process for this (or <code>Services.focus.focusedElement</code>). An existing test may be trying to retrieve <code>Services.focus.focusedElement</code> or using the commandDispatcher and these usages may need to be changed. To retrieve the focused element in a child process, use a ContentTask and check it from within there.
SimpleTest.waitForFocus and SimpleTest.promiseFocus also accept a &lt;browser&gt; element as the second argument. This can be used to focus a child tab and wait for it to focused.


=== Preferences ===
=== Preferences ===
287

edits