You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.
Similar to Favicon loading in browser/actors/LinkHandlerChild.jsm, we make use of the JSWindowActor APIs.
browser/actors/WebMonetizationChild.jsm interacts with the document to run the observable mechanics. It is responsible to find the valid monetization element (at any time), running the fetch and process steps and communicating with browser/actors/WebMonetizationParent.jsm.
The MonetizationService in browser/actors/WebMonetizationParent.jsm is responsible for managing and communicating the monetization state across all documents. The WebMonetizationParent can also control the browser UI and manage payment history.
WebMonetizationParent and MonetizationService also communicate start/stop/pause/resume events to the browser extensions with "webmonetization" permission. They're also listen to "completePayment" and "refresh" requests from the extension. All event management is done via the Services.io message passing API.
The extension uses "completePayment(sessionId, amount)" to notify the browser for a completed payment, and the browser in turn dispatches MonetizationProgressEvent to window.monetization for the relevant document. The document can listen to the MonetizationProgressEvent as window.monetization.addEventListener("progress", ev).
The extension can also request a refresh(sessionId) when it deems necessary (primarily on expiration of previous SPSP response). The browser then runs the fetch and process steps for the document/activeEl corresponding to sessionId, stops payments for sessionId (by dispatching a stop(sessionId) to the extension), and starts a new payment (by dispatching a start(newSessionId, newSpspResponse) to the extension). The call to refresh(sessionId) resolves with a newSessionId.
Similar to Favicon loading in
browser/actors/LinkHandlerChild.jsm
, we make use of theJSWindowActor
APIs.browser/actors/WebMonetizationChild.jsm
interacts with the document to run the observable mechanics. It is responsible to find the valid monetization element (at any time), running the fetch and process steps and communicating withbrowser/actors/WebMonetizationParent.jsm
.The
MonetizationService
inbrowser/actors/WebMonetizationParent.jsm
is responsible for managing and communicating the monetization state across all documents. TheWebMonetizationParent
can also control the browser UI and manage payment history.WebMonetizationParent
andMonetizationService
also communicate start/stop/pause/resume events to the browser extensions with "webmonetization" permission. They're also listen to "completePayment" and "refresh" requests from the extension. All event management is done via theServices.io
message passing API.The extension uses
"completePayment(sessionId, amount)"
to notify the browser for a completed payment, and the browser in turn dispatchesMonetizationProgressEvent
towindow.monetization
for the relevant document. The document can listen to the MonetizationProgressEvent aswindow.monetization.addEventListener("progress", ev)
.The extension can also request a
refresh(sessionId)
when it deems necessary (primarily on expiration of previous SPSP response). The browser then runs the fetch and process steps for the document/activeEl
corresponding tosessionId
, stops payments forsessionId
(by dispatching astop(sessionId)
to the extension), and starts a new payment (by dispatching astart(newSessionId, newSpspResponse
) to the extension). The call torefresh(sessionId)
resolves with anewSessionId
.monetization-src
CSP directiveSee 6ad0f18
MonetizationProgressEvent
andWindow.Monetization
interfaceWebIDL interfaces
MonetizationProgressEvent
Monetization
Window
interfaceImplementation
Window.Monetization
+dom/base/nsGlobalWindowInner.cpp
MonetizationProgressEvent
Extension API
toolkit/components/extensions/schemas/monetization.json
toolkit/components/extensions/parent/ext-monetization.js
The text was updated successfully, but these errors were encountered: