tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

use-cc-etc.rst (748B)


      1 use-cc-etc
      2 ======================
      3 
      4 This requires using ``Cc`` rather than ``Components.classes``, and the same for
      5 ``Components.interfaces``, ``Components.results`` and ``Components.utils``.
      6 This has a slight performance advantage by avoiding the use of the dot.
      7 
      8 Examples of incorrect code for this rule:
      9 -----------------------------------------
     10 
     11 .. code-block:: js
     12 
     13    let foo = Components.classes['bar'];
     14    let bar = Components.interfaces.bar;
     15    Components.results.NS_ERROR_ILLEGAL_INPUT;
     16    Components.utils.reportError('fake');
     17 
     18 Examples of correct code for this rule:
     19 ---------------------------------------
     20 
     21 .. code-block:: js
     22 
     23    let foo = Cc['bar'];
     24    let bar = Ci.bar;
     25    Cr.NS_ERROR_ILLEGAL_INPUT;
     26    Cu.reportError('fake');