merge mc to kiwifox
authorBenoit Girard <b56girard@gmail.com>
Mon, 19 Dec 2011 11:34:31 -0500
changeset 92334 ff1ce52c8c1b6cf6d87918e22477a2b2fbfe7e46
parent 92333 6b8abfaa2f5a72f4cb4dea7287ddd7b4a92795fd (current diff)
parent 84596 ac01181b4ad0dc453e70584ff6f81b140bd96438 (diff)
child 92335 6460c87c6371508954525ec435984dde383a8ad6
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mc to kiwifox
accessible/src/mac/mozAccessibleWrapper.h
browser/base/content/NetworkPrioritizer.jsm
browser/base/content/openLocationLastURL.jsm
browser/base/content/test/browser_NetworkPrioritizer.js
browser/components/migration/src/nsOperaProfileMigrator.cpp
browser/components/migration/src/nsOperaProfileMigrator.h
browser/components/sessionstore/test/browser/Makefile.in
browser/components/sessionstore/test/browser/browser_248970_a.js
browser/components/sessionstore/test/browser/browser_248970_b.js
browser/components/sessionstore/test/browser/browser_248970_b_sample.html
browser/components/sessionstore/test/browser/browser_339445.js
browser/components/sessionstore/test/browser/browser_339445_sample.html
browser/components/sessionstore/test/browser/browser_345898.js
browser/components/sessionstore/test/browser/browser_346337.js
browser/components/sessionstore/test/browser/browser_346337_sample.html
browser/components/sessionstore/test/browser/browser_350525.js
browser/components/sessionstore/test/browser/browser_354894.js
browser/components/sessionstore/test/browser/browser_367052.js
browser/components/sessionstore/test/browser/browser_393716.js
browser/components/sessionstore/test/browser/browser_394759_basic.js
browser/components/sessionstore/test/browser/browser_394759_behavior.js
browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js
browser/components/sessionstore/test/browser/browser_394759_purge.js
browser/components/sessionstore/test/browser/browser_408470.js
browser/components/sessionstore/test/browser/browser_408470_sample.html
browser/components/sessionstore/test/browser/browser_423132.js
browser/components/sessionstore/test/browser/browser_423132_sample.html
browser/components/sessionstore/test/browser/browser_447951.js
browser/components/sessionstore/test/browser/browser_447951_sample.html
browser/components/sessionstore/test/browser/browser_448741.js
browser/components/sessionstore/test/browser/browser_454908.js
browser/components/sessionstore/test/browser/browser_454908_sample.html
browser/components/sessionstore/test/browser/browser_456342.js
browser/components/sessionstore/test/browser/browser_456342_sample.xhtml
browser/components/sessionstore/test/browser/browser_459906.js
browser/components/sessionstore/test/browser/browser_459906_empty.html
browser/components/sessionstore/test/browser/browser_459906_sample.html
browser/components/sessionstore/test/browser/browser_461634.js
browser/components/sessionstore/test/browser/browser_461743.js
browser/components/sessionstore/test/browser/browser_461743_sample.html
browser/components/sessionstore/test/browser/browser_463205.js
browser/components/sessionstore/test/browser/browser_463205_helper.html
browser/components/sessionstore/test/browser/browser_463205_sample.html
browser/components/sessionstore/test/browser/browser_463206.js
browser/components/sessionstore/test/browser/browser_463206_sample.html
browser/components/sessionstore/test/browser/browser_464199.js
browser/components/sessionstore/test/browser/browser_464620_a.html
browser/components/sessionstore/test/browser/browser_464620_a.js
browser/components/sessionstore/test/browser/browser_464620_b.html
browser/components/sessionstore/test/browser/browser_464620_b.js
browser/components/sessionstore/test/browser/browser_464620_xd.html
browser/components/sessionstore/test/browser/browser_465215.js
browser/components/sessionstore/test/browser/browser_465223.js
browser/components/sessionstore/test/browser/browser_466937.js
browser/components/sessionstore/test/browser/browser_466937_sample.html
browser/components/sessionstore/test/browser/browser_467409-backslashplosion.js
browser/components/sessionstore/test/browser/browser_477657.js
browser/components/sessionstore/test/browser/browser_480148.js
browser/components/sessionstore/test/browser/browser_480893.js
browser/components/sessionstore/test/browser/browser_483330.js
browser/components/sessionstore/test/browser/browser_485482.js
browser/components/sessionstore/test/browser/browser_485482_sample.html
browser/components/sessionstore/test/browser/browser_485563.js
browser/components/sessionstore/test/browser/browser_490040.js
browser/components/sessionstore/test/browser/browser_491168.js
browser/components/sessionstore/test/browser/browser_491577.js
browser/components/sessionstore/test/browser/browser_493467.js
browser/components/sessionstore/test/browser/browser_495495.js
browser/components/sessionstore/test/browser/browser_500328.js
browser/components/sessionstore/test/browser/browser_506482.js
browser/components/sessionstore/test/browser/browser_514751.js
browser/components/sessionstore/test/browser/browser_522375.js
browser/components/sessionstore/test/browser/browser_522545.js
browser/components/sessionstore/test/browser/browser_524745.js
browser/components/sessionstore/test/browser/browser_526613.js
browser/components/sessionstore/test/browser/browser_528776.js
browser/components/sessionstore/test/browser/browser_579868.js
browser/components/sessionstore/test/browser/browser_579879.js
browser/components/sessionstore/test/browser/browser_580512.js
browser/components/sessionstore/test/browser/browser_581593.js
browser/components/sessionstore/test/browser/browser_581937.js
browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js
browser/components/sessionstore/test/browser/browser_586147.js
browser/components/sessionstore/test/browser/browser_588426.js
browser/components/sessionstore/test/browser/browser_589246.js
browser/components/sessionstore/test/browser/browser_590268.js
browser/components/sessionstore/test/browser/browser_590563.js
browser/components/sessionstore/test/browser/browser_595601-restore_hidden.js
browser/components/sessionstore/test/browser/browser_597071.js
browser/components/sessionstore/test/browser/browser_597315.js
browser/components/sessionstore/test/browser/browser_597315_a.html
browser/components/sessionstore/test/browser/browser_597315_b.html
browser/components/sessionstore/test/browser/browser_597315_c.html
browser/components/sessionstore/test/browser/browser_597315_c1.html
browser/components/sessionstore/test/browser/browser_597315_c2.html
browser/components/sessionstore/test/browser/browser_597315_index.html
browser/components/sessionstore/test/browser/browser_599909.js
browser/components/sessionstore/test/browser/browser_600545.js
browser/components/sessionstore/test/browser/browser_601955.js
browser/components/sessionstore/test/browser/browser_607016.js
browser/components/sessionstore/test/browser/browser_615394-SSWindowState_events.js
browser/components/sessionstore/test/browser/browser_618151.js
browser/components/sessionstore/test/browser/browser_623779.js
browser/components/sessionstore/test/browser/browser_624727.js
browser/components/sessionstore/test/browser/browser_625016.js
browser/components/sessionstore/test/browser/browser_625257.js
browser/components/sessionstore/test/browser/browser_628270.js
browser/components/sessionstore/test/browser/browser_635418.js
browser/components/sessionstore/test/browser/browser_636279.js
browser/components/sessionstore/test/browser/browser_644409-scratchpads.js
browser/components/sessionstore/test/browser/browser_645428.js
browser/components/sessionstore/test/browser/browser_659591.js
browser/components/sessionstore/test/browser/browser_662812.js
browser/components/sessionstore/test/browser/browser_665702-state_session.js
browser/components/sessionstore/test/browser/browser_682507.js
browser/components/sessionstore/test/browser/browser_687710.js
browser/components/sessionstore/test/browser/browser_687710_2.js
browser/components/sessionstore/test/browser/browser_694378.js
browser/components/sessionstore/test/browser/browser_705597.js
browser/components/sessionstore/test/browser/browser_form_restore_events.js
browser/components/sessionstore/test/browser/browser_form_restore_events_sample.html
browser/components/sessionstore/test/browser/head.js
browser/components/sidebar/src/Makefile.in
browser/components/sidebar/src/nsSidebar.js
browser/components/sidebar/src/nsSidebar.manifest
browser/components/test/browser/Makefile.in
browser/components/test/browser/browser_bug538331.js
browser/components/wintaskbar/WindowsJumpLists.jsm
browser/components/wintaskbar/WindowsPreviewPerTab.jsm
browser/components/wintaskbar/test/browser_taskbar_preview.js
browser/devtools/styleinspector/test/browser/Makefile.in
browser/devtools/styleinspector/test/browser/browser_bug683672.html
browser/devtools/styleinspector/test/browser/browser_bug683672.js
browser/devtools/styleinspector/test/browser/browser_bug_692400_element_style.js
browser/devtools/styleinspector/test/browser/browser_csslogic_inherited.js
browser/devtools/styleinspector/test/browser/browser_ruleview_editor.js
browser/devtools/styleinspector/test/browser/browser_ruleview_inherit.js
browser/devtools/styleinspector/test/browser/browser_ruleview_manipulation.js
browser/devtools/styleinspector/test/browser/browser_ruleview_override.js
browser/devtools/styleinspector/test/browser/browser_ruleview_ui.js
browser/devtools/styleinspector/test/browser/browser_styleinspector.js
browser/devtools/styleinspector/test/browser/browser_styleinspector_bug_672744_search_filter.js
browser/devtools/styleinspector/test/browser/browser_styleinspector_bug_672746_default_styles.js
browser/devtools/styleinspector/test/browser/browser_styleinspector_bug_689759_no_results_placeholder.js
browser/devtools/styleinspector/test/browser/head.js
browser/devtools/webconsole/test/browser/Makefile.in
browser/devtools/webconsole/test/browser/browser_gcli_inspect.html
browser/devtools/webconsole/test/browser/browser_gcli_inspect.js
browser/devtools/webconsole/test/browser/browser_gcli_integrate.js
browser/devtools/webconsole/test/browser/browser_gcli_require.js
browser/devtools/webconsole/test/browser/browser_gcli_web.js
browser/devtools/webconsole/test/browser/browser_warn_user_about_replaced_api.js
browser/devtools/webconsole/test/browser/browser_webconsole_abbreviate_source_url.js
browser/devtools/webconsole/test/browser/browser_webconsole_basic_net_logging.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_578437_page_reload.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_579412_input_focus.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_580001_closing_after_completion.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_580030_errors_after_page_reload.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_580400_groups.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_580454_timestamp_l10n.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_581231_close_button.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_582201_duplicate_errors.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_583816_tab_focus.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_585237_line_limit.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_585956_console_trace.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_585991_autocomplete_keys.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_585991_autocomplete_popup.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_586388_select_all.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_587617_output_copy.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_588342_document_focus.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_588730_text_node_insertion.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_588967_input_expansion.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_589162_css_filter.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_592442_closing_brackets.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_593003_iframe_wrong_hud.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_594477_clickable_output.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_594497_history_arrow_keys.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_595223_file_uri.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_595350_multiple_windows_and_tabs.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_595934_message_categories.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597103_deactivateHUDForContext_unfocused_window.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_external_script_errors.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597136_network_requests_from_chrome.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597460_filter_scroll.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_597756_reopen_closed_tab.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_598357_jsterm_output.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_599725_response_headers.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_600183_charset.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_601177_log_levels.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_601352_scroll.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_601667_filter_buttons.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_601909_remember_height.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_602572_log_bodies_checkbox.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_603750_websocket.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_611795.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_613013_console_api_iframe.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_613280_jsterm_copy.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_613642_maintain_scroll.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_613642_prune_scroll.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_614793_jsterm_scroll.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_618078_network_exceptions.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_618311_close_panels.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_618311_private_browsing.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_621644_jsterm_dollar.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_622303_persistent_filters.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_626484_output_copy_order.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_630733_response_redirect_headers.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_632275_getters_document_width.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_632347_iterators_generators.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_632817.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_642108_pruneTest.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_642615_autocomplete.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_644419_log_limits.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_646025_console_file_location.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_651501_document_body_autocomplete.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_653531_highlighter_console_helper.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_658368_time_methods.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_659907_console_dir.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_660806_history_nav.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_663443_panel_title.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_664131_console_group.js
browser/devtools/webconsole/test/browser/browser_webconsole_bug_678816.js
browser/devtools/webconsole/test/browser/browser_webconsole_chrome.js
browser/devtools/webconsole/test/browser/browser_webconsole_completion.js
browser/devtools/webconsole/test/browser/browser_webconsole_console_extras.js
browser/devtools/webconsole/test/browser/browser_webconsole_console_logging_api.js
browser/devtools/webconsole/test/browser/browser_webconsole_consoleonpage.js
browser/devtools/webconsole/test/browser/browser_webconsole_copying_multiple_messages_inserts_newlines_in_between.js
browser/devtools/webconsole/test/browser/browser_webconsole_execution_scope.js
browser/devtools/webconsole/test/browser/browser_webconsole_history.js
browser/devtools/webconsole/test/browser/browser_webconsole_hud_getters.js
browser/devtools/webconsole/test/browser/browser_webconsole_js_input_and_output_styling.js
browser/devtools/webconsole/test/browser/browser_webconsole_js_input_expansion.js
browser/devtools/webconsole/test/browser/browser_webconsole_jsterm.js
browser/devtools/webconsole/test/browser/browser_webconsole_live_filtering_of_message_types.js
browser/devtools/webconsole/test/browser/browser_webconsole_live_filtering_on_search_strings.js
browser/devtools/webconsole/test/browser/browser_webconsole_log_node_classes.js
browser/devtools/webconsole/test/browser/browser_webconsole_message_node_id.js
browser/devtools/webconsole/test/browser/browser_webconsole_netlogging.js
browser/devtools/webconsole/test/browser/browser_webconsole_network_panel.js
browser/devtools/webconsole/test/browser/browser_webconsole_notifications.js
browser/devtools/webconsole/test/browser/browser_webconsole_null_and_undefined_output.js
browser/devtools/webconsole/test/browser/browser_webconsole_output_order.js
browser/devtools/webconsole/test/browser/browser_webconsole_position_ui.js
browser/devtools/webconsole/test/browser/browser_webconsole_property_panel.js
browser/devtools/webconsole/test/browser/browser_webconsole_property_provider.js
browser/devtools/webconsole/test/browser/browser_webconsole_registries.js
browser/devtools/webconsole/test/browser/browser_webconsole_view_source.js
browser/devtools/webconsole/test/browser/browser_webconsole_window_zombie.js
browser/devtools/webconsole/test/browser/head.js
browser/devtools/webconsole/test/browser/test-bug-585956-console-trace.html
browser/devtools/webconsole/test/browser/test-bug-593003-iframe-wrong-hud-iframe.html
browser/devtools/webconsole/test/browser/test-bug-593003-iframe-wrong-hud.html
browser/devtools/webconsole/test/browser/test-bug-595934-canvas-css.html
browser/devtools/webconsole/test/browser/test-bug-595934-canvas-css.js
browser/devtools/webconsole/test/browser/test-bug-595934-canvas.html
browser/devtools/webconsole/test/browser/test-bug-595934-canvas.js
browser/devtools/webconsole/test/browser/test-bug-595934-css-loader.css
browser/devtools/webconsole/test/browser/test-bug-595934-css-loader.css^headers^
browser/devtools/webconsole/test/browser/test-bug-595934-css-loader.html
browser/devtools/webconsole/test/browser/test-bug-595934-css-parser.css
browser/devtools/webconsole/test/browser/test-bug-595934-css-parser.html
browser/devtools/webconsole/test/browser/test-bug-595934-dom-events-external2.html
browser/devtools/webconsole/test/browser/test-bug-595934-dom-events-external2.js
browser/devtools/webconsole/test/browser/test-bug-595934-dom-events.html
browser/devtools/webconsole/test/browser/test-bug-595934-dom-html-external.html
browser/devtools/webconsole/test/browser/test-bug-595934-dom-html-external.js
browser/devtools/webconsole/test/browser/test-bug-595934-dom-html.html
browser/devtools/webconsole/test/browser/test-bug-595934-empty-getelementbyid.html
browser/devtools/webconsole/test/browser/test-bug-595934-empty-getelementbyid.js
browser/devtools/webconsole/test/browser/test-bug-595934-html.html
browser/devtools/webconsole/test/browser/test-bug-595934-image.html
browser/devtools/webconsole/test/browser/test-bug-595934-image.jpg
browser/devtools/webconsole/test/browser/test-bug-595934-imagemap.html
browser/devtools/webconsole/test/browser/test-bug-595934-malformedxml-external.html
browser/devtools/webconsole/test/browser/test-bug-595934-malformedxml-external.xml
browser/devtools/webconsole/test/browser/test-bug-595934-malformedxml.xhtml
browser/devtools/webconsole/test/browser/test-bug-595934-svg.xhtml
browser/devtools/webconsole/test/browser/test-bug-595934-workers.html
browser/devtools/webconsole/test/browser/test-bug-595934-workers.js
browser/devtools/webconsole/test/browser/test-bug-597136-external-script-errors.html
browser/devtools/webconsole/test/browser/test-bug-597136-external-script-errors.js
browser/devtools/webconsole/test/browser/test-bug-597756-reopen-closed-tab.html
browser/devtools/webconsole/test/browser/test-bug-599725-response-headers.sjs
browser/devtools/webconsole/test/browser/test-bug-600183-charset.html
browser/devtools/webconsole/test/browser/test-bug-600183-charset.html^headers^
browser/devtools/webconsole/test/browser/test-bug-601177-log-levels.html
browser/devtools/webconsole/test/browser/test-bug-601177-log-levels.js
browser/devtools/webconsole/test/browser/test-bug-603750-websocket.html
browser/devtools/webconsole/test/browser/test-bug-603750-websocket.js
browser/devtools/webconsole/test/browser/test-bug-613013-console-api-iframe.html
browser/devtools/webconsole/test/browser/test-bug-618078-network-exceptions.html
browser/devtools/webconsole/test/browser/test-bug-621644-jsterm-dollar.html
browser/devtools/webconsole/test/browser/test-bug-630733-response-redirect-headers.sjs
browser/devtools/webconsole/test/browser/test-bug-632275-getters.html
browser/devtools/webconsole/test/browser/test-bug-632347-iterators-generators.html
browser/devtools/webconsole/test/browser/test-bug-644419-log-limits.html
browser/devtools/webconsole/test/browser/test-bug-646025-console-file-location.html
browser/devtools/webconsole/test/browser/test-bug-658368-time-methods.html
browser/devtools/webconsole/test/browser/test-bug-678816-content.js
browser/devtools/webconsole/test/browser/test-console-extras.html
browser/devtools/webconsole/test/browser/test-console-replaced-api.html
browser/devtools/webconsole/test/browser/test-console.html
browser/devtools/webconsole/test/browser/test-data.json
browser/devtools/webconsole/test/browser/test-duplicate-error.html
browser/devtools/webconsole/test/browser/test-encoding-ISO-8859-1.html
browser/devtools/webconsole/test/browser/test-error.html
browser/devtools/webconsole/test/browser/test-file-location.js
browser/devtools/webconsole/test/browser/test-filter.html
browser/devtools/webconsole/test/browser/test-image.png
browser/devtools/webconsole/test/browser/test-mutation.html
browser/devtools/webconsole/test/browser/test-network-request.html
browser/devtools/webconsole/test/browser/test-network.html
browser/devtools/webconsole/test/browser/test-observe-http-ajax.html
browser/devtools/webconsole/test/browser/test-own-console.html
browser/devtools/webconsole/test/browser/test-property-provider.html
browser/devtools/webconsole/test/browser/testscript.js
content/events/public/nsPLDOMEvent.h
content/events/src/nsPLDOMEvent.cpp
dom/indexedDB/test/test_bad_keypath.html
dom/interfaces/core/nsIDOMNSElement.idl
gfx/layers/basic/BasicLayers.cpp
gfx/layers/opengl/LayerManagerOGL.cpp
intl/chardet/public/nsICharsetResolver.idl
ipc/chromium/src/base/sha2.cc
ipc/chromium/src/base/sha2.h
ipc/chromium/src/base/sha2_unittest.cc
ipc/chromium/src/base/third_party/nss/README.chromium
ipc/chromium/src/base/third_party/nss/blapi.h
ipc/chromium/src/base/third_party/nss/blapit.h
ipc/chromium/src/base/third_party/nss/sha256.h
ipc/chromium/src/base/third_party/nss/sha512.cc
js/src/find-child.py
js/src/jsinttypes.h
js/src/jsotypes.h
media/libsydneyaudio/src/sydney_audio_gonk.c
mobile/android/base/db/BrowserContract.java
mobile/android/base/db/BrowserProvider.java
mobile/android/base/resources/drawable/rounded_grey_border.xml
mobile/android/base/resources/drawable/rounded_grey_box.xml
mobile/android/base/resources/layout/abouthome_addon_list_item.xml
mobile/android/base/resources/layout/abouthome_grid_box.xml
modules/libpref/src/init/all.js
parser/htmlparser/src/nsViewSourceHTML.cpp
parser/htmlparser/src/nsViewSourceHTML.h
testing/mochitest/pywebsocket/mod_pywebsocket/_stream_hybi06.py
testing/mochitest/pywebsocket/mod_pywebsocket/handshake/hybi06.py
toolkit/components/aboutmemory/tests/chrome/Makefile.in
toolkit/components/aboutmemory/tests/chrome/test_aboutmemory.xul
toolkit/components/aboutmemory/tests/chrome/test_asyncClose_leak.xul
toolkit/components/startup/tests/browser/Makefile.in
toolkit/components/startup/tests/browser/beforeunload.html
toolkit/components/startup/tests/browser/browser_bug511456.js
toolkit/components/startup/tests/browser/browser_bug537449.js
toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_AllOS1.js
toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_AllOS2.js
widget/public/nsIWidget.h
widget/src/xpwidgets/nsBaseWidget.cpp
widget/src/xpwidgets/nsBaseWidget.h
--- a/Makefile.in
+++ b/Makefile.in
@@ -57,16 +57,17 @@ TIERS += base
 
 #
 # tier "base" - basic setup
 #
 tier_base_dirs = \
 	config \
 	build \
 	probes \
+	mfbt \
 	$(NULL)
 
 ifndef LIBXUL_SDK
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
 tier_base_dirs += other-licenses/android other-licenses/skia-npapi
 endif
 
 tier_base_dirs += memory
