Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: third_party/mozprofile/README.md

Issue 108313011: Adding mozilla libraries required by Firefox interop test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/mozprofile/README.chromium ('k') | third_party/mozprofile/mozprofile/__init__.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 [Mozprofile](https://github.com/mozilla/mozbase/tree/master/mozprofile)
2 is a python tool for creating and managing profiles for Mozilla's
3 applications (Firefox, Thunderbird, etc.). In addition to creating profiles,
4 mozprofile can install [addons](https://developer.mozilla.org/en/addons)
5 and set
6 [preferences](https://developer.mozilla.org/En/A_Brief_Guide_to_Mozilla_Preferen ces).
7 Mozprofile can be utilized from the command line or as an API.
8
9
10 # Command Line Usage
11
12 mozprofile may be used to create profiles, set preferences in
13 profiles, or install addons into profiles.
14
15 The profile to be operated on may be specified with the `--profile`
16 switch. If a profile is not specified, one will be created in a
17 temporary directory which will be echoed to the terminal:
18
19 (mozmill)> mozprofile
20 /tmp/tmp4q1iEU.mozrunner
21 (mozmill)> ls /tmp/tmp4q1iEU.mozrunner
22 user.js
23
24 To run mozprofile from the command line enter:
25 `mozprofile --help` for a list of options.
26
27
28 # API Usage
29
30 To use mozprofile as an API you can import
31 [mozprofile.profile](https://github.com/mozilla/mozbase/tree/master/mozprofile/m ozprofile/profile.py)
32 and/or the
33 [AddonManager](https://github.com/mozilla/mozbase/tree/master/mozprofile/mozprof ile/addons.py).
34
35 `mozprofile.profile` features a generic `Profile` class. In addition,
36 subclasses `FirefoxProfile` and `ThundebirdProfile` are available
37 with preset preferences for those applications.
38
39 `mozprofile.profile:Profile`:
40
41 def __init__(self,
42 profile=None, # Path to the profile
43 addons=None, # String of one or list of addons to install
44 addon_manifests=None, # Manifest for addons, see http://ahal.c a/blog/2011/bulk-installing-fx-addons/
45 preferences=None, # Dictionary or class of preferences
46 locations=None, # locations to proxy
47 proxy=False, # setup a proxy
48 restore=True # If true remove all installed addons preferences when cleaning up
49 ):
50
51 def reset(self):
52 """reset the profile to the beginning state"""
53
54 def set_preferences(self, preferences, filename='user.js'):
55 """Adds preferences dict to profile preferences"""
56
57 def clean_preferences(self):
58 """Removed preferences added by mozrunner."""
59
60 def cleanup(self):
61 """Cleanup operations for the profile."""
62
63
64 `mozprofile.addons:AddonManager`:
65
66 def __init__(self, profile):
67 """profile - the path to the profile for which we install addons"""
68
69 def install_addons(self, addons=None, manifests=None):
70 """
71 Installs all types of addons
72 addons - a list of addon paths to install
73 manifest - a list of addon manifests to install
74 """
75
76 @classmethod
77 def get_amo_install_path(self, query):
78 """
79 Return the addon xpi install path for the specified AMO query.
80 See: https://developer.mozilla.org/en/addons.mozilla.org_%28AMO%29_API_D evelopers%27_Guide/The_generic_AMO_API
81 for query documentation.
82 """
83
84 @classmethod
85 def addon_details(cls, addon_path):
86 """
87 returns a dictionary of details about the addon
88 - addon_path : path to the addon directory
89 Returns:
90 {'id': u'rainbow@colors.org', # id of the addon
91 'version': u'1.4', # version of the addon
92 'name': u'Rainbow', # name of the addon
93 'unpack': False } # whether to unpack the addon
94 """
95
96 def clean_addons(self):
97 """Cleans up addons in the profile."""
98
99
100 # Installing Addons
101
102 Addons may be installed individually or from a manifest.
103
104 Example:
105
106 from mozprofile import FirefoxProfile
107
108 # create new profile to pass to mozmill/mozrunner
109 profile = FirefoxProfile(addons=["adblock.xpi"])
110
111
112 # Setting Preferences
113
114 Preferences can be set in several ways:
115
116 - using the API: You can pass preferences in to the Profile class's
117 constructor: `obj = FirefoxProfile(preferences=[("accessibility.typeaheadfind. flashBar", 0)])`
118 - using a JSON blob file: `mozprofile --preferences myprefs.json`
119 - using a `.ini` file: `mozprofile --preferences myprefs.ini`
120 - via the command line: `mozprofile --pref key:value --pref key:value [...]`
121
122 When setting preferences from an `.ini` file or the `--pref` switch,
123 the value will be interpolated as an integer or a boolean
124 (`true`/`false`) if possible.
125
126 # Setting Permissions
127
128 mozprofile also takes care of adding permissions to the profile.
129 See https://github.com/mozilla/mozbase/blob/master/mozprofile/mozprofile/permiss ions.py
130
131
132 # Resources
133
134 Other Mozilla programs offer additional and overlapping functionality
135 for profiles. There is also substantive documentation on profiles and
136 their management.
137
138 - [ProfileManager](https://developer.mozilla.org/en/Profile_Manager) :
139 XULRunner application for managing profiles. Has a GUI and CLI.
140 - [python-profilemanager](http://k0s.org/mozilla/hg/profilemanager/) : python CL I interface similar to ProfileManager
141 - profile documentation : http://support.mozilla.com/en-US/kb/Profiles
OLDNEW
« no previous file with comments | « third_party/mozprofile/README.chromium ('k') | third_party/mozprofile/mozprofile/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698