webOS Nation Forums >  Stuff for your webOS Device >  webOS Apps & Games > Prefox
Prefox
  Reply
Like Tree2Likes

 
Thread Tools Display Modes
Old 09/22/2010, 02:14 AM   #61 (permalink)
Member
 
Posts: 48
Outstanding!!!

The Obvious:
* A little choppy on the pinch/zoom, but acceptable for alpha.
* Slow startup, but the fact that it works at all is outstanding!!! No Complaints.
* Right and left side toolbars are awesome, very nice.
* I saw support for plugins!! Crazy!! Haven't tried any yet.

Things I noticed, bugs perhaps:
* I can not seem to use the Orange+Screen to scroll in the address bar. Perhaps I just wasn't patient enough but tried a few times. Had to retype the entire url instead of correcting errors...
* Support for mjpeg! One of the things I miss the most, which apple devices seem to do, is to properly render motion jpeg streams. The WebOS browser just tries to load the never ending file and eventually crashes or freezes the phone. Prefox at least opens the first frame, so I got my hopes up! But unfortunately it never replaces that initial frame and continues to load data till the process freezes. Had to do a hard reboot to recover because I let it load to much data. (I know, I know, mjpeg is so '90s but it's what I have so I'd like to be able to view it from my Pre) ( BTW, my new Android Epic can not render mjpeg either) http://forums.precentral.net/showthread.php?p=2673378

Once again, outstanding work, haven't got to play with it as much as I'd liked, I can't wait to see where this goes in the future!!
Dolio is offline   Reply With Quote
Old 09/22/2010, 08:47 PM   #62 (permalink)
Member
 
Posts: 296
application directory = /media/cryptofs/apps/usr/palm/applications/com.fractalbrew.prefox/

Now that's a mouthful.
palmuse is offline   Reply With Quote
Thanked By: gabe2gg
Old 09/26/2010, 02:43 AM   #63 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
Anyone besides me notice a simple user agent change to something already very web friendly makes for a world of difference in browsing speed?

Also, completely extracting and reviewing every file within uncovers the program size and font size selections. Bringing all of those numbers down to the WebOS friendly sizes also makes for a world of difference in the applications stability.

If your doing any modification i would love to hear from you on what you have done to improve the application.
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]
demetry14 is offline   Reply With Quote
Old 09/26/2010, 08:46 AM   #64 (permalink)
Member
 
TopTongueBarry's Avatar
 
Posts: 1,837
Quote:
Originally Posted by sjsharksfan View Post
my testing results in a very successful instal, the app loads perfectly. It just does not load every site I tried. I loads basic sites find, but I tried to test Justin.tv, and a weather radar site and the app just closes itself..

sj
Don't bother with justin.tv on WebOS no matter what browser you use. Justin.tv requires the Adobe Flash plug-in. Need I say more......
__________________
----------------------------------------------------------------------------------------------------
I am an AT&T employee and the postings on this site are my own and don’t necessarily represent AT&T’s positions, strategies or opinions.
TopTongueBarry is offline   Reply With Quote
Old 09/26/2010, 03:19 PM   #65 (permalink)
R_E
Member
 
Posts: 341
Quote:
Originally Posted by demetry14 View Post
Also, completely extracting and reviewing every file within uncovers the program size and font size selections. Bringing all of those numbers down to the WebOS friendly sizes also makes for a world of difference in the applications stability.
can you clarify what these files are and what to edit in them?
R_E is offline   Reply With Quote
Old 09/26/2010, 03:58 PM   #66 (permalink)
Member
 
sjsharksfan's Avatar
 
Posts: 444
has anyone tried loading the playon.tv site with prefox yet? | PlayOn | Watch Hulu, CBS.com, MLB.tv, Netflix, and more on your TV with PlayOn!
I will test as soon as I can, but hopefully someone beats me to it

sj
sjsharksfan is offline   Reply With Quote
Old 09/27/2010, 11:39 AM   #67 (permalink)
Member
 
Posts: 2,513
Just a heads-up
No PDK applications run on the emulator because they're compiled for ARM architecture, and the emulator runs on i686 architecture, they're different, and since the apps access the device directly, they won't run.

This is true for any version of the emulator (1.3.5 and beyond). In fact, the developing tools for PDK lets you run a native version of your emulator that runs on your operating system, and you need openGL drivers, etc... but if you try to run this file directly on your Pre, it won't work. You need to recompile the app and send it to your device.

So, to sum things a bit (even I went confused), PDK apps won't work on the emulators
__________________
Just remember: If I helped you, press the thanks button!

Owner of: Pre Sprint, Pre Telcel, Pre Plus AT&T, Pre 2 Unlocked, Pixi Plus AT&T, and 2 TouchPads (my Pre3 was stolen so it won't appear again here).
Needs: Veer (anyone?)
Apps: Subnet Calculator, FreeCam, PhotoFun, NuttyPad (work in progress)
HomeBrew: meta-doctor and Messaging Plugins collaborator
Twitter: @cesarneg
NuttyBunny is online now   Reply With Quote
Old 09/27/2010, 12:25 PM   #68 (permalink)
Member
 
Posts: 118
installed it and considering it's alpha it runs pretty good, of course as some1 said it's slow to start and for me it crashes when I try to click on certin things but I can't wait till this is finished I know it's goin to be great and I'll report back if I noticed anything else
mindonmillions08 is offline   Reply With Quote
Old 09/29/2010, 03:00 PM   #69 (permalink)
Member
 
Posts: 118
hey what's goin on with this prefox? Any1 stop it from crashing? Or is prefox dead?
mindonmillions08 is offline   Reply With Quote
Old 09/29/2010, 05:27 PM   #70 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
Quote:
Originally Posted by mindonmillions08 View Post
hey what's goin on with this prefox? Any1 stop it from crashing? Or is prefox dead?
Mine doesn't crash much anymore. But I took the posts out explaining everything to everyone. The one thing that helps limit the crashing is a mobile user agent, because the browser can load mobile pages much better then a full blown page and it will not have to crash because of flash, gif images or other reasons in the current build.

I can not go into detail as I am on a PPC Laptop and do not have the App or SDK/PDK with me.
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]
demetry14 is offline   Reply With Quote
Old 10/01/2010, 02:02 AM   #71 (permalink)
Member
 
Posts: 180
My thoughts so far on Prefox vs. WebOS Stock Browser:


Pros :
- The start page is designed wonderfully. History is available on the start page. Bookmarks can be brought up by clicking the address bar (In the WebOS stock browser, I need to swipe down from the top & then click on the bookmarks option). Very nice.
- Find in Page (just press the web icon in the address bar for the option to pop up). For some reason, both WebOS and the iPhone stock browsers don’t offer this option. I think they feel that this option is too “geeky” for the mainstream user. It sucks.
- Read Later extension with Offine support. This is absolutely fantastic. Right now, it does not have support for images in offline mode, but text is rendered flawlessly. (Not sure this was available when the Prefox alpha was originally released).
- Extensions. (just waiting patiently for ad block ... )
- A “tab-key” functionality to move from text box to text box, e.g., after entering a username in a web page, I can press an arrow button to move the cursor to the password text-box.
- It offers to remember passwords.
- Can save web pages as PDF (just press the web icon in the address bar for the option to pop up).
- Can support a context-menu on long tap and hold (woohoo!!). This way I can use the browser with just one palm and a thumb. On the WebOS stock browser, I need to use both hands; with one hold the gesture area and use the other for the link . Needless to say, the Prefox method is more convenient.
- Can open links in new tabs in the background after long top and hold. There is an extension that can open links in new windows in WebOS stock browser, but it cannot open it in the background.

Cons:
- Violates the WebOS tab design; each tab is its own window. I keep swiping up and throwing the app away every time I only want to close a tab.
- Also violates the WebOS swipe down from the top right to see battery level, wifi settings etc. Of course we get full screen as the trade-off but it will be nice to access the system menus somehow (maybe offer a standard vs. full screen option?)
- The user-agent string is the standard desktop FireFox string; so it tries to load the main web pages of websites and is even more unstable than it can be. Of course, this can be fixed by hacking your prefs.js (which I do ).
- Several scenes do not fit the screen ; for Pre , I need to move to landscape mode for the settings page. As the developer has commented on his own posting, hopefully Fennec will support a scalable interface to fit different screen resolutions.
- No scroll bar (actually I just want what Android and iPhone do: just a thin bar that indicates your position relative to the size of the web page whose length is inversely proportional to the size of the web page)
- No option that I can find to scroll inside the web page . The WebOS stock browser has an extension (Multimod) that maps backspace to top of page, space-bar to pgdn, etc.
- Crashes a lot
- Finally, semantics: Prefox should have been called WebOSfox or something. Pre is just a model name; there is Pixi and other (hopefully!) future model names.



Prefox is a very exciting software release for the WebOS and the community will only benefit from having more choices in browsers. Eagerly looking forward and hoping for more releases!

Thanks to Mossop!

veerar.
veerar is offline   Reply With Quote
Old 10/04/2010, 11:38 PM   #72 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
This is what I have done to:

grepprefs.js
Quote:
pref("security.enable_ssl2", true);
pref("security.enable_ssl3", true);
pref("security.enable_tls", true);
pref("security.enable_tls_session_tickets", true);

pref("security.ssl.allow_unrestricted_renego_everywhere__temporarily_available_pref", false);
pref("security.ssl.renego_unrestricted_hosts", "");
pref("security.ssl.treat_unsafe_negotiation_as_broken", false);
pref("security.ssl.require_safe_negotiation", false);
pref("security.ssl.warn_missing_rfc5746", 1);
pref("security.ssl.enable_false_start", true);

pref("security.ssl2.rc4_128", false);
pref("security.ssl2.rc2_128", false);
pref("security.ssl2.des_ede3_192", false);
pref("security.ssl2.des_64", false);
pref("security.ssl2.rc4_40", false);
pref("security.ssl2.rc2_40", false);
pref("security.ssl3.rsa_rc4_128_md5", true);
pref("security.ssl3.rsa_rc4_128_sha", true);
pref("security.ssl3.rsa_fips_des_ede3_sha", true);
pref("security.ssl3.rsa_des_ede3_sha", true);
pref("security.ssl3.rsa_fips_des_sha", false);
pref("security.ssl3.rsa_des_sha", false);
pref("security.ssl3.rsa_1024_rc4_56_sha", false);
pref("security.ssl3.rsa_1024_des_cbc_sha", false);
pref("security.ssl3.rsa_rc4_40_md5", false);
pref("security.ssl3.rsa_rc2_40_md5", false);
// Camellia is broken on Windows CE for now, see bug 508113
//@line 31 "/Users/dave/mozilla/source/palm/netwerk/base/public/security-prefs.js"
pref("security.ssl3.dhe_rsa_camellia_256_sha", true);
pref("security.ssl3.dhe_dss_camellia_256_sha", true);
pref("security.ssl3.rsa_camellia_256_sha", true);
pref("security.ssl3.dhe_rsa_camellia_128_sha", true);
pref("security.ssl3.dhe_dss_camellia_128_sha", true);
pref("security.ssl3.rsa_camellia_128_sha", true);
//@line 38 "/Users/dave/mozilla/source/palm/netwerk/base/public/security-prefs.js"
pref("security.ssl3.dhe_rsa_aes_256_sha", true);
pref("security.ssl3.dhe_dss_aes_256_sha", true);
pref("security.ssl3.rsa_aes_256_sha", true);
pref("security.ssl3.ecdhe_ecdsa_aes_256_sha", true);
pref("security.ssl3.ecdhe_ecdsa_aes_128_sha", true);
pref("security.ssl3.ecdhe_ecdsa_des_ede3_sha", true);
pref("security.ssl3.ecdhe_ecdsa_rc4_128_sha", true);
pref("security.ssl3.ecdhe_ecdsa_null_sha", false);
pref("security.ssl3.ecdhe_rsa_aes_256_sha", true);
pref("security.ssl3.ecdhe_rsa_aes_128_sha", true);
pref("security.ssl3.ecdhe_rsa_des_ede3_sha", true);
pref("security.ssl3.ecdhe_rsa_rc4_128_sha", true);
pref("security.ssl3.ecdhe_rsa_null_sha", false);
pref("security.ssl3.ecdh_ecdsa_aes_256_sha", true);
pref("security.ssl3.ecdh_ecdsa_aes_128_sha", true);
pref("security.ssl3.ecdh_ecdsa_des_ede3_sha", true);
pref("security.ssl3.ecdh_ecdsa_rc4_128_sha", true);
pref("security.ssl3.ecdh_ecdsa_null_sha", false);
pref("security.ssl3.ecdh_rsa_aes_256_sha", true);
pref("security.ssl3.ecdh_rsa_aes_128_sha", true);
pref("security.ssl3.ecdh_rsa_des_ede3_sha", true);
pref("security.ssl3.ecdh_rsa_rc4_128_sha", true);
pref("security.ssl3.ecdh_rsa_null_sha", false);
pref("security.ssl3.dhe_rsa_aes_128_sha", true);
pref("security.ssl3.dhe_dss_aes_128_sha", true);
pref("security.ssl3.rsa_aes_128_sha", true);
pref("security.ssl3.dhe_rsa_des_ede3_sha", true);
pref("security.ssl3.dhe_dss_des_ede3_sha", true);
pref("security.ssl3.dhe_rsa_des_sha", false);
pref("security.ssl3.dhe_dss_des_sha", false);
pref("security.ssl3.rsa_null_sha", false);
pref("security.ssl3.rsa_null_md5", false);
pref("security.ssl3.rsa_seed_sha", true);
pref("security.default_personal_cert", "Ask Every Time");
pref("security.remember_cert_checkbox_default_setting", true);
pref("security.ask_for_password", 0);
pref("security.password_lifetime", 7);
pref("security.warn_entering_secure", false);
pref("security.warn_entering_weak", false);
pref("security.warn_leaving_secure", false);
pref("security.warn_viewing_mixed", false);
pref("security.warn_submit_insecure", false);
pref("security.OCSP.enabled", 0);
pref("security.OCSP.require", false);
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Mozilla Code Licensing
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benjamin Smedberg <bsmedberg@covad.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */

/* The prefs in this file are shipped with the GRE and should apply to all
* embedding situations. Application-specific preferences belong somewhere else,
* for example xpfe/bootstrap/browser-prefs.js
*
* Platform-specific #ifdefs at the end of this file override the generic
* entries at the top.
*/

// SYNTAX HINTS: dashes are delimiters. Use underscores instead.
// The first character after a period must be alphabetic.

pref("keyword.URL", "http://www.google.com/search?ie=UTF-8&oe=utf-8&q=");
pref("keyword.enabled", false);
pref("general.useragent.locale", "chrome://global/locale/intl.properties");
pref("general.useragent.compatMode.firefox", false);

pref("general.config.obscure_value", 13); // for MCD .cfg files

pref("general.warnOnAboutConfig", false);

// maximum number of dated backups to keep at any time
pref("browser.bookmarks.max_backups", 2);

pref("browser.cache.disk.enable", false);
//@line 64 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
pref("browser.cache.disk.capacity", 0);
//@line 68 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
pref("browser.cache.memory.enable", false);
pref("browser.cache.memory.capacity", 0);
// -1 = determine dynamically, 0 = none, n = memory capacity in kilobytes
pref("browser.cache.disk_cache_ssl", false);
// 0 = once-per-session, 1 = each-time, 2 = never, 3 = when-appropriate/automatically
pref("browser.cache.check_doc_frequency", 0);

pref("browser.cache.offline.enable", false);
//@line 77 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
// offline cache capacity in kilobytes
pref("browser.cache.offline.capacity", 0);

// offline apps should be limited to this much data in global storage
// (in kilobytes)
pref("offline-apps.quota.max", 1024);

// the user should be warned if offline app disk usage exceeds this amount
// (in kilobytes)
pref("offline-apps.quota.warn", 1024);
//@line 93 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Whether or not indexedDB is enabled.
pref("dom.indexedDB.enabled", false);
// Space to allow indexedDB databases before prompting (in MB).
pref("dom.indexedDB.warningQuota", 0);

// Fastback caching - if this pref is negative, then we calculate the number
// of content viewers to cache based on the amount of available memory.
pref("browser.sessionhistory.max_total_viewers", 0);

pref("ui.use_native_colors", true);
pref("ui.use_native_popup_windows", false);
pref("ui.click_hold_context_menus", false);
pref("browser.display.use_document_fonts", 0); // 0 = never, 1 = quick, 2 = always
pref("browser.display.use_document_colors", false);
pref("browser.display.use_system_colors", true);
pref("browser.display.foreground_color", "#000000");
pref("browser.display.background_color", "#FFFFFF");
pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
// 0 = no external leading,
// 1 = use external leading only when font provides,
// 2 = add extra leading both internal leading and external leading are zero
pref("browser.display.normal_lineheight_calc_control", 2);
pref("browser.display.show_image_placeholders", false); // true = show image placeholders while image is loaded and when image is broken
// min font device pixel size at which to turn on high quality
pref("browser.display.auto_quality_min_font_size", 16);
pref("browser.anchor_color", "#0000EE");
pref("browser.active_color", "#EE0000");
pref("browser.visited_color", "#551A8B");
pref("browser.underline_anchors", true);
pref("browser.blink_allowed", false);
pref("browser.enable_automatic_image_resizing", false);
pref("browser.enable_click_image_resizing", true);

// See 4.10 Forms — HTML5
pref("browser.autofocus", true);

// See HTML5 (including next generation additions still in development)
pref("browser.send_pings", false);
pref("browser.send_pings.max_per_link", 2); // limit the number of pings that are sent per link click
pref("browser.send_pings.require_same_host", false); // only send pings to the same host if this is true

pref("browser.display.use_focus_colors", false);
pref("browser.display.focus_background_color", "#117722");
pref("browser.display.focus_text_color", "#ffffff");
pref("browser.display.focus_ring_width", 1);
pref("browser.display.focus_ring_on_anything", false);
// focus ring border style.
// 0 = solid border, 1 = dotted border
pref("browser.display.focus_ring_style", 1);

pref("browser.helperApps.alwaysAsk.force", false);
pref("browser.helperApps.neverAsk.saveToDisk", "");
pref("browser.helperApps.neverAsk.openFile", "");

// xxxbsmedberg: where should prefs for the toolkit go?
pref("browser.chrome.toolbar_tips", false);
// 0 = Pictures Only, 1 = Text Only, 2 = Pictures and Text
pref("browser.chrome.toolbar_style", 2);
// max image size for which it is placed in the tab icon for tabbrowser.
// if 0, no images are used for tab icons for image documents.
pref("browser.chrome.image_icons.max_size", 256);

pref("browser.triple_click_selects_paragraph", true);

// When loading <video> or <audio>, check for Access-Control-Allow-Origin
// header, and disallow the connection if not present or permitted.
pref("media.enforce_same_site_origin", false);

// Media cache size in kilobytes
pref("media.cache_size", 0);

//@line 177 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Whether to autostart a media element with an |autoplay| attribute
pref("media.autoplay.enabled", false);

// 0 = Off, 1 = Full, 2 = Tagged Images Only.
// See eCMSMode in gfx/thebes/gfxPlatform.h
pref("gfx.color_management.mode", 2);
pref("gfx.color_management.display_profile", "");
pref("gfx.color_management.rendering_intent", 0);

pref("gfx.3d_video.enabled", false);

pref("gfx.downloadable_fonts.enabled", false);

pref("gfx.font_rendering.harfbuzz.level", 1);

//@line 198 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

pref("accessibility.browsewithcaret", false);
pref("accessibility.warn_on_browsewithcaret", false);

pref("accessibility.browsewithcaret_shortcut.enabled", false);

//@line 205 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
// Tab focus model bit field:
// 1 focuses text controls, 2 focuses other form elements, 4 adds links.
// Most users will want 1, 3, or 7.
// On OS X, we use Full Keyboard Access system preference,
// unless accessibility.tabfocus is set by the user.
pref("accessibility.tabfocus", 7);
pref("accessibility.tabfocus_applies_to_xul", false);

// Forcibly disable a11y on win32, even if something attempts
// to enable it.
pref("accessibility.win32.force_disabled", false);

// On OS X, we follow the "Click in the scrollbar to:" system preference
// unless this preference was set manually
pref("ui.scrollToClick", 0);

//@line 225 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

pref("accessibility.usetexttospeech", "");
pref("accessibility.usebrailledisplay", "");
pref("accessibility.accesskeycausesactivation", false);
pref("accessibility.mouse_focuses_formcontrol", false);

// Type Ahead Find
pref("accessibility.typeaheadfind", false);
pref("accessibility.typeaheadfind.autostart", false);
// casesensitive: controls the find bar's case-sensitivity
// 0 - "never" (case-insensitive)
// 1 - "always" (case-sensitive)
// other - "auto" (case-sensitive for mixed-case input, insensitive otherwise)
pref("accessibility.typeaheadfind.casesensitive", 0);
pref("accessibility.typeaheadfind.linksonly", true);
pref("accessibility.typeaheadfind.startlinksonly", false);
pref("accessibility.typeaheadfind.timeout", 4000);
pref("accessibility.typeaheadfind.enabletimeout", true);
pref("accessibility.typeaheadfind.soundURL", "beep");
pref("accessibility.typeaheadfind.enablesound", false);
pref("accessibility.typeaheadfind.prefillwithselection", true);

// use Mac OS X Appearance panel text smoothing setting when rendering text, disabled by default
pref("gfx.use_text_smoothing_setting", false);

// loading and rendering of framesets and iframes
pref("browser.frames.enabled", false);

// Number of characters to consider emphasizing for rich autocomplete results
pref("toolkit.autocomplete.richBoundaryCutoff", 200);

