OSDN Git Service

Use new apply() instead of commit().
[android-x86/packages-apps-Browser.git] / src / com / android / browser / BrowserSettings.java
1
2 /*
3  * Copyright (C) 2007 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 package com.android.browser;
19
20 import android.app.ActivityManager;
21 import android.content.ContentResolver;
22 import android.content.Context;
23 import android.content.pm.ActivityInfo;
24 import android.content.SharedPreferences;
25 import android.content.SharedPreferences.Editor;
26 import android.preference.PreferenceActivity;
27 import android.preference.PreferenceScreen;
28 import android.webkit.CookieManager;
29 import android.webkit.GeolocationPermissions;
30 import android.webkit.ValueCallback;
31 import android.webkit.WebView;
32 import android.webkit.WebViewDatabase;
33 import android.webkit.WebIconDatabase;
34 import android.webkit.WebSettings;
35 import android.webkit.WebStorage;
36 import android.preference.PreferenceManager;
37 import android.provider.Browser;
38
39 import java.util.HashMap;
40 import java.util.Map;
41 import java.util.Set;
42 import java.util.Observable;
43
44 /*
45  * Package level class for storing various WebView and Browser settings. To use
46  * this class:
47  * BrowserSettings s = BrowserSettings.getInstance();
48  * s.addObserver(webView.getSettings());
49  * s.loadFromDb(context); // Only needed on app startup
50  * s.javaScriptEnabled = true;
51  * ... // set any other settings
52  * s.update(); // this will update all the observers
53  *
54  * To remove an observer:
55  * s.deleteObserver(webView.getSettings());
56  */
57 class BrowserSettings extends Observable {
58
59     // Private variables for settings
60     // NOTE: these defaults need to be kept in sync with the XML
61     // until the performance of PreferenceManager.setDefaultValues()
62     // is improved.
63     // Note: boolean variables are set inside reset function.
64     private boolean loadsImagesAutomatically;
65     private boolean javaScriptEnabled;
66     private WebSettings.PluginState pluginState;
67     private boolean javaScriptCanOpenWindowsAutomatically;
68     private boolean showSecurityWarnings;
69     private boolean rememberPasswords;
70     private boolean saveFormData;
71     private boolean openInBackground;
72     private String defaultTextEncodingName;
73     private String homeUrl = "";
74     private boolean autoFitPage;
75     private boolean landscapeOnly;
76     private boolean loadsPageInOverviewMode;
77     private boolean showDebugSettings;
78     // HTML5 API flags
79     private boolean appCacheEnabled;
80     private boolean databaseEnabled;
81     private boolean domStorageEnabled;
82     private boolean geolocationEnabled;
83     private boolean workersEnabled;  // only affects V8. JSC does not have a similar setting
84     // HTML5 API configuration params
85     private long appCacheMaxSize = Long.MAX_VALUE;
86     private String appCachePath;  // default value set in loadFromDb().
87     private String databasePath; // default value set in loadFromDb()
88     private String geolocationDatabasePath; // default value set in loadFromDb()
89     private WebStorageSizeManager webStorageSizeManager;
90
91     private String jsFlags = "";
92
93     private final static String TAG = "BrowserSettings";
94
95     // Development settings
96     public WebSettings.LayoutAlgorithm layoutAlgorithm =
97         WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
98     private boolean useWideViewPort = true;
99     private int userAgent = 0;
100     private boolean tracing = false;
101     private boolean lightTouch = false;
102     private boolean navDump = false;
103
104     // By default the error console is shown once the user navigates to about:debug.
105     // The setting can be then toggled from the settings menu.
106     private boolean showConsole = true;
107
108     // Private preconfigured values
109     private static int minimumFontSize = 8;
110     private static int minimumLogicalFontSize = 8;
111     private static int defaultFontSize = 16;
112     private static int defaultFixedFontSize = 13;
113     private static WebSettings.TextSize textSize =
114         WebSettings.TextSize.NORMAL;
115     private static WebSettings.ZoomDensity zoomDensity =
116         WebSettings.ZoomDensity.MEDIUM;
117     private static int pageCacheCapacity;
118
119     // Preference keys that are used outside this class
120     public final static String PREF_CLEAR_CACHE = "privacy_clear_cache";
121     public final static String PREF_CLEAR_COOKIES = "privacy_clear_cookies";
122     public final static String PREF_CLEAR_HISTORY = "privacy_clear_history";
123     public final static String PREF_HOMEPAGE = "homepage";
124     public final static String PREF_CLEAR_FORM_DATA =
125             "privacy_clear_form_data";
126     public final static String PREF_CLEAR_PASSWORDS =
127             "privacy_clear_passwords";
128     public final static String PREF_EXTRAS_RESET_DEFAULTS =
129             "reset_default_preferences";
130     public final static String PREF_DEBUG_SETTINGS = "debug_menu";
131     public final static String PREF_WEBSITE_SETTINGS = "website_settings";
132     public final static String PREF_TEXT_SIZE = "text_size";
133     public final static String PREF_DEFAULT_ZOOM = "default_zoom";
134     public final static String PREF_DEFAULT_TEXT_ENCODING =
135             "default_text_encoding";
136     public final static String PREF_CLEAR_GEOLOCATION_ACCESS =
137             "privacy_clear_geolocation_access";
138
139     private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " +
140             "U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " +
141             "like Gecko) Version/5.0 Safari/533.16";
142
143     private static final String IPHONE_USERAGENT = "Mozilla/5.0 (iPhone; U; " +
144             "CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 " +
145             "(KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7";
146
147     private static final String IPAD_USERAGENT = "Mozilla/5.0 (iPad; U; " +
148             "CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 " +
149             "(KHTML, like Gecko) Version/4.0.4 Mobile/7B367 Safari/531.21.10";
150
151     private static final String FROYO_USERAGENT = "Mozilla/5.0 (Linux; U; " +
152             "Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 " +
153             "(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1";
154
155     // Value to truncate strings when adding them to a TextView within
156     // a ListView
157     public final static int MAX_TEXTVIEW_LEN = 80;
158
159     private TabControl mTabControl;
160
161     // Single instance of the BrowserSettings for use in the Browser app.
162     private static BrowserSettings sSingleton;
163
164     // Private map of WebSettings to Observer objects used when deleting an
165     // observer.
166     private HashMap<WebSettings,Observer> mWebSettingsToObservers =
167         new HashMap<WebSettings,Observer>();
168
169     /*
170      * An observer wrapper for updating a WebSettings object with the new
171      * settings after a call to BrowserSettings.update().
172      */
173     static class Observer implements java.util.Observer {
174         // Private WebSettings object that will be updated.
175         private WebSettings mSettings;
176
177         Observer(WebSettings w) {
178             mSettings = w;
179         }
180
181         public void update(Observable o, Object arg) {
182             BrowserSettings b = (BrowserSettings)o;
183             WebSettings s = mSettings;
184
185             s.setLayoutAlgorithm(b.layoutAlgorithm);
186             if (b.userAgent == 0) {
187                 // use the default ua string
188                 s.setUserAgentString(null);
189             } else if (b.userAgent == 1) {
190                 s.setUserAgentString(DESKTOP_USERAGENT);
191             } else if (b.userAgent == 2) {
192                 s.setUserAgentString(IPHONE_USERAGENT);
193             } else if (b.userAgent == 3) {
194                 s.setUserAgentString(IPAD_USERAGENT);
195             } else if (b.userAgent == 4) {
196                 s.setUserAgentString(FROYO_USERAGENT);
197             }
198             s.setUseWideViewPort(b.useWideViewPort);
199             s.setLoadsImagesAutomatically(b.loadsImagesAutomatically);
200             s.setJavaScriptEnabled(b.javaScriptEnabled);
201             s.setPluginState(b.pluginState);
202             s.setJavaScriptCanOpenWindowsAutomatically(
203                     b.javaScriptCanOpenWindowsAutomatically);
204             s.setDefaultTextEncodingName(b.defaultTextEncodingName);
205             s.setMinimumFontSize(b.minimumFontSize);
206             s.setMinimumLogicalFontSize(b.minimumLogicalFontSize);
207             s.setDefaultFontSize(b.defaultFontSize);
208             s.setDefaultFixedFontSize(b.defaultFixedFontSize);
209             s.setNavDump(b.navDump);
210             s.setTextSize(b.textSize);
211             s.setDefaultZoom(b.zoomDensity);
212             s.setLightTouchEnabled(b.lightTouch);
213             s.setSaveFormData(b.saveFormData);
214             s.setSavePassword(b.rememberPasswords);
215             s.setLoadWithOverviewMode(b.loadsPageInOverviewMode);
216             s.setPageCacheCapacity(pageCacheCapacity);
217
218             // WebView inside Browser doesn't want initial focus to be set.
219             s.setNeedInitialFocus(false);
220             // Browser supports multiple windows
221             s.setSupportMultipleWindows(true);
222
223             // HTML5 API flags
224             s.setAppCacheEnabled(b.appCacheEnabled);
225             s.setDatabaseEnabled(b.databaseEnabled);
226             s.setDomStorageEnabled(b.domStorageEnabled);
227             s.setWorkersEnabled(b.workersEnabled);  // This only affects V8.
228             s.setGeolocationEnabled(b.geolocationEnabled);
229
230             // HTML5 configuration parameters.
231             s.setAppCacheMaxSize(b.appCacheMaxSize);
232             s.setAppCachePath(b.appCachePath);
233             s.setDatabasePath(b.databasePath);
234             s.setGeolocationDatabasePath(b.geolocationDatabasePath);
235
236             b.updateTabControlSettings();
237         }
238     }
239
240     /**
241      * Load settings from the browser app's database.
242      * NOTE: Strings used for the preferences must match those specified
243      * in the browser_preferences.xml
244      * @param ctx A Context object used to query the browser's settings
245      *            database. If the database exists, the saved settings will be
246      *            stored in this BrowserSettings object. This will update all
247      *            observers of this object.
248      */
249     public void loadFromDb(Context ctx) {
250         SharedPreferences p =
251                 PreferenceManager.getDefaultSharedPreferences(ctx);
252         // Set the default value for the Application Caches path.
253         appCachePath = ctx.getDir("appcache", 0).getPath();
254         // Determine the maximum size of the application cache.
255         webStorageSizeManager = new WebStorageSizeManager(
256                 ctx,
257                 new WebStorageSizeManager.StatFsDiskInfo(appCachePath),
258                 new WebStorageSizeManager.WebKitAppCacheInfo(appCachePath));
259         appCacheMaxSize = webStorageSizeManager.getAppCacheMaxSize();
260         // Set the default value for the Database path.
261         databasePath = ctx.getDir("databases", 0).getPath();
262         // Set the default value for the Geolocation database path.
263         geolocationDatabasePath = ctx.getDir("geolocation", 0).getPath();
264
265         if (p.getString(PREF_HOMEPAGE, "") == "") {
266             // No home page preferences is set, set it to default.
267             setHomePage(ctx, getFactoryResetHomeUrl(ctx));
268         }
269
270         // the cost of one cached page is ~3M (measured using nytimes.com). For
271         // low end devices, we only cache one page. For high end devices, we try
272         // to cache more pages, currently choose 5.
273         ActivityManager am = (ActivityManager) ctx
274                 .getSystemService(Context.ACTIVITY_SERVICE);
275         if (am.getMemoryClass() > 16) {
276             pageCacheCapacity = 5;
277         } else {
278             pageCacheCapacity = 1;
279         }
280
281         // Load the defaults from the xml
282         // This call is TOO SLOW, need to manually keep the defaults
283         // in sync
284         //PreferenceManager.setDefaultValues(ctx, R.xml.browser_preferences);
285         syncSharedPreferences(p);
286     }
287
288     /* package */ void syncSharedPreferences(SharedPreferences p) {
289
290         homeUrl =
291             p.getString(PREF_HOMEPAGE, homeUrl);
292
293         loadsImagesAutomatically = p.getBoolean("load_images",
294                 loadsImagesAutomatically);
295         javaScriptEnabled = p.getBoolean("enable_javascript",
296                 javaScriptEnabled);
297         pluginState = WebSettings.PluginState.valueOf(
298                 p.getString("plugin_state", pluginState.name()));
299         javaScriptCanOpenWindowsAutomatically = !p.getBoolean(
300             "block_popup_windows",
301             !javaScriptCanOpenWindowsAutomatically);
302         showSecurityWarnings = p.getBoolean("show_security_warnings",
303                 showSecurityWarnings);
304         rememberPasswords = p.getBoolean("remember_passwords",
305                 rememberPasswords);
306         saveFormData = p.getBoolean("save_formdata",
307                 saveFormData);
308         boolean accept_cookies = p.getBoolean("accept_cookies",
309                 CookieManager.getInstance().acceptCookie());
310         CookieManager.getInstance().setAcceptCookie(accept_cookies);
311         openInBackground = p.getBoolean("open_in_background", openInBackground);
312         textSize = WebSettings.TextSize.valueOf(
313                 p.getString(PREF_TEXT_SIZE, textSize.name()));
314         zoomDensity = WebSettings.ZoomDensity.valueOf(
315                 p.getString(PREF_DEFAULT_ZOOM, zoomDensity.name()));
316         autoFitPage = p.getBoolean("autofit_pages", autoFitPage);
317         loadsPageInOverviewMode = p.getBoolean("load_page",
318                 loadsPageInOverviewMode);
319         boolean landscapeOnlyTemp =
320                 p.getBoolean("landscape_only", landscapeOnly);
321         if (landscapeOnlyTemp != landscapeOnly) {
322             landscapeOnly = landscapeOnlyTemp;
323         }
324         useWideViewPort = true; // use wide view port for either setting
325         if (autoFitPage) {
326             layoutAlgorithm = WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
327         } else {
328             layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL;
329         }
330         defaultTextEncodingName =
331                 p.getString(PREF_DEFAULT_TEXT_ENCODING,
332                         defaultTextEncodingName);
333
334         showDebugSettings =
335                 p.getBoolean(PREF_DEBUG_SETTINGS, showDebugSettings);
336         // Debug menu items have precidence if the menu is visible
337         if (showDebugSettings) {
338             boolean small_screen = p.getBoolean("small_screen",
339                     layoutAlgorithm ==
340                     WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
341             if (small_screen) {
342                 layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN;
343             } else {
344                 boolean normal_layout = p.getBoolean("normal_layout",
345                         layoutAlgorithm == WebSettings.LayoutAlgorithm.NORMAL);
346                 if (normal_layout) {
347                     layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL;
348                 } else {
349                     layoutAlgorithm =
350                             WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
351                 }
352             }
353             useWideViewPort = p.getBoolean("wide_viewport", useWideViewPort);
354             tracing = p.getBoolean("enable_tracing", tracing);
355             lightTouch = p.getBoolean("enable_light_touch", lightTouch);
356             navDump = p.getBoolean("enable_nav_dump", navDump);
357             userAgent = Integer.parseInt(p.getString("user_agent", "0"));
358         }
359         // JS flags is loaded from DB even if showDebugSettings is false,
360         // so that it can be set once and be effective all the time.
361         jsFlags = p.getString("js_engine_flags", "");
362
363         // Read the setting for showing/hiding the JS Console always so that should the
364         // user enable debug settings, we already know if we should show the console.
365         // The user will never see the console unless they navigate to about:debug,
366         // regardless of the setting we read here. This setting is only used after debug
367         // is enabled.
368         showConsole = p.getBoolean("javascript_console", showConsole);
369
370         // HTML5 API flags
371         appCacheEnabled = p.getBoolean("enable_appcache", appCacheEnabled);
372         databaseEnabled = p.getBoolean("enable_database", databaseEnabled);
373         domStorageEnabled = p.getBoolean("enable_domstorage", domStorageEnabled);
374         geolocationEnabled = p.getBoolean("enable_geolocation", geolocationEnabled);
375         workersEnabled = p.getBoolean("enable_workers", workersEnabled);
376
377         update();
378     }
379
380     public String getHomePage() {
381         return homeUrl;
382     }
383
384     public String getJsFlags() {
385         return jsFlags;
386     }
387
388     public WebStorageSizeManager getWebStorageSizeManager() {
389         return webStorageSizeManager;
390     }
391
392     public void setHomePage(Context context, String url) {
393         Editor ed = PreferenceManager.
394                 getDefaultSharedPreferences(context).edit();
395         ed.putString(PREF_HOMEPAGE, url);
396         ed.apply();
397         homeUrl = url;
398     }
399
400     public WebSettings.TextSize getTextSize() {
401         return textSize;
402     }
403
404     public WebSettings.ZoomDensity getDefaultZoom() {
405         return zoomDensity;
406     }
407
408     public boolean openInBackground() {
409         return openInBackground;
410     }
411
412     public boolean showSecurityWarnings() {
413         return showSecurityWarnings;
414     }
415
416     public boolean isTracing() {
417         return tracing;
418     }
419
420     public boolean isLightTouch() {
421         return lightTouch;
422     }
423
424     public boolean isNavDump() {
425         return navDump;
426     }
427
428     public boolean showDebugSettings() {
429         return showDebugSettings;
430     }
431
432     public void toggleDebugSettings() {
433         showDebugSettings = !showDebugSettings;
434         navDump = showDebugSettings;
435         update();
436     }
437
438     /**
439      * Add a WebSettings object to the list of observers that will be updated
440      * when update() is called.
441      *
442      * @param s A WebSettings object that is strictly tied to the life of a
443      *            WebView.
444      */
445     public Observer addObserver(WebSettings s) {
446         Observer old = mWebSettingsToObservers.get(s);
447         if (old != null) {
448             super.deleteObserver(old);
449         }
450         Observer o = new Observer(s);
451         mWebSettingsToObservers.put(s, o);
452         super.addObserver(o);
453         return o;
454     }
455
456     /**
457      * Delete the given WebSettings observer from the list of observers.
458      * @param s The WebSettings object to be deleted.
459      */
460     public void deleteObserver(WebSettings s) {
461         Observer o = mWebSettingsToObservers.get(s);
462         if (o != null) {
463             mWebSettingsToObservers.remove(s);
464             super.deleteObserver(o);
465         }
466     }
467
468     /*
469      * Package level method for obtaining a single app instance of the
470      * BrowserSettings.
471      */
472     /*package*/ static BrowserSettings getInstance() {
473         if (sSingleton == null ) {
474             sSingleton = new BrowserSettings();
475         }
476         return sSingleton;
477     }
478
479     /*
480      * Package level method for associating the BrowserSettings with TabControl
481      */
482     /* package */void setTabControl(TabControl tabControl) {
483         mTabControl = tabControl;
484         updateTabControlSettings();
485     }
486
487     /*
488      * Update all the observers of the object.
489      */
490     /*package*/ void update() {
491         setChanged();
492         notifyObservers();
493     }
494
495     /*package*/ void clearCache(Context context) {
496         WebIconDatabase.getInstance().removeAllIcons();
497         if (mTabControl != null) {
498             WebView current = mTabControl.getCurrentWebView();
499             if (current != null) {
500                 current.clearCache(true);
501             }
502         }
503     }
504
505     /*package*/ void clearCookies(Context context) {
506         CookieManager.getInstance().removeAllCookie();
507     }
508
509     /* package */void clearHistory(Context context) {
510         ContentResolver resolver = context.getContentResolver();
511         Browser.clearHistory(resolver);
512         Browser.clearSearches(resolver);
513     }
514
515     /* package */ void clearFormData(Context context) {
516         WebViewDatabase.getInstance(context).clearFormData();
517         if (mTabControl != null) {
518             WebView currentTopView = mTabControl.getCurrentTopWebView();
519             if (currentTopView != null) {
520                 currentTopView.clearFormData();
521             }
522         }
523     }
524
525     /*package*/ void clearPasswords(Context context) {
526         WebViewDatabase db = WebViewDatabase.getInstance(context);
527         db.clearUsernamePassword();
528         db.clearHttpAuthUsernamePassword();
529     }
530
531     private void updateTabControlSettings() {
532         // Enable/disable the error console.
533         mTabControl.getBrowserActivity().setShouldShowErrorConsole(
534             showDebugSettings && showConsole);
535         mTabControl.getBrowserActivity().setRequestedOrientation(
536             landscapeOnly ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
537             : ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
538     }
539
540     private void maybeDisableWebsiteSettings(Context context) {
541         PreferenceActivity activity = (PreferenceActivity) context;
542         final PreferenceScreen screen = (PreferenceScreen)
543             activity.findPreference(BrowserSettings.PREF_WEBSITE_SETTINGS);
544         screen.setEnabled(false);
545         WebStorage.getInstance().getOrigins(new ValueCallback<Map>() {
546             public void onReceiveValue(Map webStorageOrigins) {
547                 if ((webStorageOrigins != null) && !webStorageOrigins.isEmpty()) {
548                     screen.setEnabled(true);
549                 }
550             }
551         });
552
553         GeolocationPermissions.getInstance().getOrigins(new ValueCallback<Set<String> >() {
554             public void onReceiveValue(Set<String> geolocationOrigins) {
555                 if ((geolocationOrigins != null) && !geolocationOrigins.isEmpty()) {
556                     screen.setEnabled(true);
557                 }
558             }
559         });
560     }
561
562     /*package*/ void clearDatabases(Context context) {
563         WebStorage.getInstance().deleteAllData();
564         maybeDisableWebsiteSettings(context);
565     }
566
567     /*package*/ void clearLocationAccess(Context context) {
568         GeolocationPermissions.getInstance().clearAll();
569         maybeDisableWebsiteSettings(context);
570     }
571
572     /*package*/ void resetDefaultPreferences(Context ctx) {
573         reset();
574         SharedPreferences p =
575             PreferenceManager.getDefaultSharedPreferences(ctx);
576         p.edit().clear().apply();
577         PreferenceManager.setDefaultValues(ctx, R.xml.browser_preferences,
578                 true);
579         // reset homeUrl
580         setHomePage(ctx, getFactoryResetHomeUrl(ctx));
581         // reset appcache max size
582         appCacheMaxSize = webStorageSizeManager.getAppCacheMaxSize();
583     }
584
585     private String getFactoryResetHomeUrl(Context context) {
586         String url = context.getResources().getString(R.string.homepage_base);
587         if (url.indexOf("{CID}") != -1) {
588             url = url.replace("{CID}",
589                     BrowserProvider.getClientId(context.getContentResolver()));
590         }
591         return url;
592     }
593
594     // Private constructor that does nothing.
595     private BrowserSettings() {
596         reset();
597     }
598
599     private void reset() {
600         // Private variables for settings
601         // NOTE: these defaults need to be kept in sync with the XML
602         // until the performance of PreferenceManager.setDefaultValues()
603         // is improved.
604         loadsImagesAutomatically = true;
605         javaScriptEnabled = true;
606         pluginState = WebSettings.PluginState.ON;
607         javaScriptCanOpenWindowsAutomatically = false;
608         showSecurityWarnings = true;
609         rememberPasswords = true;
610         saveFormData = true;
611         openInBackground = false;
612         autoFitPage = true;
613         landscapeOnly = false;
614         loadsPageInOverviewMode = true;
615         showDebugSettings = false;
616         // HTML5 API flags
617         appCacheEnabled = true;
618         databaseEnabled = true;
619         domStorageEnabled = true;
620         geolocationEnabled = true;
621         workersEnabled = true;  // only affects V8. JSC does not have a similar setting
622     }
623 }