mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 941868 - Part 4: tidying and enforcing TabEvent non-null-tab constraint. r=mcomella
This commit is contained in:
parent
77b88f7249
commit
f5a359892b
@ -197,6 +197,16 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
@Override
|
||||
public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
|
||||
if (tab == null) {
|
||||
// Only RESTORED is allowed a null tab: it's the only event that
|
||||
// isn't tied to a specific tab.
|
||||
if (msg != Tabs.TabEvents.RESTORED) {
|
||||
throw new IllegalArgumentException("onTabChanged:" + msg + " must specify a tab.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Log.d(LOGTAG, "BrowserApp.onTabChanged: " + tab.getId() + ": " + msg);
|
||||
switch(msg) {
|
||||
case LOCATION_CHANGE:
|
||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||
@ -1428,10 +1438,13 @@ abstract public class BrowserApp extends GeckoApp
|
||||
private void maybeCancelFaviconLoad(Tab tab) {
|
||||
int faviconLoadId = tab.getFaviconLoadId();
|
||||
|
||||
// Cancel pending favicon load task
|
||||
Favicons.cancelFaviconLoad(faviconLoadId);
|
||||
if (Favicons.NOT_LOADING == faviconLoadId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset favicon load state
|
||||
// Cancel load task and reset favicon load state if it wasn't already
|
||||
// in NOT_LOADING state.
|
||||
Favicons.cancelFaviconLoad(faviconLoadId);
|
||||
tab.setFaviconLoadId(Favicons.NOT_LOADING);
|
||||
}
|
||||
|
||||
|
@ -562,6 +562,11 @@ public class Tabs implements GeckoEventListener {
|
||||
|
||||
// Throws if not initialized.
|
||||
public void notifyListeners(final Tab tab, final TabEvents msg, final Object data) {
|
||||
if (tab == null &&
|
||||
msg != TabEvents.RESTORED) {
|
||||
throw new IllegalArgumentException("onTabChanged:" + msg + " must specify a tab.");
|
||||
}
|
||||
|
||||
ThreadUtils.postToUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
Loading…
Reference in New Issue
Block a user