pref("toolkit.scrollbox.smoothScroll", true);
pref("toolkit.scrollbox.scrollIncrement", 20);
pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150);

// view source
pref("view_source.syntax_highlight", false);
pref("view_source.wrap_long_lines", false);
pref("view_source.editor.external", false);
pref("view_source.editor.path", "");
// allows to add further arguments to the editor; use the %LINE% placeholder
// for jumping to a specific line (e.g. "/line:%LINE%" or "--goto %LINE%")
pref("view_source.editor.args", "");

// dispatch left clicks only to content in browser (still allows clicks to chrome/xul)
pref("nglayout.events.dispatchLeftClickOnly", true);

// whether or not to draw images while dragging
pref("nglayout.enable_drag_images", false);

// scrollbar snapping region
// 0 - off
// 1 and higher - slider thickness multiple
pref("slider.snapMultiplier", 0);

// option to choose plug-in finder
pref("application.use_ns_plugin_finder", false);

// URI fixup prefs
pref("browser.fixup.alternate.enabled", true);
pref("browser.fixup.alternate.prefix", "www.");
pref("browser.fixup.alternate.suffix", ".com");
pref("browser.fixup.hide_user_pass", true);

// Location Bar AutoComplete
pref("browser.urlbar.autocomplete.enabled", false);

// Print header customization
// Use the following codes:
// &T - Title
// &U - Document URL
// &D - Date/Time
// &P - Page Number
// &PT - Page Number "of" Page total
// Set each header to a string containing zero or one of these codes
// and the code will be replaced in that string by the corresponding data
pref("print.print_headerleft", "&T");
pref("print.print_headercenter", "");
pref("print.print_headerright", "&U");
pref("print.print_footerleft", "&PT");
pref("print.print_footercenter", "");
pref("print.print_footerright", "&D");
pref("print.show_print_progress", false);

// xxxbsmedberg: more toolkit prefs

// When this is set to false each window has its own PrintSettings
// and a change in one window does not affect the others
pref("print.use_global_printsettings", false);

// Save the Printings after each print job
pref("print.save_print_settings", false);

pref("print.whileInPrintPreview", false);

// Cache old Presentation when going into Print Preview
pref("print.always_cache_old_pres", false);

// Enables you to specify the amount of the paper that is to be treated
// as unwriteable. The print_edge_XXX and print_margin_XXX preferences
// are treated as offsets that are added to this pref.
// Default is "-1", which means "use the system default". (If there is
// no system default, then the -1 is treated as if it were 0.)
// This is used by both Printing and Print Preview.
// Units are in 1/100ths of an inch.
pref("print.print_unwriteable_margin_top", 0);
pref("print.print_unwriteable_margin_left", 0);
pref("print.print_unwriteable_margin_right", 0);
pref("print.print_unwriteable_margin_bottom", 0);

// Enables you to specify the gap from the edge of the paper's
// unwriteable area to the margin.
// This is used by both Printing and Print Preview
// Units are in 1/100ths of an inch.
pref("print.print_edge_top", 0);
pref("print.print_edge_left", 0);
pref("print.print_edge_right", 0);
pref("print.print_edge_bottom", 0);

// Pref used by the spellchecker extension to control the
// maximum number of misspelled words that will be underlined
// in a document.
pref("extensions.spellcheck.inline.max-misspellings", 500);

// Prefs used by libeditor. Prefs specific to seamonkey composer
// belong in comm-central/editor/ui/composer.js

pref("editor.use_custom_colors", false);
pref("editor.singleLine.pasteNewlines", 2);
pref("editor.quotesPreformatted", false);
pref("editor.use_css", true);
pref("editor.css.default_length_unit", "px");
pref("editor.resizing.preserve_ratio", true);
pref("editor.positioning.offset", 0);


// Default Capability Preferences: Security-Critical!
// Editing these may create a security risk - be sure you know what you're doing
//pref("capability.policy.default.barprop.visible.set", "UniversalBrowserWrite");

pref("capability.policy.default_policynames", "mailnews");

pref("capability.policy.default.DOMException.code", "allAccess");
pref("capability.policy.default.DOMException.message", "allAccess");
pref("capability.policy.default.DOMException.name", "allAccess");
pref("capability.policy.default.DOMException.result", "allAccess");
pref("capability.policy.default.DOMException.toString.get", "allAccess");

pref("capability.policy.default.History.back.get", "allAccess");
pref("capability.policy.default.History.current", "UniversalBrowserRead");
pref("capability.policy.default.History.forward.get", "allAccess");
pref("capability.policy.default.History.go.get", "allAccess");
pref("capability.policy.default.History.item", "UniversalBrowserRead");
pref("capability.policy.default.History.next", "UniversalBrowserRead");
pref("capability.policy.default.History.previous", "UniversalBrowserRead");
pref("capability.policy.default.History.toString", "UniversalBrowserRead");

pref("capability.policy.default.Location.hash.set", "allAccess");
pref("capability.policy.default.Location.href.set", "allAccess");
pref("capability.policy.default.Location.replace.get", "allAccess");

pref("capability.policy.default.Navigator.preference", "allAccess");
pref("capability.policy.default.Navigator.preferenceinternal.get", "UniversalPreferencesRead");
pref("capability.policy.default.Navigator.preferenceinternal.set", "UniversalPreferencesWrite");

pref("capability.policy.default.Window.blur.get", "allAccess");
pref("capability.policy.default.Window.close.get", "allAccess");
pref("capability.policy.default.Window.closed.get", "allAccess");
pref("capability.policy.default.Window.focus.get", "allAccess");
pref("capability.policy.default.Window.frames.get", "allAccess");
pref("capability.policy.default.Window.history.get", "allAccess");
pref("capability.policy.default.Window.length.get", "allAccess");
pref("capability.policy.default.Window.location", "allAccess");
pref("capability.policy.default.Window.opener.get", "allAccess");
pref("capability.policy.default.Window.parent.get", "allAccess");
pref("capability.policy.default.Window.postMessage.get", "allAccess");
pref("capability.policy.default.Window.self.get", "allAccess");
pref("capability.policy.default.Window.top.get", "allAccess");
pref("capability.policy.default.Window.window.get", "allAccess");

pref("capability.policy.default.Selection.addSelectionListener", "UniversalXPConnect");
pref("capability.policy.default.Selection.removeSelectionListener", "UniversalXPConnect");

// Restrictions on the DOM for mail/news - see bugs 66938 and 84545
pref("capability.policy.mailnews.sites", "mailbox: imap: news:");

