Bug 1601067 - Only send ActionDelegate:Attached when the delegate is not null. r=snorp

We use this to send a default action to the embedder, but if no one is
listening there's no point, and it causes problems in tests because sometimes
the delegate is attached / reattached too quickly and the second delegate will
end up getting two messages by mistake.

Differential Revision: https://phabricator.services.mozilla.com/D72974
This commit is contained in:
Agi Sferro 2020-05-05 20:54:00 +00:00
Родитель 04097efffa
Коммит df91383e8d
1 изменённых файлов: 4 добавлений и 2 удалений

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

@ -1578,8 +1578,10 @@ public class WebExtension {
final GeckoBundle bundle = new GeckoBundle(1); final GeckoBundle bundle = new GeckoBundle(1);
bundle.putString("extensionId", id); bundle.putString("extensionId", id);
EventDispatcher.getInstance().dispatch( if (delegate != null) {
"GeckoView:ActionDelegate:Attached", bundle); EventDispatcher.getInstance().dispatch(
"GeckoView:ActionDelegate:Attached", bundle);
}
} }
/** Describes the signed status for a {@link WebExtension}. /** Describes the signed status for a {@link WebExtension}.