--- a/accessible/build/nsAccessibilityFactory.cpp
+++ b/accessible/build/nsAccessibilityFactory.cpp
@@ -57,17 +57,16 @@ NS_ConstructAccessibilityService(nsISupp
     }
     rv = accessibility->QueryInterface(aIID, aResult);
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
     NS_RELEASE(accessibility);
     return rv;
 }
 
 NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_ACCESSIBLE_RETRIEVAL_CID);
 
 static const mozilla::Module::CIDEntry kA11yCIDs[] = {
     { &kNS_ACCESSIBILITY_SERVICE_CID, false, NULL, NS_ConstructAccessibilityService },
     { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kA11yContracts[] = {
     { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -435,17 +435,18 @@ nsAccUtils::GetTextAccessibleFromSelecti
     return nsnull;
   }
 
   do {
     nsHyperTextAccessible* textAcc = accessible->AsHyperText();
     if (textAcc)
       return textAcc;
 
-  } while (accessible = accessible->Parent());
+    accessible = accessible->Parent();
+  } while (accessible);
 
   NS_NOTREACHED("We must reach document accessible implementing nsIAccessibleText!");
   return nsnull;
 }
 
 nsresult
 nsAccUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
                                   PRUint32 aCoordinateType,
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -209,16 +209,20 @@ protected:
     static void NotifyA11yInitOrShutdown(bool aIsInit);
 
     // Static data, we do our own refcounting for our static data
     static nsIStringBundle *gStringBundle;
 
     static bool gIsFormFillEnabled;
 
 private:
+  nsAccessNode();
+  nsAccessNode(const nsAccessNode&);
+  nsAccessNode& operator =(const nsAccessNode&);
+  
   static nsApplicationAccessible *gApplicationAccessible;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsAccessNode,
                               NS_ACCESSNODE_IMPL_CID)
 
 #endif
 
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1194,23 +1194,21 @@ nsAccessibilityService::GetOrCreateAcces
   if (!newAcc) {
     // Elements may implement nsIAccessibleProvider via XBL. This allows them to
     // say what kind of accessible to create.
     newAcc = CreateAccessibleByType(content, aWeakShell);
   }
 
   if (!newAcc) {
     // Create generic accessibles for SVG and MathML nodes.
-    if (content->GetNameSpaceID() == kNameSpaceID_SVG &&
-        content->Tag() == nsGkAtoms::svg) {
+    if (content->IsSVG(nsGkAtoms::svg)) {
       newAcc = new nsEnumRoleAccessible(content, aWeakShell,
                                         nsIAccessibleRole::ROLE_DIAGRAM);
     }
-    else if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
-             content->Tag() == nsGkAtoms::math) {
+    else if (content->IsMathML(nsGkAtoms::math)) {
       newAcc = new nsEnumRoleAccessible(content, aWeakShell,
                                         nsIAccessibleRole::ROLE_EQUATION);
     }
   }
 
   if (!newAcc) {
     newAcc = CreateAccessibleForDeckChild(weakFrame.GetFrame(), content,
                                           aWeakShell);
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1560,24 +1560,24 @@ nsDocAccessible::AddDependentIDsFor(nsAc
 {
   for (PRUint32 idx = 0; idx < kRelationAttrsLen; idx++) {
     nsIAtom* relAttr = *kRelationAttrs[idx];
     if (aRelAttr && aRelAttr != relAttr)
       continue;
 
     if (relAttr == nsGkAtoms::_for) {
       if (!aRelProvider->GetContent()->IsHTML() ||
-          aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
-          aRelProvider->GetContent()->Tag() != nsGkAtoms::output)
+          (aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
+           aRelProvider->GetContent()->Tag() != nsGkAtoms::output))
         continue;
 
     } else if (relAttr == nsGkAtoms::control) {
       if (!aRelProvider->GetContent()->IsXUL() ||
-          aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
-          aRelProvider->GetContent()->Tag() != nsGkAtoms::description)
+          (aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
+           aRelProvider->GetContent()->Tag() != nsGkAtoms::description))
         continue;
     }
 
     IDRefsIterator iter(aRelProvider->GetContent(), relAttr);
     while (true) {
       const nsDependentSubstring id = iter.NextID();
       if (id.IsEmpty())
         break;
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -70,17 +70,16 @@ EXPORTS = \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   nsApplicationAccessibleWrap.h \
   mozDocAccessible.h \
   mozAccessible.h \
-  mozAccessibleWrapper.h \
   mozAccessibleProtocol.h \
   mozActionElements.h \
   mozTextAccessible.h \
   nsRoleMap.h \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
deleted file mode 100644
--- a/accessible/src/mac/mozAccessibleWrapper.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: Objective-C++; tab-width: 2; 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
- * http://www.mozilla.org/MPL/
- *
- * 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
- * Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Original Author: Håkan Waara <hwaara@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
- 
-#include "nsAccessibleWrap.h"
-
-#include "nsObjCExceptions.h"
-
-#import "mozAccessible.h"
-
-/* Wrapper class.  
-
-   This is needed because C++-only headers such as nsAccessibleWrap.h must not depend
-   on Objective-C and Cocoa. Classes in accessible/src/base depend on them, and other modules in turn
-   depend on them, so in the end all of Mozilla would end up having to link against Cocoa and be renamed .mm :-)
-
-   In order to have a mozAccessible object wrapped, the user passes itself (nsAccessible*) and the subclass of
-   mozAccessible that should be instantiated.
-
-   In the header file, the AccessibleWrapper is used as the member, and is forward-declared (because this header
-   cannot be #included directly.
-*/
-
-struct AccessibleWrapper {
-  mozAccessible *object;
-  AccessibleWrapper (nsAccessibleWrap *parent, Class classType) {
-    NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
-
-    object = (mozAccessible*)[[classType alloc] initWithAccessible:parent];
-
-    NS_OBJC_END_TRY_ABORT_BLOCK;
-  }
-
-  ~AccessibleWrapper () {
-    NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
-
-    // if some third-party still holds on to the object, it's important that it is marked
-    // as expired, so it can't do any harm (e.g., walk into an expired hierarchy of nodes).
-    [object expire];
-    
-    [object release];
-
-    NS_OBJC_END_TRY_ABORT_BLOCK;
-  }
-
-  mozAccessible* getNativeObject () {
-    return object;
-  }
- 
-  bool isIgnored () {
-    NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
-
-    return (bool)[object accessibilityIsIgnored];
-
-    NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
-  }
-};
--- a/accessible/src/mac/nsAccessibleWrap.h
+++ b/accessible/src/mac/nsAccessibleWrap.h
@@ -50,27 +50,26 @@
 #include "States.h"
 
 #include "nsCOMPtr.h"
 #include "nsRect.h"
 
 #include "nsTArray.h"
 #include "nsAutoPtr.h"
 
-struct AccessibleWrapper;
+#if defined(__OBJC__)
+@class mozAccessible;
+#endif
 
 class nsAccessibleWrap : public nsAccessible
 {
   public: // construction, destruction
     nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
     virtual ~nsAccessibleWrap();
     
-    // creates the native accessible connected to this one.
-    virtual bool Init ();
-    
     // get the native obj-c object (mozAccessible)
     NS_IMETHOD GetNativeInterface (void **aOutAccessible);
     
     // the objective-c |Class| type that this accessible's native object
     // should be instantied with.   used on runtime to determine the
     // right type for this accessible's associated native object.
     virtual Class GetNativeType ();
 
@@ -86,26 +85,52 @@ class nsAccessibleWrap : public nsAccess
     bool HasPopup () {
       return (NativeState() & mozilla::a11y::states::HASPOPUP);
     }
     
     // return this accessible's all children, adhering to "flat" accessibles by not returning their children.
     void GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aChildrenArray);
     virtual already_AddRefed<nsIAccessible> GetUnignoredParent();
     
-  protected:
+protected:
 
-    virtual nsresult FirePlatformEvent(AccEvent* aEvent);
+  virtual nsresult FirePlatformEvent(AccEvent* aEvent);
 
   /**
    * Return true if the parent doesn't have children to expose to AT.
    */
   bool AncestorIsFlat();
 
-    // Wrapper around our native object.
-    AccessibleWrapper *mNativeWrapper;
+  /**
+   * Get the native object. Create it if needed.
+   */
+#if defined(__OBJC__)
+  mozAccessible* GetNativeObject();
+#else
+  id GetNativeObject();
+#endif
+
+private:
+
+  /**
+   * Our native object. Private because its creation is done lazily.
+   * Don't access it directly. Ever. Unless you are GetNativeObject() or Shutdown()
+   */
+#if defined(__OBJC__)
+  // if we are in Objective-C, we use the actual Obj-C class.
+  mozAccessible* mNativeObject;
+#else
+  id mNativeObject;
+#endif
+
+  /**
+   * We have created our native. This does not mean there is one.
+   * This can never go back to false.
+   * We need it because checking whether we need a native object cost time.
+   */
+  bool mNativeInited;  
 };
 
 // Define unsupported wrap classes here
 typedef class nsHTMLTableCellAccessible    nsHTMLTableCellAccessibleWrap;
 typedef class nsHTMLTableAccessible        nsHTMLTableAccessibleWrap;
 
 #endif
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -36,59 +36,54 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDocAccessible.h"
 #include "nsObjCExceptions.h"
 
 #import "nsRoleMap.h"
 
-#import "mozAccessibleWrapper.h"
 #import "mozAccessible.h"
 #import "mozActionElements.h"
 #import "mozTextAccessible.h"
 
 nsAccessibleWrap::
   nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
-  nsAccessible(aContent, aShell), mNativeWrapper(nsnull)
+  nsAccessible(aContent, aShell), mNativeObject(nil),
+  mNativeInited(false)
 {
 }
 
 nsAccessibleWrap::~nsAccessibleWrap()
 {
-  if (mNativeWrapper) {
-    delete mNativeWrapper;
-    mNativeWrapper = nsnull;
-  }
 }
 
-bool
-nsAccessibleWrap::Init () 
+mozAccessible* 
+nsAccessibleWrap::GetNativeObject()
 {
-  if (!nsAccessible::Init())
-    return false;
-
-  if (!mNativeWrapper && !AncestorIsFlat()) {
-    // Create our native object using the class type specified in GetNativeType().
-    mNativeWrapper = new AccessibleWrapper (this, GetNativeType());
-    if (!mNativeWrapper)
-      return false;
-  }
-
-  return true;
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
+  
+  if (!mNativeInited && !mNativeObject && !IsDefunct() && !AncestorIsFlat())
+    mNativeObject = [[GetNativeType() alloc] initWithAccessible:this];
+  
+  mNativeInited = true;
+  
+  return mNativeObject;
+  
+  NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 NS_IMETHODIMP
 nsAccessibleWrap::GetNativeInterface (void **aOutInterface) 
 {
-  if (mNativeWrapper) {
-    *aOutInterface = (void**)mNativeWrapper->getNativeObject();
-    return NS_OK;
-  }
-  return NS_ERROR_FAILURE;
+  NS_ENSURE_ARG_POINTER(aOutInterface);
+
+  *aOutInterface = static_cast<void*>(GetNativeObject());
+    
+  return *aOutInterface ? NS_OK : NS_ERROR_FAILURE;
 }
 
 // overridden in subclasses to create the right kind of object. by default we create a generic
 // 'mozAccessible' node.
 Class
 nsAccessibleWrap::GetNativeType () 
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
@@ -136,21 +131,26 @@ nsAccessibleWrap::GetNativeType ()
 }
 
 // this method is very important. it is fired when an accessible object "dies". after this point
 // the object might still be around (because some 3rd party still has a ref to it), but it is
 // in fact 'dead'.
 void
 nsAccessibleWrap::Shutdown ()
 {
-  if (mNativeWrapper) {
-    delete mNativeWrapper;
-    mNativeWrapper = nsnull;
+  // this ensure we will not try to re-create the native object.
+  mNativeInited = true;
+
+  // we really intend to access the member directly.
+  if (mNativeObject) {
+    [mNativeObject expire];
+    [mNativeObject release];
+    mNativeObject = nil;
   }
-  
+
   nsAccessible::Shutdown();
 }
 
 nsresult
 nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
@@ -196,31 +196,34 @@ nsAccessibleWrap::FirePlatformEvent(AccE
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 void
 nsAccessibleWrap::InvalidateChildren()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
-  if (mNativeWrapper) {
-    mozAccessible *object = mNativeWrapper->getNativeObject();
-    [object invalidateChildren];
-  }
+  [GetNativeObject() invalidateChildren];
+
   nsAccessible::InvalidateChildren();
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 // if we for some reason have no native accessible, we should be skipped over (and traversed)
 // when fetching all unignored children, etc.  when counting unignored children, we will not be counted.
 bool 
 nsAccessibleWrap::IsIgnored() 
 {
-  return (mNativeWrapper == nsnull) || mNativeWrapper->isIgnored();
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+  
+  mozAccessible* nativeObject = GetNativeObject();
+  return (!nativeObject) || [nativeObject accessibilityIsIgnored];
+  
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
 }
 
 void
 nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aChildrenArray)
 {
   // we're flat; there are no children.
   if (nsAccUtils::MustPrune(this))
     return;
--- a/accessible/src/mac/nsDocAccessibleWrap.h
+++ b/accessible/src/mac/nsDocAccessibleWrap.h
@@ -43,17 +43,11 @@
 
 class nsDocAccessibleWrap: public nsDocAccessible
 {
 public:
   nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
                       nsIWeakReference *aShell);
   virtual ~nsDocAccessibleWrap();
 
-  // nsIAccessNode
-
-  /**
-   * Creates the native accessible connected to this one.
-   */
-  virtual bool Init();
 };
 
 #endif
--- a/accessible/src/mac/nsDocAccessibleWrap.mm
+++ b/accessible/src/mac/nsDocAccessibleWrap.mm
@@ -32,38 +32,21 @@
  * 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 ***** */
 
 #include "nsDocAccessibleWrap.h"
 
-#import "mozAccessibleWrapper.h"
+#import "mozAccessible.h"
 
 nsDocAccessibleWrap::
   nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
                       nsIWeakReference *aShell) :
   nsDocAccessible(aDocument, aRootContent, aShell)
 {
 }
 
 nsDocAccessibleWrap::~nsDocAccessibleWrap()
 {
 }
 
-bool
-nsDocAccessibleWrap::Init () 
-{
-  if (!nsDocAccessible::Init())
-    return false;
-
-  NS_ASSERTION(!mNativeWrapper, "nsDocAccessibleWrap::Init() called more than once!");
-
-  if (!mNativeWrapper) {
-    // Create our native object using the class type specified in GetNativeType().
-    mNativeWrapper = new AccessibleWrapper (this, GetNativeType());
-    if (!mNativeWrapper)
-      return false;
-  }
-
-  return true;
-}
--- a/accessible/src/mac/nsRootAccessibleWrap.mm
+++ b/accessible/src/mac/nsRootAccessibleWrap.mm
@@ -40,19 +40,16 @@
 
 #include "mozDocAccessible.h"
 
 #include "nsCOMPtr.h"
 #include "nsObjCExceptions.h"
 #include "nsIWidget.h"
 #include "nsIViewManager.h"
 
-#import "mozAccessibleWrapper.h"
-
-
 nsRootAccessibleWrap::
   nsRootAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
                        nsIWeakReference *aShell) :
   nsRootAccessible(aDocument, aRootContent, aShell)
 {
 }
 
 nsRootAccessibleWrap::~nsRootAccessibleWrap()
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -1247,18 +1247,22 @@ nsXULTreeGridCellAccessible::RelationByT
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeGridCellAccessible: public implementation
 
 PRInt32
 nsXULTreeGridCellAccessible::GetColumnIndex() const
 {
   PRInt32 index = 0;
   nsCOMPtr<nsITreeColumn> column = mColumn;
-  while (column = nsCoreUtils::GetPreviousSensibleColumn(column))
+  while (true) {
+    column = nsCoreUtils::GetPreviousSensibleColumn(column);
+    if (!column)
+      break;
     index++;
+  }
 
   return index;
 }
 
 void
 nsXULTreeGridCellAccessible::CellInvalidated()
 {
   nsAutoString textEquiv;
--- a/b2g/Makefile.in
+++ b/b2g/Makefile.in
@@ -37,12 +37,12 @@
 
 DEPTH      = ..
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS = chrome locales app
+DIRS = chrome components locales app
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/testing/testsuite-targets.mk
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -47,34 +47,34 @@ pref("browser.homescreenURL", "file:///d
 #endif
 
 // Device pixel to CSS px ratio, in percent. Set to -1 to calculate based on display density.
 pref("browser.viewport.scaleRatio", -1);
 
 /* allow scrollbars to float above chrome ui */
 pref("ui.scrollbarsCanOverlapContent", 1);
 
+/* disable text selection */
+pref("browser.ignoreNativeFrameTextSelection", true);
+
 /* cache prefs */
 pref("browser.cache.disk.enable", false);
 pref("browser.cache.disk.capacity", 0); // kilobytes
 pref("browser.cache.disk.smart_size.enabled", false);
 pref("browser.cache.disk.smart_size.first_run", false);
 
 pref("browser.cache.memory.enable", true);
 pref("browser.cache.memory.capacity", 1024); // kilobytes
 
 /* image cache prefs */
 pref("image.cache.size", 1048576); // bytes
 
 /* offline cache prefs */
-pref("browser.offline-apps.notify", true);
-pref("browser.cache.offline.enable", true);
-pref("browser.cache.offline.capacity", 5120); // kilobytes
-pref("offline-apps.quota.max", 2048); // kilobytes
-pref("offline-apps.quota.warn", 1024); // kilobytes
+pref("browser.offline-apps.notify", false);
+pref("browser.cache.offline.enable", false);
 
 /* protocol warning prefs */
 pref("network.protocol-handler.warn-external.tel", false);
 pref("network.protocol-handler.warn-external.mailto", false);
 pref("network.protocol-handler.warn-external.vnd.youtube", false);
 
 /* http prefs */
 pref("network.http.pipelining", true);
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -63,24 +63,33 @@ XPCOMUtils.defineLazyGetter(Services, 'f
 // a local http server listening on http://127.0.0.1:8888 and
 // http://localhost:8888.
 function startupHttpd(baseDir, port) {
   const httpdURL = 'chrome://browser/content/httpd.js';
   let httpd = {};
   Services.scriptloader.loadSubScript(httpdURL, httpd);
   let server = new httpd.nsHttpServer();
   server.registerDirectory('/', new LocalFile(baseDir));
+  server.registerContentType('appcache', 'text/cache-manifest');
   server.start(port);
 }
 
-// XXX until we have a security model, just let the pre-installed
-// app used indexedDB.
-function allowIndexedDB(url) {
-  let uri = Services.io.newURI(url, null, null);
-  Services.perms.add(uri, 'indexedDB', Ci.nsIPermissionManager.ALLOW_ACTION);
+// FIXME Bug 707625
+// until we have a proper security model, add some rights to
+// the pre-installed web applications 
+function addPermissions(urls) {
+  let permissions = ['indexedDB', 'webapps-manage', 'offline-app'];
+  urls.forEach(function(url) {
+    let uri = Services.io.newURI(url, null, null);
+    let allow = Ci.nsIPermissionManager.ALLOW_ACTION;
+    
+    permissions.forEach(function(permission) {
+      Services.perms.add(uri, permission, allow);
+    });
+  });
 }
 
 
 var shell = {
   get home() {
     delete this.home;
     return this.home = document.getElementById('homescreen');
   },
@@ -109,16 +118,17 @@ var shell = {
     let homeURL = this.homeURL;
     if (!homeURL) {
       let msg = 'Fatal error during startup: [No homescreen found]';
       return alert(msg);
     }
 
     window.controllers.appendController(this);
     window.addEventListener('keypress', this);
+    window.addEventListener('MozApplicationManifest', this);
     this.home.addEventListener('load', this, true);
 
     try {
       Services.io.offline = false;
 
       let fileScheme = 'file://';
       if (homeURL.substring(0, fileScheme.length) == fileScheme) {
         homeURL = homeURL.replace(fileScheme, '');
@@ -128,30 +138,31 @@ var shell = {
         baseDir = baseDir.join('/');
 
         const SERVER_PORT = 8888;
         startupHttpd(baseDir, SERVER_PORT);
 
         let baseHost = 'http://localhost';
         homeURL = homeURL.replace(baseDir, baseHost + ':' + SERVER_PORT);
       }
-      allowIndexedDB(homeURL);
+      addPermissions([homeURL]);
     } catch (e) {
       let msg = 'Fatal error during startup: [' + e + '[' + homeURL + ']';
       return alert(msg);
     }
 
     let browser = this.home;
     browser.homePage = homeURL;
     browser.goHome();
   },
 
   stop: function shell_stop() {
     window.controllers.removeController(this);
     window.removeEventListener('keypress', this);
+    window.removeEventListener('MozApplicationManifest', this);
   },
 
   supportsCommand: function shell_supportsCommand(cmd) {
     let isSupported = false;
     switch (cmd) {
       case 'cmd_close':
         isSupported = true;
         break;
@@ -164,17 +175,17 @@ var shell = {
 
   isCommandEnabled: function shell_isCommandEnabled(cmd) {
     return true;
   },
 
   doCommand: function shell_doCommand(cmd) {
     switch (cmd) {
       case 'cmd_close':
-        this.sendEvent(this.home.contentWindow, 'appclose');
+        this.home.contentWindow.postMessage('appclose', '*');
         break;
     }
   },
 
   handleEvent: function shell_handleEvent(evt) {
     switch (evt.type) {
       case 'keypress':
         switch (evt.keyCode) {
@@ -190,16 +201,50 @@ var shell = {
             this.doCommand('cmd_close');
             break;
         }
         break;
       case 'load':
         this.home.removeEventListener('load', this, true);
         this.sendEvent(window, 'ContentStart');
         break;
+      case 'MozApplicationManifest':
+        try {
+          if (!Services.prefs.getBoolPref('browser.cache.offline.enable'))
+            return;
+
+          let contentWindow = evt.originalTarget.defaultView;
+          let documentElement = contentWindow.document.documentElement;
+          if (!documentElement)
+            return;
+
+          let manifest = documentElement.getAttribute("manifest");
+          if (!manifest)
+            return;
+
+          let documentURI = contentWindow.document.documentURIObject;
+          if (!Services.perms.testPermission(documentURI, 'offline-app')) {
+            if (Services.prefs.getBoolPref('browser.offline-apps.notify')) {
+              // FIXME Bug 710729 - Add a UI for offline cache notifications
+              return;
+            }
+            return;
+          }
+
+          Services.perms.add(documentURI, 'offline-app',
+                             Ci.nsIPermissionManager.ALLOW_ACTION);
+
+          let manifestURI = Services.io.newURI(manifest, null, documentURI);
+          let updateService = Cc['@mozilla.org/offlinecacheupdate-service;1']
+                              .getService(Ci.nsIOfflineCacheUpdateService);
+          updateService.scheduleUpdate(manifestURI, documentURI, window);
+        } catch (e) {
+          dump('Error while creating offline cache: ' + e + '\n');
+        }
+        break;
     }
   },
   sendEvent: function shell_sendEvent(content, type, details) {
     let event = content.document.createEvent('CustomEvent');
     event.initCustomEvent(type, true, true, details ? details : {});
     content.dispatchEvent(event);
   }
 };
new file mode 100644
new file mode 100644
--- /dev/null
+++ b/b2g/components/Makefile.in
@@ -0,0 +1,51 @@
+# ***** 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
+# http://www.mozilla.org/MPL/
+#
+# 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.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation <http://www.mozilla.org/>.
+# Portions created by the Initial Developer are Copyright (C) 2011
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# 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 *****
+
+DEPTH      = ../..
+topsrcdir  = @top_srcdir@
+srcdir     = @srcdir@
+VPATH      = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = B2GComponents
+XPIDL_MODULE = B2GComponents
+
+EXTRA_PP_COMPONENTS = \
+        B2GComponents.manifest \
+        $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/b2g/makefiles.sh
+++ b/b2g/makefiles.sh
@@ -37,16 +37,17 @@
 add_makefiles "
 netwerk/locales/Makefile
 dom/locales/Makefile
 toolkit/locales/Makefile
 security/manager/locales/Makefile
 b2g/app/Makefile
 $MOZ_BRANDING_DIRECTORY/Makefile
 b2g/chrome/Makefile
+b2g/components/Makefile
 b2g/installer/Makefile
 b2g/locales/Makefile
 b2g/Makefile"
 
 if test -n "$MOZ_UPDATE_PACKAGING"; then
    add_makefiles "
      tools/update-packaging/Makefile
    "
--- a/browser/Makefile.in
+++ b/browser/Makefile.in
@@ -42,16 +42,17 @@ VPATH     = @srcdir@
 
 include $(topsrcdir)/config/config.mk
 
 PARALLEL_DIRS = \
   base \
   components \
   fuel \
   locales \
+  modules \
   themes \
   $(NULL)
 
 DIRS = \
   devtools \
   app \
   $(NULL)
 
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -175,69 +175,67 @@ endif
 libs:: $(srcdir)/profile/prefs.js
 	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile
 
 libs:: $(srcdir)/blocklist.xml
 	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 
-APP_NAME = $(MOZ_APP_DISPLAYNAME)
+MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
 
 ifdef MOZ_DEBUG
-APP_NAME := $(APP_NAME)Debug
+MAC_APP_NAME := $(MAC_APP_NAME)Debug
 endif
 
-LOWER_APP_NAME = $(shell echo $(APP_NAME) | tr '[A-Z]' '[a-z]')
+LOWER_MAC_APP_NAME = $(shell echo $(MAC_APP_NAME) | tr '[A-Z]' '[a-z]')
 
 AB_CD = $(MOZ_UI_LOCALE)
 
 AB := $(firstword $(subst -, ,$(AB_CD)))
 
 clean clobber repackage::
-	$(RM) -r $(DIST)/$(APP_NAME).app
+	$(RM) -r $(DIST)/$(MOZ_MACBUNDLE_NAME)
 
 ifdef LIBXUL_SDK
 APPFILES = Resources
 else
 APPFILES = MacOS
 endif
 
 libs repackage:: $(PROGRAM)
-	$(MKDIR) -p $(DIST)/$(APP_NAME).app/Contents/MacOS
-	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
-	$(MKDIR) -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
-	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
-	sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%LOWER_APP_NAME%/$(LOWER_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
-	sed -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
-	rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
-	$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
+	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
+	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(MOZ_MACBUNDLE_NAME) --exclude English.lproj
+	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
+	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
+	sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" -e "s/%LOWER_MAC_APP_NAME%/$(LOWER_MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Info.plist
+	sed -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj/InfoPlist.strings
+	rsync -a $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
+	$(RM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)/mangle $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)/shlibsign
 ifdef LIBXUL_SDK
-	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox
+	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/firefox
 else
-	$(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
-	rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
+	$(RM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
+	rsync -aL $(PROGRAM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
 endif
-	-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
-	cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(APP_NAME).app/Contents/Resources/firefox.icns
-	cp -RL $(DIST)/branding/document.icns $(DIST)/$(APP_NAME).app/Contents/Resources/document.icns
-	printf APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
-#       remove CVS dirs from packaged app
-	find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
+	-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
+	cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/firefox.icns
+	cp -RL $(DIST)/branding/document.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/document.icns
+	printf APPLMOZB > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/PkgInfo
 
 else
 ifdef LIBXUL_SDK
 libs::
 	cp $(LIBXUL_DIST)/bin/$(XULRUNNER_STUB_NAME)$(BIN_SUFFIX) $(DIST)/bin/firefox$(BIN_SUFFIX)
 endif
 endif
 
 ifdef LIBXUL_SDK
 ifndef SKIP_COPY_XULRUNNER
 libs::
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
+	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Frameworks
 else
 	$(NSINSTALL) -D $(DIST)/bin/xulrunner
 	(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
 endif # cocoa
 endif # SKIP_COPY_XULRUNNER
 endif # LIBXUL_SDK
--- a/browser/app/macbuild/Contents/Info.plist.in
+++ b/browser/app/macbuild/Contents/Info.plist.in
@@ -140,25 +140,25 @@
 			<string>HTML5 Video (WebM)</string>
 			<key>CFBundleTypeRole</key>
 			<string>Viewer</string>
 		</dict>
 	</array>
 	<key>CFBundleExecutable</key>
 	<string>firefox</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%APP_NAME% %APP_VERSION%</string>
+	<string>%MAC_APP_NAME% %APP_VERSION%</string>
 	<key>CFBundleIconFile</key>
 	<string>firefox</string>
 	<key>CFBundleIdentifier</key>
-	<string>org.mozilla.%LOWER_APP_NAME%</string>
+	<string>org.mozilla.%LOWER_MAC_APP_NAME%</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
-	<string>%APP_NAME%</string>
+	<string>%MAC_APP_NAME%</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<string>%APP_VERSION%</string>
 	<key>CFBundleSignature</key>
 	<string>MOZB</string>
 	<key>CFBundleURLTypes</key>
 	<array>
--- a/browser/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
+++ b/browser/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
@@ -1,1 +1,1 @@
-CFBundleName = "%APP_NAME%";
+CFBundleName = "%MAC_APP_NAME%";
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -76,16 +76,20 @@ pref("extensions.blocklist.interval", 86
 // blocking them.
 pref("extensions.blocklist.level", 2);
 pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/3/%APP_ID%/%APP_VERSION%/%PRODUCT%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/%PING_COUNT%/%TOTAL_PING_COUNT%/%DAYS_SINCE_LAST_PING%/");
 pref("extensions.blocklist.detailsURL", "https://www.mozilla.com/%LOCALE%/blocklist/");
 pref("extensions.blocklist.itemURL", "https://addons.mozilla.org/%LOCALE%/%APP%/blocked/%blockID%");
 
 pref("extensions.update.autoUpdateDefault", true);
 
+pref("extensions.hotfix.id", "firefox-hotfix@mozilla.org");
+pref("extensions.hotfix.cert.checkAttributes", true);
+pref("extensions.hotfix.certs.1.sha1Fingerprint", "foo");
+
 // Disable add-ons installed into the shared user and shared system areas by
 // default. This does not include the application directory. See the SCOPE
 // constants in AddonManager.jsm for values to use here
 pref("extensions.autoDisableScopes", 15);
 
 // Dictionary download preference
 pref("browser.dictionaries.download.url", "https://addons.mozilla.org/%LOCALE%/firefox/dictionaries/");
 
@@ -940,16 +944,17 @@ pref("services.sync.prefs.sync.browser.d
 pref("services.sync.prefs.sync.browser.download.manager.showWhenStarting", true);
 pref("services.sync.prefs.sync.browser.formfill.enable", true);
 pref("services.sync.prefs.sync.browser.link.open_newwindow", true);
 pref("services.sync.prefs.sync.browser.offline-apps.notify", true);
 pref("services.sync.prefs.sync.browser.safebrowsing.enabled", true);
 pref("services.sync.prefs.sync.browser.safebrowsing.malware.enabled", true);
 pref("services.sync.prefs.sync.browser.search.selectedEngine", true);
 pref("services.sync.prefs.sync.browser.search.update", true);
+pref("services.sync.prefs.sync.browser.sessionstore.restore_on_demand", true);
 pref("services.sync.prefs.sync.browser.startup.homepage", true);
 pref("services.sync.prefs.sync.browser.startup.page", true);
 pref("services.sync.prefs.sync.browser.tabs.autoHide", true);
 pref("services.sync.prefs.sync.browser.tabs.closeButtons", true);
 pref("services.sync.prefs.sync.browser.tabs.loadInBackground", true);
 pref("services.sync.prefs.sync.browser.tabs.warnOnClose", true);
 pref("services.sync.prefs.sync.browser.tabs.warnOnOpen", true);
 pref("services.sync.prefs.sync.browser.urlbar.autocomplete.enabled", true);
@@ -1007,16 +1012,22 @@ pref("devtools.errorconsole.enabled", fa
 
 // Enable the Inspector
 pref("devtools.inspector.enabled", true);
 pref("devtools.inspector.htmlHeight", 112);
 
 // Enable the style inspector
 pref("devtools.styleinspector.enabled", true);
 
+// Enable the Tilt inspector
+pref("devtools.tilt.enabled", true);
+
+// Enable the Tilt inspector even if WebGL capabilities are not detected
+pref("devtools.tilt.force-enabled", false);
+
 // Enable the rules view
 pref("devtools.ruleview.enabled", true);
 
 // Enable the Scratchpad tool.
 pref("devtools.scratchpad.enabled", true);
 
 // Enable the Style Editor.
 pref("devtools.styleeditor.enabled", true);
--- a/browser/base/Makefile.in
+++ b/browser/base/Makefile.in
@@ -48,21 +48,16 @@ include $(topsrcdir)/config/config.mk
 abs_srcdir = $(call core_abspath,$(srcdir))
 
 CHROME_DEPS += $(abs_srcdir)/content/overrides/app-license.html
 
 ifdef ENABLE_TESTS
 DIRS += content/test
 endif
 
-EXTRA_JS_MODULES = \
-	content/openLocationLastURL.jsm \
-	content/NetworkPrioritizer.jsm \
-	$(NULL)
-
 include $(topsrcdir)/config/rules.mk
 
 PRE_RELEASE_SUFFIX := ""
 
 DEFINES += \
 	-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
 	-DAPP_LICENSE_BLOCK=$(abs_srcdir)/content/overrides/app-license.html \
 	-DPRE_RELEASE_SUFFIX="$(PRE_RELEASE_SUFFIX)" \
--- a/browser/base/content/aboutDialog.js
+++ b/browser/base/content/aboutDialog.js
@@ -35,16 +35,18 @@
 # 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 ***** -->
 
 // Services = object with smart getters for common XPCOM services
 Components.utils.import("resource://gre/modules/Services.jsm");
 
+const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";
+
 function init(aEvent)
 {
   if (aEvent.target != document)
     return;
 
   try {
     var distroId = Services.prefs.getCharPref("distribution.id");
     if (distroId) {
@@ -373,16 +375,21 @@ appUpdater.prototype =
       return this;
     }
   },
 
   /**
    * Checks the compatibility of add-ons for the application update.
    */
   checkAddonCompatibility: function() {
+    try {
+      var hotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
+    }
+    catch (e) { }
+
     var self = this;
     AddonManager.getAllAddons(function(aAddons) {
       self.addons = [];
       self.addonsCheckedCount = 0;
       aAddons.forEach(function(aAddon) {
         // Protect against code that overrides the add-ons manager and doesn't
         // implement the isCompatibleWith or the findUpdates method.
         if (!("isCompatibleWith" in aAddon) || !("findUpdates" in aAddon)) {
@@ -397,19 +404,20 @@ appUpdater.prototype =
         // If an add-on isn't appDisabled and isn't userDisabled then it is
         // either active now or the user expects it to be active after the
         // restart. If that is the case and the add-on is not installed by the
         // application and is not compatible with the new application version
         // then the user should be warned that the add-on will become
         // incompatible. If an addon's type equals plugin it is skipped since
         // checking plugins compatibility information isn't supported and
         // getting the scope property of a plugin breaks in some environments
-        // (see bug 566787).
+        // (see bug 566787). The hotfix add-on is also ignored as it shouldn't
+        // block the user from upgrading.
         try {
-          if (aAddon.type != "plugin" &&
+          if (aAddon.type != "plugin" && aAddon.id != hotfixID &&
               !aAddon.appDisabled && !aAddon.userDisabled &&
               aAddon.scope != AddonManager.SCOPE_APPLICATION &&
               aAddon.isCompatible &&
               !aAddon.isCompatibleWith(self.update.appVersion,
                                        self.update.platformVersion))
             self.addons.push(aAddon);
         }
         catch (e) {
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -143,16 +143,18 @@
              oncommand="PlacesCommandHook.showPlacesOrganizer('History');"/>
   </commandset>
 
   <commandset id="inspectorCommands">
     <command id="Inspector:Inspect"
              oncommand="InspectorUI.toggleInspection();"/>
     <command id="Inspector:Sidebar"
              oncommand="InspectorUI.toggleSidebar();"/>
+    <command id="Inspector:Tilt"
+             oncommand="Tilt.initialize();"/>
   </commandset>
 
   <broadcasterset id="mainBroadcasterSet">
     <broadcaster id="viewBookmarksSidebar" autoCheck="false" label="&bookmarksButton.label;"
                  type="checkbox" group="sidebar" sidebarurl="chrome://browser/content/bookmarks/bookmarksPanel.xul"
                  oncommand="toggleSidebar('viewBookmarksSidebar');"/>
 
     <!-- for both places and non-places, the sidebar lives at
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -50,16 +50,17 @@
 #   Rob Arnold <robarnold@cmu.edu>
 #   Dietrich Ayala <dietrich@mozilla.com>
 #   Gavin Sharp <gavin@gavinsharp.com>
 #   Justin Dolske <dolske@mozilla.com>
 #   Rob Campbell <rcampbell@mozilla.com>
 #   David Dahl <ddahl@mozilla.com>
 #   Patrick Walton <pcwalton@mozilla.com>
 #   Mihai Sucan <mihai.sucan@gmail.com>
+#   Victor Porof <vporof@mozilla.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
@@ -174,16 +175,22 @@ XPCOMUtils.defineLazyGetter(this, "Popup
 });
 
 XPCOMUtils.defineLazyGetter(this, "InspectorUI", function() {
   let tmp = {};
   Cu.import("resource:///modules/inspector.jsm", tmp);
   return new tmp.InspectorUI(window);
 });
 
+XPCOMUtils.defineLazyGetter(this, "Tilt", function() {
+  let tmp = {};
+  Cu.import("resource:///modules/devtools/Tilt.jsm", tmp);
+  return new tmp.Tilt(window);
+});
+
 let gInitialPages = [
   "about:blank",
   "about:privatebrowsing",
   "about:sessionrestore"
 ];
 
 #include browser-fullZoom.js
 #include browser-places.js
@@ -195,17 +202,17 @@ let gInitialPages = [
 #endif
 
 XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
 #ifdef XP_WIN
   const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
   if (WINTASKBAR_CONTRACTID in Cc &&
       Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
     let temp = {};
-    Cu.import("resource://gre/modules/WindowsPreviewPerTab.jsm", temp);
+    Cu.import("resource:///modules/WindowsPreviewPerTab.jsm", temp);
     let AeroPeek = temp.AeroPeek;
     return {
       onOpenWindow: function () {
         AeroPeek.onOpenWindow(window);
       },
       onCloseWindow: function () {
         AeroPeek.onCloseWindow(window);
       }
@@ -2999,19 +3006,20 @@ function getMarkupDocumentViewer()
  *       which performs the same function, but for embedded clients that
  *       don't use a XUL/JS layer. It is important that the logic of
  *       these two routines be kept more or less in sync.
  *       (pinkerton)
  **/
 function FillInHTMLTooltip(tipElement)
 {
   var retVal = false;
-  // Don't show the tooltip if the tooltip node is a XUL element or a document.
+  // Don't show the tooltip if the tooltip node is a XUL element, a document or is disconnected.
   if (tipElement.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" ||
-      !tipElement.ownerDocument)
+      !tipElement.ownerDocument ||
+      tipElement.ownerDocument.compareDocumentPosition(tipElement) == document.DOCUMENT_POSITION_DISCONNECTED)
     return retVal;
 
   const XLinkNS = "http://www.w3.org/1999/xlink";
 
 
   var titleText = null;
   var XLinkTitleText = null;
   var SVGTitleText = null;
@@ -3029,20 +3037,20 @@ function FillInHTMLTooltip(tipElement)
     // If the element is barred from constraint validation or valid,
     // the validation message will be the empty string.
     titleText = tipElement.validationMessage;
   }
 
   while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
     if (tipElement.nodeType == Node.ELEMENT_NODE) {
       titleText = tipElement.getAttribute("title");
-      if ((tipElement instanceof HTMLAnchorElement && tipElement.href) ||
-          (tipElement instanceof HTMLAreaElement && tipElement.href) ||
-          (tipElement instanceof HTMLLinkElement && tipElement.href) ||
-          (tipElement instanceof SVGAElement && tipElement.hasAttributeNS(XLinkNS, "href"))) {
+      if ((tipElement instanceof HTMLAnchorElement ||
+           tipElement instanceof HTMLAreaElement ||
+           tipElement instanceof HTMLLinkElement ||
+           tipElement instanceof SVGAElement) && tipElement.href) {
         XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
       }
       if (lookingForSVGTitle &&
           (!(tipElement instanceof SVGElement) ||
            tipElement.parentNode.nodeType == Node.DOCUMENT_NODE)) {
         lookingForSVGTitle = false;
       }
       if (lookingForSVGTitle) {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -32,16 +32,17 @@
 #   Johnathan Nightingale <johnath@mozilla.com>
 #   Dão Gottwald <dao@mozilla.com>
 #   Ehsan Akhgari <ehsan.akhgari@gmail.com>
 #   Robert Strong <robert.bugzilla@gmail.com>
 #   Rob Campbell <rcampbell@mozilla.com>
 #   Patrick Walton <pcwalton@mozilla.com>
 #   David Dahl <ddahl@mozilla.com>
 #   Frank Yan <fyan@mozilla.com>
+#   Victor Porof <vporof@mozilla.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
@@ -1002,16 +1003,21 @@
           <toolbarbutton id="inspector-inspect-toolbutton"
                          label="&inspectButton.label;"
                          accesskey="&inspectButton.accesskey;"
                          command="Inspector:Inspect"/>
           <arrowscrollbox id="inspector-breadcrumbs"
                           flex="1" orient="horizontal"
                           clicktoscroll="true"/>
           <hbox id="inspector-tools">
+            <toolbarbutton id="inspector-3D-button"
+                           hidden="true"
+                           label="&inspect3DButton.label;"
+                           accesskey="&inspect3DButton.accesskey;"
+                           command="Inspector:Tilt"/>
             <toolbarbutton id="inspector-style-button"
                            label="&inspectStyleButton.label;"
                            accesskey="&inspectStyleButton.accesskey;"
                            command="Inspector:Sidebar"/>
             <!-- registered tools go here -->
           </hbox>
 #ifndef XP_MACOSX
           <toolbarbutton id="highlighter-closebutton"
--- a/browser/base/content/pageinfo/permissions.js
+++ b/browser/base/content/pageinfo/permissions.js
@@ -221,17 +221,17 @@ function onIndexedDBClear()
 
   var permissionManager = Components.classes[PERMISSION_CONTRACTID]
                                     .getService(nsIPermissionManager);
   permissionManager.remove(gPermURI.host, "indexedDB");
   permissionManager.remove(gPermURI.host, "indexedDB-unlimited");
   initIndexedDBRow();
 }
 
-function onIndexedDBUsageCallback(uri, usage)
+function onIndexedDBUsageCallback(uri, usage, fileUsage)
 {
   if (!uri.equals(gPermURI)) {
     throw new Error("Callback received for bad URI: " + uri);
   }
 
   if (usage) {
     if (!("DownloadUtils" in window)) {
       Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -199,34 +199,23 @@ Sanitizer.prototype = {
       {
         return true;
       }
     },
 
     offlineApps: {
       clear: function ()
       {
-        const Cc = Components.classes;
-        const Ci = Components.interfaces;
-        var cacheService = Cc["@mozilla.org/network/cache-service;1"].
-                           getService(Ci.nsICacheService);
-        try {
-          // Offline app data is "timeless", and doesn't respect
-          // the setting of timespan, it always clears everything
-          cacheService.evictEntries(Ci.nsICache.STORE_OFFLINE);
-        } catch(er) {}
-
-        var storageManagerService = Cc["@mozilla.org/dom/storagemanager;1"].
-                                    getService(Ci.nsIDOMStorageManager);
-        storageManagerService.clearOfflineApps();
+        Components.utils.import("resource:///modules/offlineAppCache.jsm");
+        OfflineAppCacheHelper.clear();
       },
 
       get canClear()
       {
-          return true;
+        return true;
       }
     },
 
     history: {
       clear: function ()
       {
         var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
                                       .getService(Components.interfaces.nsIBrowserHistory);
--- a/browser/base/content/sanitize.xul
+++ b/browser/base/content/sanitize.xul
@@ -88,16 +88,17 @@
 
     <preferences id="sanitizePreferences">
       <preference id="privacy.cpd.history"               name="privacy.cpd.history"               type="bool"/>
       <preference id="privacy.cpd.formdata"              name="privacy.cpd.formdata"              type="bool"/>
       <preference id="privacy.cpd.downloads"             name="privacy.cpd.downloads"             type="bool" disabled="true"/>
       <preference id="privacy.cpd.cookies"               name="privacy.cpd.cookies"               type="bool"/>
       <preference id="privacy.cpd.cache"                 name="privacy.cpd.cache"                 type="bool"/>
       <preference id="privacy.cpd.sessions"              name="privacy.cpd.sessions"              type="bool"/>
+      <preference id="privacy.cpd.offlineApps"           name="privacy.cpd.offlineApps"           type="bool"/>
       <preference id="privacy.cpd.siteSettings"          name="privacy.cpd.siteSettings"          type="bool"/>
     </preferences>
     
     <preferences id="nonItemPreferences">
       <preference id="privacy.sanitize.timeSpan"
                   name="privacy.sanitize.timeSpan"
                   type="int"/>
     </preferences>
@@ -170,17 +171,17 @@
               class="expander-down"
               persist="class"
               oncommand="gSanitizePromptDialog.toggleItemList();"/>
       <label id="detailsExpanderLabel"
              value="&detailsProgressiveDisclosure.label;"
              accesskey="&detailsProgressiveDisclosure.accesskey;"
              control="detailsExpander"/>
     </hbox>
-    <listbox id="itemList" rows="6" collapsed="true" persist="collapsed">
+    <listbox id="itemList" rows="7" collapsed="true" persist="collapsed">
       <listitem label="&itemHistoryAndDownloads.label;"
                 type="checkbox"
                 accesskey="&itemHistoryAndDownloads.accesskey;"
                 preference="privacy.cpd.history"
                 onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
       <listitem label="&itemFormSearchHistory.label;"
                 type="checkbox"
                 accesskey="&itemFormSearchHistory.accesskey;"
@@ -196,16 +197,21 @@
                 accesskey="&itemCache.accesskey;"
                 preference="privacy.cpd.cache"
                 onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
       <listitem label="&itemActiveLogins.label;"
                 type="checkbox"
                 accesskey="&itemActiveLogins.accesskey;"
                 preference="privacy.cpd.sessions"
                 onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
+      <listitem label="&itemOfflineApps.label;"
+                type="checkbox"
+                accesskey="&itemOfflineApps.accesskey;"
+                preference="privacy.cpd.offlineApps"
+                onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
       <listitem label="&itemSitePreferences.label;"
                 type="checkbox"
                 accesskey="&itemSitePreferences.accesskey;"
                 preference="privacy.cpd.siteSettings"
                 noduration="true"
                 onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>
     </listbox>
 
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -611,17 +611,18 @@
             onLocationChange: function (aWebProgress, aRequest, aLocation,
                                         aFlags) {
               // OnLocationChange is called for both the top-level content
               // and the subframes.
               let topLevel = aWebProgress.DOMWindow == this.mBrowser.contentWindow;
 
               if (topLevel) {
                 // The document loaded correctly, clear the value if we should
-                if (this.mBrowser.userTypedClear > 0)
+                if (this.mBrowser.userTypedClear > 0 ||
+                    (aRequest && !Components.isSuccessCode(aRequest.status)))
                   this.mBrowser.userTypedValue = null;
 
                 // Clear out the missing plugins list since it's related to the
                 // previous location.
                 this.mBrowser.missingPlugins = null;
 
                 // Don't clear the favicon if this onLocationChange was
                 // triggered by a pushState or a replaceState.  See bug 550565.
@@ -1259,18 +1260,20 @@
               t.setAttribute("fadein", "true");
               setTimeout(function (tabContainer) {
                 tabContainer._handleNewTab(t);
               }, 0, this.tabContainer);
             } else {
               setTimeout(function (tabContainer) {
                 if (t.pinned)
                   tabContainer._handleNewTab(t);
-                else
+                else {
+                  t._animStartTime = Date.now();
                   t.setAttribute("fadein", "true");
+                }
               }, 0, this.tabContainer);
             }
 
             this.tabContainer.appendChild(t);
 
             // invalidate cache, because tabContainer is about to change
             this._browsers = null;
 
@@ -1521,16 +1524,18 @@
                 this._removingTabs.length > 3 /* don't want lots of concurrent animations */ ||
                 aTab.getAttribute("fadein") != "true" /* fade-in transition hasn't been triggered yet */ ||
                 window.getComputedStyle(aTab).maxWidth == "0.1px" /* fade-in transition hasn't moved yet */ ||
                 !Services.prefs.getBoolPref("browser.tabs.animate")) {
               this._endRemoveTab(aTab);
               return;
             }
 
+            aTab._animStartTime = Date.now();
+
             this._blurTab(aTab);
             aTab.style.maxWidth = ""; // ensure that fade-out transition happens
             aTab.removeAttribute("fadein");
 
             setTimeout(function (tab, tabbrowser) {
               if (tab.parentNode &&
                   window.getComputedStyle(tab).maxWidth == "0.1px") {
                 NS_ASSERT(false, "Giving up waiting for the tab closing animation to finish (bug 608589)");
@@ -3252,16 +3257,24 @@
       <handler event="TabSelect" action="this._handleTabSelect();"/>
 
       <handler event="transitionend"><![CDATA[
         if (event.propertyName != "max-width")
           return;
 
         var tab = event.target;
 
+        if (tab._animStartTime) {
+          Services.telemetry.getHistogramById(tab.closing ?
+                                              "FX_TAB_ANIM_CLOSE_MS" :
+                                              "FX_TAB_ANIM_OPEN_MS")
+                            .add(Date.now() - tab._animStartTime);
+          tab._animStartTime = 0;
+        }
+
         if (tab.getAttribute("fadein") == "true") {
           if (tab._fullyOpen)
             this.adjustTabstrip();
           else
             this._handleNewTab(tab);
         } else if (tab.closing) {
           this.tabbrowser._endRemoveTab(tab);
         }
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -86,17 +86,16 @@ endif
 # back to the clear recent history dialog (santize.xul), if it ever is (bug
 # 480169)
 
 # browser_drag.js is disabled, as it needs to be updated for the new behavior from bug 320638.
 
 _BROWSER_FILES = \
                  browser_typeAheadFind.js \
                  browser_keywordSearch.js \
-                 browser_NetworkPrioritizer.js \
                  browser_allTabsPanel.js \
                  browser_alltabslistener.js \
                  browser_bug304198.js \
                  browser_bug321000.js \
                  title_test.svg \
                  browser_bug329212.js \
                  browser_bug356571.js \
                  browser_bug380960.js \
@@ -160,21 +159,23 @@ endif
                  browser_bug594131.js \
                  browser_bug595507.js \
                  browser_bug596687.js \
                  browser_bug597218.js \
                  browser_bug598923.js \
                  browser_bug599325.js \
                  browser_bug609700.js \
                  browser_bug616836.js \
+                 browser_bug623155.js \
                  browser_bug623893.js \
                  browser_bug624734.js \
                  browser_bug647886.js \
                  browser_bug655584.js \
                  browser_bug664672.js \
+                 browser_bug710878.js \
                  browser_canonizeURL.js \
                  browser_findbarClose.js \
                  browser_keywordBookmarklets.js \
                  browser_contextSearchTabPosition.js \
                  browser_ctrlTab.js \
                  browser_customize_popupNotification.js \
                  browser_disablechrome.js \
                  browser_discovery.js \
@@ -249,16 +250,17 @@ endif
                  browser_addon_bar_aomlistener.js \
                  test_bug628179.html \
                  browser_wyciwyg_urlbarCopying.js \
                  test_wyciwyg_copying.html \
                  authenticate.sjs \
                  browser_minimize.js \
 								 browser_aboutSyncProgress.js \
                  browser_middleMouse_inherit.js \
+                 redirect_bug623155.sjs \
                  $(NULL)
 
 ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 _BROWSER_FILES += \
 		browser_bug462289.js \
 		$(NULL)
 else
 _BROWSER_FILES += \
--- a/browser/base/content/test/browser_bug462289.js
+++ b/browser/base/content/test/browser_bug462289.js
@@ -1,75 +1,85 @@
 var tab1, tab2;
 
-function focus_in_navbar() {
+function focus_in_navbar()
+{
   var parent = document.activeElement.parentNode;
   while (parent && parent.id != "nav-bar")
     parent = parent.parentNode;
 
-  return (parent != null);
+  return parent != null;
 }
 
-function test() {
+function test()
+{
   waitForExplicitFinish();
 
   tab1 = gBrowser.addTab("about:blank", {skipAnimation: true});
   tab2 = gBrowser.addTab("about:blank", {skipAnimation: true});
 
   EventUtils.synthesizeMouseAtCenter(tab1, {});
   setTimeout(step2, 0);
 }
 
 function step2()
 {
-  isnot(document.activeElement, tab1, "mouse on tab not activeElement");
+  is(gBrowser.selectedTab, tab1, "1st click on tab1 selects tab");
+  isnot(document.activeElement, tab1, "1st click on tab1 does not activate tab");
 
   EventUtils.synthesizeMouseAtCenter(tab1, {});
   setTimeout(step3, 0);
 }
 
 function step3()
 {
-  isnot(document.activeElement, tab1, "mouse on tab again activeElement");
+  is(gBrowser.selectedTab, tab1, "2nd click on selected tab1 keeps tab selected");
+  isnot(document.activeElement, tab1, "2nd click on selected tab1 does not activate tab");
 
   if (gNavToolbox.getAttribute("tabsontop") == "true") {
+    ok(true, "[tabsontop=true] focusing URLBar then sending 1 Shift+Tab.");
     gURLBar.focus();
     EventUtils.synthesizeKey("VK_TAB", {shiftKey: true});
   } else {
+    ok(true, "[tabsontop=false] focusing SearchBar then sending Tab(s) until out of nav-bar.");
     document.getElementById("searchbar").focus();
-
     while (focus_in_navbar())
       EventUtils.synthesizeKey("VK_TAB", { });
   }
-  is(document.activeElement, tab1, "tab key to tab activeElement");
+  is(gBrowser.selectedTab, tab1, "tab key to selected tab1 keeps tab selected");
+  is(document.activeElement, tab1, "tab key to selected tab1 activates tab");
 
   EventUtils.synthesizeMouseAtCenter(tab1, {});
   setTimeout(step4, 0);
 }
 
 function step4()
 {
-  is(document.activeElement, tab1, "mouse on tab while focused still activeElement");
+  is(gBrowser.selectedTab, tab1, "3rd click on activated tab1 keeps tab selected");
+  is(document.activeElement, tab1, "3rd click on activated tab1 keeps tab activated");
 
   EventUtils.synthesizeMouseAtCenter(tab2, {});
   setTimeout(step5, 0);
 }
 
 function step5()
 {
   // The tabbox selects a tab within a setTimeout in a bubbling mousedown event
-  // listener, and focuses the current tab if another tab previously had focus
-  is(document.activeElement, tab2, "mouse on another tab while focused still activeElement");
+  // listener, and focuses the current tab if another tab previously had focus.
+  is(gBrowser.selectedTab, tab2, "click on tab2 while tab1 is activated selects tab");
+  is(document.activeElement, tab2, "click on tab2 while tab1 is activated activates tab");
 
+  ok(true, "focusing content then sending middle-button mousedown to tab2.");
   content.focus();
   EventUtils.synthesizeMouseAtCenter(tab2, {button: 1, type: "mousedown"});
   setTimeout(step6, 0);
 }
 
 function step6()
 {
-  isnot(document.activeElement, tab2, "tab not focused via middle click");
+  is(gBrowser.selectedTab, tab2, "middle-button mousedown on selected tab2 keeps tab selected");
+  isnot(document.activeElement, tab2, "middle-button mousedown on selected tab2 does not activate tab");
 
+  gBrowser.removeTab(tab2);
   gBrowser.removeTab(tab1);
-  gBrowser.removeTab(tab2);
 
   finish();
 }
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug623155.js
@@ -0,0 +1,134 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const REDIRECT_FROM = "https://example.com/browser/browser/base/content/test/" +
+                      "redirect_bug623155.sjs";
+
+const REDIRECT_TO = "https://www.bank1.com/"; // Bad-cert host.
+
+function isRedirectedURISpec(aURISpec) {
+  return isRedirectedURI(Services.io.newURI(aURISpec, null, null));
+}
+
+function isRedirectedURI(aURI) {
+  // Compare only their before-hash portion.
+  return Services.io.newURI(REDIRECT_TO, null, null)
+                 .equalsExceptRef(aURI);
+}
+
+/*
+   Test.
+
+1. Load
+https://example.com/browser/browser/base/content/test/redirect_bug623155.sjs#BG
+   in a background tab.
+
+2. The redirected URI is <https://www.bank1.com/#BG>, which displayes a cert
+   error page.
+
+3. Switch the tab to foreground.
+
+4. Check the URLbar's value, expecting <https://www.bank1.com/#BG>
+
+5. Load
+https://example.com/browser/browser/base/content/test/redirect_bug623155.sjs#FG
+   in the foreground tab.
+
+6. The redirected URI is <https://www.bank1.com/#FG>. And this is also
+   a cert-error page.
+
+7. Check the URLbar's value, expecting <https://www.bank1.com/#FG>
+
+8. End.
+
+ */
+
+function test() {
+  waitForExplicitFinish();
+
+  // Load a URI in the background.
+  gNewTab = gBrowser.addTab(REDIRECT_FROM + "#BG");
+  gBrowser.getBrowserForTab(gNewTab)
+          .webProgress
+          .addProgressListener(gWebProgressListener,
+                               Components.interfaces.nsIWebProgress
+                                                    .NOTIFY_LOCATION);
+}
+
+var gWebProgressListener = {
+  QueryInterface: function(aIID) {
+    if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
+        aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
+        aIID.equals(Components.interfaces.nsISupports))
+      return this;
+    throw Components.results.NS_NOINTERFACE;
+  },
+
+  // ---------------------------------------------------------------------------
+  // NOTIFY_LOCATION mode should work fine without these methods.
+  //
+  //onStateChange: function() {},
+  //onStatusChange: function() {},
+  //onProgressChange: function() {},
+  //onSecurityChange: function() {},
+  //----------------------------------------------------------------------------
+
+  onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
+    if (!aRequest) {
+      // This is bug 673752, or maybe initial "about:blank".
+      return;
+    }
+
+    ok(gNewTab, "There is a new tab.");
+    ok(isRedirectedURI(aLocation), 
+       "onLocationChange catches only redirected URI.");
+
+    if (aLocation.ref == "BG") {
+      // This is background tab's request.
+      isnot(gNewTab, gBrowser.selectedTab, "This is a background tab.");
+    } else if (aLocation.ref == "FG") {
+      // This is foreground tab's request.
+      is(gNewTab, gBrowser.selectedTab, "This is a foreground tab.");
+    }
+    else {
+      // We shonuld not reach here.
+      ok(false, "This URI hash is not expected:" + aLocation.ref);
+    }
+
+    let isSelectedTab = (gNewTab == gBrowser.selectedTab);
+    setTimeout(delayed, 0, isSelectedTab);
+  }
+};
+
+function delayed(aIsSelectedTab) {
+  // Switch tab and confirm URL bar.
+  if (!aIsSelectedTab) {
+    gBrowser.selectedTab = gNewTab;
+  }
+
+  ok(isRedirectedURISpec(content.location.href),
+     "The content area is redirected. aIsSelectedTab:" + aIsSelectedTab);
+  is(gURLBar.value, content.location.href,
+     "The URL bar shows the content URI. aIsSelectedTab:" + aIsSelectedTab);
+
+  if (!aIsSelectedTab) {
+    // If this was a background request, go on a foreground request.
+    content.location = REDIRECT_FROM + "#FG";
+  }
+  else {
+    // Othrewise, nothing to do remains.
+    finish();
+  }
+}
+
+/* Cleanup */
+registerCleanupFunction(function() {
+  if (gNewTab) {
+    gBrowser.getBrowserForTab(gNewTab)
+            .webProgress
+            .removeProgressListener(gWebProgressListener);
+
+    gBrowser.removeTab(gNewTab);
+  }
+  gNewTab = null;
+});
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug710878.js
@@ -0,0 +1,29 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test()
+{
+  waitForExplicitFinish();
+
+  let doc;
+
+  gBrowser.selectedTab = gBrowser.addTab();
+  gBrowser.selectedBrowser.addEventListener("load", function onload() {
+    gBrowser.selectedBrowser.removeEventListener("load", onload, true);
+    doc = content.document;
+    waitForFocus(performTest, content);
+  }, true);
+
+  content.location = "data:text/html,<a href='%23xxx'><span>word1 <span> word2 </span></span><span> word3</span></a>";
+
+  function performTest()
+  {
+    let link = doc.querySelector("a");;
+    let text = gatherTextUnder(link);
+    is(text, "word1 word2 word3", "Text under link is correctly computed.");
+    doc = null;
+    gBrowser.removeCurrentTab();
+    finish();
+  }
+}
+
--- a/browser/base/content/test/browser_sanitizeDialog.js
+++ b/browser/base/content/test/browser_sanitizeDialog.js
@@ -458,16 +458,118 @@ var gAllTests = [
       this.checkDetails(false);
 
       // Show details
       this.toggleDetails();
       this.checkDetails(true);
       this.cancelDialog();
     };
     wh.open();
+  },
+  function () {
+    // Test for offline apps data and cache deletion
+
+    // Prepare stuff, we will work with www.example.com
+    var URL = "http://www.example.com";
+
+    var ios = Cc["@mozilla.org/network/io-service;1"]
+              .getService(Ci.nsIIOService);
+    var URI = ios.newURI(URL, null, null);
+
+    var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
+             .getService(Ci.nsIScriptSecurityManager);
+    var principal = sm.getCodebasePrincipal(URI);
+
+    // Give www.example.com privileges to store offline data
+    var pm = Cc["@mozilla.org/permissionmanager;1"]
+             .getService(Ci.nsIPermissionManager);
+    pm.add(URI, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
+    pm.add(URI, "offline-app", Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
+
+    // Store some user data to localStorage
+    var dsm = Cc["@mozilla.org/dom/storagemanager;1"]
+             .getService(Ci.nsIDOMStorageManager);
+    var localStorage = dsm.getLocalStorageForPrincipal(principal, URL);
+    localStorage.setItem("test", "value");
+
+    // Store something to the offline cache
+    const nsICache = Components.interfaces.nsICache;
+    var cs = Components.classes["@mozilla.org/network/cache-service;1"]
+             .getService(Components.interfaces.nsICacheService);
+    var session = cs.createSession(URL + "/manifest", nsICache.STORE_OFFLINE, nsICache.STREAM_BASED);
+    var cacheEntry = session.openCacheEntry(URL, nsICache.ACCESS_READ_WRITE, false);
+    var stream = cacheEntry.openOutputStream(0);
+    var content = "content";
+    stream.write(content, content.length);
+    stream.close();
+    cacheEntry.close();
+
+    // Open the dialog
+    let wh = new WindowHelper();
+    wh.onload = function () {
+      this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
+      // Show details
+      this.toggleDetails();
+      // Clear only offlineApps
+      this.uncheckAllCheckboxes();
+      this.checkPrefCheckbox("offlineApps", true);
+      this.acceptDialog();
+
+      // Check all has been deleted (data, cache)
+      is(localStorage.length, 0, "DOM storage cleared");
+
+      var size = -1;
+      var visitor = {
+        visitDevice: function (deviceID, deviceInfo)
+        {
+          if (deviceID == "offline")
+            size = deviceInfo.totalSize;
+
+          // Do not enumerate entries
+          return false;
+        },
+
+        visitEntry: function (deviceID, entryInfo)
+        {
+          // Do not enumerate entries.
+          return false;
+        }
+      };
+      cs.visitEntries(visitor);
+      is(size, 0, "offline application cache entries evicted");
+    };
+    wh.open();
+  },
+  function () {
+    // Test for offline apps permission deletion
+
+    // Prepare stuff, we will work with www.example.com
+    var URL = "http://www.example.com";
+
+    var ios = Cc["@mozilla.org/network/io-service;1"]
+              .getService(Ci.nsIIOService);
+    var URI = ios.newURI(URL, null, null);
+
+    // Open the dialog
+    let wh = new WindowHelper();
+    wh.onload = function () {
+      this.selectDuration(Sanitizer.TIMESPAN_EVERYTHING);
+      // Show details
+      this.toggleDetails();
+      // Clear only offlineApps
+      this.uncheckAllCheckboxes();
+      this.checkPrefCheckbox("siteSettings", true);
+      this.acceptDialog();
+
+      // Check all has been deleted (privileges, data, cache)
+      var pm = Cc["@mozilla.org/permissionmanager;1"]
+               .getService(Ci.nsIPermissionManager);
+      is(pm.testPermission(URI, "offline-app"), 0, "offline-app permissions removed");
+    };
+    wh.open();
   }
 ];
 
 // Used as the download database ID for a new download.  Incremented for each
 // new download.  See addDownloadWithMinutesAgo().
 var gDownloadId = 5555551;
 
 // Index in gAllTests of the test currently being run.  Incremented for each
@@ -552,26 +654,34 @@ WindowHelper.prototype = {
     is(cb.length, 1, "found checkbox for " + pref + " preference");
     if (cb[0].checked != aCheckState)
       cb[0].click();
   },
 
   /**
    * Makes sure all the checkboxes are checked.
    */
-  checkAllCheckboxes: function () {
+  _checkAllCheckboxesCustom: function (check) {
     var cb = this.win.document.querySelectorAll("#itemList > [preference]");
     ok(cb.length > 1, "found checkboxes for preferences");
     for (var i = 0; i < cb.length; ++i) {
       var pref = this.win.document.getElementById(cb[i].getAttribute("preference"));
-      if (!pref.value)
+      if (!!pref.value ^ check)
         cb[i].click();
     }
   },
 
+  checkAllCheckboxes: function () {
+    this._checkAllCheckboxesCustom(true);
+  },
+
+  uncheckAllCheckboxes: function () {
+    this._checkAllCheckboxesCustom(false);
+  },
+
   /**
    * @return The details progressive disclosure button
    */
   getDetailsButton: function () {
     return this.win.document.getElementById("detailsExpander");
   },
 
   /**
--- a/browser/base/content/test/browser_sanitizeDialog_treeView.js
+++ b/browser/base/content/test/browser_sanitizeDialog_treeView.js
@@ -396,18 +396,19 @@ WindowHelper.prototype = {
    *        The amount and direction to move
    */
   moveGrippyBy: function (aDelta) {
     if (aDelta === 0)
       return;
     let key = aDelta < 0 ? "UP" : "DOWN";
     let abs = Math.abs(aDelta);
     let treechildren = this.getTree().treeBoxObject.treeBody;
+    treechildren.focus();
     for (let i = 0; i < abs; i++) {
-      EventUtils.sendKey(key, treechildren);
+      EventUtils.sendKey(key);
     }
   },
 
   /**
    * Selects a duration in the duration dropdown.
    *
    * @param aDurVal
    *        One of the Sanitizer.TIMESPAN_* values
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/redirect_bug623155.sjs
@@ -0,0 +1,16 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+const REDIRECT_TO = "https://www.bank1.com/"; // Bad-cert host.
+
+function handleRequest(aRequest, aResponse) {
+ // Set HTTP Status
+ aResponse.setStatusLine(aRequest.httpVersion, 301, "Moved Permanently");
+
+ // Set redirect URI, mirroring the hash value.
+ let hash = (/\#.+/.test(aRequest.path))? 
+              "#" + aRequest.path.split("#")[1]:
+              "";
+ aResponse.setHeader("Location", REDIRECT_TO + hash);
+}
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -939,17 +939,17 @@
       </method>
 
     </implementation>
   </binding>
 
   <binding id="geolocation-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
     <content align="start">
       <xul:image class="popup-notification-icon"
-                 xbl:inherits="popupid"/>
+                 xbl:inherits="popupid,src=icon"/>
       <xul:vbox flex="1">
         <xul:description class="popup-notification-description"
                          xbl:inherits="xbl:text=label"/>
         <xul:spacer flex="1"/>
         <xul:hbox class="popup-notification-button-container"
                   pack="end" align="center">
           <xul:label anonid="learnmore" class="text-link geolocation-text-link"/>
           <xul:spacer flex="1"/>
@@ -983,17 +983,17 @@
         link.href = formatter.formatURLPref("browser.geolocation.warning.infoURL");
       ]]></constructor>
     </implementation>
   </binding>
 
   <binding id="addon-progress-notification" extends="chrome://global/content/bindings/notification.xml#popup-notification">
     <content align="start">
       <xul:image class="popup-notification-icon"
-                 xbl:inherits="popupid"/>
+                 xbl:inherits="popupid,src=icon"/>
       <xul:vbox flex="1">
         <xul:description class="popup-notification-description addon-progress-description"
                          xbl:inherits="xbl:text=label"/>
         <xul:spacer flex="1"/>
         <xul:hbox align="center">
           <xul:progressmeter anonid="progressmeter" flex="1" mode="undetermined" class="popup-progress-meter"/>
           <xul:button anonid="cancel" class="popup-progress-cancel" oncommand="document.getBindingParent(this).cancel()"/>
         </xul:hbox>
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -363,23 +363,23 @@ function gatherTextUnder ( root )
     }
     // Find next node to test.
     // First, see if this node has children.
     if ( node.hasChildNodes() ) {
       // Go to first child.
       node = node.firstChild;
       depth++;
     } else {
-      // No children, try next sibling.
+      // No children, try next sibling (or parent next sibling).
+      while ( depth > 0 && !node.nextSibling ) {
+        node = node.parentNode;
+        depth--;
+      }
       if ( node.nextSibling ) {
         node = node.nextSibling;
-      } else {
-        // Last resort is our next oldest uncle/aunt.
-        node = node.parentNode.nextSibling;
-        depth--;
       }
     }
   }
   // Strip leading whitespace.
   text = text.replace( /^\s+/, "" );
   // Strip trailing whitespace.
   text = text.replace( /\s+$/, "" );
   // Compress remaining whitespace.
--- a/browser/components/Makefile.in
+++ b/browser/components/Makefile.in
@@ -64,32 +64,26 @@ PARALLEL_DIRS = \
   dirprovider \
   feeds \
   places \
   preferences \
   privatebrowsing \
   search \
   sessionstore \
   shell \
-  sidebar/src \
+  sidebar \
   tabview \
   migration \
   $(NULL)
 
-ifeq ($(MOZ_WIDGET_TOOLKIT),windows) 
-PARALLEL_DIRS += wintaskbar
-endif
-
 ifdef MOZ_SAFE_BROWSING
 PARALLEL_DIRS += safebrowsing
 endif
 
-ifdef ENABLE_TESTS
-DIRS += test/browser
-endif
+TEST_DIRS += test
 
 DIRS += build
 
 ifdef MOZILLA_OFFICIAL
 DEFINES += -DOFFICIAL_BUILD=1
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/components/build/nsBrowserCompsCID.h
+++ b/browser/components/build/nsBrowserCompsCID.h
@@ -43,19 +43,16 @@
 { 0xbc15c73d, 0xc05b, 0x497b, { 0xa3, 0x73, 0x4b, 0xae, 0x6c, 0x17, 0x86, 0x31 } }
 #endif
 
 #ifdef XP_MACOSX
 #define NS_SAFARIPROFILEMIGRATOR_CID \
 { 0x29e3b139, 0xad19, 0x44f3, { 0xb2, 0xc2, 0xe9, 0xf1, 0x3b, 0xa2, 0xbb, 0xc6 } }
 #endif
 
-#define NS_OPERAPROFILEMIGRATOR_CID \
-{ 0xf34ff792, 0x722e, 0x4490, { 0xb1, 0x95, 0x47, 0xd2, 0x42, 0xed, 0xca, 0x1c } }
-
 #define NS_SHELLSERVICE_CID \
 { 0x63c7b9f4, 0xcc8, 0x43f8, { 0xb6, 0x66, 0xa, 0x66, 0x16, 0x55, 0xcb, 0x73 } }
 
 #define NS_SHELLSERVICE_CONTRACTID \
   "@mozilla.org/browser/shell-service;1"
 
 #define NS_RDF_FORWARDPROXY_INFER_DATASOURCE_CID \
 { 0x7a024bcf, 0xedd5, 0x4d9a, { 0x86, 0x14, 0xd4, 0x4b, 0xe1, 0xda, 0xda, 0xd3 } }
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -45,19 +45,16 @@
 #include "nsWindowsShellService.h"
 #elif defined(XP_MACOSX)
 #include "nsMacShellService.h"
 #elif defined(MOZ_WIDGET_GTK2)
 #include "nsGNOMEShellService.h"
 #endif
 
 #include "nsProfileMigrator.h"
-#if !defined(XP_OS2)
-#include "nsOperaProfileMigrator.h"
-#endif
 #if defined(XP_WIN) && !defined(__MINGW32__)
 #include "nsIEProfileMigrator.h"
 #elif defined(XP_MACOSX)
 #include "nsSafariProfileMigrator.h"
 #endif
 
 #include "rdf.h"
 #include "nsFeedSniffer.h"
@@ -75,19 +72,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(Directory
 #if defined(XP_WIN)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
 #elif defined(XP_MACOSX)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
 #elif defined(MOZ_WIDGET_GTK2)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
 #endif
 
-#if !defined(XP_OS2)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsOperaProfileMigrator)
-#endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
 #if defined(XP_WIN) && !defined(__MINGW32__)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEProfileMigrator)
 #elif defined(XP_MACOSX)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafariProfileMigrator)
 #endif
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
@@ -104,19 +98,16 @@ NS_DEFINE_NAMED_CID(NS_FEEDSNIFFER_CID);
 NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID);
 NS_DEFINE_NAMED_CID(NS_FIREFOX_PROFILEMIGRATOR_CID);
 #if defined(XP_WIN) && !defined(__MINGW32__)
 NS_DEFINE_NAMED_CID(NS_WINIEPROFILEMIGRATOR_CID);
 #elif defined(XP_MACOSX)
 NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_SAFARIPROFILEMIGRATOR_CID);
 #endif
-#if !defined(XP_OS2)
-NS_DEFINE_NAMED_CID(NS_OPERAPROFILEMIGRATOR_CID);
-#endif
 NS_DEFINE_NAMED_CID(NS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID);
 
 static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
     { &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
 #if defined(XP_WIN)
     { &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor },
 #elif defined(MOZ_WIDGET_GTK2)
     { &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor },
@@ -125,19 +116,16 @@ static const mozilla::Module::CIDEntry k
     { &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
     { &kNS_FIREFOX_PROFILEMIGRATOR_CID, false, NULL, nsProfileMigratorConstructor },
 #if defined(XP_WIN) && !defined(__MINGW32__)
     { &kNS_WINIEPROFILEMIGRATOR_CID, false, NULL, nsIEProfileMigratorConstructor },
 #elif defined(XP_MACOSX)
     { &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
     { &kNS_SAFARIPROFILEMIGRATOR_CID, false, NULL, nsSafariProfileMigratorConstructor },
 #endif
-#if !defined(XP_OS2)
-    { &kNS_OPERAPROFILEMIGRATOR_CID, false, NULL, nsOperaProfileMigratorConstructor },
-#endif
     { &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID, false, NULL, nsPrivateBrowsingServiceWrapperConstructor },
     { NULL }
 };
 
 static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
     { NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID },
 #if defined(XP_WIN)
     { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
@@ -162,19 +150,16 @@ static const mozilla::Module::ContractID
     { NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
     { NS_PROFILEMIGRATOR_CONTRACTID, &kNS_FIREFOX_PROFILEMIGRATOR_CID },
 #if defined(XP_WIN) && !defined(__MINGW32__)
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "ie", &kNS_WINIEPROFILEMIGRATOR_CID },
 #elif defined(XP_MACOSX)
     { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
     { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "safari", &kNS_SAFARIPROFILEMIGRATOR_CID },
 #endif
-#if !defined(XP_OS2)
-    { NS_BROWSERPROFILEMIGRATOR_CONTRACTID_PREFIX "opera", &kNS_OPERAPROFILEMIGRATOR_CID },
-#endif
     { NS_PRIVATE_BROWSING_SERVICE_CONTRACTID, &kNS_PRIVATE_BROWSING_SERVICE_WRAPPER_CID },
     { NULL }
 };
 
 static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
     { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
     { NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
     { NULL }
--- a/browser/components/feeds/src/FeedWriter.js
+++ b/browser/components/feeds/src/FeedWriter.js
@@ -760,17 +760,17 @@ FeedWriter.prototype = {
         if (this._selectedApp) {
           // XXXben - we need to compare this with the running instance executable
           //          just don't know how to do that via script...
           // XXXmano TBD: can probably add this to nsIShellService
 #ifdef XP_WIN
 #expand           if (fp.file.leafName != "__MOZ_APP_NAME__.exe") {
 #else
 #ifdef XP_MACOSX
-#expand           if (fp.file.leafName != "__MOZ_APP_DISPLAYNAME__.app") {
+#expand           if (fp.file.leafName != "__MOZ_MACBUNDLE_NAME__") {
 #else
 #expand           if (fp.file.leafName != "__MOZ_APP_NAME__-bin") {
 #endif
 #endif
             this._initMenuItemWithFile(this._contentSandbox.selectedAppMenuItem,
                                        this._selectedApp);
 
             // Show and select the selected application menuitem
--- a/browser/components/feeds/src/Makefile.in
+++ b/browser/components/feeds/src/Makefile.in
@@ -45,17 +45,17 @@ MODULE = browser_feeds
 LIBRARY_NAME = browser_feeds_s
 FORCE_STATIC_LIB = 1
 ifndef MOZ_MEMORY
 USE_STATIC_LIBS = 1
 endif
 
 DEFINES += \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-	-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
+	-DMOZ_MACBUNDLE_NAME=$(MOZ_MACBUNDLE_NAME) \
 	$(NULL)
 
 EXTRA_COMPONENTS = \
   BrowserFeeds.manifest \
   $(NULL)
 
 EXTRA_PP_COMPONENTS = \
 	FeedConverter.js \
--- a/browser/components/migration/content/migration.js
+++ b/browser/components/migration/content/migration.js
@@ -328,19 +328,16 @@ var MigrationWizard = {
     singleStart.setAttribute("label", mainStr);
     singleStart.setAttribute("value", "DEFAULT");
 
     var source = null;
     switch (this._source) {
       case "ie":
         source = "sourceNameIE";
         break;
-      case "opera":
-        source = "sourceNameOpera";
-        break;
       case "safari":
         source = "sourceNameSafari";
         break;
       case "chrome":
         source = "sourceNameChrome";
         break;
     }
 
--- a/browser/components/migration/content/migration.xul
+++ b/browser/components/migration/content/migration.xul
@@ -65,24 +65,20 @@
     <description id="importBookmarks" control="importSourceGroup" hidden="true">&importFromBookmarks.label;</description>
 
     <radiogroup id="importSourceGroup" align="start">
       <!-- If you are adding a migrator, please add the appropriate
            hooks to GetDefaultBrowserMigratorKey in
            browser/components/migration/src/nsProfileMigrator.cpp -->
 #ifdef XP_MACOSX
       <radio id="safari"    label="&importFromSafari.label;"    accesskey="&importFromSafari.accesskey;"/>
-      <radio id="opera"     label="&importFromOpera.label;"     accesskey="&importFromOpera.accesskey;"/>
-#elifdef XP_UNIX
-      <radio id="opera"     label="&importFromOpera.label;"     accesskey="&importFromOpera.accesskey;"/>
 #elifdef XP_WIN
 #ifndef NO_IE_MIGRATOR
       <radio id="ie"        label="&importFromIE.label;"        accesskey="&importFromIE.accesskey;"/>
 #endif
-      <radio id="opera"     label="&importFromOpera.label;"     accesskey="&importFromOpera.accesskey;"/>
 #endif
       <radio id="chrome"    label="&importFromChrome.label;"    accesskey="&importFromChrome.accesskey;"/>
       <radio id="fromfile"  label="&importFromHTMLFile.label;"  accesskey="&importFromHTMLFile.accesskey;" hidden="true"/>
       <radio id="nothing"   label="&importFromNothing.label;"   accesskey="&importFromNothing.accesskey;" hidden="true"/>
     </radiogroup>
     <label id="noSources" hidden="true">&noMigrationSources.label;</label>
   </wizardpage>
 
--- a/browser/components/migration/src/Makefile.in
+++ b/browser/components/migration/src/Makefile.in
@@ -48,20 +48,16 @@ ifndef MOZ_MEMORY
 USE_STATIC_LIBS = 1
 endif
 
 
 CPPSRCS  = nsProfileMigrator.cpp \
            nsBrowserProfileMigratorUtils.cpp \
            $(NULL)
 
-ifneq ($(OS_ARCH),OS2)
-CPPSRCS += nsOperaProfileMigrator.cpp
-endif
-
 ifeq ($(OS_ARCH)_$(GNU_CXX),WINNT_)
 CPPSRCS += nsIEProfileMigrator.cpp \
            $(NULL)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += nsSafariProfileMigrator.cpp \
            $(NULL)
--- a/browser/components/migration/src/nsBrowserProfileMigratorUtils.cpp
+++ b/browser/components/migration/src/nsBrowserProfileMigratorUtils.cpp
@@ -37,18 +37,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsBrowserProfileMigratorUtils.h"
 #include "nsINavBookmarksService.h"
 #include "nsBrowserCompsCID.h"
 #include "nsToolkitCompsCID.h"
 #include "nsIPlacesImportExportService.h"
 #include "nsIFile.h"
-#include "nsIInputStream.h"
-#include "nsILineInputStream.h"
 #include "nsIProperties.h"
 #include "nsIProfileMigrator.h"
 
 #include "nsIURI.h"
 #include "nsNetUtil.h"
 #include "nsISupportsPrimitives.h"
 
 #include "nsAppDirectoryServiceDefs.h"
@@ -160,67 +158,16 @@ GetProfilePath(nsIProfileStartup* aStart
       (do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
     if (dirSvc) {
       dirSvc->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile),
                   (void**) getter_AddRefs(aProfileDir));
     }
   }
 }
 
-nsresult 
-AnnotatePersonalToolbarFolder(nsIFile* aSourceBookmarksFile,
-                              nsIFile* aTargetBookmarksFile,
-                              const char* aToolbarFolderName)
-{
-  nsCOMPtr<nsIInputStream> fileInputStream;
-  nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream),
-                                           aSourceBookmarksFile);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIOutputStream> outputStream;
-  rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream),
-                                   aTargetBookmarksFile);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsILineInputStream> lineInputStream =
-    do_QueryInterface(fileInputStream, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCAutoString sourceBuffer;
-  nsCAutoString targetBuffer;
-  bool moreData = false;
-  PRUint32 bytesWritten = 0;
-  do {
-    lineInputStream->ReadLine(sourceBuffer, &moreData);
-    if (!moreData)
-      break;
-
-    PRInt32 nameOffset = sourceBuffer.Find(aToolbarFolderName);
-    if (nameOffset >= 0) {
-      // Found the personal toolbar name on a line, check to make sure it's
-      // actually a folder. 
-      NS_NAMED_LITERAL_CSTRING(folderPrefix, "<DT><H3 ");
-      PRInt32 folderPrefixOffset = sourceBuffer.Find(folderPrefix);
-      if (folderPrefixOffset >= 0)
-        sourceBuffer.Insert(NS_LITERAL_CSTRING("PERSONAL_TOOLBAR_FOLDER=\"true\" "), 
-                            folderPrefixOffset + folderPrefix.Length());
-    }
-
-    targetBuffer.Assign(sourceBuffer);
-    targetBuffer.Append("\r\n");
-    outputStream->Write(targetBuffer.get(), targetBuffer.Length(),
-                        &bytesWritten);
-  }
-  while (1);
-  
-  outputStream->Close();
-  
-  return NS_OK;
-}
-
 nsresult
 ImportBookmarksHTML(nsIFile* aBookmarksFile, 
                     bool aImportIntoRoot,
                     bool aOverwriteDefaults,
                     const PRUnichar* aImportSourceNameKey)
 {
   nsresult rv;
 
--- a/browser/components/migration/src/nsBrowserProfileMigratorUtils.h
+++ b/browser/components/migration/src/nsBrowserProfileMigratorUtils.h
@@ -94,25 +94,16 @@ void GetMigrateDataFromArray(MigrationDa
                              nsIFile* aSourceProfile, 
                              PRUint16* aResult);
 
 
 // get the base directory of the *target* profile
 // this is already cloned, modify it to your heart's content
 void GetProfilePath(nsIProfileStartup* aStartup, nsCOMPtr<nsIFile>& aProfileDir);
 
-// The Netscape Bookmarks Format (bookmarks.html) is fairly standard but
-// each browser vendor seems to have their own way of identifying the 
-// Personal Toolbar Folder. This function scans for the vendor-specific
-// name in the source Bookmarks file and then writes out a normalized
-// variant into the target folder. 
-nsresult AnnotatePersonalToolbarFolder(nsIFile* aSourceBookmarksFile,
-                                       nsIFile* aTargetBookmarksFile,
-                                       const char* aToolbarFolderName);
-
 // In-place import from aBookmarksFile into a folder in the user's bookmarks.
 // If the importIntoRoot parameter has a value of true, the bookmarks will be
 // imported into the bookmarks root folder. Otherwise, they'll be imported into
 // a new folder with the name "From (STR:aImportSourceNameKey)".
 // aImportSourceNameKey is a key into migration.properties with the pretty name
 // of the application.
 nsresult ImportBookmarksHTML(nsIFile* aBookmarksFile, 
                              bool aImportIntoRoot,
deleted file mode 100644
--- a/browser/components/migration/src/nsOperaProfileMigrator.cpp
+++ /dev/null
@@ -1,1459 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; 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
- * http://www.mozilla.org/MPL/
- *
- * 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 The Browser Profile Migrator.
- *
- * The Initial Developer of the Original Code is Ben Goodger.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Ben Goodger <ben@bengoodger.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 ***** */
-
-#include "mozilla/Util.h"
-
-#include "nsAppDirectoryServiceDefs.h"
-#include "nsBrowserProfileMigratorUtils.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsDirectoryServiceUtils.h"
-#include "nsDocShellCID.h"
-#include "nsINavBookmarksService.h"
-#include "nsBrowserCompsCID.h"
-#include "nsIBrowserProfileMigrator.h"
-#include "nsIBrowserHistory.h"
-#include "nsICookieManager2.h"
-#include "nsIGlobalHistory.h"
-#include "nsIInputStream.h"
-#include "nsILineInputStream.h"
-#include "nsILocalFile.h"
-#include "nsINIParser.h"
-#include "nsIObserverService.h"
-#include "nsIPermissionManager.h"
-#include "nsIPrefLocalizedString.h"
-#include "nsIPrefService.h"
-#include "nsIProfileMigrator.h"
-#include "nsIProperties.h"
-#include "nsIRDFContainer.h"
-#include "nsIRDFService.h"
-#include "nsIServiceManager.h"
-#include "nsIStringBundle.h"
-#include "nsISupportsPrimitives.h"
-#include "nsNetUtil.h"
-#include "nsOperaProfileMigrator.h"
-#include "nsToolkitCompsCID.h"
-#ifdef XP_WIN
-#include <windows.h>
-#endif
-
-using namespace mozilla;
-
-#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"
-
-#ifdef XP_WIN
-#define OPERA_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Opera")
-#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera6.ini")
-#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
-#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera6.adr")
-#elif defined(XP_MACOSX)
-#define OPERA_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING("Opera 6 Preferences")
-#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("Opera 6 Preferences")
-#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("Opera Global History")
-#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("Bookmarks")
-#elif defined (XP_UNIX)
-#define OPERA_PREFERENCES_FOLDER_NAME NS_LITERAL_STRING(".opera")
-#define OPERA_PREFERENCES_FILE_NAME NS_LITERAL_STRING("opera6.ini")
-#define OPERA_HISTORY_FILE_NAME NS_LITERAL_STRING("global.dat")
-#define OPERA_BOOKMARKS_FILE_NAME NS_LITERAL_STRING("opera6.adr")
-#else
-#error Need to define location of Opera Profile data.
-#endif
-
-#define OPERA_COOKIES_FILE_NAME NS_LITERAL_STRING("cookies4.dat")
-
-///////////////////////////////////////////////////////////////////////////////
-// nsBrowserProfileMigrator
-
-NS_IMPL_ISUPPORTS1(nsOperaProfileMigrator, nsIBrowserProfileMigrator)
-
-nsOperaProfileMigrator::nsOperaProfileMigrator()
-{
-  mObserverService = do_GetService("@mozilla.org/observer-service;1");
-}
-
-nsOperaProfileMigrator::~nsOperaProfileMigrator()
-{
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::Migrate(PRUint16 aItems, nsIProfileStartup* aStartup, const PRUnichar* aProfile)
-{
-  nsresult rv = NS_OK;
-  bool aReplace = aStartup ? true : false;
-
-  if (aStartup) {
-    rv = aStartup->DoStartup();
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-  if (!mOperaProfile)
-    GetOperaProfile(aProfile, getter_AddRefs(mOperaProfile));
-
-  NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
-
-  COPY_DATA(CopyPreferences,  aReplace, nsIBrowserProfileMigrator::SETTINGS);
-  COPY_DATA(CopyCookies,      aReplace, nsIBrowserProfileMigrator::COOKIES);
-  COPY_DATA(CopyHistory,      aReplace, nsIBrowserProfileMigrator::HISTORY);
-  COPY_DATA(CopyBookmarks,    aReplace, nsIBrowserProfileMigrator::BOOKMARKS);
-
-  NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
-
-  return rv;
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::GetMigrateData(const PRUnichar* aProfile, 
-                                       bool aReplace,
-                                       PRUint16* aResult)
-{
-  *aResult = 0;
-  if (!mOperaProfile) {
-    GetOperaProfile(aProfile, getter_AddRefs(mOperaProfile));
-    if (!mOperaProfile)
-      return NS_ERROR_FILE_NOT_FOUND;
-  }
-
-  MigrationData data[] = { { ToNewUnicode(OPERA_PREFERENCES_FILE_NAME),
-                             nsIBrowserProfileMigrator::SETTINGS,
-                             false },
-                           { ToNewUnicode(OPERA_COOKIES_FILE_NAME),
-                             nsIBrowserProfileMigrator::COOKIES,
-                             false },
-                           { ToNewUnicode(OPERA_HISTORY_FILE_NAME),
-                             nsIBrowserProfileMigrator::HISTORY,
-                             false },
-                           { ToNewUnicode(OPERA_BOOKMARKS_FILE_NAME),
-                             nsIBrowserProfileMigrator::BOOKMARKS,
-                             false } };
-                                                                  
-  // Frees file name strings allocated above.
-  GetMigrateDataFromArray(data, sizeof(data)/sizeof(MigrationData), 
-                          aReplace, mOperaProfile, aResult);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::GetSourceExists(bool* aResult)
-{
-  nsCOMPtr<nsIArray> profiles;
-  GetSourceProfiles(getter_AddRefs(profiles));
-
-  if (profiles) { 
-    PRUint32 count;
-    profiles->GetLength(&count);
-    *aResult = count > 0;
-  }
-  else
-    *aResult = false;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::GetSourceHasMultipleProfiles(bool* aResult)
-{
-  nsCOMPtr<nsIArray> profiles;
-  GetSourceProfiles(getter_AddRefs(profiles));
-
-#ifdef XP_WIN
-  if (profiles) {
-    PRUint32 count;
-    profiles->GetLength(&count);
-    *aResult = count > 1;
-  }
-  else
-#endif
-    *aResult = false;
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::GetSourceProfiles(nsIArray** aResult)
-{
-  if (!mProfiles) {
-    nsresult rv;
-
-    mProfiles = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
-    if (NS_FAILED(rv)) return rv;
-
-    nsCOMPtr<nsIProperties> fileLocator(do_GetService("@mozilla.org/file/directory_service;1"));
-    nsCOMPtr<nsILocalFile> file;
-#ifdef XP_WIN
-    fileLocator->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
-
-    // Opera profile lives under %APP_DATA%\Opera\<operaver>\profile 
-    file->Append(OPERA_PREFERENCES_FOLDER_NAME);
-
-    nsCOMPtr<nsISimpleEnumerator> e;
-    rv = file->GetDirectoryEntries(getter_AddRefs(e));
-    if (NS_FAILED(rv))
-      return rv;
-
-    bool hasMore;
-    e->HasMoreElements(&hasMore);
-    while (hasMore) {
-      nsCOMPtr<nsILocalFile> curr;
-      e->GetNext(getter_AddRefs(curr));
-
-      bool isDirectory = false;
-      curr->IsDirectory(&isDirectory);
-      if (isDirectory) {
-        nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1"));
-        nsAutoString leafName;
-        curr->GetLeafName(leafName);
-        string->SetData(leafName);
-        mProfiles->AppendElement(string, false);
-      }
-
-      e->HasMoreElements(&hasMore);
-    }
-#elif defined (XP_MACOSX)
-    fileLocator->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
-    
-    file->Append(NS_LITERAL_STRING("Preferences"));
-    file->Append(OPERA_PREFERENCES_FOLDER_NAME);
-    
-    bool exists;
-    file->Exists(&exists);
-    
-    if (exists) {
-      nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1"));
-      string->SetData(OPERA_PREFERENCES_FOLDER_NAME);
-      mProfiles->AppendElement(string, false);
-    }
-#elif defined (XP_UNIX)
-    fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
-    
-    file->Append(OPERA_PREFERENCES_FOLDER_NAME);
-    
-    bool exists;
-    file->Exists(&exists);
-    
-    if (exists) {
-      nsCOMPtr<nsISupportsString> string(do_CreateInstance("@mozilla.org/supports-string;1"));
-      string->SetData(OPERA_PREFERENCES_FOLDER_NAME);
-      mProfiles->AppendElement(string, false);
-    }
-#endif
-  }
-
-  *aResult = mProfiles;
-  NS_IF_ADDREF(*aResult);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::GetSourceHomePageURL(nsACString& aResult)
-{
-  nsresult rv;
-  nsCAutoString val;
-
-  nsCOMPtr<nsIFile> operaPrefs;
-  mOperaProfile->Clone(getter_AddRefs(operaPrefs));
-  operaPrefs->Append(OPERA_PREFERENCES_FILE_NAME);
-
-  nsCOMPtr<nsILocalFile> lf(do_QueryInterface(operaPrefs));
-  NS_ENSURE_TRUE(lf, NS_ERROR_UNEXPECTED);
-
-  nsINIParser parser;
-  rv = parser.Init(lf);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = parser.GetString("User Prefs",
-                        "Home URL",
-                        val);
-
-  if (NS_SUCCEEDED(rv))
-    aResult.Assign(val);
-
-  return NS_OK;
-}
- 
-
-#define _OPM(type) nsOperaProfileMigrator::type
-
-static
-nsOperaProfileMigrator::PrefTransform gTransforms[] = {
-  { "User Prefs", "Download Directory", _OPM(STRING), "browser.download.dir", _OPM(SetFile), false, { -1 } },
-  { nsnull, "Enable Cookies", _OPM(INT), "network.cookie.cookieBehavior", _OPM(SetCookieBehavior), false, { -1 } },
-  { nsnull, "Accept Cookies Session Only", _OPM(BOOL), "network.cookie.lifetimePolicy", _OPM(SetCookieLifetime), false, { -1 } },
-  { nsnull, "Allow script to resize window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), false, { -1 } },
-  { nsnull, "Allow script to move window", _OPM(BOOL), "dom.disable_window_move_resize", _OPM(SetBool), false, { -1 } },
-  { nsnull, "Allow script to raise window", _OPM(BOOL), "dom.disable_window_flip", _OPM(SetBool), false, { -1 } },
-  { nsnull, "Allow script to change status", _OPM(BOOL), "dom.disable_window_status_change", _OPM(SetBool), false, { -1 } },
-  { nsnull, "Ignore Unrequested Popups", _OPM(BOOL), "dom.disable_open_during_load", _OPM(SetBool), false, { -1 } },
-  { nsnull, "Load Figures", _OPM(BOOL), "permissions.default.image", _OPM(SetImageBehavior), false, { -1 } },
-
-  { "Visited link", nsnull, _OPM(COLOR), "browser.visited_color", _OPM(SetString), false, { -1 } },
-  { "Link", nsnull, _OPM(COLOR), "browser.anchor_color", _OPM(SetString), false, { -1 } },
-  { nsnull, "Underline", _OPM(BOOL), "browser.underline_anchors", _OPM(SetBool), false, { -1 } },
-
-  { nsnull, "Enable SSL v3", _OPM(BOOL), "security.enable_ssl3", _OPM(SetBool), false, { -1 } },
-  { nsnull, "Enable TLS v1.0", _OPM(BOOL), "security.enable_tls", _OPM(SetBool), false, { -1 } },
-
-  { "Extensions", "Scripting", _OPM(BOOL), "javascript.enabled", _OPM(SetBool), false, { -1 } }
-};
-
-nsresult 
-nsOperaProfileMigrator::SetFile(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  nsCOMPtr<nsILocalFile> lf(do_CreateInstance("@mozilla.org/file/local;1"));
-  lf->InitWithPath(NS_ConvertUTF8toUTF16(xform->stringValue));
-  return aBranch->SetComplexValue(xform->targetPrefName, NS_GET_IID(nsILocalFile), lf);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetCookieBehavior(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  PRInt32 val = (xform->intValue == 3) ? 0 : (xform->intValue == 0) ? 2 : 1;
-  return aBranch->SetIntPref(xform->targetPrefName, val);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetCookieLifetime(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  return aBranch->SetIntPref(xform->targetPrefName, xform->boolValue ? 2 : 0);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetImageBehavior(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  return aBranch->SetIntPref(xform->targetPrefName, xform->boolValue ? 1 : 2);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetBool(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  return aBranch->SetBoolPref(xform->targetPrefName, xform->boolValue);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetWString(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  nsCOMPtr<nsIPrefLocalizedString> pls(do_CreateInstance("@mozilla.org/pref-localizedstring;1"));
-  NS_ConvertUTF8toUTF16 data(xform->stringValue); 
-  pls->SetData(data.get());
-  return aBranch->SetComplexValue(xform->targetPrefName, NS_GET_IID(nsIPrefLocalizedString), pls);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetInt(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  return aBranch->SetIntPref(xform->targetPrefName, xform->intValue);
-}
-
-nsresult 
-nsOperaProfileMigrator::SetString(void* aTransform, nsIPrefBranch* aBranch)
-{
-  PrefTransform* xform = (PrefTransform*)aTransform;
-  return aBranch->SetCharPref(xform->targetPrefName, xform->stringValue);
-}
-
-nsresult
-nsOperaProfileMigrator::CopyPreferences(bool aReplace)
-{
-  nsresult rv;
-
-  nsCOMPtr<nsIFile> operaPrefs;
-  mOperaProfile->Clone(getter_AddRefs(operaPrefs));
-  operaPrefs->Append(OPERA_PREFERENCES_FILE_NAME);
-
-  nsCOMPtr<nsILocalFile> lf(do_QueryInterface(operaPrefs));
-  NS_ENSURE_TRUE(lf, NS_ERROR_UNEXPECTED);
-
-  nsINIParser parser;
-  rv = parser.Init(lf);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsIPrefBranch> branch(do_GetService(NS_PREFSERVICE_CONTRACTID));
-
-  // Traverse the standard transforms
-  PrefTransform* transform;
-  PrefTransform* end = gTransforms + sizeof(gTransforms)/sizeof(PrefTransform);
-
-  const char* lastSectionName = nsnull;
-  for (transform = gTransforms; transform < end; ++transform) {
-    if (transform->sectionName)
-      lastSectionName = transform->sectionName;
-
-    if (transform->type == _OPM(COLOR)) {
-      char* colorString = nsnull;
-      nsresult rv = ParseColor(parser, lastSectionName, &colorString);
-      if (NS_SUCCEEDED(rv)) {
-        transform->stringValue = colorString;
-
-        transform->prefHasValue = true;
-        transform->prefSetterFunc(transform, branch);
-      }
-      if (colorString)
-        free(colorString);
-    }
-    else {
-      nsCAutoString val;
-      rv = parser.GetString(lastSectionName,
-                            transform->keyName,
-                            val);
-      if (NS_SUCCEEDED(rv)) {
-        nsresult strerr;
-        switch (transform->type) {
-        case _OPM(STRING):
-          transform->stringValue = ToNewCString(val);
-          break;
-        case _OPM(INT): {
-            transform->intValue = val.ToInteger(&strerr);
-          }
-          break;
-        case _OPM(BOOL): {
-            transform->boolValue = val.ToInteger(&strerr) != 0;
-          }
-          break;
-        default:
-          break;
-        }
-        transform->prefHasValue = true;
-        transform->prefSetterFunc(transform, branch);
-        if (transform->type == _OPM(STRING) && transform->stringValue) {
-          NS_Free(transform->stringValue);
-          transform->stringValue = nsnull;
-        }
-      }
-    }
-  }
-  
-  // Copy Proxy Settings
-  CopyProxySettings(parser, branch);
-
-  // Copy User Content Sheet
-  if (aReplace)
-    CopyUserContentSheet(parser);
-
-  return NS_OK;
-}
-
-nsresult
-nsOperaProfileMigrator::CopyProxySettings(nsINIParser &aParser, 
-                                          nsIPrefBranch* aBranch)
-{
-  nsresult rv;
-
-  PRInt32 networkProxyType = 0;
-
-  const char* protocols[] = { "HTTP", "HTTPS", "FTP"  };
-  const char* protocols_l[] = { "http", "https", "ftp" };
-  char toggleBuf[15], serverBuf[20], serverPrefBuf[20], 
-       serverPortPrefBuf[25];
-  PRInt32 enabled;
-  for (PRUint32 i = 0; i < ArrayLength(protocols); ++i) {
-    sprintf(toggleBuf, "Use %s", protocols[i]);
-    GetInteger(aParser, "Proxy", toggleBuf, &enabled);
-    if (enabled) {
-      // Enable the "manual configuration" setting if we have at least
-      // one protocol using a Proxy. 
-      networkProxyType = 1;
-    }
-
-    sprintf(serverBuf, "%s Server", protocols[i]);
-    nsCAutoString proxyServer;
-    rv = aParser.GetString("Proxy", serverBuf, proxyServer);
-    if (NS_FAILED(rv))
-      continue;
-
-    sprintf(serverPrefBuf, "network.proxy.%s", protocols_l[i]);
-    sprintf(serverPortPrefBuf, "network.proxy.%s_port", protocols_l[i]);
-    // strings in Opera pref. file are in UTF-8
-    SetProxyPref(NS_ConvertUTF8toUTF16(proxyServer),
-                 serverPrefBuf, serverPortPrefBuf, aBranch);
-  }
-
-  GetInteger(aParser, "Proxy", "Use Automatic Proxy Configuration", &enabled);
-  if (enabled)
-    networkProxyType = 2;
-
-  nsCAutoString configURL;
-  rv = aParser.GetString("Proxy", "Automatic Proxy Configuration URL",
-                         configURL);
-  if (NS_SUCCEEDED(rv))
-    aBranch->SetCharPref("network.proxy.autoconfig_url", configURL.get());
-
-  GetInteger(aParser, "Proxy", "No Proxy Servers Check", &enabled);
-  if (enabled) {
-    nsCAutoString servers;
-    rv = aParser.GetString("Proxy", "No Proxy Servers", servers);
-    if (NS_SUCCEEDED(rv))
-      // strings in Opera pref. file are in UTF-8
-      ParseOverrideServers(NS_ConvertUTF8toUTF16(servers), aBranch);
-  }
-
-  aBranch->SetIntPref("network.proxy.type", networkProxyType);
-
-  return NS_OK;
-}
-
-nsresult
-nsOperaProfileMigrator::GetInteger(nsINIParser &aParser, 
-                                   const char* aSectionName, 
-                                   const char* aKeyName, 
-                                   PRInt32* aResult)
-{
-  nsCAutoString val;
-
-  nsresult rv = aParser.GetString(aSectionName, aKeyName, val);
-  if (NS_FAILED(rv))
-    return rv;
-
-  *aResult = val.ToInteger(&rv);
-
-  return rv;
-}
-
-
-nsresult
-nsOperaProfileMigrator::ParseColor(nsINIParser &aParser,
-                                   const char* aSectionName, char** aResult)
-{
-  nsresult rv;
-  PRInt32 r, g, b;
-
-  rv = GetInteger(aParser, aSectionName, "Red", &r);
-  rv |= GetInteger(aParser, aSectionName, "Green", &g);
-  rv |= GetInteger(aParser, aSectionName, "Blue", &b);
-  if (NS_FAILED(rv)) 
-    return NS_OK; // This Preference has no value. Bail now before we get in trouble.
-
-  *aResult = (char*)malloc(sizeof(char) * 8);
-  if (!*aResult)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  sprintf(*aResult, "#%02X%02X%02X", r, g, b);
-
-  return NS_OK;
-}
-
-nsresult 
-nsOperaProfileMigrator::CopyUserContentSheet(nsINIParser &aParser)
-{
-  nsresult rv;
-
-  nsCAutoString userContentCSS;
-  rv = aParser.GetString("User Prefs", "Local CSS File", userContentCSS);
-  if (NS_FAILED(rv) || userContentCSS.Length() == 0)
-    return NS_OK;
-
-  // Copy the file
-  nsCOMPtr<nsILocalFile> userContentCSSFile;
-  rv = NS_NewNativeLocalFile(userContentCSS, true,
-                             getter_AddRefs(userContentCSSFile));
-  if (NS_FAILED(rv))
-    return NS_OK;
-
-  bool exists;
-  rv = userContentCSSFile->Exists(&exists);
-  if (NS_FAILED(rv) || !exists)
-    return NS_OK;
-
-  nsCOMPtr<nsIFile> profileChromeDir;
-  NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR,
-                         getter_AddRefs(profileChromeDir));
-  if (!profileChromeDir)
-    return NS_OK;
-
-  userContentCSSFile->CopyToNative(profileChromeDir,
-                                   NS_LITERAL_CSTRING("userContent.css"));
-
-  return NS_OK;
-}
-
-nsresult
-nsOperaProfileMigrator::CopyCookies(bool aReplace)
-{
-  nsresult rv = NS_OK;
-
-  nsCOMPtr<nsIFile> temp;
-  mOperaProfile->Clone(getter_AddRefs(temp));
-  nsCOMPtr<nsILocalFile> historyFile(do_QueryInterface(temp));
-
-  historyFile->Append(OPERA_COOKIES_FILE_NAME);
-
-  nsCOMPtr<nsIInputStream> fileStream;
-  NS_NewLocalFileInputStream(getter_AddRefs(fileStream), historyFile);
-  if (!fileStream) 
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  nsOperaCookieMigrator* ocm = new nsOperaCookieMigrator(fileStream);
-  if (!ocm)
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  rv = ocm->Migrate();
-
-  if (ocm) {
-    delete ocm;
-    ocm = nsnull;
-  }
-
-  return rv;
-}
-
-nsOperaCookieMigrator::nsOperaCookieMigrator(nsIInputStream* aSourceStream) :
-  mAppVersion(0), mFileVersion(0), mTagTypeLength(0), mPayloadTypeLength(0), 
-  mCookieOpen(false), mCurrHandlingInfo(0)
-{
-  mStream = do_CreateInstance("@mozilla.org/binaryinputstream;1");
-  if (mStream)
-    mStream->SetInputStream(aSourceStream);
-
-  mCurrCookie.isSecure = false;
-  mCurrCookie.expiryTime = 0;
-}
-
-nsOperaCookieMigrator::~nsOperaCookieMigrator() 
-{ 
-  if (mStream)
-    mStream->SetInputStream(nsnull);
-}
-
-
-nsresult
-nsOperaCookieMigrator::Migrate()
-{
-  if (!mStream)
-    return NS_ERROR_FAILURE;
-
-  nsresult rv;
-
-  rv = ReadHeader();
-  if (NS_FAILED(rv)) 
-    return NS_OK;
-
-  nsCOMPtr<nsICookieManager2> manager(do_GetService(NS_COOKIEMANAGER_CONTRACTID));
-  nsCOMPtr<nsIPermissionManager> permissionManager(do_GetService("@mozilla.org/permissionmanager;1"));
-
-  PRUint8 tag;
-  PRUint16 length, segmentLength;
-
-  char* buf = nsnull;
-  do {
-    if (NS_FAILED(mStream->Read8(&tag))) 
-      return NS_OK; // EOF.
-
-    switch (tag) {
-    case BEGIN_DOMAIN_SEGMENT:
-      mStream->Read16(&length);
-      break;
-    case DOMAIN_COMPONENT: 
-      {
-        mStream->Read16(&length);
-        
-        mStream->ReadBytes(length, &buf);
-        buf = (char*)nsMemory::Realloc(buf, length+1);
-        buf[length] = '\0';
-        mDomainStack.AppendElement(buf);
-      }
-      break;
-    case END_DOMAIN_SEGMENT:
-      {
-        if (mCurrHandlingInfo)
-          AddCookieOverride(permissionManager);
-
-        // Pop the domain stack
-        PRUint32 count = mDomainStack.Length();
-        if (count > 0) {
-          char* segment = mDomainStack.ElementAt(count - 1);
-          if (segment) 
-            nsMemory::Free(segment);
-          mDomainStack.RemoveElementAt(count - 1);
-        }
-      }
-      break;
-
-    case BEGIN_PATH_SEGMENT:
-      mStream->Read16(&length);
-      break;
-    case PATH_COMPONENT:
-      {
-        mStream->Read16(&length);
-        
-        mStream->ReadBytes(length, &buf);
-        buf = (char*)nsMemory::Realloc(buf, length+1);
-        buf[length] = '\0';
-        mPathStack.AppendElement(buf);
-      }
-      break;
-    case END_PATH_SEGMENT:
-      {
-        // Add the last remaining cookie for this path.
-        if (mCookieOpen) 
-          AddCookie(manager);
-
-        // We receive one "End Path Segment" even if the path stack is empty
-        // i.e. telling us that we are done processing cookies for "/"
-
-        // Pop the path stack
-        PRUint32 count = mPathStack.Length();
-        if (count > 0) {
-          char* segment = mPathStack.ElementAt(count - 1);
-          if (segment)
-            nsMemory::Free(segment);
-          mPathStack.RemoveElementAt(count - 1);
-        }
-      }
-      break;
-
-    case FILTERING_INFO:
-      mStream->Read16(&length);
-      mStream->Read8(&mCurrHandlingInfo);
-      break;
-    case PATH_HANDLING_INFO:
-    case THIRD_PARTY_HANDLING_INFO: 
-      {
-        mStream->Read16(&length);
-        PRUint8 temp;
-        mStream->Read8(&temp);
-      }
-      break;
-
-    case BEGIN_COOKIE_SEGMENT:
-      {
-        // Be sure to save the last cookie before overwriting the buffers
-        // with data from subsequent cookies. 
-        if (mCookieOpen)
-          AddCookie(manager);
-
-        mStream->Read16(&segmentLength);
-        mCookieOpen = true;
-      }
-      break;
-    case COOKIE_ID:
-      {
-        mStream->Read16(&length);
-        mStream->ReadBytes(length, &buf);
-        buf = (char*)nsMemory::Realloc(buf, length+1);
-        buf[length] = '\0';
-        mCurrCookie.id.Assign(buf);
-        if (buf) {
-          nsMemory::Free(buf);
-          buf = nsnull;
-        }
-      }
-      break;
-    case COOKIE_DATA:
-      {
-        mStream->Read16(&length);
-        mStream->ReadBytes(length, &buf);
-        buf = (char*)nsMemory::Realloc(buf, length+1);
-        buf[length] = '\0';
-        mCurrCookie.data.Assign(buf);
-        if (buf) {
-          nsMemory::Free(buf);
-          buf = nsnull;
-        }
-      }
-      break;
-    case COOKIE_EXPIRY:
-      mStream->Read16(&length);
-      mStream->Read32(reinterpret_cast<PRUint32*>(&(mCurrCookie.expiryTime)));
-      break;
-    case COOKIE_SECURE:
-      mCurrCookie.isSecure = true;
-      break;
-
-    // We don't support any of these fields but we must read them in
-    // to advance the stream cursor. 
-    case COOKIE_LASTUSED: 
-      {
-        mStream->Read16(&length);
-        PRTime temp;
-        mStream->Read32(reinterpret_cast<PRUint32*>(&temp));
-      }
-      break;
-    case COOKIE_COMMENT:
-    case COOKIE_COMMENT_URL:
-    case COOKIE_V1_DOMAIN:
-    case COOKIE_V1_PATH:
-    case COOKIE_V1_PORT_LIMITATIONS:
-      {
-        mStream->Read16(&length);
-        mStream->ReadBytes(length, &buf);
-        if (buf) {
-          nsMemory::Free(buf);
-          buf = nsnull;
-        }
-      }
-      break;
-    case COOKIE_VERSION: 
-      {
-        mStream->Read16(&length);
-        PRUint8 temp;
-        mStream->Read8(&temp);
-      }
-      break;
-    case COOKIE_OTHERFLAG_1:
-    case COOKIE_OTHERFLAG_2:
-    case COOKIE_OTHERFLAG_3:
-    case COOKIE_OTHERFLAG_4:
-    case COOKIE_OTHERFLAG_5:
-    case COOKIE_OTHERFLAG_6: 
-      break;
-    }
-  }
-  while (1);
-  
-  // Make sure the path and domain stacks are clear. 
-  char* segment = nsnull;
-  PRUint32 i;
-  PRUint32 count = mPathStack.Length();
-  for (i = 0; i < count; ++i) {
-    segment = mPathStack.ElementAt(i);
-    if (segment) {
-      nsMemory::Free(segment);
-      segment = nsnull;
-    }
-  }
-  count = mDomainStack.Length();
-  for (i = 0; i < count; ++i) {
-    segment = mDomainStack.ElementAt(i);
-    if (segment) {
-      nsMemory::Free(segment);
-      segment = nsnull;
-    }
-  }
-  
-  return NS_OK;
-}
-
-nsresult
-nsOperaCookieMigrator::AddCookieOverride(nsIPermissionManager* aManager)
-{
-  nsresult rv;
-
-  nsCString domain;
-  SynthesizeDomain(getter_Copies(domain));
-  nsCOMPtr<nsIURI> uri(do_CreateInstance("@mozilla.org/network/standard-url;1"));
-  if (!uri)
-    return NS_ERROR_OUT_OF_MEMORY;
-  uri->SetHost(domain);
-
-  rv = aManager->Add(uri, "cookie",
-                     (mCurrHandlingInfo == 1 || mCurrHandlingInfo == 3)
-                     ? (PRUint32) nsIPermissionManager::ALLOW_ACTION
-                     : (PRUint32) nsIPermissionManager::DENY_ACTION,
-                     nsIPermissionManager::EXPIRE_NEVER,
-                     0);
-
-  mCurrHandlingInfo = 0;
-
-  return rv;
-}
-
-
-nsresult
-nsOperaCookieMigrator::AddCookie(nsICookieManager2* aManager)
-{
-  // This is where we use the information gathered in all the other 
-  // states to add a cookie to the Firebird/Firefox Cookie Manager.
-  nsCString domain;
-  SynthesizeDomain(getter_Copies(domain));
-
-  nsCString path;
-  SynthesizePath(getter_Copies(path));
-
-  mCookieOpen = false;
-  
-  nsresult rv = aManager->Add(domain, 
-                              path, 
-                              mCurrCookie.id, 
-                              mCurrCookie.data, 
-                              mCurrCookie.isSecure, 
-                              false, // isHttpOnly
-                              false, // isSession
-                              PRInt64(mCurrCookie.expiryTime));
-
-  mCurrCookie.isSecure = 0;
-  mCurrCookie.expiryTime = 0;
-
-  return rv;
-}
-
-void
-nsOperaCookieMigrator::SynthesizePath(char** aResult)
-{
-  PRUint32 count = mPathStack.Length();
-  nsCAutoString synthesizedPath("/");
-  for (PRUint32 i = 0; i < count; ++i) {
-    synthesizedPath.Append(mPathStack.ElementAt(i));
-    if (i != count-1)
-      synthesizedPath.Append("/");
-  }
-  if (synthesizedPath.IsEmpty())
-    synthesizedPath.Assign("/");
-
-  *aResult = ToNewCString(synthesizedPath);
-}
-
-void
-nsOperaCookieMigrator::SynthesizeDomain(char** aResult)
-{
-  PRUint32 count = mDomainStack.Length();
-  if (count == 0)
-    return;
-
-  nsCAutoString synthesizedDomain;
-  for (PRInt32 i = (PRInt32)count - 1; i >= 0; --i) {
-    synthesizedDomain.Append(mDomainStack.ElementAt((PRUint32)i));
-    if (i != 0)
-      synthesizedDomain.Append(".");
-  }
-
-  *aResult = ToNewCString(synthesizedDomain);
-}
-
-nsresult
-nsOperaCookieMigrator::ReadHeader()
-{
-  mStream->Read32(&mAppVersion);
-  mStream->Read32(&mFileVersion);
-
-  if (mAppVersion & 0x1000 && mFileVersion & 0x2000) {
-    mStream->Read16(&mTagTypeLength);
-    mStream->Read16(&mPayloadTypeLength);
-
-    return NS_OK;
-  }
-  return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-nsOperaProfileMigrator::RunBatched(nsISupports* aUserData)
-{
-  PRUint8 batchAction;
-  nsCOMPtr<nsISupportsPRUint8> strWrapper(do_QueryInterface(aUserData));
-  NS_ASSERTION(strWrapper, "Unable to create nsISupportsPRUint8 wrapper!");
-  nsresult rv = strWrapper->GetData(&batchAction);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  switch (batchAction) {
-    case BATCH_ACTION_HISTORY:
-      rv = CopyHistoryBatched(false);
-      break;
-    case BATCH_ACTION_HISTORY_REPLACE:
-      rv = CopyHistoryBatched(true);
-      break;
-    case BATCH_ACTION_BOOKMARKS:
-      rv = CopyBookmarksBatched(false);
-      break;
-    case BATCH_ACTION_BOOKMARKS_REPLACE:
-      rv = CopyBookmarksBatched(true);
-      break;
-  }
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult
-nsOperaProfileMigrator::CopyHistory(bool aReplace) 
-{
-  nsresult rv;
-  nsCOMPtr<nsINavHistoryService> history =
-    do_GetService(NS_NAVHISTORYSERVICE_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRUint8 batchAction = aReplace ? BATCH_ACTION_HISTORY_REPLACE
-                                 : BATCH_ACTION_HISTORY;
-  nsCOMPtr<nsISupportsPRUint8> supports =
-    do_CreateInstance(NS_SUPPORTS_PRUINT8_CONTRACTID);
-  NS_ENSURE_TRUE(supports, NS_ERROR_OUT_OF_MEMORY);
-  rv = supports->SetData(batchAction);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = history->RunInBatchMode(this, supports);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
- 
-nsresult
-nsOperaProfileMigrator::CopyHistoryBatched(bool aReplace) 
-{
-  nsCOMPtr<nsIBrowserHistory> hist(do_GetService(NS_GLOBALHISTORY2_CONTRACTID));
-
-  nsCOMPtr<nsIFile> temp;
-  mOperaProfile->Clone(getter_AddRefs(temp));
-  nsCOMPtr<nsILocalFile> historyFile(do_QueryInterface(temp));
-  historyFile->Append(OPERA_HISTORY_FILE_NAME);
-
-  nsCOMPtr<nsIInputStream> fileStream;
-  NS_NewLocalFileInputStream(getter_AddRefs(fileStream), historyFile);
-  if (!fileStream) return NS_ERROR_OUT_OF_MEMORY;
-
-  nsCOMPtr<nsILineInputStream> lineStream = do_QueryInterface(fileStream);
-
-  nsCAutoString buffer, url;
-  nsAutoString title;
-  PRTime lastVisitDate;
-  bool moreData = false;
-
-  enum { TITLE, URL, LASTVISIT } state = TITLE;
-
-  // Format is "title\nurl\nlastvisitdate"
-  do {
-    nsresult rv = lineStream->ReadLine(buffer, &moreData);
-    if (NS_FAILED(rv))
-      return rv;
-
-    switch (state) {
-    case TITLE:
-      CopyUTF8toUTF16(buffer, title);
-      state = URL;
-      break;
-    case URL:
-      url = buffer;
-      state = LASTVISIT;
-      break;
-    case LASTVISIT:
-      // Opera time format is a second offset, PRTime is a microsecond offset
-      nsresult err;
-      lastVisitDate = buffer.ToInteger(&err);
-      
-      PRInt64 temp, million;
-      LL_I2L(temp, lastVisitDate);
-      LL_I2L(million, PR_USEC_PER_SEC);
-      LL_MUL(lastVisitDate, temp, million);
-
-      nsCOMPtr<nsIURI> uri;
-      NS_NewURI(getter_AddRefs(uri), url);
-      if (uri)
-        hist->AddPageWithDetails(uri, title.get(), lastVisitDate);
-      
-      state = TITLE;
-      break;
-    }
-  }
-  while (moreData);
-
-  return NS_OK;
-}
-
-nsresult
-nsOperaProfileMigrator::CopyBookmarks(bool aReplace)
-{
-  nsresult rv;
-  nsCOMPtr<nsINavBookmarksService> bookmarks =
-    do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRUint8 batchAction = aReplace ? BATCH_ACTION_BOOKMARKS_REPLACE
-                                 : BATCH_ACTION_BOOKMARKS;
-  nsCOMPtr<nsISupportsPRUint8> supports =
-    do_CreateInstance(NS_SUPPORTS_PRUINT8_CONTRACTID);
-  NS_ENSURE_TRUE(supports, NS_ERROR_OUT_OF_MEMORY);
-  rv = supports->SetData(batchAction);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = bookmarks->RunInBatchMode(this, supports);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-nsresult
-nsOperaProfileMigrator::CopyBookmarksBatched(bool aReplace)
-{
-  // Find Opera Bookmarks
-  nsCOMPtr<nsIFile> operaBookmarks;
-  mOperaProfile->Clone(getter_AddRefs(operaBookmarks));
-  operaBookmarks->Append(OPERA_BOOKMARKS_FILE_NAME);
-
-  nsCOMPtr<nsIInputStream> fileInputStream;
-  NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), operaBookmarks);
-  NS_ENSURE_TRUE(fileInputStream, NS_ERROR_OUT_OF_MEMORY);
-
-  nsCOMPtr<nsILineInputStream> lineInputStream(do_QueryInterface(fileInputStream));
-
-  nsresult rv;
-  nsCOMPtr<nsINavBookmarksService> bms =
-    do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-  PRInt64 bookmarksMenuFolderId;
-  rv = bms->GetBookmarksMenuFolder(&bookmarksMenuFolderId);
-  NS_ENSURE_SUCCESS(rv, rv);
-  PRInt64 parentFolder = bookmarksMenuFolderId;
-
-  nsCOMPtr<nsIStringBundleService> bundleService =
-    do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-  nsCOMPtr<nsIStringBundle> bundle;
-  rv = bundleService->CreateBundle(MIGRATION_BUNDLE, getter_AddRefs(bundle));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (!aReplace) {
-    nsString sourceNameOpera;
-    rv = bundle->GetStringFromName(NS_LITERAL_STRING("sourceNameOpera").get(), 
-                                   getter_Copies(sourceNameOpera));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    const PRUnichar* sourceNameStrings[] = { sourceNameOpera.get() };
-    nsString importedOperaHotlistTitle;
-    rv = bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
-                                      sourceNameStrings, 1, 
-                                      getter_Copies(importedOperaHotlistTitle));
-   NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = bms->CreateFolder(parentFolder,
-                           NS_ConvertUTF16toUTF8(importedOperaHotlistTitle),
-                           nsINavBookmarksService::DEFAULT_INDEX,
-                           &parentFolder);
-   NS_ENSURE_SUCCESS(rv, rv);
-  }
-  else {
-    nsCOMPtr<nsIFile> profile;
-    GetProfilePath(nsnull, profile);
-    rv = InitializeBookmarks(profile);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
-#if defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
-  CopySmartKeywords(bms, bundle, parentFolder);
-#endif
-
-  PRInt64 bookmarksToolbarFolderId;
-  rv = bms->GetToolbarFolder(&bookmarksToolbarFolderId);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = ParseBookmarksFolder(lineInputStream, parentFolder,
-                            bookmarksToolbarFolderId, bms);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-#if defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
-nsresult
-nsOperaProfileMigrator::CopySmartKeywords(nsINavBookmarksService* aBMS, 
-                                          nsIStringBundle* aBundle,
-                                          PRInt64 aParentFolder)
-{
-  nsresult rv;
-
-  nsCOMPtr<nsIFile> smartKeywords;
-  mOperaProfile->Clone(getter_AddRefs(smartKeywords));
-  smartKeywords->Append(NS_LITERAL_STRING("search.ini"));
-
-  nsCOMPtr<nsILocalFile> lf(do_QueryInterface(smartKeywords));
-  nsINIParser parser;
-  if (!lf || NS_FAILED(parser.Init(lf)))
-    return NS_OK;
-
-  nsString sourceNameOpera;
-  rv = aBundle->GetStringFromName(NS_LITERAL_STRING("sourceNameOpera").get(),
-                                  getter_Copies(sourceNameOpera));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  const PRUnichar* sourceNameStrings[] = { sourceNameOpera.get() };
-  nsString importedSearchUrlsTitle;
-  rv = aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchURLsFolder").get(),
-                                     sourceNameStrings, 1, 
-                                     getter_Copies(importedSearchUrlsTitle));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt64 keywordsFolder;
-  rv = aBMS->CreateFolder(aParentFolder,
-                          NS_ConvertUTF16toUTF8(importedSearchUrlsTitle),
-                          nsINavBookmarksService::DEFAULT_INDEX,
-                          &keywordsFolder);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRInt32 sectionIndex = 1;
-  nsCAutoString name, url, keyword;
-  do {
-    nsCAutoString section("Search Engine ");
-    section.AppendInt(sectionIndex++);
-
-    rv = parser.GetString(section.get(), "Name", name);
-    if (NS_FAILED(rv)) {
-      // No more smart keywords found, stop parsing the file.
-      break;
-    }
-    if (name.IsEmpty())
-      continue;
-
-    rv = parser.GetString(section.get(), "URL", url);
-    if (NS_FAILED(rv) || url.IsEmpty())
-      continue;
-
-    rv = parser.GetString(section.get(), "Key", keyword);
-    if (NS_FAILED(rv) || keyword.IsEmpty())
-      continue;
-
-    PRInt32 post;
-    rv = GetInteger(parser, section.get(), "Is post", &post);
-    if (NS_SUCCEEDED(rv) && post)
-      continue;
-
-    PRUint32 length = name.Length();
-    PRInt32 index = 0;
-    do {
-      index = name.FindChar('&', index);
-      if ((PRUint32)index >= length - 2)
-        break;
-
-      // Assume "&&" is an escaped ampersand in the search query title. 
-      if (name.CharAt(index + 1) == '&') {
-        name.Cut(index, 1);
-        index += 2;
-        continue;
-      }
-
-      name.Cut(index, 1);
-    }
-    while ((PRUint32)index < length);
-
-    nsCOMPtr<nsIURI> uri;
-    if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), url.get())) || !uri)
-      continue;
-
-    nsCAutoString hostCStr;
-    uri->GetHost(hostCStr);
-    NS_ConvertASCIItoUTF16 host(hostCStr);
-
-    const PRUnichar* descStrings[] = { NS_ConvertUTF8toUTF16(keyword).get(),
-                                       host.get() };
-    nsString keywordDesc;
-    rv = aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchUrlDesc").get(),
-                                       descStrings, 2,
-                                       getter_Copies(keywordDesc));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    PRInt64 newId;
-    rv = aBMS->InsertBookmark(keywordsFolder, uri,
-                              nsINavBookmarksService::DEFAULT_INDEX,
-                              name, &newId);
-    NS_ENSURE_SUCCESS(rv, rv);
-    rv = aBMS->SetKeywordForBookmark(newId, NS_ConvertUTF8toUTF16(keyword));
-    NS_ENSURE_SUCCESS(rv, rv);
-    // TODO Bug 397771: set bookmark description to keywordDesc.
-  }
-  while (1);
-  
-  return rv;
-}
-#endif
-
-typedef enum { LineType_FOLDER, 
-               LineType_BOOKMARK, 
-               LineType_SEPARATOR, 
-               LineType_NAME, 
-               LineType_URL, 
-               LineType_KEYWORD,
-               LineType_DESCRIPTION,
-               LineType_ONTOOLBAR,
-               LineType_NL,
-               LineType_OTHER } LineType;
-
-static LineType GetLineType(nsAString& aBuffer, PRUnichar** aData)
-{
-  if (Substring(aBuffer, 0, 7).Equals(NS_LITERAL_STRING("#FOLDER")))
-    return LineType_FOLDER;
-  if (Substring(aBuffer, 0, 4).Equals(NS_LITERAL_STRING("#URL")))
-    return LineType_BOOKMARK;
-  if (Substring(aBuffer, 0, 1).Equals(NS_LITERAL_STRING("-")))
-    return LineType_SEPARATOR;
-  if (Substring(aBuffer, 1, 5).Equals(NS_LITERAL_STRING("NAME="))) {
-    const nsAString& data = Substring(aBuffer, 6, aBuffer.Length() - 6);
-    *aData = ToNewUnicode(data);
-    return LineType_NAME;
-  }
-  if (Substring(aBuffer, 1, 4).Equals(NS_LITERAL_STRING("URL="))) {
-    const nsAString& data = Substring(aBuffer, 5, aBuffer.Length() - 5);
-    *aData = ToNewUnicode(data);
-    return LineType_URL;
-  }
-  if (Substring(aBuffer, 1, 12).Equals(NS_LITERAL_STRING("DESCRIPTION="))) {
-    const nsAString& data = Substring(aBuffer, 13, aBuffer.Length() - 13);
-    *aData = ToNewUnicode(data);
-    return LineType_DESCRIPTION;
-  }
-  if (Substring(aBuffer, 1, 11).Equals(NS_LITERAL_STRING("SHORT NAME="))) {
-    const nsAString& data = Substring(aBuffer, 12, aBuffer.Length() - 12);
-    *aData = ToNewUnicode(data);
-    return LineType_KEYWORD;
-  }
-  if (Substring(aBuffer, 1, 15).Equals(NS_LITERAL_STRING("ON PERSONALBAR="))) {
-    const nsAString& data = Substring(aBuffer, 16, aBuffer.Length() - 16);
-    *aData = ToNewUnicode(data);
-    return LineType_ONTOOLBAR;
-  }
-  if (aBuffer.IsEmpty())
-    return LineType_NL; // Newlines separate bookmarks
-  return LineType_OTHER;
-}
-
-typedef enum { EntryType_BOOKMARK, EntryType_FOLDER } EntryType;
-
-nsresult
-nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream, 
-                                             PRInt64 aParent,
-                                             PRInt64 aToolbar,
-                                             nsINavBookmarksService* aBMS)
-{
-  nsresult rv;
-  bool moreData = false;
-  nsAutoString buffer;
-  EntryType entryType = EntryType_BOOKMARK;
-  nsAutoString keyword, description;
-  nsCAutoString url, name;
-  bool onToolbar = false;
-  do {
-    nsCAutoString cBuffer;
-    rv = aStream->ReadLine(cBuffer, &moreData);
-    if (NS_FAILED(rv)) return rv;
-    
-    CopyUTF8toUTF16(cBuffer, buffer);
-    nsString data;
-    LineType type = GetLineType(buffer, getter_Copies(data));
-    switch(type) {
-    case LineType_FOLDER:
-      entryType = EntryType_FOLDER;
-      break;
-    case LineType_BOOKMARK:
-      entryType = EntryType_BOOKMARK;
-      break;
-    case LineType_SEPARATOR:
-      // If we're here, we need to break out of the loop for the current folder, 
-      // essentially terminating this instance of ParseBookmarksFolder and return
-      // to the calling function, which is either ParseBookmarksFolder for a parent
-      // folder, or CopyBookmarks (which means we're done parsing all bookmarks).
-      goto done;
-    case LineType_NAME:
-      name.Assign(NS_ConvertUTF16toUTF8(data));
-      break;
-    case LineType_URL:
-      url.Assign(NS_ConvertUTF16toUTF8(data));
-      break;
-    case LineType_KEYWORD:
-      keyword = data;
-      break;
-    case LineType_DESCRIPTION:
-      description = data;
-      break;
-    case LineType_ONTOOLBAR:
-      if (NS_LITERAL_STRING("YES").Equals(data))
-        onToolbar = true;
-      break;
-    case LineType_NL: {
-      // XXX We don't know for sure how Opera deals with IDN hostnames in URL.
-      // Assuming it's in UTF-8 is rather safe because it covers two cases 
-      // (UTF-8 and ASCII) out of three cases (the last is a non-UTF-8
-      // multibyte encoding).
-      // XXX Todo: |description| is not saved.
-      if (entryType == EntryType_BOOKMARK) {
-        if (!name.IsEmpty() && !url.IsEmpty()) {
-          nsCOMPtr<nsIURI> uri;
-          rv = NS_NewURI(getter_AddRefs(uri), url);
-          if (NS_FAILED(rv))
-            continue;
-          PRInt64 id;
-          rv = aBMS->InsertBookmark(onToolbar ? aToolbar : aParent,
-                                    uri, nsINavBookmarksService::DEFAULT_INDEX,
-                                    name, &id);
-          if (NS_FAILED(rv))
-            continue;
-          name.Truncate();
-          url.Truncate();
-          keyword.Truncate();
-          description.Truncate();
-          onToolbar = false;
-        }
-      }
-      else if (entryType == EntryType_FOLDER) {
-        if (!name.IsEmpty()) {
-          PRInt64 newFolder;
-          rv = aBMS->CreateFolder(onToolbar ? aToolbar : aParent,
-                                  name, nsINavBookmarksService::DEFAULT_INDEX, &newFolder);
-          if (NS_FAILED(rv)) 
-            continue;
-          rv = ParseBookmarksFolder(aStream, newFolder, aToolbar, aBMS);
-          name.Truncate();
-        }
-      }
-      break;
-    }
-    case LineType_OTHER:
-      break;
-    }
-  }
-  while (moreData);
-
-done:
-  return rv;
-}
-
-void
-nsOperaProfileMigrator::GetOperaProfile(const PRUnichar* aProfile, nsILocalFile** aFile)
-{
-  nsCOMPtr<nsIProperties> fileLocator(do_GetService("@mozilla.org/file/directory_service;1"));
-  nsCOMPtr<nsILocalFile> file;
-#ifdef XP_WIN
-  fileLocator->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
-
-  // Opera profile lives under %APP_DATA%\Opera\<operaver>\profile 
-  file->Append(OPERA_PREFERENCES_FOLDER_NAME);
-  file->Append(nsDependentString(aProfile));
-  file->Append(NS_LITERAL_STRING("profile"));
-#elif defined (XP_MACOSX)
-  fileLocator->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
-    
-  file->Append(NS_LITERAL_STRING("Preferences"));
-  file->Append(OPERA_PREFERENCES_FOLDER_NAME);
-#elif defined (XP_UNIX)
-  fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(file));
-    
-  file->Append(OPERA_PREFERENCES_FOLDER_NAME);
-#endif    
-
-  *aFile = file;
-  NS_ADDREF(*aFile);
-}
-
deleted file mode 100644
--- a/browser/components/migration/src/nsOperaProfileMigrator.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; 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
- * http://www.mozilla.org/MPL/
- *
- * 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 The Browser Profile Migrator.
- *
- * The Initial Developer of the Original Code is Ben Goodger.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *  Ben Goodger <ben@bengoodger.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 ***** */
- 
-#ifndef operaprofilemigrator___h___
-#define operaprofilemigrator___h___
-
-#include "nsCOMPtr.h"
-#include "nsIBinaryInputStream.h"
-#include "nsIBrowserProfileMigrator.h"
-#include "nsIObserverService.h"
-#include "nsStringAPI.h"
-#include "nsTArray.h"
-#include "nsIMutableArray.h"
-#include "nsINavHistoryService.h"
-#include "nsIStringBundle.h"
-
-class nsICookieManager2;
-class nsILineInputStream;
-class nsILocalFile;
-class nsINIParser;
-class nsIPermissionManager;
-class nsIPrefBranch;
-class nsINavBookmarksService;
-class nsIRDFResource;
-
-class nsOperaProfileMigrator : public nsIBrowserProfileMigrator,
-                               public nsINavHistoryBatchCallback
-{
-public:
-  NS_DECL_NSIBROWSERPROFILEMIGRATOR
-  NS_DECL_NSINAVHISTORYBATCHCALLBACK
-  NS_DECL_ISUPPORTS
-
-  nsOperaProfileMigrator();
-  virtual ~nsOperaProfileMigrator();
-
-public:
-
-  typedef enum { STRING, INT, BOOL, COLOR } PrefType;
-
-  typedef nsresult(*prefConverter)(void*, nsIPrefBranch*);
-
-  struct PrefTransform {
-    const char*   sectionName;
-    const char*   keyName;
-    PrefType      type;
-    const char*   targetPrefName;
-    prefConverter prefSetterFunc;
-    bool          prefHasValue;
-    union {
-      PRInt32     intValue;
-      bool        boolValue;
-      char*       stringValue;
-    };
-  };
-
-  static nsresult SetFile(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetCookieBehavior(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetCookieLifetime(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetImageBehavior(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetBool(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetWString(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetInt(void* aTransform, nsIPrefBranch* aBranch);
-  static nsresult SetString(void* aTransform, nsIPrefBranch* aBranch);
-
-protected:
-  nsresult CopyPreferences(bool aReplace);
-  nsresult ParseColor(nsINIParser &aParser, const char* aSectionName,
-                      char** aResult);
-  nsresult CopyUserContentSheet(nsINIParser &aParser);
-  nsresult CopyProxySettings(nsINIParser &aParser, nsIPrefBranch* aBranch);
-  nsresult GetInteger(nsINIParser &aParser, const char* aSectionName, 
-                      const char* aKeyName, PRInt32* aResult);
-
-  nsresult CopyCookies(bool aReplace);
-  /**
-   * Migrate history to Places.
-   * This will end up calling CopyHistoryBatched helper, that provides batch
-   * support.  Batching allows for better performances and integrity.
-   *
-   * @param aReplace
-   *        Indicates if we should replace current history or append to it.
-   */
-  nsresult CopyHistory(bool aReplace);
-  nsresult CopyHistoryBatched(bool aReplace);
-  /**
-   * Migrate bookmarks to Places.
-   * This will end up calling CopyBookmarksBatched helper, that provides batch
-   * support.  Batching allows for better performances and integrity.
-   *
-   * @param aReplace
-   *        Indicates if we should replace current bookmarks or append to them.
-   *        When appending we will usually default to bookmarks menu.
-   */
-  nsresult CopyBookmarks(bool aReplace);
-  nsresult CopyBookmarksBatched(bool aReplace);
-  void     ClearToolbarFolder(nsINavBookmarksService * aBookmarksService,
-                              PRInt64 aToolbarFolder);
-  nsresult ParseBookmarksFolder(nsILineInputStream* aStream, 
-                                PRInt64 aFolder,
-                                PRInt64 aToolbar, 
-                                nsINavBookmarksService* aBMS);
-#if defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
-  nsresult CopySmartKeywords(nsINavBookmarksService* aBMS, 
-                             nsIStringBundle* aBundle, 
-                             PRInt64 aParentFolder);
-#endif // defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
-
-  void     GetOperaProfile(const PRUnichar* aProfile, nsILocalFile** aFile);
-
-private:
-  nsCOMPtr<nsILocalFile> mOperaProfile;
-  nsCOMPtr<nsIMutableArray> mProfiles;
-  nsCOMPtr<nsIObserverService> mObserverService;
-};
-
-class nsOperaCookieMigrator
-{
-public:
-  nsOperaCookieMigrator(nsIInputStream* aSourceStream);
-  virtual ~nsOperaCookieMigrator();
-
-  nsresult Migrate();
-
-  typedef enum { BEGIN_DOMAIN_SEGMENT         = 0x01,
-                 DOMAIN_COMPONENT             = 0x1E,
-                 END_DOMAIN_SEGMENT           = 0x84 | 0x80, // 0x04 | (1 << 8)
-                 
-                 BEGIN_PATH_SEGMENT           = 0x02,
-                 PATH_COMPONENT               = 0x1D,
-                 END_PATH_SEGMENT             = 0x05 | 0x80, // 0x05 | (1 << 8)
-                 
-                 FILTERING_INFO               = 0x1F,
-                 PATH_HANDLING_INFO           = 0x21,
-                 THIRD_PARTY_HANDLING_INFO    = 0x25,
-
-                 BEGIN_COOKIE_SEGMENT         = 0x03,
-                 COOKIE_ID                    = 0x10,
-                 COOKIE_DATA                  = 0x11,
-                 COOKIE_EXPIRY                = 0x12,
-                 COOKIE_LASTUSED              = 0x13,
-                 COOKIE_COMMENT               = 0x14,
-                 COOKIE_COMMENT_URL           = 0x15,
-                 COOKIE_V1_DOMAIN             = 0x16,
-                 COOKIE_V1_PATH               = 0x17,
-                 COOKIE_V1_PORT_LIMITATIONS   = 0x18,
-                 COOKIE_SECURE                = 0x19 | 0x80, 
-                 COOKIE_VERSION               = 0x1A,
-                 COOKIE_OTHERFLAG_1           = 0x1B | 0x80,
-                 COOKIE_OTHERFLAG_2           = 0x1C | 0x80,
-                 COOKIE_OTHERFLAG_3           = 0x20 | 0x80,
-                 COOKIE_OTHERFLAG_4           = 0x22 | 0x80,
-                 COOKIE_OTHERFLAG_5           = 0x23 | 0x80,
-                 COOKIE_OTHERFLAG_6           = 0x24 | 0x80
-  } TAG;
-
-protected:
-  nsOperaCookieMigrator() { }
-
-  nsresult ReadHeader();
-
-  void     SynthesizePath(char** aResult);
-  void     SynthesizeDomain(char** aResult);
-  nsresult AddCookieOverride(nsIPermissionManager* aManager);
-  nsresult AddCookie(nsICookieManager2* aManager);
-
-private:
-  nsCOMPtr<nsIBinaryInputStream> mStream;
-
-  nsTArray<char*> mDomainStack;
-  nsTArray<char*> mPathStack;
-
-  struct Cookie {
-    nsCString id;
-    nsCString data;
-    PRInt32 expiryTime;
-    bool isSecure;
-  };
-
-  PRUint32 mAppVersion;
-  PRUint32 mFileVersion;
-  PRUint16 mTagTypeLength;
-  PRUint16 mPayloadTypeLength;
-  bool     mCookieOpen;
-  Cookie   mCurrCookie;
-  PRUint8  mCurrHandlingInfo;
-};
-
-#endif
-
--- a/browser/components/migration/src/nsProfileMigrator.cpp
+++ b/browser/components/migration/src/nsProfileMigrator.cpp
@@ -134,17 +134,16 @@ nsProfileMigrator::Migrate(nsIProfileSta
 // nsProfileMigrator
 
 NS_IMPL_ISUPPORTS1(nsProfileMigrator, nsIProfileMigrator)
 
 #ifdef XP_WIN
 
 #define INTERNAL_NAME_IEXPLORE        "iexplore"
 #define INTERNAL_NAME_MOZILLA_SUITE   "apprunner"
-#define INTERNAL_NAME_OPERA           "opera"
 #define INTERNAL_NAME_CHROME          "chrome"
 #endif
 
 nsresult
 nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
                                                 nsCOMPtr<nsIBrowserProfileMigrator>& bpm)
 {
 #if XP_WIN
@@ -215,20 +214,16 @@ nsProfileMigrator::GetDefaultBrowserMigr
   nsAutoString internalName;
   if (NS_FAILED(lfw->GetVersionInfoField("InternalName", internalName)))
     return NS_ERROR_FAILURE;
 
   if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_IEXPLORE)) {
     aKey = "ie";
     return NS_OK;
   }
-  else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_OPERA)) {
-    aKey = "opera";
-    return NS_OK;
-  }
   else if (internalName.LowerCaseEqualsLiteral(INTERNAL_NAME_CHROME)) {
     aKey = "chrome";
     return NS_OK;
   }
 
 #else
   bool exists = false;
 #define CHECK_MIGRATOR(browser) do {\
@@ -238,15 +233,14 @@ nsProfileMigrator::GetDefaultBrowserMigr
   if (exists) {\
     aKey = browser;\
     return NS_OK;\
   }} while(0)
 
 #if defined(XP_MACOSX)
   CHECK_MIGRATOR("safari");
 #endif
-  CHECK_MIGRATOR("opera");
   CHECK_MIGRATOR("chrome");
 
 #undef CHECK_MIGRATOR
 #endif
   return NS_ERROR_FAILURE;
 }
--- a/browser/components/migration/src/nsSafariProfileMigrator.h
+++ b/browser/components/migration/src/nsSafariProfileMigrator.h
@@ -41,16 +41,19 @@
 
 #include "nsIBrowserProfileMigrator.h"
 #include "nsIObserverService.h"
 #include "nsStringAPI.h"
 #include "nsINavHistoryService.h"
 
 #include <CoreFoundation/CoreFoundation.h>
 
+class nsIPrefBranch;
+class nsINavBookmarksService;
+class nsIRDFResource;
 class nsIRDFDataSource;
 
 class nsSafariProfileMigrator : public nsIBrowserProfileMigrator,
                                 public nsINavHistoryBatchCallback
 {
 public:
   NS_DECL_NSIBROWSERPROFILEMIGRATOR
   NS_DECL_NSINAVHISTORYBATCHCALLBACK
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -216,18 +216,19 @@ var gEditItemOverlay = {
           }
           else
             this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i]);
           this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]);
         }
         this._allTags = this._getCommonTags();
         this._initTextField("tagsField", this._allTags.join(", "), false);
         this._element("itemsCountText").value =
-          PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
-                                           [this._itemIds.length]);
+          PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel",
+                                        this._itemIds.length,
+                                        [this._itemIds.length]);
       }
 
       // tags selector
       this._rebuildTagsSelectorList();
     }
 
     // name picker
     this._initNamePicker();
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -708,18 +708,18 @@ var PlacesOrganizer = {
       for (var i = 0; i < aNodeList.length; i++) {
         if (!PlacesUtils.nodeIsBookmark(aNodeList[i]) &&
             !PlacesUtils.nodeIsURI(aNodeList[i])) {
           detailsDeck.selectedIndex = 0;
           var selectItemDesc = document.getElementById("selectItemDescription");
           var itemsCountLabel = document.getElementById("itemsCountText");
           selectItemDesc.hidden = false;
           itemsCountLabel.value =
-            PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
-                                             [aNodeList.length]);
+            PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel",
+                                          aNodeList.length, [aNodeList.length]);
           infoBox.hidden = true;
           return;
         }
         itemIds[i] = aNodeList[i].itemId != -1 ? aNodeList[i].itemId :
                      PlacesUtils._uri(aNodeList[i].uri);
       }
       detailsDeck.selectedIndex = 1;
       gEditItemOverlay.initPanel(itemIds,
@@ -738,23 +738,19 @@ var PlacesOrganizer = {
       var itemsCountLabel = document.getElementById("itemsCountText");
       var rowCount = this._content.treeBoxObject.view.rowCount;
       if (rowCount == 0) {
         selectItemDesc.hidden = true;
         itemsCountLabel.value = PlacesUIUtils.getString("detailsPane.noItems");
       }
       else {
         selectItemDesc.hidden = false;
-        if (rowCount == 1)
-          itemsCountLabel.value = PlacesUIUtils.getString("detailsPane.oneItem");
-        else {
-          itemsCountLabel.value =
-            PlacesUIUtils.getFormattedString("detailsPane.multipleItems",
-                                             [rowCount]);
-        }
+        itemsCountLabel.value =
+          PlacesUIUtils.getPluralString("detailsPane.itemsCountLabel",
+                                        rowCount, [rowCount]);
       }
     }
   },
 
   // NOT YET USED
   _updateThumbnail: function PO__updateThumbnail() {
     var bo = document.getElementById("previewBox").boxObject;
     var width  = bo.width;
--- a/browser/components/places/src/PlacesUIUtils.jsm
+++ b/browser/components/places/src/PlacesUIUtils.jsm
@@ -45,16 +45,19 @@ var EXPORTED_SYMBOLS = ["PlacesUIUtils"]
 var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
+XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
+                                  "resource://gre/modules/PluralForm.jsm");
+
 XPCOMUtils.defineLazyGetter(this, "PlacesUtils", function() {
   Cu.import("resource://gre/modules/PlacesUtils.jsm");
   return PlacesUtils;
 });
 
 var PlacesUIUtils = {
   ORGANIZER_LEFTPANE_VERSION: 7,
   ORGANIZER_FOLDER_ANNO: "PlacesOrganizer/OrganizerFolder",
@@ -74,16 +77,41 @@ var PlacesUIUtils = {
   createFixedURI: function PUIU_createFixedURI(aSpec) {
     return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
   },
 
   getFormattedString: function PUIU_getFormattedString(key, params) {
     return bundle.formatStringFromName(key, params, params.length);
   },
 
+  /**
+   * Get a localized plural string for the specified key name and numeric value
+   * substituting parameters.
+   *
+   * @param   aKey
+   *          String, key for looking up the localized string in the bundle
+   * @param   aNumber
+   *          Number based on which the final localized form is looked up
+   * @param   aParams
+   *          Array whose items will substitute #1, #2,... #n parameters
+   *          in the string.
+   *
+   * @see https://developer.mozilla.org/en/Localization_and_Plurals
+   * @return The localized plural string.
+   */
+  getPluralString: function PUIU_getPluralString(aKey, aNumber, aParams) {
+    let str = PluralForm.get(aNumber, bundle.GetStringFromName(aKey));
+
+    // Replace #1 with aParams[0], #2 with aParams[1], and so on.
+    return str.replace(/\#(\d+)/g, function (matchedId, matchedNumber) {
+      let param = aParams[parseInt(matchedNumber, 10) - 1];
+      return param !== undefined ? param : matchedId;
+    });
+  },
+
   getString: function PUIU_getString(key) {
     return bundle.GetStringFromName(key);
   },
 
   get _copyableAnnotations() [
     this.DESCRIPTION_ANNO,
     this.LOAD_IN_SIDEBAR_ANNO,
     PlacesUtils.POST_DATA_ANNO,
--- a/browser/components/preferences/Makefile.in
+++ b/browser/components/preferences/Makefile.in
@@ -46,14 +46,14 @@ include $(DEPTH)/config/autoconf.mk
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-	-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
+	-DMOZ_MACBUNDLE_NAME=$(MOZ_MACBUNDLE_NAME) \
 	$(NULL)
 
 ifneq (,$(filter windows gtk2 cocoa, $(MOZ_WIDGET_TOOLKIT)))
 DEFINES += -DHAVE_SHELL_SERVICE=1
 endif
--- a/browser/components/preferences/advanced.js
+++ b/browser/components/preferences/advanced.js
@@ -63,17 +63,18 @@ var gAdvancedPane = {
 
 #ifdef MOZ_UPDATER
     this.updateReadPrefs();
 #endif
     this.updateOfflineApps();
 #ifdef MOZ_CRASHREPORTER
     this.initSubmitCrashes();
 #endif
-    this.updateActualCacheSize();
+    this.updateActualCacheSize("disk");
+    this.updateActualCacheSize("offline");
   },
 
   /**
    * Stores the identity of the current tab in preferences so that the selected
    * tab can be persisted between openings of the preferences window.
    */
   tabSelectionChanged: function ()
   {
@@ -197,40 +198,45 @@ var gAdvancedPane = {
    * Displays a dialog in which proxy settings may be changed.
    */
   showConnections: function ()
   {
     document.documentElement.openSubDialog("chrome://browser/content/preferences/connection.xul",
                                            "", null);
   },
  
-  // Retrieves the amount of space currently used by disk cache
-  updateActualCacheSize: function ()
+  // Retrieves the amount of space currently used by disk or offline cache
+  updateActualCacheSize: function (device)
   {
     var visitor = {
       visitDevice: function (deviceID, deviceInfo)
       {
-        if (deviceID == "disk") {
-          var actualSizeLabel = document.getElementById("actualCacheSize");
+        if (deviceID == device) {
+          var actualSizeLabel = document.getElementById(device == "disk" ?
+                                                        "actualDiskCacheSize" :
+                                                        "actualAppCacheSize");
           var sizeStrings = DownloadUtils.convertByteUnits(deviceInfo.totalSize);
           var prefStrBundle = document.getElementById("bundlePreferences");
-          var sizeStr = prefStrBundle.getFormattedString("actualCacheSize",
-                                                          sizeStrings);
+          var sizeStr = prefStrBundle.getFormattedString(device == "disk" ?
+                                                         "actualDiskCacheSize" :
+                                                         "actualAppCacheSize",
+                                                         sizeStrings);
           actualSizeLabel.value = sizeStr;
         }
         // Do not enumerate entries
         return false;
       },
 
       visitEntry: function (deviceID, entryInfo)
       {
         // Do not enumerate entries.
         return false;
       }
     };
+
     var cacheService =
       Components.classes["@mozilla.org/network/cache-service;1"]
                 .getService(Components.interfaces.nsICacheService);
     cacheService.visitEntries(visitor);
   },
 
   updateCacheSizeUI: function (smartSizeEnabled)
   {
@@ -269,21 +275,33 @@ var gAdvancedPane = {
   },
 
   /**
    * Clears the cache.
    */
   clearCache: function ()
   {
     var cacheService = Components.classes["@mozilla.org/network/cache-service;1"]
-                         	       .getService(Components.interfaces.nsICacheService);
+                                 .getService(Components.interfaces.nsICacheService);
     try {
       cacheService.evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
     } catch(ex) {}
-    this.updateActualCacheSize();
+    this.updateActualCacheSize("disk");
+  },
+
+  /**
+   * Clears the application cache.
+   */
+  clearOfflineAppCache: function ()
+  {
+    Components.utils.import("resource:///modules/offlineAppCache.jsm");
+    OfflineAppCacheHelper.clear();
+
+    this.updateActualCacheSize("offline");
+    this.updateOfflineApps();
   },
 
   readOfflineNotify: function()
   {
     var pref = document.getElementById("browser.offline-apps.notify");
     var button = document.getElementById("offlineNotifyExceptions");
     button.disabled = !pref.value;
     return pref.value;
@@ -427,16 +445,17 @@ var gAdvancedPane = {
                        .getService(Components.interfaces.nsIPermissionManager);
     pm.remove(host, "offline-app",
               Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
     pm.remove(host, "offline-app",
               Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
 
     list.removeChild(item);
     gAdvancedPane.offlineAppSelected();
+    this.updateActualCacheSize("offline");
   },
 
   // UPDATE TAB
 
   /*
    * Preferences:
    *
    * app.update.enabled
@@ -591,28 +610,16 @@ var gAdvancedPane = {
   showUpdates: function ()
   {
     var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
                              .createInstance(Components.interfaces.nsIUpdatePrompt);
     prompter.showUpdateHistory(window);
   },
 #endif
 
-  /**
-   * The Extensions checkbox and button are disabled only if the enable Addon
-   * update preference is locked.
-   */
-  updateAddonUpdateUI: function ()
-  {
-    var enabledPref = document.getElementById("extensions.update.enabled");
-    var enableAddonUpdate = document.getElementById("enableAddonUpdate");
-
-    enableAddonUpdate.disabled = enabledPref.locked;
-  },
-
   // ENCRYPTION TAB
 
   /*
    * Preferences:
    *
    * security.enable_ssl3
    * - true if SSL 3 encryption is enabled, false otherwise
    * security.enable_tls
--- a/browser/components/preferences/advanced.xul
+++ b/browser/components/preferences/advanced.xul
@@ -105,18 +105,16 @@
       <preference id="app.update.auto"                 name="app.update.auto"                 type="bool"/>
       <preference id="app.update.mode"                 name="app.update.mode"                 type="int"/>
 
       <preference id="app.update.disable_button.showUpdateHistory"
                   name="app.update.disable_button.showUpdateHistory"
                   type="bool"/>
 #endif
 
-      <preference id="extensions.update.enabled"       name="extensions.update.enabled"       type="bool"
-                  onchange="gAdvancedPane.updateAddonUpdateUI();"/>
       <preference id="browser.search.update"           name="browser.search.update"           type="bool"/>
 
       <!-- Encryption tab -->
       <preference id="security.enable_ssl3"            name="security.enable_ssl3"            type="bool"/>
       <preference id="security.enable_tls"             name="security.enable_tls"             type="bool"/>
 
       <preference id="security.default_personal_cert"  name="security.default_personal_cert"  type="string"/>
 
@@ -231,22 +229,22 @@
             <hbox align="center">
               <description flex="1" control="connectionSettings">&connectionDesc.label;</description>
               <button id="connectionSettings" icon="network" label="&connectionSettings.label;"
                       accesskey="&connectionSettings.accesskey;"
                       oncommand="gAdvancedPane.showConnections();"/>
             </hbox>
           </groupbox>
 
-          <!-- Cache/Offline apps -->
-          <groupbox id="offlineGroup">
-            <caption label="&offlineStorage.label;"/>
- 
+          <!-- Cache -->
+          <groupbox id="cacheGroup">
+            <caption label="&httpCache.label;"/>
+
             <hbox align="center">
-              <label id="actualCacheSize" flex="1"/>
+              <label id="actualDiskCacheSize" flex="1"/>
               <button id="clearCacheButton" icon="clear"
                       label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
                       oncommand="gAdvancedPane.clearCache();"/>
             </hbox>
             <checkbox preference="browser.cache.disk.smart_size.enabled"
                       id="allowSmartSize" flex="1"
                       onsyncfrompreference="return gAdvancedPane.readSmartSizeEnabled();"
                       label="&overrideSmartCacheSize.label;" 
@@ -257,29 +255,41 @@
                      value="&limitCacheSizeBefore.label;"/>
               <textbox id="cacheSize" type="number" size="4" max="1024"
                        preference="browser.cache.disk.capacity"
                        onsyncfrompreference="return gAdvancedPane.readCacheSize();"
                        onsynctopreference="return gAdvancedPane.writeCacheSize();"
                        aria-labelledby="useCacheBefore cacheSize useCacheAfter"/>
               <label id="useCacheAfter" flex="1">&limitCacheSizeAfter.label;</label>
             </hbox>
+          </groupbox>
+
+          <!-- Offline apps -->
+          <groupbox id="offlineGroup">
+            <caption label="&offlineStorage2.label;"/>
+
+            <hbox align="center">
+              <label id="actualAppCacheSize" flex="1"/>
+              <button id="clearOfflineAppCacheButton" icon="clear"
+                      label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"
+                      oncommand="gAdvancedPane.clearOfflineAppCache();"/>
+            </hbox>
             <hbox align="center">
               <checkbox id="offlineNotify" flex="1"
                         label="&offlineNotify.label;" accesskey="&offlineNotify.accesskey;"
                         preference="browser.offline-apps.notify"
                         onsyncfrompreference="return gAdvancedPane.readOfflineNotify();"/>
               <button id="offlineNotifyExceptions"
                       label="&offlineNotifyExceptions.label;"
                       accesskey="&offlineNotifyExceptions.accesskey;"
                       oncommand="gAdvancedPane.showOfflineExceptions();"/>
             </hbox>
             <hbox>
               <vbox flex="1">
-                <label id="offlineAppsListLabel">&offlineAppsList.label;</label>
+                <label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
                 <listbox id="offlineAppsList"
                          style="height: &offlineAppsList.height;;"
                          flex="1"
                          aria-labelledby="offlineAppsListLabel"
                          onselect="gAdvancedPane.offlineAppSelected(event);">
                 </listbox>
               </vbox>
               <vbox pack="end">
@@ -325,20 +335,16 @@
                       accesskey="&updateHistory.accesskey;"
                       preference="app.update.disable_button.showUpdateHistory"
                       oncommand="gAdvancedPane.showUpdates();"/>
             </hbox>
           </groupbox>
 #endif
           <groupbox id="updateOthers">
             <caption label="&updateOthers.label;"/>
-            <checkbox id="enableAddonUpdate"
-                      label="&enableAddonsUpdate3.label;"
-                      accesskey="&enableAddonsUpdate3.accesskey;"
-                      preference="extensions.update.enabled"/>
             <checkbox id="enableSearchUpdate"
                       label="&enableSearchUpdate.label;"
                       accesskey="&enableSearchUpdate.accesskey;"
                       preference="browser.search.update"/>
           </groupbox>
         </tabpanel>
 
         <!-- Encryption -->
--- a/browser/components/preferences/applications.js
+++ b/browser/components/preferences/applications.js
@@ -1347,17 +1347,17 @@ var gApplicationsPane = {
            aExecutable.isExecutable() &&
 // XXXben - we need to compare this with the running instance executable
 //          just don't know how to do that via script...
 // XXXmano TBD: can probably add this to nsIShellService
 #ifdef XP_WIN
 #expand    aExecutable.leafName != "__MOZ_APP_NAME__.exe";
 #else
 #ifdef XP_MACOSX
-#expand    aExecutable.leafName != "__MOZ_APP_DISPLAYNAME__.app";
+#expand    aExecutable.leafName != "__MOZ_MACBUNDLE_NAME__";
 #else
 #expand    aExecutable.leafName != "__MOZ_APP_NAME__-bin";
 #endif
 #endif
   },
 
   /**
    * Rebuild the actions menu for the selected entry.  Gets called by
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -45,17 +45,17 @@ var gMainPane = {
    * Initialization of this.
    */
   init: function ()
   {
     this._pane = document.getElementById("paneMain");
 
     // set up the "use current page" label-changing listener
     this._updateUseCurrentButton();
-    window.addEventListener("focus", this._updateUseCurrentButton, false);
+    window.addEventListener("focus", this._updateUseCurrentButton.bind(this), false);
 
     this.updateBrowserStartupLastSession();
     this.startupPagePrefChanged();
 
     // Notify observers that the UI is now ready
     Components.classes["@mozilla.org/observer-service;1"]
               .getService(Components.interfaces.nsIObserverService)
               .notifyObservers(window, "main-pane-loaded", null);
@@ -123,33 +123,23 @@ var gMainPane = {
 
   /**
    * Sets the home page to the current displayed page (or frontmost tab, if the
    * most recent browser window contains multiple tabs), updating preference
    * window UI to reflect this.
    */
   setHomePageToCurrent: function ()
   {
-    var win;
-    if (document.documentElement.instantApply) {
-      // If we're in instant-apply mode, use the most recent browser window
-      var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-                         .getService(Components.interfaces.nsIWindowMediator);
-      win = wm.getMostRecentWindow("navigator:browser");
-    }
-    else
-      win = window.opener;
+    let homePage = document.getElementById("browser.startup.homepage");
+    let tabs = this._getTabsForHomePage();
+    function getTabURI(t) t.linkedBrowser.currentURI.spec;
 
-    if (win) {
-      var homePage = document.getElementById("browser.startup.homepage");
-      var tabs = win.gBrowser.visibleTabs;
-      function getTabURI(t) t.linkedBrowser.currentURI.spec;
-      // FIXME Bug 244192: using dangerous "|" joiner!
+    // FIXME Bug 244192: using dangerous "|" joiner!
+    if (tabs.length)
       homePage.value = tabs.map(getTabURI).join("|");
-    }
   },
 
   /**
    * Displays a dialog in which the user can select a bookmark to use as home
    * page.  If the user selects a bookmark, that bookmark's name is displayed in
    * UI and the bookmark's address is stored to the home page preference.
    */
   setHomePageToBookmark: function ()
@@ -165,51 +155,54 @@ var gMainPane = {
     }
   },
 
   /**
    * Switches the "Use Current Page" button between its singular and plural
    * forms.
    */
   _updateUseCurrentButton: function () {
-    var useCurrent = document.getElementById("useCurrent");
+    let useCurrent = document.getElementById("useCurrent");
+
+    let tabs = this._getTabsForHomePage();
+    if (tabs.length > 1)
+      useCurrent.label = useCurrent.getAttribute("label2");
+    else
+      useCurrent.label = useCurrent.getAttribute("label1");
 
-    var windowIsPresent;
+    // In this case, the button's disabled state is set by preferences.xml.
+    if (document.getElementById
+        ("pref.browser.homepage.disable_button.current_page").locked)
+      return;
+
+    useCurrent.disabled = !tabs.length
+  },
+
+  _getTabsForHomePage: function ()
+  {
     var win;
+    var tabs = [];
     if (document.documentElement.instantApply) {
       const Cc = Components.classes, Ci = Components.interfaces;
       // If we're in instant-apply mode, use the most recent browser window
       var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
                  .getService(Ci.nsIWindowMediator);
       win = wm.getMostRecentWindow("navigator:browser");
     }
-    else
+    else {
       win = window.opener;
+    }
 
     if (win && win.document.documentElement
                   .getAttribute("windowtype") == "navigator:browser") {
-      windowIsPresent = true;
-
-      var tabbrowser = win.document.getElementById("content");
-      if (tabbrowser.browsers.length > 1)
-        useCurrent.label = useCurrent.getAttribute("label2");
-      else
-        useCurrent.label = useCurrent.getAttribute("label1");
-    }
-    else {
-      windowIsPresent = false;
-      useCurrent.label = useCurrent.getAttribute("label1");
+      // We should only include visible & non-pinned tabs
+      tabs = win.gBrowser.visibleTabs.slice(win.gBrowser._numPinnedTabs);
     }
 
-    // In this case, the button's disabled state is set by preferences.xml.
-    if (document.getElementById
-        ("pref.browser.homepage.disable_button.current_page").locked)
-      return;
-
-    useCurrent.disabled = !windowIsPresent;
+    return tabs;
   },
 
   /**
    * Restores the default home page as the user's home page.
    */
   restoreDefaultHomePage: function ()
   {
     var homePage = document.getElementById("browser.startup.homepage");
--- a/browser/components/sessionstore/Makefile.in
+++ b/browser/components/sessionstore/Makefile.in
@@ -45,13 +45,11 @@ XPIDL_MODULE = sessionstore
 
 XPIDLSRCS = \
 	nsISessionStartup.idl \
 	nsISessionStore.idl \
   $(NULL)
 
 DIRS = src
 
-ifdef ENABLE_TESTS
-DIRS += test/browser
-endif
+TEST_DIRS = test
 
 include $(topsrcdir)/config/rules.mk
rename from browser/components/sessionstore/test/browser/Makefile.in
rename to browser/components/sessionstore/test/Makefile.in
--- a/browser/components/sessionstore/test/browser/Makefile.in
+++ b/browser/components/sessionstore/test/Makefile.in
@@ -31,21 +31,21 @@
 # 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 *****
 
-DEPTH		= ../../../../..
+DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
-relativesrcdir  = browser/components/sessionstore/test/browser 
+relativesrcdir  = browser/components/sessionstore/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 # browser_506482.js is disabled because of frequent failures (bug 538672)
 # browser_526613.js is disabled because of frequent failures (bug 534489)
 
 _BROWSER_TEST_FILES = \
rename from browser/components/sessionstore/test/browser/browser_248970_a.js
rename to browser/components/sessionstore/test/browser_248970_a.js
rename from browser/components/sessionstore/test/browser/browser_248970_b.js
rename to browser/components/sessionstore/test/browser_248970_b.js
--- a/browser/components/sessionstore/test/browser/browser_248970_b.js
+++ b/browser/components/sessionstore/test/browser_248970_b.js
@@ -111,17 +111,17 @@ function test() {
 
   //////////////////////////////////////////////////////////////////
   // Test (B) : Session data restoration between modes            //
   //////////////////////////////////////////////////////////////////
 
   let rootDir = getRootDirectory(gTestPath);
   const testURL = rootDir + "browser_248970_b_sample.html";
   const testURL2 = "http://mochi.test:8888/browser/" +
-  "browser/components/sessionstore/test/browser/browser_248970_b_sample.html";
+  "browser/components/sessionstore/test/browser_248970_b_sample.html";
 
   // get closed tab count
   let count = ss.getClosedTabCount(window);
   let max_tabs_undo = gPrefService.getIntPref("browser.sessionstore.max_tabs_undo");
   ok(0 <= count && count <= max_tabs_undo,
     "getClosedTabCount should return zero or at most max_tabs_undo");
 
   // setup a state for tab (A) so we can check later that is restored
rename from browser/components/sessionstore/test/browser/browser_248970_b_sample.html
rename to browser/components/sessionstore/test/browser_248970_b_sample.html
rename from browser/components/sessionstore/test/browser/browser_339445.js
rename to browser/components/sessionstore/test/browser_339445.js
--- a/browser/components/sessionstore/test/browser/browser_339445.js
+++ b/browser/components/sessionstore/test/browser_339445.js
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 339445 **/
   
   waitForExplicitFinish();
   
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_339445_sample.html";
+    "browser/components/sessionstore/test/browser_339445_sample.html";
   
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     this.removeEventListener("load", arguments.callee, true);
     let doc = tab.linkedBrowser.contentDocument;
     is(doc.getElementById("storageTestItem").textContent, "PENDING",
        "sessionStorage value has been set");
     
rename from browser/components/sessionstore/test/browser/browser_339445_sample.html
rename to browser/components/sessionstore/test/browser_339445_sample.html
rename from browser/components/sessionstore/test/browser/browser_345898.js
rename to browser/components/sessionstore/test/browser_345898.js
rename from browser/components/sessionstore/test/browser/browser_346337.js
rename to browser/components/sessionstore/test/browser_346337.js
rename from browser/components/sessionstore/test/browser/browser_346337_sample.html
rename to browser/components/sessionstore/test/browser_346337_sample.html
rename from browser/components/sessionstore/test/browser/browser_350525.js
rename to browser/components/sessionstore/test/browser_350525.js
rename from browser/components/sessionstore/test/browser/browser_354894.js
rename to browser/components/sessionstore/test/browser_354894.js
rename from browser/components/sessionstore/test/browser/browser_367052.js
rename to browser/components/sessionstore/test/browser_367052.js
rename from browser/components/sessionstore/test/browser/browser_393716.js
rename to browser/components/sessionstore/test/browser_393716.js
rename from browser/components/sessionstore/test/browser/browser_394759_basic.js
rename to browser/components/sessionstore/test/browser_394759_basic.js
rename from browser/components/sessionstore/test/browser/browser_394759_behavior.js
rename to browser/components/sessionstore/test/browser_394759_behavior.js
rename from browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js
rename to browser/components/sessionstore/test/browser_394759_privatebrowsing.js
rename from browser/components/sessionstore/test/browser/browser_394759_purge.js
rename to browser/components/sessionstore/test/browser_394759_purge.js
rename from browser/components/sessionstore/test/browser/browser_408470.js
rename to browser/components/sessionstore/test/browser_408470.js
rename from browser/components/sessionstore/test/browser/browser_408470_sample.html
rename to browser/components/sessionstore/test/browser_408470_sample.html
rename from browser/components/sessionstore/test/browser/browser_423132.js
rename to browser/components/sessionstore/test/browser_423132.js
--- a/browser/components/sessionstore/test/browser/browser_423132.js
+++ b/browser/components/sessionstore/test/browser_423132.js
@@ -43,17 +43,17 @@ function test() {
   let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
   cs.removeAll();
 
   // make sure that sessionstore.js can be forced to be created by setting
   // the interval pref to 0
   gPrefService.setIntPref("browser.sessionstore.interval", 0);
 
   const testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_423132_sample.html";
+    "browser/components/sessionstore/test/browser_423132_sample.html";
 
   // open a new window
   let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:blank");
 
   // make sure sessionstore saves the cookie data, then close the window
   newWin.addEventListener("load", function (aEvent) {
     newWin.removeEventListener("load", arguments.callee, false);
 
rename from browser/components/sessionstore/test/browser/browser_423132_sample.html
rename to browser/components/sessionstore/test/browser_423132_sample.html
rename from browser/components/sessionstore/test/browser/browser_447951.js
rename to browser/components/sessionstore/test/browser_447951.js
--- a/browser/components/sessionstore/test/browser/browser_447951.js
+++ b/browser/components/sessionstore/test/browser_447951.js
@@ -34,17 +34,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 447951 **/
   
   waitForExplicitFinish();
   const baseURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_447951_sample.html#";
+    "browser/components/sessionstore/test/browser_447951_sample.html#";
     
   let tab = gBrowser.addTab();
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
     
     let tabState = { entries: [] };
     let max_entries = gPrefService.getIntPref("browser.sessionhistory.max_entries");
     for (let i = 0; i < max_entries; i++)
rename from browser/components/sessionstore/test/browser/browser_447951_sample.html
rename to browser/components/sessionstore/test/browser_447951_sample.html
rename from browser/components/sessionstore/test/browser/browser_448741.js
rename to browser/components/sessionstore/test/browser_448741.js
rename from browser/components/sessionstore/test/browser/browser_454908.js
rename to browser/components/sessionstore/test/browser_454908.js
rename from browser/components/sessionstore/test/browser/browser_454908_sample.html
rename to browser/components/sessionstore/test/browser_454908_sample.html
rename from browser/components/sessionstore/test/browser/browser_456342.js
rename to browser/components/sessionstore/test/browser_456342.js
rename from browser/components/sessionstore/test/browser/browser_456342_sample.xhtml
rename to browser/components/sessionstore/test/browser_456342_sample.xhtml
rename from browser/components/sessionstore/test/browser/browser_459906.js
rename to browser/components/sessionstore/test/browser_459906.js
--- a/browser/components/sessionstore/test/browser/browser_459906.js
+++ b/browser/components/sessionstore/test/browser_459906.js
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 459906 **/
 
   waitForExplicitFinish();
 
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_459906_sample.html";
+    "browser/components/sessionstore/test/browser_459906_sample.html";
   let uniqueValue = "<b>Unique:</b> " + Date.now();
 
   var frameCount = 0;
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     // wait for all frames to load completely
     if (frameCount++ < 2)
       return;
rename from browser/components/sessionstore/test/browser/browser_459906_empty.html
rename to browser/components/sessionstore/test/browser_459906_empty.html
rename from browser/components/sessionstore/test/browser/browser_459906_sample.html
rename to browser/components/sessionstore/test/browser_459906_sample.html
rename from browser/components/sessionstore/test/browser/browser_461634.js
rename to browser/components/sessionstore/test/browser_461634.js
rename from browser/components/sessionstore/test/browser/browser_461743.js
rename to browser/components/sessionstore/test/browser_461743.js
--- a/browser/components/sessionstore/test/browser/browser_461743.js
+++ b/browser/components/sessionstore/test/browser_461743.js
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 461743 **/
 
   waitForExplicitFinish();
 
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_461743_sample.html";
+    "browser/components/sessionstore/test/browser_461743_sample.html";
 
   let frameCount = 0;
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     // Wait for all frames to load completely.
     if (frameCount++ < 2)
       return;
     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
rename from browser/components/sessionstore/test/browser/browser_461743_sample.html
rename to browser/components/sessionstore/test/browser_461743_sample.html
rename from browser/components/sessionstore/test/browser/browser_463205.js
rename to browser/components/sessionstore/test/browser_463205.js
--- a/browser/components/sessionstore/test/browser/browser_463205.js
+++ b/browser/components/sessionstore/test/browser_463205.js
@@ -93,17 +93,17 @@ function test() {
     
     let uniqueValue = "Unique: " + Math.random();
     let win = tab.linkedBrowser.contentWindow;
     typeText(win.frames[0].document.getElementById("original"), uniqueValue);
     typeText(win.frames[1].document.getElementById("original"), uniqueValue);
 
     mainURL = testURL;
     frame1URL = "http://mochi.test:8888/browser/" +
-      "browser/components/sessionstore/test/browser/browser_463205_helper.html";
+      "browser/components/sessionstore/test/browser_463205_helper.html";
     frame2URL = rootDir + "browser_463205_helper.html";
     frame3URL = "data:text/html,mark2";
 
     frameCount = 0;
 
     let tab2 = gBrowser.duplicateTab(tab);
     tab2.linkedBrowser.addEventListener("load", function(aEvent) {
       // wait for all frames to load (and reload!) completely
rename from browser/components/sessionstore/test/browser/browser_463205_helper.html
rename to browser/components/sessionstore/test/browser_463205_helper.html
rename from browser/components/sessionstore/test/browser/browser_463205_sample.html
rename to browser/components/sessionstore/test/browser_463205_sample.html
--- a/browser/components/sessionstore/test/browser/browser_463205_sample.html
+++ b/browser/components/sessionstore/test/browser_463205_sample.html
@@ -13,13 +13,13 @@
     frames[2].removeEventListener("DOMContentLoaded", arguments.callee, false);
     
     if (frames[2].document.location.href == "data:text/html,mark1") {
       frames[2].document.location = "data:text/html,mark2";
     }
     else {
       frames[1].document.location.hash = "#original";
       frames[0].document.location = "http://mochi.test:8888/browser/" +
-        "browser/components/sessionstore/test/browser/browser_463205_helper.html";
+        "browser/components/sessionstore/test/browser_463205_helper.html";
     }
   }, false);
 </script>
 </body>
rename from browser/components/sessionstore/test/browser/browser_463206.js
rename to browser/components/sessionstore/test/browser_463206.js
--- a/browser/components/sessionstore/test/browser/browser_463206.js
+++ b/browser/components/sessionstore/test/browser_463206.js
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 463206 **/
   
   waitForExplicitFinish();
   
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_463206_sample.html";
+    "browser/components/sessionstore/test/browser_463206_sample.html";
   
   var frameCount = 0;
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     // wait for all frames to load completely
     if (frameCount++ < 5)
       return;
     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
rename from browser/components/sessionstore/test/browser/browser_463206_sample.html
rename to browser/components/sessionstore/test/browser_463206_sample.html
rename from browser/components/sessionstore/test/browser/browser_464199.js
rename to browser/components/sessionstore/test/browser_464199.js
rename from browser/components/sessionstore/test/browser/browser_464620_a.html
rename to browser/components/sessionstore/test/browser_464620_a.html
--- a/browser/components/sessionstore/test/browser/browser_464620_a.html
+++ b/browser/components/sessionstore/test/browser_464620_a.html
@@ -2,17 +2,17 @@
 
 <title>Test for bug 464620 (injection on input)</title>
 
 <iframe></iframe>
 <iframe onload="setup()"></iframe>
 
 <script>
   var targetUrl = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_464620_xd.html";
+    "browser/components/sessionstore/test/browser_464620_xd.html";
   var firstPass;
   
   function setup() {
     if (firstPass !== undefined)
       return;
     firstPass = frames[1].location.href == "about:blank";
     if (firstPass) {
       frames[0].location = 'data:text/html,<body onload="if (parent.firstPass) parent.step();"><input id="x" oninput="parent.xss()">XXX</body>';
rename from browser/components/sessionstore/test/browser/browser_464620_a.js
rename to browser/components/sessionstore/test/browser_464620_a.js
--- a/browser/components/sessionstore/test/browser/browser_464620_a.js
+++ b/browser/components/sessionstore/test/browser_464620_a.js
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 464620 (injection on input) **/
   
   waitForExplicitFinish();
   
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_464620_a.html";
+    "browser/components/sessionstore/test/browser_464620_a.html";
   
   var frameCount = 0;
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     // wait for all frames to load completely
     if (frameCount++ < 4)
       return;
     this.removeEventListener("load", arguments.callee, true);
rename from browser/components/sessionstore/test/browser/browser_464620_b.html
rename to browser/components/sessionstore/test/browser_464620_b.html
--- a/browser/components/sessionstore/test/browser/browser_464620_b.html
+++ b/browser/components/sessionstore/test/browser_464620_b.html
@@ -3,17 +3,17 @@
 <title>Test for bug 464620 (injection on DOM node insertion)</title>
 
 <iframe></iframe>
 <iframe></iframe>
 <iframe onload="setup()"></iframe>
 
 <script>
   var targetUrl = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_464620_xd.html";
+    "browser/components/sessionstore/test/browser_464620_xd.html";
   var firstPass;
   
   function setup() {
     if (firstPass !== undefined)
       return;
     firstPass = frames[2].location.href == "about:blank";
     if (firstPass) {
       frames[0].location = 'data:text/html,<body onload="parent.step()">a</body>';
rename from browser/components/sessionstore/test/browser/browser_464620_b.js
rename to browser/components/sessionstore/test/browser_464620_b.js
--- a/browser/components/sessionstore/test/browser/browser_464620_b.js
+++ b/browser/components/sessionstore/test/browser_464620_b.js
@@ -35,17 +35,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   /** Test for Bug 464620 (injection on DOM node insertion) **/
   
   waitForExplicitFinish();
   
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_464620_b.html";
+    "browser/components/sessionstore/test/browser_464620_b.html";
   
   var frameCount = 0;
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     // wait for all frames to load completely
     if (frameCount++ < 6)
       return;
     this.removeEventListener("load", arguments.callee, true);
rename from browser/components/sessionstore/test/browser/browser_464620_xd.html
rename to browser/components/sessionstore/test/browser_464620_xd.html
rename from browser/components/sessionstore/test/browser/browser_465215.js
rename to browser/components/sessionstore/test/browser_465215.js
rename from browser/components/sessionstore/test/browser/browser_465223.js
rename to browser/components/sessionstore/test/browser_465223.js
rename from browser/components/sessionstore/test/browser/browser_466937.js
rename to browser/components/sessionstore/test/browser_466937.js
--- a/browser/components/sessionstore/test/browser/browser_466937.js
+++ b/browser/components/sessionstore/test/browser_466937.js
@@ -42,17 +42,17 @@ function test() {
   var file = Components.classes["@mozilla.org/file/directory_service;1"]
              .getService(Components.interfaces.nsIProperties)
              .get("TmpD", Components.interfaces.nsILocalFile);
   file.append("466937_test.file");
   file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
   let testPath = file.path;
   
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_466937_sample.html";
+    "browser/components/sessionstore/test/browser_466937_sample.html";
   
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
     let doc = tab.linkedBrowser.contentDocument;
     doc.getElementById("reverse_thief").value = "/home/user/secret2";
     doc.getElementById("bystander").value = testPath;
     
rename from browser/components/sessionstore/test/browser/browser_466937_sample.html
rename to browser/components/sessionstore/test/browser_466937_sample.html
rename from browser/components/sessionstore/test/browser/browser_467409-backslashplosion.js
rename to browser/components/sessionstore/test/browser_467409-backslashplosion.js
rename from browser/components/sessionstore/test/browser/browser_477657.js
rename to browser/components/sessionstore/test/browser_477657.js
rename from browser/components/sessionstore/test/browser/browser_480148.js
rename to browser/components/sessionstore/test/browser_480148.js
rename from browser/components/sessionstore/test/browser/browser_480893.js
rename to browser/components/sessionstore/test/browser_480893.js
rename from browser/components/sessionstore/test/browser/browser_483330.js
rename to browser/components/sessionstore/test/browser_483330.js
rename from browser/components/sessionstore/test/browser/browser_485482.js
rename to browser/components/sessionstore/test/browser_485482.js
rename from browser/components/sessionstore/test/browser/browser_485482_sample.html
rename to browser/components/sessionstore/test/browser_485482_sample.html
rename from browser/components/sessionstore/test/browser/browser_485563.js
rename to browser/components/sessionstore/test/browser_485563.js
rename from browser/components/sessionstore/test/browser/browser_490040.js
rename to browser/components/sessionstore/test/browser_490040.js
rename from browser/components/sessionstore/test/browser/browser_491168.js
rename to browser/components/sessionstore/test/browser_491168.js
rename from browser/components/sessionstore/test/browser/browser_491577.js
rename to browser/components/sessionstore/test/browser_491577.js
rename from browser/components/sessionstore/test/browser/browser_493467.js
rename to browser/components/sessionstore/test/browser_493467.js
rename from browser/components/sessionstore/test/browser/browser_495495.js
rename to browser/components/sessionstore/test/browser_495495.js
rename from browser/components/sessionstore/test/browser/browser_500328.js
rename to browser/components/sessionstore/test/browser_500328.js
rename from browser/components/sessionstore/test/browser/browser_506482.js
rename to browser/components/sessionstore/test/browser_506482.js
rename from browser/components/sessionstore/test/browser/browser_514751.js
rename to browser/components/sessionstore/test/browser_514751.js
rename from browser/components/sessionstore/test/browser/browser_522375.js
rename to browser/components/sessionstore/test/browser_522375.js
rename from browser/components/sessionstore/test/browser/browser_522545.js
rename to browser/components/sessionstore/test/browser_522545.js
rename from browser/components/sessionstore/test/browser/browser_524745.js
rename to browser/components/sessionstore/test/browser_524745.js
rename from browser/components/sessionstore/test/browser/browser_526613.js
rename to browser/components/sessionstore/test/browser_526613.js
rename from browser/components/sessionstore/test/browser/browser_528776.js
rename to browser/components/sessionstore/test/browser_528776.js
rename from browser/components/sessionstore/test/browser/browser_579868.js
rename to browser/components/sessionstore/test/browser_579868.js
rename from browser/components/sessionstore/test/browser/browser_579879.js
rename to browser/components/sessionstore/test/browser_579879.js
rename from browser/components/sessionstore/test/browser/browser_580512.js
rename to browser/components/sessionstore/test/browser_580512.js
rename from browser/components/sessionstore/test/browser/browser_581593.js
rename to browser/components/sessionstore/test/browser_581593.js
rename from browser/components/sessionstore/test/browser/browser_581937.js
rename to browser/components/sessionstore/test/browser_581937.js
rename from browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js
rename to browser/components/sessionstore/test/browser_586068-cascaded_restore.js
rename from browser/components/sessionstore/test/browser/browser_586147.js
rename to browser/components/sessionstore/test/browser_586147.js
rename from browser/components/sessionstore/test/browser/browser_588426.js
rename to browser/components/sessionstore/test/browser_588426.js
rename from browser/components/sessionstore/test/browser/browser_589246.js
rename to browser/components/sessionstore/test/browser_589246.js
rename from browser/components/sessionstore/test/browser/browser_590268.js
rename to browser/components/sessionstore/test/browser_590268.js
rename from browser/components/sessionstore/test/browser/browser_590563.js
rename to browser/components/sessionstore/test/browser_590563.js
rename from browser/components/sessionstore/test/browser/browser_595601-restore_hidden.js
rename to browser/components/sessionstore/test/browser_595601-restore_hidden.js
rename from browser/components/sessionstore/test/browser/browser_597071.js
rename to browser/components/sessionstore/test/browser_597071.js
rename from browser/components/sessionstore/test/browser/browser_597315.js
rename to browser/components/sessionstore/test/browser_597315.js
rename from browser/components/sessionstore/test/browser/browser_597315_a.html
rename to browser/components/sessionstore/test/browser_597315_a.html
rename from browser/components/sessionstore/test/browser/browser_597315_b.html
rename to browser/components/sessionstore/test/browser_597315_b.html
rename from browser/components/sessionstore/test/browser/browser_597315_c.html
rename to browser/components/sessionstore/test/browser_597315_c.html
rename from browser/components/sessionstore/test/browser/browser_597315_c1.html
rename to browser/components/sessionstore/test/browser_597315_c1.html
rename from browser/components/sessionstore/test/browser/browser_597315_c2.html
rename to browser/components/sessionstore/test/browser_597315_c2.html
rename from browser/components/sessionstore/test/browser/browser_597315_index.html
rename to browser/components/sessionstore/test/browser_597315_index.html
rename from browser/components/sessionstore/test/browser/browser_599909.js
rename to browser/components/sessionstore/test/browser_599909.js
rename from browser/components/sessionstore/test/browser/browser_600545.js
rename to browser/components/sessionstore/test/browser_600545.js
rename from browser/components/sessionstore/test/browser/browser_601955.js
rename to browser/components/sessionstore/test/browser_601955.js
rename from browser/components/sessionstore/test/browser/browser_607016.js
rename to browser/components/sessionstore/test/browser_607016.js
rename from browser/components/sessionstore/test/browser/browser_615394-SSWindowState_events.js
rename to browser/components/sessionstore/test/browser_615394-SSWindowState_events.js
rename from browser/components/sessionstore/test/browser/browser_618151.js
rename to browser/components/sessionstore/test/browser_618151.js
rename from browser/components/sessionstore/test/browser/browser_623779.js
rename to browser/components/sessionstore/test/browser_623779.js
rename from browser/components/sessionstore/test/browser/browser_624727.js
rename to browser/components/sessionstore/test/browser_624727.js
rename from browser/components/sessionstore/test/browser/browser_625016.js
rename to browser/components/sessionstore/test/browser_625016.js
rename from browser/components/sessionstore/test/browser/browser_625257.js
rename to browser/components/sessionstore/test/browser_625257.js
rename from browser/components/sessionstore/test/browser/browser_628270.js
rename to browser/components/sessionstore/test/browser_628270.js
rename from browser/components/sessionstore/test/browser/browser_635418.js
rename to browser/components/sessionstore/test/browser_635418.js
rename from browser/components/sessionstore/test/browser/browser_636279.js
rename to browser/components/sessionstore/test/browser_636279.js
rename from browser/components/sessionstore/test/browser/browser_644409-scratchpads.js
rename to browser/components/sessionstore/test/browser_644409-scratchpads.js
--- a/browser/components/sessionstore/test/browser/browser_644409-scratchpads.js
+++ b/browser/components/sessionstore/test/browser_644409-scratchpads.js
@@ -33,27 +33,35 @@ function test() {
   Services.ww.registerNotification(windowObserver);
 
   ss.setBrowserState(JSON.stringify(testState));
 }
 
 function windowObserver(aSubject, aTopic, aData) {
   if (aTopic == "domwindowopened") {     
     let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
-    win.addEventListener("load", function() {
+    win.addEventListener("load", function onLoad() {
+      win.removeEventListener("load", onLoad, false);
+
       if (win.Scratchpad) {
-        let state = win.Scratchpad.getState();
-        win.close();
-        addState(state);
+        win.Scratchpad.addObserver({
+          onReady: function() {
+            win.Scratchpad.removeObserver(this);
+
+            let state = win.Scratchpad.getState();
+            win.close();
+            addState(state);
+          },
+        });
       }
     }, false);
   }
 }
 
 function statesMatch(restored, states) {
   return states.every(function(state) {
     return restored.some(function(restoredState) {
       return state.filename == restoredState.filename &&
              state.text == restoredState.text &&
              state.executionContext == restoredState.executionContext;
     })
   });
-}
\ No newline at end of file
+}
rename from browser/components/sessionstore/test/browser/browser_645428.js
rename to browser/components/sessionstore/test/browser_645428.js
rename from browser/components/sessionstore/test/browser/browser_659591.js
rename to browser/components/sessionstore/test/browser_659591.js
rename from browser/components/sessionstore/test/browser/browser_662812.js
rename to browser/components/sessionstore/test/browser_662812.js
rename from browser/components/sessionstore/test/browser/browser_665702-state_session.js
rename to browser/components/sessionstore/test/browser_665702-state_session.js
rename from browser/components/sessionstore/test/browser/browser_682507.js
rename to browser/components/sessionstore/test/browser_682507.js
rename from browser/components/sessionstore/test/browser/browser_687710.js
rename to browser/components/sessionstore/test/browser_687710.js
rename from browser/components/sessionstore/test/browser/browser_687710_2.js
rename to browser/components/sessionstore/test/browser_687710_2.js
rename from browser/components/sessionstore/test/browser/browser_694378.js
rename to browser/components/sessionstore/test/browser_694378.js
rename from browser/components/sessionstore/test/browser/browser_705597.js
rename to browser/components/sessionstore/test/browser_705597.js
rename from browser/components/sessionstore/test/browser/browser_form_restore_events.js
rename to browser/components/sessionstore/test/browser_form_restore_events.js
--- a/browser/components/sessionstore/test/browser/browser_form_restore_events.js
+++ b/browser/components/sessionstore/test/browser_form_restore_events.js
@@ -39,17 +39,17 @@ function test() {
 
   waitForExplicitFinish();
 
   let file = Components.classes["@mozilla.org/file/directory_service;1"]
              .getService(Components.interfaces.nsIProperties)
              .get("TmpD", Components.interfaces.nsIFile);
 
   let testURL = "http://mochi.test:8888/browser/" +
-    "browser/components/sessionstore/test/browser/browser_form_restore_events_sample.html";
+    "browser/components/sessionstore/test/browser_form_restore_events_sample.html";
   let tab = gBrowser.addTab(testURL);
   tab.linkedBrowser.addEventListener("load", function(aEvent) {
     tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
     let doc = tab.linkedBrowser.contentDocument;
 
     // text fields
     doc.getElementById("modify01").value += Math.random();
     doc.getElementById("modify02").value += " " + Date.now();
rename from browser/components/sessionstore/test/browser/browser_form_restore_events_sample.html
rename to browser/components/sessionstore/test/browser_form_restore_events_sample.html
rename from browser/components/sessionstore/test/browser/head.js
rename to browser/components/sessionstore/test/head.js
rename from browser/components/sidebar/src/Makefile.in
rename to browser/components/sidebar/Makefile.in
--- a/browser/components/sidebar/src/Makefile.in
+++ b/browser/components/sidebar/Makefile.in
@@ -30,17 +30,17 @@
 # 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 *****
 
-DEPTH		= ../../../..
+DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 EXTRA_COMPONENTS = nsSidebar.manifest
 EXTRA_PP_COMPONENTS = nsSidebar.js
rename from browser/components/sidebar/src/nsSidebar.js
rename to browser/components/sidebar/nsSidebar.js
rename from browser/components/sidebar/src/nsSidebar.manifest
rename to browser/components/sidebar/nsSidebar.manifest
--- a/browser/components/tabview/test/Makefile.in
+++ b/browser/components/tabview/test/Makefile.in
@@ -69,17 +69,16 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug595804.js \
                  browser_tabview_bug595930.js \
                  browser_tabview_bug595943.js \
                  browser_tabview_bug595965.js \
                  browser_tabview_bug596781.js \
                  browser_tabview_bug597248.js \
                  browser_tabview_bug597360.js \
                  browser_tabview_bug597399.js \
-                 browser_tabview_bug597980.js \
                  browser_tabview_bug598375.js \
                  browser_tabview_bug598600.js \
                  browser_tabview_bug599048.js \
                  browser_tabview_bug599626.js \
                  browser_tabview_bug600645.js \
                  browser_tabview_bug600812.js \
                  browser_tabview_bug602432.js \
                  browser_tabview_bug604098.js \
@@ -189,10 +188,12 @@ include $(topsrcdir)/config/rules.mk
                  dummy_page.html \
                  head.js \
                  search1.html \
                  search2.html \
                  test_bug600645.html \
                  test_bug644097.html \
                  $(NULL)
 
+# browser_tabview_bug597980.js is disabled for leaking, see bug 711907
+
 libs::	$(_BROWSER_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
rename from browser/components/test/browser/Makefile.in
rename to browser/components/test/Makefile.in
--- a/browser/components/test/browser/Makefile.in
+++ b/browser/components/test/Makefile.in
@@ -30,21 +30,21 @@
 # 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 *****
 
-DEPTH     = ../../../..
+DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
-relativesrcdir  = browser/components/test/browser
+relativesrcdir  = browser/components/test
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_TEST_FILES = \
   browser_bug538331.js \
   $(NULL)
 
rename from browser/components/test/browser/browser_bug538331.js
rename to browser/components/test/browser_bug538331.js
--- a/browser/config/mozconfigs/macosx-universal/nightly
+++ b/browser/config/mozconfigs/macosx-universal/nightly
@@ -11,8 +11,10 @@ ac_add_options --disable-install-strip
 # Nightlies only since this has a cost in performance
 ac_add_options --enable-js-diagnostics
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 mk_add_options MOZ_MAKE_FLAGS="-j4"
+
+ac_add_options --with-macbundlename-prefix=Firefox
--- a/browser/config/mozconfigs/macosx32/debug
+++ b/browser/config/mozconfigs/macosx32/debug
@@ -2,8 +2,10 @@
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
+
+ac_add_options --with-macbundlename-prefix=Firefox
--- a/browser/config/mozconfigs/macosx64/debug
+++ b/browser/config/mozconfigs/macosx64/debug
@@ -4,8 +4,10 @@ ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 ac_add_options --enable-accessibility
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
+
+ac_add_options --with-macbundlename-prefix=Firefox
--- a/browser/devtools/Makefile.in
+++ b/browser/devtools/Makefile.in
@@ -47,13 +47,14 @@ include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/config.mk
 
 DIRS = \
   highlighter \
   webconsole \
   sourceeditor \
   styleeditor \
   styleinspector \
+  tilt \
   scratchpad \
   shared \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/highlighter/inspector.jsm
+++ b/browser/devtools/highlighter/inspector.jsm
@@ -923,16 +923,17 @@ InspectorUI.prototype = {
     this.win = this.browser.contentWindow;
     this.winID = this.getWindowID(this.win);
     this.toolbar = this.chromeDoc.getElementById("inspector-toolbar");
     this.inspectMenuitem = this.chromeDoc.getElementById("Tools:Inspect");
     this.inspectToolbutton =
       this.chromeDoc.getElementById("inspector-inspect-toolbutton");
 
     this.initTools();
+    this.chromeWin.Tilt.setup();
 
     if (this.treePanelEnabled) {
       this.treePanel = new TreePanel(this.chromeWin, this);
     }
 
     if (Services.prefs.getBoolPref("devtools.ruleview.enabled") &&
         !this.toolRegistered("ruleview")) {
       this.registerRuleView();
@@ -1185,16 +1186,17 @@ InspectorUI.prototype = {
     if (forceUpdate || aNode != this.selection) {
       this.selection = aNode;
       if (!this.inspecting) {
         this.highlighter.highlightNode(this.selection);
       }
     }
 
     this.breadcrumbs.update();
+    this.chromeWin.Tilt.update(aNode);
 
     this.toolsSelect(aScroll);
   },
 
   /**
    * Called when the highlighted node is changed by a tool.
    *
    * @param object aUpdater
--- a/browser/devtools/highlighter/test/browser_inspector_duplicate_ruleview.js
+++ b/browser/devtools/highlighter/test/browser_inspector_duplicate_ruleview.js
@@ -106,17 +106,16 @@ function inspectorRuleTrap()
   Services.obs.removeObserver(inspectorRuleTrap,
     InspectorUI.INSPECTOR_NOTIFICATIONS.RULEVIEWREADY, false);
   is(InspectorUI.ruleView.doc.documentElement.children.length, 1, "RuleView elements.length == 1");
 }
 
 function test()
 {
   waitForExplicitFinish();
-  ignoreAllUncaughtExceptions();
 
   tab1 = gBrowser.addTab();
   gBrowser.selectedTab = tab1;
   gBrowser.selectedBrowser.addEventListener("load", function(evt) {
     gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
       true);
     waitForFocus(inspectorTabOpen1, content);
   }, true);
--- a/browser/devtools/highlighter/test/browser_inspector_initialization.js
+++ b/browser/devtools/highlighter/test/browser_inspector_initialization.js
@@ -217,17 +217,16 @@ function finishInspectorTests(subject, t
   Services.obs.removeObserver(inspectNodesFromContextTestTrap, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED);
   gBrowser.removeCurrentTab();
   finish();
 }
 
 function test()
 {
   waitForExplicitFinish();
-  ignoreAllUncaughtExceptions();
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function() {
     gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
     doc = content.document;
     waitForFocus(createDocument, content);
   }, true);
 
   content.location = "data:text/html,basic tests for inspector";
--- a/browser/devtools/highlighter/test/browser_inspector_ruleviewstore.js
+++ b/browser/devtools/highlighter/test/browser_inspector_ruleviewstore.js
@@ -132,17 +132,16 @@ function ruleViewOpened2()
   gBrowser.removeCurrentTab();
   InspectorUI.closeInspectorUI();
   finish();
 }
 
 function test()
 {
   waitForExplicitFinish();
-  ignoreAllUncaughtExceptions();
 
   tab1 = gBrowser.addTab();
   gBrowser.selectedTab = tab1;
   gBrowser.selectedBrowser.addEventListener("load", function(evt) {
     gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
       true);
     waitForFocus(inspectorTabOpen1, content);
   }, true);
--- a/browser/devtools/jar.mn
+++ b/browser/devtools/jar.mn
@@ -1,13 +1,13 @@
 browser.jar:
 *   content/browser/inspector.html                (highlighter/inspector.html)
     content/browser/NetworkPanel.xhtml            (webconsole/NetworkPanel.xhtml)
 *   content/browser/scratchpad.xul                (scratchpad/scratchpad.xul)
-*   content/browser/scratchpad.js                 (scratchpad/scratchpad.js)
+    content/browser/scratchpad.js                 (scratchpad/scratchpad.js)
 *   content/browser/styleeditor.xul               (styleeditor/styleeditor.xul)
     content/browser/splitview.css                 (styleeditor/splitview.css)
     content/browser/styleeditor.css               (styleeditor/styleeditor.css)
     content/browser/devtools/csshtmltree.xul      (styleinspector/csshtmltree.xul)
     content/browser/devtools/cssruleview.xul      (styleinspector/cssruleview.xul)
     content/browser/devtools/styleinspector.css   (styleinspector/styleinspector.css)
     content/browser/orion.js                      (sourceeditor/orion/orion.js)
     content/browser/orion.css                     (sourceeditor/orion/orion.css)
--- a/browser/devtools/scratchpad/scratchpad-manager.jsm
+++ b/browser/devtools/scratchpad/scratchpad-manager.jsm
@@ -99,17 +99,17 @@ var ScratchpadManager = {
    * Iterate through open scratchpad windows and save their states.
    */
   saveOpenWindows: function SPM_saveOpenWindows() {
     this._scratchpads = [];
 
     let enumerator = Services.wm.getEnumerator("devtools:scratchpad");
     while (enumerator.hasMoreElements()) {
       let win = enumerator.getNext();
-      if (!win.closed) {
+      if (!win.closed && win.Scratchpad.initialized) {
         this._scratchpads.push(win.Scratchpad.getState());
       }
     }
   },
 
   /**
    * Open a new scratchpad window with an optional initial state.
    *
--- a/browser/devtools/scratchpad/scratchpad.js
+++ b/browser/devtools/scratchpad/scratchpad.js
@@ -82,16 +82,23 @@ var Scratchpad = {
    *   - SCRATCHPAD_CONTEXT_CONTENT to execute code in the context of the current
    *   tab content window object.
    *   - SCRATCHPAD_CONTEXT_BROWSER to execute code in the context of the
    *   currently active chrome window object.
    */
   executionContext: SCRATCHPAD_CONTEXT_CONTENT,
 
   /**
+   * Tells if this Scratchpad is initialized and ready for use.
+   * @boolean
+   * @see addObserver
+   */
+  initialized: false,
+
+  /**
    * Retrieve the xul:notificationbox DOM element. It notifies the user when
    * the current code execution context is SCRATCHPAD_CONTEXT_BROWSER.
    */
   get notificationBox() document.getElementById("scratchpad-notificationbox"),
 
   /**
    * Get the selected text from the editor.
    *
@@ -728,17 +735,17 @@ var Scratchpad = {
    */
   getInnerWindowId: function SP_getInnerWindowId(aWindow)
   {
     return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
            getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
   },
 
   /**
-   * The Scratchpad window DOMContentLoaded event handler. This method
+   * The Scratchpad window load event handler. This method
    * initializes the Scratchpad window and source editor.
    *
    * @param nsIDOMEvent aEvent
    */
   onLoad: function SP_onLoad(aEvent)
   {
     if (aEvent.target != document) {
       return;
@@ -779,17 +786,19 @@ var Scratchpad = {
    * editor initialization.
    */
   onEditorLoad: function SP_onEditorLoad()
   {
     this.editor.addEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
                                  this.onContextMenu);
     this.editor.focus();
     this.editor.setCaretOffset(this.editor.getCharCount());
-    
+
+    this.initialized = true;
+
     if (this.filename && !this.saved) {
       this.onTextChanged();
     }
     else if (this.filename && this.saved) {
       this.onTextSaved();
     }
 
     this._triggerObservers("Ready");
@@ -861,17 +870,17 @@ var Scratchpad = {
    * This method adds a listener to the editor for text changes. Called when
    * a scratchpad is saved, opened from file, or restored from a saved file.
    */
   onTextSaved: function SP_onTextSaved(aStatus)
   {
     if (aStatus && !Components.isSuccessCode(aStatus)) {
       return;
     }
-    if (!document) {
+    if (!document || !this.initialized) {
       return;  // file saved to disk after window has closed
     }
     document.title = document.title.replace(/^\*/, "");
     this.saved = true;
     this.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
                                  this.onTextChanged);
   },
 
@@ -899,16 +908,17 @@ var Scratchpad = {
       return;
     }
 
     this.resetContext();
     this.editor.removeEventListener(SourceEditor.EVENTS.CONTEXT_MENU,
                                     this.onContextMenu);
     this.editor.destroy();
     this.editor = null;
+    this.initialized = false;
   },
 
   /**
    * Prompt to save scratchpad if it has unsaved changes.
    *
    * @param function aCallback
    *        Optional function you want to call when file is saved
    * @return boolean
@@ -1028,11 +1038,11 @@ var Scratchpad = {
     }
   }
 };
 
 XPCOMUtils.defineLazyGetter(Scratchpad, "strings", function () {
   return Services.strings.createBundle(SCRATCHPAD_L10N);
 });
 
-addEventListener("DOMContentLoaded", Scratchpad.onLoad.bind(Scratchpad), false);
+addEventListener("load", Scratchpad.onLoad.bind(Scratchpad), false);
 addEventListener("unload", Scratchpad.onUnload.bind(Scratchpad), false);
 addEventListener("close", Scratchpad.onClose.bind(Scratchpad), false);
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_646070_chrome_context_pref.js
@@ -1,39 +1,34 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-let gOldPref;
 let DEVTOOLS_CHROME_ENABLED = "devtools.chrome.enabled";
 
 function test()
 {
   waitForExplicitFinish();
 
-  gOldPref = Services.prefs.getBoolPref(DEVTOOLS_CHROME_ENABLED);
   Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, true);
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
 
-    ok(Scratchpad, "Scratchpad variable exists");
+    ok(window.Scratchpad, "Scratchpad variable exists");
 
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,Scratchpad test for bug 646070 - chrome context preference";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
 
   let environmentMenu = gScratchpadWindow.document.
                           getElementById("sp-environment-menu");
   ok(environmentMenu, "Environment menu element exists");
   ok(!environmentMenu.hasAttribute("hidden"),
      "Environment menu is visible");
@@ -45,12 +40,12 @@ function runTests()
      "Error console command is enabled");
 
   let chromeContextCommand = gScratchpadWindow.document.
                             getElementById("sp-cmd-browserContext");
   ok(chromeContextCommand, "Chrome context command element exists");
   ok(!chromeContextCommand.hasAttribute("disabled"),
      "Chrome context command is disabled");
 
-  Services.prefs.setBoolPref(DEVTOOLS_CHROME_ENABLED, gOldPref);
+  Services.prefs.clearUserPref(DEVTOOLS_CHROME_ENABLED);
 
   finish();
 }
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_653427_confirm_close.js
@@ -12,139 +12,122 @@ var count = 0;
 function done()
 {
   if (++count == expected) {
     cleanup();
     finish();
   }
 }
 
-var ScratchpadManager = Scratchpad.ScratchpadManager;
 var gFile;
 
 var oldPrompt = Services.prompt;
+var promptButton = -1;
 
 function test()
 {
   waitForExplicitFinish();
 
   gFile = createTempFile("fileForBug653427.tmp");
   writeFile(gFile, "text", testUnsaved.call(this));
 
+  Services.prompt = {
+    confirmEx: function() {
+      return promptButton;
+    }
+  };
+
   testNew();
   testSavedFile();
 
   content.location = "data:text/html,<p>test scratchpad save file prompt on closing";
 }
 
 function testNew()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function() {
+  openScratchpad(function(win) {
     win.Scratchpad.close();
-
     ok(win.closed, "new scratchpad window should close without prompting")
     done();
-  });
+  }, {noFocus: true});
 }
 
 function testSavedFile()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function() {
+  openScratchpad(function(win) {
     win.Scratchpad.filename = "test.js";
     win.Scratchpad.saved = true;
     win.Scratchpad.close();
 
     ok(win.closed, "scratchpad from file with no changes should close")
     done();
-  });
+  }, {noFocus: true});
 }
 
 function testUnsaved()
 {
   testUnsavedFileCancel();
   testUnsavedFileSave();
   testUnsavedFileDontSave();
 }
 
 function testUnsavedFileCancel()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function() {
+  openScratchpad(function(win) {
     win.Scratchpad.filename = "test.js";
     win.Scratchpad.saved = false;
 
-    Services.prompt = {
-      confirmEx: function() {
-        return win.BUTTON_POSITION_CANCEL;
-      }
-    }
+    promptButton = win.BUTTON_POSITION_CANCEL;
 
     win.Scratchpad.close();
 
     ok(!win.closed, "cancelling dialog shouldn't close scratchpad");
 
     win.close();
     done();
-  });
+  }, {noFocus: true});
 }
 
 function testUnsavedFileSave()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function() {
+  openScratchpad(function(win) {
     win.Scratchpad.importFromFile(gFile, true, function(status, content) {
       win.Scratchpad.filename = gFile.path;
       win.Scratchpad.onTextSaved();
 
       let text = "new text";
       win.Scratchpad.setText(text);
 
-      Services.prompt = {
-        confirmEx: function() {
-          return win.BUTTON_POSITION_SAVE;
-        }
-      }
+      promptButton = win.BUTTON_POSITION_SAVE;
 
       win.Scratchpad.close(function() {
         readFile(gFile, function(savedContent) {
           is(savedContent, text, 'prompted "Save" worked when closing scratchpad');
           done();
         });
       });
 
       ok(win.closed, 'pressing "Save" in dialog should close scratchpad');
     });
-  });
+  }, {noFocus: true});
 }
 
 function testUnsavedFileDontSave()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function() {
+  openScratchpad(function(win) {
     win.Scratchpad.filename = gFile.path;
     win.Scratchpad.saved = false;
 
-    Services.prompt = {
-      confirmEx: function() {
-        return win.BUTTON_POSITION_DONT_SAVE;
-      }
-    }
+    promptButton = win.BUTTON_POSITION_DONT_SAVE;
 
     win.Scratchpad.close();
 
     ok(win.closed, 'pressing "Don\'t Save" in dialog should close scratchpad');
     done();
-  });
+  }, {noFocus: true});
 }
 
 function cleanup()
 {
   Services.prompt = oldPrompt;
   gFile.remove(false);
   gFile = null;
 }
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_660560_tab.js
@@ -1,47 +1,35 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-var ScratchpadManager = Scratchpad.ScratchpadManager;
-
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
     gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
 
     ok(window.Scratchpad, "Scratchpad variable exists");
 
     Services.prefs.setIntPref("devtools.editor.tabsize", 5);
 
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", function onScratchpadLoad() {
-      gScratchpadWindow.removeEventListener("load", onScratchpadLoad, false);
-
-      gScratchpadWindow.Scratchpad.addObserver({
-        onReady: runTests
-      });
-    }, false);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,Scratchpad test for the Tab key, bug 660560";
 }
 
 function runTests()
 {
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
 
-  is(this.onReady, runTests, "the handler runs in the context of the observer");
-  sp.removeObserver(this);
-
   ok(sp.editor.hasFocus(), "the editor has focus");
 
   sp.setText("window.foo;");
   sp.editor.setCaretOffset(0);
 
   EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
 
   is(sp.getText(), "     window.foo;", "Tab key added 5 spaces");
@@ -65,29 +53,22 @@ function runTests()
 
   is(sp.editor.getCaretOffset(), 13, "caret location is correct after update");
 
   gScratchpadWindow.close();
 
   Services.prefs.setIntPref("devtools.editor.tabsize", 6);
   Services.prefs.setBoolPref("devtools.editor.expandtab", false);
 
-  gScratchpadWindow = Scratchpad.openScratchpad();
-  gScratchpadWindow.addEventListener("load", function onScratchpadLoad() {
-    gScratchpadWindow.removeEventListener("load", onScratchpadLoad, false);
-    gScratchpadWindow.Scratchpad.addObserver({
-      onReady: runTests2
-    });
-  }, false);
+  openScratchpad(runTests2);
 }
 
 function runTests2()
 {
   let sp = gScratchpadWindow.Scratchpad;
-  sp.removeObserver(this);
 
   sp.setText("window.foo;");
   sp.editor.setCaretOffset(0);
 
   EventUtils.synthesizeKey("VK_TAB", {}, gScratchpadWindow);
 
   is(sp.getText(), "\twindow.foo;", "Tab key added the tab character");
 
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_669612_unsaved.js
@@ -25,146 +25,102 @@ function test()
   testRestoreFromFileSaved();
   testRestoreFromFileUnsaved();
 
   content.location = "data:text/html,<p>test star* UI for unsaved file changes";
 }
 
 function testListeners()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
+  openScratchpad(function(aWin, aScratchpad) {
+    aScratchpad.setText("new text");
+    ok(!isStar(aWin), "no star if scratchpad isn't from a file");
 
-    win.Scratchpad.addObserver({
-      onReady: function (aScratchpad) {
-        aScratchpad.removeObserver(this);
+    aScratchpad.onTextSaved();
+    ok(!isStar(aWin), "no star before changing text");
 
-        aScratchpad.setText("new text");
-        ok(!isStar(win), "no star if scratchpad isn't from a file");
-
-        aScratchpad.onTextSaved();
-        ok(!isStar(win), "no star before changing text");
+    aScratchpad.setText("new text2");
+    ok(isStar(aWin), "shows star if scratchpad text changes");
 
-        aScratchpad.setText("new text2");
-        ok(isStar(win), "shows star if scratchpad text changes");
-
-        aScratchpad.onTextSaved();
-        ok(!isStar(win), "no star if scratchpad was just saved");
+    aScratchpad.onTextSaved();
+    ok(!isStar(aWin), "no star if scratchpad was just saved");
 
-        aScratchpad.undo();
-        ok(isStar(win), "star if scratchpad undo");
+    aScratchpad.undo();
+    ok(isStar(aWin), "star if scratchpad undo");
 
-        win.close();
-        done();
-      }
-    });
-  }, false);
+    aWin.close();
+    done();
+  }, {noFocus: true});
 }
 
 function testErrorStatus()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
-
-    win.Scratchpad.addObserver({
-      onReady: function (aScratchpad) {
-        aScratchpad.removeObserver(this);
+  openScratchpad(function(aWin, aScratchpad) {
+    aScratchpad.onTextSaved(Components.results.NS_ERROR_FAILURE);
+    aScratchpad.setText("new text");
+    ok(!isStar(aWin), "no star if file save failed");
 
-        aScratchpad.onTextSaved(Components.results.NS_ERROR_FAILURE);
-        aScratchpad.setText("new text");
-        ok(!isStar(win), "no star if file save failed");
-
-        win.close();
-        done();
-      }
-    });
-  }, false);
+    aWin.close();
+    done();
+  }, {noFocus: true});
 }
 
 
 function testRestoreNotFromFile()
 {
   let session = [{
     text: "test1",
     executionContext: 1
   }];
 
   let [win] = ScratchpadManager.restoreSession(session);
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
-
-    win.Scratchpad.addObserver({
-      onReady: function (aScratchpad) {
-        aScratchpad.removeObserver(this);
+  openScratchpad(function(aWin, aScratchpad) {
+    aScratchpad.setText("new text");
+    ok(!isStar(win), "no star if restored scratchpad isn't from a file");
 
-        aScratchpad.setText("new text");
-        ok(!isStar(win), "no star if restored scratchpad isn't from a file");
-
-        win.close();
-        done();
-      }
-    });
-  }, false);
+    win.close();
+    done();
+  }, {window: win, noFocus: true});
 }
 
 function testRestoreFromFileSaved()
 {
   let session = [{
     filename: "test.js",
     text: "test1",
     executionContext: 1,
     saved: true
   }];
 
   let [win] = ScratchpadManager.restoreSession(session);
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
-
-    win.Scratchpad.addObserver({
-      onReady: function (aScratchpad) {
-        aScratchpad.removeObserver(this);
-
-        ok(!isStar(win), "no star before changing text in scratchpad restored from file");
+  openScratchpad(function(aWin, aScratchpad) {
+    ok(!isStar(win), "no star before changing text in scratchpad restored from file");
 
-        aScratchpad.setText("new text");
-        ok(isStar(win), "star when text changed from scratchpad restored from file");
+    aScratchpad.setText("new text");
+    ok(isStar(win), "star when text changed from scratchpad restored from file");
 
-        win.close();
-        done();
-      }
-    });
-  }, false);
+    win.close();
+    done();
+  }, {window: win, noFocus: true});
 }
 
 function testRestoreFromFileUnsaved()
 {
   let session = [{
     filename: "test.js",
     text: "test1",
     executionContext: 1,
     saved: false
   }];
 
   let [win] = ScratchpadManager.restoreSession(session);
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
-
-    win.Scratchpad.addObserver({
-      onReady: function (aScratchpad) {
-        aScratchpad.removeObserver(this);
+  openScratchpad(function() {
+    ok(isStar(win), "star with scratchpad restored with unsaved text");
 
-        ok(isStar(win), "star with scratchpad restored with unsaved text");
-
-        win.close();
-        done();
-      }
-    });
-  }, false);
+    win.close();
+    done();
+  }, {window: win, noFocus: true});
 }
 
 function isStar(win)
 {
   return win.document.title.match(/^\*[^\*]/);
 }
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_679467_falsy.js
@@ -1,34 +1,27 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", testFalsy, false);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    openScratchpad(testFalsy);
   }, true);
 
   content.location = "data:text/html,<p>test falsy display() values in Scratchpad";
 }
 
-function testFalsy(sp)
+function testFalsy()
 {
-  gScratchpadWindow.removeEventListener("load", testFalsy, false);
-
   let sp = gScratchpadWindow.Scratchpad;
   verifyFalsies(sp);
   
   sp.setBrowserContext();
   verifyFalsies(sp);
 
   finish();
 }
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug_699130_edit_ui_updates.js
@@ -8,28 +8,24 @@ Cu.import("resource:///modules/source-ed
 
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
   gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
     gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,test Edit menu updates Scratchpad - bug 699130";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", runTests, false);
-
   let sp = gScratchpadWindow.Scratchpad;
   let doc = gScratchpadWindow.document;
   let winUtils = gScratchpadWindow.QueryInterface(Ci.nsIInterfaceRequestor).
                  getInterface(Ci.nsIDOMWindowUtils);
   let OS = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS;
 
   info("will test the Edit menu");
 
--- a/browser/devtools/scratchpad/test/browser_scratchpad_contexts.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_contexts.js
@@ -1,34 +1,27 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,test context switch in Scratchpad";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   let sp = gScratchpadWindow.Scratchpad;
 
   let contentMenu = gScratchpadWindow.document.getElementById("sp-menu-content");
   let chromeMenu = gScratchpadWindow.document.getElementById("sp-menu-browser");
   let notificationBox = sp.notificationBox;
 
   ok(contentMenu, "found #sp-menu-content");
   ok(chromeMenu, "found #sp-menu-browser");
@@ -37,17 +30,17 @@ function runTests()
   sp.setContentContext();
 
   is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
      "executionContext is content");
 
   is(contentMenu.getAttribute("checked"), "true",
      "content menuitem is checked");
 
-  ok(!chromeMenu.hasAttribute("checked"),
+  isnot(chromeMenu.getAttribute("checked"), "true",
      "chrome menuitem is not checked");
 
   ok(!notificationBox.currentNotification,
      "there is no notification in content context");
 
   sp.setText("window.foobarBug636725 = 'aloha';");
 
   ok(!content.wrappedJSObject.foobarBug636725,
@@ -61,17 +54,17 @@ function runTests()
   sp.setBrowserContext();
 
   is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_BROWSER,
      "executionContext is chrome");
 
   is(chromeMenu.getAttribute("checked"), "true",
      "chrome menuitem is checked");
 
-  ok(!contentMenu.hasAttribute("checked"),
+  isnot(contentMenu.getAttribute("checked"), "true",
      "content menuitem is not checked");
 
   ok(notificationBox.currentNotification,
      "there is a notification in browser context");
 
   sp.setText("2'", 31, 33);
 
   ok(sp.getText(), "window.foobarBug636725 = 'aloha2';",
--- a/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_execute_print.js
@@ -2,30 +2,26 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+  gBrowser.selectedBrowser.addEventListener("load", function onTabLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onTabLoad, true);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,<p>test run() and display() in Scratchpad";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   let sp = gScratchpadWindow.Scratchpad;
 
   content.wrappedJSObject.foobarBug636725 = 1;
 
   sp.setText("++window.foobarBug636725");
 
   let exec = sp.run();
   is(exec[0], sp.getText(), "run()[0] is correct");
--- a/browser/devtools/scratchpad/test/browser_scratchpad_files.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_files.js
@@ -1,46 +1,39 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 Cu.import("resource://gre/modules/NetUtil.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
 // Reference to the Scratchpad object.
 let gScratchpad;
 
 // Reference to the temporary nsIFile we will work with.
 let gFile;
 
 // The temporary file content.
 let gFileContent = "hello.world('bug636725');";
 
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,<p>test file open and save in Scratchpad";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   gScratchpad = gScratchpadWindow.Scratchpad;
 
   // Create a temporary file.
   gFile = FileUtils.getFile("TmpD", ["fileForBug636725.tmp"]);
   gFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
 
   // Write the temporary file.
   let fout = Cc["@mozilla.org/network/file-output-stream;1"].
--- a/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_initialization.js
@@ -1,36 +1,30 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
 
-    ok(Scratchpad, "Scratchpad variable exists");
+    ok(window.Scratchpad, "Scratchpad variable exists");
 
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,initialization test for Scratchpad";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   let sp = gScratchpadWindow.Scratchpad;
   ok(sp, "Scratchpad object exists in new window");
   is(typeof sp.run, "function", "Scratchpad.run() exists");
   is(typeof sp.inspect, "function", "Scratchpad.inspect() exists");
   is(typeof sp.display, "function", "Scratchpad.display() exists");
 
   let environmentMenu = gScratchpadWindow.document.
                           getElementById("sp-environment-menu");
--- a/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_inspect.js
@@ -1,46 +1,39 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,<title>foobarBug636725</title>" +
     "<p>test inspect() in Scratchpad";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   let sp = gScratchpadWindow.Scratchpad;
 
   sp.setText("document");
 
   sp.inspect();
 
   let propPanel = document.querySelector(".scratchpad_propertyPanel");
   ok(propPanel, "property panel is open");
 
-  propPanel.addEventListener("popupshown", function() {
-    propPanel.removeEventListener("popupshown", arguments.callee, false);
+  propPanel.addEventListener("popupshown", function onPopupShown() {
+    propPanel.removeEventListener("popupshown", onPopupShown, false);
 
     let tree = propPanel.querySelector("tree");
     ok(tree, "property panel tree found");
 
     let column = tree.columns[0];
     let found = false;
 
     for (let i = 0; i < tree.view.rowCount; i++) {
--- a/browser/devtools/scratchpad/test/browser_scratchpad_open.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_open.js
@@ -1,75 +1,62 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-var ScratchpadManager = Scratchpad.ScratchpadManager;
-
 // only finish() when correct number of tests are done
 const expected = 3;
 var count = 0;
 
 function done()
 {
   if (++count == expected) {
     finish();
   }
 }
 
-
 function test()
 {
   waitForExplicitFinish();
   testOpen();
   testOpenWithState();
   testOpenInvalidState();
 }
 
 function testOpen()
 {
-  let win = ScratchpadManager.openScratchpad();
-
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
-
+  openScratchpad(function(win) {
     is(win.Scratchpad.filename, undefined, "Default filename is undefined");
     is(win.Scratchpad.getText(),
        win.Scratchpad.strings.GetStringFromName("scratchpadIntro"),
        "Default text is loaded")
     is(win.Scratchpad.executionContext, win.SCRATCHPAD_CONTEXT_CONTENT,
       "Default execution context is content");
 
     win.close();
     done();
-  }, false);
+  }, {noFocus: true});
 }
 
 function testOpenWithState()
 {
   let state = {
     filename: "testfile",
     executionContext: 2,
     text: "test text"
   };
 
-  let win = ScratchpadManager.openScratchpad(state);
-
-  win.addEventListener("load", function onScratchpadLoad() {
-    win.removeEventListener("load", onScratchpadLoad, false);
-
+  openScratchpad(function(win) {
     is(win.Scratchpad.filename, state.filename, "Filename loaded from state");
     is(win.Scratchpad.executionContext, state.executionContext, "Execution context loaded from state");
     is(win.Scratchpad.getText(), state.text, "Content loaded from state");
 
     win.close();
     done();
-  }, false);
+  }, {state: state, noFocus: true});
 }
 
 function testOpenInvalidState()
 {
-  let state = 7;
-
-  let win = ScratchpadManager.openScratchpad(state);
+  let win = openScratchpad(null, {state: 7});
   ok(!win, "no scratchpad opened if state is not an object");
   done();
 }
--- a/browser/devtools/scratchpad/test/browser_scratchpad_restore.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_restore.js
@@ -43,21 +43,17 @@ function testRestore()
     {
       text: "text3",
       executionContext: 1
     }
   ];
 
   asyncMap(states, function(state, done) {
     // Open some scratchpad windows
-    let win = ScratchpadManager.openScratchpad(state);
-    win.addEventListener("load", function onScratchpadLoad() {
-      removeEventListener("load", onScratchpadLoad, false);
-      done(win);
-    }, false)
+    openScratchpad(done, {state: state, noFocus: true});
   }, function(wins) {
     // Then save the windows to session store
     ScratchpadManager.saveOpenWindows();
 
     // Then get their states
     let session = ScratchpadManager.getSessionState();
 
     // Then close them
@@ -69,22 +65,21 @@ function testRestore()
     ScratchpadManager.saveOpenWindows();
 
     // Then restore them
     let restoredWins = ScratchpadManager.restoreSession(session);
 
     is(restoredWins.length, 3, "Three scratchad windows restored");
 
     asyncMap(restoredWins, function(restoredWin, done) {
-      restoredWin.addEventListener("load", function onScratchpadLoad() {
-        restoredWin.removeEventListener("load", onScratchpadLoad, false);
-        let state = restoredWin.Scratchpad.getState();
-        restoredWin.close();
+      openScratchpad(function(aWin) {
+        let state = aWin.Scratchpad.getState();
+        aWin.close();
         done(state);
-      }, false);
+      }, {window: restoredWin, noFocus: true});
     }, function(restoredStates) {
       // Then make sure they were restored with the right states
       ok(statesMatch(restoredStates, states),
         "All scratchpad window states restored correctly");
 
       // Yay, we're done!
       finish();
     });
--- a/browser/devtools/scratchpad/test/browser_scratchpad_tab_switch.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_tab_switch.js
@@ -1,44 +1,39 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
 let tab1;
 let tab2;
 let sp;
 
 function test()
 {
   waitForExplicitFinish();
 
   tab1 = gBrowser.addTab();
   gBrowser.selectedTab = tab1;
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad1() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad1, true);
 
     tab2 = gBrowser.addTab();
     gBrowser.selectedTab = tab2;
-    gBrowser.selectedBrowser.addEventListener("load", function() {
-      gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-      gScratchpadWindow = Scratchpad.openScratchpad();
-      gScratchpadWindow.addEventListener("load", runTests, false);
+    gBrowser.selectedBrowser.addEventListener("load", function onLoad2() {
+      gBrowser.selectedBrowser.removeEventListener("load", onLoad2, true);
+      openScratchpad(runTests);
     }, true);
     content.location = "data:text/html,test context switch in Scratchpad tab 2";
   }, true);
 
   content.location = "data:text/html,test context switch in Scratchpad tab 1";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", runTests, true);
-
   sp = gScratchpadWindow.Scratchpad;
 
   let contentMenu = gScratchpadWindow.document.getElementById("sp-menu-content");
   let browserMenu = gScratchpadWindow.document.getElementById("sp-menu-browser");
   let notificationBox = sp.notificationBox;
 
   ok(contentMenu, "found #sp-menu-content");
   ok(browserMenu, "found #sp-menu-browser");
@@ -47,17 +42,17 @@ function runTests()
   sp.setContentContext();
 
   is(sp.executionContext, gScratchpadWindow.SCRATCHPAD_CONTEXT_CONTENT,
      "executionContext is content");
 
   is(contentMenu.getAttribute("checked"), "true",
      "content menuitem is checked");
 
-  ok(!browserMenu.hasAttribute("checked"),
+  isnot(browserMenu.getAttribute("checked"), "true",
      "chrome menuitem is not checked");
 
   is(notificationBox.currentNotification, null,
      "there is no notification currently shown for content context");
 
   sp.setText("window.foosbug653108 = 'aloha';");
 
   ok(!content.wrappedJSObject.foosbug653108,
--- a/browser/devtools/scratchpad/test/browser_scratchpad_ui.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_ui.js
@@ -1,35 +1,28 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Reference to the Scratchpad chrome window object.
-let gScratchpadWindow;
-
 function test()
 {
   waitForExplicitFinish();
 
   gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-
-    gScratchpadWindow = Scratchpad.openScratchpad();
-    gScratchpadWindow.addEventListener("load", runTests, false);
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    openScratchpad(runTests);
   }, true);
 
   content.location = "data:text/html,<title>foobarBug636725</title>" +
     "<p>test inspect() in Scratchpad";
 }
 
 function runTests()
 {
-  gScratchpadWindow.removeEventListener("load", arguments.callee, false);
-
   let sp = gScratchpadWindow.Scratchpad;
   let doc = gScratchpadWindow.document;
 
   let methodsAndItems = {
     "sp-menu-newscratchpad": "openScratchpad",
     "sp-menu-open": "openFile",
     "sp-menu-save": "saveFile",
     "sp-menu-saveas": "saveFileAs",
--- a/browser/devtools/scratchpad/test/head.js
+++ b/browser/devtools/scratchpad/test/head.js
@@ -1,16 +1,71 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 let gScratchpadWindow; // Reference to the Scratchpad chrome window object
 
+/**
+ * Open a Scratchpad window.
+ *
+ * @param function aReadyCallback
+ *        Optional. The function you want invoked when the Scratchpad instance
+ *        is ready.
+ * @param object aOptions
+ *        Optional. Options for opening the scratchpad:
+ *        - window
+ *          Provide this if there's already a Scratchpad window you want to wait
+ *          loading for.
+ *        - state
+ *          Scratchpad state object. This is used when Scratchpad is open.
+ *        - noFocus
+ *          Boolean that tells you do not want the opened window to receive
+ *          focus.
+ * @return nsIDOMWindow
+ *         The new window object that holds Scratchpad. Note that the
+ *         gScratchpadWindow global is also updated to reference the new window
+ *         object.
+ */
+function openScratchpad(aReadyCallback, aOptions)
+{
+  aOptions = aOptions || {};
+
+  let win = aOptions.window ||
+            Scratchpad.ScratchpadManager.openScratchpad(aOptions.state);
+  if (!win) {
+    return;
+  }
+
+  let onLoad = function() {
+    win.removeEventListener("load", onLoad, false);
+
+    win.Scratchpad.addObserver({
+      onReady: function(aScratchpad) {
+        aScratchpad.removeObserver(this);
+
+        if (aOptions.noFocus) {
+          aReadyCallback(win, aScratchpad);
+        } else {
+          waitForFocus(aReadyCallback.bind(null, win, aScratchpad), win);
+        }
+      }
+    });
+  };
+
+  if (aReadyCallback) {
+    win.addEventListener("load", onLoad, false);
+  }
+
+  gScratchpadWindow = win;
+  return gScratchpadWindow;
+}
+
 function cleanup()
 {
   if (gScratchpadWindow) {
     gScratchpadWindow.close();
     gScratchpadWindow = null;
   }
   while (gBrowser.tabs.length > 1) {
     gBrowser.removeCurrentTab();
--- a/browser/devtools/sourceeditor/orion/Makefile.dryice.js
+++ b/browser/devtools/sourceeditor/orion/Makefile.dryice.js
@@ -40,22 +40,27 @@
 var copy = require('dryice').copy;
 
 const ORION_EDITOR = "org.eclipse.orion.client.editor/web";
 
 var js_src = copy.createDataObject();
 
 copy({
   source: [
+    ORION_EDITOR + "/orion/textview/global.js",
+    ORION_EDITOR + "/orion/textview/eventTarget.js",
+    ORION_EDITOR + "/orion/editor/regex.js",
     ORION_EDITOR + "/orion/textview/keyBinding.js",
     ORION_EDITOR + "/orion/textview/rulers.js",
     ORION_EDITOR + "/orion/textview/undoStack.js",
     ORION_EDITOR + "/orion/textview/textModel.js",
+    ORION_EDITOR + "/orion/textview/annotations.js",
     ORION_EDITOR + "/orion/textview/tooltip.js",
     ORION_EDITOR + "/orion/textview/textView.js",
+    ORION_EDITOR + "/orion/textview/textDND.js",
     ORION_EDITOR + "/orion/editor/htmlGrammar.js",
     ORION_EDITOR + "/orion/editor/textMateStyler.js",
     ORION_EDITOR + "/examples/textview/textStyler.js",
   ],
   dest: js_src,
 });
 
 copy({
@@ -64,16 +69,17 @@ copy({
 });
 
 var css_src = copy.createDataObject();
 
 copy({
   source: [
     ORION_EDITOR + "/orion/textview/textview.css",
     ORION_EDITOR + "/orion/textview/rulers.css",
+    ORION_EDITOR + "/orion/textview/annotations.css",
     ORION_EDITOR + "/examples/textview/textstyler.css",
     ORION_EDITOR + "/examples/editor/htmlStyles.css",
   ],
   dest: css_src,
 });
 
 copy({
     source: css_src,
--- a/browser/devtools/sourceeditor/orion/README
+++ b/browser/devtools/sourceeditor/orion/README
@@ -3,35 +3,21 @@
 This is the Orion editor packaged for Mozilla.
 
 The Orion editor web site: http://www.eclipse.org/orion
 
 # Upgrade
 
 To upgrade Orion to a newer version see the UPGRADE file.
 
-Orion version: git clone from 2011-10-26
-               commit hash 0ab295660e1f7d33ca2bfb8558b3b7492d2c5aa5
-  + patch for Eclipse Bug 358623 - Drag and Drop support:
-    https://github.com/mihaisucan/orion.client/tree/bug-358623
-      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=358623
-  + patch for Eclipse Bug 362286 - Monaco font line height:
-    https://github.com/mihaisucan/orion.client/tree/bug-362286
-      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=362286
-  + patch for Eclipse Bug 362107 - Ctrl-Up/Down failure on Linux:
-    https://github.com/mihaisucan/orion.client/tree/bug-362107
-      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=362107
-  + patch for Eclipse Bug 362428 - _getXToOffset() throws:
-    https://github.com/mihaisucan/orion.client/tree/bug-362428
-      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=362428
-  + patch for Eclipse Bug 362835 - Pasted HTML shows twice:
-    https://github.com/mihaisucan/orion.client/tree/bug-362835
-      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=362835
-  + patch for Eclipse Bug 363508 - Selection is broken after TextView hide/unhide
-    see https://bugs.eclipse.org/bugs/show_bug.cgi?id=363508
+Orion version: git clone from 2011-12-09
+               commit hash d8a6dc01d9c561d6eb99f03b64c8c78ce785c59d
+  + patch for Eclipse Bug 366312 - right-clicking outside of the selection causes the caret to move
+    https://github.com/mihaisucan/orion.client/tree/bug-366312
+      see https://bugs.eclipse.org/bugs/show_bug.cgi?id=366312
 
 # License
 
 The following files are licensed according to the contents in the LICENSE
 file:
   orion.js
   orion.css
 
--- a/browser/devtools/sourceeditor/orion/mozilla.css
+++ b/browser/devtools/sourceeditor/orion/mozilla.css
@@ -1,16 +1,125 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 .viewContainer {
-  font-size: inherit; /* inherit browser's default monospace font size */
+	background: -moz-Dialog;
+	font-family: monospace;
+	font-size: inherit; /* inherit browser's default monospace font size */
+}
+
+.view {
+	background: #fff;
+}
+
+.readonly > .view {
+	background: #f6f6f6;
+}
+
+/* Styles for rulers */
+.ruler {
+	background-color: white;
+}
+.ruler.lines {
+	border-right: 1px solid lightgray;
+	text-align: right;
+}
+
+/* Styles for the line number ruler */
+.rulerLines {
+	background: -moz-Dialog;
+	color: -moz-DialogText;
+	min-width: 1.4em;
+	padding-left: 4px;
+	padding-right: 4px;
+	text-align: end;
+}
+
+.token_singleline_comment {
+	color: green;
+}
+
+.token_multiline_comment {
+	color: green;
+}
+
+.token_doc_comment {
+	color: #00008F;
+}
+
+.token_doc_html_markup {
+	color: #7F7F9F;
+}
+
+.token_doc_tag {
+	color: #7F9FBF;
+}
+
+.token_task_tag {
+	color: #7F9FBF;
+}
+
+.token_string {
+	color: blue;
 }
 
-.rulerLines {
-  background: -moz-Dialog;
-  color: -moz-DialogText;
-  min-width: 1.4em;
-  padding-left: 4px;
-  padding-right: 4px;
-  text-align: end;
+.token_keyword {
+	color: darkred;
+	font-weight: bold;
+}
+
+.token_space {
+	/* images/white_space.png */
+	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAIAAABv85FHAAAABnRSTlMA/wAAAACkwsAdAAAAIUlEQVR4nGP4z8CAC+GUIEXuABhgkTuABEiRw2cmae4EAH05X7xDolNRAAAAAElFTkSuQmCC");
+	background-repeat: no-repeat;
+ 	background-position: center center;
+}
+
+.token_tab {
+	/* images/white_tab.png */
+	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAJCAIAAACJ2loDAAAABnRSTlMA/wD/AP83WBt9AAAAMklEQVR4nGP4TwRgoK6i52c3bz5w6zMSA6tJn28d2Lx589nnCAYu63AaSLxJRLoJPwAAeNk0aG4opfMAAAAASUVORK5CYII=");
+	background-repeat: no-repeat;
+ 	background-position: left center;
+}
+
+.line_caret {
+	background: #EAF2FE;
+}
+
+.readonly .line_caret {
+	background: #fcfcfc;
 }
 
+/* Styling for html syntax highlighting */
+.entity-name-tag {
+	color: #3f7f7f;
+}
+
+.entity-other-attribute-name {
+	color: #7f007f;
+}
+
+.punctuation-definition-comment {
+	color: #3f5fbf;
+}
+
+.comment {
+	color: #3f5fbf
+}
+
+.string-quoted {
+	color: #2a00ff;
+	font-style: italic;
+}
+
+.invalid {
+	color: red;
+	font-weight: bold;
+}
+
+.annotationRange.currentBracket {
+}
+
+.annotationRange.matchingBracket {
+	outline: 1px solid red;
+}
+
--- a/browser/devtools/sourceeditor/orion/orion.css
+++ b/browser/devtools/sourceeditor/orion/orion.css
@@ -1,16 +1,20 @@
 .view {
 	background-color: white;
 }
 
 .viewContainer {
+	background-color: #eeeeee;
 	font-family: monospace;
 	font-size: 10pt;
 }
+::-webkit-scrollbar-corner {
+	background-color: #eeeeee;
+}
 
 .viewContent {
 }/* Styles for rulers */
 .ruler {
 	background-color: white;
 }
 .ruler.annotations {
 	border-right: 1px solid lightgray;
@@ -20,26 +24,182 @@
 	border-right: 1px solid lightgray;
 	width: 14px;
 }
 .ruler.lines {
 	border-right: 1px solid lightgray;
 	text-align: right;
 }
 .ruler.overview {
+	border-left: 1px solid lightgray;
 	width: 14px;
 }
 
 /* Styles for the line number ruler */
 .rulerLines {
-	background-color: white;
 }
 .rulerLines.even
 .rulerLines.odd {
-}.token_singleline_comment {
+}/* Styles for the annotation ruler (all lines) */
+.annotation {
+}
+.annotation.error,
+.annotation.warning
+.annotation.task,
+.annotation.bookmark,
+.annotation.breakpoint,
+.annotation.collapsed
+.annotation.expanded {
+}
+
+/* Styles for the annotation ruler (first line) */
+.annotationHTML {
+	cursor: pointer;
+	width: 16px;
+	height: 16px;
+	display: inline-block;
+	vertical-align: middle;
+	background-position: center;
+	background-repeat: no-repeat;
+}
+.annotationHTML.error {
+	/* images/error.gif */
+	background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAPVvcvWHiPVucvRuc+ttcfV6f91KVN5LU99PV/FZY/JhaM4oN84pONE4Rd1ATfJLWutVYPRgbdxpcsgWKMgZKs4lNfE/UvE/U+artcpdSc5uXveimslHPuBhW/eJhfV5efaCgO2CgP+/v+PExP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACUALAAAAAAQABAAAAZ+wJJwSCwaScgkySgkjTQZTkYzWhadnE5oE+pwqkSshwQqkzxfa4kkQXxEpA9J9EFI1KQGQQBAigYCBA14ExEWF0gXihETeA0QD3AkD5QQg0NsDnAJmwkOd5gYFSQKpXAFDBhqaxgLBwQBBAapq00YEg0UDRKqTGtKSL7Cw8JBADs=");
+}
+.annotationHTML.warning {
+	/* images/warning.gif */
+	background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAP7bc//egf/ij/7ijv/jl/7kl//mnv7lnv/uwf7CTP7DTf7DT/7IW//Na/7Na//NbP7QdP/dmbltAIJNAF03AMSAJMSCLKqASa2DS6uBSquCSrGHTq6ETbCHT7WKUrKIUcCVXL+UXMOYX8GWXsSZYMiib6+ETbOIUcOXX86uhd3Muf///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACsALAAAAAAQABAAAAZowJVwSCwaj0ihikRSJYcoBEL0XKlGkcjImQQhJBREKFnyICoThKeE/AAW6AXgdPyUAgrLJBEo0YsbAQyDhAEdRRwDDw8OaA4NDQImRBgFEJdglxAEGEQZKQcHBqOkKRpFF6mqq1WtrUEAOw==");
+}
+.annotationHTML.task {
+	/* images/task.gif */
+	background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAN7s4uTy6ICvY423c2WdP2ugR3mqWYeza2ejOl6VNVqPM1aJMURsJ2GaOnKlT8PbsbPDqGmmO1OCLk98LEhxKGWfOWKaN0t2KkJoJf///////wAAAAAAAAAAAAAAAAAAACH5BAEAABoALAAAAAAQABAAAAVmoCaOZDk+UaquDxkNcCxHJHLceI6QleD/vkCmQrIYjkiDMGAhJRzQ6NKRICkKgYJ2qVWQFktCmEBYkCSNZSbQaDckpAl5TCZMSBdtAaDXX0gUUYJRFCQMSYgGDCQQGI6PkBAmkyUhADs=");
+}
+.annotationHTML.bookmark {
+	/* images/bookmark.gif */
+	background-image: url("data:image/gif;base64,R0lGODlhEAAQALMAAP7//+/VNPzZS/vifeumAPrBOOSlHOSuRP///wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAgALAAAAAAQABAAAARLEMlJq5Xn3EvIrkenfRIhCB5pmKhRdbAJAGhssuc8n6eJoAKdkOaTAIdEQeWoA1oGsiZhYAnIcqiApVPjElyUbkFSgCkn5XElLYkAADs=");
+}
+.annotationHTML.breakpoint {
+	/* images/breakpoint.gif */
+	background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAFheoFxkoFxnpmt0pmZxpnF7rYyWwmJwpnaFs3aDrWt8rXGBrYycwmZ3mXuNs42cu77F03GIs3aJrYGVu2J5oKCuxeDj6LK/03GLrYieu3aIoIygu6m4zcLN3MTM1m6Rs2aLriRgkSZilXGXtoGcs7LD0QBLhSZikihol3ScubrO2Yaqu5q4xpO0wpm7yabF0ZO9yaXI0r3X3tHj6P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAADQALAAAAAAQABAAAAafQJpwSCwWLYZBIDAwWIw0A+FFpW6aRUPCxe1yE4ahhdCCxWSzmSwGgxGeUceKpUqhUCkVa7UK0wgkJCUjJoUmIyWBBEIEGhoeJ4YmJx6OAUIADQ0QIZIhEJoAQgEUFBUgkiAVpZdRCxIPFx8iIh8XDw4FfhYHDhgZHB0dHBkYEwdwUQoTEc3OEwp+QwYHCBMMDBMIB9JESAJLAk5Q5EVBADs=");
+}
+.annotationHTML.collapsed {
+	/* images/collapsed.png */
+	width: 14px;
+	height: 14px;
+	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWBJREFUeNpi/P//PwMlgImBQkCxASzoAp++fo+6de+Z+fXbD/Jev/nAICoiwKCpqrBBTUlqNR835zJ09YzIYfDxy7eo/cevLmXlYGNQUJAEahZieP3mHcODB08Zfv/4w+BoqR3Nz8O1DKcXzt94HPqXmZlBU1+LgZNfkMHazIOBA0hr6uswgMTP33gYijcMLlx/EMAnLs7w7sc/hg9AG0HgPZB+B8S84hJA+UcBeMPg+at3DJIMnAxZzt5wsUhnXzDdsmIVWB6vAcLCfAys3z4wzN64huEfkJ/uH8IwexOQDQymD2/fgeXxekFLRWHD51evGDhZGRi4WSFSnCwgNjB2Xr1m0AbK4zXAQkdhNdPf3wx3r91g+PruLcOqnasYvn54x3Dv2k0G5r+/GMyB8nijEQTefvoadeH6w9Cbtx8GvH//kUFQkJ9BQ1V+g76m/GphPu5lBA0YenmBYgMAAgwA34GIKjmLxOUAAAAASUVORK5CYII=");
+}
+.annotationHTML.expanded {
+	/* images/expanded.png */
+	width: 14px;
+	height: 14px;	
+	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAT5JREFUeNrUksFKw0AURW+mTWw67SSEiG209U90r4jddFO34l+5U0HdZCHiFwiCOz9AlMSmGEpMOqk1TWJSFGyFbATR2dyZd+Dw3mOENE3xkyP8PYHrBT3OX7uW43ZefA6FUaw1dJPSyrmu1k8KBYOh37Od4XFZLEPXFdRrFMGIw3U9TKMYqw1tb0VjcxLy9eEF425CCIxWE5JcxSQGxCyNloG87gXhwWIHc4J767lTZQw8ShFGSZbxRyaQmZJxd3NRUJ6ffwQNEi6PzG/L2tjdmvFCgcKqKL2F2Olu43MzggDka+IjPuOFI7Sbujn2fUglYKkkzFIi+R0I/QDrGS8UqDX5QkhiOHYfE84hkhSTkGNgOyDJFCzjhYLTq+vDtrG8r1LZtB6fcHtzB+uhD5VWzLx+lvF/8JV/XfAuwADsrJbMGG4l4AAAAABJRU5ErkJggg==");
+}
+.annotationHTML.multiple {
+	/* images/multiple.gif */
+	background-image: url("data:image/gif;base64,R0lGODlhEAAQANUAAOdpa+yJiuFYXOFYXeBYXONwded8f+NwdmhwkHB4iPr7/ezx+fP2+2h4kOzy+Wh4iPr8/gCBwTaczjaXyjaYyjaXyTaYyfr8/QCMzQCMzACHxzao2jal2Dak1zag03iAgI/Ckn64fZrHmX+4fZLCianPopPCiarOoqbLlafLlbnXq7nWq6fLlMTcsoCIeJCQcIiIeKCYaJiQcO16ee16evGVlfGWlfahn/ahoPWhn/WhoPe1tP///////wAAAAAAACH5BAEAAD0ALAAAAAAQABAAAAaRwJ5wSCwaj8WYcslcDmObaDTGq1Zjzw4mk+FQIRcFTzaUeTRoj4zHaI+HL0lkLnnxFgsH7zWEWSoTFBMwVlUwQy6JMDCJjYwuQx8tk5MfOzk4OjcfkSssKCkqHzY0MzQ1nEIJJSYkJCcJAQCzAQlDDyIjISMiCQYEAgMGD0MNIMfHDQUHBc3EQgjR0tPSSNY9QQA7");