pref("capability.policy.mailnews.*.attributes.get", "noAccess");
pref("capability.policy.mailnews.*.baseURI.get", "noAccess");
pref("capability.policy.mailnews.*.data.get", "noAccess");
pref("capability.policy.mailnews.*.getAttribute", "noAccess");
pref("capability.policy.mailnews.HTMLDivElement.getAttribute", "sameOrigin");
pref("capability.policy.mailnews.*.getAttributeNS", "noAccess");
pref("capability.policy.mailnews.*.getAttributeNode", "noAccess");
pref("capability.policy.mailnews.*.getAttributeNodeNS", "noAccess");
pref("capability.policy.mailnews.*.getNamedItem", "noAccess");
pref("capability.policy.mailnews.*.getNamedItemNS", "noAccess");
pref("capability.policy.mailnews.*.host.get", "noAccess");
pref("capability.policy.mailnews.*.hostname.get", "noAccess");
pref("capability.policy.mailnews.*.href.get", "noAccess");
pref("capability.policy.mailnews.*.innerHTML.get", "noAccess");
pref("capability.policy.mailnews.*.lowSrc.get", "noAccess");
pref("capability.policy.mailnews.*.nodeValue.get", "noAccess");
pref("capability.policy.mailnews.*.pathname.get", "noAccess");
pref("capability.policy.mailnews.*.protocol.get", "noAccess");
pref("capability.policy.mailnews.*.src.get", "noAccess");
pref("capability.policy.mailnews.*.substringData.get", "noAccess");
pref("capability.policy.mailnews.*.text.get", "noAccess");
pref("capability.policy.mailnews.*.textContent", "noAccess");
pref("capability.policy.mailnews.*.title.get", "noAccess");
pref("capability.policy.mailnews.*.wholeText", "noAccess");
pref("capability.policy.mailnews.DOMException.toString", "noAccess");
pref("capability.policy.mailnews.HTMLAnchorElement.toString", "noAccess");
pref("capability.policy.mailnews.HTMLDocument.domain", "noAccess");
pref("capability.policy.mailnews.HTMLDocument.URL", "noAccess");
pref("capability.policy.mailnews.*.documentURI", "noAccess");
pref("capability.policy.mailnews.Location.toString", "noAccess");
pref("capability.policy.mailnews.Range.toString", "noAccess");
pref("capability.policy.mailnews.Window.blur", "noAccess");
pref("capability.policy.mailnews.Window.focus", "noAccess");
pref("capability.policy.mailnews.Window.innerWidth.set", "noAccess");
pref("capability.policy.mailnews.Window.innerHeight.set", "noAccess");
pref("capability.policy.mailnews.Window.moveBy", "noAccess");
pref("capability.policy.mailnews.Window.moveTo", "noAccess");
pref("capability.policy.mailnews.Window.name.set", "noAccess");
pref("capability.policy.mailnews.Window.outerHeight.set", "noAccess");
pref("capability.policy.mailnews.Window.outerWidth.set", "noAccess");
pref("capability.policy.mailnews.Window.resizeBy", "noAccess");
pref("capability.policy.mailnews.Window.resizeTo", "noAccess");
pref("capability.policy.mailnews.Window.screenX.set", "noAccess");
pref("capability.policy.mailnews.Window.screenY.set", "noAccess");
pref("capability.policy.mailnews.Window.sizeToContent", "noAccess");
pref("capability.policy.mailnews.document.load", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.channel", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.getInterface", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.responseXML", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.responseText", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.status", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.statusText", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.abort", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.getAllResponseHeaders", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.getResponseHeader", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.open", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.send", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.setRequestHeader", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.readyState", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.overrideMimeType", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.onload", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.onerror", "noAccess");
pref("capability.policy.mailnews.XMLHttpRequest.onreadystatechange", "noAccess");
pref("capability.policy.mailnews.XMLSerializer.serializeToString", "noAccess");
pref("capability.policy.mailnews.XMLSerializer.serializeToStream", "noAccess");
pref("capability.policy.mailnews.DOMParser.parseFromString", "noAccess");
pref("capability.policy.mailnews.DOMParser.parseFromStream", "noAccess");
pref("capability.policy.mailnews.SOAPCall.transportURI", "noAccess");
pref("capability.policy.mailnews.SOAPCall.verifySourceHeader", "noAccess");
pref("capability.policy.mailnews.SOAPCall.invoke", "noAccess");
pref("capability.policy.mailnews.SOAPCall.asyncInvoke", "noAccess");
pref("capability.policy.mailnews.SOAPResponse.fault", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.styleURI", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.getAssociatedEncoding", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.setEncoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.getEncoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.setDecoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.setDecoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.getDecoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.defaultEncoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.defaultDecoder", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.schemaCollection", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.encode", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.decode", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.mapSchemaURI", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.unmapSchemaURI", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.getInternalSchemaURI", "noAccess");
pref("capability.policy.mailnews.SOAPEncoding.getExternalSchemaURI", "noAccess");
pref("capability.policy.mailnews.SOAPFault.element", "noAccess");
pref("capability.policy.mailnews.SOAPFault.faultNamespaceURI", "noAccess");
pref("capability.policy.mailnews.SOAPFault.faultCode", "noAccess");
pref("capability.policy.mailnews.SOAPFault.faultString", "noAccess");
pref("capability.policy.mailnews.SOAPFault.faultActor", "noAccess");
pref("capability.policy.mailnews.SOAPFault.detail", "noAccess");
pref("capability.policy.mailnews.SOAPHeaderBlock.actorURI", "noAccess");
pref("capability.policy.mailnews.SOAPHeaderBlock.mustUnderstand", "noAccess");
pref("capability.policy.mailnews.SOAPParameter", "noAccess");
pref("capability.policy.mailnews.SOAPPropertyBagMutator.propertyBag", "noAccess");
pref("capability.policy.mailnews.SOAPPropertyBagMutator.addProperty", "noAccess");
pref("capability.policy.mailnews.SchemaLoader.load", "noAccess");
pref("capability.policy.mailnews.SchemaLoader.loadAsync", "noAccess");
pref("capability.policy.mailnews.SchemaLoader.processSchemaElement", "noAccess");
pref("capability.policy.mailnews.SchemaLoader.onLoad", "noAccess");
pref("capability.policy.mailnews.SchemaLoader.onError", "noAccess");
pref("capability.policy.mailnews.WSDLLoader.load", "noAccess");
pref("capability.policy.mailnews.WSDLLoader.loadAsync", "noAccess");
pref("capability.policy.mailnews.WSDLLoader.onLoad", "noAccess");
pref("capability.policy.mailnews.WSDLLoader.onError", "noAccess");
pref("capability.policy.mailnews.WebServiceProxyFactory.createProxy", "noAccess");
pref("capability.policy.mailnews.WebServiceProxyFactory.createProxyAsync", "noAccess");
pref("capability.policy.mailnews.WebServiceProxyFactory.onLoad", "noAccess");
pref("capability.policy.mailnews.WebServiceProxyFactory.onError", "noAccess");

// XMLExtras
pref("capability.policy.default.XMLHttpRequest.channel", "noAccess");
pref("capability.policy.default.XMLHttpRequest.getInterface", "noAccess");
pref("capability.policy.default.XMLHttpRequest.open-uri", "allAccess");
pref("capability.policy.default.DOMParser.parseFromStream", "noAccess");

// Clipboard
pref("capability.policy.default.Clipboard.cutcopy", "noAccess");
pref("capability.policy.default.Clipboard.paste", "noAccess");

// Scripts & Windows prefs
pref("dom.disable_image_src_set", false);
pref("dom.disable_window_flip", false);
pref("dom.disable_window_move_resize", false);
pref("dom.disable_window_status_change", false);
pref("dom.disable_window_open_feature.titlebar", false);
pref("dom.disable_window_open_feature.close", false);
pref("dom.disable_window_open_feature.toolbar", false);
pref("dom.disable_window_open_feature.location", false);
pref("dom.disable_window_open_feature.personalbar", false);
pref("dom.disable_window_open_feature.menubar", false);
pref("dom.disable_window_open_feature.scrollbars", false);
pref("dom.disable_window_open_feature.resizable", true);
pref("dom.disable_window_open_feature.minimizable", false);
pref("dom.disable_window_open_feature.status", true);
pref("dom.allow_scripts_to_close_windows", false);
pref("dom.disable_open_during_load", false);
pref("dom.popup_maximum", 20);
pref("dom.popup_allowed_events", "change click dblclick mouseup reset submit");
pref("dom.disable_open_click_delay", 1000);
pref("dom.storage.enabled", true);
pref("dom.storage.default_quota", 1024);

// Parsing perf prefs. For now just mimic what the old code did.
//@line 563 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
pref("content.sink.pending_event_mode", 0);
//@line 565 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Disable popups from plugins by default
// 0 = openAllowed
// 1 = openControlled
// 2 = openAbused
pref("privacy.popups.disable_from_plugins", 2);
pref("dom.event.contextmenu.enabled", false);
pref("javascript.enabled", true);
pref("javascript.options.strict", true);
//@line 579 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
pref("javascript.options.relimit", true);
pref("javascript.options.tracejit.content", true);
pref("javascript.options.tracejit.chrome", true);
pref("javascript.options.methodjit.content", true);
pref("javascript.options.methodjit.chrome", false);
// This preference limits the memory usage of javascript.
// If you want to change these values for your device,
// please find Bug 417052 comment 17 and Bug 456721
// Comment 32.
pref("javascript.options.mem.high_water_mark", 32);
pref("javascript.options.mem.gc_frequency", 1600);

// advanced prefs
pref("advanced.mailftp", false);
pref("image.animation_mode", "normal");

// Same-origin policy for file URIs, "false" is traditional
pref("security.fileuri.strict_origin_policy", true);

// If there is ever a security firedrill that requires
// us to block certian ports global, this is the pref
// to use. Is is a comma delimited list of port numbers
// for example:
// pref("network.security.ports.banned", "1,2,3,4,5");
// prevents necko connecting to ports 1-5 unless the protocol
// overrides.

// Default action for unlisted external protocol handlers
pref("network.protocol-handler.external-default", true); // OK to load
pref("network.protocol-handler.warn-external-default", true); // warn before load

// Prevent using external protocol handlers for these schemes
pref("network.protocol-handler.external.hcp", false);
pref("network.protocol-handler.external.vbscript", false);
pref("network.protocol-handler.external.javascript", false);
pref("network.protocol-handler.external.data", false);
pref("network.protocol-handler.external.ms-help", false);
pref("network.protocol-handler.external.shell", false);
pref("network.protocol-handler.external.vnd.ms.radio", false);
//@line 621 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
pref("network.protocol-handler.external.disk", false);
pref("network.protocol-handler.external.disks", false);
pref("network.protocol-handler.external.afp", false);
pref("network.protocol-handler.external.moz-icon", false);

// An exposed protocol handler is one that can be used in all contexts. A
// non-exposed protocol handler is one that can only be used internally by the
// application. For example, a non-exposed protocol would not be loaded by the
// application in response to a link click or a X-remote openURL command.
// Instead, it would be deferred to the system's external protocol handler.
// Only internal/built-in protocol handlers can be marked as exposed.

// This pref controls the default settings. Per protocol settings can be used
// to override this value.
pref("network.protocol-handler.expose-all", true);

// Example: make IMAP an exposed protocol
// pref("network.protocol-handler.expose.imap", false);
pref("network.hosts.smtp_server", "mail");
pref("network.hosts.pop_server", "mail");

// <http>
pref("network.http.version", "1.1"); // default
// pref("network.http.version", "1.0"); // uncomment this out in case of problems
// pref("network.http.version", "0.9"); // it'll work too if you're crazy
// keep-alive option is effectively obsolete. Nevertheless it'll work with
// some older 1.0 servers:

pref("network.http.proxy.version", "1.1"); // default
// pref("network.http.proxy.version", "1.0"); // uncomment this out in case of problems
// (required if using junkbuster proxy)

// enable caching of http documents
pref("network.http.use-cache", false);

// this preference can be set to override the socket type used for normal
// HTTP traffic. an empty value indicates the normal TCP/IP socket type.
pref("network.http.default-socket-type", "");

pref("network.http.keep-alive", false); // set it to false in case of problems
pref("network.http.proxy.keep-alive", true);
// There is a problem with some IIS7 servers that don't close the connection
// properly after it times out (bug #491541). Default timeout on IIS7 is
// 120 seconds. We need to reuse or drop the connection within this time.
// We set the timeout a little shorter to keep a reserve for cases when
// the packet is lost or delayed on the route.
pref("network.http.keep-alive.timeout", 115);

// limit the absolute number of http connections.
pref("network.http.max-connections", 30);

// limit the absolute number of http connections that can be established per
// host. if a http proxy server is enabled, then the "server" is the proxy
// server. Otherwise, "server" is the http origin server.
pref("network.http.max-connections-per-server", 15);

// if network.http.keep-alive is true, and if NOT connecting via a proxy, then
// a new connection will only be attempted if the number of active persistent
// connections to the server is less then max-persistent-connections-per-server.
pref("network.http.max-persistent-connections-per-server", 6);

// if network.http.keep-alive is true, and if connecting via a proxy, then a
// new connection will only be attempted if the number of active persistent
// connections to the proxy is less then max-persistent-connections-per-proxy.
pref("network.http.max-persistent-connections-per-proxy", 8);

// amount of time (in seconds) to suspend pending requests, before spawning a
// new connection, once the limit on the number of persistent connections per
// host has been reached. however, a new connection will not be created if
// max-connections or max-connections-per-server has also been reached.
pref("network.http.request.max-start-delay", 10);

// Headers
pref("network.http.accept.default", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
pref("network.http.sendRefererHeader", 2); // 0=don't send any, 1=send only on clicks, 2=send on image requests as well

// Controls whether we send HTTPS referres to other HTTPS sites.
// By default this is enabled for compatibility (see bug 141641)
pref("network.http.sendSecureXSiteReferrer", true);

// Maximum number of consecutive redirects before aborting.
pref("network.http.redirection-limit", 20);

// Enable http compression: comment this out in case of problems with 1.1
// NOTE: support for "compress" has been disabled per bug 196406.
// NOTE: separate values with comma+space (", "): see bug 576033
pref("network.http.accept-encoding", "gzip, deflate");

pref("network.http.pipelining" , true);
pref("network.http.pipelining.ssl" , false); // disable pipelining over SSL
pref("network.http.proxy.pipelining", false);

// Max number of requests in the pipeline
pref("network.http.pipelining.maxrequests" , 4);

// Prompt for 307 redirects
pref("network.http.prompt-temp-redirect", false);

// On networks deploying QoS, it is recommended that these be lockpref()'d,
// since inappropriate marking can easily overwhelm bandwidth reservations
// for certain services (i.e. EF for VoIP, AF4x for interactive video,
// AF3x for broadcast/streaming video, etc)

// default value for HTTP
// in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594,
// Section 4.8 "High-Throughput Data Service Class"
pref("network.http.qos", 0);

// default values for FTP
// in a DSCP environment this should be 40 (0x28, or AF11), per RFC-4594,
// Section 4.8 "High-Throughput Data Service Class", and 80 (0x50, or AF22)
// per Section 4.7 "Low-Latency Data Service Class".
pref("network.ftp.data.qos", 0);
pref("network.ftp.control.qos", 0);

// </http>

// <ws>: WebSocket
pref("network.websocket.enabled", true);
// </ws>

// If false, remote JAR files that are served with a content type other than
// application/java-archive or application/x-jar will not be opened
// by the jar channel.
pref("network.jar.open-unsafe-types", false);

// This preference controls whether or not internationalized domain names (IDN)
// are handled. IDN requires a nsIIDNService implementation.
pref("network.enableIDN", true);

// This preference, if true, causes all UTF-8 domain names to be normalized to
// punycode. The intention is to allow UTF-8 domain names as input, but never
// generate them from punycode.
pref("network.IDN_show_punycode", false);

// TLDs with "network.IDN.whitelist.tld" explicitly set to true are treated as
// IDN-safe. Otherwise, they're treated as unsafe and punycode will be used
// for displaying them in the UI (e.g. URL bar). Note that these preferences
// are referred to ONLY when "network.IDN_show_punycode" is false. In other
// words, all IDNs will be shown in punycode if "network.IDN_show_punycode"
// is true.

// ccTLDs
pref("network.IDN.whitelist.ac", true);
pref("network.IDN.whitelist.ar", true);
pref("network.IDN.whitelist.at", true);
pref("network.IDN.whitelist.br", true);
pref("network.IDN.whitelist.ch", true);
pref("network.IDN.whitelist.cl", true);
pref("network.IDN.whitelist.cn", true);
pref("network.IDN.whitelist.de", true);
pref("network.IDN.whitelist.dk", true);
pref("network.IDN.whitelist.es", true);
pref("network.IDN.whitelist.fi", true);
pref("network.IDN.whitelist.gr", true);
pref("network.IDN.whitelist.hu", true);
pref("network.IDN.whitelist.io", true);
pref("network.IDN.whitelist.ir", true);
pref("network.IDN.whitelist.is", true);
pref("network.IDN.whitelist.jp", true);
pref("network.IDN.whitelist.kr", true);
pref("network.IDN.whitelist.li", true);
pref("network.IDN.whitelist.lt", true);
pref("network.IDN.whitelist.lu", true);
pref("network.IDN.whitelist.no", true);
pref("network.IDN.whitelist.nu", true);
pref("network.IDN.whitelist.nz", true);
pref("network.IDN.whitelist.pl", true);
pref("network.IDN.whitelist.pr", true);
pref("network.IDN.whitelist.se", true);
pref("network.IDN.whitelist.sh", true);
pref("network.IDN.whitelist.th", true);
pref("network.IDN.whitelist.tm", true);
pref("network.IDN.whitelist.tw", true);
pref("network.IDN.whitelist.vn", true);

// IDN ccTLDs
// ae, UAE, .<Emarat>
pref("network.IDN.whitelist.xn--mgbaam7a8h", true);
// sa, Saudi Arabia, .<al-Saudiah>
pref("network.IDN.whitelist.xn--mgberp4a5d4ar", true);
// ru, Russian Federation, .<RF>
pref("network.IDN.whitelist.xn--p1ai", true);
// jo, Jordan, .<Al-Ordon>
pref("network.IDN.whitelist.xn--mgbayh7gpa", true);

// gTLDs
pref("network.IDN.whitelist.biz", true);
pref("network.IDN.whitelist.cat", true);
pref("network.IDN.whitelist.info", true);
pref("network.IDN.whitelist.museum", true);
pref("network.IDN.whitelist.org", true);
pref("network.IDN.whitelist.tel", true);

// NOTE: Before these can be removed, one of bug 414812's tests must be updated
// or it will likely fail! Please CC jwalden+bmo on the bug associated
// with removing these so he can provide a patch to make the necessary
// changes to avoid bustage.
// ".test" localised TLDs for ICANN's top-level IDN trial
pref("network.IDN.whitelist.xn--0zwm56d", true);
pref("network.IDN.whitelist.xn--11b5bs3a9aj6g", true);
pref("network.IDN.whitelist.xn--80akhbyknj4f", true);
pref("network.IDN.whitelist.xn--9t4b11yi5a", true);
pref("network.IDN.whitelist.xn--deba0ad", true);
pref("network.IDN.whitelist.xn--g6w251d", true);
pref("network.IDN.whitelist.xn--hgbk6aj7f53bba", true);
pref("network.IDN.whitelist.xn--hlcj6aya9esc7a", true);
pref("network.IDN.whitelist.xn--jxalpdlp", true);
pref("network.IDN.whitelist.xn--kgbechtv", true);
pref("network.IDN.whitelist.xn--zckzah", true);

// If a domain includes any of the following characters, it may be a spoof
// attempt and so we always display the domain name as punycode. This would
// override the settings "network.IDN_show_punycode" and
// "network.IDN.whitelist.*".
pref("network.IDN.blacklist_chars", "\u0020\u00A0\u00BC\u00BD\u00BE\u01C3\u02D0\u0337\u0338\u0589\u05C3\u05F4\u0609\u060A\u066A\u06D4\u0 701\u0702\u0703\u0704\u115F\u1160\u1735\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\ u200A\u200B\u2024\u2027\u2028\u2029\u202F\u2039\u203A\u2041\u2044\u2052\u205F\u2153\u2154\u2155\u215 6\u2157\u2158\u2159\u215A\u215B\u215C\u215D\u215E\u215F\u2215\u2236\u23AE\u2571\u29F6\u29F8\u2AFB\u2 AFD\u2FF0\u2FF1\u2FF2\u2FF3\u2FF4\u2FF5\u2FF6\u2FF7\u2FF8\u2FF9\u2FFA\u2FFB\u3000\u3002\u3014\u3015\ u3033\u3164\u321D\u321E\u33AE\u33AF\u33C6\u33DF\uA789\uFE14\uFE15\uFE3F\uFE5D\uFE5E\uFEFF\uFF0E\uFF0 F\uFF61\uFFA0\uFFF9\uFFFA\uFFFB\uFFFC\uFFFD");

// This preference specifies a list of domains for which DNS lookups will be
// IPv4 only. Works around broken DNS servers which can't handle IPv6 lookups
// and/or allows the user to disable IPv6 on a per-domain basis. See bug 68796.
pref("network.dns.ipv4OnlyDomains", "");

// This preference can be used to turn off IPv6 name lookups. See bug 68796.
pref("network.dns.disableIPv6", false);

// This preference controls whether or not URLs with UTF-8 characters are
// escaped. Set this preference to TRUE for strict RFC2396 conformance.
pref("network.standard-url.escape-utf8", true);

// This preference controls whether or not URLs are always encoded and sent as
// UTF-8.
pref("network.standard-url.encode-utf8", true);

// This preference controls whether or not queries are encoded and sent as
// UTF-8.
pref("network.standard-url.encode-query-utf8", false);

// Idle timeout for ftp control connections - 5 minute default
pref("network.ftp.idleConnectionTimeout", 300);

// directory listing format
// 2: HTML
// 3: XUL directory viewer
// all other values are treated like 2
pref("network.dir.format", 2);

// enables the prefetch service (i.e., prefetching of <link rel="next"> URLs).
pref("network.prefetch-next", false);


// The following prefs pertain to the negotiate-auth extension (see bug 17578),
// which provides transparent Kerberos or NTLM authentication using the SPNEGO
// protocol. Each pref is a comma-separated list of keys, where each key has
// the format:
// [scheme "://"] [host [":" port]]
// For example, "foo.com" would match "http://www.foo.com/bar", etc.

// This list controls which URIs can use the negotiate-auth protocol. This
// list should be limited to the servers you know you'll need to login to.
pref("network.negotiate-auth.trusted-uris", "");
// This list controls which URIs can support delegation.
pref("network.negotiate-auth.delegation-uris", "");

// Allow SPNEGO by default when challenged by a proxy server.
pref("network.negotiate-auth.allow-proxies", true);

// Path to a specific gssapi library
pref("network.negotiate-auth.gsslib", "");

// Specify if the gss lib comes standard with the OS
pref("network.negotiate-auth.using-native-gsslib", true);

//@line 900 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Controls which NTLM authentication implementation we default to. True forces
// the use of our generic (internal) NTLM authentication implementation vs. any
// native implementation provided by the os. This pref is for diagnosing issues
// with native NTLM. (See bug 520607 for details.) Using generic NTLM authentication
// can expose the user to reflection attack vulnerabilities. Do not change this
// unless you know what you're doing!
// This pref should be removed 6 months after the release of firefox 3.6.
pref("network.auth.force-generic-ntlm", false);

// The following prefs are used to enable automatic use of the operating
// system's NTLM implementation to silently authenticate the user with their
// Window's domain logon. The trusted-uris pref follows the format of the
// trusted-uris pref for negotiate authentication.
pref("network.automatic-ntlm-auth.allow-proxies", false);
pref("network.automatic-ntlm-auth.trusted-uris", "");

// This preference controls whether or not the LM hash will be included in
// response to a NTLM challenge. By default, this is disabled since servers
// should almost never need the LM hash, and the LM hash is what makes NTLM
// authentication less secure. See bug 250691 for further details.
// NOTE: automatic-ntlm-auth which leverages the OS-provided NTLM
// implementation will not be affected by this preference.
pref("network.ntlm.send-lm-response", false);

pref("permissions.default.image", 1); // 1-Accept, 2-Deny, 3-dontAcceptForeign

pref("network.proxy.type", 5);
pref("network.proxy.ftp", "");
pref("network.proxy.ftp_port", 0);
pref("network.proxy.http", "");
pref("network.proxy.http_port", 0);
pref("network.proxy.ssl", "");
pref("network.proxy.ssl_port", 0);
pref("network.proxy.socks", "");
pref("network.proxy.socks_port", 0);
pref("network.proxy.socks_version", 5);
pref("network.proxy.socks_remote_dns", false);
pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
pref("network.proxy.failover_timeout", 1800); // 30 minutes
pref("network.online", true); //online/offline
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontUse
pref("network.cookie.thirdparty.sessionOnly", false);
pref("network.cookie.lifetimePolicy", 0); // accept normally, 1-askBeforeAccepting, 2-acceptForSession,3-acceptForNDays
pref("network.cookie.alwaysAcceptSessionCookies", false);
pref("network.cookie.prefsMigrated", false);
pref("network.cookie.lifetime.days", 90);

// The PAC file to load. Ignored unless network.proxy.type is 2.
pref("network.proxy.autoconfig_url", "");

// If we cannot load the PAC file, then try again (doubling from interval_min
// until we reach interval_max or the PAC file is successfully loaded).
pref("network.proxy.autoconfig_retry_interval_min", 5); // 5 seconds
pref("network.proxy.autoconfig_retry_interval_max", 300); // 5 minutes

pref("converter.html2txt.structs", true); // Output structured phrases (strong, em, code, sub, sup, b, i, u)
pref("converter.html2txt.header_strategy", 1); // 0 = no indention; 1 = indention, increased with header level; 2 = numbering and slight indention

pref("intl.accept_languages", "chrome://global/locale/intl.properties");
pref("intl.accept_charsets", "iso-8859-1,*,utf-8");
pref("intl.menuitems.alwaysappendaccesskeys","chrome://global/locale/intl.properties");
pref("intl.menuitems.insertseparatorbeforeaccesskeys","chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.static", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more1", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more2", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more3", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more4", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more5", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.unicode", "UTF-8, UTF-16LE, UTF-16BE, UTF-32, UTF-32LE, UTF-32BE");
pref("intl.charsetmenu.mailedit", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.cache", "");
pref("intl.charsetmenu.mailview.cache", "");
pref("intl.charsetmenu.composer.cache", "");
pref("intl.charsetmenu.browser.cache.size", 5);
pref("intl.charset.detector", "chrome://global/locale/intl.properties");
pref("intl.charset.default", "chrome://global-platform/locale/intl.properties");
pref("intl.ellipsis", "chrome://global-platform/locale/intl.properties");
pref("intl.locale.matchOS", false);
// fallback charset list for Unicode conversion (converting from Unicode)
// currently used for mail send only to handle symbol characters (e.g Euro, trademark, smartquotes)
// for ISO-8859-1
pref("intl.fallbackCharsetList.ISO-8859-1", "windows-1252");
pref("font.language.group", "chrome://global/locale/intl.properties");

// these locales have right-to-left UI
pref("intl.uidirection.ar", "rtl");
pref("intl.uidirection.he", "rtl");
pref("intl.uidirection.fa", "rtl");

pref("font.mathfont-family", "STIXNonUnicode, STIXSizeOneSym, STIXSize1, STIXGeneral, Standard Symbols L, DejaVu Sans, Cambria Math");

// Some CJK fonts have bad underline offset, their CJK character glyphs are overlapped (or adjoined) to its underline.
// These fonts are ignored the underline offset, instead of it, the underline is lowered to bottom of its em descent.
pref("font.blacklist.underline_offset", "FangSong,Gulim,GulimChe,MingLiU,MingLiU-ExtB,MingLiU_HKSCS,MingLiU-HKSCS-ExtB,MS Gothic,MS Mincho,MS PGothic,MS PMincho,MS UI Gothic,PMingLiU,PMingLiU-ExtB,SimHei,SimSun,SimSun-ExtB,Hei,Kai,Apple LiGothic,Apple LiSung,Osaka");

pref("images.dither", "auto");
pref("security.directory", "");

pref("signed.applets.codebase_principal_support", false);
pref("security.checkloaduri", true);
pref("security.xpconnect.plugin.unrestricted", true);
// security-sensitive dialogs should delay button enabling. In milliseconds.
pref("security.dialog_enable_delay", 2000);
pref("security.csp.enable", true);
pref("security.csp.debug", false);

// Modifier key prefs: default to Windows settings,
// menu access key = alt, accelerator key = control.
// Use 17 for Ctrl, 18 for Alt, 224 for Meta, 0 for none. Mac settings in macprefs.js
pref("ui.key.accelKey", 17);
pref("ui.key.menuAccessKey", 18);
pref("ui.key.generalAccessKey", -1);

// If generalAccessKey is -1, use the following two prefs instead.
// Use 0 for disabled, 1 for Shift, 2 for Ctrl, 4 for Alt, 8 for Meta
// (values can be combined, e.g. 5 for Alt+Shift)
pref("ui.key.chromeAccess", 4);
pref("ui.key.contentAccess", 5);

pref("ui.key.menuAccessKeyFocuses", false); // overridden below
pref("ui.key.saveLink.shift", true); // true = shift, false = meta

// Disable page loading activity cursor by default.
pref("ui.use_activity_cursor", false);

// Middle-mouse handling
pref("middlemouse.paste", false);
pref("middlemouse.openNewWindow", true);
pref("middlemouse.contentLoadURL", false);
pref("middlemouse.scrollbarPosition", false);

// Clipboard behavior
pref("clipboard.autocopy", false);

// mouse wheel scroll transaction period of time (in milliseconds)
pref("mousewheel.transaction.timeout", 1500);
// mouse wheel scroll transaction is held even if the mouse cursor is moved.
pref("mousewheel.transaction.ignoremovedelay", 100);

// Macbook touchpad two finger pixel scrolling
pref("mousewheel.enable_pixel_scrolling", true);

// prefs for app level mouse wheel scrolling acceleration.
// number of mousewheel clicks when acceleration starts
// acceleration can be turned off if pref is set to -1
pref("mousewheel.acceleration.start", -1);
// factor to be multiplied for constant acceleration
pref("mousewheel.acceleration.factor", 10);

// Prefs for override the system mouse wheel scrolling speed on the root
// content of the web pages. When
// "mousewheel.system_scroll_override_on_root_content.enabled" is true and the system
// scrolling speed isn't customized by the user, the root content scrolling
// speed is multiplied by the following factors. The value will be used as
// 1/100. E.g., 200 means 2.00.
// NOTE: Even if "mousewheel.system_scroll_override_on_root_content.enabled" is
// true, when Gecko detects the user customized the system scrolling speed
// settings, the override isn't executed.
pref("mousewheel.system_scroll_override_on_root_content.vertical.factor", 200);
pref("mousewheel.system_scroll_override_on_root_content.horizontal.factor", 200);

// 0=lines, 1=pages, 2=history , 3=text size
pref("mousewheel.withnokey.action",0);
pref("mousewheel.withnokey.numlines",6);
pref("mousewheel.withnokey.sysnumlines",true);
pref("mousewheel.withcontrolkey.action",0);
pref("mousewheel.withcontrolkey.numlines",1);
pref("mousewheel.withcontrolkey.sysnumlines",true);
// mousewheel.withshiftkey, see the Mac note below.
pref("mousewheel.withshiftkey.action",0);
pref("mousewheel.withshiftkey.numlines",1);
pref("mousewheel.withshiftkey.sysnumlines",true);
pref("mousewheel.withaltkey.action",2);
pref("mousewheel.withaltkey.numlines",1);
pref("mousewheel.withaltkey.sysnumlines",false);
pref("mousewheel.withmetakey.action",0);
pref("mousewheel.withmetakey.numlines",1);
pref("mousewheel.withmetakey.sysnumlines",true);

// activate horizontal scrolling by default
pref("mousewheel.horizscroll.withnokey.action",0);
pref("mousewheel.horizscroll.withnokey.numlines",1);
pref("mousewheel.horizscroll.withnokey.sysnumlines",true);
pref("mousewheel.horizscroll.withcontrolkey.action",0);
pref("mousewheel.horizscroll.withcontrolkey.numlines",1);
pref("mousewheel.horizscroll.withcontrolkey.sysnumlines",true);
pref("mousewheel.horizscroll.withshiftkey.action",0);
pref("mousewheel.horizscroll.withshiftkey.numlines",1);
pref("mousewheel.horizscroll.withshiftkey.sysnumlines",true);
pref("mousewheel.horizscroll.withaltkey.action",2);
pref("mousewheel.horizscroll.withaltkey.numlines",-1);
pref("mousewheel.horizscroll.withaltkey.sysnumlines",false);
pref("mousewheel.horizscroll.withmetakey.action",0);
pref("mousewheel.horizscroll.withmetakey.numlines",1);
pref("mousewheel.horizscroll.withmetakey.sysnumlines",true);

pref("profile.confirm_automigration",true);
// profile.migration_behavior determines how the profiles root is set
// 0 - use NS_APP_USER_PROFILES_ROOT_DIR
// 1 - create one based on the NS4.x profile root
// 2 - use, if not empty, profile.migration_directory otherwise same as 0
pref("profile.migration_behavior",0);
pref("profile.migration_directory", "");

// the amount of time (in seconds) that must elapse
// before we think your mozilla profile is defunct
// and you'd benefit from re-migrating from 4.x
// see bug #137886 for more details
//
// if -1, we never think your profile is defunct
// and users will never see the remigrate UI.
pref("profile.seconds_until_defunct", -1);
// We can show it anytime from menus
pref("profile.manage_only_at_launch", false);

pref("prefs.converted-to-utf8",false);

// --------------------------------------------------
// IBMBIDI
// --------------------------------------------------
//
// ------------------
// Text Direction
// ------------------
// 1 = directionLTRBidi *
// 2 = directionRTLBidi
pref("bidi.direction", 1);
// ------------------
// Text Type
// ------------------
// 1 = charsettexttypeBidi *
// 2 = logicaltexttypeBidi
// 3 = visualtexttypeBidi
pref("bidi.texttype", 1);
// ------------------
// Numeral Style
// ------------------
// 0 = nominalnumeralBidi *
// 1 = regularcontextnumeralBidi
// 2 = hindicontextnumeralBidi
// 3 = arabicnumeralBidi
// 4 = hindinumeralBidi
// 5 = persiancontextnumeralBidi
// 6 = persiannumeralBidi
pref("bidi.numeral", 0);
// ------------------
// Support Mode
// ------------------
// 1 = mozillaBidisupport *
// 2 = OsBidisupport
// 3 = disableBidisupport
pref("bidi.support", 1);
// ------------------
// Charset Mode
// ------------------
// 1 = doccharactersetBidi *
// 2 = defaultcharactersetBidi
pref("bidi.characterset", 1);
// Whether delete and backspace should immediately delete characters not
// visually adjacent to the caret, or adjust the visual position of the caret
// on the first keypress and delete the character on a second keypress
pref("bidi.edit.delete_immediately", false);

// Bidi caret movement style:
// 0 = logical
// 1 = visual
// 2 = visual, but logical during selection
pref("bidi.edit.caret_movement_style", 2);

// Setting this pref to |true| forces Bidi UI menu items and keyboard shortcuts
// to be exposed, and enables the directional caret hook. By default, only
// expose it for bidi-associated system locales.
pref("bidi.browser.ui", false);

// used for double-click word selection behavior. Win will override.
pref("layout.word_select.eat_space_to_next_word", false);
pref("layout.word_select.stop_at_punctuation", true);

// controls caret style and word-delete during text selection
// 0 = use platform default
// 1 = caret moves and blinks as when there is no selection; word
// delete deselects the selection and then deletes word (Windows default)
// 2 = caret moves to selection edge and is not visible during selection;
// word delete deletes the selection (Mac default)
// 3 = caret moves and blinks as when there is no selection; word delete
// deletes the selection (Unix default)
pref("layout.selection.caret_style", 0);

// pref to control whether or not to replace backslashes with Yen signs
// in documents encoded in one of Japanese legacy encodings (EUC-JP,
// Shift_JIS, ISO-2022-JP)
pref("layout.enable_japanese_specific_transform", false);

// pref to force frames to be resizable
pref("layout.frames.force_resizability", false);

// pref to report CSS errors to the error console
pref("layout.css.report_errors", false);

// Should the :visited selector ever match (otherwise :link matches instead)?
pref("layout.css.visited_links_enabled", true);

// Override DPI. A value of -1 means use the maximum of 96 and the system DPI.
// A value of 0 means use the system DPI. A positive value is used as the DPI.
// This sets the physical size of a device pixel and thus controls the
// interpretation of physical units such as "pt".
pref("layout.css.dpi", -1);

// Set the number of device pixels per CSS pixel. A value <= 0 means choose
// automatically based on user settings for the platform (e.g., "UI scale factor"
// on Mac). A positive value is used as-is. This effectively controls the size
// of a CSS "px". This is only used for windows on the screen, not for printing.
// XXX the default value here should be 0, but before we can set it to 0,
// we have to get this feature working on all platforms.
pref("layout.css.devPixelsPerPx", "1.0");

// pref for which side vertical scrollbars should be on
// 0 = end-side in UI direction
// 1 = end-side in document/content direction
// 2 = right
// 3 = left
pref("layout.scrollbar.side", 0);

// pref to control browser frame rate, in Hz. A value <= 0 means choose
// automatically based on knowledge of the platform (or 60Hz if no platform-
// specific information is available).
pref("layout.frame_rate", -1);

// pref to control precision of the frame rate timer. When true,
// we use a "precise" timer, which means each notification fires
// Nms after the start of the last notification. That means if the
// processing of the notification is slow, the timer can fire immediately
// after we've just finished processing the last notification, which might
// lead to starvation problems.
// When false, we use a "slack" timer which fires Nms after the *end*
// of the last notification. This can give less tight frame rates
// but provides more time for other operations when the browser is
// heavily loaded.
pref("layout.frame_rate.precise", false);

// pref to permit users to make verified SOAP calls by default
pref("capability.policy.default.SOAPCall.invokeVerifySourceHeader", "allAccess");

// if true, allow plug-ins to override internal imglib decoder mime types in full-page mode
pref("plugin.override_internal_types", false);
pref("plugin.expose_full_path", false); // if true navigator.plugins reveals full path

// See bug 136985. Gives embedders a pref to hook into to show
// a popup blocker if they choose.
pref("browser.popups.showPopupBlocker", false);

// Pref to control whether the viewmanager code does double-buffering or not
// See http://bugzilla.mozilla.org/show_bug.cgi?id=169483 for further details...
pref("viewmanager.do_doublebuffering", true);

// whether use prefs from system
pref("config.use_system_prefs", false);

// if the system has enabled accessibility
pref("config.use_system_prefs.accessibility", false);

// enable single finger gesture input (win7+ tablets)
pref("gestures.enable_single_finger_input", true);

/*
* What are the entities that you want Mozilla to save using mnemonic
* names rather than numeric codes? E.g. If set, we'll output &nbsp;
* otherwise, we may output 0xa0 depending on the charset.
*
* "none" : don't use any entity names; only use numeric codes.
* "basic" : use entity names just for &nbsp; &amp; &lt; &gt; &quot; for
* interoperability/exchange with products that don't support more
* than that.
* "latin1" : use entity names for 8bit accented letters and other special
* symbols between 128 and 255.
* "html" : use entity names for 8bit accented letters, greek letters, and
* other special markup symbols as defined in HTML4.
*/
//pref("editor.encode_entity", "html");

pref("editor.resizing.preserve_ratio", true);
pref("editor.positioning.offset", 0);

pref("dom.max_chrome_script_run_time", 20);
pref("dom.max_script_run_time", 10);

//@line 1289 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
// How long a plugin is allowed to process a synchronous IPC message
// before we consider it "hung".
pref("dom.ipc.plugins.timeoutSecs", 45);
// How long a plugin launch is allowed to take before
// we consider it failed.
pref("dom.ipc.plugins.processLaunchTimeoutSecs", 45);
//@line 1300 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 1304 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
// Linux plugins using Xt instead of Xembed don't work out-of-process yet.
pref("dom.ipc.plugins.enabled.libvlcplugin.so", false);
pref("dom.ipc.plugins.enabled.nppdf.so", false);
//@line 1310 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

pref("svg.enabled", true);
pref("svg.smil.enabled", true);

pref("font.minimum-size.ar", 0);
pref("font.minimum-size.x-armn", 0);
pref("font.minimum-size.x-beng", 0);
pref("font.minimum-size.x-baltic", 0);
pref("font.minimum-size.x-central-euro", 0);
pref("font.minimum-size.zh-CN", 0);
pref("font.minimum-size.zh-HK", 0);
pref("font.minimum-size.zh-TW", 0);
pref("font.minimum-size.x-cyrillic", 0);
pref("font.minimum-size.x-devanagari", 0);
pref("font.minimum-size.x-ethi", 0);
pref("font.minimum-size.x-geor", 0);
pref("font.minimum-size.el", 0);
pref("font.minimum-size.x-gujr", 0);
pref("font.minimum-size.x-guru", 0);
pref("font.minimum-size.he", 0);
pref("font.minimum-size.ja", 0);
pref("font.minimum-size.x-knda", 0);
pref("font.minimum-size.x-khmr", 0);
pref("font.minimum-size.ko", 0);
pref("font.minimum-size.x-mlym", 0);
pref("font.minimum-size.x-orya", 0);
pref("font.minimum-size.x-sinh", 0);
pref("font.minimum-size.x-tamil", 0);
pref("font.minimum-size.x-telu", 0);
pref("font.minimum-size.x-tibt", 0);
pref("font.minimum-size.th", 0);
pref("font.minimum-size.tr", 0);
pref("font.minimum-size.x-cans", 0);
pref("font.minimum-size.x-western", 0);
pref("font.minimum-size.x-unicode", 0);
pref("font.minimum-size.x-user-def", 0);

//@line 1770 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 2198 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 2401 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 2497 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 2771 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 2775 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
// Handled differently under Mac/Windows
pref("network.hosts.smtp_server", "localhost");
pref("network.hosts.pop_server", "pop");
pref("network.protocol-handler.warn-external.file", false);
pref("browser.drag_out_of_frame_style", 1);

// Middle-mouse handling
pref("middlemouse.paste", true);
pref("middlemouse.contentLoadURL", true);
pref("middlemouse.openNewWindow", true);
pref("middlemouse.scrollbarPosition", true);

// Clipboard behavior
pref("clipboard.autocopy", true);

pref("browser.urlbar.clickSelectsAll", false);

// Tab focus model bit field:
// 1 focuses text controls, 2 focuses other form elements, 4 adds links.
// Leave this at the default, 7, to match mozilla1.0-era user expectations.
// pref("accessibility.tabfocus", 1);

// autocomplete keyboard grab workaround
pref("autocomplete.grab_during_popup", true);
pref("autocomplete.ungrab_during_mode_switch", true);

// Default to using the system filepicker if possible, but allow
// toggling to use the XUL filepicker
pref("ui.allow_platform_file_picker", true);

// should NetworkManager be authoritative for online/offline status?
pref("toolkit.networkmanager.disable", true);

pref("helpers.global_mime_types_file", "/etc/mime.types");
pref("helpers.global_mailcap_file", "/etc/mailcap");
pref("helpers.private_mime_types_file", "~/.mime.types");
pref("helpers.private_mailcap_file", "~/.mailcap");
pref("java.global_java_version_file", "/etc/.java/versions");
pref("java.private_java_version_file", "~/.java/versions");
pref("java.default_java_location_solaris", "/usr/j2se");
pref("java.default_java_location_others", "/usr/java");
pref("java.java_plugin_library_name", "javaplugin_oji");
pref("applications.telnet", "xterm -e telnet %h %p");
pref("applications.tn3270", "xterm -e tn3270 %h");
pref("applications.rlogin", "xterm -e rlogin %h");
pref("applications.rlogin_with_user", "xterm -e rlogin %h -l %u");
pref("print.print_command", "lpr ${MOZ_PRINTER_NAME:+-P\"$MOZ_PRINTER_NAME\"}");
pref("print.printer_list", ""); // list of printers, separated by spaces
pref("print.print_reversed", false);
pref("print.print_color", true);
pref("print.print_landscape", false);
pref("print.print_paper_size", 0);

// print_extra_margin enables platforms to specify an extra gap or margin
// around the content of the page for Print Preview only
pref("print.print_extra_margin", 0); // twips

pref("font.allow_double_byte_special_chars", true);
// font names

pref("font.alias-list", "sans,sans-serif,serif,monospace");

// ar

pref("font.name.serif.el", "serif");
pref("font.name.sans-serif.el", "sans-serif");
pref("font.name.monospace.el", "monospace");

pref("font.name.serif.he", "serif");
pref("font.name.sans-serif.he", "sans-serif");
pref("font.name.monospace.he", "monospace");

pref("font.name.serif.ja", "serif");
pref("font.name.sans-serif.ja", "sans-serif");
pref("font.name.monospace.ja", "monospace");

pref("font.name.serif.ko", "serif");
pref("font.name.sans-serif.ko", "sans-serif");
pref("font.name.monospace.ko", "monospace");

pref("font.name.serif.th", "serif");
pref("font.name.sans-serif.th", "sans-serif");
pref("font.name.monospace.th", "monospace");

pref("font.name.serif.tr", "serif");
pref("font.name.sans-serif.tr", "sans-serif");
pref("font.name.monospace.tr", "monospace");

pref("font.name.serif.x-baltic", "serif");
pref("font.name.sans-serif.x-baltic", "sans-serif");
pref("font.name.monospace.x-baltic", "monospace");

pref("font.name.serif.x-central-euro", "serif");
pref("font.name.sans-serif.x-central-euro", "sans-serif");
pref("font.name.monospace.x-central-euro", "monospace");

pref("font.name.serif.x-cyrillic", "serif");
pref("font.name.sans-serif.x-cyrillic", "sans-serif");
pref("font.name.monospace.x-cyrillic", "monospace");

pref("font.name.serif.x-unicode", "serif");
pref("font.name.sans-serif.x-unicode", "sans-serif");
pref("font.name.monospace.x-unicode", "monospace");

pref("font.name.serif.x-user-def", "serif");
pref("font.name.sans-serif.x-user-def", "sans-serif");
pref("font.name.monospace.x-user-def", "monospace");

pref("font.name.serif.x-western", "serif");
pref("font.name.sans-serif.x-western", "sans-serif");
pref("font.name.monospace.x-western", "monospace");

pref("font.name.serif.zh-CN", "serif");
pref("font.name.sans-serif.zh-CN", "sans-serif");
pref("font.name.monospace.zh-CN", "monospace");

// ming_uni.ttf (HKSCS-2001)
// http://www.info.gov.hk/digital21/eng...nload/uime.exe
pref("font.name.serif.zh-HK", "serif");
pref("font.name.sans-serif.zh-HK", "sans-serif");
pref("font.name.monospace.zh-HK", "monospace");

// zh-TW

pref("font.default.ar", "sans-serif");
pref("font.size.variable.ar", 14);
pref("font.size.fixed.ar", 10);

pref("font.default.el", "serif");
pref("font.size.variable.el", 14);
pref("font.size.fixed.el", 10);

pref("font.default.he", "sans-serif");
pref("font.size.variable.he", 14);
pref("font.size.fixed.he", 10);

pref("font.default.ja", "sans-serif");
pref("font.size.variable.ja", 14);
pref("font.size.fixed.ja", 14);

pref("font.default.ko", "sans-serif");
pref("font.size.variable.ko", 14);
pref("font.size.fixed.ko", 14);

pref("font.default.th", "serif");
pref("font.size.variable.th", 14);
pref("font.size.fixed.th", 11);
pref("font.minimum-size.th", 11);

pref("font.default.tr", "serif");
pref("font.size.variable.tr", 14);
pref("font.size.fixed.tr", 10);

pref("font.default.x-baltic", "serif");
pref("font.size.variable.x-baltic", 14);
pref("font.size.fixed.x-baltic", 10);

pref("font.default.x-central-euro", "serif");
pref("font.size.variable.x-central-euro", 14);
pref("font.size.fixed.x-central-euro", 10);

pref("font.default.x-cyrillic", "serif");
pref("font.size.variable.x-cyrillic", 14);
pref("font.size.fixed.x-cyrillic", 10);

pref("font.default.x-unicode", "serif");
pref("font.size.variable.x-unicode", 14);
pref("font.size.fixed.x-unicode", 10);

pref("font.default.x-user-def", "serif");
pref("font.size.variable.x-user-def", 14);
pref("font.size.fixed.x-user-def", 10);

pref("font.default.x-western", "serif");
pref("font.size.variable.x-western", 14);
pref("font.size.fixed.x-western", 10);

pref("font.default.zh-CN", "sans-serif");
pref("font.size.variable.zh-CN", 14);
pref("font.size.fixed.zh-CN", 14);

pref("font.default.zh-TW", "sans-serif");
pref("font.size.variable.zh-TW", 14);
pref("font.size.fixed.zh-TW", 14);

pref("font.default.zh-HK", "sans-serif");
pref("font.size.variable.zh-HK", 14);
pref("font.size.fixed.zh-HK", 14);

pref("font.default.x-devanagari", "serif");
pref("font.size.variable.x-devanagari", 14);
pref("font.size.fixed.x-devanagari", 11);

pref("font.default.x-tamil", "serif");
pref("font.size.variable.x-tamil", 14);
pref("font.size.fixed.x-tamil", 11);

pref("font.default.x-armn", "serif");
pref("font.size.variable.x-armn", 14);
pref("font.size.fixed.x-armn", 11);

pref("font.default.x-beng", "serif");
pref("font.size.variable.x-beng", 14);
pref("font.size.fixed.x-beng", 11);

pref("font.default.x-cans", "serif");
pref("font.size.variable.x-cans", 14);
pref("font.size.fixed.x-cans", 11);

pref("font.default.x-ethi", "serif");
pref("font.size.variable.x-ethi", 14);
pref("font.size.fixed.x-ethi", 11);

pref("font.default.x-geor", "serif");
pref("font.size.variable.x-geor", 14);
pref("font.size.fixed.x-geor", 11);

pref("font.default.x-gujr", "serif");
pref("font.size.variable.x-gujr", 14);
pref("font.size.fixed.x-gujr", 11);

pref("font.default.x-guru", "serif");
pref("font.size.variable.x-guru", 14);
pref("font.size.fixed.x-guru", 11);

pref("font.default.x-khmr", "serif");
pref("font.size.variable.x-khmr", 14);
pref("font.size.fixed.x-khmr", 11);

pref("font.default.x-mlym", "serif");
pref("font.size.variable.x-mlym", 14);
pref("font.size.fixed.x-mlym", 11);

pref("font.default.x-orya", "serif");
pref("font.size.variable.x-orya", 14);
pref("font.size.fixed.x-orya", 11);

pref("font.default.x-telu", "serif");
pref("font.size.variable.x-telu", 14);
pref("font.size.fixed.x-telu", 11);

pref("font.default.x-knda", "serif");
pref("font.size.variable.x-knda", 14);
pref("font.size.fixed.x-knda", 11);

pref("font.default.x-sinh", "serif");
pref("font.size.variable.x-sinh", 14);
pref("font.size.fixed.x-sinh", 11);

pref("font.default.x-tibt", "serif");
pref("font.size.variable.x-tibt", 14);
pref("font.size.fixed.x-tibt", 11);

/* PostScript print module prefs */
// pref("print.postscript.enabled", true);
pref("print.postscript.paper_size", "letter");
pref("print.postscript.orientation", "portrait");
pref("print.postscript.print_command", "lpr ${MOZ_PRINTER_NAME:+-P\"$MOZ_PRINTER_NAME\"}");

// On GTK2 platform, we should use topmost window level for the default window
// level of <panel> element of XUL. GTK2 has only two window types. One is
// normal top level window, other is popup window. The popup window is always
// topmost window level, therefore, we are using normal top level window for
// non-topmost panel, but it is pretty hacky. On some Window Managers, we have
// 2 problems:
// 1. The non-topmost panel steals focus from its parent window at showing.
// 2. The parent of non-topmost panel is not activated when the panel is hidden.
// So, we have no reasons we should use non-toplevel window for popup.
pref("ui.panel.default_level_parent", true);

pref("mousewheel.system_scroll_override_on_root_content.enabled", false);

//@line 3051 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 3077 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 3097 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 3105 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Login Manager prefs
pref("signon.rememberSignons", false);
pref("signon.SignonFileName", "signons.txt"); // obsolete
pref("signon.SignonFileName2", "signons2.txt"); // obsolete
pref("signon.SignonFileName3", "signons3.txt"); // obsolete
pref("signon.autofillForms", false);
pref("signon.autologin.proxy", false);
pref("signon.debug", false);

// Satchel (Form Manager) prefs
pref("browser.formfill.debug", false);
pref("browser.formfill.enable", false);
pref("browser.formfill.expire_days", 14);
pref("browser.formfill.saveHttpsForms", false);
pref("browser.formfill.agedWeight", 2);
pref("browser.formfill.bucketSize", 1);
pref("browser.formfill.maxTimeGroupings", 25);
pref("browser.formfill.timeGroupingSize", 604800);
pref("browser.formfill.boundaryWeight", 25);
pref("browser.formfill.prefixWeight", 5);

// Zoom prefs
pref("browser.zoom.full", false);
pref("zoom.minPercent", 50);
pref("zoom.maxPercent", 300);
pref("toolkit.zoomManager.zoomValues", ".3,.5,.67,.8,.9,1,1.1,1.2,1.33,1.5,1.7,2,2.4,3");

// Image cache prefs
// The maximum size, in bytes, of the decoded images we cache
pref("image.cache.size", 1024000);
// A weight, from 0-1000, to place on time when comparing to size.
// Size is given a weight of 1000 - timeweight.
pref("image.cache.timeweight", 500);

// The default Accept header sent for images loaded over HTTP(S)
pref("image.http.accept", "image/png,image/*;q=0.8,*/*;q=0.5");

//
// Image memory management prefs
//

// Discards inactive image frames and re-decodes them on demand from
// compressed data.
pref("image.mem.discardable", true);

// Prevents images from automatically being decoded on load, instead allowing
// them to be decoded on demand when they are drawn.
pref("image.mem.decodeondraw", false);

// Minimum timeout for image discarding (in milliseconds). The actual time in
// which an image must inactive for it to be discarded will vary between this
// value and twice this value.
pref("image.mem.min_discard_timeout_ms", 10000);

// Chunk size for calls to the image decoders
pref("image.mem.decode_bytes_at_a_time", 200000);

// The longest time we can spend in an iteration of an async decode
pref("image.mem.max_ms_before_yield", 400);

// The maximum source data size for which we auto sync decode
pref("image.mem.max_bytes_for_sync_decode", 150000);

// WebGL prefs
pref("webgl.enabled_for_all_sites", false);
pref("webgl.shader_validator", true);
pref("webgl.force_osmesa", false);
pref("webgl.mochitest_native_gl", false);
pref("webgl.osmesalib", "");
pref("webgl.verbose", false);

//@line 3183 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

//@line 3188 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Initialize default render-mode.
pref("mozilla.widget.render-mode", -1);

// Default value of acceleration for all widgets.
//@line 3196 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"
pref("layers.accelerate-all", false);
//@line 3198 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Whether to allow acceleration on layers at all.
pref("layers.accelerate-none", false);

//@line 3210 "/Users/dave/mozilla/source/palm/modules/libpref/src/init/all.js"

// Enable/Disable the geolocation API for content
pref("geo.enabled", true);

// Enable/Disable the orientation API for content
pref("accelerometer.enabled", true);

// Enable/Disable HTML5 parser
pref("html5.enable", true);
// Toggle which thread the HTML5 parser uses for stream parsing
pref("html5.offmainthread", true);
// Time in milliseconds between the time a network buffer is seen and the
// timer firing when the timer hasn't fired previously in this parse in the
// off-the-main-thread HTML5 parser.
pref("html5.flushtimer.initialdelay", 120);
// Time in milliseconds between the time a network buffer is seen and the
// timer firing when the timer has already fired previously in this parse.
pref("html5.flushtimer.subsequentdelay", 120);

// Push/Pop/Replace State prefs
pref("browser.history.allowPushState", true);
pref("browser.history.allowReplaceState", true);
pref("browser.history.allowPopState", true);
pref("browser.history.maxStateObjectSize", 65536);

// XPInstall prefs
pref("xpinstall.whitelist.required", true);
pref("extensions.alwaysUnpack", false);

pref("network.buffer.cache.count", 24);
pref("network.buffer.cache.size", 32768);
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]

Last edited by demetry14; 10/06/2010 at 12:22 AM.
demetry14 is offline   Reply With Quote
Thanked By: mamouton
Old 10/04/2010, 11:43 PM   #73 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
This is what I have done to:

browser.js
Quote:
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/*
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Mozilla Code Licensing
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Mobile Browser.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brad Lassey <blassey@mozilla.com>
* Mark Finkle <mfinkle@mozilla.com>
* Aleks Totic <a@totic.org>
* Johnathan Nightingale <johnath@mozilla.com>
* Stuart Parmenter <stuart@mozilla.com>
* Taras Glek <tglek@mozilla.com>
* Roy Frostig <rfrostig@mozilla.com>
* Ben Combee <bcombee@mozilla.com>
* Matt Brubeck <mbrubeck@mozilla.com>
* Benjamin Stover <bstover@mozilla.com>
* Miika Jarvinen <mjarvin@gmail.com>
* Jaakko Kiviluoto <jaakko.kiviluoto@digia.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */

let Cc = Components.classes;
let Ci = Components.interfaces;
let Cu = Components.utils;

function getBrowser() {
return Browser.selectedBrowser;
}

const kDefaultBrowserWidth = 980;

// Override sizeToContent in the main window. It breaks things (bug 565887)
window.sizeToContent = function() {
Components.utils.reportError("window.sizeToContent is not allowed in this window");
}

//@line 70 "/Users/dave/mozilla/source/palm/mobile/chrome/content/browser.js"

const endl = '\n';

function debug() {
let bv = Browser._browserView;
let tc = bv._tileManager._tileCache;
let scrollbox = document.getElementById("content-scrollbox")
.boxObject.QueryInterface(Ci.nsIScrollBoxObject);

let x = {};
let y = {};
let w = {};
let h = {};
scrollbox.getPosition(x, y);
scrollbox.getScrolledSize(w, h);
let container = document.getElementById("tile-container");
let [x, y] = [x.value, y.value];
let [w, h] = [w.value, h.value];
if (bv) {
dump('----------------------DEBUG!-------------------------\n');
dump(bv._browserViewportState.toString() + endl);

dump(endl);

dump('location from Browser: ' + Browser.selectedBrowser.currentURI.spec + endl);
dump('location from BV : ' + bv.getBrowser().currentURI.spec + endl);

dump(endl + endl);

let cr = bv._tileManager._criticalRect;
dump('criticalRect from BV: ' + (cr ? cr.toString() : null) + endl);
dump('visibleRect from BV : ' + bv.getVisibleRect().toString() + endl);
dump('visibleRect from foo: ' + Browser.getVisibleRect().toString() + endl);

dump('bv batchops depth: ' + bv._batchOps.length + endl);
dump('renderpause depth: ' + bv._renderMode + endl);

dump(endl);

dump('window.innerWidth : ' + window.innerWidth + endl);
dump('window.innerHeight: ' + window.innerHeight + endl);

dump(endl);

dump('container width,height from BV: ' + bv._container.style.width + ', '
+ bv._container.style.height + endl);
dump('container width,height via DOM: ' + container.style.width + ', '
+ container.style.height + endl);

dump(endl);

dump('scrollbox position : ' + x + ', ' + y + endl);
dump('scrollbox scrolledsize: ' + w + ', ' + h + endl);


let sb = document.getElementById("content-scrollbox");
dump('container location: ' + Math.round(container.getBoundingClientRect().left) + " " +
Math.round(container.getBoundingClientRect().top) + endl);

dump(endl);

let mouseModule = ih._modules[0];
dump('ih grabber : ' + ih._grabber + endl);
dump('ih grabdepth: ' + ih._grabDepth + endl);
dump('ih listening: ' + !ih._ignoreEvents + endl);
dump('ih suppress : ' + ih._suppressNextClick + endl);
dump('mouseModule : ' + mouseModule + endl);

dump(endl);

dump('tilecache capacity: ' + bv._tileManager._tileCache.getCapacity() + endl);
dump('tilecache size : ' + bv._tileManager._tileCache.size + endl);
dump('tilecache iBound : ' + bv._tileManager._tileCache.iBound + endl);
dump('tilecache jBound : ' + bv._tileManager._tileCache.jBound + endl);

dump('-----------------------------------------------------\n');
}
}

function debugTile(i, j) {
let bv = Browser._browserView;
let tc = bv._tileManager._tileCache;
let t = tc.getTile(i, j);

dump('------ DEBUGGING TILE (' + i + ',' + j + ') --------\n');

dump('in bounds: ' + tc.inBounds(i, j) + endl);
dump('occupied : ' + !!tc.lookup(i, j) + endl);
if (t)
{
dump('toString : ' + t.toString(true) + endl);
dump('free : ' + t.free + endl);
dump('dirtyRect: ' + t._dirtyTileCanvasRect + endl);

let len = tc._tilePool.length;
for (let k = 0; k < len; ++k)
if (tc._tilePool[k] === t)
dump('found in tilePool at index ' + k + endl);
}

dump('------------------------------------\n');
}

function onDebugKeyPress(ev) {
let bv = Browser._browserView;

if (!ev.ctrlKey)
return;

// use capitals so we require SHIFT here too

const a = 65; // debug all critical tiles
const b = 66; // dump an ASCII graphic of the tile map
const c = 67;
const d = 68; // debug dump
const e = 69;
const f = 70; // free memory by clearing a tab.
const g = 71;
const h = 72;
const i = 73; // toggle info click mode
const j = 74;
const k = 75;
const l = 76; // restart lazy crawl
const m = 77; // fix mouseout
const n = 78;
const o = 79;
const p = 80; // debug tiles in pool order
const q = 81; // toggle orientation
const r = 82; // reset visible rect
const s = 83;
const t = 84;
const u = 85; // debug given list of tiles separated by space
const v = 86;
const w = 87;
const x = 88;
const y = 89;
const z = 90; // set zoom level to 1

if (window.tileMapMode) {
function putChar(ev, col, row) {
let tile = tc.getTile(col, row);
switch (ev.charCode) {
case h: // held tiles
dump(tile ? (tile.free ? '*' : 'h') : ' ');
break;
case d: // dirty tiles
dump(tile ? (tile.isDirty() ? 'd' : '*') : ' ');
break;
case o: // occupied tileholders
dump(tc.lookup(col, row) ? 'o' : ' ');
break;
}
}

let tc = Browser._browserView._tileManager._tileCache;
let col, row;

dump(endl);

dump(' ');
for (col = 0; col < tc.iBound; ++col)
dump(col % 10);

dump(endl);

for (row = 0; row < tc.jBound; ++row) {

dump((row % 10) + ' ');

for (col = 0; col < tc.iBound; ++col) {
putChar(ev, col, row);
}

dump(endl);
}
dump(endl + endl);

for (let ii = 0; ii < tc._tilePool.length; ++ii) {
let tile = tc._tilePool[ii];
putChar(ev, tile.i, tile.j);
}

dump(endl + endl);

window.tileMapMode = false;
return;
}

switch (ev.charCode) {
case f:
MemoryObserver.observe();
dump("Forced a GC\n");
break;
case r:
bv.onAfterVisibleMove();
//bv.setVisibleRect(Browser.getVisibleRect());

case d:
debug();

break;
case l:
bv._tileManager.restartLazyCrawl(bv._tileManager._criticalRect);

break;
case b:
window.tileMapMode = true;
break;
case u:
let ijstrs = window.prompt('row,col plz').split(' ');
for each (let ijstr in ijstrs) {
let [i, j] = ijstr.split(',').map(function (x) { return parseInt(x); });
debugTile(i, j);
}

break;
case a:
let cr = bv._tileManager._criticalRect;
dump('>>>>>> critical rect is ' + (cr ? cr.toString() : cr) + '\n');
if (cr) {
let starti = cr.left >> kTileExponentWidth;
let endi = cr.right >> kTileExponentWidth;

let startj = cr.top >> kTileExponentHeight;
let endj = cr.bottom >> kTileExponentHeight;

for (var jj = startj; jj <= endj; ++jj)
for (var ii = starti; ii <= endi; ++ii)
debugTile(ii, jj);
}

break;
case i:
window.infoMode = !window.infoMode;
break;
case m:
Util.dumpLn("renderMode:", bv._renderMode);
Util.dumpLn("batchOps:",bv._batchOps.length);
bv.resumeRendering();
break;
case p:
let tc = bv._tileManager._tileCache;
dump('************* TILE POOL ****************\n');
for (let ii = 0, len = tc._tilePool.length; ii < len; ++ii) {
if (window.infoMode)
debugTile(tc._tilePool[ii].i, tc._tilePool[ii].j);
else
dump(tc._tilePool[ii].i + ',' + tc._tilePool[ii].j + '\n');
}
dump('****************************************\n');
break;
//@line 322 "/Users/dave/mozilla/source/palm/mobile/chrome/content/browser.js"
case q:
if (Util.isPortrait())
// window.top.resizeTo(800,480);
window.top.resizeTo(480,320);

else
// window.top.resizeTo(480,800);
window.top.resizeTo(320,480);
break;
//@line 329 "/Users/dave/mozilla/source/palm/mobile/chrome/content/browser.js"
case z:
bv.setZoomLevel(1.0);
break;
default:
break;
}
}
window.infoMode = false;
window.tileMapMode = false;

var ih = null;

var Browser = {
_tabs : [],
_selectedTab : null,
windowUtils: window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils),
contentScrollbox: null,
contentScrollboxScroller: null,
controlsScrollbox: null,
controlsScrollboxScroller: null,
pageScrollbox: null,
pageScrollboxScroller: null,
styles: {},

startup: function startup() {
var self = this;

try {
messageManager.loadFrameScript("chrome://browser/content/Util.js", true);
messageManager.loadFrameScript("chrome://browser/content/forms.js", true);
messageManager.loadFrameScript("chrome://browser/content/content.js", true);
} catch (e) {
// XXX whatever is calling startup needs to dump errors!
dump("###########" + e + "\n");
}

let container = document.getElementById("tile-container");
let bv = this._browserView = new BrowserView(container, Browser.getVisibleRect);

/* handles dispatching clicks on tiles into clicks in content or zooms */
container.customClicker = new ContentCustomClicker(bv);
container.customKeySender = new ContentCustomKeySender(bv);

/* scrolling box that contains tiles */
let contentScrollbox = this.contentScrollbox = document.getElementById("content-scrollbox");
this.contentScrollboxScroller = contentScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
contentScrollbox.customDragger = new Browser.MainDragger(bv);

/* horizontally scrolling box that holds the sidebars as well as the contentScrollbox */
let controlsScrollbox = this.controlsScrollbox = document.getElementById("controls-scrollbox");
this.controlsScrollboxScroller = controlsScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
controlsScrollbox.customDragger = {
isDraggable: function isDraggable(target, content) { return false; },
dragStart: function dragStart(cx, cy, target, scroller) {},
dragStop: function dragStop(dx, dy, scroller) { return false; },
dragMove: function dragMove(dx, dy, scroller) { return false; }
};

/* vertically scrolling box that contains the url bar, notifications, and content */
let pageScrollbox = this.pageScrollbox = document.getElementById("page-scrollbox");
this.pageScrollboxScroller = pageScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
pageScrollbox.customDragger = controlsScrollbox.customDragger;

// during startup a lot of viewportHandler calls happen due to content and window resizes
bv.beginBatchOperation();

let stylesheet = document.styleSheets[0];
for each (let style in ["viewport-width", "viewport-height", "window-width", "window-height", "toolbar-height"]) {
let index = stylesheet.insertRule("." + style + " {}", stylesheet.cssRules.length);
this.styles[style] = stylesheet.cssRules[index].style;
}

function resizeHandler(e) {
if (e.target != window)
return;

// XXX is this code right here actually needed?
let w = window.innerWidth;
let h = window.innerHeight;
let maximize = (document.documentElement.getAttribute("sizemode") == "maximized");
if (maximize && w > screen.width)
return;

bv.beginBatchOperation();

let toolbarHeight = Math.round(document.getElementById("toolbar-main").getBoundingClientRect().height);
let scaledDefaultH = (kDefaultBrowserWidth * (h / w));
let scaledScreenH = (window.screen.width * (h / w));
let dpiScale = Services.prefs.getIntPref("zoom.dpiScale") / 100;

Browser.styles["viewport-width"].width = (w / dpiScale) + "px";
Browser.styles["viewport-height"].height = (h / dpiScale) + "px";
Browser.styles["window-width"].width = w + "px";
Browser.styles["window-height"].height = h + "px";
Browser.styles["toolbar-height"].height = toolbarHeight + "px";

// Tell the UI to resize the browser controls
BrowserUI.sizeControls(w, h);

// XXX During the launch, the resize of the window arrive after we add
// the first tab, so we need to force the viewport state for this case
// see bug 558840
let bvs = bv._browserViewportState;
if (bvs.viewportRect.width == 1 && bvs.viewportRect.height == 1) {
bvs.viewportRect.width = window.innerWidth;
bvs.viewportRect.height = window.innerHeight;
}

bv.updateDefaultZoom();
if (bv.isDefaultZoom())
// XXX this should really only happen on browser startup, not every resize
Browser.hideSidebars();
bv.onAfterVisibleMove();

for (let i = Browser.tabs.length - 1; i >= 0; i--)
Browser.tabs[i].updateViewportSize();

bv.commitBatchOperation();

let curEl = document.activeElement;
if (curEl && curEl.scrollIntoView)
curEl.scrollIntoView(false);

// Preload the zoom snapshot canvas, because it's slow on Android (bug 586353)
AnimatedZoom.createCanvas().MozGetIPCContext("2d");
}
window.addEventListener("resize", resizeHandler, false);

function fullscreenHandler() {
if (!window.fullScreen)
document.getElementById("toolbar-main").setAttribute("fullscreen", "true");
else
document.getElementById("toolbar-main").removeAttribute("fullscreen");
}
window.addEventListener("fullscreen", fullscreenHandler, false);

function notificationHandler() {
// Let the view know that the layout might have changed
Browser.forceChromeReflow();
bv.onAfterVisibleMove();
}
let notifications = document.getElementById("notifications");
notifications.addEventListener("AlertActive", notificationHandler, false);
notifications.addEventListener("AlertClose", notificationHandler, false);

BrowserUI.init();

// initialize input handling
ih = new InputHandler(container);

window.controllers.appendController(this);
window.controllers.appendController(BrowserUI);

var os = Services.obs;
os.addObserver(gXPInstallObserver, "addon-install-blocked", false);
os.addObserver(gSessionHistoryObserver, "browserurge-session-history", false);

// clear out tabs the user hasn't touched lately on memory crunch
os.addObserver(MemoryObserver, "memory-pressure", false);

// search engine changes
os.addObserver(BrowserSearch, "browser-search-engine-modified", false);

window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow = new nsBrowserAccess();

let browsers = document.getElementById("browsers");
browsers.addEventListener("command", this._handleContentCommand, true);
browsers.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);

// Login Manager and Form History initialization
Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
Cc["@mozilla.org/satchel/form-history;1"].getService(Ci.nsIFormHistory2);

// Make sure we're online before attempting to load
Util.forceOnline();

// If this is an intial window launch the commandline handler passes us the default
// page as an argument
let defaultURL = this.getHomePage();
if (window.arguments && window.arguments[0])
defaultURL = window.arguments[0];

this.addTab(defaultURL, true);

// JavaScript Error Console
if (Services.prefs.getBoolPref("browser.console.showInPanel")){
let button = document.getElementById("tool-console");
button.hidden = false;
}

bv.commitBatchOperation();

// If some add-ons were disabled during during an application update, alert user
if (Services.prefs.prefHasUserValue("extensions.disabledAddons")) {
let addons = Services.prefs.getCharPref("extensions.disabledAddons").split(",");
if (addons.length > 0) {
let disabledStrings = Elements.browserBundle.getString("alertAddonsDisabled");
let label = PluralForm.get(addons.length, disabledStrings).replace("#1", addons.length);

let alerts = Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
alerts.showAlertNotification(URI_GENERIC_ICON_XPINSTALL, Elements.browserBundle.getString("alertAddons"),
label, false, "", null);
}
Services.prefs.clearUserPref("extensions.disabledAddons");
}

messageManager.addMessageListener("Browser:ViewportMetadata", this);
messageManager.addMessageListener("Browser:FormSubmit", this);
messageManager.addMessageListener("Browser:KeyPress", this);
messageManager.addMessageListener("Browser:ZoomToPoint:Return", this);
messageManager.addMessageListener("Browser:MozApplicationManifest", OfflineApps);

// broadcast a UIReady message so add-ons know we are finished with startup
let event = document.createEvent("Events");
event.initEvent("UIReady", true, false);
window.dispatchEvent(event);

// Maybe the widget code isn't sending a resize event when it needs to, this
// makes sure the UI gets sized correctly
resizeHandler({ target: window });
},

_waitingToClose: false,
closing: function closing() {
// If we are already waiting for the close prompt, don't show another
if (this._waitingToClose)
return false;

// Prompt if we have multiple tabs before closing window
let numTabs = this._tabs.length;
if (numTabs > 1) {
let shouldPrompt = Services.prefs.getBoolPref("browser.tabs.warnOnClose");
if (shouldPrompt) {
let prompt = Services.prompt;

// Default to true: if it were false, we wouldn't get this far
let warnOnClose = { value: true };

let messageBase = Elements.browserBundle.getString("tabs.closeWarning");
let message = PluralForm.get(numTabs, messageBase).replace("#1", numTabs);

let title = Elements.browserBundle.getString("tabs.closeWarningTitle");
let closeText = Elements.browserBundle.getString("tabs.closeButton");
let checkText = Elements.browserBundle.getString("tabs.closeWarningPromptMe");
let buttons = (prompt.BUTTON_TITLE_IS_STRING * prompt.BUTTON_POS_0) +
(prompt.BUTTON_TITLE_CANCEL * prompt.BUTTON_POS_1);

this._waitingToClose = true;
let pressed = prompt.confirmEx(window, title, message, buttons, closeText, null, null, checkText, warnOnClose);
this._waitingToClose = false;

// Don't set the pref unless they press OK and it's false
let reallyClose = (pressed == 0);
if (reallyClose && !warnOnClose.value)
Services.prefs.setBoolPref("browser.tabs.warnOnClose", false);

// If we don't want to close, return now. If we are closing, continue with other housekeeping.
if (!reallyClose)
return false;
}
}

// Figure out if there's at least one other browser window around.
let lastBrowser = true;
let e = Services.wm.getEnumerator("navigator:browser");
while (e.hasMoreElements() && lastBrowser) {
let win = e.getNext();
if (win != window && win.toolbar.visible)
lastBrowser = false;
}
if (!lastBrowser)
return true;

// Let everyone know we are closing the last browser window
let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(closingCanceled, "browser-lastwindow-close-requested", null);
if (closingCanceled.data)
return false;

Services.obs.notifyObservers(null, "browser-lastwindow-close-granted", null);
return true;
},

shutdown: function shutdown() {
this._browserView.uninit();
BrowserUI.uninit();

var os = Services.obs;
os.removeObserver(gXPInstallObserver, "addon-install-blocked");
os.removeObserver(gSessionHistoryObserver, "browserurge-session-history");
os.removeObserver(MemoryObserver, "memory-pressure");
os.removeObserver(BrowserSearch, "browser-search-engine-modified");

window.controllers.removeController(this);
window.controllers.removeController(BrowserUI);
},

getHomePage: function () {
let url = "about:home";
try {
url = Services.prefs.getComplexValue("browser.startup.homepage", Ci.nsIPrefLocalizedString).data;
} catch (e) { }

return url;
},

get browsers() {
return this._tabs.map(function(tab) { return tab.browser; });
},

scrollContentToTop: function scrollContentToTop() {
this.contentScrollboxScroller.scrollTo(0, 0);
this.pageScrollboxScroller.scrollTo(0, 0);
this._browserView.onAfterVisibleMove();
},

// cmd_scrollBottom does not work in Fennec (Bug 590535).
scrollContentToBottom: function scrollContentToTop() {
let x = {}, y = {};
this.contentScrollboxScroller.getScrolledSize(x, y);
this.contentScrollboxScroller.scrollTo(0, y.value);

this.pageScrollboxScroller.getScrolledSize(x, y);
this.pageScrollboxScroller.scrollTo(0, y.value);

this._browserView.onAfterVisibleMove();
},

/** Let current browser's scrollbox know about where content has been panned. */
scrollBrowserToContent: function scrollBrowserToContent() {
let browser = this.selectedBrowser;
if (browser) {
let scroll = Browser.getScrollboxPosition(Browser.contentScrollboxScroller);
browser.messageManager.sendAsyncMessage("Content:ScrollTo", { x: scroll.x, y: scroll.y });
}
},

/** Update viewport to location of browser's scrollbars. */
scrollContentToBrowser: function scrollContentToBrowser(aScrollX, aScrollY) {
if (aScrollY != 0)
Browser.hideTitlebar();

let zoomLevel = this._browserView.getZoomLevel();
Browser.contentScrollboxScroller.scrollTo(aScrollX*zoomLevel, aScrollY*zoomLevel);
this._browserView.onAfterVisibleMove();
},

hideSidebars: function scrollSidebarsOffscreen() {
let container = this.contentScrollbox;
let rect = container.getBoundingClientRect();
this.controlsScrollboxScroller.scrollBy(Math.round(rect.left), 0);
this._browserView.onAfterVisibleMove();
},

hideTitlebar: function hideTitlebar() {
let container = this.contentScrollbox;
let rect = container.getBoundingClientRect();
this.pageScrollboxScroller.scrollBy(0, Math.round(rect.top));
this.tryUnfloatToolbar();
this._browserView.onAfterVisibleMove();
},

/**
* Load a URI in the current tab, or a new tab if necessary.
* @param aURI String
* @param aParams Object with optional properties that will be passed to loadURIWithFlags:
* flags, referrerURI, charset, postData.
*/
loadURI: function loadURI(aURI, aParams) {
let browser = this.selectedBrowser;

// We need to keep about: pages opening in new "local" tabs. We also want to spawn
// new "remote" tabs if opening web pages from a "local" about: page.
let currentURI = browser.currentURI.spec;
let useLocal = Util.isLocalScheme(aURI);
let hasLocal = Util.isLocalScheme(currentURI);

if (hasLocal != useLocal) {
let oldTab = this.selectedTab;
if (currentURI == "about:blank" && !browser.canGoBack && !browser.canGoForward) {
this.closeTab(oldTab);
oldTab = null;
}
let tab = Browser.addTab(aURI, true, oldTab);
tab.browser.stop();
}

let params = aParams || {};
let flags = params.flags || Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
getBrowser().loadURIWithFlags(aURI, flags, params.referrerURI, params.charset, params.postData);
},

/**
* Return the currently active <browser> object
*/
get selectedBrowser() {
return this._selectedTab.browser;
},

get tabs() {
return this._tabs;
},

getTabForBrowser: function getTabForBrowser(aBrowser) {
let tabs = this._tabs;
for (let i = 0; i < tabs.length; i++) {
if (tabs[i].browser == aBrowser)
return tabs[i];
}
return null;
},

getTabAtIndex: function getTabAtIndex(index) {
if (index > this._tabs.length || index < 0)
return null;
return this._tabs[index];
},

getTabFromChrome: function getTabFromChrome(chromeTab) {
for (var t = 0; t < this._tabs.length; t++) {
if (this._tabs[t].chromeTab == chromeTab)
return this._tabs[t];
}
return null;
},

addTab: function(uri, bringFront, aOwner) {
let newTab = new Tab(uri);
newTab.owner = aOwner || null;
this._tabs.push(newTab);

if (bringFront)
this.selectedTab = newTab;

let event = document.createEvent("Events");
event.initEvent("TabOpen", true, false);
newTab.chromeTab.dispatchEvent(event);
newTab.browser.messageManager.sendAsyncMessage("Browser:TabOpen");

return newTab;
},

closeTab: function(tab) {
if (tab instanceof XULElement)
tab = this.getTabFromChrome(tab);

if (!tab)
return;

let tabIndex = this._tabs.indexOf(tab);
if (tabIndex == -1)
return;

let nextTab = this._selectedTab;
if (nextTab == tab) {
nextTab = tab.owner || this.getTabAtIndex(tabIndex + 1) || this.getTabAtIndex(tabIndex - 1);
if (!nextTab)
return;
}

// Tabs owned by the closed tab are now orphaned.
this._tabs.forEach(function(aTab, aIndex, aArray) {
if (aTab.owner == tab)
aTab.owner = null;
});

let event = document.createEvent("Events");
event.initEvent("TabClose", true, false);
tab.chromeTab.dispatchEvent(event);
tab.browser.messageManager.sendAsyncMessage("Browser:TabClose");

this.selectedTab = nextTab;

tab.destroy();
this._tabs.splice(tabIndex, 1);
},

get selectedTab() {
return this._selectedTab;
},

set selectedTab(tab) {
let bv = this._browserView;

if (tab instanceof XULElement)
tab = this.getTabFromChrome(tab);

if (!tab || this._selectedTab == tab)
return;

if (this._selectedTab) {
this._selectedTab.contentScrollOffset = this.getScrollboxPosition(this.contentScrollboxScroller);
this._selectedTab.pageScrollOffset = this.getScrollboxPosition(this.pageScrollboxScroller);

// Make sure we leave the toolbar in an unlocked state
if (this._selectedTab.isLoading())
BrowserUI.unlockToolbar();
}

let isFirstTab = this._selectedTab == null;
let lastTab = this._selectedTab;
this._selectedTab = tab;

// Lock the toolbar if the new tab is still loading
if (this._selectedTab.isLoading())
BrowserUI.lockToolbar();

bv.beginBatchOperation();

bv.setBrowser(tab.browser, tab.browserViewportState);
bv.forceContainerResize();
bv.updateDefaultZoom();

document.getElementById("tabs").selectedTab = tab.chromeTab;

if (!isFirstTab) {
// Update all of our UI to reflect the new tab's location
BrowserUI.updateURI();
getIdentityHandler().checkIdentity();

let event = document.createEvent("Events");
event.initEvent("TabSelect", true, false);
event.lastTab = lastTab;
tab.chromeTab.dispatchEvent(event);
}

tab.lastSelected = Date.now();

// XXX incorrect behavior if page was scrolled by tab in the background.
if (tab.contentScrollOffset) {
let { x: scrollX, y: scrollY } = tab.contentScrollOffset;
Browser.contentScrollboxScroller.scrollTo(scrollX, scrollY);
}
if (tab.pageScrollOffset) {
let { x: pageScrollX, y: pageScrollY } = tab.pageScrollOffset;
Browser.pageScrollboxScroller.scrollTo(pageScrollX, pageScrollY);
}

bv.setAggressive(!tab._loading);

bv.commitBatchOperation();
},

supportsCommand: function(cmd) {
var isSupported = false;
switch (cmd) {
case "cmd_fullscreen":
isSupported = true;
break;
default:
isSupported = false;
break;
}
return isSupported;
},

isCommandEnabled: function(cmd) {
return true;
},

doCommand: function(cmd) {
switch (cmd) {
case "cmd_fullscreen":
window.fullScreen = !window.fullScreen;
break;
}
},

getNotificationBox: function getNotificationBox() {
return document.getElementById("notifications");
},

removeTransientNotificationsForTab: function removeTransientNotificationsForTab(aTab) {
let notificationBox = this.getNotificationBox();
let notifications = notificationBox.allNotifications;
for (let n = notifications.length - 1; n >= 0; n--) {
let notification = notifications[n];
if (notification._chromeTab != aTab.chromeTab)
continue;

if (notification.persistence)
notification.persistence--;
else if (Date.now() > notification.timeout)
notificationBox.removeNotification(notification);
}
},

/**
* Handle command event bubbling up from content. This allows us to do chrome-
* privileged things based on buttons in, e.g., unprivileged error pages.
* Obviously, care should be taken not to trust events that web pages could have
* synthesized.
*/
_handleContentCommand: function _handleContentCommand(aEvent) {
// Don't trust synthetic events
if (!aEvent.isTrusted)
return;

var ot = aEvent.originalTarget;
var errorDoc = ot.ownerDocument;

// If the event came from an ssl error page, it is probably either the "Add
// Exception…" or "Get me out of here!" button
if (/^about:certerror\?e=nssBadCert/.test(errorDoc.documentURI)) {
if (ot == errorDoc.getElementById("temporaryExceptionButton") ||
ot == errorDoc.getElementById("permanentExceptionButton")) {
try {
// add a new SSL exception for this URL
let uri = Services.io.newURI(errorDoc.location.href, null, null);
let sslExceptions = new SSLExceptions();

if (ot == errorDoc.getElementById("permanentExceptionButton")) {
sslExceptions.addPermanentException(uri);
} else {
sslExceptions.addTemporaryException(uri);
}
} catch (e) {
dump("EXCEPTION handle content command: " + e + "\n" );
}

// automatically reload after the exception was added
errorDoc.location.reload();
}
else if (ot == errorDoc.getElementById('getMeOutOfHereButton')) {
// Get the start page from the *default* pref branch, not the user's
var defaultPrefs = Services.prefs.getDefaultBranch(null);
var url = "about:blank";
try {
url = defaultPrefs.getCharPref("browser.startup.homepage");
// If url is a pipe-delimited set of pages, just take the first one.
if (url.indexOf("|") != -1)
url = url.split("|")[0];
} catch (e) { /* Fall back on about blank */ }

Browser.selectedBrowser.loadURI(url, null, null, false);
}
}
else if (/^about:neterror\?e=netOffline/.test(errorDoc.documentURI)) {
if (ot == errorDoc.getElementById("errorTryAgain")) {
// Make sure we're online before attempting to load
Util.forceOnline();
}
}
},

/**
* Compute the sidebar percentage visibility.
*
* @param [optional] dx
* @param [optional] dy an offset distance at which to perform the visibility
* computation
*/
computeSidebarVisibility: function computeSidebarVisibility(dx, dy) {
function visibility(aSidebarRect, aVisibleRect) {
let width = aSidebarRect.width;
aSidebarRect.restrictTo(aVisibleRect);
return aSidebarRect.width / width;
}

if (!dx) dx = 0;
if (!dy) dy = 0;

let [leftSidebar, rightSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
if (leftSidebar.left > rightSidebar.left)
[rightSidebar, leftSidebar] = [leftSidebar, rightSidebar]; // switch in RTL case

let visibleRect = new Rect(0, 0, window.innerWidth, 1);
let leftRect = new Rect(Math.round(leftSidebar.left) - dx, 0, Math.round(leftSidebar.width), 1);
let rightRect = new Rect(Math.round(rightSidebar.left) - dx, 0, Math.round(rightSidebar.width), 1);

let leftTotalWidth = leftRect.width;
let leftVisibility = visibility(leftRect, visibleRect);

let rightTotalWidth = rightRect.width;
let rightVisibility = visibility(rightRect, visibleRect);

return [leftVisibility, rightVisibility, leftTotalWidth, rightTotalWidth];
},

/**
* Compute the horizontal distance needed to scroll in order to snap the
* sidebars into place.
*
* Visibility is computed by creating dummy rectangles for the sidebar and the
* visible rect. Sidebar rectangles come from getBoundingClientRect(), so
* they are in absolute client coordinates (and since we're in a scrollbox,
* this means they are positioned relative to the window, which is anchored at
* (0, 0) regardless of the scrollbox's scroll position. The rectangles are
* made to have a top of 0 and a height of 1, since these do not affect how we
* compute visibility (we care only about width), and using rectangles allows
* us to use restrictTo(), which comes in handy.
*
* @return scrollBy dx needed to make snap happen
*/
snapSidebars: function snapSidebars() {
let [leftvis, ritevis, leftw, ritew] = Browser.computeSidebarVisibility();

let snappedX = 0;

if (leftvis != 0 && leftvis != 1) {
if (leftvis >= 0.6666) {
snappedX = -((1 - leftvis) * leftw);
} else {
snappedX = leftvis * leftw;
}
}
else if (ritevis != 0 && ritevis != 1) {
if (ritevis >= 0.6666) {
snappedX = (1 - ritevis) * ritew;
} else {
snappedX = -ritevis * ritew;
}
}

return Math.round(snappedX);
},

tryFloatToolbar: function tryFloatToolbar(dx, dy) {
if (this.floatedWhileDragging)
return;

let [leftvis, ritevis, leftw, ritew] = Browser.computeSidebarVisibility(dx, dy);
if (leftvis > 0 || ritevis > 0) {
BrowserUI.lockToolbar();
this.floatedWhileDragging = true;
}
},

tryUnfloatToolbar: function tryUnfloatToolbar(dx, dy) {
if (!this.floatedWhileDragging)
return true;

let [leftvis, ritevis, leftw, ritew] = Browser.computeSidebarVisibility(dx, dy);
if (leftvis == 0 && ritevis == 0) {
BrowserUI.unlockToolbar();
this.floatedWhileDragging = false;
return true;
}
return false;
},

/** Zoom one step in (negative) or out (positive). */
zoom: function zoom(aDirection) {
let bv = this._browserView;
if (!bv.allowZoom)
return;

let zoomLevel = bv.getZoomLevel();

let zoomValues = ZoomManager.zoomValues;
let i = zoomValues.indexOf(ZoomManager.snap(zoomLevel)) + (aDirection < 0 ? 1 : -1);
if (i >= 0 && i < zoomValues.length)
zoomLevel = zoomValues[i];

zoomLevel = bv.clampZoomLevel(zoomLevel);

let center = this.getVisibleRect().center().map(bv.viewportToBrowser);
this.animatedZoomTo(this._getZoomRectForPoint(center.x, center.y, zoomLevel));
},

/** Rect should be in browser coordinates. */
_getZoomLevelForRect: function _getZoomLevelForRect(rect) {
const margin = 15;

let bv = this._browserView;
let vis = bv.getVisibleRect();

return bv.clampZoomLevel(vis.width / (rect.width + margin * 2));
},

/**
* Find an appropriate zoom rect for an element bounding rect, if it exists.
* @return Rect in viewport coordinates
* */
_getZoomRectForRect: function _getZoomRectForRect(rect, y) {
let bv = this._browserView;
let oldZoomLevel = bv.getZoomLevel();
let zoomLevel = this._getZoomLevelForRect(rect);
let zoomRatio = oldZoomLevel / zoomLevel;

// Don't zoom in a marginal amount, but be more lenient for the first zoom.
// > 2/3 means operation increases the zoom level by less than 1.5
// > 9/10 means operation increases the zoom level by less than 1.1
let zoomTolerance = (bv.isDefaultZoom()) ? .9 : .6666;
if (zoomRatio >= zoomTolerance)
return null;
else
return this._getZoomRectForPoint(rect.center().x, y, zoomLevel);
},

/**
* Find a good zoom rectangle for point that is specified in browser coordinates.
* @return Rect in viewport coordinates
*/
_getZoomRectForPoint: function _getZoomRectForPoint(x, y, zoomLevel) {
let bv = this._browserView;
let vis = bv.getVisibleRect();
x = bv.browserToViewport(x);
y = bv.browserToViewport(y);

zoomLevel = Math.min(ZoomManager.MAX, zoomLevel);
let zoomRatio = zoomLevel / bv.getZoomLevel();
let newVisW = vis.width / zoomRatio, newVisH = vis.height / zoomRatio;
let result = new Rect(x - newVisW / 2, y - newVisH / 2, newVisW, newVisH);

// Make sure rectangle doesn't poke out of viewport
return result.translateInside(bv._browserViewportState.viewportRect);
},

animatedZoomTo: function animatedZoomTo(rect) {
let zoom = new AnimatedZoom(this._browserView);
zoom.animateTo(rect);
},

setVisibleRect: function setVisibleRect(rect) {
let bv = this._browserView;
let vis = bv.getVisibleRect();
let zoomRatio = vis.width / rect.width;
let zoomLevel = bv.getZoomLevel() * zoomRatio;
let scrollX = rect.left * zoomRatio;
let scrollY = rect.top * zoomRatio;

// The order of operations below is important for artifacting and for performance. Important
// side effects of functions are noted below.

// Hardware scrolling happens immediately when scrollTo is called. Hide to prevent artifacts.
bv.beginOffscreenOperation(rect);

// We must scroll to the correct area before TileManager is informed of the change
// so that only one render is done. Ensures setZoomLevel puts it off.
bv.beginBatchOperation();

// Critical rect changes when controls are hidden. Must hide before tilemanager viewport.
this.hideSidebars();
this.hideTitlebar();

bv.setZoomLevel(zoomLevel);

// Ensure container is big enough for scroll values.
bv.forceContainerResize();
this.forceChromeReflow();
this.contentScrollboxScroller.scrollTo(scrollX, scrollY);
bv.onAfterVisibleMove();

// Inform tile manager, which happens to render new tiles too. Must call in case a batch
// operation was in progress before zoom.
bv.forceViewportChange();

bv.commitBatchOperation();
bv.commitOffscreenOperation();
},

zoomToPoint: function zoomToPoint(cX, cY, aRect) {
let bv = this._browserView;
if (!bv.allowZoom)
return null;

let zoomRect = null;
if (aRect)
zoomRect = this._getZoomRectForRect(aRect, cY);

if (!zoomRect && bv.isDefaultZoom())
zoomRect = this._getZoomRectForPoint(cX, cY, bv.getZoomLevel() * 2);

if (zoomRect)
this.animatedZoomTo(zoomRect);

return zoomRect;
},

zoomFromPoint: function zoomFromPoint(cX, cY) {
let bv = this._browserView;
if (bv.allowZoom && !bv.isDefaultZoom()) {
let zoomLevel = bv.getDefaultZoomLevel();
let zoomRect = this._getZoomRectForPoint(cX, cY, zoomLevel);
this.animatedZoomTo(zoomRect);
}
},

/**
* Transform x and y from client coordinates to BrowserView coordinates.
*/
clientToBrowserView: function clientToBrowserView(x, y) {
let container = document.getElementById("tile-container");
let containerBCR = container.getBoundingClientRect();

let x0 = Math.round(containerBCR.left);
let y0;
if (arguments.length > 1)
y0 = Math.round(containerBCR.top);

return (arguments.length > 1) ? [x - x0, y - y0] : (x - x0);
},

browserViewToClient: function browserViewToClient(x, y) {
let container = document.getElementById("tile-container");
let containerBCR = container.getBoundingClientRect();

let x0 = Math.round(-containerBCR.left);
let y0;
if (arguments.length > 1)
y0 = Math.round(-containerBCR.top);

return (arguments.length > 1) ? [x - x0, y - y0] : (x - x0);
},

browserViewToClientRect: function browserViewToClientRect(rect) {
let container = document.getElementById("tile-container");
let containerBCR = container.getBoundingClientRect();
return rect.clone().translate(Math.round(containerBCR.left), Math.round(containerBCR.top));
},

/**
* turn client coordinates into page-relative ones (adjusted for
* zoom and page position)
*/
transformClientToBrowser: function transformClientToBrowser(cX, cY) {
return this.clientToBrowserView(cX, cY).map(this._browserView.viewportToBrowser);
},

/**
* Return the visible rect in coordinates with origin at the (left, top) of
* the tile container, i.e. BrowserView coordinates.
*/
getVisibleRect: function getVisibleRect() {
let stack = document.getElementById("tile-stack");
let container = document.getElementById("tile-container");
let containerBCR = container.getBoundingClientRect();

let x = Math.round(-containerBCR.left);
let y = Math.round(-containerBCR.top);
let w = window.innerWidth;
let h = stack.getBoundingClientRect().height;

return new Rect(x, y, w, h);
},

/**
* Convenience function for getting the scrollbox position off of a
* scrollBoxObject interface. Returns the actual values instead of the
* wrapping objects.
*
* @param scroller a scrollBoxObject on which to call scroller.getPosition()
*/
getScrollboxPosition: function getScrollboxPosition(scroller) {
let x = {};
let y = {};
scroller.getPosition(x, y);
return new Point(x.value, y.value);
},

forceChromeReflow: function forceChromeReflow() {
let dummy = getComputedStyle(document.documentElement, "").width;
},

receiveMessage: function receiveMessage(aMessage) {
let json = aMessage.json;
switch (aMessage.name) {
case "Browser:ViewportMetadata":
let tab = Browser.getTabForBrowser(aMessage.target);
// Some browser such as iframes loaded dynamically into the chrome UI
// does not have any assigned tab
if (tab)
tab.updateViewportMetadata(json);
break;

case "Browser:FormSubmit":
let browser = aMessage.target;
browser.lastLocation = null;
break;

case "Browser:KeyPress":
let event = document.createEvent("KeyEvents");
event.initKeyEvent("keypress", true, true, null,
json.ctrlKey, json.altKey, json.shiftKey, json.metaKey,
json.keyCode, json.charCode)
document.getElementById("mainKeyset").dispatchEvent(event);
break;

case "Browser:ZoomToPoint:Return":
// JSON-ified rect needs to be recreated so the methods exist
let rect = Rect.fromRect(json.rect);
if (!Browser.zoomToPoint(json.x, json.y, rect))
Browser.zoomFromPoint(json.x, json.y);
break;
}
}
};


Browser.MainDragger = function MainDragger(browserView) {
this.bv = browserView;
};

Browser.MainDragger.prototype = {
isDraggable: function isDraggable(target, scroller) { return true; },

dragStart: function dragStart(clientX, clientY, target, scroller) {
this._nextRender = Date.now() + 500;
this._dragMoved = false;
},

dragStop: function dragStop(dx, dy, scroller) {
this.draggedFrame = null;
this.dragMove(Browser.snapSidebars(), 0, scroller);

Browser.tryUnfloatToolbar();

if (this._dragMoved)
this.bv.resumeRendering();
},

dragMove: function dragMove(dx, dy, scroller) {
let doffset = new Point(dx, dy);

if (!this._dragMoved) {
this._dragMoved = true;
this.bv.pauseRendering();
}

// First calculate any panning to take sidebars out of view
let panOffset = this._panControlsAwayOffset(doffset);

// Do content panning
this._panScroller(Browser.contentScrollboxScroller, doffset);

// Any leftover panning in doffset would bring controls into view. Add to sidebar
// away panning for the total scroll offset.
doffset.add(panOffset);
Browser.tryFloatToolbar(doffset.x, 0);
this._panScroller(Browser.controlsScrollboxScroller, doffset);
this._panScroller(Browser.pageScrollboxScroller, doffset);

this.bv.onAfterVisibleMove();

if (Date.now() >= this._nextRender) {
this.bv.renderNow();
this._nextRender = Date.now() + 500;
}

return !doffset.equals(dx, dy);
},

/** Return offset that pans controls away from screen. Updates doffset with leftovers. */
_panControlsAwayOffset: function(doffset) {
let x = 0, y = 0, rect;

rect = Rect.fromRect(Browser.pageScrollbox.getBoundingClientRect()).map(Math.round);
if (doffset.x < 0 && rect.right < window.innerWidth)
x = Math.max(doffset.x, rect.right - window.innerWidth);
if (doffset.x > 0 && rect.left > 0)
x = Math.min(doffset.x, rect.left);

let height = document.getElementById("tile-stack").getBoundingClientRect().height;
rect = Rect.fromRect(Browser.contentScrollbox.getBoundingClientRect()).map(Math.round);
if (doffset.y < 0 && rect.bottom < height)
y = Math.max(doffset.y, rect.bottom - height);
if (doffset.y > 0 && rect.top > 0)
y = Math.min(doffset.y, rect.top);

doffset.subtract(x, y);
return new Point(x, y);
},

/** Pan scroller by the given amount. Updates doffset with leftovers. */
_panScroller: function _panScroller(scroller, doffset) {
let { x: x0, y: y0 } = Browser.getScrollboxPosition(scroller);
scroller.scrollBy(doffset.x, doffset.y);
let { x: x1, y: y1 } = Browser.getScrollboxPosition(scroller);
doffset.subtract(x1 - x0, y1 - y0);
}
};


function nsBrowserAccess()
{
}

nsBrowserAccess.prototype = {
QueryInterface: function(aIID) {
if (aIID.equals(Ci.nsIBrowserDOMWindow) || aIID.equals(Ci.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
},

_getBrowser: function _getBrowser(aURI, aOpener, aWhere, aContext) {
let isExternal = (aContext == Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL);
if (isExternal && aURI && aURI.schemeIs("chrome"))
return null;

let loadflags = isExternal ?
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
let location;
if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW) {
switch (aContext) {
case Ci.nsIBrowserDOMWindow.OPEN_EXTERNAL :
aWhere = Services.prefs.getIntPref("browser.link.open_external");
break;
default : // OPEN_NEW or an illegal value
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow");
}
}

let browser;
if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW) {
let url = aURI ? aURI.spec : "about:blank";
let newWindow = openDialog("chrome://browser/content/browser.xul", "_blank",
"all,dialog=no", url, null, null, null);
// since newWindow.Browser doesn't exist yet, just return null
return null;
} else if (aWhere == Ci.nsIBrowserDOMWindow.OPEN_NEWTAB) {
browser = Browser.addTab("about:blank", true, Browser.selectedTab).browser;
} else { // OPEN_CURRENTWINDOW and illegal values
browser = Browser.selectedBrowser;
}

try {
let referrer;
if (aURI) {
if (aOpener) {
location = aOpener.location;
referrer = Services.io.newURI(location, null, null);
}
browser.loadURIWithFlags(aURI.spec, loadflags, referrer, null, null);
}
browser.focus();
} catch(e) { }

return browser;
},

openURI: function(aURI, aOpener, aWhere, aContext) {
let browser = this._getBrowser(aURI, aOpener, aWhere, aContext);
return browser ? browser.contentWindow : null;
},

openURIInFrame: function(aURI, aOpener, aWhere, aContext) {
let browser = this._getBrowser(aURI, aOpener, aWhere, aContext);
return browser ? browser.QueryInterface(Ci.nsIFrameLoaderOwner) : null;
},

isTabContentWindow: function(aWindow) {
return Browser.browsers.some(function (browser) browser.contentWindow == aWindow);
}
};


const BrowserSearch = {
observe: function bs_observe(aSubject, aTopic, aData) {
if (aTopic != "browser-search-engine-modified")
return;

switch (aData) {
case "engine-added":
case "engine-removed":
// force a rebuild of the prefs list, if needed
// XXX this is inefficient, shouldn't have to rebuild the entire list
if (ExtensionsView._list)
ExtensionsView.getAddonsFromLocal();

// fall through
case "engine-changed":
// XXX we should probably also update the ExtensionsView list here once
// that's efficient, since the icon can change (happen during an async
// installs from the web)

// blow away our cache
this._engines = null;
break;
case "engine-current":
// Not relevant
break;
}
},

get engines() {
if (this._engines)
return this._engines;

let engines = Services.search.getVisibleEngines({ }).map(
function(item, index, array) {
return {
label: item.name,
default: (item == Services.search.defaultEngine),
image: item.iconURI ? item.iconURI.spec : null
}
});

return this._engines = engines;
},

updatePageSearchEngines: function updatePageSearchEngines(aNode) {
let items = Browser.selectedBrowser.searchEngines.filter(this.isPermanentSearchEngine);
if (!items.length)
return false;

// XXX limit to the first search engine for now
let engine = items[0];
aNode.setAttribute("description", engine.title);
aNode.onclick = function() {
BrowserSearch.addPermanentSearchEngine(engine);
PageActions.hideItem(aNode);
};
return true;
},

addPermanentSearchEngine: function addPermanentSearchEngine(aEngine) {
let iconURL = BrowserUI._favicon.src;
Services.search.addEngine(aEngine.href, Ci.nsISearchEngine.DATA_XML, iconURL, false);

this._engines = null;
},

isPermanentSearchEngine: function isPermanentSearchEngine(aEngine) {
return !BrowserSearch.engines.some(function(item) {
return aEngine.title == item.name;
});
}
};


/** Watches for mouse events in chrome and sends them to content. */
function ContentCustomClicker(browserView) {
this._browserView = browserView;
}

ContentCustomClicker.prototype = {
_dispatchMouseEvent: function _dispatchMouseEvent(aName, aX, aY, aModifiers) {
let aX = aX || 0;
let aY = aY || 0;
let aModifiers = aModifiers || null;
let browser = this._browserView.getBrowser();
let [x, y] = Browser.transformClientToBrowser(aX, aY);
browser.messageManager.sendAsyncMessage(aName, { x: x, y: y, modifiers: aModifiers });
},

mouseDown: function mouseDown(aX, aY) {
// Ensure that the content process has gets an activate event
let browser = this._browserView.getBrowser();
let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
try {
fl.activateRemoteFrame();
} catch (e) {}
this._dispatchMouseEvent("Browser:MouseDown", aX, aY);
},

mouseUp: function mouseUp(aX, aY) {
},

panBegin: function panBegin() {
TapHighlightHelper.hide();

this._dispatchMouseEvent("Browser:MouseCancel");
},

singleClick: function singleClick(aX, aY, aModifiers) {
TapHighlightHelper.hide();

// Cancel the mouse click if we are showing a context menu
if (!ContextHelper.popupState)
this._dispatchMouseEvent("Browser:MouseUp", aX, aY, aModifiers);
this._dispatchMouseEvent("Browser:MouseCancel");
},

doubleClick: function doubleClick(aX1, aY1, aX2, aY2) {
TapHighlightHelper.hide();

this._dispatchMouseEvent("Browser:MouseCancel");

const kDoubleClickRadius = 100;

let maxRadius = kDoubleClickRadius * Browser._browserView.getZoomLevel();
let dx = aX2 - aX1;
let dy = aY1 - aY2;

if (dx*dx + dy*dy < maxRadius*maxRadius)
this._dispatchMouseEvent("Browser:ZoomToPoint", aX1, aY1);
},

toString: function toString() {
return "[ContentCustomClicker] { }";
}
};


/** Watches for mouse events in chrome and sends them to content. */
function ContentCustomKeySender(browserView) {
this._browserView = browserView;
}

ContentCustomKeySender.prototype = {
/** Dispatch a mouse event with chrome client coordinates. */
dispatchKeyEvent: function _dispatchKeyEvent(aEvent) {
let browser = this._browserView.getBrowser();
if (browser) {
browser.messageManager.sendAsyncMessage("Browser:KeyEvent", {
type: aEvent.type,
keyCode: aEvent.keyCode,
charCode: aEvent.charCode,
modifiers: this._parseModifiers(aEvent)
});
}
},

_parseModifiers: function _parseModifiers(aEvent) {
const masks = Components.interfaces.nsIDOMNSEvent;
var mval = 0;
if (aEvent.shiftKey)
mval |= masks.SHIFT_MASK;
if (aEvent.ctrlKey)
mval |= masks.CONTROL_MASK;
if (aEvent.altKey)
mval |= masks.ALT_MASK;
if (aEvent.metaKey)
mval |= masks.META_MASK;
return mval;
},

toString: function toString() {
return "[ContentCustomKeySender] { }";
}
};


/**
* Utility class to handle manipulations of the identity indicators in the UI
*/
function IdentityHandler() {
this._staticStrings = {};
this._staticStrings[this.IDENTITY_MODE_DOMAIN_VERIFIED] = {
encryption_label: Elements.browserBundle.getString("identity.encrypted2")
};
this._staticStrings[this.IDENTITY_MODE_IDENTIFIED] = {
encryption_label: Elements.browserBundle.getString("identity.encrypted2")
};
this._staticStrings[this.IDENTITY_MODE_UNKNOWN] = {
encryption_label: Elements.browserBundle.getString("identity.unencrypted2")
};

// Close the popup when reloading the page
document.getElementById("browsers").addEventListener("URLChanged", this, true);

this._cacheElements();
}

IdentityHandler.prototype = {
// Mode strings used to control CSS display
IDENTITY_MODE_IDENTIFIED : "verifiedIdentity", // High-quality identity information
IDENTITY_MODE_DOMAIN_VERIFIED : "verifiedDomain", // Minimal SSL CA-signed domain verification
IDENTITY_MODE_UNKNOWN : "unknownIdentity", // No trusted identity information

// Cache the most recent SSLStatus and Location seen in checkIdentity
_lastStatus : null,
_lastLocation : null,

/**
* Build out a cache of the elements that we need frequently.
*/
_cacheElements: function() {
this._identityBox = document.getElementById("identity-box");
this._identityPopup = document.getElementById("identity-container");
this._identityPopupContentBox = document.getElementById("identity-popup-content-box");
this._identityPopupContentHost = document.getElementById("identity-popup-content-host");
this._identityPopupContentOwner = document.getElementById("identity-popup-content-owner");
this._identityPopupContentSupp = document.getElementById("identity-popup-content-supplemental");
this._identityPopupContentVerif = document.getElementById("identity-popup-content-verifier");
this._identityPopupEncLabel = document.getElementById("identity-popup-encryption-label");
},

getIdentityData: function() {
return this._lastStatus.serverCert;
},

/**
* Determine the identity of the page being displayed by examining its SSL cert
* (if available) and, if necessary, update the UI to reflect this.
*/
checkIdentity: function() {
let browser = getBrowser();
let state = browser.securityUI.state;
let location = browser.currentURI;
let currentStatus = browser.securityUI.SSLStatus;

this._lastStatus = currentStatus;
this._lastLocation = {};

try {
// make a copy of the passed in location to avoid cycles
this._lastLocation = { host: location.hostPort, hostname: location.host, port: location.port == -1 ? "" : location.port};
} catch(e) { }

if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
this.setMode(this.IDENTITY_MODE_IDENTIFIED);
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
this.setMode(this.IDENTITY_MODE_DOMAIN_VERIFIED);
else
this.setMode(this.IDENTITY_MODE_UNKNOWN);
},

/**
* Return the eTLD+1 version of the current hostname
*/
getEffectiveHost: function() {
// Cache the eTLDService if this is our first time through
if (!this._eTLDService)
this._eTLDService = Cc["@mozilla.org/network/effective-tld-service;1"]
.getService(Ci.nsIEffectiveTLDService);
try {
return this._eTLDService.getBaseDomainFromHost(this._lastLocation.hostname);
} catch (e) {
// If something goes wrong (e.g. hostname is an IP address) just fail back
// to the full domain.
return this._lastLocation.hostname;
}
},

/**
* Update the UI to reflect the specified mode, which should be one of the
* IDENTITY_MODE_* constants.
*/
setMode: function(newMode) {
this._identityBox.setAttribute("mode", newMode);
this.setIdentityMessages(newMode);

// Update the popup too, if it's open
if (!this._identityPopup.hidden)
this.setPopupMessages(newMode);
},

/**
* Set up the messages for the primary identity UI based on the specified mode,
* and the details of the SSL cert, where applicable
*
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
*/
setIdentityMessages: function(newMode) {
let strings = Elements.browserBundle;

if (newMode == this.IDENTITY_MODE_DOMAIN_VERIFIED) {
var iData = this.getIdentityData();

// We need a port number for all lookups. If one hasn't been specified, use
// the https default
var lookupHost = this._lastLocation.host;
if (lookupHost.indexOf(':') < 0)
lookupHost += ":443";

// Cache the override service the first time we need to check it
if (!this._overrideService)
this._overrideService = Cc["@mozilla.org/security/certoverride;1"].getService(Ci.nsICertOverrideService);

// Verifier is either the CA Org, for a normal cert, or a special string
// for certs that are trusted because of a security exception.
var tooltip = strings.getFormattedString("identity.identified.verifier",
[iData.caOrg]);

// Check whether this site is a security exception.
if (iData.isException)
tooltip = strings.getString("identity.identified.verified_by_you");
}
else if (newMode == this.IDENTITY_MODE_IDENTIFIED) {
// If it's identified, then we can populate the dialog with credentials
iData = this.getIdentityData();
tooltip = strings.getFormattedString("identity.identified.verifier",
[iData.caOrg]);
}
else {
tooltip = strings.getString("identity.unknown.tooltip");
}

// Push the appropriate strings out to the UI
this._identityBox.tooltipText = tooltip;
},

/**
* Set up the title and content messages for the identity message popup,
* based on the specified mode, and the details of the SSL cert, where
* applicable
*
* @param newMode The newly set identity mode. Should be one of the IDENTITY_MODE_* constants.
*/
setPopupMessages: function(newMode) {
this._identityPopup.setAttribute("mode", newMode);
this._identityPopupContentBox.className = newMode;

// Set the static strings up front
this._identityPopupEncLabel.textContent = this._staticStrings[newMode].encryption_label;

// Initialize the optional strings to empty values
var supplemental = "";
var verifier = "";

let strings = Elements.browserBundle;

if (newMode == this.IDENTITY_MODE_DOMAIN_VERIFIED) {
var iData = this.getIdentityData();
var host = this.getEffectiveHost();
var owner = strings.getString("identity.ownerUnknown2");
verifier = this._identityBox.tooltipText;
supplemental = "";
}
else if (newMode == this.IDENTITY_MODE_IDENTIFIED) {
// If it's identified, then we can populate the dialog with credentials
iData = this.getIdentityData();
host = this.getEffectiveHost();
owner = iData.subjectOrg;
verifier = this._identityBox.tooltipText;

// Build an appropriate supplemental block out of whatever location data we have
if (iData.city)
supplemental += iData.city + " ";
if (iData.state && iData.country)
supplemental += strings.getFormattedString("identity.identified.state_and_country",
[iData.state, iData.country]);
else if (iData.state) // State only
supplemental += iData.state;
else if (iData.country) // Country only
supplemental += iData.country;
}
else {
// These strings will be hidden in CSS anyhow
host = "";
owner = "";
}

// Push the appropriate strings out to the UI
this._identityPopupContentHost.textContent = host;
this._identityPopupContentOwner.textContent = owner;
this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier;

PageActions.updateSiteMenu();
},

show: function ih_show() {
// dismiss any dialog which hide the identity popup
BrowserUI.activePanel = null;
while (BrowserUI.activeDialog)
BrowserUI.activeDialog.close();

this._identityPopup.hidden = false;
this._identityPopup.top = BrowserUI.toolbarH;
this._identityPopup.focus();

this._identityBox.setAttribute("open", "true");

// Update the popup strings
this.setPopupMessages(this._identityBox.getAttribute("mode") || this.IDENTITY_MODE_UNKNOWN);

BrowserUI.pushPopup(this, [this._identityPopup, this._identityBox, Elements.toolbarContainer]);
BrowserUI.lockToolbar();
},

hide: function ih_hide() {
this._identityPopup.hidden = true;
this._identityBox.removeAttribute("open");

BrowserUI.popPopup();
BrowserUI.unlockToolbar();
},

toggle: function ih_toggle() {
// When the urlbar is active the identity button is used to show the
// list of search engines
if (Elements.urlbarState.getAttribute("mode") == "edit") {
CommandUpdater.doCommand("cmd_opensearch");
return;
}

if (this._identityPopup.hidden)
this.show();
else
this.hide();
},

/**
* Click handler for the identity-box element in primary chrome.
*/
handleIdentityButtonEvent: function(aEvent) {
aEvent.stopPropagation();

if ((aEvent.type == "click" && aEvent.button != 0) ||
(aEvent.type == "keypress" && aEvent.charCode != KeyEvent.DOM_VK_SPACE &&
aEvent.keyCode != KeyEvent.DOM_VK_RETURN))
return; // Left click, space or enter only

this.toggle();
},

handleEvent: function(aEvent) {
if (aEvent.type == "URLChanged" && !this._identityPopup.hidden)
this.hide();
}
};

var gIdentityHandler;

/**
* Returns the singleton instance of the identity handler class. Should always be
* used instead of referencing the global variable directly or creating new instances
*/
function getIdentityHandler() {
if (!gIdentityHandler)
gIdentityHandler = new IdentityHandler();
return gIdentityHandler;
}


/**
* Handler for blocked popups, triggered by DOMUpdatePageReport events in browser.xml
*/
const gPopupBlockerObserver = {
onUpdatePageReport: function onUpdatePageReport(aEvent)
{
var cBrowser = Browser.selectedBrowser;
if (aEvent.originalTarget != cBrowser)
return;

if (!cBrowser.pageReport)
return;

let result = Services.perms.testExactPermission(Browser.selectedBrowser.currentURI, "popup");
if (result == Ci.nsIPermissionManager.DENY_ACTION)
return;

// Only show the notification again if we've not already shown it. Since
// notifications are per-browser, we don't need to worry about re-adding
// it.
if (!cBrowser.pageReport.reported) {
if (Services.prefs.getBoolPref("privacy.popups.showBrowserMessage")) {
var brandBundle = document.getElementById("bundle_brand");
var brandShortName = brandBundle.getString("brandShortName");
var message;
var popupCount = cBrowser.pageReport.length;

let strings = Elements.browserBundle;
if (popupCount > 1)
message = strings.getFormattedString("popupWarningMultiple", [brandShortName, popupCount]);
else
message = strings.getFormattedString("popupWarning", [brandShortName]);

var notificationBox = Browser.getNotificationBox();
var notification = notificationBox.getNotificationWithValue("popup-blocked");
if (notification) {
notification.label = message;
}
else {
var buttons = [
{
label: strings.getString("popupButtonAllowOnce"),
accessKey: null,
callback: function() { gPopupBlockerObserver.showPopupsForSite(); }
},
{
label: strings.getString("popupButtonAlwaysAllow2"),
accessKey: null,
callback: function() { gPopupBlockerObserver.allowPopupsForSite(true); }
},
{
label: strings.getString("popupButtonNeverWarn2"),
accessKey: null,
callback: function() { gPopupBlockerObserver.allowPopupsForSite(false); }
}
];

const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
notificationBox.appendNotification(message, "popup-blocked",
"",
priority, buttons);
}
}
// Record the fact that we've reported this blocked popup, so we don't
// show it again.
cBrowser.pageReport.reported = true;
}
},

allowPopupsForSite: function allowPopupsForSite(aAllow) {
var currentURI = Browser.selectedBrowser.currentURI;
Services.perms.add(currentURI, "popup", aAllow
? Ci.nsIPermissionManager.ALLOW_ACTION
: Ci.nsIPermissionManager.DENY_ACTION);

Browser.getNotificationBox().removeCurrentNotification();
},

showPopupsForSite: function showPopupsForSite() {
let uri = Browser.selectedBrowser.currentURI;
let pageReport = Browser.selectedBrowser.pageReport;
if (pageReport) {
for (let i = 0; i < pageReport.length; ++i) {
var popupURIspec = pageReport[i].popupWindowURI.spec;

// Sometimes the popup URI that we get back from the pageReport
// isn't useful (for instance, netscape.com's popup URI ends up
// being "http://www.netscape.com", which isn't really the URI of
// the popup they're trying to show). This isn't going to be
// useful to the user, so we won't create a menu item for it.
if (popupURIspec == "" || popupURIspec == "about:blank" ||
popupURIspec == uri.spec)
continue;

let popupFeatures = pageReport[i].popupWindowFeatures;
let popupName = pageReport[i].popupWindowName;

Browser.addTab(popupURIspec, false, Browser.selectedTab);
}
}
}
};

const gXPInstallObserver = {
observe: function xpi_observer(aSubject, aTopic, aData)
{
var brandBundle = document.getElementById("bundle_brand");
switch (aTopic) {
case "addon-install-blocked":
var installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
var host = installInfo.originatingURI.host;
var brandShortName = brandBundle.getString("brandShortName");
var notificationName, messageString, buttons;
var strings = Elements.browserBundle;
var enabled = true;
try {
enabled = Services.prefs.getBoolPref("xpinstall.enabled");
}
catch (e) {}
if (!enabled) {
notificationName = "xpinstall-disabled";
if (Services.prefs.prefIsLocked("xpinstall.enabled")) {
messageString = strings.getString("xpinstallDisabledMessageLocked");
buttons = [];
}
else {
messageString = strings.getFormattedString("xpinstallDisabledMessage",
[brandShortName, host]);
buttons = [{
label: strings.getString("xpinstallDisabledButton"),
accessKey: null,
popup: null,
callback: function editPrefs() {
Services.prefs.setBoolPref("xpinstall.enabled", true);
return false;
}
}];
}
}
else {
notificationName = "xpinstall";
messageString = strings.getFormattedString("xpinstallPromptWarning",
[brandShortName, host]);

buttons = [{
label: strings.getString("xpinstallPromptAllowButton"),
accessKey: null,
popup: null,
callback: function() {
// Kick off the install
installInfo.install();
return false;
}
}];
}

var nBox = Browser.getNotificationBox();
if (!nBox.getNotificationWithValue(notificationName)) {
const priority = nBox.PRIORITY_WARNING_MEDIUM;
const iconURL = "chrome://mozapps/skin/update/update.png";
nBox.appendNotification(messageString, notificationName, iconURL, priority, buttons);
}
break;
}
}
};

const gSessionHistoryObserver = {
observe: function sho_observe(subject, topic, data) {
if (topic != "browserurge-session-history")
return;

let back = document.getElementById("cmd_back");
back.setAttribute("disabled", "true");
let forward = document.getElementById("cmd_forward");
forward.setAttribute("disabled", "true");

let urlbar = document.getElementById("urlbar-edit");
if (urlbar) {
// Clear undo history of the URL bar
urlbar.editor.transactionManager.clear();
}
}
};

var MemoryObserver = {
observe: function mo_observe() {
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).garbageCollect();
Components.utils.forceGC();
}
};

