118
edits
(→Browser-chrome: e10s is the default for test runs now.) |
(Don't use CPOWs! Also sometimes the info is already in the parent) |
||
Line 126: | Line 126: | ||
You can also use <code>browser.messageManager.loadFrameScript("data:,(" + fn.toString() + ")()")</code> to load a script and execute it in the child process. In addition, you can use the message manager to pass messages from the child to the parent and vice versa. Newer tests tend to use ContentTask instead for better readability, but there are some specific cases where message passing may be needed. Note: the opposite of loadFrameScript is <code>SpecialPowers.loadChromeScript</code> but you need to pass a URL or function, not a data URI. | You can also use <code>browser.messageManager.loadFrameScript("data:,(" + fn.toString() + ")()")</code> to load a script and execute it in the child process. In addition, you can use the message manager to pass messages from the child to the parent and vice versa. Newer tests tend to use ContentTask instead for better readability, but there are some specific cases where message passing may be needed. Note: the opposite of loadFrameScript is <code>SpecialPowers.loadChromeScript</code> but you need to pass a URL or function, not a data URI. | ||
=== browser.contentWindow/contentDocument === | === <code>browser.contentWindow/contentDocument</code> === | ||
Avoid accessing the contentWindow or the contentDocument from the test. These are CPOW objects that are often unsafe to use, and slower | Avoid accessing the contentWindow or the contentDocument from the test. These are CPOW objects that are often unsafe to use, and slower. | ||
Many test fixes will involve removing usage of these that access child objects within the parent process. To replace usages, use the techniques listed above, such as using a ContentTask. | Many test fixes will involve removing usage of these that access child objects within the parent process. To replace usages, use the techniques listed above, such as using a <code>ContentTask</code> by using APIs in the parent process that already have the information necessary (e.g. replacing <code>browser.contentDocument.title</code> with <code>browser.contentTitle</code>). |
edits