Bug 1565410 - Don't expose BundleEventListener in the API. r=esawin

This also updates apilint to 0.2.2 to ensure that future instances of this
problem will be caught automatically.

Differential Revision: https://phabricator.services.mozilla.com/D37812

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Agi Sferro 2019-07-17 15:48:58 +00:00
Родитель 4172b0bfee
Коммит 2b4677581d
4 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -83,7 +83,7 @@ buildscript {
}
dependencies {
classpath 'org.mozilla.apilint:apilint:0.2.1'
classpath 'org.mozilla.apilint:apilint:0.2.2'
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
classpath 'org.apache.commons:commons-exec:1.3'

Просмотреть файл

@ -56,9 +56,6 @@ import java.util.AbstractSequentialList;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.geckoview.AllowOrDeny;
import org.mozilla.geckoview.CompositorController;
import org.mozilla.geckoview.ContentBlocking;
@ -1108,7 +1105,7 @@ package org.mozilla.geckoview {
method default public void onPortMessage(@NonNull Object, @NonNull WebExtension.Port);
}
public class WebExtensionController implements BundleEventListener {
public class WebExtensionController {
ctor protected WebExtensionController(GeckoRuntime, WebExtensionEventDispatcher);
method @UiThread @Nullable public WebExtensionController.TabDelegate getTabDelegate();
method @UiThread public void setTabDelegate(@Nullable WebExtensionController.TabDelegate);

Просмотреть файл

@ -8,7 +8,7 @@ import org.mozilla.gecko.util.BundleEventListener;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.util.GeckoBundle;
public class WebExtensionController implements BundleEventListener {
public class WebExtensionController {
public interface TabDelegate {
/**
* Called when tabs.create is invoked, this method returns a *newly-created* session
@ -28,10 +28,23 @@ public class WebExtensionController implements BundleEventListener {
private GeckoRuntime mRuntime;
private WebExtensionEventDispatcher mDispatcher;
private TabDelegate mTabDelegate;
private final EventListener mEventListener;
protected WebExtensionController(final GeckoRuntime runtime, final WebExtensionEventDispatcher dispatcher) {
mRuntime = runtime;
mDispatcher = dispatcher;
mEventListener = new EventListener();
}
private class EventListener implements BundleEventListener {
@Override
public void handleMessage(final String event, final GeckoBundle message,
final EventCallback callback) {
if ("GeckoView:WebExtension:NewTab".equals(event)) {
newTab(message, callback);
return;
}
}
}
@UiThread
@ -39,14 +52,14 @@ public class WebExtensionController implements BundleEventListener {
if (delegate == null) {
if (mTabDelegate != null) {
EventDispatcher.getInstance().unregisterUiThreadListener(
this,
mEventListener,
"GeckoView:WebExtension:NewTab"
);
}
} else {
if (mTabDelegate == null) {
EventDispatcher.getInstance().registerUiThreadListener(
this,
mEventListener,
"GeckoView:WebExtension:NewTab"
);
}
@ -89,13 +102,4 @@ public class WebExtensionController implements BundleEventListener {
callback.sendSuccess(session.getId());
});
}
@Override
public void handleMessage(final String event, final GeckoBundle message,
final EventCallback callback) {
if ("GeckoView:WebExtension:NewTab".equals(event)) {
newTab(message, callback);
return;
}
}
}

Просмотреть файл

@ -347,4 +347,4 @@ exclude: true
[65.24]: ../CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: ../GeckoResult.html
[api-version]: 3d726407275d906a54c1fc86eb92f2c3bfaaa3d0
[api-version]: 29a6f7c954300f7faaf3073add8a23afbe50197d