function getNotificationBox(aWindow) {
return Browser.getNotificationBox();
}

function importDialog(aParent, aSrc, aArguments) {
// load the dialog with a synchronous XHR
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
xhr.open("GET", aSrc, false);
xhr.overrideMimeType("text/xml");
xhr.send(null);
if (!xhr.responseXML)
return null;

let currentNode;
let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null, false);
while (currentNode = nodeIterator.nextNode()) {
let trimmed = currentNode.nodeValue.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
if (!trimmed.length)
currentNode.parentNode.removeChild(currentNode);
}

let doc = xhr.responseXML.documentElement;

var dialog = null;

// we need to insert before menulist-container if we want it to show correctly
// for prompt.select for instance
let menulistContainer = document.getElementById("menulist-container");
let parentNode = menulistContainer.parentNode;

// emit DOMWillOpenModalDialog event
let event = document.createEvent("Events");
event.initEvent("DOMWillOpenModalDialog", true, false);
let dispatcher = aParent || getBrowser();
dispatcher.dispatchEvent(event);

// create a full-screen semi-opaque box as a background
let back = document.createElement("box");
back.setAttribute("class", "modal-block");
dialog = back.appendChild(document.importNode(doc, true));
parentNode.insertBefore(back, menulistContainer);

dialog.arguments = aArguments;
dialog.parent = aParent;
return dialog;
}

