Implement an error console. The console is displayed when the user has enabled debug in the browser (been to about:debug) and there are errors on the page. It can be toggled on/off in debug mode in the settings menu.
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java
index 1c8b7c8..c7c3e3f 100644
--- a/src/com/android/browser/TabControl.java
+++ b/src/com/android/browser/TabControl.java
@@ -195,6 +195,8 @@
// url has not changed.
private String mOriginalUrl;
+ private ErrorConsoleView mErrorConsole;
+
// Construct a new tab
private Tab(WebView w, boolean closeOnExit, String appId, String url) {
mMainView = w;
@@ -388,6 +390,28 @@
}
/**
+ * Return the current tab's error console. Creates the console if createIfNEcessary
+ * is true and we haven't already created the console.
+ * @param createIfNecessary Flag to indicate if the console should be created if it has
+ * not been already.
+ * @return The current tab's error console, or null if one has not been created and
+ * createIfNecessary is false.
+ */
+ ErrorConsoleView getCurrentErrorConsole(boolean createIfNecessary) {
+ Tab t = getTab(mCurrentTab);
+ if (t == null) {
+ return null;
+ }
+
+ if (createIfNecessary && t.mErrorConsole == null) {
+ t.mErrorConsole = new ErrorConsoleView(mActivity);
+ t.mErrorConsole.setWebView(t.mMainView);
+ }
+
+ return t.mErrorConsole;
+ }
+
+ /**
* Return the current tab's top-level WebView. This can return a subwindow
* if one exists.
* @return The top-level WebView of the current tab.