gecko-dev/testing/eslint-plugin-mozilla/docs/no-cpows-in-tests.rst
Michael Ratcliffe 65b3f9f335 Bug 1218412 - Create ESLint rule to check for CPOWS in browser mochitests r=pbrosset
--HG--
extra : transplant_source : %A8%14Q%E4n%F4%A8%001%B7F%5D%04WO%A2A%CFY%D4
2015-10-30 17:24:45 +00:00

26 lines
630 B
ReStructuredText

.. _no-cpows-in-tests:
=================
no-cpows-in-tests
=================
Rule Details
------------
This rule checks if the file is a browser mochitest and, if so, checks for
possible CPOW usage by checking for the following strings:
- "gBrowser.contentWindow"
- "gBrowser.contentDocument"
- "gBrowser.selectedBrowser.contentWindow"
- "browser.contentDocument"
- "window.content"
- "content"
- "content."
Note: These are string matches so we will miss situations where the parent
object is assigned to another variable e.g.::
var b = gBrowser;
b.content // Would not be detected as a CPOW.