function showDownloadManager(aWindowContext, aID, aReason) {
BrowserUI.showPanel("downloads-container");
// TODO: select the download with aID
}

var AlertsHelper = {
_timeoutID: -1,
_listener: null,
_cookie: "",
_clickable: false,
get container() {
delete this.container;
let container = document.getElementById("alerts-container");

// Move the popup on the other side if we are in RTL
let [leftSidebar, rightSidebar] = [Elements.tabs.getBoundingClientRect(), Elements.controls.getBoundingClientRect()];
if (leftSidebar.left > rightSidebar.left) {
container.removeAttribute("right");
container.setAttribute("left", "0");
}

let self = this;
container.addEventListener("transitionend", function() {
self.alertTransitionOver();
}, true);

return this.container = container;
},

showAlertNotification: function ah_show(aImageURL, aTitle, aText, aTextClickable, aCookie, aListener) {
this._clickable = aTextClickable || false;
this._listener = aListener || null;
this._cookie = aCookie || "";

document.getElementById("alerts-image").setAttribute("src", aImageURL);
document.getElementById("alerts-title").value = aTitle;
document.getElementById("alerts-text").textContent = aText;

let container = this.container;
container.hidden = false;
container.height = container.getBoundingClientRect().height;
container.classList.add("showing");

let timeout = Services.prefs.getIntPref("alerts.totalOpenTime");
let self = this;
if (this._timeoutID)
clearTimeout(this._timeoutID);
this._timeoutID = setTimeout(function() { self._timeoutAlert(); }, timeout);
},

_timeoutAlert: function ah__timeoutAlert() {
this._timeoutID = -1;

this.container.classList.remove("showing");
if (this._listener)
this._listener.observe(null, "alertfinished", this._cookie);
},

alertTransitionOver: function ah_alertTransitionOver() {
let container = this.container;
if (!container.classList.contains("showing")) {
container.height = 0;
container.hidden = true;
}
},

click: function ah_click(aEvent) {
if (this._clickable && this._listener)
this._listener.observe(null, "alertclickcallback", this._cookie);

if (this._timeoutID != -1) {
clearTimeout(this._timeoutID);
this._timeoutAlert();
}
}
};

