зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1501108 - [3.6] Extend StorageController API to delete session context data. r=baku,snorp,geckoview-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D23732 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a953b9ae74
Коммит
10b4aa39cc
|
@ -65,7 +65,11 @@ GeckoViewStartup.prototype = {
|
|||
|
||||
GeckoViewUtils.addLazyGetter(this, "GeckoViewStorageController", {
|
||||
module: "resource://gre/modules/GeckoViewStorageController.jsm",
|
||||
ged: ["GeckoView:ClearData", "GeckoView:ClearHostData"],
|
||||
ged: [
|
||||
"GeckoView:ClearData",
|
||||
"GeckoView:ClearSessionContextData",
|
||||
"GeckoView:ClearHostData",
|
||||
],
|
||||
});
|
||||
|
||||
GeckoViewUtils.addLazyPrefObserver(
|
||||
|
|
|
@ -1047,6 +1047,7 @@ package org.mozilla.geckoview {
|
|||
public final class StorageController {
|
||||
ctor public StorageController();
|
||||
method @AnyThread @NonNull public GeckoResult<Void> clearData(long);
|
||||
method @AnyThread public void clearDataForSessionContext(@NonNull String);
|
||||
method @AnyThread @NonNull public GeckoResult<Void> clearDataFromHost(@NonNull String, long);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,10 @@ public final class GeckoSessionSettings implements Parcelable {
|
|||
* between sessions, only sessions that share the same ID share storage
|
||||
* data.
|
||||
*
|
||||
* Warning: Storage data is collected persistently for each context,
|
||||
* to delete context data, call {@link StorageController#clearDataForSessionContext}
|
||||
* for the given context.
|
||||
*
|
||||
* @param value The custom context ID.
|
||||
* The default ID is null, which removes isolation for this
|
||||
* instance.
|
||||
|
|
|
@ -160,4 +160,24 @@ public final class StorageController {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear data for the given context ID.
|
||||
* Use {@link GeckoSessionSettings.Builder#contextId}.to set a context ID
|
||||
* for a session.
|
||||
*
|
||||
* Note: Any open session may re-accumulate previously cleared data. To
|
||||
* ensure that no persistent data is left behind, you need to close all
|
||||
* sessions for the given context prior to clearing data.
|
||||
*
|
||||
* @param contextId The context ID for the storage data to be deleted.
|
||||
*/
|
||||
@AnyThread
|
||||
public void clearDataForSessionContext(final @NonNull String contextId) {
|
||||
final GeckoBundle bundle = new GeckoBundle(1);
|
||||
bundle.putString("contextId", contextId);
|
||||
|
||||
EventDispatcher.getInstance().dispatch(
|
||||
"GeckoView:ClearSessionContextData", bundle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,6 +143,13 @@ exclude: true
|
|||
|
||||
[68.28]: ./GeckoSession.MediaSource.html
|
||||
|
||||
- Added API for session context assignment
|
||||
[`GeckoSessionSettings.Builder.contextId`][68.29] and deletion of data
|
||||
related to a session context
|
||||
[`StorageController.clearSessionContextData`][68.30].
|
||||
|
||||
[68.29]: ../GeckoSessionSettings.Builder.html#contextId-
|
||||
[68.30]: ../StorageController.html#clearSessionContextData-java.lang.String-
|
||||
|
||||
## v67
|
||||
- Added [`setAutomaticFontSizeAdjustment`][67.2] to
|
||||
|
|
|
@ -98,6 +98,10 @@ const GeckoViewStorageController = {
|
|||
this.clearData(aData.flags, aCallback);
|
||||
break;
|
||||
}
|
||||
case "GeckoView:ClearSessionContextData": {
|
||||
this.clearSessionContextData(aData.contextId);
|
||||
break;
|
||||
}
|
||||
case "GeckoView:ClearHostData": {
|
||||
this.clearHostData(aData.host, aData.flags, aCallback);
|
||||
break;
|
||||
|
@ -132,6 +136,7 @@ const GeckoViewStorageController = {
|
|||
Services.clearData.deleteDataFromOriginAttributesPattern(pattern);
|
||||
// Call QMS explicitly to work around bug 1537882.
|
||||
Services.qms.clearStoragesForOriginAttributesPattern(
|
||||
JSON.stringify(pattern));
|
||||
JSON.stringify(pattern)
|
||||
);
|
||||
},
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче