diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/PanZoomControllerImpl.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/PanZoomControllerImpl.java index 144707afe8..ee508feddf 100644 --- a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/PanZoomControllerImpl.java +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/PanZoomControllerImpl.java @@ -1,5 +1,6 @@ package com.igalia.wolvic.browser.api.impl; +import android.util.Log; import android.view.MotionEvent; import android.view.ViewGroup; @@ -16,11 +17,19 @@ public PanZoomControllerImpl(SessionImpl session) { @Override public void onTouchEvent(@NonNull MotionEvent event) { + if (getContentView() == null) { + Log.w("PanZoomControllerImpl", "called onTouchEvent() but getContentView() is null"); + return; + } getContentView().dispatchTouchEvent(event); } @Override public void onMotionEvent(@NonNull MotionEvent event) { + if (getContentView() == null) { + Log.w("PanZoomControllerImpl", "called onMotionEvent() but getContentView() is null"); + return; + } getContentView().dispatchGenericMotionEvent(event); } diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabImpl.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabImpl.java index e05cef133a..84a16d8774 100644 --- a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabImpl.java +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabImpl.java @@ -59,6 +59,8 @@ public void purgeHistory() { public void setPaymentWebContents(WebContents webContents, ContentView contentView, TabCompositorView compositorView) { Log.e("MYSH", "set PaymentWebContents webContents=" + webContents + " contentView="+ contentView + " compositorView="+ compositorView); + //setWebContentsDelegate(webContents, mTabWebContentsDelegate); + mPaymentHandlerWebContents = webContents; mPaymentHandlerContentView = contentView; mPaymentHandlerCompositorView = compositorView; diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsDelegate.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsDelegate.java index 86be9a226d..05afd3bf38 100644 --- a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsDelegate.java +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsDelegate.java @@ -134,8 +134,13 @@ public void onCreateNewWindow(WebContents webContents) { @Override public void closeContents() { + Log.w(LOGTAG, "closeContents"); WSession.ContentDelegate delegate = mSession.getContentDelegate(); - assert delegate != null; + //assert delegate != null; + if (delegate == null) { + Log.w(LOGTAG, "Trying to close contents when delegate is null"); + return; + } PostTask.postDelayedTask(TaskTraits.UI_DEFAULT, () -> { delegate.onCloseRequest(mSession); diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsObserver.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsObserver.java index 5b7243f6ef..4588c27d18 100644 --- a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsObserver.java +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/TabWebContentsObserver.java @@ -160,6 +160,7 @@ public void onCreateNewPaymentHandler(final WebContents newWebContents) { assert viewDelegate.getContainerView() instanceof ContentView : "WebContents should not set container views other than ContentView."; + mTab.setWebContentsDelegate(newWebContents, new TabWebContentsDelegate(mSession, newWebContents)); mTab.setPaymentWebContents(newWebContents, (ContentView) viewDelegate.getContainerView(), compositorView); WDisplay display = mSession.acquireOverlayDisplay(compositorView); diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java index 9542263557..6cc6ffa840 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/WindowWidget.java @@ -1754,6 +1754,7 @@ public void onFullScreen(@NonNull WSession session, boolean aFullScreen) { @Override public void onCloseRequest(@NonNull WSession aSession) { + Log.w(LOGTAG, "onCloseRequest"); Session session = SessionStore.get().getSession(aSession); mWidgetManager.getWindows().onTabsClose(Collections.singletonList(session)); }