function ProgressController(tab) {
this._tab = tab;

// Properties used to cache security state used to update the UI
this.state = null;
this._hostChanged = false; // onLocationChange will flip this bit
}

ProgressController.prototype = {
get browser() {
return this._tab.browser;
},

onStateChange: function onStateChange(aWebProgress, aRequest, aStateFlags, aStatus) {
// ignore notification that aren't about the main document (iframes, etc)
if (aWebProgress.windowId != this._tab.browser.contentWindowId && this._tab.browser.contentWindowId)
return;

// If you want to observe other state flags, be sure they're listed in the
// Tab._createBrowser's call to addProgressListener
if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
this._networkStart();
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
this._networkStop();
}

if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
//@line 2289 "/Users/dave/mozilla/source/palm/mobile/chrome/content/browser.js"
}
else if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
this._documentStop();
}
}
},

/** This method is called to indicate progress changes for the currently loading page. */
onProgressChange: function onProgressChange(aWebProgress, aRequest, aCurSelf, aMaxSelf, aCurTotal, aMaxTotal) {
// To use this method, add NOTIFY_PROGRESS to the flags in Tab._createBrowser
},

/** This method is called to indicate a change to the current location. */
onLocationChange: function onLocationChange(aWebProgress, aRequest, aLocationURI) {
// ignore notification that aren't about the main document (iframes, etc)
if (aWebProgress.windowId != this._tab.browser.contentWindowId)
return;

let spec = aLocationURI ? aLocationURI.spec : "";
let location = spec.split("#")[0]; // Ignore fragment identifier changes.

this._hostChanged = true;

if (location != this.browser.lastLocation) {
this.browser.lastLocation = location;
Browser.removeTransientNotificationsForTab(this._tab);
this._tab.resetZoomLevel();

if (this._tab == Browser.selectedTab) {
BrowserUI.updateURI();

// We're about to have new page content, so scroll the content area
// to the top so the new paints will draw correctly.
// (background tabs are delayed scrolled to top in _documentStop)
Browser.scrollContentToTop();
}
}
},

