diff options
author | Feng Qian <fqian@google.com> | 2009-06-29 15:58:08 -0700 |
---|---|---|
committer | Feng Qian <fqian@google.com> | 2009-06-29 17:35:44 -0700 |
commit | b3c02da4553b1a629b16377970fdabae28394c94 (patch) | |
tree | 8ea6510502cacac6f82ec038c349231232e70efb | |
parent | accf2c92c7ea0379d1336d5d8a0f0c3e7ddce3e2 (diff) | |
download | packages_apps_Browser-b3c02da4553b1a629b16377970fdabae28394c94.zip packages_apps_Browser-b3c02da4553b1a629b16377970fdabae28394c94.tar.gz packages_apps_Browser-b3c02da4553b1a629b16377970fdabae28394c94.tar.bz2 |
Add a UI for setting JS flags.
The UI only shows up when 'about:debug' is typed in the address bar.
JS flags are a string '--heap-stats --log-gc' in V8 etc.
Currently this is only used by V8 build for debugging purpose.
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/debug_preferences.xml | 11 | ||||
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 5 | ||||
-rw-r--r-- | src/com/android/browser/BrowserSettings.java | 10 |
4 files changed, 24 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 68742e1..8d31462 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -431,6 +431,8 @@ <!-- Do not tranlsate. Development option --> <string name="pref_development_search_url" translatable="false">Set search URL</string> <!-- Do not tranlsate. Development option --> + <string name="js_engine_flags" translatable="false">Set JS flags</string> + <!-- Do not tranlsate. Development option --> <string name="pref_development_uastring" translatable="false">UAString</string> <!-- Do not tranlsate. Development option --> <string-array name="pref_development_ua_choices" translatable="false"> diff --git a/res/xml/debug_preferences.xml b/res/xml/debug_preferences.xml index 4f55f6b..c39ae5b 100644 --- a/res/xml/debug_preferences.xml +++ b/res/xml/debug_preferences.xml @@ -51,9 +51,14 @@ android:title="@string/pref_development_nav_dump" /> <com.android.browser.BrowserSearchpagePreference - android:key="search_url" - android:title="@string/pref_development_search_url" - android:singleLine="true" /> + android:key="search_url" + android:title="@string/pref_development_search_url" + android:singleLine="true" /> + + <EditTextPreference + android:key="js_engine_flags" + android:title="@string/js_engine_flags" + android:singleLine="true" /> <ListPreference android:key="user_agent" diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 8336837..1c2c6af 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -783,6 +783,11 @@ public class BrowserActivity extends Activity // are not animating from the tab picker. attachTabToContentView(mTabControl.getCurrentTab()); } + // Read JavaScript flags if it exists. + String jsFlags = mSettings.getJsFlags(); + if (jsFlags.trim().length() != 0) { + mTabControl.getCurrentWebView().setJsFlags(jsFlags); + } /* enables registration for changes in network status from http stack */ diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index 4f4d440..762149b 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -83,6 +83,7 @@ class BrowserSettings extends Observable { private boolean appCacheEnabled = true; private String appCachePath; // default value set in loadFromDb(). private boolean domStorageEnabled = true; + private String jsFlags = ""; private final static String TAG = "BrowserSettings"; @@ -94,6 +95,7 @@ class BrowserSettings extends Observable { private boolean tracing = false; private boolean lightTouch = false; private boolean navDump = false; + // Browser only settings private boolean doFlick = false; @@ -327,7 +329,9 @@ class BrowserSettings extends Observable { mTabControl.getBrowserActivity().setBaseSearchUrl( p.getString("search_url", "")); } - update(); + // JS flags is loaded from DB even if showDebugSettings is false, + // so that it can be set once and be effective all the time. + jsFlags = p.getString("js_engine_flags", ""); } public String getPluginsPath() { @@ -338,6 +342,10 @@ class BrowserSettings extends Observable { return homeUrl; } + public String getJsFlags() { + return jsFlags; + } + public void setHomePage(Context context, String url) { Editor ed = PreferenceManager. getDefaultSharedPreferences(context).edit(); |