Files
tubestation/dom/chrome-webidl/PlacesEvent.webidl
Doug Thayer eb85f05a47 Bug 1340498 - Implement new Places Observers interface r=mrbkap
See the design doc[1] for further info. We would like to redesign
the places observer system to be more performant and more friendly
to consume. WebIDL was recommended as it simplifies creating simple
dictionary payloads while allowing dynamic typing with `any`.

There were some difficulties with WebIDL though, most of which
revolved around allowing consumers to be weakly referenced, from
both C++ and JS. The simplest solution I could come up with was to
create a simple native interface for the C++ case, and a WebIDL
wrapper for a JS callback in the JS case. Suggestions for simpler
alternatives are very welcome though.

[1] https://docs.google.com/document/d/1G45vfd6RXFXwNz7i4FV40lDCU0ao-JX_bZdgJV4tLjk/edit?usp=sharing

MozReview-Commit-ID: ACnAEfa5WxO
2018-02-14 09:06:15 -08:00

70 lines
1.5 KiB
Plaintext

enum PlacesEventType {
"none",
/**
* data: PlacesVisit. Fired whenever a page is visited.
*/
"page-visited",
};
[ChromeOnly, Exposed=(Window,System)]
interface PlacesEvent {
readonly attribute PlacesEventType type;
};
[ChromeOnly, Exposed=(Window,System)]
interface PlacesVisit : PlacesEvent {
/**
* URL of the visit.
*/
readonly attribute DOMString url;
/**
* Id of the visit.
*/
readonly attribute unsigned long long visitId;
/**
* Time of the visit, in milliseconds since epoch.
*/
readonly attribute unsigned long long visitTime;
/**
* The id of the visit the user came from, defaults to 0 for no referrer.
*/
readonly attribute unsigned long long referringVisitId;
/**
* One of nsINavHistory.TRANSITION_*
*/
readonly attribute unsigned long transitionType;
/**
* The unique id associated with the page.
*/
readonly attribute ByteString pageGuid;
/**
* Whether the visited page is marked as hidden.
*/
readonly attribute boolean hidden;
/**
* Number of visits (including this one) for this URL.
*/
readonly attribute unsigned long visitCount;
/**
* Whether the URL has been typed or not.
* TODO (Bug 1271801): This will become a count, rather than a boolean.
* For future compatibility, always compare it with "> 0".
*/
readonly attribute unsigned long typedCount;
/**
* The last known title of the page. Might not be from the current visit,
* and might be null if it is not known.
*/
readonly attribute DOMString? lastKnownTitle;
};