/**
* This method is called to indicate a status changes for the currently
* loading page. The message is already formatted for display.
*/
onStatusChange: function onStatusChange(aWebProgress, aRequest, aStatus, aMessage) {
// To use this method, add NOTIFY_STATUS to the flags in Tab._createBrowser
},

/** This method is called when the security state of the browser changes. */
onSecurityChange: function onSecurityChange(aWebProgress, aRequest, aState) {
// Don't need to do anything if the data we use to update the UI hasn't changed
if (this.state == aState && !this._hostChanged)
return;

this._hostChanged = false;
this.state = aState;

if (this._tab == Browser.selectedTab) {
getIdentityHandler().checkIdentity();
}
},

QueryInterface: function(aIID) {
if (aIID.equals(Ci.nsIWebProgressListener) ||
aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsISupports))
return this;

throw Components.results.NS_ERROR_NO_INTERFACE;
},

_networkStart: function _networkStart() {
this._tab.startLoading();

if (this._tab == Browser.selectedTab) {
BrowserUI.update(TOOLBARSTATE_LOADING);

// We should at least show something in the URLBar until
// the load has progressed further along
if (this._tab.browser.currentURI.spec == "about:blank")
BrowserUI.updateURI();
}

let event = document.createEvent("Events");
event.initEvent("URLChanged", true, false);
this.browser.dispatchEvent(event);
},

