Bug 1489669 Comment 8 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

I think we could provide a powerful API here by exposing a subset of [nsIClearDataService](https://searchfox.org/mozilla-central/source/toolkit/components/cleardata/nsIClearDataService.idl) through our StorageController` API.

Proposed API:
```
class StorageController {
  class ClearFlags {
    COOKIES
    NETWORK_CACHE
    IMAGE_CACHE
    HISTORY
    DOM_STORAGES
    AUTH_SESSIONS
    PERMISSIONS
    ALL_CACHES
    SITE_SETTINGS
    SITE_DATA
    ALL
  }

  void clearDataFromHost(String host, ClearFlags flags)

  void clearDataInTimeRange(Time from, Time to, ClearFlags flags)

  void clearData(ClearFlags flags)
}
```

The `ClearFlags` selection would be composed based on desktop's [Sanitizer setup](https://searchfox.org/mozilla-central/source/browser/modules/Sanitizer.jsm#320) to provide a powerful yet not overloaded API.

The `ClearFlags` constants would need to maintain a consistent mapping to `nsIClearDataService`, which we hopefully can monitor through tests. Any additions to `nsIClearDataService` would need to be exposed through the GV API, if applicable.

Baku and snorp, do you see any issues with exposing this API to app consumers and would you agree with the proposed flag selection?
I think we could provide a powerful API here by exposing a subset of [nsIClearDataService](https://searchfox.org/mozilla-central/source/toolkit/components/cleardata/nsIClearDataService.idl) through our `StorageController` API.

Proposed API:
```
class StorageController {
  class ClearFlags {
    COOKIES
    NETWORK_CACHE
    IMAGE_CACHE
    HISTORY
    DOM_STORAGES
    AUTH_SESSIONS
    PERMISSIONS
    ALL_CACHES
    SITE_SETTINGS
    SITE_DATA
    ALL
  }

  void clearDataFromHost(String host, ClearFlags flags)

  void clearDataInTimeRange(Time from, Time to, ClearFlags flags)

  void clearData(ClearFlags flags)
}
```

The `ClearFlags` selection would be composed based on desktop's [Sanitizer setup](https://searchfox.org/mozilla-central/source/browser/modules/Sanitizer.jsm#320) to provide a powerful yet not overloaded API.

The `ClearFlags` constants would need to maintain a consistent mapping to `nsIClearDataService`, which we hopefully can monitor through tests. Any additions to `nsIClearDataService` would need to be exposed through the GV API, if applicable.

Baku and snorp, do you see any issues with exposing this API to app consumers and would you agree with the proposed flag selection?
I think we could provide a powerful API here by exposing a subset of [nsIClearDataService](https://searchfox.org/mozilla-central/source/toolkit/components/cleardata/nsIClearDataService.idl) through our `StorageController` API.

Proposed API:
```
StorageController {
  ClearFlags {
    COOKIES
    NETWORK_CACHE
    IMAGE_CACHE
    HISTORY
    DOM_STORAGES
    AUTH_SESSIONS
    PERMISSIONS
    ALL_CACHES
    SITE_SETTINGS
    SITE_DATA
    ALL
  }

  void clearDataFromHost(String host, ClearFlags flags)

  void clearDataInTimeRange(Time from, Time to, ClearFlags flags)

  void clearData(ClearFlags flags)
}
```

The `ClearFlags` selection would be composed based on desktop's [Sanitizer setup](https://searchfox.org/mozilla-central/source/browser/modules/Sanitizer.jsm#320) to provide a powerful yet not overloaded API.

The `ClearFlags` constants would need to maintain a consistent mapping to `nsIClearDataService`, which we hopefully can monitor through tests. Any additions to `nsIClearDataService` would need to be exposed through the GV API, if applicable.

Baku and snorp, do you see any issues with exposing this API to app consumers and would you agree with the proposed flag selection?
I think we could provide a powerful API here by exposing a subset of [nsIClearDataService](https://searchfox.org/mozilla-central/source/toolkit/components/cleardata/nsIClearDataService.idl) through our `StorageController` API.

Proposed API:
```
StorageController {
  ClearFlags {
    COOKIES
    NETWORK_CACHE
    IMAGE_CACHE
    HISTORY
    DOM_STORAGES
    AUTH_SESSIONS
    PERMISSIONS
    ALL_CACHES
    SITE_SETTINGS
    SITE_DATA
    ALL // 0xFFFFFF so shouldn't be affected by changing or new flags
  }

  void clearDataFromHost(String host, ClearFlags flags)

  void clearDataInTimeRange(Time from, Time to, ClearFlags flags)

  void clearData(ClearFlags flags)
}
```

The `ClearFlags` selection would be composed based on desktop's [Sanitizer setup](https://searchfox.org/mozilla-central/source/browser/modules/Sanitizer.jsm#320) to provide a powerful yet not overloaded API.

The `ClearFlags` constants would need to maintain a consistent mapping to `nsIClearDataService`, which we hopefully can monitor through tests. Any additions to `nsIClearDataService` would need to be exposed through the GV API, if applicable.

Baku and snorp, do you see any issues with exposing this API to app consumers and would you agree with the proposed flag selection?

Back to Bug 1489669 Comment 8