diff --git a/app/build.gradle b/app/build.gradle
index d1d26acb0..ad69a2418 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -240,7 +240,8 @@ dependencies {
svrImplementation fileTree(dir: "${project.rootDir}/third_party/svr/", include: ['*.jar'])
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.vr:sdk-audio:1.170.0'
- implementation "org.mozilla.components:service-telemetry:0.26.0"
+ implementation "org.mozilla.components:service-telemetry:${rootProject.ext.androidComponents['version']}"
+ implementation "org.mozilla.components:browser-errorpages:${rootProject.ext.androidComponents['version']}"
implementation "com.github.mozilla:mozillaspeechlibrary:1.0.6"
}
diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java
index 4ebac1c56..c4086692e 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java
@@ -131,35 +131,6 @@ public void clearListeners() {
mTextInputListeners.clear();
}
- private InternalPages.PageResources errorPageResourcesForCategory(@LoadErrorCategory int category) {
- switch (category) {
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_UNKNOWN: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_SECURITY: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_NETWORK: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_CONTENT: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_URI: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_PROXY: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- case GeckoSession.NavigationDelegate.ERROR_CATEGORY_SAFEBROWSING: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- default: {
- return InternalPages.PageResources.create(R.raw.error_pages, R.raw.error_style);
- }
- }
- }
-
public void setContext(Context aContext, Bundle aExtras) {
if (mRuntime == null) {
// FIXME: Once GeckoView has a prefs API
@@ -916,11 +887,10 @@ public GeckoResult onNewSession(@NonNull GeckoSession aSession, @N
}
@Override
- public GeckoResult onLoadError(GeckoSession session, String uri, int category, int error) {
+ public GeckoResult onLoadError(GeckoSession session, String uri, @LoadErrorCategory int category, @LoadError int error) {
Log.d(LOGTAG, "SessionStore onLoadError: " + uri);
- InternalPages.PageResources pageResources = errorPageResourcesForCategory(category);
- return GeckoResult.fromValue(InternalPages.createErrorPage(mContext, uri, pageResources, category, error));
+ return GeckoResult.fromValue(InternalPages.createErrorPage(mContext, uri, category, error));
}
// Progress Listener
diff --git a/app/src/common/shared/org/mozilla/vrbrowser/utils/InternalPages.java b/app/src/common/shared/org/mozilla/vrbrowser/utils/InternalPages.java
index 39c775eeb..59f059241 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/utils/InternalPages.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/utils/InternalPages.java
@@ -2,6 +2,7 @@
import android.content.Context;
import android.util.Base64;
+
import org.mozilla.geckoview.GeckoSession.NavigationDelegate;
import org.mozilla.geckoview.GeckoSession.NavigationDelegate.LoadError;
import org.mozilla.geckoview.GeckoSession.NavigationDelegate.LoadErrorCategory;
@@ -10,185 +11,118 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-public class InternalPages {
- public static class LocalizedResources {
- public int titleRes;
- public int messageRes;
+import mozilla.components.browser.errorpages.ErrorPages;
+import mozilla.components.browser.errorpages.ErrorType;
- LocalizedResources(int error, int description) {
- titleRes = error;
- messageRes = description;
- }
-
- public static LocalizedResources create(int error, int description) {
- return new LocalizedResources(error, description);
- }
- }
+public class InternalPages {
- private static LocalizedResources fromGeckoErrorToLocalizedResources(@LoadErrorCategory int category, @LoadError int error) {
+ private static ErrorType fromGeckoErrorToErrorType(@LoadErrorCategory int category, @LoadError int error) {
switch(category) {
case NavigationDelegate.ERROR_CATEGORY_UNKNOWN: {
- return LocalizedResources.create(
- R.string.error_generic_title,
- R.string.error_generic_message);
+ return ErrorType.UNKNOWN;
}
case NavigationDelegate.ERROR_CATEGORY_SECURITY: {
switch (error) {
case NavigationDelegate.ERROR_SECURITY_SSL: {
- return LocalizedResources.create(
- R.string.error_security_ssl_title,
- R.string.error_security_ssl_message);
+ return ErrorType.ERROR_SECURITY_SSL;
}
case NavigationDelegate.ERROR_SECURITY_BAD_CERT: {
- return LocalizedResources.create(
- R.string.error_security_bad_cert_title,
- R.string.error_security_bad_cert_message);
+ return ErrorType.ERROR_SECURITY_BAD_CERT;
}
}
}
case NavigationDelegate.ERROR_CATEGORY_NETWORK: {
switch (error) {
case NavigationDelegate.ERROR_NET_INTERRUPT: {
- return LocalizedResources.create(
- R.string.error_net_interrupt_title,
- R.string.error_net_interrupt_message);
+ return ErrorType.ERROR_NET_INTERRUPT;
}
case NavigationDelegate.ERROR_NET_TIMEOUT: {
- return LocalizedResources.create(
- R.string.error_net_timeout_title,
- R.string.error_net_timeout_message);
+ return ErrorType.ERROR_NET_TIMEOUT;
}
case NavigationDelegate.ERROR_CONNECTION_REFUSED: {
- return LocalizedResources.create(
- R.string.error_connection_failure_title,
- R.string.error_connection_failure_message);
+ return ErrorType.ERROR_CONNECTION_REFUSED;
}
case NavigationDelegate.ERROR_UNKNOWN_SOCKET_TYPE: {
- return LocalizedResources.create(
- R.string.error_unknown_socket_type_title,
- R.string.error_unknown_socket_type_message);
+ return ErrorType.ERROR_UNKNOWN_SOCKET_TYPE;
}
case NavigationDelegate.ERROR_REDIRECT_LOOP: {
- return LocalizedResources.create(
- R.string.error_redirect_loop_title,
- R.string.error_redirect_loop_message);
+ return ErrorType.ERROR_REDIRECT_LOOP;
}
case NavigationDelegate.ERROR_OFFLINE: {
- return LocalizedResources.create(
- R.string.error_offline_title,
- R.string.error_offline_message);
+ return ErrorType.ERROR_OFFLINE;
}
case NavigationDelegate.ERROR_PORT_BLOCKED: {
- return LocalizedResources.create(
- R.string.error_port_blocked_title,
- R.string.error_port_blocked_message);
+ return ErrorType.ERROR_PORT_BLOCKED;
}
case NavigationDelegate.ERROR_NET_RESET: {
- return LocalizedResources.create(
- R.string.error_net_reset_title,
- R.string.error_net_reset_message);
+ return ErrorType.ERROR_NET_RESET;
}
}
}
case NavigationDelegate.ERROR_CATEGORY_CONTENT: {
switch (error) {
case NavigationDelegate.ERROR_UNSAFE_CONTENT_TYPE: {
- return LocalizedResources.create(
- R.string.error_unsafe_content_type_title,
- R.string.error_unsafe_content_type_message);
+ return ErrorType.ERROR_UNSAFE_CONTENT_TYPE;
}
case NavigationDelegate.ERROR_CORRUPTED_CONTENT: {
- return LocalizedResources.create(
- R.string.error_corrupted_content_title,
- R.string.error_corrupted_content_message);
+ return ErrorType.ERROR_CORRUPTED_CONTENT;
}
case NavigationDelegate.ERROR_CONTENT_CRASHED: {
- return LocalizedResources.create(
- R.string.error_content_crashed_title,
- R.string.error_content_crashed_message);
+ return ErrorType.ERROR_CONTENT_CRASHED;
}
case NavigationDelegate.ERROR_INVALID_CONTENT_ENCODING: {
- return LocalizedResources.create(
- R.string.error_invalid_content_encoding_title,
- R.string.error_invalid_content_encoding_message);
+ return ErrorType.ERROR_INVALID_CONTENT_ENCODING;
}
}
}
case NavigationDelegate.ERROR_CATEGORY_URI: {
switch (error) {
case NavigationDelegate.ERROR_UNKNOWN_HOST: {
- return LocalizedResources.create(
- R.string.error_unknown_host_title,
- R.string.error_unknown_host_message);
+ return ErrorType.ERROR_UNKNOWN_HOST;
}
case NavigationDelegate.ERROR_MALFORMED_URI: {
- return LocalizedResources.create(
- R.string.error_malformed_uri_title,
- R.string.error_malformed_uri_message);
+ return ErrorType.ERROR_MALFORMED_URI;
}
case NavigationDelegate.ERROR_UNKNOWN_PROTOCOL: {
- return LocalizedResources.create(
- R.string.error_unknown_protocol_title,
- R.string.error_unknown_protocol_message);
+ return ErrorType.ERROR_UNKNOWN_PROTOCOL;
}
case NavigationDelegate.ERROR_FILE_NOT_FOUND: {
- return LocalizedResources.create(
- R.string.error_file_not_found_title,
- R.string.error_file_not_found_message);
+ return ErrorType.ERROR_FILE_NOT_FOUND;
}
case NavigationDelegate.ERROR_FILE_ACCESS_DENIED: {
- return LocalizedResources.create(
- R.string.error_file_access_denied_title,
- R.string.error_file_access_denied_message);
+ return ErrorType.ERROR_FILE_ACCESS_DENIED;
}
}
}
case NavigationDelegate.ERROR_CATEGORY_PROXY: {
switch (error) {
case NavigationDelegate.ERROR_PROXY_CONNECTION_REFUSED: {
- return LocalizedResources.create(
- R.string.error_proxy_connection_refused_title,
- R.string.error_proxy_connection_refused_message);
+ return ErrorType.ERROR_CONNECTION_REFUSED;
}
case NavigationDelegate.ERROR_UNKNOWN_PROXY_HOST: {
- return LocalizedResources.create(
- R.string.error_unknown_proxy_host_title,
- R.string.error_unknown_proxy_host_message);
+ return ErrorType.ERROR_UNKNOWN_PROXY_HOST;
}
}
}
case NavigationDelegate.ERROR_CATEGORY_SAFEBROWSING: {
switch (error) {
case NavigationDelegate.ERROR_SAFEBROWSING_MALWARE_URI: {
- return LocalizedResources.create(
- R.string.error_safe_browsing_malware_uri_title,
- R.string.error_safe_browsing_malware_uri_message);
+ return ErrorType.ERROR_SAFEBROWSING_MALWARE_URI;
}
case NavigationDelegate.ERROR_SAFEBROWSING_UNWANTED_URI: {
- return LocalizedResources.create(
- R.string.error_safe_browsing_unwanted_uri_title,
- R.string.error_safe_browsing_unwanted_uri_message);
+ return ErrorType.ERROR_SAFEBROWSING_UNWANTED_URI;
}
case NavigationDelegate.ERROR_SAFEBROWSING_HARMFUL_URI: {
- return LocalizedResources.create(
- R.string.error_safe_harmful_uri_title,
- R.string.error_safe_harmful_uri_message);
+ return ErrorType.ERROR_SAFEBROWSING_HARMFUL_URI;
}
case NavigationDelegate.ERROR_SAFEBROWSING_PHISHING_URI: {
- return LocalizedResources.create(
- R.string.error_safe_phishing_uri_title,
- R.string.error_safe_phishing_uri_message);
+ return ErrorType.ERROR_SAFEBROWSING_PHISHING_URI;
}
}
}
default: {
- return LocalizedResources.create(
- R.string.error_generic_title,
- R.string.error_generic_message);
+ return ErrorType.UNKNOWN;
}
}
}
@@ -208,21 +142,16 @@ public static PageResources create(int html, int css) {
}
public static String createErrorPage(Context context,
- String uri,
- PageResources resources,
- @LoadErrorCategory int errorCategory,
- @LoadError int errorType) {
- LocalizedResources localizedData = fromGeckoErrorToLocalizedResources(errorCategory, errorType);
-
- String html = readRawResourceString(context, resources.html);
- String css = readRawResourceString(context, resources.css);
-
- html = html
- .replace("%pageTitle%", context.getString(R.string.errorpage_title))
- .replace("%button%", context.getString(R.string.errorpage_refresh))
- .replace("%messageShort%", context.getString(localizedData.titleRes))
- .replace("%messageLong%", context.getString(localizedData.messageRes, uri))
- .replace("%css%", css);
+ String uri,
+ @LoadErrorCategory int errorCategory,
+ @LoadError int errorType) {
+ // TODO: browser-error pages component needs to accept a uri parameter
+ String html = ErrorPages.INSTANCE.createErrorPage(
+ context,
+ fromGeckoErrorToErrorType(errorCategory, errorType),
+ uri,
+ R.raw.error_pages,
+ R.raw.error_style);
return "data:text/html;base64," + Base64.encodeToString(html.getBytes(), Base64.DEFAULT);
}
@@ -232,9 +161,10 @@ public static byte[] createAboutPage(Context context,
String html = readRawResourceString(context, resources.html);
String css = readRawResourceString(context, resources.css);
+ String pageBody = context.getString(R.string.private_browsing_body, context.getString(R.string.app_name));
html = html
.replace("%pageTitle%", context.getString(R.string.private_browsing_title))
- .replace("%pageBody%", context.getString(R.string.private_browsing_body))
+ .replace("%pageBody%", pageBody)
.replace("%css%", css)
.replace("%privateBrowsingSupportUrl%", context.getString(R.string.private_browsing_support_url));
diff --git a/app/src/main/res/values/localpages.xml b/app/src/main/res/values/localpages.xml
index e5fd0e92d..f92702590 100644
--- a/app/src/main/res/values/localpages.xml
+++ b/app/src/main/res/values/localpages.xml
@@ -3,217 +3,12 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
- Problem loading page
- Try Again
-
-
- Cannot Complete Request
- Additional information about this problem or error is currently unavailable.
- ]]>
-
-
- Secure Connection Failed
- The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
-- Please contact the website owners to inform them of this problem.
- ]]>
-
- Secure Connection Failed
-
-This could be a problem with the server\'s configuration, or it could be someone trying to impersonate the server.
-If you have connected to this server successfully in the past, the error may be temporary, and you can try again later.
-
- ]]>
-
-
- Data Transfer Interrupted
- The browser connected successfully, but the connection was interrupted while transferring information. Please try again.
-
-- Are you unable to browse other sites? Check the computer\'s network connection.
-- Still having trouble? Consult your network administrator or Internet provider for assistance.
-
- ]]>
-
- Network Timeout
- The requested site did not respond to a connection request and the browser has stopped waiting for a reply.
-
-- Could the server be experiencing high demand or a temporary outage? Try again later.
-- Are you unable to browse other sites? Check the computer\'s network connection.
-- Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.
-- Still having trouble? Consult your network administrator or Internet provider for assistance.
-
- ]]>
-
- Failed to Connect
- Though the site seems valid, the browser was unable to establish a connection.
-
-- Could the site be temporarily unavailable? Try again later.
-- Are you unable to browse other sites? Check the computer\'s network connection.
-- Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.
-
- ]]>
-
- Incorrect Response
- The site responded to the network request in an unexpected way and the browser cannot continue.
- ]]>
-
- Redirect Loop
- The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.
-
-- Have you disabled or blocked cookies required by this site?
-- NOTE: If accepting the site\'s cookies does not resolve the problem, it is likely a server configuration issue and not your computer.
-
- ]]>
-
- Offline Mode
- The browser is operating in its offline mode and cannot connect to the requested item.
-
-- Is the computer connected to an active network?
-- Press "Try Again" to switch to online mode and reload the page.
-
- ]]>
-
- Port Restricted for Security Reasons
- The requested address specified a port (e.g. mozilla.org:80
for port 80 on mozilla.org) normally used for purposes other than Web browsing. The browser has canceled the request for your protection and security.
- ]]>
-
- Connection Interrupted
- The network link was interrupted while negotiating a connection. Please try again.
- ]]>
-
-
- Unsafe File Type
-
- Please contact the website owners to inform them of this problem.
-
- ]]>
-
- Corrupted Content Error
- The page you are trying to view cannot be shown because an error in the data transmission was detected.
-
-- Please contact the website owners to inform them of this problem.
-
- ]]>
-
- Content crashed
- The page you are trying to view cannot be shown because an error in the data transmission was detected.
-
-- Please contact the website owners to inform them of this problem.
-
- ]]>
-
- Content Encoding Error
- The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
-
-- Please contact the website owners to inform them of this problem.
-
-
- ]]>
-
-
- Address Not Found
- The browser could not find the host server for the provided address.
-
-- Did you make a mistake when typing the domain? (e.g.
ww.mozilla.org
instead of www.mozilla.org
) - Are you certain this domain address exists? Its registration may have expired.
-- Are you unable to browse other sites? Check your network connection and DNS server settings.
-- Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.
-
- ]]>
-
- Invalid Address
- The provided address is not in a recognized format. Please check the location bar for mistakes and try again.
- ]]>
-
- Unknown Protocol
- The address specifies a protocol (e.g. wxyz://
) the browser does not recognize, so the browser cannot properly connect to the site.
-
-- Are you trying to access multimedia or other non-text services? Check the site for extra requirements.
-- Some protocols may require third-party software or plugins before the browser can recognize them.
-
- ]]>
-
- File Not Found
-
-Could the item have been renamed, removed, or relocated?
-Is there a spelling, capitalization, or other typographical error in the address?
-Do you have sufficient access permissions to the requested item?
-
- ]]>
-
- Access to the file was denied
-
-It may have been removed, moved, or file permissions may be preventing access.
-
- ]]>
-
-
- Proxy Server Refused Connection
- The browser is configured to use a proxy server, but the proxy refused a connection.
-
-- Is the browser\'s proxy configuration correct? Check the settings and try again.
-- Does the proxy service allow connections from this network?
-- Still having trouble? Consult your network administrator or Internet provider for assistance.
-
- ]]>
-
- Proxy Server Not Found
- The browser is configured to use a proxy server, but the proxy could not be found.
-
-- Is the browser\'s proxy configuration correct? Check the settings and try again.
-- Is the computer connected to an active network?
-- Still having trouble? Consult your network administrator or Internet provider for assistance.
-
- ]]>
-
-
- Malware site issue
- The site at %1$s has been reported as an attack site and has been blocked based on your security preferences.
- ]]>
-
- Unwanted site issue
- The site at %1$s has been reported as serving unwanted software and has been blocked based on your security preferences.
- ]]>
-
- Harmful site issue
- The site at %1$s has been reported as a potentially harmful site and has been blocked based on your security preferences.
- ]]>
-
- Deceptive site issue
- This web page at %1$s has been reported as a deceptive site and has been blocked based on your security preferences.
- ]]>
-
Private Browsing
Private Browsing
-When you browse in a Private Window, Firefox Reality does not save:
+When you browse in a Private Window, %1$s does not save:
- visited pages
@@ -222,7 +17,7 @@
- temporary files
-Private Browsing doesn\'t make you anonymous on the Internet. Your employer or Internet service provider can still know what page you visit.
+Private Browsing doesn’t save make you anonymous on the Internet. Your employer or Internet service provider can still know what page you visit.
Learn more about Private Browsing.
]]>
diff --git a/build.gradle b/build.gradle
index 4b69537a1..9f01a8477 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,6 +8,11 @@ buildscript {
version: '65.0.20181023100123'
]
+ // Android components version
+ ext.androidComponents = [
+ version: '0.27.0'
+ ]
+
repositories {
google()
jcenter()