зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 92ed8a00d24f (bug 1674500) for lint failures. CLOSED TREE
This commit is contained in:
Родитель
7c83560854
Коммит
3e4030f9b6
|
@ -431,6 +431,7 @@ package org.mozilla.geckoview {
|
|||
method @NonNull @UiThread public GeckoResult<List<ContentBlockingController.LogEntry>> getLog(@NonNull GeckoSession);
|
||||
method @UiThread public void removeException(@NonNull GeckoSession);
|
||||
method @AnyThread public void removeException(@NonNull ContentBlockingController.ContentBlockingException);
|
||||
method @Deprecated @DeprecationSchedule(version=85,id="exception-list") @UiThread public void restoreExceptionList(@NonNull ContentBlockingController.ExceptionList);
|
||||
method @AnyThread public void restoreExceptionList(@NonNull List<ContentBlockingController.ContentBlockingException>);
|
||||
method @NonNull @UiThread public GeckoResult<List<ContentBlockingController.ContentBlockingException>> saveExceptionList();
|
||||
}
|
||||
|
@ -466,6 +467,13 @@ package org.mozilla.geckoview {
|
|||
field @Deprecated @DeprecationSchedule(version=86,id="unsafe-content") public static final int REPLACED_UNSAFE_CONTENT = 16;
|
||||
}
|
||||
|
||||
@Deprecated @DeprecationSchedule(version=85,id="exception-list") @AnyThread public class ContentBlockingController.ExceptionList {
|
||||
ctor public ExceptionList(@NonNull String);
|
||||
ctor public ExceptionList(@NonNull JSONObject);
|
||||
method @NonNull public String[] getUris();
|
||||
method @NonNull public JSONObject toJson();
|
||||
}
|
||||
|
||||
@AnyThread public static class ContentBlockingController.LogEntry {
|
||||
ctor protected LogEntry();
|
||||
field @NonNull public final List<ContentBlockingController.LogEntry.BlockingData> blockingData;
|
||||
|
|
|
@ -78,6 +78,89 @@ public class ContentBlockingController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ExceptionList represents a content blocking exception list exported
|
||||
* from Gecko. It can be used to persist the list or to inspect the URIs
|
||||
* present in the list.
|
||||
*/
|
||||
@Deprecated
|
||||
@DeprecationSchedule(version = 85, id = "exception-list")
|
||||
@AnyThread
|
||||
public class ExceptionList {
|
||||
private final @NonNull GeckoBundle mBundle;
|
||||
|
||||
/* package */ ExceptionList(final @NonNull GeckoBundle bundle) {
|
||||
mBundle = new GeckoBundle(bundle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URIs currently on the content blocking exception list.
|
||||
*
|
||||
* @return A string array containing the URIs.
|
||||
*/
|
||||
public @NonNull String[] getUris() {
|
||||
return mBundle.getStringArray("uris");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the content blocking exception list.
|
||||
* May be null if the JSON to string conversion fails for any reason.
|
||||
*
|
||||
* @return A string representing the exception list.
|
||||
*/
|
||||
@Override
|
||||
public @Nullable String toString() {
|
||||
String res;
|
||||
try {
|
||||
res = mBundle.toJSONObject().toString();
|
||||
} catch (JSONException e) {
|
||||
Log.e(LOGTAG, "Could not convert session state to string.");
|
||||
res = null;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a JSONObject representation of the content blocking exception list.
|
||||
*
|
||||
* @return A JSONObject representing the exception list.
|
||||
*
|
||||
* @throws JSONException if conversion to JSONObject fails.
|
||||
*/
|
||||
public @NonNull JSONObject toJson() throws JSONException {
|
||||
return mBundle.toJSONObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception list from a string. The string should be valid
|
||||
* output from {@link #toString}.
|
||||
*
|
||||
* @param savedList A string representation of a saved exception list.
|
||||
*
|
||||
* @throws JSONException if the string representation no longer represents valid JSON.
|
||||
*/
|
||||
public ExceptionList(final @NonNull String savedList) throws JSONException {
|
||||
mBundle = GeckoBundle.fromJSONObject(new JSONObject(savedList));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception list from a JSONObject. The JSONObject should be valid
|
||||
* output from {@link #toJson}.
|
||||
*
|
||||
* @param savedList A JSONObject representation of a saved exception list.
|
||||
*
|
||||
* @throws JSONException if the JSONObject cannot be converted for any reason.
|
||||
*/
|
||||
public ExceptionList(final @NonNull JSONObject savedList) throws JSONException {
|
||||
mBundle = GeckoBundle.fromJSONObject(savedList);
|
||||
}
|
||||
|
||||
/* package */ GeckoBundle getBundle() {
|
||||
return mBundle;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a content blocking exception for the site currently loaded by the supplied
|
||||
* {@link GeckoSession}.
|
||||
|
@ -178,6 +261,18 @@ public class ContentBlockingController {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the supplied {@link ExceptionList}, overwriting the existing exception list.
|
||||
*
|
||||
* @param list An {@link ExceptionList} originally created by {@link #saveExceptionList}.
|
||||
*/
|
||||
@Deprecated
|
||||
@DeprecationSchedule(version = 85, id = "exception-list")
|
||||
@UiThread
|
||||
public void restoreExceptionList(final @NonNull ExceptionList list) {
|
||||
EventDispatcher.getInstance().dispatch("ContentBlocking:RestoreList", list.getBundle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the supplied List of {@link ContentBlockingException}, overwriting the existing exception list.
|
||||
*
|
||||
|
|
|
@ -21,8 +21,6 @@ exclude: true
|
|||
includes the `version` that we expect to remove the member and an `id` that
|
||||
can be used to group annotation notices in tooling.
|
||||
([bug 1671460]({{bugzilla}}1671460))
|
||||
- ⚠️ Removed deprecated [`ContentBlockingController.ExceptionList`] abd
|
||||
[`ContentBlockingController.restoreExceptionList`]. ([bug 1674500]({{bugzilla}}1674500))
|
||||
|
||||
[84.1]: {{javadoc_uri}}/DeprecationSchedule.html
|
||||
|
||||
|
@ -849,4 +847,4 @@ to allow adding gecko profiler markers.
|
|||
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
|
||||
[65.25]: {{javadoc_uri}}/GeckoResult.html
|
||||
|
||||
[api-version]: 2e4e0b4fb29ca63851687ac1020d9d51589476ce
|
||||
[api-version]: 642c42359bac29b766e9788dd78e90244290f953
|
||||
|
|
Загрузка…
Ссылка в новой задаче