_networkStop: function _networkStop() {
this._tab.endLoading();

if (this._tab == Browser.selectedTab)
BrowserUI.update(TOOLBARSTATE_LOADED);

if (this.browser.currentURI.spec != "about:blank")
this._tab.updateThumbnail();
},

_documentStop: function _documentStop() {
if (this._tab == Browser.selectedTab) {
// XXX Sometimes MozScrolledAreaChanged has not occurred, so the scroll pane will not
// be resized yet. We are assuming this event is on the queue, so scroll the pane
// "soon."
Util.executeSoon(function() {
let scroll = Browser.getScrollboxPosition(Browser.contentScrollboxScroller);
if (scroll.isZero())
Browser.scrollContentToBrowser(0, 0);
});
}
else {
// XXX: We don't know the current scroll position of the content, so assume
// it's at the top. This will be fixed by Layers
this._tab.contentScrollOffset = new Point(0, 0);

// Make sure the URLbar is in view. If this were the selected tab,
// onLocationChange would scroll to top.
this._tab.pageScrollOffset = new Point(0, 0);
}
}
};

var OfflineApps = {
offlineAppRequested: function(aRequest) {
if (!Services.prefs.getBoolPref("browser.offline-apps.notify"))
return;

let currentURI = Services.io.newURI(aRequest.location, aRequest.charset, null);

// don't bother showing UI if the user has already made a decision
if (Services.perms.testExactPermission(currentURI, "offline-app") != Ci.nsIPermissionManager.UNKNOWN_ACTION)
return;

try {
if (Services.prefs.getBoolPref("offline-apps.allow_by_default")) {
// all pages can use offline capabilities, no need to ask the user
return;
}
} catch(e) {
// this pref isn't set by default, ignore failures
}

let host = currentURI.asciiHost;
let notificationID = "offline-app-requested-" + host;
let notificationBox = Browser.getNotificationBox();

let notification = notificationBox.getNotificationWithValue(notificationID);
let strings = Elements.browserBundle;
if (notification) {
notification.documents.push(aRequest);
} else {
let buttons = [{
label: strings.getString("offlineApps.allow"),
accessKey: null,
callback: function() {
for (let i = 0; i < notification.documents.length; i++)
OfflineApps.allowSite(notification.documents[i]);
}
},{
label: strings.getString("offlineApps.never"),
accessKey: null,
callback: function() {
for (let i = 0; i < notification.documents.length; i++)
OfflineApps.disallowSite(notification.documents[i]);
}
},{
label: strings.getString("offlineApps.notNow"),
accessKey: null,
callback: function() { /* noop */ }
}];

const priority = notificationBox.PRIORITY_INFO_LOW;
let message = strings.getFormattedString("offlineApps.available", [host]);
notification = notificationBox.appendNotification(message, notificationID,
"", priority, buttons);
notification.documents = [aRequest];
}
},

allowSite: function(aRequest) {
let currentURI = Services.io.newURI(aRequest.location, aRequest.charset, null);
Services.perms.add(currentURI, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);

// When a site is enabled while loading, manifest resources will start
// fetching immediately. This one time we need to do it ourselves.
this._startFetching(aRequest);
},

disallowSite: function(aRequest) {
let currentURI = Services.io.newURI(aRequest.location, aRequest.charset, null);
Services.perms.add(currentURI, "offline-app", Ci.nsIPermissionManager.DENY_ACTION);
},

_startFetching: function(aRequest) {
let currentURI = Services.io.newURI(aRequest.location, aRequest.charset, null);
let manifestURI = Services.io.newURI(aRequest.manifest, aRequest.charset, currentURI);

let updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"].getService(Ci.nsIOfflineCacheUpdateService);
updateService.scheduleUpdate(manifestURI, currentURI);
},

receiveMessage: function receiveMessage(aMessage) {
if (aMessage.name == "Browser:MozApplicationManifest") {
this.offlineAppRequested(aMessage.json);
}
}
};

function Tab(aURI) {
this._id = null;
this._browser = null;
this._browserViewportState = null;
this._state = null;
this._listener = null;
this._loading = false;
this._chromeTab = null;
this.owner = null;

// Set to 0 since new tabs that have not been viewed yet are good tabs to
// toss if app needs more memory.
this.lastSelected = 0;

this.create(aURI);
}

Tab.prototype = {
get browser() {
return this._browser;
},

get browserViewportState() {
return this._browserViewportState;
},

get chromeTab() {
return this._chromeTab;
},

/** Update browser styles when the viewport metadata changes. */
updateViewportMetadata: function updateViewportMetadata(metaData) {
let browser = this._browser;
if (!browser)
return;

this._browserViewportState.metaData = metaData;

// Remove any previous styles.
browser.className = "";
browser.style.removeProperty("width");
browser.style.removeProperty("height");

// Add classes for auto-sizing viewports.
if (metaData.autoSize) {
if (metaData.defaultZoom == 1.0) {
browser.classList.add("window-width");
browser.classList.add("window-height");
} else {
browser.classList.add("viewport-width");
browser.classList.add("viewport-height");
}
}
this.updateViewportSize();
},

/** Update browser size when the metadata or the window size changes. */
updateViewportSize: function updateViewportSize() {
let browser = this._browser;
if (!browser)
return;

let metaData = this._browserViewportState.metaData || {};
if (!metaData.autoSize) {
let screenW = window.innerWidth;
let screenH = window.innerHeight;
let viewportW = metaData.width;
let viewportH = metaData.height;

// If (scale * width) < device-width, increase the width (bug 561413).
let maxInitialZoom = metaData.defaultZoom || metaData.maxZoom;
if (maxInitialZoom && viewportW)
viewportW = Math.max(viewportW, screenW / maxInitialZoom);

let validW = viewportW > 0;
let validH = viewportH > 0;

if (validW && !validH) {
viewportH = viewportW * (screenH / screenW);
} else if (!validW && validH) {
viewportW = viewportH * (screenW / screenH);
} else {
viewportW = kDefaultBrowserWidth;
viewportH = kDefaultBrowserWidth * (screenH / screenW);
}

browser.style.width = viewportW + "px";
browser.style.height = viewportH + "px";
}

// Local XUL documents are not firing MozScrolledAreaChanged
let contentDocument = browser.contentDocument;
if (contentDocument && contentDocument instanceof XULDocument) {
let width = contentDocument.documentElement.scrollWidth;
let height = contentDocument.documentElement.scrollHeight;
BrowserView.Util.ensureMozScrolledAreaEvent(browser, width, height);
}
},

startLoading: function startLoading() {
if (this._loading) throw "Already Loading!";

this._loading = true;

let bv = Browser._browserView;

if (this == Browser.selectedTab) {
bv.setAggressive(false);
// Sync up browser so previous and forward scroll positions are set. This is a good time to do
// this because the resulting invalidation is irrelevant.
bv.ignorePageScroll(true);
Browser.scrollBrowserToContent();
}
},

endLoading: function endLoading() {
if (!this._loading) throw "Not Loading!";
this._loading = false;

if (this == Browser.selectedTab) {
let bv = Browser._browserView;
bv.ignorePageScroll(false);
bv.setAggressive(true);
}
},

isLoading: function isLoading() {
return this._loading;
},

create: function create(aURI) {
// Initialize a viewport state for BrowserView
this._browserViewportState = BrowserView.Util.createBrowserViewportState();

this._chromeTab = document.getElementById("tabs").addTab();
this._createBrowser(aURI);
},

destroy: function destroy() {
document.getElementById("tabs").removeTab(this._chromeTab);
this._chromeTab = null;
this._destroyBrowser();
},

_createBrowser: function _createBrowser(aURI) {
if (this._browser)
throw "Browser already exists";

// Create the browser using the current width the dynamically size the height
let browser = this._browser = document.createElement("browser");
this._chromeTab.linkedBrowser = browser;

browser.setAttribute("style", "overflow: -moz-hidden-unscrollable; visibility: hidden;");
browser.setAttribute("type", "content");

let useRemote = Services.prefs.getBoolPref("browser.tabs.remote");
let useLocal = Util.isLocalScheme(aURI);
browser.setAttribute("remote", (!useLocal && useRemote) ? "true" : "false");

// Append the browser to the document, which should start the page load
document.getElementById("browsers").appendChild(browser);

// stop about:blank from loading
browser.stop();

// Attach a separate progress listener to the browser
let flags = Ci.nsIWebProgress.NOTIFY_LOCATION |
Ci.nsIWebProgress.NOTIFY_SECURITY |
Ci.nsIWebProgress.NOTIFY_STATE_NETWORK |
Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT;
this._listener = new ProgressController(this);
browser.webProgress.addProgressListener(this._listener, flags);

browser.setAttribute("src", aURI);
},

_destroyBrowser: function _destroyBrowser() {
if (this._browser) {
var browser = this._browser;
browser.removeProgressListener(this._listener);

this._browser = null;
this._listener = null;
this._loading = false;

Util.executeSoon(function() {
document.getElementById("browsers").removeChild(browser);
});
}
},

/* Set up the initial zoom level. While the bvs.defaultZoomLevel of a tab is
equal to bvs.zoomLevel this mean that not user action has happended and
we can safely alter the zoom on a window resize or on a page load
*/
resetZoomLevel: function resetZoomLevel() {
let bvs = this._browserViewportState;
bvs.defaultZoomLevel = bvs.zoomLevel;
},

updateThumbnail: function updateThumbnail() {
if (!this._browser)
return;

// XXX: We don't know the size of the browser at this time and we can't fallback
// to contentWindow.innerWidth and .innerHeight. The viewport meta data is not
// even set yet. So fallback to something sane for now.
this._chromeTab.updateThumbnail(this._browser, 800, 500);
},

toString: function() {
return "[Tab " + (this._browser ? this._browser.currentURI.spec : "(no browser)") + "]";
}
};

// Helper used to hide IPC / non-IPC differences for rendering to a canvas
function rendererFactory(aBrowser, aCanvas) {
let wrapper = {};

if (aBrowser.contentWindow) {
let ctx = aCanvas.getContext("2d");
let draw = function(browser, aLeft, aTop, aWidth, aHeight, aColor, aFlags) {
ctx.drawWindow(browser.contentWindow, aLeft, aTop, aWidth, aHeight, aColor, aFlags);
let e = document.createEvent("HTMLEvents");
e.initEvent("MozAsyncCanvasRender", true, true);
aCanvas.dispatchEvent(e);
};
wrapper.checkBrowser = function(browser) {
return browser.contentWindow;
};
wrapper.drawContent = function(callback) {
callback(ctx, draw);
};
}
else {
let ctx = aCanvas.MozGetIPCContext("2d");
let draw = function(browser, aLeft, aTop, aWidth, aHeight, aColor, aFlags) {
ctx.asyncDrawXULElement(browser, aLeft, aTop, aWidth, aHeight, aColor, aFlags);
};
wrapper.checkBrowser = function(browser) {
return !browser.contentWindow;
};
wrapper.drawContent = function(callback) {
callback(ctx, draw);
};
}

return wrapper;
}
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]
demetry14 is offline   Reply With Quote
Thanked By: mamouton
Old 10/04/2010, 11:49 PM   #74 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
There are about 6 other files I have modified, but can not remember what I changed and I didn't make notes within the files to remind me I changed the info. But when I remember and come across the information I will post it.

Remember when modifying the files within omni.jar you need to extract the jar with the jar command and recompile without the meta file as it will make a folder within the jar file instead of everything being at the top most level.
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]

Last edited by demetry14; 10/05/2010 at 07:38 PM.
demetry14 is offline   Reply With Quote
Thanked By: mamouton
Old 10/07/2010, 10:40 PM   #75 (permalink)
Member
 
Posts: 180
Firefox 4 Beta for Android and Maemo is Now Available :: The Mozilla Blog

Mozilla not releasing builds for WebOS ; only for Android & Maemo.

Check Frequently Asked Questions in Firefox 4 beta 1 for Android and Maemo Release Notes

veerar is offline   Reply With Quote
Old 10/08/2010, 05:37 PM   #76 (permalink)
Member
 
Posts: 389
demetry14, seriously. Did you have to paste all of that source code into a post? You couldn't attach a text file? Have you tried looking at your post in the mobile version? Give me a freaking break. Don't ever do that again!!!!!
RJKinsman is offline   Reply With Quote
Old 10/09/2010, 01:10 AM   #77 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
Quote:
Originally Posted by RJKinsman View Post
demetry14, seriously. Did you have to paste all of that source code into a post? You couldn't attach a text file? Have you tried looking at your post in the mobile version? Give me a freaking break. Don't ever do that again!!!!!
I wasn't exactly satisfied with the way the posts came out either but it seems that Quoted text can not be resided as i set it to Font size 1 in the advanced editor and it seems to have done nothing for the actual font size. I do not plan nor did i plan for it to be that way, but thanks for your very direct response to the information posted.
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]
demetry14 is offline   Reply With Quote
Old 10/09/2010, 01:14 AM   #78 (permalink)
Member
 
mamouton's Avatar
 
Posts: 5,719
demetry I made the changes you recommended and it is better. I notice somed addons available for Prefox. I installed and was able to use the twitter for Prefox option. Let me know if you make any other changes. I was trying to find the one you posted when it first came out as an aplha.
__________________
My contributions to customizing the Palm Pre.

Browser Mega Mix|Email Mega Mix|Additional Sync Days|
Disable Various Phone Sounds|Priority Discard Buttons|
mamouton is offline   Reply With Quote
Old 10/10/2010, 07:11 PM   #79 (permalink)
Member
 
demetry14's Avatar
 
Posts: 797
Quote:
Originally Posted by mamouton View Post
demetry I made the changes you recommended and it is better. I notice somed addons available for Prefox. I installed and was able to use the twitter for Prefox option. Let me know if you make any other changes. I was trying to find the one you posted when it first came out as an aplha.
I am trying to move ahead on the new 4 Beta 1 but the build instructions on Fractal Brew do not all work for me... I can do everything except for the hg qpush commands because the qpush is not a recognized command with my macports version of hg.

Once I get passed that issue I should have a build with the new 4 beta 1 source.

If you have the ability follow the mozilla wiki for building the source and follow Fractal Brew for the slight change in mozconfig. If you have space on DropBox maybe we can share our work to make something happen around here.
__________________
16 Candles, The Breakfast Club SB, Friday SB, App Catalog Fix, Palm Pre/Pixi - USB Modem, TMC Workaround, SCRIM Changing OTF

The fastest way to install Preware on your WebOS device.
Put your device in Developer mode.
From your PC download the Preware installer from http://get.preware.org
Run the Preware installer while the WebOS device is connected with the USB cable to your PC.
Vualla Preware is installed.]
demetry14 is offline   Reply With Quote
Old 10/10/2010, 07:18 PM   #80 (permalink)
Member
 
mamouton's Avatar
 
Posts: 5,719
Quote:
Originally Posted by demetry14 View Post
I am trying to move ahead on the new 4 Beta 1 but the build instructions on Fractal Brew do not all work for me... I can do everything except for the hg qpush commands because the qpush is not a recognized command with my macports version of hg.

Once I get passed that issue I should have a build with the new 4 beta 1 source.

If you have the ability follow the mozilla wiki for building the source and follow Fractal Brew for the slight change in mozconfig. If you have space on DropBox maybe we can share our work to make something happen around here.
I tried to pm you my email but you have pm's off. I do have a dropbox my signature will take you there and I will go find the wiki you mentioned.
__________________
My contributions to customizing the Palm Pre.

Browser Mega Mix|Email Mega Mix|Additional Sync Days|
Disable Various Phone Sounds|Priority Discard Buttons|
mamouton is offline   Reply With Quote
Reply

 

Thread Tools
Display Modes



 


Content Relevant URLs by vBSEO 3.6.0