mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 938827 - Part 9: Remove unregisterEventListener reflection. r=rnewman
This commit is contained in:
parent
7db5286fab
commit
be30179d74
@ -42,9 +42,7 @@ public class FennecNativeActions implements Actions {
|
||||
// Objects for reflexive access of fennec classes.
|
||||
private ClassLoader mClassLoader;
|
||||
private Class mApiClass;
|
||||
private Class mEventListenerClass;
|
||||
private Class mDrawListenerClass;
|
||||
private Method mUnregisterEventListener;
|
||||
private Method mSetDrawListener;
|
||||
private Object mRobocopApi;
|
||||
|
||||
@ -62,10 +60,8 @@ public class FennecNativeActions implements Actions {
|
||||
mClassLoader = activity.getClassLoader();
|
||||
|
||||
mApiClass = mClassLoader.loadClass("org.mozilla.gecko.RobocopAPI");
|
||||
mEventListenerClass = mClassLoader.loadClass("org.mozilla.gecko.util.GeckoEventListener");
|
||||
mDrawListenerClass = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoLayerClient$DrawListener");
|
||||
|
||||
mUnregisterEventListener = mApiClass.getMethod("unregisterEventListener", String.class, mEventListenerClass);
|
||||
mSetDrawListener = mApiClass.getMethod("setDrawListener", mDrawListenerClass);
|
||||
|
||||
mRobocopApi = mApiClass.getConstructor(Activity.class).newInstance(activity);
|
||||
@ -189,17 +185,11 @@ public class FennecNativeActions implements Actions {
|
||||
throw new IllegalStateException("listener not registered");
|
||||
}
|
||||
|
||||
try {
|
||||
FennecNativeDriver.log(LogLevel.INFO, "EventExpecter: no longer listening for "+mGeckoEvent);
|
||||
FennecNativeDriver.log(LogLevel.INFO,
|
||||
"EventExpecter: no longer listening for " + mGeckoEvent);
|
||||
|
||||
mUnregisterEventListener.invoke(mRobocopApi,
|
||||
new Object[] { mGeckoEvent, mListener });
|
||||
mIsRegistered = false;
|
||||
} catch (IllegalAccessException e) {
|
||||
FennecNativeDriver.log(LogLevel.ERROR, e);
|
||||
} catch (InvocationTargetException e) {
|
||||
FennecNativeDriver.log(LogLevel.ERROR, e);
|
||||
}
|
||||
GeckoAppShell.unregisterEventListener(mGeckoEvent, mListener);
|
||||
mIsRegistered = false;
|
||||
}
|
||||
|
||||
public boolean eventReceived() {
|
||||
|
@ -2307,6 +2307,7 @@ public class GeckoAppShell
|
||||
* any removed listeners will still be invoked on the event currently being processed, but
|
||||
* will not be invoked on future events of that type.
|
||||
*/
|
||||
@RobocopTarget
|
||||
public static void unregisterEventListener(String event, GeckoEventListener listener) {
|
||||
sEventDispatcher.unregisterEventListener(event, listener);
|
||||
}
|
||||
|
@ -41,10 +41,6 @@ public class RobocopAPI {
|
||||
mGeckoApp = (GeckoApp)activity;
|
||||
}
|
||||
|
||||
public void unregisterEventListener(String event, GeckoEventListener listener) {
|
||||
GeckoAppShell.unregisterEventListener(event, listener);
|
||||
}
|
||||
|
||||
public void setDrawListener(GeckoLayerClient.DrawListener listener) {
|
||||
GeckoAppShell.getLayerView().getLayerClient().setDrawListener(listener);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user