Bug 2024589 - doc: use the :searchfox: macro r=asuth,perftest-reviewers,necko-reviewers,mozperftest-reviewers,geckoview-reviewers,extension-reviewers,credential-management-reviewers,search-reviewers,releng-reviewers,places-reviewers,profiler-reviewers,win-reviewers,omc-reviewers,urlbar-reviewers,permissions-reviewers,core-sessionstore-reviewers,browser-installer-reviewers,layout-reviewers,dom-worker-reviewers,ai-platform-reviewers,niklas,sthompson,janerik,bhearsum,valentin,dshin,sparky,scunnane,canaltinova,hanna_a,handyman,ahal,farre,jteow,emz,nrishel,ohall,dimi,robwu,emilio

Differential Revision: https://phabricator.services.mozilla.com/D288640
This commit is contained in:
Sylvestre Ledru
2026-04-30 13:28:53 +00:00
committed by sledru@mozilla.com
parent 62b1ca8d05
commit a2ce5437ce
188 changed files with 939 additions and 1253 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ Firefox has multiple different sets of "branding" that are used to hold channel-
* Product names (eg: "Mozilla Firefox", "Firefox Developer Edition")
* Channel-specific preferences (eg: ``app.update.interval``)
Brandings are stored in the `branding subdirectory <https://searchfox.org/firefox-main/source/browser/branding>`_ and map to builds as follows:
Brandings are stored in the :searchfox:`branding subdirectory <browser/branding>` and map to builds as follows:
- ``official`` is used for Release and Beta builds
- ``aurora`` is used for Developer Edition builds
@@ -5,9 +5,7 @@ The ``BackupService`` module is architected in a way to make testing its
individual components relatively easy with unit tests.
The main entry point exists in a module called
``BackupService.sys.mjs``, which is `invoked and initialized via in the
BrowserGlue idle tasks
list <https://searchfox.org/mozilla-central/rev/97feebcab27f1a92e70ceacaa77211e9eaba0e6e/browser/components/BrowserGlue.sys.mjs#2449-2470>`__
``BackupService.sys.mjs``, which is :searchfox:`invoked and initialized via in the BrowserGlue idle tasks list <mozilla-central/rev/97feebcab27f1a92e70ceacaa77211e9eaba0e6e:browser/components/BrowserGlue.sys.mjs#2449-2470>`
The ``BackupService`` manages two high-level operations: creation of
backups, and recovery from such backups.
@@ -14,57 +14,38 @@ Frontend
--------
The frontend part of the bookmarking experience includes various kind of views:
* `Trees`_
* `Menus`_
* `Toolbars`_
* :searchfox:`Trees <browser/components/places/content/places-tree.js>`
* :searchfox:`Menus <mozilla-central/rev/4c184ca81b28f1ccffbfd08f465709b95bcb4aa1:browser/components/places/content/browserPlacesViews.js#1990>`
* :searchfox:`Toolbars <mozilla-central/rev/4c184ca81b28f1ccffbfd08f465709b95bcb4aa1:browser/components/places/content/browserPlacesViews.js#894>`
.. _Trees: https://searchfox.org/firefox-main/source/browser/components/places/content/places-tree.js
.. _Menus: https://searchfox.org/mozilla-central/rev/4c184ca81b28f1ccffbfd08f465709b95bcb4aa1/browser/components/places/content/browserPlacesViews.js#1990
.. _Toolbars: https://searchfox.org/mozilla-central/rev/4c184ca81b28f1ccffbfd08f465709b95bcb4aa1/browser/components/places/content/browserPlacesViews.js#894
All the views share a common :searchfox:`Controller <browser/components/places/content/controller.js>` that is responsible to handle operations and commands required by the views. Each view creates a Result object and receives notifications about changes from it.
All the views share a common `Controller`_ that is responsible to handle operations and commands required by the views. Each view creates a Result object and receives notifications about changes from it.
As an example, removing a bookmark from a view will call into the controller that calls into PlacesTransactions to actually do the removal. The removal will notify a :searchfox:`Places event <dom/chrome-webidl/PlacesEvent.webidl>`, that is caught by the Result, that will immediately update its internal representation of the bookmarks tree. Then the Result sends a notification to the view that will handle it, updating what the user is seeing. The system works according to the classical `Model-View-Controller`_ pattern.
As an example, removing a bookmark from a view will call into the controller that calls into PlacesTransactions to actually do the removal. The removal will notify a `Places event`_, that is caught by the Result, that will immediately update its internal representation of the bookmarks tree. Then the Result sends a notification to the view that will handle it, updating what the user is seeing. The system works according to the classical `Model-View-Controller`_ pattern.
Fronted dialogs and panels are written using xhtml and shadow DOM. The bookmark dialogs in particular are wrappers around a common template, :searchfox:`editBookmarkPanel.inc.xhtml <browser/components/places/content/editBookmarkPanel.inc.xhtml>`, it could be extended or overloaded like an object (overlay, similar to Web Component).
Fronted dialogs and panels are written using xhtml and shadow DOM. The bookmark dialogs in particular are wrappers around a common template, `editBookmarkPanel.inc.xhtml`_, it could be extended or overloaded like an object (overlay, similar to Web Component).
Most of the logic for the edit bookmark overlay lives in the generic script :searchfox:`editBookmark.js <browser/components/places/content/editBookmark.js>`.
Most of the logic for the edit bookmark overlay lives in the generic script `editBookmark.js`_.
.. _Controller: https://searchfox.org/firefox-main/source/browser/components/places/content/controller.js
.. _Places event: https://searchfox.org/firefox-main/source/dom/chrome-webidl/PlacesEvent.webidl
.. _Model-View-Controller: https://en.wikipedia.org/wiki/Modelviewcontroller
.. _editBookmarkPanel.inc.xhtml: https://searchfox.org/firefox-main/source/browser/components/places/content/editBookmarkPanel.inc.xhtml
.. _editBookmark.js: https://searchfox.org/firefox-main/source/browser/components/places/content/editBookmark.js
Structure of Frontend
^^^^^^^^^^^^^^^^^^^^^
Most part of frontend code is located in : `Browser/Components/Places/Content`_:
Most part of frontend code is located in : :searchfox:`Browser/Components/Places/Content <browser/components/places/content>`:
- `BookmarkProperties`_ , BookmarkProperties.xhtml - responsible for editBookmarks & newBookmark Dialog. The panel is initialized based on data given in the js object passed as ``window.arguments[0]``. ``Window.arguments[0]`` is set to the guid of the item, if the dialog is accepted.
- :searchfox:`BookmarkProperties <browser/components/places/content/bookmarkProperties.js>` , BookmarkProperties.xhtml - responsible for editBookmarks & newBookmark Dialog. The panel is initialized based on data given in the js object passed as ``window.arguments[0]``. ``Window.arguments[0]`` is set to the guid of the item, if the dialog is accepted.
- BookmarksHistoyTooltip.xhtml - code responsible for tooltip
- `BookmarksSidebar`_, bookmarksSidebar.xhtml - code responsible for sidebar window. Searches through existing bookmarks tree for desired bookmark.
- `BrowserPlacesViews`_ - controls most views (menu, panels, toolbox). The base view implements everything that's common to the toolbar and menu views.
- `Controller`_ - controller shared by all places views. Connect UI and actual operations.
- `EditBookmark`_, editBookmarkPanel.inc.xhtml - controls edit bookmark panel. Observes changes for bookmarks and connects all UI manipulations with backend.
- `HistorySidebar`_, historySidebar.xhtml - code responsible for history sidebar window. Searches through existing tree for requested History.
- `Places-menupopup`_ - custom element definition for Places menus
- `Places-tree`_ - class ``MozPlacesTree`` - builds a custom element definition for the places tree. This is loaded into all XUL windows. Has to be wrapped in a block to prevent leaking to a window scope.
- :searchfox:`BookmarksSidebar <browser/components/places/content/bookmarksSidebar.js>`, bookmarksSidebar.xhtml - code responsible for sidebar window. Searches through existing bookmarks tree for desired bookmark.
- :searchfox:`BrowserPlacesViews <browser/components/places/content/browserPlacesViews.js>` - controls most views (menu, panels, toolbox). The base view implements everything that's common to the toolbar and menu views.
- :searchfox:`Controller <browser/components/places/content/controller.js>` - controller shared by all places views. Connect UI and actual operations.
- :searchfox:`EditBookmark <browser/components/places/content/editBookmark.js>`, editBookmarkPanel.inc.xhtml - controls edit bookmark panel. Observes changes for bookmarks and connects all UI manipulations with backend.
- :searchfox:`HistorySidebar <browser/components/places/content/historySidebar.js>`, historySidebar.xhtml - code responsible for history sidebar window. Searches through existing tree for requested History.
- :searchfox:`Places-menupopup <browser/components/places/content/places-menupopup.js>` - custom element definition for Places menus
- :searchfox:`Places-tree <browser/components/places/content/places-tree.js>` - class ``MozPlacesTree`` - builds a custom element definition for the places tree. This is loaded into all XUL windows. Has to be wrapped in a block to prevent leaking to a window scope.
- Places.css, places.js, places.xhtml - responsible for Library window
- PlacesCommands.inc.xhtml - commands for multiple windows
- PlacesContextMenu.inc.xhtml - definition for context menu
- `TreeView`_ - implementation of the tree view
.. _Browser/Components/Places/Content: https://searchfox.org/firefox-main/source/browser/components/places/content
.. _BookmarkProperties: https://searchfox.org/firefox-main/source/browser/components/places/content/bookmarkProperties.js
.. _BookmarksSidebar: https://searchfox.org/firefox-main/source/browser/components/places/content/bookmarksSidebar.js
.. _BrowserPlacesViews: https://searchfox.org/firefox-main/source/browser/components/places/content/browserPlacesViews.js
.. _EditBookmark: https://searchfox.org/firefox-main/source/browser/components/places/content/editBookmark.js
.. _HistorySidebar: https://searchfox.org/firefox-main/source/browser/components/places/content/historySidebar.js
.. _Places-menupopup: https://searchfox.org/firefox-main/source/browser/components/places/content/places-menupopup.js
.. _Places-tree: https://searchfox.org/firefox-main/source/browser/components/places/content/places-tree.js
.. _TreeView: https://searchfox.org/firefox-main/source/browser/components/places/content/treeView.js
- :searchfox:`TreeView <browser/components/places/content/treeView.js>` - implementation of the tree view
Backend
-------
@@ -78,21 +59,18 @@ Toolkit Places also provides a way to query bookmarks, through Results. This is
Structure of Backend
^^^^^^^^^^^^^^^^^^^^
Most part of backend code is located in : `Toolkit/Components/Places`_:
Most part of backend code is located in : :searchfox:`Toolkit/Components/Places <toolkit/components/places>`:
- :doc:`Bookmarks` - Asynchronous API for managing bookmarks
- :doc:`History` - Asynchronous API for managing history
- `PlacesUtils`_ - This module exports functions for Sync to use when applying remote records
- :searchfox:`PlacesUtils <toolkit/components/places/PlacesUtils.sys.mjs>` - This module exports functions for Sync to use when applying remote records
- :doc:`PlacesTransactions` - This module serves as the transactions manager for Places
.. _Toolkit/Components/Places: https://searchfox.org/firefox-main/source/toolkit/components/places
.. _PlacesUtils: https://searchfox.org/firefox-main/source/toolkit/components/places/PlacesUtils.sys.mjs
Storage
-------
Places uses `SQLite`_ (C-language library with a stable, cross-platform, and backwards compatible file format) as its data storage backend.
All the data is contained in a places.sqlite file, in the roaming Firefox profile folder. The database is accessed using a wrapper of the SQLite library called `mozStorage`_.
All the data is contained in a places.sqlite file, in the roaming Firefox profile folder. The database is accessed using a wrapper of the SQLite library called :searchfox:`mozStorage <storage>`.
For storing our favicons we use favicons.sqlite which is represented as ATTACH-ed to places.sqlite. That makes it easier to use our two separate sqlites as one single database.
Synchronization
@@ -101,5 +79,4 @@ Synchronization
Places works in strict contact with `Firefox Sync`_, to synchronize bookmarks and history across devices, thus you can meet Sync specific code in various parts of the Places codebase. Some of the code may refer to Weave, the old project name for Sync.
.. _SQLite: https://www.sqlite.org/index.html
.. _mozStorage: https://searchfox.org/firefox-main/source/storage
.. _Firefox Sync: https://www.mozilla.org/en-US/firefox/sync/
@@ -10,8 +10,8 @@ Generally - the Observer pattern follows a subscription model. A subscriber (com
Each successful operation is noticed by observer for these events and passed to a subscriber.
`PlacesObservers.webidl`_ a Global Singleton which provides utilities to observe or notify all events.
`PlacesEvent.webidl`_ states all types of possible events and describes their features. In our case, events are:
:searchfox:`PlacesObservers.webidl <dom/chrome-webidl/PlacesObservers.webidl>` a Global Singleton which provides utilities to observe or notify all events.
:searchfox:`PlacesEvent.webidl <dom/chrome-webidl/PlacesEvent.webidl>` states all types of possible events and describes their features. In our case, events are:
- ``“page-visited”`` - ``data: PlacesVisit`` Fired whenever a page is visited
- ``“bookmark-added”`` - ``data: PlacesBookmarkAddition`` Fired whenever a bookmark (or a bookmark folder/separator) is created.
@@ -30,6 +30,3 @@ Each successful operation is noticed by observer for these events and passed to
- ``“page-rank-changed”`` - ``data: PlacesRanking`` Fired whenever pages ranking is changed.
- ``“page-removed”`` - ``data: PlacesVisitRemoved`` Fired whenever a page or its visits are removed. This may be invoked when a page is removed from the store because it has no more visits, nor bookmarks. It may also be invoked when all or some of the page visits are removed, but the page itself is not removed from the store, because it may be bookmarked.
- ``“purge-caches”`` - ``data: PlacesPurgeCaches`` Fired whenever changes happened that could not be observed through other notifications, for example a database fixup. When received, observers, especially data views, should drop any caches and reload from scratch.
.. _PlacesObservers.webidl: https://searchfox.org/firefox-main/source/dom/chrome-webidl/PlacesObservers.webidl
.. _PlacesEvent.webidl: https://searchfox.org/firefox-main/source/dom/chrome-webidl/PlacesEvent.webidl
+1 -2
View File
@@ -13,7 +13,7 @@ The search area covers:
Search Engine handling is taken care of with the `toolkit Search Service`_.
Most of the search code lives in `browser/components/search`_.
Most of the search code lives in :searchfox:`browser/components/search`.
.. toctree::
@@ -22,4 +22,3 @@ Most of the search code lives in `browser/components/search`_.
telemetry
.. _toolkit Search Service: /toolkit/search/index.html
.. _browser/components/search: https://searchfox.org/firefox-main/source/browser/components/search
+1 -1
View File
@@ -212,5 +212,5 @@ browser.search.adclicks.*
.. _additional telemetry of its own: /browser/urlbar/telemetry.html
.. _SearchSERPTelemetry.sys.mjs and the associated parent/child actors: https://searchfox.org/mozilla-central/search?q=&path=SearchSERPTelemetry*.sys.mjs&case=false&regexp=false
.. _BrowserSearchTelemetry: https://searchfox.org/firefox-main/source/browser/components/search/BrowserSearchTelemetry.sys.mjs
.. _BrowserSearchTelemetry: :searchfox:`browser/components/search/BrowserSearchTelemetry.sys.mjs`
.. _sap.counts Event documentation: https://dictionary.telemetry.mozilla.org/apps/firefox_desktop/metrics/sap_counts
+4 -11
View File
@@ -53,7 +53,7 @@ JavaScript API
``browser/components/touchbar/MacTouchBar.sys.mjs`` defines what specific inputs are
available to the user, what icon they will have, what action they will perform,
and so on. Inputs are defined in the ``gBuiltInInputs`` object `in that file`_.
and so on. Inputs are defined in the ``gBuiltInInputs`` object :searchfox:`in that file <mozilla-central/rev/669fac9888b173c02baa4c036e980c0c204dfe02:browser/components/touchbar/MacTouchBar.sys.mjs#76>`.
When creating a new object in ``gBuiltInInputs``, the available properties are
documented in the JSDoc for ``TouchBarInput``:
@@ -98,8 +98,6 @@ Clarification on some of these properties is warranted.
``kInputTypes.POPOVER``, any input type except another ``kInputTypes.POPOVER``
can be used.
.. _in that file: https://searchfox.org/mozilla-central/rev/669fac9888b173c02baa4c036e980c0c204dfe02/browser/components/touchbar/MacTouchBar.sys.mjs#76
Input types
-----------
@@ -238,12 +236,10 @@ will make the input available in the Touch Bar customization window (accessible
from the Firefox menu bar item).
If you want to to add your new input to the default set, add its identifier
here_, where ``type`` is a value from ``kAllowedInputTypes`` in that
:searchfox:`here <mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c:widget/cocoa/nsTouchBar.mm#100>`, where ``type`` is a value from ``kAllowedInputTypes`` in that
file and ``key`` is the value you set for ``title`` in ``gBuiltInInputs``.
You should request approval from UX before changing the default set of inputs.
.. _here: https://searchfox.org/mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c/widget/cocoa/nsTouchBar.mm#100
If you are interested in adding new features to Firefox's implementation of the
Touch Bar API, read on!
@@ -259,7 +255,7 @@ The best resource to understand the Touch Bar API is Apple's
these APIs and how one might extend ``nsTouchBar`` to enable new Touch Bar
features.
Every new Firefox window initializes ``nsTouchBar`` (link_). The function
Every new Firefox window initializes ``nsTouchBar`` (:searchfox:`link <mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c:widget/cocoa/nsCocoaWindow.mm#2877>`). The function
``makeTouchBar`` is looked for automatically on every new instance of an
``NSWindow*``. If ``makeTouchBar`` is defined, that window will own a new
instance of ``nsTouchBar``.
@@ -277,7 +273,6 @@ created containing a default set of inputs. ``initWithInputs`` can also take an
initialized with only those inputs available.
.. _official documentation: https://developer.apple.com/documentation/appkit/nstouchbar?language=objc
.. _link: https://searchfox.org/mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c/widget/cocoa/nsCocoaWindow.mm#2877
NSTouchBarItemIdentifiers
-------------------------
@@ -304,7 +299,7 @@ If you need to generate an identifier, use the convenience method
.. warning::
``NSTouchBarItemIdentifier`` `is used in one other place`_: setting
``NSTouchBarItemIdentifier`` :searchfox:`is used in one other place <mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c:widget/cocoa/nsTouchBar.mm#71>`: setting
``customizationIdentifier``. Do not ever change this string. If it is changed,
any customizations users have made to the layout of their Touch Bar in Firefox
will be erased.
@@ -316,8 +311,6 @@ which are the actual objects used by Apple's Touch Bar API and displayed in the
Touch Bar. It is important to understand the difference between
``TouchBarInput`` and ``NSTouchBarItem``!
.. _is used in one other place: https://searchfox.org/mozilla-central/rev/ebe492edacc75bb122a2b380e4cafcca3470864c/widget/cocoa/nsTouchBar.mm#71
TouchBarInput creation flow
---------------------------
Creating a Touch Bar and its ``TouchBarInputs`` flows as follows:
@@ -178,9 +178,7 @@ for a description of this object.
~~~~~~~~~~~~~~~~~~~~
If you are creating the provider in the internal address bar implementation in
mozilla-central, then add styling to `dynamic-results.css`_.
.. _dynamic-results.css: https://searchfox.org/firefox-main/source/browser/themes/shared/urlbar/dynamic-results.css
mozilla-central, then add styling to :searchfox:`dynamic-results.css <browser/themes/shared/urlbar/dynamic-results.css>`.
The rest of this section will discuss the CSS rules you need to use to style
your results.
@@ -630,7 +628,5 @@ Appendix A: Examples
This section lists some example and real-world consumers of dynamic result
types.
`Tab-to-Search Provider`__
:searchfox:`Tab-to-Search Provider <browser/components/urlbar/UrlbarProviderTabToSearch.sys.mjs>`
This is a built-in provider in mozilla-central that uses dynamic result types.
__ https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarProviderTabToSearch.sys.mjs
+1 -1
View File
@@ -25,7 +25,7 @@ If you are interested in the technical details, you might want to skip ahead to
Codebase
--------
The address bar code lives in `browser/components/urlbar <https://searchfox.org/firefox-main/source/browser/components/urlbar/>`_.
The address bar code lives in :searchfox:`browser/components/urlbar <browser/components/urlbar/>`.
Table of Contents
-----------------
+18 -18
View File
@@ -18,14 +18,14 @@ of April 2023.
#.
The user types a query (e.g. "coffee near me") into the *UrlbarInput*
`<input> DOM element <https://searchfox.org/mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89/browser/base/content/navigator-toolbox.inc.xhtml#330-336>`_.
That DOM element `tells <https://searchfox.org/mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89/browser/components/urlbar/UrlbarInput.sys.mjs#3312>`_
That DOM element :searchfox:`tells <mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89:browser/components/urlbar/UrlbarInput.sys.mjs#3312>`
*UrlbarInput* that text is being input.
#.
*UrlbarInput* `starts a search <https://searchfox.org/mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89/browser/components/urlbar/UrlbarInput.sys.mjs#3395>`_.
It `creates <https://searchfox.org/mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89/browser/components/urlbar/UrlbarInput.sys.mjs#1549>`_
*UrlbarInput* :searchfox:`starts a search <mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89:browser/components/urlbar/UrlbarInput.sys.mjs#3395>`.
It :searchfox:`creates <mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89:browser/components/urlbar/UrlbarInput.sys.mjs#1549>`
a `UrlbarQueryContext <https://firefox-source-docs.mozilla.org/browser/urlbar/overview.html#the-urlbarquerycontext>`_
and `passes it to UrlbarController <https://searchfox.org/mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89/browser/components/urlbar/UrlbarInput.sys.mjs#1548>`_.
and :searchfox:`passes it to UrlbarController <mozilla-central/rev/1f4f99a8f331cce8467a50742178b6d46914ab89:browser/components/urlbar/UrlbarInput.sys.mjs#1548>`.
The query context is an object that will exist for the lifetime of the query
and it's how we keep track of what results to show. It contains information
like what kind of results are allowed, the search string ("coffee near me",
@@ -33,20 +33,20 @@ of April 2023.
*UrlbarQueryContext* is created every time the text in the input changes.
#.
*UrlbarController* `tells ProvidersManager <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarController.sys.mjs#140>`_
*UrlbarController* :searchfox:`tells ProvidersManager <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarController.sys.mjs#140>`
that the providers should fetch results.
#.
*ProvidersManager* tells `each <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProvidersManager.sys.mjs#408>`_
*ProvidersManager* tells :searchfox:`each <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProvidersManager.sys.mjs#408>`
provider to decide if it wants to provide results for this query by calling
their `isActive <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProvidersManager.sys.mjs#422>`_
their :searchfox:`isActive <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProvidersManager.sys.mjs#422>`
methods. The provider can decide whether or not it will be active for this
query. Some providers are rarely active: for example,
*UrlbarProviderTopSites* `isn't active if the user has typed a search string <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProviderTopSites.sys.mjs#97>`_.
*UrlbarProviderTopSites* :searchfox:`isn't active if the user has typed a search string <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProviderTopSites.sys.mjs#97>`.
#.
*ProvidersManager* then tells the *active* providers to fetch results by
`calling their startQuery method <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProvidersManager.sys.mjs#462>`_.
:searchfox:`calling their startQuery method <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProvidersManager.sys.mjs#462>`.
#.
The providers fetch results for the query asynchronously. Each provider
@@ -57,9 +57,9 @@ of April 2023.
#.
The providers send their results back to *ProvidersManager*. They do
this one result at a time by `calling the addCallback callback <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProviderSearchSuggestions.sys.mjs#292>`_
this one result at a time by :searchfox:`calling the addCallback callback <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProviderSearchSuggestions.sys.mjs#292>`
passed into startQuery. *ProvidersManager* takes all the results from all the
providers and `puts them into the list of unsorted results <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProvidersManager.sys.mjs#607>`_.
providers and :searchfox:`puts them into the list of unsorted results <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProvidersManager.sys.mjs#607>`.
Due to the asynchronous and parallel nature of providers, this and the
following steps may occur multiple times per search. Some providers may take
@@ -71,7 +71,7 @@ of April 2023.
following steps.
#.
*ProvidersManager* `asks <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProvidersManager.sys.mjs#648>`_
*ProvidersManager* :searchfox:`asks <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProvidersManager.sys.mjs#648>`
*UrlbarMuxer* to sort the unsorted results.
#.
@@ -83,15 +83,15 @@ of April 2023.
#.
Once the results are sorted, *ProvidersManager*
`tells UrlbarController <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarProvidersManager.sys.mjs#675>`_
:searchfox:`tells UrlbarController <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarProvidersManager.sys.mjs#675>`
that results are ready to be shown.
#.
*UrlbarController* `sends out a notification <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarController.sys.mjs#213>`_
that results are ready to be shown. *UrlbarView* was `listening <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarView.sys.mjs#662>`_
for that notification. Once the view gets the notification, it `calls #updateResults <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarView.sys.mjs#670>`_
to create `DOM nodes <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarView.sys.mjs#1185>`_
for each *UrlbarResult* and `inserts them <https://searchfox.org/mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172/browser/components/urlbar/UrlbarView.sys.mjs#1156>`_
*UrlbarController* :searchfox:`sends out a notification <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarController.sys.mjs#213>`
that results are ready to be shown. *UrlbarView* was :searchfox:`listening <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarView.sys.mjs#662>`
for that notification. Once the view gets the notification, it :searchfox:`calls #updateResults <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarView.sys.mjs#670>`
to create :searchfox:`DOM nodes <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarView.sys.mjs#1185>`
for each *UrlbarResult* and :searchfox:`inserts them <mozilla-central/rev/0ffaecaa075887ab07bf4c607c61ea2faa81b172:browser/components/urlbar/UrlbarView.sys.mjs#1156>`
into the view's DOM element.
As described above, we may reach this step multiple times per search. That
@@ -485,7 +485,7 @@ Search Interventions
Search interventions help the user perform a task based on their search string.
There are three kinds of interventions, and each is triggered by typing a
certain set of phrases_ in the input. They always appear as the second result,
certain set of :searchfox:`phrases <mozilla-central/rev/c4d682be93f090e99d5f4049ceb7b6b6c03d0632:browser/components/urlbar/UrlbarProviderInterventions.jsm#64>` in the input. They always appear as the second result,
after the heuristic result.
The three kinds of interventions are:
@@ -518,8 +518,6 @@ Currently this feature is limited to English-speaking locales, but work is
ongoing to build a more sophisticated intent-matching platform to support other
locales, more complex search strings, and more kinds of interventions.
.. _phrases: https://searchfox.org/mozilla-central/rev/c4d682be93f090e99d5f4049ceb7b6b6c03d0632/browser/components/urlbar/UrlbarProviderInterventions.jsm#64
Search Tips
~~~~~~~~~~~
+6 -6
View File
@@ -72,7 +72,7 @@ The Model
The *Model* is the component responsible for retrieving search results based on
the user's input, and sorting them accordingly to their importance.
At the core is the `ProvidersManager <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarProvidersManager.sys.mjs>`_,
At the core is the :searchfox:`ProvidersManager <browser/components/urlbar/UrlbarProvidersManager.sys.mjs>`,
a component tracking all the available search providers, and managing searches
across them.
@@ -92,7 +92,7 @@ Queries can be canceled.
terminating any running and future SQL query, unless a query is running inside
a *runInCriticalSection* task.
The *searchString* gets tokenized by the `UrlbarTokenizer <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarTokenizer.sys.mjs>`_
The *searchString* gets tokenized by the :searchfox:`UrlbarTokenizer <browser/components/urlbar/UrlbarTokenizer.sys.mjs>`
component into tokens, some of these tokens have a special meaning and can be
used by the user to restrict the search to specific result type (See the
*UrlbarTokenizer::TYPE* enum).
@@ -246,7 +246,7 @@ indicated by the UrlbarQueryContext.muxer property.
The Controller
--------------
`UrlbarController <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarController.sys.mjs>`_
:searchfox:`UrlbarController <browser/components/urlbar/UrlbarController.sys.mjs>`
is the component responsible for reacting to user's input, by communicating
proper course of action to the Model (e.g. starting/stopping a query) and the
View (e.g. showing/hiding a panel). It is also responsible for reporting Telemetry.
@@ -279,7 +279,7 @@ user and handling their input.
The View is a replaceable component, as such what is described here is a
reference for the default View, but may not be valid for other implementations.
`UrlbarInput.sys.mjs <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarInput.sys.mjs>`_
:searchfox:`UrlbarInput.sys.mjs <browser/components/urlbar/UrlbarInput.sys.mjs>`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Implements an input box *View*, owns an *UrlbarView*.
@@ -323,7 +323,7 @@ Implements an input box *View*, owns an *UrlbarView*.
value;
}
`UrlbarView.sys.mjs <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarView.sys.mjs>`_
:searchfox:`UrlbarView.sys.mjs <browser/components/urlbar/UrlbarView.sys.mjs>`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Represents the base *View* implementation, communicates with the *Controller*.
@@ -353,7 +353,7 @@ Represents the base *View* implementation, communicates with the *Controller*.
UrlbarResult
------------
An `UrlbarResult <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarResult.sys.mjs>`_
An :searchfox:`UrlbarResult <browser/components/urlbar/UrlbarResult.sys.mjs>`
instance represents a single search result with a result type, that
identifies specific kind of results.
Each kind has its own properties, that the *View* may support, and a few common
@@ -15,7 +15,7 @@ Before results appear in the UrlbarView, they are fetched from providers.
Each `UrlbarProvider <https://firefox-source-docs.mozilla.org/browser/urlbar/overview.html#urlbarprovider>`_
implements its own internal ranking and returns sorted results.
Externally all the results are ranked by the `UrlbarMuxer <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarMuxerStandard.sys.mjs>`_
Externally all the results are ranked by the :searchfox:`UrlbarMuxer <browser/components/urlbar/UrlbarMuxerStandard.sys.mjs>`
according to a hardcoded list of groups and sub-groups.
.. NOTE:: Preferences can influence the groups order, for example by putting
@@ -192,7 +192,7 @@ Frecency is recalculated:
In this case, when a change influencing frecency happens, the ``recalc_frecency``
database field for the page is set to ``1``.
Recalculation is done by the `PlacesFrecencyRecalculator <https://searchfox.org/firefox-main/source/toolkit/components/places/PlacesFrecencyRecalculator.sys.mjs>`_ module.
Recalculation is done by the :searchfox:`PlacesFrecencyRecalculator <toolkit/components/places/PlacesFrecencyRecalculator.sys.mjs>` module.
The Recalculator is notified when ``PlacesUtils.history.shouldStartFrecencyRecalculation``
value changes from false to true, that means there's values to recalculate.
A DeferredTask is armed, that will look for a user idle opportunity
+2 -2
View File
@@ -7,7 +7,7 @@ Before results appear in the UrlbarView, they are fetched from providers.
Each `UrlbarProvider <https://firefox-source-docs.mozilla.org/browser/urlbar/overview.html#urlbarprovider>`_
implements its own internal ranking and returns sorted results.
Externally all the results are ranked by the `UrlbarMuxer <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarMuxerStandard.sys.mjs>`_
Externally all the results are ranked by the :searchfox:`UrlbarMuxer <browser/components/urlbar/UrlbarMuxerStandard.sys.mjs>`
according to an hardcoded list of groups and sub-groups.
.. NOTE:: Preferences can influence the groups order, for example by putting
@@ -220,7 +220,7 @@ Frecency is recalculated:
In this case, when a change influencing frecency happens, the ``recalc_frecency``
database field for the page is set to ``1``.
Recalculation is done by the `PlacesFrecencyRecalculator <https://searchfox.org/firefox-main/source/toolkit/components/places/PlacesFrecencyRecalculator.sys.mjs>`_ module.
Recalculation is done by the :searchfox:`PlacesFrecencyRecalculator <toolkit/components/places/PlacesFrecencyRecalculator.sys.mjs>` module.
The Recalculator is notified when ``PlacesUtils.history.shouldStartFrecencyRecalculation``
value changes from false to true, that means there's values to recalculate.
A DeferredTask is armed, that will look for a user idle opportunity
+1 -1
View File
@@ -90,7 +90,7 @@ PLACES_FRECENCY_RECALC_CHUNK_TIME_MS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This records the time necessary to recalculate frecency of a chunk of pages,
as defined in the `PlacesFrecencyRecalculator <https://searchfox.org/firefox-main/source/toolkit/components/places/PlacesFrecencyRecalculator.sys.mjs>`_ module.
as defined in the :searchfox:`PlacesFrecencyRecalculator <toolkit/components/places/PlacesFrecencyRecalculator.sys.mjs>` module.
Scalars
-------
+9 -16
View File
@@ -38,11 +38,9 @@ connect it to other components in another language, such as JavaScript.
Each XPCShell test is executed in a new shell instance, therefore you will
see several Firefox icons pop up and close when XPCShell tests are executing.
These are two examples of XPCShell tests for the address bar
`test_providerHeuristicFallback <https://searchfox.org/firefox-main/source
/browser/components/urlbar/tests/unit/test_providerHeuristicFallback.js>`_
:searchfox:`test_providerHeuristicFallback <browser/components/urlbar/tests/unit/test_providerHeuristicFallback.js>`
and
`test_providerTabToSearch <https://searchfox.org/firefox-main/source/browser
/components/urlbar/tests/unit/test_providerTabToSearch.js>`_.
:searchfox:`test_providerTabToSearch <browser/components/urlbar/tests/unit/test_providerTabToSearch.js>`.
When To Write a XPCShell or Mochitest?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -54,11 +52,9 @@ testing a specific component in the UI.
If you are writing a test for a urlbarProvider, you can test the Provider
through a XPCShell test. Providers do not modify the UI, instead what they do is
receive a url string query, search for the string and bring back the result. An
example is the `ProviderPlaces <https://searchfox.org/mozilla-central/sou
rce/browser/components/urlbar/UrlbarProviderPlaces.sys.mjs>`_, which fetches
example is the :searchfox:`ProviderPlaces <browser/components/urlbar/UrlbarProviderPlaces.sys.mjs>`, which fetches
results from the Places database. Another component thats good for writing
XPCShell test is the `urlbarMuxer <https://searchfox.org/mozilla-central/
source/browser/components/urlbar/UrlbarMuxerStandard.sys.mjs>`_.
XPCShell test is the :searchfox:`urlbarMuxer <browser/components/urlbar/UrlbarMuxerStandard.sys.mjs>`.
There may be times where writing both an XPCShell test and browser test is
necessary. In these situations, you could be testing the result from a Provider
@@ -107,8 +103,7 @@ manifest in alphabetical order.
Start in the manifest file and add your test name in alphabetical
order. The manifest file we should add our test in is
`browser.toml <https://searchfox.org/firefox-main/source/browser/components/
urlbar/tests/browser/browser.toml>`_. The ``urlbar/test/browser/`` directory
:searchfox:`browser.toml <browser/components/urlbar/tests/browser/browser.toml>`. The ``urlbar/test/browser/`` directory
is the main browser test directory for address bar, and the manifest file
linked above is the main browser test manifest.
@@ -145,8 +140,7 @@ ensures what is done within one test will not affect subsequent tests.
head.js and common-head.js
~~~~~~~~~~~~~~~~~~~~~~~~~~
The `head.js <https://searchfox.org/firefox-main/source/browser/components
/urlbar/tests/browser/head.js>`_ file is executed at the beginning before each
The :searchfox:`head.js <browser/components/urlbar/tests/browser/head.js>` file is executed at the beginning before each
test and contains imports to modules which are useful for each test.
Any tasks ``head.js`` adds (via add_task) will run first for each test, and
any variables and functions it defines will be available in the scope of
@@ -158,7 +152,7 @@ modules names to where they can be found, their paths. ``Lazy`` means the files
are only imported if or when it is used. Any tests in this directory can use
these modules without importing it themselves in their own file.
The ``head.js`` provides a convenience for this purpose. The ``head.js`` file
imports `common-head.js <https://searchfox.org/firefox-main/source/browser/components/urlbar/tests/browser/head-common.js>`_
imports :searchfox:`common-head.js <browser/components/urlbar/tests/browser/head-common.js>`
making everything within ``head-common.js`` available in ``head.js`` as well.
The ``registerCleanupFunction`` is an important function in browser mochi tests
@@ -176,7 +170,7 @@ test.
UrlbarTestUtils
~~~~~~~~~~~~~~~
`UrlbarTestUtils.sys.mjs <https://searchfox.org/firefox-main/source/browser/components/urlbar/tests/UrlbarTestUtils.sys.mjs>`_ is useful for url bar testing. This
:searchfox:`UrlbarTestUtils.sys.mjs <browser/components/urlbar/tests/UrlbarTestUtils.sys.mjs>` is useful for url bar testing. This
file contains methods that can help with starting a new search in the url bar,
waiting for a new search to complete, returning the results in
the view, and etc.
@@ -202,8 +196,7 @@ bookmarks, waiting for notification of visited pages, and etc.
EventUtils
~~~~~~~~~~
`EventUtils.js <https://searchfox.org/firefox-main/source/testing/mochitest
/tests/SimpleTest/EventUtils.js>`_ is an older test file and does not
:searchfox:`EventUtils.js <testing/mochitest/tests/SimpleTest/EventUtils.js>` is an older test file and does not
need to be imported because it is not a ``.sys.mjs`` file. ``EventUtils`` is only
used for browser tests, unlike the other TestUtils listed above which are
used for browser tests, XPCShell tests and other tests.
+2 -2
View File
@@ -3,7 +3,7 @@ Utilities
Various modules provide shared utilities to the other components:
`UrlbarPrefs.sys.mjs <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarPrefs.sys.mjs>`_
:searchfox:`UrlbarPrefs.sys.mjs <browser/components/urlbar/UrlbarPrefs.sys.mjs>`
-------------------------------------------------------------------------------------------------------------------
Implements a Map-like storage or urlbar related preferences. The values are kept
@@ -19,7 +19,7 @@ up-to-date.
Newly added preferences should always be properly documented in UrlbarPrefs.
`UrlbarUtils.sys.mjs <https://searchfox.org/firefox-main/source/browser/components/urlbar/UrlbarUtils.sys.mjs>`_
:searchfox:`UrlbarUtils.sys.mjs <browser/components/urlbar/UrlbarUtils.sys.mjs>`
-------------------------------------------------------------------------------------------------------------------
Includes shared utils and constants shared across all the components.
+2 -2
View File
@@ -4,7 +4,7 @@
Browser Usage Telemetry
=======================
The `BrowserUsageTelemetry.sys.mjs <https://searchfox.org/firefox-main/source/browser/modules/BrowserUsageTelemetry.sys.mjs>`_ module is the main module for measurements regarding the browser usage (e.g. tab and window counts, search counts, ...).
The :searchfox:`BrowserUsageTelemetry.sys.mjs <browser/modules/BrowserUsageTelemetry.sys.mjs>` module is the main module for measurements regarding the browser usage (e.g. tab and window counts, search counts, ...).
The measurements recording begins right after the ``SessionStore`` has finished restoring the session (i.e. restoring tabs/windows after Firefox starts).
@@ -17,7 +17,7 @@ The usage telemetry module currently measures these interactions with the browse
- *navigation events*: at this time, this only counts the number of time a page load is triggered by a particular UI interaction (e.g. by searching through the URL bar, see ``browser.engagement.navigation.urlbar``).
Please see `Scalars.yaml <https://searchfox.org/firefox-main/source/toolkit/components/telemetry/Scalars.yaml>`_ for the full list of tracked interactions.
Please see :searchfox:`Scalars.yaml <toolkit/components/telemetry/Scalars.yaml>` for the full list of tracked interactions.
Customizable UI
===============
+1 -2
View File
@@ -19,8 +19,7 @@ Known parameters
that the command line is untrusted and must be sanitized. Command lines
with ``-osint`` are rejected unless they have a very specific structure,
usually ``firefox.exe -osint -url URL`` or ``firefox.exe -osint
-private-window URL``: refer to `the EnsureCommandLineSafe function
<https://searchfox.org/mozilla-central/rev/ead7da2d9c5400bc7034ff3f06a030531bd7e5b9/toolkit/xre/CmdLineAndEnvUtils.h#196>`_.
-private-window URL``: refer to :searchfox:`the EnsureCommandLineSafe function <mozilla-central/rev/ead7da2d9c5400bc7034ff3f06a030531bd7e5b9:toolkit/xre/CmdLineAndEnvUtils.h#196>`.
These command lines are produced by apps delegating to Firefox, and the
resulting URL may not be correctly quoted. The sanitization process
ensures that maliciously chosen URLs do not add additional parameters to
@@ -10,7 +10,7 @@ Our objective is to increase user engagement, satisfaction and retention for fre
Form Autofill handles filling in addresses and credit cards into forms. While the filling aspect of this is straightforward and uses the same mechanism as other autocomplete types, much of the additional work involves analyzing and classifying the form to determine which form field corresponds to which type of data. For instance, text boxes are classified into different types of address data.
For historical reasons, part of the form autofill is implemented using an extension, located in `browser/extensions/formautofill <https://searchfox.org/firefox-main/source/browser/extensions/formautofill>`_. It is this extension which adds the form autofill actors used to handle the search for possible results. However, most of the work is done via code in `toolkit/components/formautofill <https://searchfox.org/firefox-main/source/toolkit/components/formautofill>`_.
For historical reasons, part of the form autofill is implemented using an extension, located in :searchfox:`browser/extensions/formautofill`. It is this extension which adds the form autofill actors used to handle the search for possible results. However, most of the work is done via code in :searchfox:`toolkit/components/formautofill`.
Form Autofill uses the autocomplete popup mechanism to show a list of suggestions to the user based on what they have typed so far. The user can also press the cursor key or tab key to open the autocomplete popup while the focus is within a field.
@@ -20,7 +20,7 @@ For more information about autocomplete, see :doc:`Autocomplete </toolkit/compon
How Form Autofill Works
-----------------------
The form fill actor ``FormAutofillChild`` waits for form fields to be focused. When a field is focused, it starts the process of analyzing the form and picking out which fields might be address or credit card related. This process is primarily done by the ``getFormInfo`` function within `FormAutofillHeuristics.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs>`_. This process is separate from the mechanism used to trigger an autocomplete popup.
The form fill actor ``FormAutofillChild`` waits for form fields to be focused. When a field is focused, it starts the process of analyzing the form and picking out which fields might be address or credit card related. This process is primarily done by the ``getFormInfo`` function within :searchfox:`FormAutofillHeuristics.sys.mjs <toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs>`. This process is separate from the mechanism used to trigger an autocomplete popup.
Form Autofill can handle filling in <input>, <textarea> and <select> elements.
@@ -28,19 +28,19 @@ There are three mechanisms that can be used to identify a field:
1. **autocomplete attributes**: authors may place an autocomplete attribute on a form field to identify its purpose. This is most likely to be correct although sometimes authoring errors will occur and we attempt to fix some common cases.
2. **fathom**: Fathom is a simple learning system that uses a selection of rules to identify credit card related fields. It currently is used to detect the credit card name and number fields (``cc-name`` and ``cc-number``) but does not detect other credit card fields or operate on address fields.
3. **regular expressions**: a large list of regular expressions located in `HeuristicsRegExp.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/HeuristicsRegExp.sys.mjs>`_ that is used to match the ids, names, placeholders and labels associated with form elements. This is where most of the analysis of form fields is done for addresses.
3. **regular expressions**: a large list of regular expressions located in :searchfox:`HeuristicsRegExp.sys.mjs <toolkit/components/formautofill/shared/HeuristicsRegExp.sys.mjs>` that is used to match the ids, names, placeholders and labels associated with form elements. This is where most of the analysis of form fields is done for addresses.
The ``element.getAutocompleteInfo()`` function provides the parsed result of ``autocomplete`` attribute which includes the field name and section information defined in `autofill spec <https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill>`_
Each field in a form is classified into a number of different field types, for example: ``email``, ``address-line1``, ``country`` and so on. Many fields will not be able to be placed into a definite type, and many forms will have multiple fields classified with the same type. Work is ongoing to reduce the number of errors made in classifying fields.
After fields are classified, some additional heuristics are run (within the ``parseAndUpdateFieldNamesParent`` function in `FormAutofillHeuristics.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs>`_). These are responsible for further checking for common field classification issues. For example, when multiple address line fields appear in a row, it is likely that they represent a separate line of the address (street, apartment number, building, etc) and appear in order. Another example is that it is common on Japanese web sites to have a separate set of name fields to indicate the pronounciation of one's name; heuristics are included to recognize this situation.
After fields are classified, some additional heuristics are run (within the ``parseAndUpdateFieldNamesParent`` function in :searchfox:`FormAutofillHeuristics.sys.mjs <toolkit/components/formautofill/shared/FormAutofillHeuristics.sys.mjs>`). These are responsible for further checking for common field classification issues. For example, when multiple address line fields appear in a row, it is likely that they represent a separate line of the address (street, apartment number, building, etc) and appear in order. Another example is that it is common on Japanese web sites to have a separate set of name fields to indicate the pronounciation of one's name; heuristics are included to recognize this situation.
Note that the heuristics within ``parseAndUpdateFieldNamesParent`` are done within the parent browser process so no longer have access to the form fields directly, so any information needed will need to be stored in the field data (usually called ``fieldDetails`` within the code).
However, there are a few heuristics in ``parseAndUpdateFieldNamesContent`` that are done in the web page process beforehand. Most processing happens in the parent process afterwards because all of the form fields across different subframes (iframes) can be searched and collected together as a single form. There are a number of web sites that break up each field into separate child iframes.
Once fields have been identified, they are split into sections. Some sites will have multiple sections for addresses, one for a billing address and one for a shipping address. This handling is done by groupFields within `FormAutofillSection.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/FormAutofillSection.sys.mjs>`_. The ``autocomplete`` attribute may be used on a field in a web page to be explicit about which section to use for that field, but otherwise the heuristics try to determine this automatically.
Once fields have been identified, they are split into sections. Some sites will have multiple sections for addresses, one for a billing address and one for a shipping address. This handling is done by groupFields within :searchfox:`FormAutofillSection.sys.mjs <toolkit/components/formautofill/shared/FormAutofillSection.sys.mjs>`. The ``autocomplete`` attribute may be used on a field in a web page to be explicit about which section to use for that field, but otherwise the heuristics try to determine this automatically.
Once the fields are identified, a message is sent back to the child process so that ``markAsAutoCompletableField()`` may be called on each detected field, allowing the autocomplete actor to recognize that the form fill actor is able to provide results for that form field. In addition, the section and form field details are saved in the field ``sectionsByRootId`` within ``FormAutofillParent`` to that they may be retreived when the autocomplete is performed.
@@ -56,17 +56,17 @@ Additional Cases
Country Meta Data
-----------------
The specifics for each region is defined in the file `AddressMetaData.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/AddressMetaData.sys.mjs>`_. This file contains information about the regions in each country, postal code formats, languages used in each region and so forth. This file contains links to documentation about the format of this data and is a good place to look for information that might be country specific. For example, when we look at data for Brazil, we can see a list of states (federative units), and also see that Brazil has defined a "sublocality_name_type" field which indicates a third level of region besides state and city, used for the neighborhood. The neighborhood appears in the address preference dialog when adding Brazilian addresses and can be autofilled as needed. Most other regions do not include a neighborhood field.
The specifics for each region is defined in the file :searchfox:`AddressMetaData.sys.mjs <toolkit/components/formautofill/shared/AddressMetaData.sys.mjs>`. This file contains information about the regions in each country, postal code formats, languages used in each region and so forth. This file contains links to documentation about the format of this data and is a good place to look for information that might be country specific. For example, when we look at data for Brazil, we can see a list of states (federative units), and also see that Brazil has defined a "sublocality_name_type" field which indicates a third level of region besides state and city, used for the neighborhood. The neighborhood appears in the address preference dialog when adding Brazilian addresses and can be autofilled as needed. Most other regions do not include a neighborhood field.
Form Submission
-----------------
When a form is submitted, a prompt may be show asking the user if they wish to save the address or credit card information. This helps the user realize that the autofill capability is available. The filled in data on the form can optionally be automatically saved as a new address or credit card. This is done within the ``onFormSubmit`` function of `FormAutofillParent <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/FormAutofillParent.sys.mjs>`_.
When a form is submitted, a prompt may be show asking the user if they wish to save the address or credit card information. This helps the user realize that the autofill capability is available. The filled in data on the form can optionally be automatically saved as a new address or credit card. This is done within the ``onFormSubmit`` function of :searchfox:`FormAutofillParent <toolkit/components/formautofill/FormAutofillParent.sys.mjs>`.
In general, however, we do not show the prompt to save a new address or credit card if the user has not filled in enough fields, fillin is disabled in the user's region, or the form does not contain the right fields. Which fields are necessary is dependent on the region. For example, typically, a street, city and postal code is required. The specific data needed to save the form data is determined from the `AddressMetaData.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/AddressMetaData.sys.mjs>`_ as described above.
In general, however, we do not show the prompt to save a new address or credit card if the user has not filled in enough fields, fillin is disabled in the user's region, or the form does not contain the right fields. Which fields are necessary is dependent on the region. For example, typically, a street, city and postal code is required. The specific data needed to save the form data is determined from the :searchfox:`AddressMetaData.sys.mjs <toolkit/components/formautofill/shared/AddressMetaData.sys.mjs>` as described above.
If an address is determined to be the same as an existing saved address, the prompt does not appear. Some heuristics within
`AddressParser.sys.mjs <https://searchfox.org/firefox-main/source/toolkit/components/formautofill/shared/AddressParser.sys.mjs>`_ are used to determine if the address is the same as an existing saved address, because this can be inexact matching, for example, 'Floor 2' and '2nd floor' are different strings but refer to the same thing. This ensures that the amount of times the user is prompted is reduced when the address is similar.
:searchfox:`AddressParser.sys.mjs <toolkit/components/formautofill/shared/AddressParser.sys.mjs>` are used to determine if the address is the same as an existing saved address, because this can be inexact matching, for example, 'Floor 2' and '2nd floor' are different strings but refer to the same thing. This ensures that the amount of times the user is prompted is reduced when the address is similar.
Report Issues
-------------
@@ -4,11 +4,11 @@ Full Installer
The full installer is actually responsible for installing the browser; it's what the stub launches in order to do the "real" installing work, but it's also available separately. It uses a traditional "wizard" interface design, as is (somewhat) natively supported by NSIS. It can also be :doc:`configured <FullConfig>` to launch in a silent mode, suitable for scripting or managed deployments.
The full installer's main script is `installer.nsi <https://searchfox.org/firefox-main/source/browser/installer/windows/nsis/installer.nsi>`_, but most of the heavy lifting is done by the shared functions in `common.nsh <https://searchfox.org/firefox-main/source/toolkit/mozapps/installer/windows/nsis/common.nsh>`_.
The full installer's main script is :searchfox:`installer.nsi <browser/installer/windows/nsis/installer.nsi>`, but most of the heavy lifting is done by the shared functions in :searchfox:`common.nsh <toolkit/mozapps/installer/windows/nsis/common.nsh>`.
If it was not launched by the :doc:`StubInstaller`, an :ref:`Install Ping` is sent when the installer exits.
The installer writes ``installation_telemetry.json`` to the install location, this is read by Firefox in order to send a telemetry event, see the event definition in `Events.yaml <https://searchfox.org/firefox-main/source/toolkit/components/telemetry/Events.yaml>`_ (category ``installation``, event name ``first_seen``) for a description of the properties. There is also an ``install_timestamp`` property, which is saved in the profile to determine whether there has been a new installation; this is not sent as part of the ping.
The installer writes ``installation_telemetry.json`` to the install location, this is read by Firefox in order to send a telemetry event, see the event definition in :searchfox:`Events.yaml <toolkit/components/telemetry/Events.yaml>` (category ``installation``, event name ``first_seen``) for a description of the properties. There is also an ``install_timestamp`` property, which is saved in the profile to determine whether there has been a new installation; this is not sent as part of the ping.
The full installer can also access NSIS plugins written in C++, see :doc:`building NSIS plugins <NSISPlugins>` for more information.
+1 -5
View File
@@ -1,7 +1,7 @@
======
Helper
======
helper.exe contains the uninstaller, plus a routine that's run by the application updater after it applies an update, as well as a few utilities used for default browser handling and shortcut maintenance. It mainly consists of two files, uninstaller.nsi_, which is the main script and contains the entry point and the uninstall logic, and shared.nsh_, which contains most of the logic for the other functions.
helper.exe contains the uninstaller, plus a routine that's run by the application updater after it applies an update, as well as a few utilities used for default browser handling and shortcut maintenance. It mainly consists of two files, :searchfox:`uninstaller.nsi <browser/installer/windows/nsis/uninstaller.nsi>`, which is the main script and contains the entry point and the uninstall logic, and :searchfox:`shared.nsh <browser/installer/windows/nsis/shared.nsh>`, which contains most of the logic for the other functions.
Uninstaller
-----------
@@ -33,7 +33,3 @@ Windows versions older than 10 contain a control panel called Set Program Access
The helper also implements the ``/SetAsDefaultAppUser`` switch, which is invoked by the "Make Default" button in the Firefox preferences UI.
On Windows 10 neither SetAsDefaultAppUser nor SetAsDefaultAppGlobal is effective because the default programs settings can only be modified by the Windows settings app. However they do still write the registry entries that are needed to get us an entry in the system default browser menu, should those entries not already exist (the installer always creates them, but running Firefox without having run the installer is supported). ShowShortcuts and HideShortcuts are never called on Windows 10 because the SPAD control panel no longer exists.
.. _uninstaller.nsi: https://searchfox.org/firefox-main/source/browser/installer/windows/nsis/uninstaller.nsi
.. _shared.nsh: https://searchfox.org/firefox-main/source/browser/installer/windows/nsis/shared.nsh
@@ -38,7 +38,7 @@ Build process
Both the full and stub installers are built through a similar process, which is summarized here along with references to the relevant bits of code.
Most of this procedure is done in `makensis.mk <https://searchfox.org/firefox-main/source/toolkit/mozapps/installer/windows/nsis/makensis.mk>`_ and in the `mach repackage <https://searchfox.org/mozilla-central/rev/2b9779c59390ecc47be7a70d99753653d8eb5afc/python/mozbuild/mozbuild/mach_commands.py#2166>`_ command.
Most of this procedure is done in :searchfox:`makensis.mk <toolkit/mozapps/installer/windows/nsis/makensis.mk>` and in the :searchfox:`mach repackage <mozilla-central/rev/2b9779c59390ecc47be7a70d99753653d8eb5afc:python/mozbuild/mozbuild/mach_commands.py#2166>` command.
0. A prerequisite is for the application to be in a packaged state, so ``mach package`` first creates a release-style package and puts it in ``$OBJDIR/dist/firefox``.
1. All required files are copied into the instgen directory. This includes .nsi and .nsh script files, plugin DLL files, image and icon files, and the 7-zip SFX module and its configuration files.
+1 -1
View File
@@ -6,4 +6,4 @@ We provide a `Windows Installer <https://wikipedia.org/wiki/Windows_Installer>`_
Our MSI packages are not "true" Windows Installer packages; they don't actually contain any installable components and don't register any product. They simply wrap the :doc:`full installer <FullInstaller>`, which performs the installation just as if it had been run normally. The main reason for this is the difficulty of adapting Firefox's existing update mechanisms to fit the way that Windows Installer would expect things to be done.
The MSI package is built for every release along with the other package formats using the command ``./mach repackage msi``. That command invokes the `WiX tools <https://wixtoolset.org/>`_ to build the package from `a normal WiX XML file <https://searchfox.org/firefox-main/source/browser/installer/windows/msi/installer.wxs>`_, after filling in a few variables to customize the package for that particular Firefox build. The majority of the WiX file is concerned with passing parameters through from MSI properties to command-line arguments for the full installer to use; the rest is boilerplate to satisfy the minimum requirements for something that WiX will build and the Windows Installer system will load and run without errors.
The MSI package is built for every release along with the other package formats using the command ``./mach repackage msi``. That command invokes the `WiX tools <https://wixtoolset.org/>`_ to build the package from :searchfox:`a normal WiX XML file <browser/installer/windows/msi/installer.wxs>`, after filling in a few variables to customize the package for that particular Firefox build. The majority of the WiX file is concerned with passing parameters through from MSI properties to command-line arguments for the full installer to use; the rest is boilerplate to satisfy the minimum requirements for something that WiX will build and the Windows Installer system will load and run without errors.
+1 -1
View File
@@ -4,7 +4,7 @@ Stub Installer Architecture
The stub is called a stub because it doesn't actually install anything. It's just a GUI frontend that downloads and runs the full installer in silent mode. The exact full installer that will be downloaded isn't baked into the stub; the channel and the locale (which are baked in) are sent in a request to the Bouncer service, which uses that information to redirect to the URL of the specific full installer file.
The main stub installer source code file is `stub.nsi <https://searchfox.org/firefox-main/source/browser/installer/windows/nsis/stub.nsi>`_. Even though the stub installer doesn't install anything, it's still built on NSIS. This means the structure of stub.nsi is a bit odd for an NSIS script. There's only one section, and it's empty, and there are no predefined pages used. The work is all done in two custom pages, createProfileCleanup and createInstall, and the functions called by those two pages. Also, the stub's dialogs are built using HTML and the Windows WebBrowser control (based on Internet Explorer); see :doc:`this page <StubGUI>` for details about that.
The main stub installer source code file is :searchfox:`stub.nsi <browser/installer/windows/nsis/stub.nsi>`. Even though the stub installer doesn't install anything, it's still built on NSIS. This means the structure of stub.nsi is a bit odd for an NSIS script. There's only one section, and it's empty, and there are no predefined pages used. The work is all done in two custom pages, createProfileCleanup and createInstall, and the functions called by those two pages. Also, the stub's dialogs are built using HTML and the Windows WebBrowser control (based on Internet Explorer); see :doc:`this page <StubGUI>` for details about that.
The basic execution flow is this:
+1 -1
View File
@@ -9,7 +9,7 @@ This page explains interactions between Firefox and Flatpak packaging format.
Where is the upstream
=====================
The code reference itself is mozilla-central and the repackaging is under `the mach repackage flatpak command <https://searchfox.org/firefox-main/source/python/mozbuild/mozbuild/repackaging/flatpak.py>`_.
The code reference itself is mozilla-central and the repackaging is under :searchfox:`the mach repackage flatpak command <python/mozbuild/mozbuild/repackaging/flatpak.py>`.
Where to report bugs
====================
+10 -10
View File
@@ -19,8 +19,8 @@ The format of a jar.mn is fairly simple; it consists of a heading specifying
which JAR file is being packaged, followed by indented lines listing files and
chrome registration instructions.
For a simple ``jar.mn`` file, see `toolkit/profile/jar.mn <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/toolkit/profile/jar.mn>`_. For a much
more complex ``jar.mn`` file, see `toolkit/locales/jar.mn <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/toolkit/locales/jar.mn>`_. More examples with specific formats and uses are available below.
For a simple ``jar.mn`` file, see :searchfox:`toolkit/profile/jar.mn <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:toolkit/profile/jar.mn>`. For a much
more complex ``jar.mn`` file, see :searchfox:`toolkit/locales/jar.mn <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:toolkit/locales/jar.mn>`. More examples with specific formats and uses are available below.
Shipping Chrome Files
======================
@@ -36,7 +36,7 @@ Note that file path mappings are listed by destination (left) followed by source
Same Directory Omission
^^^^^^^^^^^^^^^^^^^^^^^
If the JAR manifest and packaged files live in the same directory, the source path and parentheses can be omitted.
A sample of a ``jar.mn`` file with omitted source paths and parentheses is `this revision of browser/components/colorways/jar.mn <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/browser/components/colorways/jar.mn>`_::
A sample of a ``jar.mn`` file with omitted source paths and parentheses is :searchfox:`this revision of browser/components/colorways/jar.mn <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:browser/components/colorways/jar.mn>`::
browser.jar:
content/browser/colorwaycloset.html
@@ -51,13 +51,13 @@ Writing the following is equivalent, given that the aforementioned files exist i
content/browser/colorwaycloset.js (colorwaycloset.js)
This manifest is responsible for packaging files needed by Colorway Closet, including
JS scripts, localization files, images (ex. PNGs, AVIFs), and CSS styling. Look at `browser/components/colorways/colorwaycloset.html <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/browser/components/colorways/colorwaycloset.html#18>`_
JS scripts, localization files, images (ex. PNGs, AVIFs), and CSS styling. Look at :searchfox:`browser/components/colorways/colorwaycloset.html <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:browser/components/colorways/colorwaycloset.html#18>`
to see how a file may be referenced using its chrome URL.
Absolute Paths
^^^^^^^^^^^^^^
The source tree location may also be an absolute path (taken from the top of the source tree).
One such example can be found in `toolkit/components/pictureinpicture/jar.mn <https://searchfox.org/mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b/toolkit/components/pictureinpicture/jar.mn>`_::
One such example can be found in :searchfox:`toolkit/components/pictureinpicture/jar.mn <mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b:toolkit/components/pictureinpicture/jar.mn>`::
toolkit.jar:
* content/global/pictureinpicture/player.xhtml (content/player.xhtml)
@@ -66,7 +66,7 @@ One such example can be found in `toolkit/components/pictureinpicture/jar.mn <ht
Asterisk Marker (Preprocessing)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
An asterisk marker (``*``) at the beginning of the line indicates that the file should be processed by the :ref:`preprocessor` before being packaged.
The file `toolkit/profile/jar.mn <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/toolkit/profile/jar.mn>`_ indicates that the file `toolkit/profile/content/profileDowngrade.xhtml <https://searchfox.org/mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b/toolkit/profile/content/profileDowngrade.xhtml#34,36>`_ should be
The file :searchfox:`toolkit/profile/jar.mn <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:toolkit/profile/jar.mn>` indicates that the file :searchfox:`toolkit/profile/content/profileDowngrade.xhtml <mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b:toolkit/profile/content/profileDowngrade.xhtml#34,36>` should be
run through the preprocessor, since it contains ``#ifdef`` and ``#endif`` statements that need to be interpreted::
* content/mozapps/profile/profileDowngrade.xhtml (content/profileDowngrade.xhtml)
@@ -74,8 +74,8 @@ run through the preprocessor, since it contains ``#ifdef`` and ``#endif`` statem
Base Path, Variables, Wildcards and Localized Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The ``.jar`` file location may be preceded with a base path between square brackets.
The file `toolkit/locales/jar.mn <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/toolkit/locales/jar.mn>`_ uses a base path so that the ``.jar`` file is under a ``localization`` directory,
which is a `special directory parsed by mozbuild <https://searchfox.org/mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b/python/mozbuild/mozpack/packager/l10n.py#260-265>`_.
The file :searchfox:`toolkit/locales/jar.mn <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:toolkit/locales/jar.mn>` uses a base path so that the ``.jar`` file is under a ``localization`` directory,
which is a :searchfox:`special directory parsed by mozbuild <mozilla-central/rev/2005e8d87ee045f19dac58e5bff32eff7d01bc9b:python/mozbuild/mozpack/packager/l10n.py#260-265>`.
It is also named according to the value passed by the variable ``@AB_CD@``, normally a locale. Note the use of the preprocessor directive ``#filter substitution`` at the top of the file for replacing the variable with the value::
@@ -87,7 +87,7 @@ It is also named according to the value passed by the variable ``@AB_CD@``, norm
crashreporter (%crashreporter/**/*.ftl)
toolkit (%toolkit/**/*.ftl)
The percentage sign in front of the source paths designates the locale to target as a source. By default, this is ``en-US``. With this specific example, `/toolkit/locales/en-US <https://searchfox.org/firefox-main/source/toolkit/locales/en-US>`_ would be targeted.
The percentage sign in front of the source paths designates the locale to target as a source. By default, this is ``en-US``. With this specific example, :searchfox:`/toolkit/locales/en-US <toolkit/locales/en-US>` would be targeted.
Otherwise, the file from an alternate localization source tree ``/l10n/<locale>/toolkit/`` is read if building a localized version.
The wildcards in ``**/*.ftl`` tell the processor to install all Fluent files within the ``crashreporter`` and ``toolkit`` directories, as well as their subdirectories.
@@ -111,7 +111,7 @@ an extension.
Example
^^^^^^^
The file `browser/themes/addons/jar.mn <https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/browser/themes/addons/jar.mn>`_ registers a ``resource`` chrome package under the name ``builtin-themes``. Its source files are in ``%content/builtin-themes/``::
The file :searchfox:`browser/themes/addons/jar.mn <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:browser/themes/addons/jar.mn>` registers a ``resource`` chrome package under the name ``builtin-themes``. Its source files are in ``%content/builtin-themes/``::
browser.jar:
% resource builtin-themes %content/builtin-themes/
+6 -7
View File
@@ -16,9 +16,9 @@ Linking Rust crates into libxul
Rust crates that you want to link into libxul should be listed in the
``dependencies`` section of
`toolkit/library/rust/shared/Cargo.toml <https://searchfox.org/firefox-main/source/toolkit/library/rust/shared/Cargo.toml>`_.
:searchfox:`toolkit/library/rust/shared/Cargo.toml`.
You must also add an ``extern crate`` reference to
`toolkit/library/rust/shared/lib.rs <https://searchfox.org/firefox-main/source/toolkit/library/rust/shared/lib.rs>`_.
:searchfox:`toolkit/library/rust/shared/lib.rs`.
This ensures that the Rust code will be linked properly into libxul as well
as the copy of libxul used for gtests. (Even though Rust 2018 mostly doesn't
require ``extern crate`` declarations, these ones are necessary because the
@@ -32,7 +32,7 @@ but --frozen was passed to prevent this"**.
By default, all Cargo packages in the mozilla-central repository are part of
the same
`workspace <https://searchfox.org/firefox-main/source/toolkit/library/rust/shared/lib.rs>`_
:searchfox:`workspace <toolkit/library/rust/shared/lib.rs>`
and will share the ``Cargo.lock`` file and ``target`` directory in the root of
the repository. You can change this behavior by adding a path to the
``exclude`` list in the top-level ``Cargo.toml`` file. You may want to do
@@ -58,7 +58,7 @@ To link Rust code into libraries other than libxul, create a directory with a
RustLibrary('crate_name')
where ``crate_name`` matches the name from the ``[package]`` section of your
``Cargo.toml``. You can refer to `the moz.build file <https://searchfox.org/mozilla-central/rev/603b9fded7a11ff213c0f415198cd637b7c86614/toolkit/library/rust/moz.build#9>`_ and `the Cargo.toml file <https://searchfox.org/mozilla-central/rev/603b9fded7a11ff213c0f415198cd637b7c86614/toolkit/library/rust/Cargo.toml>`_ that are used for libxul.
``Cargo.toml``. You can refer to :searchfox:`the moz.build file <mozilla-central/rev/603b9fded7a11ff213c0f415198cd637b7c86614:toolkit/library/rust/moz.build#9>` and :searchfox:`the Cargo.toml file <mozilla-central/rev/603b9fded7a11ff213c0f415198cd637b7c86614:toolkit/library/rust/Cargo.toml>` that are used for libxul.
You can then add ``USE_LIBS += ['crate_name']`` to the ``moz.build`` file
that defines the binary as you would with any other library in the tree.
@@ -75,8 +75,7 @@ that defines the binary as you would with any other library in the tree.
Conditional compilation
========================
Edit `tool/library/rust/gkrust-features.mozbuild
<https://searchfox.org/firefox-main/source/toolkit/library/rust/gkrust-features.mozbuild>`_
Edit :searchfox:`tool/library/rust/gkrust-features.mozbuild <toolkit/library/rust/gkrust-features.mozbuild>`
to expose build flags as Cargo features.
Standalone Rust programs
@@ -175,7 +174,7 @@ Finally, make sure you don't accidentally land the changes to the crate or the
``Cargo.lock`` file.
For an example of a more complex workflow involving a third-party crate, see
`mp4parse-rust/README.md <https://searchfox.org/firefox-main/source/media/mp4parse-rust/README.md>`_.
:searchfox:`mp4parse-rust/README.md <media/mp4parse-rust/README.md>`.
It describes the workflow for a crate that is hosted on GitHub, and for which
changes are made via GitHub pull requests, but all pull requests must also be
tested within mozilla-central before being merged.
+4 -7
View File
@@ -97,13 +97,12 @@ a cron task daily and includes:
- building them on all branches
- running a few selenium-based tests
The build definitions `are based on docker <https://searchfox.org/mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8/taskcluster/docker/snap-coreXX-build/Dockerfile>`_.
The build definitions :searchfox:`are based on docker <mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8:taskcluster/docker/snap-coreXX-build/Dockerfile>`.
It should be noted that for the moment, all tasks needs to run under docker.
However, this setup is not working for `Snap` since it interacts with `SystemD`
which does not work under `Docker`. This is why the installation is handled by
`the install-snap script
<https://searchfox.org/mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8/taskcluster/docker/snap-coreXX-build/install-snap.sh>`_
:searchfox:`the install-snap script <mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8:taskcluster/docker/snap-coreXX-build/install-snap.sh>`
rather than plain `sudo snap install`, and also why we need to run `snap` in
`destructive mode` (which is fine since we are within a docker container). This
does not apply to the tests case which relies on newly-available wayland
@@ -117,8 +116,7 @@ builds are as close as possible to upstream. This means:
step
- it builds using the clang build within the snap definition
The tests are defined `within the docker subdirectory
<https://searchfox.org/mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8/taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh>`_.
The tests are defined :searchfox:`within the docker subdirectory <mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8:taskcluster/docker/snap-coreXX-build/snap-tests/tests.sh>`.
They are using Selenium because this is what was used by pre-existing tests ran
on GitHub Actions from upstream.
@@ -131,8 +129,7 @@ How to hack on try
Build and test tasks can be explored via ``mach try fuzzy --full`` by searching
for ``'snap 'upstream``. There is a bit of hacking for try to make sure we
actually don't re-download the mercurial repo and directly reuse the clone
generated by `run-task`, handled in the `run.sh script
<https://searchfox.org/mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8/taskcluster/docker/snap-coreXX-build/run.sh#61-72>`_.
generated by `run-task`, handled in the :searchfox:`run.sh script <mozilla-central/rev/3c72de9280ec57dc55c24886c6334d9e340500e8:taskcluster/docker/snap-coreXX-build/run.sh#61-72>`.
So pushing to try is basically just:
+2 -2
View File
@@ -17,9 +17,9 @@ To add a new **CA**, add a ``${cert_name}.ca.keyspec`` as well as a correspondin
.. hint::
* The full syntax for .certspec files is documented at https://searchfox.org/firefox-main/source/security/manager/tools/pycert.py
* The full syntax for .certspec files is documented at :searchfox:`security/manager/tools/pycert.py`
* The full syntax for .keyspec files is documented at https://searchfox.org/firefox-main/source/security/manager/tools/pykey.py
* The full syntax for .keyspec files is documented at :searchfox:`security/manager/tools/pykey.py`
Then regenerate the certificates by running:::
+15 -33
View File
@@ -13,38 +13,30 @@ Clang and Rust
To modify the toolchains used for a particular task, you may need several
things:
1. A `build task`_
1. A :searchfox:`build task <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/build/linux.yml#5-45>`
2. Which uses a toolchain task
- `clang toolchain`_
- `rust toolchain`_
- :searchfox:`clang toolchain <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/toolchain/clang.yml#51-72>`
- :searchfox:`rust toolchain <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/toolchain/rust.yml#57-74>`
3. Which uses a git fetch
- `clang fetch`_
- (from-source ``dev`` builds only) `rust fetch`_
- :searchfox:`clang fetch <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/fetch/toolchains.yml#413-418>`
- (from-source ``dev`` builds only) :searchfox:`rust fetch <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/fetch/toolchains.yml#434-439>`
4. (clang only) Which uses a `config json`_
4. (clang only) Which uses a :searchfox:`config json <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:build/build-clang/clang-linux64.json>`
5. Which takes patches_ you may want to apply.
5. Which takes :searchfox:`patches <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:build/build-clang/static-llvm-symbolizer.patch>` you may want to apply.
For the most part, you should be able to accomplish what you want by
copying/editing the existing examples in those files.
.. _build task: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/build/linux.yml#5-45
.. _clang toolchain: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/toolchain/clang.yml#51-72
.. _rust toolchain: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/toolchain/rust.yml#57-74
.. _clang fetch: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/fetch/toolchains.yml#413-418
.. _rust fetch: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/fetch/toolchains.yml#434-439
.. _config json: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/build/build-clang/clang-linux64.json
.. _patches: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/build/build-clang/static-llvm-symbolizer.patch
Clang
-----
Building clang is handled by `build-clang.py`_, which uses several resources
in the `build-clang`_ directory. Read the `build-clang README`_ for more
Building clang is handled by :searchfox:`build-clang.py <build/build-clang/build-clang.py>`, which uses several resources
in the :searchfox:`build-clang <build/build-clang/>` directory. Read the :searchfox:`build-clang README <build/build-clang/README>` for more
details.
Note for local builds: build-clang.py can be run on developer machines but its
@@ -52,15 +44,12 @@ lengthy multi-stage build process is unnecessary for most local development. The
upstream `LLVM Getting Started Guide`_ has instructions on how to build
clang more directly.
.. _build-clang.py: https://searchfox.org/firefox-main/source/build/build-clang/build-clang.py
.. _build-clang README: https://searchfox.org/firefox-main/source/build/build-clang/README
.. _build-clang: https://searchfox.org/firefox-main/source/build/build-clang/
.. _LLVM Getting Started Guide: https://llvm.org/docs/GettingStarted.html
Rust
----
Rust builds are handled by `repack_rust.py`_. The primary purpose of
Rust builds are handled by :searchfox:`repack_rust.py <taskcluster/scripts/misc/repack_rust.py>`. The primary purpose of
that script is to download prebuilt tarballs from the Rust project.
It uses the same basic format as `rustup` for specifying the toolchain
@@ -80,22 +69,22 @@ used anywhere by default. The feature was added so that we can test patches
to rustc against the tree. Expect things to be a bit hacky and limited.
Most importantly, building from source requires your toolchain to have a
`fetch of the rust tree`_ as well as `clang and binutils toolchains`_. It is also
:searchfox:`fetch of the rust tree <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/toolchain/rust.yml#69-71>` as well as :searchfox:`clang and binutils toolchains <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/ci/toolchain/rust.yml#72-74>`. It is also
recommended to upgrade the worker-type to e.g. ``b-linux-large``.
Rust's build dependencies are fairly minimal, and it has a sanity check
that should catch any missing or too-old dependencies. See the `Rust README`_
for more details.
Patches are set via `the --patch flag`_ (passed via ``toolchain/rust.yml``).
Patches are set via :searchfox:`the --patch flag <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/scripts/misc/repack_rust.py#667-675>` (passed via ``toolchain/rust.yml``).
Patch paths are assumed to be relative to ``/build/build-rust/``, and may be
optionally prefixed with ``module-path:`` to specify they apply to that git
submodule in the Rust source. e.g. ``--patch src/llvm-project:mypatch.diff``
patches rust's llvm with ``/build/build-rust/mypatch.diff``. There are no
currently checked in rust patches to use as an example, but they should be
the same format as `the clang ones`_.
the same format as :searchfox:`the clang ones <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:build/build-clang/static-llvm-symbolizer.patch>`.
Rust builds are not currently configurable, and uses a `hardcoded config.toml`_,
Rust builds are not currently configurable, and uses a :searchfox:`hardcoded config.toml <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/scripts/misc/repack_rust.py#384-421>`,
which you may need to edit for your purposes. See Rust's `example config`_ for
details/defaults. Note that these options do occasionally change, so be sure
you're using options for the version you're targeting. For instance, there was
@@ -110,22 +99,15 @@ what needs to be done to get this working.
While Rust generally maintains a clean tree for building ``rustc`` and
``cargo``, other tools like ``rustfmt`` or ``miri`` are allowed to be
transiently broken. This means not every commit in the Rust tree will be
able to build the `tools we require`_.
able to build the :searchfox:`tools we require <mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c:taskcluster/scripts/misc/repack_rust.py#398>`.
Although ``repack_rust`` considers ``rustfmt`` an optional package, Rust builds
do not currently implement this and will fail if ``rustfmt`` is busted. Some
attempt was made to work around it, but `more work is needed`_.
.. _Rust's ci: https://github.com/rust-lang/rust/pull/77875#issuecomment-736092083
.. _repack_rust.py: https://searchfox.org/firefox-main/source/taskcluster/scripts/misc/repack_rust.py
.. _fetch of the rust tree: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/toolchain/rust.yml#69-71
.. _clang and binutils toolchains: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/ci/toolchain/rust.yml#72-74
.. _the --patch flag: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/scripts/misc/repack_rust.py#667-675
.. _the clang ones: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/build/build-clang/static-llvm-symbolizer.patch
.. _Rust README: https://github.com/rust-lang/rust/#building-on-a-unix-like-system
.. _hardcoded config.toml: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/scripts/misc/repack_rust.py#384-421
.. _example config: https://github.com/rust-lang/rust/blob/b7ebc6b0c1ba3c27ebb17c0b496ece778ef11e18/config.toml.example
.. _tools we require: https://searchfox.org/mozilla-central/rev/168c45a7acc44e9904cfd4eebcb9eb080e05699c/taskcluster/scripts/misc/repack_rust.py#398
.. _more work is needed: https://github.com/rust-lang/rust/issues/79249
Python
@@ -354,7 +354,7 @@ C/C++ practices
---------------
- **Have you checked for compiler warnings?** Warnings often point to
real bugs. `Many of them <https://searchfox.org/firefox-main/source/build/moz.configure/warnings.configure>`__
real bugs. :searchfox:`Many of them <build/moz.configure/warnings.configure>`
are enabled by default in the build system.
- In C++ code, use ``nullptr`` for pointers. In C code, using ``NULL``
or ``0`` is allowed.
@@ -159,15 +159,13 @@ wrapper).
Coding style configuration is done within clang-format itself. When we
change the configuration (incorrect configuration, new feature in clang,
etc), we use `local
overrides <https://searchfox.org/mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0/.clang-format>`__.
etc), we use :searchfox:`local overrides <mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0:.clang-format>`.
Ignored files & directories
~~~~~~~~~~~~~~~~~~~~~~~~~~~
We maintain a `list of ignored directories and
files <https://searchfox.org/mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0/.clang-format-ignore>`__,
We maintain a :searchfox:`list of ignored directories and files <mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0:.clang-format-ignore>`,
which is used by ``./mach lint -l clang-format``. This is generally only used
for code broken by clang-format, and third-party code.
@@ -185,8 +183,7 @@ reformat:
my code which should not be reformatted
// clang-format on
You can find an `example of code not
formatted <https://searchfox.org/mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0/xpcom/io/nsEscape.cpp#22>`__.
You can find an :searchfox:`example of code not formatted <mozilla-central/rev/501eb4718d73870892d28f31a99b46f4783efaa0:xpcom/io/nsEscape.cpp#22>`.
Ignore lists
@@ -92,16 +92,15 @@ What to mirror
- Icons or animations that imply directionality or motion like
back/forward buttons or progress bars
- Icons that imply text direction, like
`reader-mode.svg <https://searchfox.org/mozilla-central/rev/f9beb753a84aa297713d1565dcd0c5e3c66e4174/browser/themes/shared/icons/reader-mode.svg>`__
:searchfox:`reader-mode.svg <mozilla-central/rev/f9beb753a84aa297713d1565dcd0c5e3c66e4174:browser/themes/shared/icons/reader-mode.svg>`
- Icons that imply location of UI elements in the screen, like
`sidebar-collapsed-right.svg <https://searchfox.org/firefox-main/rev/b9c3ba706c41c42a7a1b4f6e5b5ba878782b3ab2/browser/themes/shared/icons/sidebar-collapsed-right.svg>`__,
`open-in-new.svg <https://searchfox.org/mozilla-central/rev/f9beb753a84aa297713d1565dcd0c5e3c66e4174/toolkit/themes/shared/icons/open-in-new.svg>`__,
`default theme's preview.svg <https://searchfox.org/mozilla-central/rev/f9beb753a84aa297713d1565dcd0c5e3c66e4174/toolkit/mozapps/extensions/default-theme/preview.svg>`__
:searchfox:`sidebar-collapsed-right.svg <firefox-main/rev/b9c3ba706c41c42a7a1b4f6e5b5ba878782b3ab2:browser/themes/shared/icons/sidebar-collapsed-right.svg>`,
:searchfox:`open-in-new.svg <mozilla-central/rev/f9beb753a84aa297713d1565dcd0c5e3c66e4174:toolkit/themes/shared/icons/open-in-new.svg>`,
:searchfox:`default theme's preview.svg <mozilla-central/rev/f9beb753a84aa297713d1565dcd0c5e3c66e4174:toolkit/mozapps/extensions/default-theme/preview.svg>`
or
`pane-collapse.svg <https://searchfox.org/mozilla-central/rev/74cc0f4dce444fe0757e2a6b8307d19e4d0e0212/devtools/client/debugger/images/pane-collapse.svg>`__
:searchfox:`pane-collapse.svg <mozilla-central/rev/74cc0f4dce444fe0757e2a6b8307d19e4d0e0212:devtools/client/debugger/images/pane-collapse.svg>`
- Icons representing objects that are meant to be handheld should look
like they're being right-handed, like the `magnifying glass
icon <https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/toolkit/themes/windows/global/icons/search-textbox.svg>`__
like they're being right-handed, like the :searchfox:`magnifying glass icon <mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f:toolkit/themes/windows/global/icons/search-textbox.svg>`
- Twisties in their collapsed state. Note that if the context in which
they appear is LTR (e.g. code in a devtools HTML view), they should
not be mirrored, even if the user might be using an RTL locale.
@@ -112,14 +111,12 @@ What NOT to mirror
- Text/numbers
- Icons containing text/numbers
- Icons/animations that are direction neutral
- Icons that wouldn't look differently if they'd be mirrored, like `X
buttons <https://searchfox.org/mozilla-central/rev/a78233c11a6baf2c308fbed17eb16c6e57b6a2ac/devtools/client/debugger/images/close.svg>`__
or the `bookmark
star <https://searchfox.org/mozilla-central/rev/a78233c11a6baf2c308fbed17eb16c6e57b6a2ac/browser/themes/shared/icons/bookmark-hollow.svg>`__
- Icons that wouldn't look differently if they'd be mirrored, like :searchfox:`X buttons <mozilla-central/rev/a78233c11a6baf2c308fbed17eb16c6e57b6a2ac:devtools/client/debugger/images/close.svg>`
or the :searchfox:`bookmark star <mozilla-central/rev/a78233c11a6baf2c308fbed17eb16c6e57b6a2ac:browser/themes/shared/icons/bookmark-hollow.svg>`
icon, or any other symmetric icon
- Icons that should look the same as LTR, like icons related to code
(which is always LTR) like
`tool-webconsole.svg <https://searchfox.org/mozilla-central/rev/74cc0f4dce444fe0757e2a6b8307d19e4d0e0212/devtools/client/themes/images/tool-webconsole.svg>`__
:searchfox:`tool-webconsole.svg <mozilla-central/rev/74cc0f4dce444fe0757e2a6b8307d19e4d0e0212:devtools/client/themes/images/tool-webconsole.svg>`
- Checkmark icons
- Video/audio player controls
- Product logos
@@ -315,12 +315,11 @@ rvalue references
Attributes
Several common attributes are defined in
`mozilla/Attributes.h <https://searchfox.org/firefox-main/source/mfbt/Attributes.h>`__
:searchfox:`mozilla/Attributes.h <mfbt/Attributes.h>`
or nscore.h.
Alignment
Some alignment utilities are defined in `mozilla/Alignment.h
<https://searchfox.org/firefox-main/source/mfbt/Alignment.h>`__.
Some alignment utilities are defined in :searchfox:`mozilla/Alignment.h <mfbt/Alignment.h>`.
``[[deprecated]]``
If we have deprecated code, we should be removing it rather than marking it as
@@ -388,7 +387,7 @@ memory size tracking) or have more controllable performance
characteristics.
A list of approved standard library headers is maintained in
`config/stl-headers.mozbuild <https://searchfox.org/firefox-main/source/config/stl-headers.mozbuild>`__.
:searchfox:`config/stl-headers.mozbuild`.
Data structures
@@ -439,7 +438,7 @@ Data structures
-
- Like ``std::set``, but for enum classes.
* - ``mozilla::Hash{Map,Set}``
- `mozilla/HashTable.h <https://searchfox.org/firefox-main/source/mfbt/HashTable.h>`__
- :searchfox:`mozilla/HashTable.h <mfbt/HashTable.h>`
- ``std::unordered_{map,set}``
- A general purpose hash map and hash set.
* - ``nsInterfaceHashtable``
+1 -1
View File
@@ -27,7 +27,7 @@ In this document, we try to list these all tools.
* - Custom clang checker
-
-
- `Source <https://searchfox.org/firefox-main/source/build/clang-plugin>`_
- :searchfox:`Source <build/clang-plugin>`
-
* - Clang-Tidy
- Yes
+9 -9
View File
@@ -106,7 +106,7 @@ Example
-------
Here is an example of an external linter that shells out to the Python ruff linter,
let's call the file ``ruff_lint.py`` (`in-tree version <https://searchfox.org/firefox-main/source/tools/lint/python/ruff.py>`__):
let's call the file ``ruff_lint.py`` (:searchfox:`in-tree version <tools/lint/python/ruff.py>`):
.. code-block:: python
@@ -224,7 +224,7 @@ They should be pretty easy to write as most of the work is managed by the Mozlin
framework. The key declaration is the ``LINTER`` variable which must match
the linker declaration.
As an example, the `ruff test <https://searchfox.org/firefox-main/source/tools/lint/test/test_ruff.py>`_ looks like the following snippet:
As an example, the :searchfox:`ruff test <tools/lint/test/test_ruff.py>` looks like the following snippet:
.. code-block:: python
@@ -256,7 +256,7 @@ To run a specific test:
./mach python-test --subsuite mozlint tools/lint/test/test_black.py
More tests can be `found in-tree <https://searchfox.org/firefox-main/source/tools/lint/test>`_.
More tests can be :searchfox:`found in-tree <tools/lint/test>`.
Tracking fixed issues
---------------------
@@ -268,8 +268,8 @@ All the linters that provide ``fix support`` returns a dictionary instead of a l
* results - All the linting errors it was not able to fix
* fixed - Count of fixed errors (for ``fix=False`` this is 0)
Some linters (example: `codespell <https://searchfox.org/mozilla-central/rev/0379f315c75a2875d716b4f5e1a18bf27188f1e6/tools/lint/spell/__init__.py#145-163>`_) might require two passes to count the number of fixed issues.
Others might just need `some tuning <https://searchfox.org/mozilla-central/rev/0379f315c75a2875d716b4f5e1a18bf27188f1e6/tools/lint/file-whitespace/__init__.py#28,60,85,112>`_.
Some linters (example: :searchfox:`codespell <mozilla-central/rev/0379f315c75a2875d716b4f5e1a18bf27188f1e6:tools/lint/spell/__init__.py#145-163>`) might require two passes to count the number of fixed issues.
Others might just need :searchfox:`some tuning <mozilla-central/rev/0379f315c75a2875d716b4f5e1a18bf27188f1e6:tools/lint/file-whitespace/__init__.py#28,60,85,112>`.
For adding tests to check your fixed count, add a global variable ``fixed = 0``
and write a function to add your test as mentioned under ``Automated testing`` section.
@@ -308,7 +308,7 @@ complicated as pulling a whole graph of tools, plugins and their dependencies.
Either way, to reduce the burden on users, linters should strive to provide
automated bootstrapping of all their dependencies. To help with this,
``mozlint`` allows linters to define a ``setup`` config, which has the same
path object format as an external payload. For example (`in-tree version <https://searchfox.org/firefox-main/source/tools/lint/ruff.yml>`__):
path object format as an external payload. For example (:searchfox:`in-tree version <tools/lint/ruff.yml>`):
.. code-block:: yaml
@@ -347,7 +347,7 @@ Adding the linter to the CI
First, the job will have to be declared in Taskcluster.
This should be done in the `mozlint Taskcluster configuration <https://searchfox.org/firefox-main/source/taskcluster/kinds/source-test/mozlint.yml>`_.
This should be done in the :searchfox:`mozlint Taskcluster configuration <taskcluster/kinds/source-test/mozlint.yml>`.
You will need to define a symbol, how it is executed and on what kind of change.
For example, for ruff, the configuration is the following:
@@ -365,8 +365,8 @@ For example, for ruff, the configuration is the following:
- '**/*.py'
- '**/.ruff.toml'
If the linter requires an external program, you will have to install it in the `setup script <https://searchfox.org/firefox-main/source/taskcluster/docker/lint/system-setup.sh>`_
and maybe install the necessary files in the `Docker configuration <https://searchfox.org/firefox-main/source/taskcluster/docker/lint/Dockerfile>`_.
If the linter requires an external program, you will have to install it in the :searchfox:`setup script <taskcluster/docker/lint/system-setup.sh>`
and maybe install the necessary files in the :searchfox:`Docker configuration <taskcluster/docker/lint/Dockerfile>`.
.. note::
+3 -3
View File
@@ -33,7 +33,7 @@ Configuration
-------------
To enable clippy on new directory, add the path to the include
section in the `clippy.yml <https://searchfox.org/firefox-main/source/tools/lint/clippy.yml>`_ file.
section in the :searchfox:`clippy.yml <tools/lint/clippy.yml>` file.
To enable additional clippy rules beyond the defaults, add them to the
``warn`` or ``deny`` lists in `clippy.yml <https://searchfox.org/mozilla-central/source/tools/lint/clippy.yml>`_:
@@ -51,5 +51,5 @@ The full list of available lints is at https://rust-lang.github.io/rust-clippy/m
Sources
-------
* `Configuration (YAML) <https://searchfox.org/firefox-main/source/tools/lint/clippy.yml>`_
* `Source <https://searchfox.org/firefox-main/source/tools/lint/clippy/__init__.py>`_
* :searchfox:`Configuration (YAML) <tools/lint/clippy.yml>`
* :searchfox:`Source <tools/lint/clippy/__init__.py>`
@@ -9,7 +9,7 @@ non-module code or non-system modules, webidl defined interfaces should already
be available and hence do not need importing.
For sjs test files, if the relevant global is not already available, then consider
extending the `list of globals available from the httpd server <https://searchfox.org/mozilla-central/rev/e9b338c2d597067f99e96d5f20769f41f312fa8f/netwerk/test/httpserver/httpd.sys.mjs#2875-2889>`_.
extending the :searchfox:`list of globals available from the httpd server <mozilla-central/rev/e9b338c2d597067f99e96d5f20769f41f312fa8f:netwerk/test/httpserver/httpd.sys.mjs#2875-2889>`.
Options
-------
@@ -7,7 +7,7 @@ If modifying old code, please consider swapping it in if possible; if this is tr
a bug is on file.
.. |TextEncoder| replace:: ``TextEncoder``
.. _TextEncoder: https://searchfox.org/firefox-main/source/dom/webidl/TextEncoder.webidl
.. _TextEncoder: :searchfox:`dom/webidl/TextEncoder.webidl`
.. |TextDecoder| replace:: ``TextDecoder``
.. _TextDecoder: https://searchfox.org/firefox-main/source/dom/webidl/TextDecoder.webidl
.. _TextDecoder: :searchfox:`dom/webidl/TextDecoder.webidl`
+3 -4
View File
@@ -92,7 +92,7 @@ it is not possible to scope ESLint rules to individual files based on .ini
files without a build step that would break editors, or an expensive loading
cycle.
* If the directory path of the tests is one of the `known ones`_, then ESLint will
* If the directory path of the tests is one of the :searchfox:`known ones <mozilla-central/rev/287583a4a605eee8cd2d41381ffaea7a93d7b987:.eslintrc.js#24-40>`, then ESLint will
do the right thing for that test type. This is the preferred option.
* For example placing xpcshell-tests in ``browser/components/foo/test/unit/``
@@ -215,9 +215,8 @@ For test harness issues, file bugs in Developer Infrastructure :: Lint and Forma
.. _eslint.org's rule list: https://eslint.org/docs/rules/
.. _eslint-plugin-mozilla: eslint-plugin-mozilla.html
.. _eslint-plugin-spidermonkey-js: eslint-plugin-spidermonkey-js.html
.. _informed that it is a module: https://searchfox.org/mozilla-central/rev/9399e5832979755cd340383f4ca4069dd5fc7774/browser/base/content/.eslintrc.js
.. _informed that it is a module: :searchfox:`mozilla-central/rev/9399e5832979755cd340383f4ca4069dd5fc7774:browser/base/content/.eslintrc.js`
.. _seek help: ../index.html#getting-help
.. _patterns in .eslintrc.js: https://searchfox.org/mozilla-central/rev/9399e5832979755cd340383f4ca4069dd5fc7774/.eslintrc.js#24-38
.. _known ones: https://searchfox.org/mozilla-central/rev/287583a4a605eee8cd2d41381ffaea7a93d7b987/.eslintrc.js#24-40
.. _patterns in .eslintrc.js: :searchfox:`mozilla-central/rev/9399e5832979755cd340383f4ca4069dd5fc7774:.eslintrc.js#24-38`
.. _difficult for ESLint to handle: https://bugzilla.mozilla.org/show_bug.cgi?id=1379669
.. _prettier ignore docs: https://prettier.io/docs/en/ignore.html
@@ -29,5 +29,5 @@ This linter provides a ``--fix`` option for the ``generated-metrics.yaml`` file.
Sources
-------
* `Configuration (YAML) <https://searchfox.org/firefox-main/source/tools/lint/gecko-trace.yml>`_
* `Source <https://searchfox.org/firefox-main/source/tools/lint/gecko-trace/__init__.py>`_
* :searchfox:`Configuration (YAML) <tools/lint/gecko-trace.yml>`
* :searchfox:`Source <tools/lint/gecko-trace/__init__.py>`
+1 -2
View File
@@ -5,8 +5,7 @@ This linter verifies if a file has a known license header.
By default, Firefox uses MPL-2 license with the `appropriate headers <https://www.mozilla.org/en-US/MPL/headers/>`_.
In some cases (thirdpardy code), a file might have a different header file.
If this is the case, one of the significant line of the header should be listed in the list `of valid licenses
<https://searchfox.org/firefox-main/source/tools/lint/license/valid-licenses.txt>`_.
If this is the case, one of the significant line of the header should be listed in the list :searchfox:`of valid licenses <tools/lint/license/valid-licenses.txt>`.
Run Locally
-----------
+3 -3
View File
@@ -120,10 +120,10 @@ Metrics that produce alerts can also be documented like so:
The documented metrics must exist in the tests for the suite. If they are not, then validation will fail. The same is true if a metric in a test is not documented. Also, if ``metrics`` are defined, then a ``metrics.rst`` file is expected to be found in the ``perfdocs`` folder for the given suite. It must contain the string ``{metrics_documentation}`` where the documentation should be added. The ``metrics.rst`` is renamed ``{suite-name}-metrics.rst`` in the generated folder, so if it needs to be linked to in the ``index.rst`` file, it should contain a ``{metrics_rst_name}`` string for where the link should be added - it's expected to be found in a toctree section.
Note that there needs to be a FrameworkGatherer implemented for the framework being documented since each of them may have different ways of parsing test manifests for the tests. See `RaptorGatherer <https://searchfox.org/firefox-main/source/tools/lint/perfdocs/framework_gatherers.py>`_ for an example gatherer that was implemented for Raptor.
Note that there needs to be a FrameworkGatherer implemented for the framework being documented since each of them may have different ways of parsing test manifests for the tests. See :searchfox:`RaptorGatherer <tools/lint/perfdocs/framework_gatherers.py>` for an example gatherer that was implemented for Raptor.
Sources
-------
* `Configuration <https://searchfox.org/firefox-main/source/tools/lint/perfdocs.yml>`__
* `Source <https://searchfox.org/firefox-main/source/tools/lint/perfdocs>`__
* :searchfox:`Configuration <tools/lint/perfdocs.yml>`
* :searchfox:`Source <tools/lint/perfdocs>`
+3 -4
View File
@@ -25,7 +25,7 @@ The mozlint integration of ruff can be run using mach:
Configuration
-------------
Ruff is configured in the root `pyproject.toml`_ file. Additionally, ruff will
Ruff is configured in the root :searchfox:`pyproject.toml` file. Additionally, ruff will
pick up any ``pyproject.toml`` or ``ruff.toml`` files in subdirectories. The
settings in these files will only apply to files contained within these
subdirs. For more details on configuration discovery, see the `configuration
@@ -36,9 +36,8 @@ For a list of options, see the `settings documentation`_.
Sources
-------
* `Configuration (YAML) <https://searchfox.org/firefox-main/source/tools/lint/ruff.yml>`_
* `Source <https://searchfox.org/firefox-main/source/tools/lint/python/ruff.py>`_
* :searchfox:`Configuration (YAML) <tools/lint/ruff.yml>`
* :searchfox:`Source <tools/lint/python/ruff.py>`
.. _pyproject.toml: https://searchfox.org/firefox-main/source/pyproject.toml
.. _configuration documentation: https://beta.ruff.rs/docs/configuration/
.. _settings documentation: https://beta.ruff.rs/docs/settings/
@@ -168,8 +168,8 @@ Platforms that are currently supported in CI
Sources
-------
* `Configuration (YAML) <https://searchfox.org/firefox-main/source/tools/lint/test-manifest-toml.yml>`_
* `Source <https://searchfox.org/firefox-main/source/tools/lint/test-manifest-toml/__init__.py>`_
* :searchfox:`Configuration (YAML) <tools/lint/test-manifest-toml.yml>`
* :searchfox:`Source <tools/lint/test-manifest-toml/__init__.py>`
Developer Information
---------------------
@@ -5,7 +5,7 @@ Adding a check
After you've completed a matcher using clang-query, it's time to take it to the next step and turn it into C++ and run it on the whole m-c codebase and see what happens.
Clang plugins live in `build/clang-plugin <https://searchfox.org/firefox-main/source/build/clang-plugin>`_ and here we'll cover what is needed to add one. To see how the most recent check was added, you can look at the log for `Checks.inc <https://hg.mozilla.org/mozilla-central/log/tip/build/clang-plugin/Checks.inc>`_ which is one of the necessary files to edit. That's also what we'll be covering next.
Clang plugins live in :searchfox:`build/clang-plugin` and here we'll cover what is needed to add one. To see how the most recent check was added, you can look at the log for `Checks.inc <https://hg.mozilla.org/mozilla-central/log/tip/build/clang-plugin/Checks.inc>`_ which is one of the necessary files to edit. That's also what we'll be covering next.
Boilerplate Steps to Add a New Check
------------------------------------
@@ -14,7 +14,7 @@ First pick a name. Pick something that makes sense without punctuation, in no mo
#. Add it alphabetically in build/clang-plugin/Checks.inc, ChecksIncludes.inc, and moz.build
#. ``cd build/clang-plugin && touch MissingElseInEnumComparisons.h MissingElseInEnumComparisons.cpp``
#. Copy the contents of an existing, simple .h file (e.g. `build/clang-plugin/ScopeChecker.h <https://searchfox.org/firefox-main/source/build/clang-plugin/ScopeChecker.h>`_) and edit the class name and header guards.
#. Copy the contents of an existing, simple .h file (e.g. :searchfox:`build/clang-plugin/ScopeChecker.h`) and edit the class name and header guards.
#. Create the following boilerplate for your implementation:
::
@@ -8,7 +8,7 @@ This page covers additional ways to improve and extend the check you've added to
Adding Tests
------------
No doubt you've seen the tests for existing checks in `build/clang-plugin/tests <https://searchfox.org/firefox-main/source/build/clang-plugin/tests>`_. Adding tests is straightforward; and your reviewer should insist you do so. Simply copying the existing format of any test and how diagnostics are marked as expected.
No doubt you've seen the tests for existing checks in :searchfox:`build/clang-plugin/tests`. Adding tests is straightforward; and your reviewer should insist you do so. Simply copying the existing format of any test and how diagnostics are marked as expected.
One wrinkle - all clang plugin checks are applied to all tests. We try to write tests so that only one check applies to it. If you write a check that triggers on an existing test, try to fix the existing test slightly so the new check does not trigger on it.
@@ -4,8 +4,7 @@ Using clang-query
=================
clang-query is a tool that allows you to quickly iterate and develop the difficult part of a matcher.
Once the design of the matcher is completed, it can be transferred to a C++ clang-tidy plugin, `similar
to the ones in mozilla-central <https://searchfox.org/firefox-main/source/build/clang-plugin>`_.
Once the design of the matcher is completed, it can be transferred to a C++ clang-tidy plugin, :searchfox:`similar to the ones in mozilla-central <build/clang-plugin>`.
Recommended Boilerplate
-----------------------
+3 -3
View File
@@ -103,6 +103,6 @@ References
----------
The interface definition in source code have a lot of detailed comments:
- The `nsIPrincipal <https://searchfox.org/firefox-main/source/caps/nsIPrincipal.idl>`_ interface definition.
- The `nsILoadInfo <https://searchfox.org/firefox-main/source/netwerk/base/nsILoadInfo.idl>`_ interface definition.
- The `nsIContentSecurityManager <https://searchfox.org/firefox-main/source/dom/interfaces/security/nsIContentSecurityManager.idl>`_ interface definition
- The :searchfox:`nsIPrincipal <caps/nsIPrincipal.idl>` interface definition.
- The :searchfox:`nsILoadInfo <netwerk/base/nsILoadInfo.idl>` interface definition.
- The :searchfox:`nsIContentSecurityManager <dom/interfaces/security/nsIContentSecurityManager.idl>` interface definition
@@ -8,7 +8,7 @@ devices, and audiences:
mobile browser is split into several different artifact layers:
- `The fenix Android application </mobile/android/fenix.html>`_
- `The android-components Android library <https://searchfox.org/firefox-main/source/mobile/android/android-components>`_
- :searchfox:`The android-components Android library <mobile/android/android-components>`
- `The GeckoView platform </mobile/android/geckoview>`_
- `Firefox for iOS <https://github.com/mozilla-mobile/firefox-ios>`_,
@@ -16,7 +16,7 @@ devices, and audiences:
- Building **Firefox Focus**, our privacy-focused browser for
- `iOS <https://github.com/mozilla-mobile/focus-ios>`_
- `Android <https://searchfox.org/firefox-main/source/mobile/android/focus-android>`_. This browser
- :searchfox:`Android <mobile/android/focus-android>`. This browser
also uses the android-components library and GeckoView platform, like Firefox for Android
For both Desktop and Mobile development, please bear the following in
@@ -35,7 +35,7 @@ very diverse skills:
- If you know **Rust**, you can also contribute to the `Rust programming
language <https://github.com/rust-lang/rust>`_ itself, numerous crates like `grcov <https://github.com/mozilla/grcov/>`_
or `Servo <https://servo.org/>`_, the web browser engine designed for parallelism and safety.
- If you know **Kotlin**, you can contribute to :ref:`Firefox for Android <Firefox Contributors' Quick Reference>` (code name: "Fenix"). `Fenix's code <https://searchfox.org/firefox-main/source/mobile/android/>`_ is integrated into the same repository as Firefox Desktop.
- If you know **Kotlin**, you can contribute to :ref:`Firefox for Android <Firefox Contributors' Quick Reference>` (code name: "Fenix"). :searchfox:`Fenix's code <mobile/android/>` is integrated into the same repository as Firefox Desktop.
- If you know **Swift**, you can contribute to `Firefox for
iOS <https://github.com/mozilla-mobile/firefox-ios>`_ and `Firefox
Focus for iOS <https://github.com/mozilla-mobile/focus-ios>`_.
@@ -7,11 +7,11 @@ Mozilla-specific lldb settings
------------------------------
There's an
``.lldbinit`` `file <https://searchfox.org/firefox-main/source/.lldbinit>`_
``.lldbinit`` :searchfox:`file <.lldbinit>`
in the Mozilla source tree, which applies recommended settings and
includes a few type summaries and Mozilla-specific debugging commands
via the lldbutils module (see
`python/lldbutils/README.txt <https://searchfox.org/firefox-main/source/python/lldbutils/README.txt>`__).
:searchfox:`python/lldbutils/README.txt`).
For information about available features see the links above and the `Using
LLDB to debug Gecko <http://mcc.id.au/blog/2014/01/lldb-gecko>`__ blog
post.
@@ -111,7 +111,7 @@ Advanced usage
Shared suppression files
~~~~~~~~~~~~~~~~~~~~~~~~
`/build/valgrind/ <https://searchfox.org/firefox-main/source/build/valgrind/>`__
:searchfox:`/build/valgrind/ <build/valgrind/>`
contains the suppression files used by the periodic Valgrind jobs on
Treeherder. Some of these files are platform-specific.
@@ -179,10 +179,8 @@ Setting up lldb
lldb <Debugging Firefox with LLDB>`.
The
`.lldbinit <http://searchfox.org/firefox-main/source/.lldbinit>`__
file in the source tree imports many useful `Mozilla specific lldb
settings, commands and
formatters <https://searchfox.org/firefox-main/source/python/lldbutils/README.txt>`__
:searchfox:`.lldbinit`
file in the source tree imports many useful :searchfox:`Mozilla specific lldb settings, commands and formatters <python/lldbutils/README.txt>`
into ``lldb``, but you may need to take one of the following steps to
make sure this file is used.
@@ -274,7 +274,7 @@ Debugging JavaScript
~~~~~~~~~~~~~~~~~~~~
You can use helper functions from
`nsXPConnect.cpp <https://searchfox.org/firefox-main/source/js/xpconnect/src/nsXPConnect.cpp>`__
:searchfox:`nsXPConnect.cpp <js/xpconnect/src/nsXPConnect.cpp>`
to inspect and modify the state of JavaScript code from the MSVS
debugger.
@@ -890,7 +890,7 @@ test types.
.. code:: bash
# Run a single test by using Prefix.TestName, e.g. JsepSessionTest.FullCall
# https://searchfox.org/mozilla-central/rev/4d6a5b97428760d15bfcad13f8fc81439370a7ec/media/webrtc/signaling/gtest/jsep_session_unittest.cpp#1551
# :searchfox:`mozilla-central/rev/4d6a5b97428760d15bfcad13f8fc81439370a7ec:media/webrtc/signaling/gtest/jsep_session_unittest.cpp#1551`
./mach gtest 'JsepSessionTest.FullCall'
# Run all the tests in a single Prefix, e.g. JsepSessionTest
@@ -913,20 +913,20 @@ Here is a list of helpful substring selectors for executing specific WebRTC gtes
- Files
* - :code:`*Jsep*`
- JSEP (signalling) tests
- `jsep_session_unittest.cpp <https://searchfox.org/firefox-main/source/media/webrtc/signaling/gtest/jsep_session_unittest.cpp>`__
`jsep_trak_unittest.cpp <https://searchfox.org/firefox-main/source/media/webrtc/signaling/gtest/jsep_track_unittest.cpp>`__
- :searchfox:`jsep_session_unittest.cpp <media/webrtc/signaling/gtest/jsep_session_unittest.cpp>`
:searchfox:`jsep_trak_unittest.cpp <media/webrtc/signaling/gtest/jsep_track_unittest.cpp>`
* - :code:`*Sdp*`
- SDP parsing tests
- `sdp_unittests.cpp <https://searchfox.org/firefox-main/source/media/webrtc/signaling/gtest/sdp_unittests.cpp>`__
- :searchfox:`sdp_unittests.cpp <media/webrtc/signaling/gtest/sdp_unittests.cpp>`
* - :code:`*MediaPipeline*`
- MediaPipline and MediaPipeline filter tests for RTP media handling
- `mediapipeline_unittest.cpp <https://searchfox.org/firefox-main/source/media/webrtc/signaling/gtest/mediapipeline_unittest.cpp>`__
- :searchfox:`mediapipeline_unittest.cpp <media/webrtc/signaling/gtest/mediapipeline_unittest.cpp>`
* - :code:`*AudioConduit*`
- AudioConduit tests for libwebrtc glue for RTP audio media
- `audioconduit_unittests.cpp <https://searchfox.org/firefox-main/source/media/webrtc/signaling/gtest/audioconduit_unittests.cpp>`__
- :searchfox:`audioconduit_unittests.cpp <media/webrtc/signaling/gtest/audioconduit_unittests.cpp>`
* - :code:`*VideoConduit*`
- VideoConduit tests for libwebrtc glue for RTP video media
- `videoconduit_unittests.cpp <https://searchfox.org/firefox-main/source/media/webrtc/signaling/gtest/videoconduit_unittests.cpp>`__
- :searchfox:`videoconduit_unittests.cpp <media/webrtc/signaling/gtest/videoconduit_unittests.cpp>`
For more general information about gtests see the documentation `here </gtest/index.html>`__.
@@ -955,115 +955,115 @@ provided below to help one navigate.
- Component
- Description
- Notes
* - `dom/media/webrtc <https://searchfox.org/firefox-main/source/dom/media/webrtc>`__
* - :searchfox:`dom/media/webrtc`
- WebRTC
- This is the primary directory for Firefox WebRTC code
-
* - `dom/media/webrtc/common <https://searchfox.org/firefox-main/source/dom/media/webrtc/common>`__
* - :searchfox:`dom/media/webrtc/common`
- WebRTC
- This contains WebRTC related utility code
-
* - `dom/media/webrtc/jsapi <https://searchfox.org/firefox-main/source/dom/media/webrtc/jsapi>`__
* - :searchfox:`dom/media/webrtc/jsapi`
- JS API
- This contains the C++ implementations of the JavaScript WebRTC interfaces
-
* - `dom/media/webrtc/jsep <https://searchfox.org/firefox-main/source/dom/media/webrtc/jsep>`__
* - :searchfox:`dom/media/webrtc/jsep`
- Signalling
- This is the JSEP state engine implementation
-
* - `dom/media/webrtc/libwebrtcglue <https://searchfox.org/firefox-main/source/dom/media/webrtc/libwebrtcglue>`__
* - :searchfox:`dom/media/webrtc/libwebrtcglue`
- WebRTC (various)
- This is the glue code between libwebrtc and Firefox
-
* - `dom/media/webrtc/libwebrtc_overrides <https://searchfox.org/firefox-main/source/dom/media/webrtc/libwebrtc_overrides>`__
* - :searchfox:`dom/media/webrtc/libwebrtc_overrides`
- WebRTC (various)
- Firefox-specific overrides for libwebrtc components
-
* - `dom/media/webrtc/sdp <https://searchfox.org/firefox-main/source/dom/media/webrtc/sdp>`__
* - :searchfox:`dom/media/webrtc/sdp`
- Signalling
- This contains the SDP parsing interface
-
* - `dom/media/webrtc/tests <https://searchfox.org/firefox-main/source/dom/media/webrtc/tests>`__
* - :searchfox:`dom/media/webrtc/tests`
- Tests
- This contains `some` of the WebRTC related tests
-
* - `dom/media/webrtc/third_party_build <https://searchfox.org/firefox-main/source/dom/media/webrtc/third_party_build>`__
* - :searchfox:`dom/media/webrtc/third_party_build`
- Build
- The scripting and configuration for vendoring new versions of libwebrtc are here
- This is unlikely to be of concern for debugging
* - `dom/media/webrtc/transport <https://searchfox.org/firefox-main/source/dom/media/webrtc/transport>`__
* - :searchfox:`dom/media/webrtc/transport`
- Network
- This contains the ICE implementation, the MDNS implementation, and transport code
-
* - `dom/media/webrtc/transport/ipc <https://searchfox.org/firefox-main/source/dom/media/webrtc/transport/ipc>`__
* - :searchfox:`dom/media/webrtc/transport/ipc`
- Network
- IPDL protocols for WebRTC transport, including STUN address requests and WebRTC TCP sockets
-
* - `dom/media/webrtc/transportbridge <https://searchfox.org/firefox-main/source/dom/media/webrtc/transportbridge>`__
* - :searchfox:`dom/media/webrtc/transportbridge`
- WebRTC
- This contains the MediaPipeline and MediaPipeline filter code which is glue between transport and the libwebrtc RTP stack
-
* - `third_party/libsrtp <https://searchfox.org/firefox-main/source/third_party/libsrtp>`__
* - :searchfox:`third_party/libsrtp`
- Network
- This is the SRTP implementation used by Firefox
-
* - `third_party/libwebrtc <https://searchfox.org/firefox-main/source/third_party/libwebrtc>`__
* - :searchfox:`third_party/libwebrtc`
- WebRTC (various)
- libwebrtc handles many aspects of WebRTC calls above the transport layer and below the presentation layer
-
* - `third_party/rust/webrtc-sdp <https://searchfox.org/firefox-main/source/third_party/rust/webrtc-sdp>`__
* - :searchfox:`third_party/rust/webrtc-sdp`
- Signalling
- webrtc-sdp is a Rust implementation of a WebRTC-only SDP parser
-
* - `third_party/sipcc <https://searchfox.org/firefox-main/source/third_party/sipcc>`__
* - :searchfox:`third_party/sipcc`
- Signalling
- sipcc is a C implementation of a general SDP parser
- this carries many local modifications
* - `dom/media <https://searchfox.org/firefox-main/source/dom/media>`__
* - :searchfox:`dom/media`
- Media Capture
- GetUserMedia and related classes are here
- There are many other unrelated media source files here
* - `dom/media/systemservices <https://searchfox.org/firefox-main/source/dom/media/systemservices>`__
* - :searchfox:`dom/media/systemservices`
- Media Capture
- System services for media capture including camera/microphone access
- Contains CamerasChild, CamerasParent, VideoEngine, and platform-specific implementations
* - `dom/media/encoder <https://searchfox.org/firefox-main/source/dom/media/encoder>`__
* - :searchfox:`dom/media/encoder`
- Media Encoding
- Media encoders for recording, including Opus and VP8 track encoders
-
* - `dom/media/gmp <https://searchfox.org/firefox-main/source/dom/media/gmp>`__
* - :searchfox:`dom/media/gmp`
- Media Codecs
- Gecko Media Plugin (GMP) framework for sandboxed codec plugins
- Used by WebRTC for H.264 codec support
* - `dom/media/platforms <https://searchfox.org/firefox-main/source/dom/media/platforms>`__
* - :searchfox:`dom/media/platforms`
- Media Codecs
- Platform-specific encoder/decoder implementations (Apple, Android, FFmpeg, WMF)
- Contains PlatformEncoderModule and EncoderConfig used by WebRTC
* - `netwerk/sctp/datachannel <https://searchfox.org/firefox-main/source/netwerk/sctp/datachannel>`__
* - :searchfox:`netwerk/sctp/datachannel`
- Data Channels
- SCTP-based data channel implementation
-
* - `browser/components/webrtc <https://searchfox.org/firefox-main/source/browser/components/webrtc>`__
* - :searchfox:`browser/components/webrtc`
- Browser UI
- Browser-level WebRTC UI components including permission prompts and indicators
-
* - `toolkit/content/aboutwebrtc <https://searchfox.org/firefox-main/source/toolkit/content/aboutwebrtc>`__
* - :searchfox:`toolkit/content/aboutwebrtc`
- Debugging
- Implementation of the about:webrtc debugging page
-
* - `media/webrtc/signaling <https://searchfox.org/firefox-main/source/media/webrtc/signaling>`__
* - :searchfox:`media/webrtc/signaling`
- Signalling
- WebRTC signaling implementation and GTests
-
* - `browser/base/content/test/webrtc <https://searchfox.org/firefox-main/source/browser/base/content/test/webrtc>`__
* - :searchfox:`browser/base/content/test/webrtc`
- Tests
- Browser chrome tests for WebRTC getUserMedia and getDisplayMedia
-
* - `testing/web-platform/tests/webrtc <https://searchfox.org/firefox-main/source/testing/web-platform/tests/webrtc>`__
* - :searchfox:`testing/web-platform/tests/webrtc`
- Tests
- Web Platform Tests for WebRTC conformance
- Also includes webrtc-encoded-transform, webrtc-extensions, webrtc-ice, webrtc-identity, webrtc-priority, webrtc-stats, webrtc-svc
* - `dom/webidl <https://searchfox.org/firefox-main/source/dom/webidl>`__
* - :searchfox:`dom/webidl`
- WebIDL (JS API)
- This contains the WebIDL definitions for the WebRTC JS API amongst many other WebIDL definitions
- :code:`RTC*.webidl`
+1 -1
View File
@@ -22,7 +22,7 @@ Firefox source tree comes with its own set of recommendations of Visual Studio
Code extensions. They will be offered when you first open the project.
If you need to refer to them later, the extensions are listed in
`.vscode/extensions.json <https://searchfox.org/firefox-main/source/.vscode/extensions.json>`__.
:searchfox:`.vscode/extensions.json`.
For Rust development, the `rust-analyzer <https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer>`__ extension is recommended.
`See the manual <https://rust-analyzer.github.io/manual.html>`__ for more information.
+2 -2
View File
@@ -20,7 +20,7 @@ global variables are defined into the given object.
"chrome://browser/content/browser.js", this
);
See `mozIJSSubScriptLoader.idl <https://searchfox.org/firefox-main/source/js/xpconnect/idl/mozIJSSubScriptLoader.idl>`_ for more details
See :searchfox:`mozIJSSubScriptLoader.idl <js/xpconnect/idl/mozIJSSubScriptLoader.idl>` for more details
Asynchronous Classic Script Compile
-----------------------------------
@@ -41,7 +41,7 @@ classic script, and execute in given globals.
const result2 = script.executeInGlobal(targetGlobal2);
}
See `ChromeUtils.webidl <https://searchfox.org/firefox-main/source/dom/chrome-webidl/ChromeUtils.webidl>`_ and `PrecompiledScript.webidl <https://searchfox.org/firefox-main/source/dom/chrome-webidl/PrecompiledScript.webidl>`_ for more details.
See :searchfox:`ChromeUtils.webidl <dom/chrome-webidl/ChromeUtils.webidl>` and :searchfox:`PrecompiledScript.webidl <dom/chrome-webidl/PrecompiledScript.webidl>` for more details.
Synchronous Module Import
-------------------------
+5 -5
View File
@@ -16,7 +16,7 @@ modules.
All system modules are imported into the shared system global (except for
modules loaded into the `DevTools distinct system global`_).
See ``mozJSModuleLoader::CreateLoaderGlobal`` in `mozJSModuleLoader.cpp <https://searchfox.org/firefox-main/source/js/xpconnect/loader/mozJSModuleLoader.cpp>`_ for details about the global and built-in functions.
See ``mozJSModuleLoader::CreateLoaderGlobal`` in :searchfox:`mozJSModuleLoader.cpp <js/xpconnect/loader/mozJSModuleLoader.cpp>` for details about the global and built-in functions.
Defining a Module
-----------------
@@ -145,7 +145,7 @@ property with the symbol name and the module URI for each.
TestFunc: "resource://gre/modules/Test.sys.mjs",
});
See `ChromeUtils.webidl <https://searchfox.org/firefox-main/source/dom/chrome-webidl/ChromeUtils.webidl>`_ for more details.
See :searchfox:`ChromeUtils.webidl <dom/chrome-webidl/ChromeUtils.webidl>` for more details.
Using the Namespace Object
--------------------------
@@ -226,7 +226,7 @@ The exported object should follow the specified XPCOM interface.
nsCOMPtr<nsIUtils> utils = do_ImportESModule(
"resource://gre/modules/Test.sys.mjs", "Utils");
See `nsImportModule.h <https://searchfox.org/firefox-main/source/js/xpconnect/loader/nsImportModule.h>`_ for more details.
See :searchfox:`nsImportModule.h <js/xpconnect/loader/nsImportModule.h>` for more details.
Lifetime
--------
@@ -301,7 +301,7 @@ This is only for the debugging purpose.
console.log(
Cu.getModuleImportStack("resource://gre/modules/Test.sys.mjs"));
See `xpccomponents.idl <https://searchfox.org/firefox-main/source/js/xpconnect/idl/xpccomponents.idl>`_ for more details.
See :searchfox:`xpccomponents.idl <js/xpconnect/idl/xpccomponents.idl>` for more details.
Limitations
-----------
@@ -347,7 +347,7 @@ used. The module is imported into the DevTools distinct system global if the
current global is the DevTools distinct system global. Otherwise the module
is imported into the shared system global.
See ``ImportESModuleTargetGlobal`` in `ChromeUtils.webidl <https://searchfox.org/firefox-main/source/dom/chrome-webidl/ChromeUtils.webidl>`_ for more details.
See ``ImportESModuleTargetGlobal`` in :searchfox:`ChromeUtils.webidl <dom/chrome-webidl/ChromeUtils.webidl>` for more details.
Integration with JSActors
-------------------------
+1 -1
View File
@@ -20,7 +20,7 @@ Description
:ref:`PR_EXTERN` is used to define externally visible routines and globals.
For syntax details for each platform, see
`prtypes.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtypes.h>`__.
:searchfox:`prtypes.h <nsprpub/pr/include/prtypes.h>`.
The macro includes the proper specifications to declare the target
``extern`` and set up other required linkages.
+1 -1
View File
@@ -20,7 +20,7 @@ Description
:ref:`PR_IMPLEMENT` is used to define implementations of externally visible
routines and globals. For syntax details for each platform, see
`prtypes.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtypes.h>`__.
:searchfox:`prtypes.h <nsprpub/pr/include/prtypes.h>`.
.. warning::
+2 -2
View File
@@ -35,10 +35,10 @@ The structure has the following fields:
Size, in bytes, of file's contents.
``creationTime``
Creation time per definition of :ref:`PRTime`. See
`prtime.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtime.h>`__.
:searchfox:`prtime.h <nsprpub/pr/include/prtime.h>`.
``modifyTime``
Last modification time per definition of :ref:`PRTime`. See
`prtime.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtime.h>`__.
:searchfox:`prtime.h <nsprpub/pr/include/prtime.h>`.
Description
+2 -2
View File
@@ -33,10 +33,10 @@ The structure has the following fields:
64-bit size, in bytes, of file's contents.
``creationTime``
Creation time per definition of :ref:`PRTime`. See
`prtime.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtime.h>`__.
:searchfox:`prtime.h <nsprpub/pr/include/prtime.h>`.
``modifyTime``
Last modification time per definition of :ref:`PRTime`. See
`prtime.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtime.h>`__.
:searchfox:`prtime.h <nsprpub/pr/include/prtime.h>`.
Description
+1 -1
View File
@@ -19,4 +19,4 @@ Description
May be defined as an ``int`` or a ``long``, depending on the platform.
For syntax details for each platform, see
`prtypes.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtypes.h>`__.
:searchfox:`prtypes.h <nsprpub/pr/include/prtypes.h>`.
+1 -1
View File
@@ -19,4 +19,4 @@ Description
May be defined in several different ways, depending on the platform. For
syntax details for each platform, see
`prtypes.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtypes.h>`__.
:searchfox:`prtypes.h <nsprpub/pr/include/prtypes.h>`.
+1 -1
View File
@@ -19,4 +19,4 @@ Description
May be defined as an unsigned ``int`` or an unsigned ``long``, depending
on the platform. For syntax details for each platform, see
`prtypes.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtypes.h>`__.
:searchfox:`prtypes.h <nsprpub/pr/include/prtypes.h>`.
+1 -1
View File
@@ -19,4 +19,4 @@ Description
May be defined in several different ways, depending on the platform. For
syntax details for each platform, see
`prtypes.h <https://searchfox.org/firefox-main/source/nsprpub/pr/include/prtypes.h>`__.
:searchfox:`prtypes.h <nsprpub/pr/include/prtypes.h>`.
+5 -5
View File
@@ -211,10 +211,10 @@ Firefox captures the security context using one of the following four types of P
in Firefox Extensions.
Whenever Firefox starts to load a resource (e.g. script, css, image) then security relevant meta
information including `nsIPrincipal <https://searchfox.org/firefox-main/source/caps/nsIPrincipal.idl>`_
is attached to the `nsILoadInfo <https://searchfox.org/firefox-main/source/netwerk/base/nsILoadInfo.idl>`_.
information including :searchfox:`nsIPrincipal <caps/nsIPrincipal.idl>`
is attached to the :searchfox:`nsILoadInfo <netwerk/base/nsILoadInfo.idl>`.
This load context providing object remains attached to the resource load (
`nsIChannel <https://searchfox.org/firefox-main/source/netwerk/base/nsIChannel.idl>`_) throughout
:searchfox:`nsIChannel <netwerk/base/nsIChannel.idl>`) throughout
the entire loading life cycle of a resource and allows Firefox to provide the same security
guarantees even if the resource load encounters a server side redirect.
@@ -254,8 +254,8 @@ The ``about`` protocol allows for binding short human-readable urls to internal
displayed in the content area. For the most part each about page is simply a simpler name for
content in the chrome or resource protocols. For example the page ``about:processes`` simply loads
``chrome://global/content/aboutProcesses.html``. About pages are registered in the
`global <https://searchfox.org/firefox-main/source/docshell/base/nsAboutRedirector.cpp>`_ and
`desktop <https://searchfox.org/firefox-main/source/browser/components/about/AboutRedirector.cpp>`_
:searchfox:`global <docshell/base/nsAboutRedirector.cpp>` and
:searchfox:`desktop <browser/components/about/AboutRedirector.cpp>`
redirector components.
Toolkit
+1 -1
View File
@@ -44,7 +44,7 @@ archive of :ref:`Breakpad <Crash reporting>` symbol files:
Treeherder uses an additional ``uploadsymbols`` target to upload
symbols to a socorro server. See
https://searchfox.org/firefox-main/source/toolkit/crashreporter/tools/upload_symbols.py
:searchfox:`toolkit/crashreporter/tools/upload_symbols.py`
for more information about the environment variables used by this
target.
+1 -1
View File
@@ -149,7 +149,7 @@ Building, running, testing, etc. not always support the latest Python versions,
especially after updating your Python distribution to a new version.
The recommended way to work around this is to use a virtual environment with a compatible Python version.
Please consider `mach's <https://searchfox.org/firefox-main/source/mach>`_ ``MIN_PYTHON_VERSION`` and ``MAX_PYTHON_VERSION_TO_CONSIDER``
Please consider :searchfox:`mach's <mach>` ``MIN_PYTHON_VERSION`` and ``MAX_PYTHON_VERSION_TO_CONSIDER``
for the range of compatible versions.
Should you be using Python through Homebrew, you can install older releases like this:
+4 -6
View File
@@ -261,7 +261,7 @@ The outer window for the frame associated with this ``JSWindowActorChild``.
The ``nsIDocShell`` for the frame associated with this ``JSWindowActorChild``.
See `JSWindowActor.webidl`_ for more detail on exactly what is exposed on both ``JSWindowActorParent`` and ``JSWindowActorChild`` implementations.
See :searchfox:`JSWindowActor.webidl <dom/chrome-webidl/JSWindowActor.webidl>` for more detail on exactly what is exposed on both ``JSWindowActorParent`` and ``JSWindowActorChild`` implementations.
How to port from message manager and framescripts to JSWindowActors
-------------------------------------------------------------------
@@ -385,8 +385,8 @@ In the ``JS*ACTORS`` objects, each key is the name of the actor pair (example: `
The full list of registration parameters can be found:
- for JSProcessActor in file `JSProcessActor.webidl`_ as ``WindowActorOptions``, ``ProcessActorSidedOptions`` and ``ProcessActorChildOptions``.
- for JSWindowActor in file `JSWindowActor.webidl`_ as ``WindowActorOptions``, ``WindowActorSidedOptions`` and ``WindowActorChildOptions``.
- for JSProcessActor in file :searchfox:`JSProcessActor.webidl <dom/chrome-webidl/JSProcessActor.webidl>` as ``WindowActorOptions``, ``ProcessActorSidedOptions`` and ``ProcessActorChildOptions``.
- for JSWindowActor in file :searchfox:`JSWindowActor.webidl <dom/chrome-webidl/JSWindowActor.webidl>` as ``WindowActorOptions``, ``WindowActorSidedOptions`` and ``WindowActorChildOptions``.
Here's an example ``JSWindowActor`` registration pulled from ``BrowserGlue.sys.mjs``:
@@ -540,7 +540,5 @@ And more
.. _Electrolysis Project: https://wiki.mozilla.org/Electrolysis
.. _IPC Actors: https://developer.mozilla.org/en-US/docs/Mozilla/IPDL/Tutorial
.. _Context Menu Fission Port: https://hg.mozilla.org/mozilla-central/rev/adc60720b7b8
.. _JSProcessActor.webidl: https://searchfox.org/firefox-main/source/dom/chrome-webidl/JSProcessActor.webidl
.. _JSWindowActor.webidl: https://searchfox.org/firefox-main/source/dom/chrome-webidl/JSWindowActor.webidl
.. _BrowserElementParent.sys.mjs: https://searchfox.org/firefox-main/source/toolkit/actors/BrowserElementParent.sys.mjs
.. _BrowserElementParent.sys.mjs: :searchfox:`toolkit/actors/BrowserElementParent.sys.mjs`
.. _Transferable: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Transferable_objects
+9 -9
View File
@@ -1,7 +1,7 @@
Process Model
=============
The complete set of recognized process types is defined in `GeckoProcessTypes <https://searchfox.org/firefox-main/source/xpcom/geckoprocesstypes_generator/geckoprocesstypes/__init__.py>`_.
The complete set of recognized process types is defined in :searchfox:`GeckoProcessTypes <xpcom/geckoprocesstypes_generator/geckoprocesstypes/__init__.py>`.
For more details on how process types are added and managed by IPC, see the process creation documentation :ref:`Gecko Processes`.
@@ -94,13 +94,13 @@ As the parent process can display HTML and JS, such as the browser UI and privil
Content Process
---------------
:primary protocol: `PContent <https://searchfox.org/firefox-main/source/dom/ipc/PContent.ipdl>`_
:primary protocol: :searchfox:`PContent <dom/ipc/PContent.ipdl>`
:other names: Renderer Process
:sandboxed?: yes (content sandbox policy)
Content processes are used to load web content, and are the only process type (other than the parent process) which can load and execute JS code. These processes are further subdivided into specific "remote types", which specify the type of content loaded within them, their sandboxing behavior, and can gate access to certain privileged IPC methods.
The specific remote type and isolation behaviour used for a specific resource is currently controlled in 2 major places. When performing a document navigation, the final process to load the document in is selected by the logic in `ProcessIsolation.cpp <https://searchfox.org/firefox-main/source/dom/ipc/ProcessIsolation.cpp>`_. This will combine information about the specific response, such as the site and headers, with other state to select which process and other isolating actions should be taken. When selecting which process to create the initial process for a new tab in, and when selecting processes for serviceworkers and shared workers, the logic in :searchfox:`E10SUtils.sys.mjs <toolkit/modules/E10SUtils.sys.mjs>` is used to select a process. The logic in ``E10SUtils.sys.mjs`` will likely be removed and replaced with ``ProcessIsolation.cpp`` in the future.
The specific remote type and isolation behaviour used for a specific resource is currently controlled in 2 major places. When performing a document navigation, the final process to load the document in is selected by the logic in :searchfox:`ProcessIsolation.cpp <dom/ipc/ProcessIsolation.cpp>`. This will combine information about the specific response, such as the site and headers, with other state to select which process and other isolating actions should be taken. When selecting which process to create the initial process for a new tab in, and when selecting processes for serviceworkers and shared workers, the logic in :searchfox:`E10SUtils.sys.mjs <toolkit/modules/E10SUtils.sys.mjs>` is used to select a process. The logic in ``E10SUtils.sys.mjs`` will likely be removed and replaced with ``ProcessIsolation.cpp`` in the future.
.. note::
@@ -232,7 +232,7 @@ ServiceWorker web content processes are used to host ServiceWorkers on a per-sit
Gecko Media Plugins (GMP) Process
---------------------------------
:primary protocol: `PGMP <https://searchfox.org/firefox-main/source/dom/media/gmp/PGMP.ipdl>`_
:primary protocol: :searchfox:`PGMP <dom/media/gmp/PGMP.ipdl>`
:sandboxed?: yes (GMP sandbox policy)
The GMP process is used to sandbox third-party "Content Decryption Module" (CDM) binaries used for media playback in a sandboxed environment. This process is only launched when DRM-enabled content is loaded.
@@ -242,7 +242,7 @@ The GMP process is used to sandbox third-party "Content Decryption Module" (CDM)
GPU Process
-----------
:primary protocol: `PGPU <https://searchfox.org/firefox-main/source/gfx/ipc/PGPU.ipdl>`_
:primary protocol: :searchfox:`PGPU <gfx/ipc/PGPU.ipdl>`
:other names: Compositor Process
:sandboxed?: no (`bug 1347710 <https://bugzilla.mozilla.org/show_bug.cgi?id=1347710>`_ tracks sandboxing on windows)
@@ -255,7 +255,7 @@ The GPU process is not used on all platforms. Platforms which do not use it, suc
VR Process
----------
:primary protocol: `PVR <https://searchfox.org/firefox-main/source/gfx/vr/ipc/PVR.ipdl>`_
:primary protocol: :searchfox:`PVR <gfx/vr/ipc/PVR.ipdl>`
:sandboxed?: no (`bug 1430043 <https://bugzilla.mozilla.org/show_bug.cgi?id=1430043>`_ tracks sandboxing on windows)
VR headset libraries require access to specific OS level features and other requirements which we would generally like to block with the sandbox in other processes. In order to allow the GPU process to have tighter sandboxing rules, these VR libraries are loaded into the less-restricted VR process. Like the GPU process, this serves to isolate them from the rest of Firefox and reduce the impact of bugs in these libraries on the rest of the browser. The VR process is launched only after a user visits a site which uses WebVR.
@@ -265,7 +265,7 @@ VR headset libraries require access to specific OS level features and other requ
Data Decoder (RDD) Process
--------------------------
:primary protocol: `PRDD <https://searchfox.org/firefox-main/source/dom/media/ipc/PRDD.ipdl>`_
:primary protocol: :searchfox:`PRDD <dom/media/ipc/PRDD.ipdl>`
:sandboxed?: yes (RDD sandbox policy)
This process is used to run media data decoders within their own sandboxed process, allowing the code to be isolated from other code in Gecko. This aims to reduce the severity of potential bugs in media decoder libraries, and improve the security of the browser.
@@ -285,7 +285,7 @@ This process is used to run media data decoders within their own sandboxed proce
Network (Socket) Process
------------------------
:primary protocol: `PSocketProcess <https://searchfox.org/firefox-main/source/netwerk/ipc/PSocketProcess.ipdl>`_
:primary protocol: :searchfox:`PSocketProcess <netwerk/ipc/PSocketProcess.ipdl>`
:sandboxed?: yes (socket sandbox policy)
The socket process is used to separate certain networking operations from the parent process, allowing them to be performed more directly in a partially sandboxed process. The eventual goal is to move all TCP/UDP network operations into this dedicated process, and is being tracked in `Bug 1322426 <https://bugzilla.mozilla.org/show_bug.cgi?id=1322426>`_.
@@ -327,7 +327,7 @@ This test-only process type is intended for use when writing IPDL unit tests. Ho
Utility Process
---------------
:primary protocol: `PUtilityProcess <https://searchfox.org/firefox-main/source/ipc/glue/PUtilityProcess.ipdl>`_
:primary protocol: :searchfox:`PUtilityProcess <ipc/glue/PUtilityProcess.ipdl>`
:metabug: `Bug 1722051 <https://bugzilla.mozilla.org/show_bug.cgi?id=1722051>`_
:sandboxed?: yes, customizable
+10 -10
View File
@@ -77,8 +77,8 @@ API Documentation
.. hlist::
:columns: 3
* `header (searchfox) <https://searchfox.org/firefox-main/source/docshell/base/BrowsingContext.h>`__
* `source (searchfox) <https://searchfox.org/firefox-main/source/docshell/base/BrowsingContext.cpp>`__
* :searchfox:`header (searchfox) <docshell/base/BrowsingContext.h>`
* :searchfox:`source (searchfox) <docshell/base/BrowsingContext.cpp>`
* `html spec <https://html.spec.whatwg.org/multipage/browsers.html#browsing-context>`_
This is a synced-context type. Instances of it will exist in every
@@ -115,8 +115,8 @@ API Documentation
.. hlist::
:columns: 3
* `header (searchfox) <https://searchfox.org/firefox-main/source/docshell/base/CanonicalBrowsingContext.h>`__
* `source (searchfox) <https://searchfox.org/firefox-main/source/docshell/base/CanonicalBrowsingContext.cpp>`__
* :searchfox:`header (searchfox) <docshell/base/CanonicalBrowsingContext.h>`
* :searchfox:`source (searchfox) <docshell/base/CanonicalBrowsingContext.cpp>`
When a :cpp:class:`BrowsingContext` is constructed in the parent process,
it is actually an instance of :cpp:class:`CanonicalBrowsingContext`.
@@ -129,21 +129,21 @@ API Documentation
.. hlist::
:columns: 3
* `header (searchfox) <https://searchfox.org/firefox-main/source/docshell/base/WindowContext.h>`__
* `source (searchfox) <https://searchfox.org/firefox-main/source/docshell/base/WindowContext.cpp>`__
* :searchfox:`header (searchfox) <docshell/base/WindowContext.h>`
* :searchfox:`source (searchfox) <docshell/base/WindowContext.cpp>`
.. cpp:class:: WindowGlobalParent : public WindowContext, public WindowGlobalActor, public PWindowGlobalParent
.. hlist::
:columns: 3
* `header (searchfox) <https://searchfox.org/firefox-main/source/dom/ipc/WindowGlobalParent.h>`__
* `source (searchfox) <https://searchfox.org/firefox-main/source/dom/ipc/WindowGlobalParent.cpp>`__
* :searchfox:`header (searchfox) <dom/ipc/WindowGlobalParent.h>`
* :searchfox:`source (searchfox) <dom/ipc/WindowGlobalParent.cpp>`
.. cpp:class:: WindowGlobalChild : public WindowGlobalActor, public PWindowGlobalChild
.. hlist::
:columns: 3
* `header (searchfox) <https://searchfox.org/firefox-main/source/dom/ipc/WindowGlobalChild.h>`__
* `source (searchfox) <https://searchfox.org/firefox-main/source/dom/ipc/WindowGlobalChild.cpp>`__
* :searchfox:`header (searchfox) <dom/ipc/WindowGlobalChild.h>`
* :searchfox:`source (searchfox) <dom/ipc/WindowGlobalChild.cpp>`
+1 -1
View File
@@ -199,7 +199,7 @@ In function signatures, prefer accepting or returning ``RefPtr`` instead of
``already_AddRefed`` in conjunction with regular ``std::move`` rather than
``.forget()``. This improves readability and code generation. Prevailing
legimitate uses of ``already_AddRefed`` are described in its
`documentation <https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/mfbt/AlreadyAddRefed.h#31>`_.
:searchfox:`documentation <mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36:mfbt/AlreadyAddRefed.h#31>`.
Prefer using ``mozilla::UniquePtr`` over ``nsAutoPtr``, since the latter is
deprecated (and e.g. has no factory function, see Bug 1600079).
@@ -4,8 +4,7 @@ Service Worker Performance Tests
Our performance tests are mochitests running in the `mozperftest
<https://firefox-source-docs.mozilla.org/testing/perfdocs/mozperftest.html>`_
harness. Tests reside under `dom/serviceworkers/test/performance
<https://searchfox.org/firefox-main/source/dom/serviceworkers/test/performance>`_,
harness. Tests reside under :searchfox:`dom/serviceworkers/test/performance`,
itemized in perftest.toml. Beyond the standard mochitest machinery,
performance tests define a ``perfMetadata`` variable at the top level, and call:
@@ -23,18 +22,14 @@ They can be run via mach perftest, or as normal mochitests via mach test.
Adding new tests
================
Add files to `perftest.toml
<https://searchfox.org/firefox-main/source/dom/serviceworkers/test/performance/perftest.toml>`_
Add files to :searchfox:`perftest.toml <dom/serviceworkers/test/performance/perftest.toml>`
as usual for mochitests.
Modify linux.yml, macosx.yml, and windows11.yml under `taskcluster/kinds/perftest
<https://searchfox.org/firefox-main/source/taskcluster/kinds/perftest>`_.
Currently, each test needs to be added individually to the run command (`here
<https://searchfox.org/mozilla-central/rev/91cc8848427fdbbeb324e6ca56a0d08d32d3c308/taskcluster/ci/perftest/linux.yml#121-149>`_,
Modify linux.yml, macosx.yml, and windows11.yml under :searchfox:`taskcluster/kinds/perftest`.
Currently, each test needs to be added individually to the run command (:searchfox:`here <mozilla-central/rev/91cc8848427fdbbeb324e6ca56a0d08d32d3c308:taskcluster/ci/perftest/linux.yml#121-149>`,
for example). kind.yml can be ignoredit provides some defaults.
Add your new test to `perfdocs/config.yml
<https://searchfox.org/firefox-main/source/python/mozperftest/perfdocs/config.yml>`_.
Add your new test to :searchfox:`perfdocs/config.yml <python/mozperftest/perfdocs/config.yml>`.
Modify the generated documentation using:
+51 -45
View File
@@ -82,31 +82,40 @@ selections from ``mozilla::TextRangeType`` which are sent by
``mozilla::WidgetCompositionEvent`` as ``mozilla::TextRangeArray``. The
following table explains the mapping between them.
.. table:: Selection types of each clause of composition string or caret
.. list-table:: Selection types of each clause of composition string or caret
:header-rows: 1
:widths: auto
+------------------------------------------------------------+---------------------------------------+-------------------------+-------------------------+
| |`nsISelectionController`_ |`mozilla::SelectionType`_|`mozilla::TextRangeType`_|
+============================================================+=======================================+=========================+=========================+
|Caret |``SELECTION_NORMAL`` |``eNormal`` |``eCaret`` |
+------------------------------------------------------------+---------------------------------------+-------------------------+-------------------------+
|Raw text typed by the user |``SELECTION_IME_RAW_INPUT`` |``eIMERawClause`` |``eRawClause`` |
+------------------------------------------------------------+---------------------------------------+-------------------------+-------------------------+
|Selected clause of raw text typed by the user |``SELECTION_IME_SELECTEDRAWTEXT`` |``eIMESelectedRawClause``|``eSelectedRawClause`` |
+------------------------------------------------------------+---------------------------------------+-------------------------+-------------------------+
|Converted clause by IME |``SELECTION_IME_CONVERTEDTEXT`` |``eIMEConvertedClause`` |``eConvertedClause`` |
+------------------------------------------------------------+---------------------------------------+-------------------------+-------------------------+
|Selected clause by the user or IME and also converted by IME|``SELECTION_IME_SELECTEDCONVERTEDTEXT``|``eIMESelectedClause`` |``eSelectedClause`` |
+------------------------------------------------------------+---------------------------------------+-------------------------+-------------------------+
* -
- :searchfox:`nsISelectionController <dom/base/nsISelectionController.idl>`
- :searchfox:`mozilla::SelectionType <dom/base/nsISelectionController.idl>`
- :searchfox:`mozilla::TextRangeType <widget/TextRange.h>`
* - Caret
- ``SELECTION_NORMAL``
- ``eNormal``
- ``eCaret``
* - Raw text typed by the user
- ``SELECTION_IME_RAW_INPUT``
- ``eIMERawClause``
- ``eRawClause``
* - Selected clause of raw text typed by the user
- ``SELECTION_IME_SELECTEDRAWTEXT``
- ``eIMESelectedRawClause``
- ``eSelectedRawClause``
* - Converted clause by IME
- ``SELECTION_IME_CONVERTEDTEXT``
- ``eIMEConvertedClause``
- ``eConvertedClause``
* - Selected clause by the user or IME and also converted by IME
- ``SELECTION_IME_SELECTEDCONVERTEDTEXT``
- ``eIMESelectedClause``
- ``eSelectedClause``
Note that typically, "Selected clause of raw text typed by the user" isn't used
because when composition string is already separated to multiple clauses, that
means that the composition string has already been converted by IME at least
once.
.. _nsISelectionController: https://searchfox.org/firefox-main/source/dom/base/nsISelectionController.idl
.. _mozilla::SelectionType: https://searchfox.org/firefox-main/source/dom/base/nsISelectionController.idl
.. _mozilla::TextRangeType: https://searchfox.org/firefox-main/source/widget/TextRange.h
Modules handling IME composition
================================
@@ -277,12 +286,12 @@ composition to IME is perefored synchronously. See
editor/libeditor
----------------
`mozilla::EditorEventListener <https://searchfox.org/firefox-main/source/editor/libeditor/EditorEventListener.cpp>`__
:searchfox:`mozilla::EditorEventListener <editor/libeditor/EditorEventListener.cpp>`
listens for trusted DOM ``compositionstart``, ``text`` and ``compositionend``
events and notifies
`mozilla::EditorBase <https://searchfox.org/firefox-main/source/editor/libeditor/EditorBase.cpp>`__
:searchfox:`mozilla::EditorBase <editor/libeditor/EditorBase.cpp>`
and
`mozilla::TextEditor <https://searchfox.org/firefox-main/source/editor/libeditor/TextEditor.cpp>`__
:searchfox:`mozilla::TextEditor <editor/libeditor/TextEditor.cpp>`
of the events.
When ``EditorBase`` receives an ``eCompositionStart``
@@ -291,7 +300,7 @@ instance and stores it.
When ``TextEditor`` receives an ``eCompositionChange`` (DOM ``"text"``) event,
it creates or modifies a text node which includes the composition string and
`mozilla::CompositionTransaction <https://searchfox.org/firefox-main/source/editor/libeditor/CompositionTransaction.cpp>`__
:searchfox:`mozilla::CompositionTransaction <editor/libeditor/CompositionTransaction.cpp>`
(it was called ``IMETextTxn``) sets IME selections for representing the clauses
of the composition string.
@@ -413,7 +422,7 @@ mozilla::ContentCacheInChild
----------------------------
This exists only in remote processes. This is created as a member of
`PuppetWidget <https://searchfox.org/firefox-main/source/widget/PuppetWidget.cpp>`__.
:searchfox:`PuppetWidget <widget/PuppetWidget.cpp>`.
When ``PuppetWidget`` receives notifications to IME from ``IMEContentObserver``
in the remote process, it makes this class modify its cached content. Then,
this class do that with ``WidgetQueryContentEvents``. Finally, ``PuppetWidget``
@@ -488,7 +497,7 @@ Style of each clause
--------------------
The style of each IME selection is managed by
`LookAndFeel <https://searchfox.org/firefox-main/source/widget/LookAndFeel.h>`__
:searchfox:`LookAndFeel <widget/LookAndFeel.h>`
class per platform. Therefore, it can be overridden by prefs.
Background color, foreground color (text color) and underline color can be
@@ -510,7 +519,7 @@ specified with following prefs. The values must be string of "#rrggbb" format.
Underline style can be specified with the following prefs. The values are
integer, 0: none, 1: dotted, 2: dashed, 3: solid, 4: double, 5: wavy (The
values same as ``mozilla::StyleTextDecorationStyle`` defined in
`nsStyleConsts.h <https://searchfox.org/firefox-main/source/layout/style/nsStyleConsts.h>`__).
:searchfox:`nsStyleConsts.h <layout/style/nsStyleConsts.h>`).
* ``ui.IMERawInputUnderlineStyle``
* ``ui.IMESelectedRawTextUnderlineStyle``
@@ -524,7 +533,7 @@ normal width, 200 means double width.
On some platforms, IME may support its own style for each clause. Currently,
this feature is supported in TSF mode of Windows and on Linux. The style
information is stored in ``TextRangeStyle`` which is defined in
`TextRange.h <https://searchfox.org/firefox-main/source/widget/TextRange.h>`__.
:searchfox:`TextRange.h <widget/TextRange.h>`.
It's a member of ``TextRange``. ``TextRange`` is stored in ``mRanges`` of
``WidgetCompositionEvent`` only when its message is ``eCompositionChange``.
@@ -707,7 +716,7 @@ focused editor, this is sent to widget. But this is sent only when result of
``nsIWidget::GetIMEUpdatePreference()`` includes
``NOTIFY_MOUSE_BUTTON_EVENT_ON_CHAR``. This is sent with various information.
See ``IMENotification::mMouseButtonEventData`` in
`IMEData.h <https://searchfox.org/firefox-main/source/widget/IMEData.h>`__
:searchfox:`IMEData.h <widget/IMEData.h>`
for the detail.
If native IME supports mouse button event handling, ``widget`` should notify
@@ -842,7 +851,7 @@ of the new focused node (calls ``IMEStateManager::OnChangeFocus()``).
returns the result.
Next, ``IMEStateManager`` initializes ``InputContext`` (defined in
`IMEData.h <https://searchfox.org/firefox-main/source/widget/IMEData.h>`__)
:searchfox:`IMEData.h <widget/IMEData.h>`)
with the desired IME state and node information. Then, it calls
``nsIWidget::SetInputContext()`` with the ``InputContext``.
@@ -917,26 +926,26 @@ How does Gecko disable IME in IMM mode on Windows
Every window on Windows is associated an ``IMContext``. When Gecko disables
IME,
`mozilla::widget::IMEHandler <https://searchfox.org/firefox-main/source/widget/windows/WinIMEHandler.cpp>`__::SetInputContext()
:searchfox:`mozilla::widget::IMEHandler <widget/windows/WinIMEHandler.cpp>`::SetInputContext()
disassociates the context from the window.
How does Gecko disable IME in TSF mode on Windows
"""""""""""""""""""""""""""""""""""""""""""""""""
`mozilla::widget::TSFTextStore <https://searchfox.org/firefox-main/source/widget/windows/TSFTextStore.cpp>`__
:searchfox:`mozilla::widget::TSFTextStore <widget/windows/TSFTextStore.cpp>`
sets focus to a dummy context which disables the keyboard.
How does Gecko disable IME on Mac
"""""""""""""""""""""""""""""""""
`mozilla::widget::TextInputHandler <https://searchfox.org/firefox-main/source/widget/cocoa/TextInputHandler.mm>`__::HandleKeyDownEvent()
:searchfox:`mozilla::widget::TextInputHandler <widget/cocoa/TextInputHandler.mm>`::HandleKeyDownEvent()
doesn't call focused view's interpretKeyEvents. This prevents native key events
to be passed to IME.
How does Gecko disable IME on GTK
"""""""""""""""""""""""""""""""""
`mozilla::widget::IMContextWrapper <https://searchfox.org/firefox-main/source/widget/gtk/IMContextWrapper.cpp>`__
:searchfox:`mozilla::widget::IMContextWrapper <widget/gtk/IMContextWrapper.cpp>`
sets focus to a dummy context which doesn't have IME composition.
How does Gecko disable IME on Android
@@ -982,17 +991,16 @@ Following classes handles IME on each platform:
Windows
-------
`mozilla::widget::IMEHandler`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:searchfox:`mozilla::widget::IMEHandler <widget/windows/WinIMEHandler.cpp>`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This class manages input method context of each window and makes ``IMMHandler``
or ``TSFTextStore`` work with active IME and focused editor. This class has
only static members, i.e., never created its instance.
__ https://searchfox.org/firefox-main/source/widget/windows/WinIMEHandler.cpp
`mozilla::widget::IMMHandler`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:searchfox:`mozilla::widget::IMMHandler <widget/windows/IMMHandler.cpp>`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This class is used when TSF mode is disabled by pref (``"intl.tsf.enabled"``
since 108, formerly named ``"intl.tsf.enable"``) or active IME is for IMM
@@ -1004,10 +1012,9 @@ Typically, a process creates windows with default IM context. Therefore, this
design is enough (ideally, an instance should be created per IM context,
though). The singleton instance is created when it becomes necessary.
__ https://searchfox.org/firefox-main/source/widget/windows/IMMHandler.cpp
`mozilla::widget::TSFTextStore`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:searchfox:`mozilla::widget::TSFTextStore <widget/windows/TSFTextStore.cpp>`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This class handles IME events in TSF mode and when TIP (IME implemented with
TSF) is active. This instances are created when an editable element gets focus
@@ -1062,30 +1069,29 @@ position's character rect (for a popup to indicate current input mode or next
word suggestion list) or first character rect of the target clause of current
composition (for a candidate list window of conversion).
__ https://searchfox.org/firefox-main/source/widget/windows/TSFTextStore.cpp
Mac
---
Both IME and key events are handled in
`TextInputHandler.mm <https://searchfox.org/firefox-main/source/widget/cocoa/TextInputHandler.mm>`__.
:searchfox:`TextInputHandler.mm <widget/cocoa/TextInputHandler.mm>`.
``mozilla::widget::TextInputHandlerBase`` is the most base class.
``mozilla::widget::IMEInputHandler`` inherits ``TextInputHandlerBase`` and
handles IME related events. ``mozilla::widget::TextInputHandler`` inherits
``TextInputHandlerBase`` and implements ``NSTextInput`` protocol of Cocoa. Its
instance is created per
`nsChildView <https://searchfox.org/firefox-main/source/widget/cocoa/nsChildView.mm>`__
:searchfox:`nsChildView <widget/cocoa/nsChildView.mm>`
instance.
GTK
---
`mozilla::widget::IMContextWrapper <https://searchfox.org/firefox-main/source/widget/gtk/IMContextWrapper.cpp>`__
:searchfox:`mozilla::widget::IMContextWrapper <widget/gtk/IMContextWrapper.cpp>`
handles IME. The instance is created per top level window.
Android
-------
`org.mozilla.geckoview.GeckoEditable <https://searchfox.org/firefox-main/source/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java>`__ handles native IME events and `mozilla::widget::GeckoEditableSupport <https://searchfox.org/firefox-main/source/widget/android/GeckoEditableSupport.cpp>`__
:searchfox:`org.mozilla.geckoview.GeckoEditable <mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoEditable.java>` handles native IME events and :searchfox:`mozilla::widget::GeckoEditableSupport <widget/android/GeckoEditableSupport.cpp>`
dispatches ``Widget*Event``.
+3 -6
View File
@@ -13,16 +13,14 @@ a permission consists of the following:
``0`` (“Undefined”), ``1`` (“Allow”), ``2`` (“Deny”) or ``3`` (“Prompt the user”).
For storing arbitrary preferences per origin instead of just permission values,
the `content pref service
<https://searchfox.org/firefox-main/source/dom/interfaces/base/nsIContentPrefService2.idl>`__
the :searchfox:`content pref service <dom/interfaces/base/nsIContentPrefService2.idl>`
offers a good alternative to the permission manager.
The permission manager also supports :doc:`browser-scoped (per-tab) temporary
permissions <browser-scoped>` that are not stored to disk and are automatically
cleared when their tab is closed.
The `site permission manager
<https://searchfox.org/firefox-main/source/browser/modules/SitePermissions.sys.mjs>`__
The :searchfox:`site permission manager <browser/modules/SitePermissions.sys.mjs>`
builds on top of both regular and browser-scoped permissions, and makes user
interfaces easier.
@@ -34,8 +32,7 @@ interface. This interface is available through the
``@mozilla.org/permissionmanager;1`` service, or through the quick
``Services.perms`` getter in JavaScript. Below is a list of the most common
methods, and examples on how to use them with JavaScript. For a full list of
signatures, see `nsIPermissionManager.idl
<https://searchfox.org/firefox-main/source/netwerk/base/nsIPermissionManager.idl>`__.
signatures, see :searchfox:`nsIPermissionManager.idl <netwerk/base/nsIPermissionManager.idl>`.
``testExactPermissionFromPrincipal``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+1 -2
View File
@@ -14,8 +14,7 @@ HTTPS-First exceptions to be set through remote settings if a site is known to
be broken with HTTPS-First. A bad example of remote permission would be using
them to set permissions of the type ``uitour``. Permissions of that type grant
sites access to a set of special APIs. These kinds of permissions should be set
directly in source at `browser/app/permissions
<https://searchfox.org/firefox-main/source/browser/app/permissions>`__.
directly in source at :searchfox:`browser/app/permissions`.
To limit the types of permissions that are allowed to be set through remote
settings, the permission types that are allowed to be set through remote
+7 -13
View File
@@ -785,7 +785,7 @@ Mochitest
~~~~~~~~~
The APZ specific mochitests are useful when specific gestures or events need to be tested
with specific content. The APZ mochitests are located in `gfx/layers/apz/test/mochitest`_.
with specific content. The APZ mochitests are located in :searchfox:`gfx/layers/apz/test/mochitest`.
To run all of the APZ mochitests, run something like the following:
::
@@ -793,11 +793,11 @@ To run all of the APZ mochitests, run something like the following:
./mach mochitest ./gfx/layers/apz/test/mochitest
The APZ mochitests are often organized as subtests that run in a group. For example,
the `test_group_hittest-2.html`_ contains >20 subtests like
`helper_hittest_overscroll.html`_. When working on a specific subtest, it is often
the :searchfox:`test_group_hittest-2.html <gfx/layers/apz/test/mochitest/test_group_hittest-2.html>` contains >20 subtests like
:searchfox:`helper_hittest_overscroll.html <gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html>`. When working on a specific subtest, it is often
helpful to use the `apz.subtest` preference to filter the subtests run to just the
tests you are working on. For example, the following would only run the
`helper_hittest_overscroll.html`_ subtest of the `test_group_hittest-2.html`_ group.
:searchfox:`helper_hittest_overscroll.html <gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html>` subtest of the :searchfox:`test_group_hittest-2.html <gfx/layers/apz/test/mochitest/test_group_hittest-2.html>` group.
::
@@ -806,15 +806,12 @@ tests you are working on. For example, the following would only run the
For more information on mochitest, see the `Mochitest Documentation`_.
.. _gfx/layers/apz/test/mochitest: https://searchfox.org/firefox-main/source/gfx/layers/apz/test/mochitest
.. _test_group_hittest-2.html: https://searchfox.org/firefox-main/source/gfx/layers/apz/test/mochitest/test_group_hittest-2.html
.. _helper_hittest_overscroll.html: https://searchfox.org/firefox-main/source/gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html
.. _Mochitest Documentation: /testing/mochitest-plain/index.html
GTest
~~~~~
The APZ specific GTests can be found in `gfx/layers/apz/test/gtest/`_. To run
The APZ specific GTests can be found in :searchfox:`gfx/layers/apz/test/gtest/`. To run
these tests, run something like the following:
::
@@ -824,13 +821,12 @@ these tests, run something like the following:
For more information, see the `GTest Documentation`_.
.. _GTest Documentation: /gtest/index.html
.. _gfx/layers/apz/test/gtest/: https://searchfox.org/firefox-main/source/gfx/layers/apz/test/gtest/
Reftests
~~~~~~~~
The APZ reftests can be found in `layout/reftests/async-scrolling/`_ and
`gfx/layers/apz/test/reftest`_. To run the relevant reftests for APZ, run
The APZ reftests can be found in :searchfox:`layout/reftests/async-scrolling/` and
:searchfox:`gfx/layers/apz/test/reftest <gfx/layers/apz/test/reftest/>`. To run the relevant reftests for APZ, run
a large portion of the APZ reftests, run something like the following:
::
@@ -843,8 +839,6 @@ There is no defined process for choosing which directory the APZ reftests
should be placed in, but in general reftests should exist where other
similar tests do.
.. _layout/reftests/async-scrolling/: https://searchfox.org/firefox-main/source/layout/reftests/async-scrolling/
.. _gfx/layers/apz/test/reftest: https://searchfox.org/firefox-main/source/gfx/layers/apz/test/reftest/
.. _Reftest Documentation: /layout/Reftest.html
Threading / Locking Overview
+1 -1
View File
@@ -137,7 +137,7 @@ Updating ICU will also update the language tag registry (which records language
Often a local patch wont apply, or new patches must be applied to successfully build. In this case youll have to manually edit ``update-icu.sh`` to abort after only *some* patches have been applied, make whatever changes are necessary by hand, generate a new/updated patch file by hand, then carefully reattempt updating. (The people who have updated ICU in the past, usually jwalden and anba, follow this awkward process and dont have good ideas on how to improve it.)
Any time ICU is updated, youll need to fully rebuild whichever of SpiderMonkey or Gecko youre building. For SpiderMonkey, delete your object directory and reconfigure from scratch. For Gecko, change the message in the top-level `CLOBBER <https://searchfox.org/firefox-main/source/CLOBBER>`__ file.
Any time ICU is updated, youll need to fully rebuild whichever of SpiderMonkey or Gecko youre building. For SpiderMonkey, delete your object directory and reconfigure from scratch. For Gecko, change the message in the top-level :searchfox:`CLOBBER` file.
Updating tzdata
~~~~~~~~~~~~~~~
+10 -20
View File
@@ -97,7 +97,7 @@ that represents the child. The generated files are then automatically included
in the C++ build process. The generated classes contain public methods for
sending the protocol messages, which client code will use as the entry-point to
IPC communication. The generated methods are built atop our IPC framework,
defined in `/ipc <https://searchfox.org/firefox-main/source/ipc>`_, that
defined in :searchfox:`/ipc <ipc>`, that
standardizes the safe and secure use of sockets, pipes, shared memory, etc on
all supported platforms. See `Using The IPDL compiler`_ for more on
integration with the build process.
@@ -107,10 +107,8 @@ to add handlers for the tasks generated to respond to each message. It must
also add routines (``ParamTraits``) that define serialization and
deserialization for any types used in the payload of a message that aren't
already known to the IPDL system. Primitive types, and a bunch of Mozilla
types, have predefined ``ParamTraits`` (`here
<https://searchfox.org/firefox-main/source/ipc/glue/IPCMessageUtils.h>`__
and `here
<https://searchfox.org/firefox-main/source/ipc/glue/IPCMessageUtilsSpecializations.h>`__).
types, have predefined ``ParamTraits`` (:searchfox:`here <ipc/glue/IPCMessageUtils.h>`
and :searchfox:`here <ipc/glue/IPCMessageUtilsSpecializations.h>`).
.. note::
Among other things, client code that uses the generated code must include
@@ -588,7 +586,7 @@ can be any type that has a C++ ``ParamTraits`` specialization and is imported
by a directive. That said, there are some surprises in the list of messages:
================= =============================================================
``int32_t``,... The standard primitive types are included. See `builtin.py`_
``int32_t``,... The standard primitive types are included. See :searchfox:`builtin.py <ipc/ipdl/ipdl/builtin.py>`
for a list. Pointer types are, unsurprisingly, forbidden.
``?`` When following a type T, the parameter is translated into
``Maybe<T>`` in C++.
@@ -606,8 +604,6 @@ discussed in the next chapter; messages in particular are covered in `Actors
and Messages in C++`_. For suggestions on best practices when designing your
IPDL actor approach, see `IPDL Best Practices`_.
.. _builtin.py: https://searchfox.org/firefox-main/source/ipc/ipdl/ipdl/builtin.py
IPDL Syntax Quick Reference
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -798,12 +794,9 @@ Most basic types and many essential Mozilla types are always available for use
without inclusion. An incomplete list includes: C++ primitives, strings
(``std`` and ``mozilla``), vectors (``std`` and ``mozilla``), ``RefPtr<T>``
(for serializable ``T``), ``UniquePtr<T>``, ``nsCOMPtr<T>``, ``nsTArray<T>``,
``std::unordered_map<T>``, ``nsresult``, etc. See `builtin.py
<https://searchfox.org/firefox-main/source/ipc/ipdl/ipdl/builtin.py>`_,
`ipc_message_utils.h
<https://searchfox.org/firefox-main/source/ipc/chromium/src/chrome/common/ipc_message_utils.h>`_
and `IPCMessageUtilsSpecializations.h
<https://searchfox.org/firefox-main/source/ipc/glue/IPCMessageUtilsSpecializations.h>`_.
``std::unordered_map<T>``, ``nsresult``, etc. See :searchfox:`builtin.py <ipc/ipdl/ipdl/builtin.py>`,
:searchfox:`ipc_message_utils.h <ipc/chromium/src/chrome/common/ipc_message_utils.h>`
and :searchfox:`IPCMessageUtilsSpecializations.h <ipc/glue/IPCMessageUtilsSpecializations.h>`.
``ParamTraits`` typically bootstrap with the ``ParamTraits`` of more basic
types, until they hit bedrock (e.g. one of the basic types above). In the most
@@ -1110,8 +1103,7 @@ result of the [Tainted] annotation in the protocol file. Recall that
handler before their values can be used (as opposed to validation in
``ParamTraits``). They therefore have access to any state that the message
handler does. Their APIs, along with a list of macros that are used to
validate them, are detailed `here
<https://searchfox.org/firefox-main/source/mfbt/Tainting.h>`__.
validate them, are detailed :searchfox:`here <mfbt/Tainting.h>`.
Send methods that are not for async messages with return values follow a
simpler form; they return a ``bool`` indicating success or failure and return
@@ -1669,7 +1661,7 @@ while a sync messagee is waiting for a response. The rules for when a nested
message can be handled are somewhat complex but they try to safely allow a
``sync`` message ``M`` to handle and respond to some special (nested) messages
that may be needed for the other endpoint to finish processing ``M``. There is
a `comment in MessageChannel`_ with info on how the decision to handle nested
a :searchfox:`comment in MessageChannel <mozilla-central/rev/077501b34cca91763ae04f4633a42fddd919fdbd:ipc/glue/MessageChannel.cpp#54-118>` with info on how the decision to handle nested
messages is made. For sync nested messages, note that this implies a relay
between the endpoints, which could dramatically affect their throughput.
@@ -1770,7 +1762,7 @@ The following tables explain what happens in all cases:
\* sync inside_cpow IPDL compiler error: parent cannot use inside_cpow priority
============================= ========================= ========================================================
We haven't seen rule #2 from the `comment in MessageChannel`_ in action but, as
We haven't seen rule #2 from the :searchfox:`comment in MessageChannel <mozilla-central/rev/077501b34cca91763ae04f4633a42fddd919fdbd:ipc/glue/MessageChannel.cpp#54-118>` in action but, as
the comment mentions, it is needed to break deadlocks in cases where both the
parent and child are initiating message-threads simultaneously. It
accomplishes this by favoring the parent's sent messages over the child's when
@@ -1788,8 +1780,6 @@ objects. Control flow, and hence state, can be very difficult to predict and
are just as hard to maintain. This is one of the key reasons why we have
stressed that message priorities should be avoided whenever possible.
.. _comment in MessageChannel: https://searchfox.org/mozilla-central/rev/077501b34cca91763ae04f4633a42fddd919fdbd/ipc/glue/MessageChannel.cpp#54-118
.. _Message Logging:
Message Logging
+100 -162
View File
@@ -163,8 +163,7 @@ we call **Demo**.
for this actor to simply take the name of the process type. The sample uses
``PDemo``, so it creates ``DemoParent`` and ``DemoChild`` actor subclasses
as usual (see :ref:`IPDL: Inter-Thread and Inter-Process Message Passing`).
* A subclass of `GeckoChildProcessHost
<https://searchfox.org/firefox-main/source/ipc/glue/GeckoChildProcessHost.h>`_
* A subclass of :searchfox:`GeckoChildProcessHost <ipc/glue/GeckoChildProcessHost.h>`
that exists in the main process (where new processes are created) and handles
most of the machinery needed for new process creation. It is common for these
names to be the process type plus ``ProcessParent`` or ``ProcessHost``. The
@@ -173,8 +172,7 @@ we call **Demo**.
since it is large, complicated and mostly unimportant externally. This
complexity is also why it is a bad idea to add extra responsibilities to the
``Host`` object that inherits it.
* A subclass of `ProcessChild
<https://searchfox.org/firefox-main/source/ipc/glue/ProcessChild.h>`_ that
* A subclass of :searchfox:`ProcessChild <ipc/glue/ProcessChild.h>` that
exists in the new process. These names are usually generated by affixing
``ProcessChild`` or ``ProcessImpl`` to the type. The sample will use
``DemoChild::Process``, another private class, for the same reasons it did
@@ -214,8 +212,7 @@ Process Bookkeeping
~~~~~~~~~~~~~~~~~~~
.. _process-bookkeeping:
To begin with, look at the `geckoprocesstypes generator
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/geckoprocesstypes_generator/geckoprocesstypes/__init__.py>`_
To begin with, look at the :searchfox:`geckoprocesstypes generator <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/geckoprocesstypes_generator/geckoprocesstypes/__init__.py>`
which adds the bones for a new process (by defining enum values and so on).
Some further manual intervention is still required, and you need to follow the
following checklists depending on your needs.
@@ -223,34 +220,25 @@ following checklists depending on your needs.
Basic requirements
^^^^^^^^^^^^^^^^^^
* Add a new entry to the `enum WebIDLProcType
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/dom/chrome-webidl/ChromeUtils.webidl#610-638>`_
* Update the `static_assert
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/xre/nsAppRunner.cpp#988-990>`_
* Add a new entry to the :searchfox:`enum WebIDLProcType <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:dom/chrome-webidl/ChromeUtils.webidl#610-638>`
* Update the :searchfox:`static_assert <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/xre/nsAppRunner.cpp#988-990>`
call checking for boundary against ``GeckoProcessType_End``
* Add your process to the correct ``MessageLoop::TYPE_x`` in the first
``switch(XRE_GetProcessType())`` in `XRE_InitChildProcess
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/xre/nsEmbedFunctions.cpp#572-590>`__.
You can get more information about that topic in `this comment
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/ipc/chromium/src/base/message_loop.h#159-187>`_
``switch(XRE_GetProcessType())`` in :searchfox:`XRE_InitChildProcess <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/xre/nsEmbedFunctions.cpp#572-590>`.
You can get more information about that topic in :searchfox:`this comment <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:ipc/chromium/src/base/message_loop.h#159-187>`
* Instantiate your child within the second ``switch (XRE_GetProcessType())`` in
`XRE_InitChildProcess
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/xre/nsEmbedFunctions.cpp#615-671>`__
* Add a new entry ``PROCESS_TYPE_x`` in `nsIXULRuntime interface
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/system/nsIXULRuntime.idl#183-196>`_
:searchfox:`XRE_InitChildProcess <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/xre/nsEmbedFunctions.cpp#615-671>`
* Add a new entry ``PROCESS_TYPE_x`` in :searchfox:`nsIXULRuntime interface <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/system/nsIXULRuntime.idl#183-196>`
Graphics
########
If you need graphics-related interaction, hack into `gfxPlatform
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/gfx/thebes/gfxPlatform.cpp>`__
If you need graphics-related interaction, hack into :searchfox:`gfxPlatform <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:gfx/thebes/gfxPlatform.cpp>`
- Add a call to your process manager init in ``gfxPlatform::Init()`` in
`gfxPlatform
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/gfx/thebes/gfxPlatform.cpp#808-810>`__
:searchfox:`gfxPlatform <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:gfx/thebes/gfxPlatform.cpp#808-810>`
- Add a call to your process manager shutdown in ``gfxPlatform::Shutdown()`` in
`gfxPlatform
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/gfx/thebes/gfxPlatform.cpp#1255-1259>`__
:searchfox:`gfxPlatform <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:gfx/thebes/gfxPlatform.cpp#1255-1259>`
Android
#######
@@ -260,28 +248,22 @@ required or applicable to your new process type.
- Add a new ``<service>`` entry against
``org.mozilla.gecko.process.GeckoChildProcessServices$XXX`` in the
`AndroidManifest
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/mobile/android/geckoview/src/main/AndroidManifest.xml#45-81>`_
- Add matching class inheritance from `GeckoChildProcessServices
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoChildProcessServices.jinja#10-13>`_
- Add new entry in `public enum GeckoProcessType
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoProcessType.java#11-23>`_
:searchfox:`AndroidManifest <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:mobile/android/geckoview/src/main/AndroidManifest.xml#45-81>`
- Add matching class inheritance from :searchfox:`GeckoChildProcessServices <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoChildProcessServices.jinja#10-13>`
- Add new entry in :searchfox:`public enum GeckoProcessType <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:mobile/android/geckoview/src/main/java/org/mozilla/gecko/process/GeckoProcessType.java#11-23>`
Crash reporting
###############
- Add ``InitCrashReporter`` message to the parent-side `InitCrashReporter
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#30>`_
- Add ``InitCrashReporter`` message to the parent-side :searchfox:`InitCrashReporter <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#30>`
- Ensure your parent class inherits `public ipc::CrashReporterHelper<GeckoProcessType_Xxx>
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessParent.h#23>`_
- Add new ``Xxx*Status`` `annotations
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/crashreporter/CrashAnnotations.yaml#968-971>`_
- Add new ``Xxx*Status`` :searchfox:`annotations <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/crashreporter/CrashAnnotations.yaml#968-971>`
entry for your new process type description. The link here points to
`UtilityProcessStatus` so you can see the similar description you have to
write, but you might want to respect ordering in that file and put your new
code at the appropriate place.
- Add entry in `PROCESS_CRASH_SUBMIT_ATTEMPT
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/telemetry/Histograms.json#13403-13422>`_ and
- Add entry in :searchfox:`PROCESS_CRASH_SUBMIT_ATTEMPT <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/telemetry/Histograms.json#13403-13422>` and
`submit_attempt` in `toolkit/components/crashes/metrics.yaml`.
Memory reporting
@@ -291,23 +273,23 @@ Throughout the linked code, please consider those methods more as boilerplate co
- Add definition of memory reporter to your new :ref:`top-level actor <Top Level Actors>`
+ Type inclusion `MemoryReportTypes <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#6>`__
+ To parent-side `AddMemoryReport <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#32>`__
+ To child-side `RequestMemoryReport <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#44-48>`__
+ Type inclusion :searchfox:`MemoryReportTypes <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#6>`
+ To parent-side :searchfox:`AddMemoryReport <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#32>`
+ To child-side :searchfox:`RequestMemoryReport <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#44-48>`
- Add handling for your new process within `nsMemoryReporterManager::GetReportsExtended <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/xpcom/base/nsMemoryReporterManager.cpp#1813-1819>`_
- Add handling for your new process within :searchfox:`nsMemoryReporterManager::GetReportsExtended <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:xpcom/base/nsMemoryReporterManager.cpp#1813-1819>`
- Provide a process manager level abstraction
+ Implement a new class deriving ``MemoryReportingProcess`` such as `UtilityMemoryReporter <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessManager.cpp#253-292>`_
+ Write a `GetProcessMemoryReport <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessManager.cpp#294-300>`_
+ Implement a new class deriving ``MemoryReportingProcess`` such as :searchfox:`UtilityMemoryReporter <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessManager.cpp#253-292>`
+ Write a :searchfox:`GetProcessMemoryReport <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessManager.cpp#294-300>`
- On the child side, provide an implementation for `RequestMemoryReport <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessChild.cpp#153-166>`__
- On the child side, provide an implementation for :searchfox:`RequestMemoryReport <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessChild.cpp#153-166>`
- On the parent side
+ Provide an implementation for `RequestMemoryReport <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessParent.cpp#41-69>`__
+ Provide an implementation for `AddMemoryReport <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessParent.cpp#71-77>`__
+ Provide an implementation for :searchfox:`RequestMemoryReport <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessParent.cpp#41-69>`
+ Provide an implementation for :searchfox:`AddMemoryReport <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessParent.cpp#71-77>`
If you want to add a test that ensures proper behavior, you can have a look at the `utility process memory report test <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/test/browser/browser_utility_memoryReport.js>`_
If you want to add a test that ensures proper behavior, you can have a look at the :searchfox:`utility process memory report test <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/test/browser/browser_utility_memoryReport.js>`
Process reporting
#################
@@ -316,27 +298,25 @@ Those elements will be used for exposing processes to users in some `about:`
pages. You might want to ping `#fluent-reviewers` to ensure if you need your
process there.
- Add a `user-facing localizable name
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/locales/en-US/toolkit/global/processTypes.ftl#39-57>`_
- Add a :searchfox:`user-facing localizable name <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/locales/en-US/toolkit/global/processTypes.ftl#39-57>`
for your process, if needed
- Hashmap from process type to user-facing string above in `const ProcessType
<https://searchfox.org/mozilla-central/rev/c5c002f81f08a73e04868e0c2bf0eb113f200b03/toolkit/modules/ProcessType.sys.mjs#10-16>`_
- Hashmap from process type to user-facing string above in :searchfox:`const ProcessType <mozilla-central/rev/c5c002f81f08a73e04868e0c2bf0eb113f200b03:toolkit/modules/ProcessType.sys.mjs#10-16>`
- For `about:processes` you will probably want to follow the following steps:
+ Add handling for your new process type producing a unique `fluentName <https://searchfox.org/mozilla-central/rev/be4604e4be8c71b3c1dbff2398a5b05f15411673/toolkit/components/aboutprocesses/content/aboutProcesses.js#472-539>`_, i.e., constructing a dynamic name is highly discouraged
+ Add matching localization strings within `about:processes localization file <https://searchfox.org/mozilla-central/rev/be4604e4be8c71b3c1dbff2398a5b05f15411673/toolkit/locales/en-US/toolkit/about/aboutProcesses.ftl#35-55>`_
+ Add matching localization strings within `about:support localization file <https://searchfox.org/firefox-main/source/toolkit/locales/en-US/toolkit/global/processTypes.ftl#54-60>`_
+ Add handling for your new process type producing a unique :searchfox:`fluentName <mozilla-central/rev/be4604e4be8c71b3c1dbff2398a5b05f15411673:toolkit/components/aboutprocesses/content/aboutProcesses.js#472-539>`, i.e., constructing a dynamic name is highly discouraged
+ Add matching localization strings within :searchfox:`about:processes localization file <mozilla-central/rev/be4604e4be8c71b3c1dbff2398a5b05f15411673:toolkit/locales/en-US/toolkit/about/aboutProcesses.ftl#35-55>`
+ Add matching localization strings within :searchfox:`about:support localization file <toolkit/locales/en-US/toolkit/global/processTypes.ftl#54-60>`
Profiler
########
- Add definition of ``PProfiler`` to your new IPDL
+ Type inclusion `protocol PProfiler <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#9>`__
+ Child-side `InitProfiler <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#42>`__
+ Type inclusion :searchfox:`protocol PProfiler <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#9>`
+ Child-side :searchfox:`InitProfiler <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#42>`
- Make sure your initialization path contains a `SendInitProfiler <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessHost.cpp#222-223>`__. You will want to perform the call once a ``OnChannelConnected`` is issued, thus ensuring your new process is connected to IPC.
- Provide an implementation for `InitProfiler <https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessChild.cpp#147-151>`__
- Make sure your initialization path contains a :searchfox:`SendInitProfiler <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessHost.cpp#222-223>`. You will want to perform the call once a ``OnChannelConnected`` is issued, thus ensuring your new process is connected to IPC.
- Provide an implementation for :searchfox:`InitProfiler <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessChild.cpp#147-151>`
- You will probably want to make sure your child process code register within the profiler a proper name, otherwise it will default to ``GeckoMain`` ; this can be done by issuing ``profiler_set_process_name(nsCString("XxX"))`` on the child init side.
@@ -355,34 +335,33 @@ StaticComponents code generation
services, so you might have to ensure you have all your bases covered. Some of
the components might not need to be updated as well.
+ `libpref <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/modules/libpref/components.conf>`_
+ `telemetry <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/telemetry/core/components.conf>`_
+ `android <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/widget/android/components.conf>`_
+ `gtk <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/widget/gtk/components.conf>`_
+ `windows <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/widget/windows/components.conf>`_
+ `base <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/base/components.conf>`_
+ `components <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/components/components.conf>`_
+ `ds <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/ds/components.conf>`_
+ `threads <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/threads/components.conf>`_
+ `cocoa kWidgetModule <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/widget/cocoa/nsWidgetFactory.mm#194-202>`_
+ `build <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/build/components.conf>`_
+ `XPCOMinit kXPCOMModule <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/build/XPCOMInit.cpp#172-180>`_
+ :searchfox:`libpref <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:modules/libpref/components.conf>`
+ :searchfox:`telemetry <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/telemetry/core/components.conf>`
+ :searchfox:`android <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:widget/android/components.conf>`
+ :searchfox:`gtk <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:widget/gtk/components.conf>`
+ :searchfox:`windows <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:widget/windows/components.conf>`
+ :searchfox:`base <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/base/components.conf>`
+ :searchfox:`components <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/components/components.conf>`
+ :searchfox:`ds <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/ds/components.conf>`
+ :searchfox:`threads <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/threads/components.conf>`
+ :searchfox:`cocoa kWidgetModule <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:widget/cocoa/nsWidgetFactory.mm#194-202>`
+ :searchfox:`build <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/build/components.conf>`
+ :searchfox:`XPCOMinit kXPCOMModule <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/build/XPCOMInit.cpp#172-180>`
- Within `static components generator
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/components/gen_static_components.py>`_
- Within :searchfox:`static components generator <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/components/gen_static_components.py>`
+ Add new definition in ``ProcessSelector`` for your new process
``ALLOW_IN_x_PROCESS = 0x..``
+ Add new process selector masks including your new process definition
+ Also add those into the ``PROCESSES`` structure
- Within `module definition <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/components/Module.h>`_
- Within :searchfox:`module definition <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/components/Module.h>`
+ Add new definition in ``enum ProcessSelector``
+ Add new process selector mask including the new definition
+ Update ``kMaxProcessSelector``
- Within `nsComponentManager <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/xpcom/components/nsComponentManager.cpp>`_
- Within :searchfox:`nsComponentManager <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:xpcom/components/nsComponentManager.cpp>`
+ Add new selector match in ``ProcessSelectorMatches`` for your new process
(needed?)
@@ -394,60 +373,46 @@ Glean telemetry
- Ensure your new IPDL includes on the child side
+ `FlushFOGData
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#55>`__
+ `TestTriggerMetrics
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/PUtilityProcess.ipdl#60>`__
+ :searchfox:`FlushFOGData <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#55>`
+ :searchfox:`TestTriggerMetrics <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/PUtilityProcess.ipdl#60>`
- Provide a parent-side implementation for `FOGData
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessParent.cpp#79-82>`__
- Provide a child-side implementation for `FlushFOGData
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessChild.cpp#179-183>`__
- Child-side should flush its FOG data at IPC `ActorDestroy
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessChild.cpp#199-201>`__
- Child-side `test metrics
<https://searchfox.org/mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc/ipc/glue/UtilityProcessChild.cpp#185-191>`__
- Within `FOGIPC
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/glean/ipc/FOGIPC.cpp>`__
- Provide a parent-side implementation for :searchfox:`FOGData <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessParent.cpp#79-82>`
- Provide a child-side implementation for :searchfox:`FlushFOGData <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessChild.cpp#179-183>`
- Child-side should flush its FOG data at IPC :searchfox:`ActorDestroy <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessChild.cpp#199-201>`
- Child-side :searchfox:`test metrics <mozilla-central/rev/fc4d4a8d01b0e50d20c238acbb1739ccab317ebc:ipc/glue/UtilityProcessChild.cpp#185-191>`
- Within :searchfox:`FOGIPC <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/glean/ipc/FOGIPC.cpp>`
+ Add handling of your new process type within ``FlushAllChildData()`` `here
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/glean/ipc/FOGIPC.cpp#106-121>`__
and ``SendFOGData()`` `here
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/glean/ipc/FOGIPC.cpp#165-182>`__
+ Add support for sending test metrics in ``TestTriggerMetrics()`` `here
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/glean/ipc/FOGIPC.cpp#208-232>`__
+ Add handling of your new process type within ``FlushAllChildData()`` :searchfox:`here <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/glean/ipc/FOGIPC.cpp#106-121>`
and ``SendFOGData()`` :searchfox:`here <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/glean/ipc/FOGIPC.cpp#165-182>`
+ Add support for sending test metrics in ``TestTriggerMetrics()`` :searchfox:`here <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/glean/ipc/FOGIPC.cpp#208-232>`
- Handle process shutdown in ``register_process_shutdown()`` of `glean
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/toolkit/components/glean/api/src/ipc.rs>`__
- Handle process shutdown in ``register_process_shutdown()`` of :searchfox:`glean <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:toolkit/components/glean/api/src/ipc.rs>`
Third-Party Modules
###################
- Ensure your new IPDL includes on the child side
+ `GetUntrustedModulesData
<https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/PUtilityProcess.ipdl#106>`_
+ `UnblockUntrustedModulesThread
<https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/PUtilityProcess.ipdl#113>`_
+ :searchfox:`GetUntrustedModulesData <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/PUtilityProcess.ipdl#106>`
+ :searchfox:`UnblockUntrustedModulesThread <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/PUtilityProcess.ipdl#113>`
- Provide a parent side implementation for both
- Add handling of your new process type in ``MultiGetUntrustedModulesData::GetUntrustedModuleLoadEvents()`` `here <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/toolkit/components/telemetry/other/UntrustedModules.cpp#145-151>`__
- Add handling of your new process type in ``MultiGetUntrustedModulesData::GetUntrustedModuleLoadEvents()`` :searchfox:`here <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:toolkit/components/telemetry/other/UntrustedModules.cpp#145-151>`
- `Update your IPDL <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/PUtilityProcess.ipdl#75>`_ and make sure your ``Init()`` can receive a boolean for
``isReadyForBackgroundProcessing`` `like here <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/UtilityProcessChild.cpp#157-160>`_, then within the child's ``RecvInit()``
make sure a call to ``DllServices``'s ``StartUntrustedModulesProcessor()`` `is
performed <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/UtilityProcessChild.cpp#185-186>`_.
- :searchfox:`Update your IPDL <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/PUtilityProcess.ipdl#75>` and make sure your ``Init()`` can receive a boolean for
``isReadyForBackgroundProcessing`` :searchfox:`like here <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/UtilityProcessChild.cpp#157-160>`, then within the child's ``RecvInit()``
make sure a call to ``DllServices``'s ``StartUntrustedModulesProcessor()`` :searchfox:`is performed <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/UtilityProcessChild.cpp#185-186>`.
- Ensure your new IPDL includes for the parent side
+ `GetModulesTrust <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/PUtilityProcess.ipdl#60-61>`_
+ :searchfox:`GetModulesTrust <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/PUtilityProcess.ipdl#60-61>`
- Provide an implementation on the `parent side <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/ipc/glue/UtilityProcessParent.cpp#69-81>`_
- Provide an implementation on the :searchfox:`parent side <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:ipc/glue/UtilityProcessParent.cpp#69-81>`
- Expose your new process type as supported in ``UntrustedModulesProcessor::IsSupportedProcessType()`` `like others <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp#76-91>`_
- Expose your new process type as supported in ``UntrustedModulesProcessor::IsSupportedProcessType()`` :searchfox:`like others <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:toolkit/xre/dllservices/UntrustedModulesProcessor.cpp#76-91>`
- Update ``UntrustedModulesProcessor::SendGetModulesTrust()`` to call `your new child process <https://searchfox.org/mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a/toolkit/xre/dllservices/UntrustedModulesProcessor.cpp#757-761>`_
- Update ``UntrustedModulesProcessor::SendGetModulesTrust()`` to call :searchfox:`your new child process <mozilla-central/rev/2ce39261ea6a69e49d87f76a119494b2a7a7e42a:toolkit/xre/dllservices/UntrustedModulesProcessor.cpp#757-761>`
Sandboxing
##########
@@ -461,61 +426,43 @@ _____________
Linux sandboxing mostly works by allowing / blocking system calls for child
process and redirecting (brokering) some from the child to the parent. Rules
are written in a specific DSL: `BPF
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/chromium/sandbox/linux/bpf_dsl/bpf_dsl.h#21-72>`_.
are written in a specific DSL: :searchfox:`BPF <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/chromium/sandbox/linux/bpf_dsl/bpf_dsl.h#21-72>`.
- Add new ``SetXXXSandbox()`` function within `linux sandbox
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/Sandbox.cpp#719-748>`_
- Within `sandbox filter
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/SandboxFilter.cpp>`_
- Add new ``SetXXXSandbox()`` function within :searchfox:`linux sandbox <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/Sandbox.cpp#719-748>`
- Within :searchfox:`sandbox filter <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/SandboxFilter.cpp>`
+ Add new helper ``GetXXXSandboxPolicy()`` `like this one
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/SandboxFilter.cpp#2036-2040>`_
+ Add new helper ``GetXXXSandboxPolicy()`` :searchfox:`like this one <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/SandboxFilter.cpp#2036-2040>`
called by ``SetXXXSandbox()``
+ Derive new class `similar to this
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/SandboxFilter.cpp#2000-2034>`_
+ Derive new class :searchfox:`similar to this <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/SandboxFilter.cpp#2000-2034>`
inheriting ``SandboxPolicyCommon`` or ``SandboxPolicyBase`` and defining
the sandboxing policy
- Add new ``SandboxBrokerPolicyFactory::GetXXXProcessPolicy()`` in `sandbox
broker
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp#881-932>`_
- Add new case handling in ``GetEffectiveSandboxLevel()`` in `sandbox launch
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/launch/SandboxLaunch.cpp#243-271>`_
- Add new entry in ``enum class ProcType`` of `sandbox reporter header
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/reporter/SandboxReporterCommon.h#32-39>`_
- Add new case handling in ``SubmitToTelemetry()`` in `sandbox reporter
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/reporter/SandboxReporter.cpp#131-152>`_
- Add new case handling in ``SandboxReportWrapper::GetProcType()`` of `sandbox
reporter wrapper
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp#69-91>`_
- Add new ``SandboxBrokerPolicyFactory::GetXXXProcessPolicy()`` in :searchfox:`sandbox broker <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp#881-932>`
- Add new case handling in ``GetEffectiveSandboxLevel()`` in :searchfox:`sandbox launch <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/launch/SandboxLaunch.cpp#243-271>`
- Add new entry in ``enum class ProcType`` of :searchfox:`sandbox reporter header <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/reporter/SandboxReporterCommon.h#32-39>`
- Add new case handling in ``SubmitToTelemetry()`` in :searchfox:`sandbox reporter <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/reporter/SandboxReporter.cpp#131-152>`
- Add new case handling in ``SandboxReportWrapper::GetProcType()`` of :searchfox:`sandbox reporter wrapper <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/linux/reporter/SandboxReporterWrappers.cpp#69-91>`
MacOS Sandbox
_____________
- Add new case handling in ``GeckoChildProcessHost::StartMacSandbox()`` of
`GeckoChildProcessHost <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/ipc/glue/GeckoChildProcessHost.cpp#1720-1743>`__
- Add new entry in ``enum MacSandboxType`` defined in `macOS sandbox header
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/mac/Sandbox.h#12-20>`__
- Within `macOS sandbox core
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/mac/Sandbox.mm>`__
:searchfox:`GeckoChildProcessHost <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:ipc/glue/GeckoChildProcessHost.cpp#1720-1743>`
- Add new entry in ``enum MacSandboxType`` defined in :searchfox:`macOS sandbox header <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/mac/Sandbox.h#12-20>`
- Within :searchfox:`macOS sandbox core <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/mac/Sandbox.mm>`
handle the new ``MacSandboxType`` in
+ ``MacSandboxInfo::AppendAsParams()`` in the `switch statement
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/mac/Sandbox.mm#164-188>`__
+ ``StartMacSandbox()`` in the `series of if/else statements
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/mac/Sandbox.mm#286-436>`__.
+ ``MacSandboxInfo::AppendAsParams()`` in the :searchfox:`switch statement <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/mac/Sandbox.mm#164-188>`
+ ``StartMacSandbox()`` in the :searchfox:`series of if/else statements <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/mac/Sandbox.mm#286-436>`.
This code sets template values for the sandbox string rendering, and is
running on the side of the main process.
+ ``StartMacSandboxIfEnabled()`` in this `switch statement
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/mac/Sandbox.mm#753-782>`__.
+ ``StartMacSandboxIfEnabled()`` in this :searchfox:`switch statement <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/mac/Sandbox.mm#753-782>`.
You might also need a ``GetXXXSandboxParamsFromArgs()`` that performs CLI
parsing on behalf of ``StartMacSandbox()``.
- Create the new sandbox definition file
``security/sandbox/mac/SandboxPolicy<XXX>.h`` for your new process ``<XXX>``,
and make it exposed in the ``EXPORTS.mozilla`` section of `moz.build
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/mac/moz.build#7-13>`__.
and make it exposed in the ``EXPORTS.mozilla`` section of :searchfox:`moz.build <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/mac/moz.build#7-13>`.
Those rules follows a specific Scheme-like language. You can learn more about
it in `Apple Sandbox Guide
<https://reverse.put.as/wp-content/uploads/2011/09/Apple-Sandbox-Guide-v1.0.pdf>`__
@@ -526,31 +473,24 @@ _______________
- Introduce a new ``SandboxBroker::SetSecurityLevelForXXXProcess()`` that
defines the new sandbox in the sandbox broker basing yourself on this
`example <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp#1241-1344>`__
:searchfox:`example <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/win/src/sandboxbroker/sandboxBroker.cpp#1241-1344>`
- Add new case handling in ``WindowsProcessLauncher::DoSetup()`` calling
``SandboxBroker::SetSecurityLevelForXXXProcess()`` in `GeckoChildProcessHost
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/ipc/glue/GeckoChildProcessHost.cpp#1391-1470>`__.
``SandboxBroker::SetSecurityLevelForXXXProcess()`` in :searchfox:`GeckoChildProcessHost <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:ipc/glue/GeckoChildProcessHost.cpp#1391-1470>`.
This will apply actual sandboxing rules to your process.
Sandbox tests
_____________
- New process' first top level actor needs to `include PSandboxTesting
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/common/test/PSandboxTesting.ipdl>`_
and implement ``RecvInitSandboxTesting`` `like there
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/ipc/glue/UtilityProcessChild.cpp#165-174>`_.
- Add your new process ``string_name`` in the ``processTypes`` list of `sandbox
tests <https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/test/browser_sandbox_test.js#17>`_
- Add a new case in ``SandboxTest::StartTests()`` in `test core
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/common/test/SandboxTest.cpp#100-232>`_
- New process' first top level actor needs to :searchfox:`include PSandboxTesting <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/common/test/PSandboxTesting.ipdl>`
and implement ``RecvInitSandboxTesting`` :searchfox:`like there <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:ipc/glue/UtilityProcessChild.cpp#165-174>`.
- Add your new process ``string_name`` in the ``processTypes`` list of :searchfox:`sandbox tests <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/test/browser_sandbox_test.js#17>`
- Add a new case in ``SandboxTest::StartTests()`` in :searchfox:`test core <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/common/test/SandboxTest.cpp#100-232>`
to handle your new process
- Add a new if branch for your new process in ``SandboxTestingChild::Bind()``
in `testing child
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/common/test/SandboxTestingChild.cpp#68-96>`_
in :searchfox:`testing child <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/common/test/SandboxTestingChild.cpp#68-96>`
- Add a new ``RunTestsXXX`` function for your new process (called by ``Bind()``
above) `similar to that implementation
<https://searchfox.org/mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854/security/sandbox/common/test/SandboxTestingChildTests.h#333-363>`_
above) :searchfox:`similar to that implementation <mozilla-central/rev/d4b9c457db637fde655592d9e2048939b7ab2854:security/sandbox/common/test/SandboxTestingChildTests.h#333-363>`
Creating the New Process
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -721,10 +661,8 @@ is used to determine what process types have access to what XPCOM components.
By default, a process has access to none. The code adds enums for selecting
a subset of process types, like
``ALLOW_IN_GPU_RDD_VR_SOCKET_UTILITY_AND_DEMO_PROCESS``, to the
``ProcessSelector`` enum in `gen_static_components.py
<https://searchfox.org/firefox-main/source/xpcom/components/gen_static_components.py>`_
and `Module.h
<https://searchfox.org/firefox-main/source/xpcom/components/Module.h>`_.
``ProcessSelector`` enum in :searchfox:`gen_static_components.py <xpcom/components/gen_static_components.py>`
and :searchfox:`Module.h <xpcom/components/Module.h>`.
It then updates the selectors in various ``components.conf`` files and
hardcoded spots like ``nsComponentManager.cpp`` to add the **Demo** processes
to the list that can use them. Some modules are required to bootstrap XPCOM
+8 -10
View File
@@ -28,17 +28,17 @@ implementing the trivial example visible in `EmptyUtil
performing the heavy lifting of starting your process, you can take
inspiration from ``StartEmptyUtil()`` in the sample.
- Ideally, this starting method should rely on `StartUtility() <https://searchfox.org/mozilla-central/rev/f9f9b422f685244dcd3f6826b70d34a496ce5853/ipc/glue/UtilityProcessManager.cpp#238-318,347>`_
- Ideally, this starting method should rely on :searchfox:`StartUtility() <mozilla-central/rev/f9f9b422f685244dcd3f6826b70d34a496ce5853:ipc/glue/UtilityProcessManager.cpp#238-318,347>`
- To use ``StartUtility()`` mentioned above, please ensure that you provide
a ``nsresult BindToUtilityProcess(RefPtr<UtilityProcessParent>
aUtilityParent)``. Usually, it should be in charge of creating a set of
endpoints and performing ``Bind()`` to setup the IPC. You can see some example for `UtilityMediaService <https://searchfox.org/mozilla-central/rev/0fe32133f12ed0f20d5fde8fe970157f04817982/ipc/glue/UtilityMediaServiceChild.cpp#60-92>`_
endpoints and performing ``Bind()`` to setup the IPC. You can see some example for :searchfox:`UtilityMediaService <mozilla-central/rev/0fe32133f12ed0f20d5fde8fe970157f04817982:ipc/glue/UtilityMediaServiceChild.cpp#60-92>`
- For proper user-facing exposition in ``about:processes`` you will have to also provide an actor
name via a method ``UtilityActorName GetActorName() { return UtilityActorName::EmptyUtil; }``
+ Add member within `enum WebIDLUtilityActorName in <https://searchfox.org/mozilla-central/rev/f9f9b422f685244dcd3f6826b70d34a496ce5853/dom/chrome-webidl/ChromeUtils.webidl#852-866>`_
+ Add member within :searchfox:`enum WebIDLUtilityActorName in <mozilla-central/rev/f9f9b422f685244dcd3f6826b70d34a496ce5853:dom/chrome-webidl/ChromeUtils.webidl#852-866>`
- Handle reception of ``StartEmptyUtilService`` on the child side of
``UtilityProcess`` within ``RecvStartEmptyUtilService()``
@@ -48,22 +48,20 @@ implementing the trivial example visible in `EmptyUtil
will probably include a reference to the ``EmptyUtilChild``.
- The specific sandboxing requirements can be implemented by tracking
``SandboxingKind``, and it starts within `UtilityProcessSandboxing header
<https://searchfox.org/firefox-main/source/ipc/glue/UtilityProcessSandboxing.h>`_
``SandboxingKind``, and it starts within :searchfox:`UtilityProcessSandboxing header <ipc/glue/UtilityProcessSandboxing.h>`
- Try and make sure you at least add some ``gtest`` coverage of your new
actor, for example like in `existing gtest
<https://searchfox.org/firefox-main/source/ipc/glue/test/gtest/TestUtilityProcess.cpp>`_
actor, for example like in :searchfox:`existing gtest <ipc/glue/test/gtest/TestUtilityProcess.cpp>`
- Also ensure actual sandbox testing within
+ ``SandboxTest`` to start your new process,
`<https://searchfox.org/firefox-main/source/security/sandbox/common/test/SandboxTest.cpp>`_
:searchfox:`security/sandbox/common/test/SandboxTest.cpp`
+ ``SandboxTestingChildTests`` to define the test
`<https://searchfox.org/firefox-main/source/security/sandbox/common/test/SandboxTestingChildTests.h>`_
:searchfox:`security/sandbox/common/test/SandboxTestingChildTests.h`
+ ``SandboxTestingChild`` to run your test
`<https://searchfox.org/firefox-main/source/security/sandbox/common/test/SandboxTestingChild.cpp>`_
:searchfox:`security/sandbox/common/test/SandboxTestingChild.cpp`
- Please also consider having a look at :ref:`Process Bookkeeping <process-bookkeeping>` for anything you may want to ensure is supported by your new process, like e.g. profiler, crash reporting, etc.
+1 -2
View File
@@ -15,8 +15,7 @@ Security issues
- If you ever have a raw pointer to a dynamically allocated object, it's good
to scrutinize whether the object might be destroyed before the last
possible use of the raw pointer. For example: if you have a local variable
that points to an object that's owned by a `frame's property table
<https://searchfox.org/firefox-main/source/layout/base/FrameProperties.h>`__,
that points to an object that's owned by a :searchfox:`frame's property table <layout/base/FrameProperties.h>`,
then consider whether the frame might remove/replace the property-table
entry (or whether the frame itself might be destroyed) inside any of the
function calls that happen while the local pointer is in scope.
+1 -2
View File
@@ -2,8 +2,7 @@ Style system (CSS) & Layout
===========================
Here contains the overview and design documents for Firefox's layout engine and
style system. They live in the mozilla-central repository under `layout/docs
<https://searchfox.org/firefox-main/source/layout/docs>`__ directory.
style system. They live in the mozilla-central repository under :searchfox:`layout/docs` directory.
`Layout page <https://wiki.mozilla.org/Platform/Layout>`__ on mozilla wiki
contains general information about layout and the layout team at Mozilla.
@@ -121,4 +121,4 @@ You're done!
Your application should now load and display a webpage inside of GeckoView.
To learn more about GeckoView's capabilities, review GeckoView's `JavaDoc <https://mozilla.github.io/geckoview/javadoc/mozilla-central/>`_ or the `reference application <https://searchfox.org/firefox-main/source/mobile/android/geckoview_example>`_.
To learn more about GeckoView's capabilities, review GeckoView's `JavaDoc <https://mozilla.github.io/geckoview/javadoc/mozilla-central/>`_ or the :searchfox:`reference application <mobile/android/geckoview_example>`.
@@ -188,7 +188,7 @@ call, you will also receive the ``GeckoSession`` the request was sent
from, the URI of the site that requested the permission, as a String,
the list of video devices available, if requesting video, the list of
audio devices available, if requesting audio, and a
`MediaCallback <https://searchfox.org/firefox-main/source/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java#686>`_
:searchfox:`MediaCallback <mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java#686>`
to respond to the request.
It is up to the app to present UI to the user asking for the
@@ -138,7 +138,7 @@ Lets set up an activity that registers an extension located in the
that will be used to communicate with Web Content.
You can find the full example here:
`MessagingExample <https://searchfox.org/firefox-main/source/mobile/android/examples/messaging_example>`_.
:searchfox:`MessagingExample <mobile/android/examples/messaging_example>`.
Activity.java
^^^^^^^^^^^^^
@@ -288,7 +288,7 @@ will allow you to receive a
object that can be used to receive and send messages to the extension.
The following example can be found
`here <https://searchfox.org/firefox-main/source/mobile/android/examples/port_messaging_example>`_.
:searchfox:`here <mobile/android/examples/port_messaging_example>`.
For this example, the extension side will do the following:
@@ -24,7 +24,7 @@ served by our general bootstrapping guide. If you are looking to
contribute to front-end development of one of Mozillas Android
browsers, youre likely better off starting with their codebase and
returning here only if actual GeckoView changes are needed. See, for
example, `Fenix on Mozilla Central <https://searchfox.org/firefox-main/source/mobile/android/fenix>`_.
example, :searchfox:`Fenix on Mozilla Central <mobile/android/fenix>`.
What to do if this guide contains bugs or leads you astray: The quickest
way to get a response is to ask generally on #gv on Mozilla Slack;
@@ -136,8 +136,8 @@ the associated ``SurfaceView`` or ``TextureView``. This triggers a few actions
on the Gecko side:
- The GL Surface is released, and Gecko is notified in
`SyncPauseCompositor <https://searchfox.org/mozilla-central/rev/ead7da2d9c5400bc7034ff3f06a030531bd7e5b9/widget/android/nsWindow.cpp#1114>`_.
- The ``<browser>`` associated to the ``GeckoSession`` is `set to inactive <https://searchfox.org/mozilla-central/rev/ead7da2d9c5400bc7034ff3f06a030531bd7e5b9/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#553>`_,
:searchfox:`SyncPauseCompositor <mozilla-central/rev/ead7da2d9c5400bc7034ff3f06a030531bd7e5b9:widget/android/nsWindow.cpp#1114>`.
- The ``<browser>`` associated to the ``GeckoSession`` is :searchfox:`set to inactive <mozilla-central/rev/ead7da2d9c5400bc7034ff3f06a030531bd7e5b9:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#553>`,
which essentially freezes the JavaScript engine.
Apps that do not use ``GeckoView``, because e.g. they cannot use
@@ -253,8 +253,7 @@ default, read Android's CA store to determine root certificates.
However, GeckoView provides a way to import all third-party CA roots added to
the Android CA store by setting the `enterpriseRootsEnabled
<https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoRuntimeSettings.Builder.html#enterpriseRootsEnabled(boolean)>`_
runtime setting to ``true``, this feature is implemented in `EnterpriseRoots
<https://searchfox.org/mozilla-central/rev/26a6a38fb515dbab0bb459c40ec4b877477eefef/mobile/android/geckoview/src/main/java/org/mozilla/gecko/EnterpriseRoots.java>`_
runtime setting to ``true``, this feature is implemented in :searchfox:`EnterpriseRoots <mozilla-central/rev/26a6a38fb515dbab0bb459c40ec4b877477eefef:mobile/android/geckoview/src/main/java/org/mozilla/gecko/EnterpriseRoots.java>`
There is not currently any API for an app to manually specify additional CA
roots, although this might change with `Bug 1522162
@@ -430,8 +429,7 @@ The underlying assumption is that a session that is not visible doesn't have a
surface associated to it and it's not being used by the user so it shouldn't
receive high priority status.
The way this is implemented is `by setting
<https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#114,123>`_
The way this is implemented is :searchfox:`by setting <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#114,123>`
the ``active`` property on the ``browser`` object to ``false``, which causes
Gecko to de-prioritize the process, assuming that no other windows in the same
process have ``active=true``. See also `GeckoDisplay`_.
@@ -450,8 +448,7 @@ priority, `setPriorityHint
<https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoSession.html#setPriorityHint(int)>`_.
The priority hint is taken into consideration when calculating the
priority of a process. Any process that contains either an active session or a
session with the priority hint `is boosted
<https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/dom/ipc/BrowserParent.cpp#3593>`_
session with the priority hint :searchfox:`is boosted <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:dom/ipc/BrowserParent.cpp#3593>`
to the highest priority.
Shutdown
@@ -468,8 +465,7 @@ Principals
----------
In Gecko, a *website* loaded in a session is represented by an abstraction
called `principal
<https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/caps/nsIPrincipal.idl>`__.
called :searchfox:`principal <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:caps/nsIPrincipal.idl>`.
Principals contain information that is used to determine what permissions have
been granted to the website instance, what APIs are available to it, which
container the page is loaded in, is the page in private browsing or not, etc.
@@ -690,24 +686,18 @@ Implementation
~~~~~~~~~~~~~~
The main entry point from Gecko is ``nsIContentPermissionPrompt.prompt``, which
is handled in the `Permission module
<https://searchfox.org/mozilla-central/rev/256f84391cf5d4e3a4d66afbbcd744a5bec48956/mobile/android/components/geckoview/GeckoViewPermission.jsm#21>`_
is handled in the :searchfox:`Permission module <mozilla-central/rev/256f84391cf5d4e3a4d66afbbcd744a5bec48956:mobile/android/components/geckoview/GeckoViewPermission.jsm#21>`
in the same process where the request is originated.
The permission module calls the child actor `GeckoViewPermission
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/actors/GeckoViewPermissionChild.jsm#47>`_
which issues a `GeckoView:ContentPermission
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/actors/GeckoViewPermissionChild.jsm#75>`_
The permission module calls the child actor :searchfox:`GeckoViewPermission <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/actors/GeckoViewPermissionChild.jsm#47>`
which issues a :searchfox:`GeckoView:ContentPermission <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/actors/GeckoViewPermissionChild.jsm#75>`
request to the Java front-end as needed.
Media permissions are requested using a global observer, and therefore are
handled in a `Process actor
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/actors/GeckoViewPermissionProcessChild.jsm#41>`_,
handled in a :searchfox:`Process actor <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/actors/GeckoViewPermissionProcessChild.jsm#41>`,
media permissions requests have enough information to redirect the request to
the corresponding window child actor, with the exception of requests that are
not associated with a window, which are redirected to the `current active
window
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/actors/GeckoViewPermissionProcessParent.jsm#28-35>`_.
not associated with a window, which are redirected to the :searchfox:`current active window <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/actors/GeckoViewPermissionProcessParent.jsm#28-35>`.
Setting permissions
~~~~~~~~~~~~~~~~~~~
@@ -725,8 +715,7 @@ permission is given to the wrong website.
Internally, some permissions are only present when a certain override is set,
e.g. Tracking Protection override permissions are only present when the page
has been given a TP override. Because the only way to set the value of a
permission is to get hold of the ``ContentPermission`` object, `we manually insert
<https://searchfox.org/mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0/mobile/android/modules/geckoview/GeckoViewNavigation.jsm#605-625>`_
permission is to get hold of the ``ContentPermission`` object, :searchfox:`we manually insert <mozilla-central/rev/5b2d2863bd315f232a3f769f76e0eb16cdca7cb0:mobile/android/modules/geckoview/GeckoViewNavigation.jsm#605-625>`
a `trackingprotection` permission on every page load.
Autofill Support
@@ -737,20 +726,16 @@ GeckoView supports third-party autofill providers through Android's `autofill fr
Document tree
~~~~~~~~~~~~~
The autofill Java front-end is located in the `Autofill class
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#37>`_.
The autofill Java front-end is located in the :searchfox:`Autofill class <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#37>`.
GeckoView maintains a virtual tree structure of the current document for each
``GeckoSession``.
The virtual tree structure is composed of `Node
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#593>`_
The virtual tree structure is composed of :searchfox:`Node <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#593>`
objects which are immutable. Data associated to a node, including mutable data
like the current value, is stored in a separate `NodeData
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#171>`_
like the current value, is stored in a separate :searchfox:`NodeData <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#171>`
class. Only HTML nodes that are relevant to autofilling are referenced in the
virtual structure and each node is associated to a root node, e.g. the root
``<form>`` element. All root nodes are children of the autofill `mRoot
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#210>`_
``<form>`` element. All root nodes are children of the autofill :searchfox:`mRoot <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/Autofill.java#210>`
node, hence making the overall structure a tree rather than a collection of
trees. Note that the root node is the only node in the virtual structure that
does not correspond to an actual element on the page.
@@ -761,8 +746,7 @@ Javascript. The autofill framework itself requires integer IDs for nodes, so we
store a mapping between UUIDs and integer IDs in the associated ``NodeData``
object. The integer IDs are used only externally, while internally only the
UUIDs are used. The reason why we use a separate ID structure from the autofill
framework is that this allows us to `generate UUIDs
<https://searchfox.org/mozilla-central/rev/7e34cb7a0094a2f325a0c9db720cec0a2f2aca4f/mobile/android/actors/GeckoViewAutoFillChild.jsm#217-220>`_
framework is that this allows us to :searchfox:`generate UUIDs <mozilla-central/rev/7e34cb7a0094a2f325a0c9db720cec0a2f2aca4f:mobile/android/actors/GeckoViewAutoFillChild.jsm#217-220>`
directly in the isolated content processes avoiding an IPC roundtrip to the
main process.
@@ -773,8 +757,7 @@ Detecting autofillable nodes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GeckoView scans every web page for password ``<input>`` elements whenever the
``pageshow`` event `fires
<https://searchfox.org/mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a/mobile/android/actors/GeckoViewAutoFillChild.jsm#74-78>`_.
``pageshow`` event :searchfox:`fires <mozilla-central/rev/9dc5ffe42635b602d4ddfc9a4b8ea0befc94975a:mobile/android/actors/GeckoViewAutoFillChild.jsm#74-78>`.
It also uses ``DOMFormHasPassword`` and ``DOMInputPasswordAdded`` to detect
whenever a password element is added to the DOM after the ``pageshow`` event.
@@ -228,7 +228,7 @@ Finally, follow the next command to get the API hash for the CHANGELOG:
./mach lint --linter android-api-lint
In the `CHANGELOG` `file <https://searchfox.org/firefox-main/source/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md>`_.
In the `CHANGELOG` :searchfox:`file <mobile/android/geckoview/src/main/java/org/mozilla/geckoview/doc-files/CHANGELOG.md>`.
at the bottom, swap `[api-version]` with the new hash provided by the linter and add an entry for what changed.
The feature and methods should also be documented in the changelog similar to the example below.
@@ -2,10 +2,8 @@
Junit Test Framework
====================
GeckoView has `a lot
<https://searchfox.org/mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java>`_
of `custom
<https://searchfox.org/firefox-main/source/mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support>`_
GeckoView has :searchfox:`a lot <mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java>`
of :searchfox:`custom <mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support>`
code that is used to run junit tests. This document is an overview of what this
code does and how it works.
@@ -57,11 +55,9 @@ is fully installed:
public GeckoResult<WebExtension> install(...)
To simplify memory safety, ``GeckoResult`` will always `execute callbacks
<https://searchfox.org/mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoResult.java#740-744>`_
To simplify memory safety, ``GeckoResult`` will always :searchfox:`execute callbacks <mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoResult.java#740-744>`
in the same thread where it was created, turning asynchronous code into
single-threaded javascript-style code. This is currently `implemented
<https://searchfox.org/mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoResult.java#285>`_
single-threaded javascript-style code. This is currently :searchfox:`implemented <mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3:mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoResult.java#285>`
using the Android Looper for the thread, which restricts ``GeckoResult`` to
threads that have a looper, like the Android UI thread.
@@ -80,8 +76,7 @@ and most of the test framework is built around making sure that these
interactions are easy to write and verify.
Tests in GeckoView can be run using the ``mach`` interface, which is used by
most Gecko tests. E.g. to run the `loadUnknownHost
<https://searchfox.org/mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt#186-196>`_
most Gecko tests. E.g. to run the :searchfox:`loadUnknownHost <mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt#186-196>`
test in ``NavigationDelegateTest`` you would type on your terminal:
.. code:: shell
@@ -119,8 +114,7 @@ through Android Studio, the prefs will be inherited from the default GeckoView
prefs (i.e. the same prefs that would be enabled in a consumer's build of
GeckoView) and the mochitest web server will not be available.
Tests account for this using the `isAutomation
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Environment.java#36-38>`_
Tests account for this using the :searchfox:`isAutomation <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/Environment.java#36-38>`
check, which essentially checks whether the test is running under ``mach`` or
via Android Studio.
@@ -130,10 +124,8 @@ thread. Without this, every test would most likely include a lot of blocks that
run code in the UI thread, adding significant boilerplate.
Running tests on the UI thread is achieved by registering a custom ``TestRule``
called `GeckoSessionTestRule
<https://searchfox.org/mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt#186-196>`_,
which, among other things, `overrides the evaluate
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1307,1312>`_
called :searchfox:`GeckoSessionTestRule <mozilla-central/rev/36904ac58d2528fc59f640db57cc9429103368d3:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/NavigationDelegateTest.kt#186-196>`,
which, among other things, :searchfox:`overrides the evaluate <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1307,1312>`
method and wraps everything into a ``instrumentation.runOnMainSync`` call.
Verifying delegates
@@ -181,23 +173,16 @@ Tracking delegate calls
One thing you might have noticed in the above section is that
``forCallbacksDuringWait`` moves "backward" in time by replaying the delegates
called that happened while the wait was being executed.
``GeckoSessionTestRule`` achieves this by `injecting a proxy object
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1137>`_
into every delegate, and `proxying every call
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1091-1092>`_
``GeckoSessionTestRule`` achieves this by :searchfox:`injecting a proxy object <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1137>`
into every delegate, and :searchfox:`proxying every call <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1091-1092>`
to the current delegate according to the ``delegate`` test calls.
The proxy delegate `is built
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1105-1106>`_
using the Java reflection's ``Proxy.newProxyInstance`` method and receives `a
callback
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1030-1031>`_
The proxy delegate :searchfox:`is built <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1105-1106>`
using the Java reflection's ``Proxy.newProxyInstance`` method and receives :searchfox:`a callback <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1030-1031>`
every time a method on the delegate is being executed.
``GeckoSessionTestRule`` maintains a list of `"default" delegates
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#743-752>`_
used in GeckoView, and will `use reflection
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#585>`_
``GeckoSessionTestRule`` maintains a list of :searchfox:`"default" delegates <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#743-752>`
used in GeckoView, and will :searchfox:`use reflection <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#585>`
to match the object passed into the ``delegate*`` calls to the proxy delegates.
For example, when calling
@@ -222,8 +207,7 @@ continue or not. When replaying delegates, however, we don't know what the
value of ``onLoadRequest`` will be (or if the test is going to install a
delegate for it, either!).
What ``GeckoSessionTestRule`` does, instead, is to `return the default value
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1092>`_
What ``GeckoSessionTestRule`` does, instead, is to :searchfox:`return the default value <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1092>`
for the delegate method, and ignore the replayed delegate method return value.
This can be a little confusing for test writers, for example this code `will
not` stop the page from loading:
@@ -247,21 +231,16 @@ Tracking Waits
--------------
To track when a ``wait`` occurs and to know when to replay delegate calls,
``GeckoSessionTestRule`` `stores
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1075>`_
``GeckoSessionTestRule`` :searchfox:`stores <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1075>`
the list of delegate calls in a ``List<CallRecord>`` object, where
``CallRecord`` is a class that has enough information to replay a delegate
call. The test rule will track the `start and end index
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1619>`_
of the last wait's delegate calls and `replay it
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1697-1724>`_
call. The test rule will track the :searchfox:`start and end index <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1619>`
of the last wait's delegate calls and :searchfox:`replay it <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1697-1724>`
when ``forCallbacksDuringWait`` is called.
To wait until a delegate call happens, the test rule will first `examine
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1585>`_
To wait until a delegate call happens, the test rule will first :searchfox:`examine <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1585>`
the already executed delegate calls using the call record list described above.
If none of the calls match, then it will `wait for new calls
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1589>`_
If none of the calls match, then it will :searchfox:`wait for new calls <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1589>`
to happen, using ``UiThreadUtils.waitForCondition``.
``waitForCondition`` is also used to implement other type of ``wait*`` methods
@@ -269,11 +248,9 @@ like ``waitForResult``, which waits until a ``GeckoResult`` is executed.
``waitForCondition`` runs on the UI thread, and it synchronously waits for an
event to occur. The events it waits for normally execute on the UI thread as
well, so it `injects itself
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/UiThreadUtils.java#145,153>`_
well, so it :searchfox:`injects itself <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/UiThreadUtils.java#145,153>`
in the Android event loop, checking for the condition after every event has
executed. If no more events remain in the queue, `it posts a delayed 100ms
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/UiThreadUtils.java#136-141>`_
executed. If no more events remain in the queue, :searchfox:`it posts a delayed 100ms <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/util/UiThreadUtils.java#136-141>`
task to avoid clogging the event loop.
Executing Javascript
@@ -296,8 +273,7 @@ and install it. This was done intentionally to avoid having to rewrite a lot of
the Web-Content-related APIs that the WebExtension API offers.
GeckoView extends the WebExtension API to allow embedders to communicate to the
extension by `overloading
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/modules/geckoview/GeckoViewWebExtension.jsm#221>`_
extension by :searchfox:`overloading <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/modules/geckoview/GeckoViewWebExtension.jsm#221>`
the native messaging API (which is not normally implemented on mobile).
Embedders can register themselves as a `native app
<https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/WebExtension.MessageDelegate.html>`_
@@ -315,28 +291,20 @@ WebView offers, but nothing has been developed so far.
The test runner extension
-------------------------
To run arbitrary javascript in GeckoView, the test runner installs a `support
extension
<https://searchfox.org/firefox-main/source/mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support>`_.
To run arbitrary javascript in GeckoView, the test runner installs a :searchfox:`support extension <mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support>`.
The test framework then `establishes
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1827>`_
The test framework then :searchfox:`establishes <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1827>`
a port for the background script, used to run code in the main process, and a
port for every window, to be able to run javascript on test web pages.
When ``evaluateJS`` is called, the test framework will send `a message
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1912>`_
to the extension which then `calls eval
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support/test-support.js#21>`_
on it and returns the `JSON`-stringified version of the result `back
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1952-1956>`_
When ``evaluateJS`` is called, the test framework will send :searchfox:`a message <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1912>`
to the extension which then :searchfox:`calls eval <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support/test-support.js#21>`
on it and returns the `JSON`-stringified version of the result :searchfox:`back <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1952-1956>`
to the test framework.
The test framework also supports promises with `evaluatePromiseJS
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1888>`_.
The test framework also supports promises with :searchfox:`evaluatePromiseJS <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1888>`.
It works similarly to ``evaluateJS`` but instead of returning the stringified
value, it `sets
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1879>`_
value, it :searchfox:`sets <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1879>`
the return value of the ``eval`` call into the ``this`` object, keyed by a
randomly-generated UUID.
@@ -345,9 +313,7 @@ randomly-generated UUID.
this[uuid] = eval(...)
``evaluatePromiseJS`` then returns an ``ExtensionPromise`` Java object which
has a ``getValue`` method on it, which will essentially execute `await
this[uuid]
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1883-1885>`_
has a ``getValue`` method on it, which will essentially execute :searchfox:`await this[uuid] <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#1883-1885>`
to get the value from the promise when needed.
Beyond executing javascript
@@ -359,13 +325,11 @@ Gecko front-end, which is written in JavaScript, and don't have limits on what
they can do. Experiment extensions are essentially what old add-ons used to be
in Firefox, very powerful and very dangerous.
The test runner uses experiments to offer `privileged APIs
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support/test-api.js>`_
The test runner uses experiments to offer :searchfox:`privileged APIs <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/assets/web_extensions/test-support/test-api.js>`
to tests like ``setPref`` or ``getLinkColor`` (which is not normally available
to websites for privacy concerns).
Each privileged API is exposed as an `ordinary Java API
<https://searchfox.org/mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#2101>`_
Each privileged API is exposed as an :searchfox:`ordinary Java API <mozilla-central/rev/95d8478112eecdd0ee249a941788e03f47df240b:mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java#2101>`
and the test framework doesn't offer a way to run arbitrary chrome code to
discourage developers from relying too much on implementation-dependent
privileged code.
@@ -92,7 +92,7 @@ GeckoViewPdf.sys.mjs
}
async saveToPDF() {
// Reference: https://searchfox.org/firefox-main/source/remote/cdp/domains/parent/Page.sys.mjs#519
// Reference: :searchfox:`remote/cdp/domains/parent/Page.sys.mjs#519`
}
+1 -1
View File
@@ -29,6 +29,6 @@ More information
* Talk to us on `Matrix <https://chat.mozilla.org/#/room/#geckoview:mozilla.org>`_
* `GeckoView Wiki <https://wiki.mozilla.org/Mobile/GeckoView>`_
* `GeckoView Source Code <https://searchfox.org/firefox-main/source/mobile/android/geckoview>`_
* :searchfox:`GeckoView Source Code <mobile/android/geckoview>`
* `Raise a bug on GeckoView code <https://bugzilla.mozilla.org/enter_bug.cgi?product=GeckoView>`_
* `Raise a documentation bug <https://github.com/mozilla/geckoview/issues>`_
+1 -1
View File
@@ -205,7 +205,7 @@ Then the AVD can be created with:
The name passed in argument can be whatever you want and the package is one of
the installed list. It is then required to modify entries within
`android_device.py <https://searchfox.org/mozilla-central/rev/d56687458d4e6e8882c4b740e78413a0f0a69d59/testing/mozbase/mozrunner/mozrunner/devices/android_device.py#101-175>`_ to be able to make use of ``mach android-emulator``,
:searchfox:`android_device.py <mozilla-central/rev/d56687458d4e6e8882c4b740e78413a0f0a69d59:testing/mozbase/mozrunner/mozrunner/devices/android_device.py#101-175>` to be able to make use of ``mach android-emulator``,
changing the definition to match the name of the AVD created above. Example below:
.. code:: diff
+6 -7
View File
@@ -3,8 +3,7 @@ HTTP Cache
This document describes the **HTTP cache implementation**.
The code resides in `/netwerk/cache2 (searchfox)
<https://searchfox.org/firefox-main/source/netwerk/cache2>`_
The code resides in :searchfox:`/netwerk/cache2 (searchfox) <netwerk/cache2>`
API
---
@@ -27,7 +26,7 @@ nsICacheStorageService
- The HTTP cache entry-point. Accessible as a service only, fully
thread-safe, scriptable.
- `nsICacheStorageService.idl (searchfox) <https://searchfox.org/firefox-main/source/netwerk/cache2/nsICacheStorageService.idl>`_
- :searchfox:`nsICacheStorageService.idl (searchfox) <netwerk/cache2/nsICacheStorageService.idl>`
- \ ``"@mozilla.org/netwerk/cache-storage-service;1"``
@@ -73,7 +72,7 @@ nsILoadContextInfo
- Mandatory argument to ``*Storage`` methods of :ref:`nsICacheStorageService <nsICacheStorageService>`.
- `nsILoadContextInfo.idl (searchfox) <https://searchfox.org/firefox-main/source/netwerk/base/nsILoadContextInfo.idl>`_
- :searchfox:`nsILoadContextInfo.idl (searchfox) <netwerk/base/nsILoadContextInfo.idl>`
- It is a helper interface wrapping following four arguments into a single one:
@@ -105,7 +104,7 @@ nsILoadContextInfo
nsICacheStorage
---------------
- `nsICacheStorage.idl (searchfox) <https://searchfox.org/firefox-main/source/netwerk/cache2/nsICacheStorage.idl>`_
- :searchfox:`nsICacheStorage.idl (searchfox) <netwerk/cache2/nsICacheStorage.idl>`
- Obtained from call to one of the ``*Storage`` methods on
:ref:`nsICacheStorageService <nsICacheStorageService>`.
@@ -120,7 +119,7 @@ nsICacheStorage
nsICacheEntryOpenCallback
-------------------------
- `nsICacheEntryOpenCallback.idl (searchfox) <https://searchfox.org/firefox-main/source/netwerk/cache2/nsICacheEntryOpenCallback.idl>`_
- :searchfox:`nsICacheEntryOpenCallback.idl (searchfox) <netwerk/cache2/nsICacheEntryOpenCallback.idl>`
- The result of ``nsICacheStorage.asyncOpenURI`` is always and only
sent to callbacks on this interface.
@@ -145,7 +144,7 @@ nsICacheEntryOpenCallback
nsICacheEntry
-------------
- `nsICacheEntry.idl (searchfox) <https://searchfox.org/firefox-main/source/netwerk/cache2/nsICacheEntry.idl>`_
- :searchfox:`nsICacheEntry.idl (searchfox) <netwerk/cache2/nsICacheEntry.idl>`
- Obtained asynchronously or pseudo-asynchronously by a call to
``nsICacheStorage.asyncOpenURI``.
+52 -39
View File
@@ -7,26 +7,53 @@ HTTP requests in Firefox go through several steps. Each piece of the request me
What is Available When
----------------------
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
| Data | When it's available | Sample JS code | Interfaces | Test code |
+=======================+===================================================+=======================================+========================+===============================+
| HTTP request method | *http-on-modify-request* observer notification | channel.requestMethod | nsIHttpChannel_ | |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
| HTTP request URI | *http-on-modify-request* observer notification | channel.URI | nsIChannel_ | |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
| HTTP request headers | *http-on-modify-request* observer notification | channel.visitRequestHeaders(visitor) | nsIHttpChannel_ | |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
| HTTP request body | *http-on-modify-request* observer notification | channel.uploadStream | nsIUploadChannel_ | |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
|| HTTP response status || *http-on-examine-response* observer notification || channel.responseStatus || nsIHttpChannel_ || test_basic_functionality.js_ |
|| || || channel.responseStatusText || || |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
| HTTP response headers | *http-on-examine-response* observer notification | channel.visitResponseHeaders(visitor) | nsIHttpChannel_ | |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
|| HTTP response body || *onStopRequest* via stream listener tee || See below || nsITraceableChannel_ || test_traceable_channel.js_ |
|| || || || nsIStreamListenerTee_ || |
|| || || || nsIPipe_ || |
+-----------------------+---------------------------------------------------+---------------------------------------+------------------------+-------------------------------+
.. list-table::
:header-rows: 1
:widths: auto
* - Data
- When it's available
- Sample JS code
- Interfaces
- Test code
* - HTTP request method
- *http-on-modify-request* observer notification
- channel.requestMethod
- :searchfox:`nsIHttpChannel <netwerk/protocol/http/nsIHttpChannel.idl>`
-
* - HTTP request URI
- *http-on-modify-request* observer notification
- channel.URI
- :searchfox:`nsIChannel <netwerk/base/nsIChannel.idl>`
-
* - HTTP request headers
- *http-on-modify-request* observer notification
- channel.visitRequestHeaders(visitor)
- :searchfox:`nsIHttpChannel <netwerk/protocol/http/nsIHttpChannel.idl>`
-
* - HTTP request body
- *http-on-modify-request* observer notification
- channel.uploadStream
- :searchfox:`nsIUploadChannel <netwerk/base/nsIUploadChannel.idl>`
-
* - HTTP response status
- *http-on-examine-response* observer notification
- | channel.responseStatus
| channel.responseStatusText
- :searchfox:`nsIHttpChannel <netwerk/protocol/http/nsIHttpChannel.idl>`
- :searchfox:`test_basic_functionality.js <netwerk/test/httpserver/test/test_basic_functionality.js>`
* - HTTP response headers
- *http-on-examine-response* observer notification
- channel.visitResponseHeaders(visitor)
- :searchfox:`nsIHttpChannel <netwerk/protocol/http/nsIHttpChannel.idl>`
-
* - HTTP response body
- *onStopRequest* via stream listener tee
- See below
- | :searchfox:`nsITraceableChannel <netwerk/base/nsITraceableChannel.idl>`
| :searchfox:`nsIStreamListenerTee <netwerk/base/nsIStreamListenerTee.idl>`
| :searchfox:`nsIPipe <xpcom/io/nsIPipe.idl>`
- :searchfox:`test_traceable_channel.js <netwerk/test/unit/test_traceable_channel.js>`
The Request: http-on-modify-request
-----------------------------------
@@ -48,7 +75,7 @@ Attaching a listener for a request is pretty simple::
Services.obs.addObserver(observer, "http-on-modify-request", false);
See nsIObserverService_ for the details.
See :searchfox:`nsIObserverService <xpcom/ds/nsIObserverService.idl>` for the details.
The request method and URI are immediately available at this time. Request headers are trivially easy to get::
@@ -75,9 +102,9 @@ The request method and URI are immediately available at this time. Request head
const visitor = new HeaderVisitor(requestHeaders);
channel.visitRequestHeaders(visitor);
This is also the time to set request headers, if you need to. The method for that on the nsIHttpChannel_ interface is `channel.setRequestHeader(header, value);`
This is also the time to set request headers, if you need to. The method for that on the :searchfox:`nsIHttpChannel <netwerk/protocol/http/nsIHttpChannel.idl>` interface is `channel.setRequestHeader(header, value);`
Most HTTP requests don't have a body, as they are GET requests. POST requests often have them, though. As the nsIUploadChannel_ documentation indicates, the body of most HTTP requests is available via a seekable stream (nsISeekableStream_). So you can simply capture the body stream and its current position, to revisit it later. network-helper.js_ has code to read the request body.
Most HTTP requests don't have a body, as they are GET requests. POST requests often have them, though. As the :searchfox:`nsIUploadChannel <netwerk/base/nsIUploadChannel.idl>` documentation indicates, the body of most HTTP requests is available via a seekable stream (:searchfox:`nsISeekableStream <xpcom/io/nsISeekableStream.idl>`). So you can simply capture the body stream and its current position, to revisit it later. :searchfox:`network-helper.js <devtools/shared/webconsole/network-helper.js>` has code to read the request body.
The Response: http-on-examine-response
--------------------------------------
@@ -175,7 +202,7 @@ Here's some sample code to illustrate what you need::
}
}
test_traceable_channel.js_ does essentially this.
:searchfox:`test_traceable_channel.js <netwerk/test/unit/test_traceable_channel.js>` does essentially this.
Character Encodings and Compression
-----------------------------------
@@ -203,18 +230,4 @@ Order of Operations
Useful Code Samples and References
----------------------------------
- nsIHttpProtocolHandler_ defines a lot of observer topics, and has a lot of details.
.. _nsIHttpChannel: https://searchfox.org/firefox-main/source/netwerk/protocol/http/nsIHttpChannel.idl
.. _nsIChannel: https://searchfox.org/firefox-main/source/netwerk/base/nsIChannel.idl
.. _nsIUploadChannel: https://searchfox.org/firefox-main/source/netwerk/base/nsIUploadChannel.idl
.. _nsITraceableChannel: https://searchfox.org/firefox-main/source/netwerk/base/nsITraceableChannel.idl
.. _nsISeekableStream: https://searchfox.org/firefox-main/source/xpcom/io/nsISeekableStream.idl
.. _nsIObserverService: https://searchfox.org/firefox-main/source/xpcom/ds/nsIObserverService.idl
.. _nsIHttpProtocolHandler: https://searchfox.org/firefox-main/source/netwerk/protocol/http/nsIHttpProtocolHandler.idl
.. _nsIStreamListenerTee: https://searchfox.org/firefox-main/source/netwerk/base/nsIStreamListenerTee.idl
.. _nsIPipe: https://searchfox.org/firefox-main/source/xpcom/io/nsIPipe.idl
.. _test_basic_functionality.js: https://searchfox.org/firefox-main/source/netwerk/test/httpserver/test/test_basic_functionality.js
.. _test_traceable_channel.js: https://searchfox.org/firefox-main/source/netwerk/test/unit/test_traceable_channel.js
.. _network-helper.js: https://searchfox.org/firefox-main/source/devtools/shared/webconsole/network-helper.js
- :searchfox:`nsIHttpProtocolHandler <netwerk/protocol/http/nsIHttpProtocolHandler.idl>` defines a lot of observer topics, and has a lot of details.
+3 -3
View File
@@ -29,7 +29,7 @@ Where You Can Use It
The server is written primarily for use from ``xpcshell``-based
tests, and it can be used as an inline script or as an XPCOM component. The
Mochitest framework also uses it to serve its tests, and
`reftests <https://searchfox.org/firefox-main/source/layout/tools/reftest/README.txt>`__
:searchfox:`reftests <layout/tools/reftest/README.txt>`
can optionally use it when their behavior is dependent upon specific
HTTP header values.
@@ -60,7 +60,7 @@ The best and first place you should look for documentation is
comprehensive and detailed, and it should be enough to figure out how to
make the server do what you want. I also suggest taking a look at the
less-comprehensive server
`README <https://searchfox.org/firefox-main/source/netwerk/test/httpserver/README>`__,
:searchfox:`README <netwerk/test/httpserver/README>`,
although the IDL should usually be sufficient.
Running the Server
@@ -112,7 +112,7 @@ because the error-dispatch mechanism doesn't currently accommodate doing
so and partly because exposing errors in a real server could make it
easier to exploit them. If you don't know why the server is acting a
particular way, edit
`httpd.sys.mjs <https://searchfox.org/firefox-main/source/netwerk/test/httpserver/httpd.sys.mjs>`__
:searchfox:`httpd.sys.mjs <netwerk/test/httpserver/httpd.sys.mjs>`
and change the value of ``DEBUG`` to ``true``. This will cause the
server to print information about the processing of requests (and errors
encountered doing so) to the console, and it's usually not difficult to
+1 -1
View File
@@ -147,4 +147,4 @@ The settings file follows the ``ini`` format, e.g:
default = fuzzy
.. _bash completion: https://searchfox.org/firefox-main/source/python/mach/bash-completion.sh
.. _bash completion: :searchfox:`python/mach/bash-completion.sh`

Some files were not shown because too many files have changed in this diff Show More