Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Jan 4, 2025
1 parent ea0ef33 commit 2845028
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.igalia.wolvic.browser.api.impl;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

Expand Down Expand Up @@ -108,6 +110,8 @@ public void didStopLoading(GURL url, boolean isKnownValid) {

@Override
public void didFailLoad(boolean isInPrimaryMainFrame, int errorCode, GURL failingUrl, @LifecycleState int rfhLifecycleState) {
Log.e("ChromiumErrorPage", "Chromium error code: " + errorCode);

@Nullable WSession.ProgressDelegate delegate = mSession.getProgressDelegate();
if (delegate != null && isInPrimaryMainFrame) {
delegate.onPageStop(mSession, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.igalia.wolvic.browser.api.impl;

import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

Expand Down Expand Up @@ -66,6 +68,8 @@ public GeckoResult<GeckoSession> onNewSession(@NonNull GeckoSession session, @No
@Nullable
@Override
public GeckoResult<String> onLoadError(@NonNull GeckoSession session, @Nullable String uri, @NonNull WebRequestError error) {
Log.e("ChromiumErrorPage", "Gecko error code: " + error);

return ResultImpl.from(mDelegate.onLoadError(mSession, uri, new WWebRequestError() {
@Override
public int code() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import mozilla.components.browser.errorpages.ErrorType;

import org.chromium.net.NetError;
//import org.chromium.net.NetError;

public class InternalPages {

Expand All @@ -23,6 +23,7 @@ private static ErrorType fromSessionErrorToErrorType(int error) {
case WWebRequestError.ERROR_SECURITY_SSL: {
return ErrorType.ERROR_SECURITY_SSL;
}
case -201:
case WWebRequestError.ERROR_SECURITY_BAD_CERT: {
return ErrorType.ERROR_SECURITY_BAD_CERT;
}
Expand Down Expand Up @@ -131,6 +132,7 @@ public static byte[] createErrorPageData(Context context,

boolean showSSLAdvanced;
switch (sessionError) {
case -201:
case WWebRequestError.ERROR_SECURITY_SSL:
case WWebRequestError.ERROR_SECURITY_BAD_CERT:
showSSLAdvanced = true;
Expand Down
12 changes: 3 additions & 9 deletions app/src/main/res/raw/error_pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@

advancedVisible = !advancedVisible;
}
function acceptAndContinue(temporary) {
document.addCertException(temporary).then(() => {
location.reload();
},
err => {
console.error("Unexpected error: " + err)
}
);
function acceptAndContinue() {
window.certificateErrorPageController.proceed();
}
</script>
</head>
Expand Down Expand Up @@ -70,7 +64,7 @@ <h1 id="et_dnsNotFound" class="errorTitleText">%messageShort%</h1>
<button id="advancedPanelReturnButton" onClick="window.history.back()" class="button">Go Back (Recommended)</button>
</div>
<div id="advancedPanelButtonContainer" class="button-container">
<button id="button" class="buttonSecondary" onClick="acceptAndContinue(true)">Accept the Risk and Continue</button>
<button id="button" class="buttonSecondary" onClick="acceptAndContinue()">Accept the Risk and Continue</button>
</div>
</div>
</div>
Expand Down

0 comments on commit 2845028

Please sign in to comment.