diff --git a/.hgtags b/.hgtags
index d7465f4c596a67bcec1bf0cdcea7d5086dae40aa..0e0898afb022e96841dc06bcc2577e034ef87124 100644
--- a/.hgtags
+++ b/.hgtags
@@ -42,3 +42,12 @@ dc6483491b4af559060bccaef8e9045a303212dd 2.4.0-beta1
 3bc1f50a72e117f4d4ad8d555f0c785ea8cc201e 2.4.0-beta1
 25bd6007e3d2fc15db9326ed4b18a24a5969a46a 2.4.0-beta2
 1ed382c6a08ba3850b6ce9061bc551ddece0ea07 2.4.0-release
+a82e5b1e22c7f90e3c7977d146b80588f004ed0d 2.5.0-start
+76f586a8e22b1abe6b2339758c8ac0fa718975de 76f586a8e22b
+76f586a8e22b1abe6b2339758c8ac0fa718975de 76f586a8e22b
+0000000000000000000000000000000000000000 76f586a8e22b
+0000000000000000000000000000000000000000 76f586a8e22b
+345b17e7cf630db77e840b4fe3451bd476d750a3 76f586a8e22b
+345b17e7cf630db77e840b4fe3451bd476d750a3 2.5.0-beta1
+345b17e7cf630db77e840b4fe3451bd476d750a3 76f586a8e22b
+0000000000000000000000000000000000000000 76f586a8e22b
diff --git a/build.sh b/build.sh
index c5f74c23ee07ac283b76289af82d8d5fe2a2644c..cd1d9df6f3e32c7d3784f580a73e125919c3d55d 100755
--- a/build.sh
+++ b/build.sh
@@ -170,13 +170,7 @@ do
   mkdir -p "$build_dir"
   if pre_build "$variant" "$build_dir" >> "$build_log" 2>&1
   then
-    if $build_link_parallel
-    then
-      begin_section BuildParallel
-      ( build "$variant" "$build_dir" > "$build_dir/build.log" 2>&1 ) &
-      build_processes="$build_processes $!"
-      end_section BuildParallel
-    elif $build_coverity
+    if $build_coverity
     then
       mkdir -p "$build_dir/cvbuild"
       coverity_config=`cygpath --windows "$coverity_dir/config/coverity_config.xml"`
@@ -198,7 +192,6 @@ do
         begin_section CovAnalyze\
          &&\
         "$coverity_dir"/bin/cov-analyze\
-           --cxx\
            --security\
            --concurrency\
            --dir "$coverity_tmpdir"\
@@ -209,14 +202,14 @@ do
         begin_section CovCommit\
          &&\
         "$coverity_dir"/bin/cov-commit-defects\
-           --product "$coverity_product"\
+           --stream "$coverity_product"\
            --dir "$coverity_tmpdir"\
-           --remote "$coverity_server"\
+           --host "$coverity_server"\
            --strip-path "$coverity_root"\
            --target "$branch/$arch"\
            --version "$revision"\
            --description "$repo: $variant $revision"\
-           --user admin --password admin\
+           --user admin --password coverity\
           >> "$build_log" 2>&1\
           || record_failure "Coverity Build Failed"
         # since any step could have failed, rely on the enclosing block to close any pending sub-blocks
@@ -227,6 +220,12 @@ do
       then
         upload_item log "$build_dir"/cvbuild/build-log.txt text/plain
       fi
+    elif $build_link_parallel
+    then
+      begin_section BuildParallel
+      ( build "$variant" "$build_dir" > "$build_dir/build.log" 2>&1 ) &
+      build_processes="$build_processes $!"
+      end_section BuildParallel
     else
       begin_section "Build$variant"
       build "$variant" "$build_dir" >> "$build_log" 2>&1
diff --git a/doc/contributions.txt b/doc/contributions.txt
index f987cf485202b07485c54054158a85e7d2c0e55b..b601f9380603f33bf682fb8da2864c3db252b1df 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -72,6 +72,7 @@ Aleric Inglewood
 	VWR-10837
 	VWR-12691
 	VWR-12984
+	VWR-13040
 	VWR-13996
 	VWR-14426
 	VWR-24247
@@ -79,6 +80,10 @@ Aleric Inglewood
 	VWR-24252
 	VWR-24254
 	VWR-24261
+	VWR-24315
+	VWR-24317
+	VWR-24320
+ 	VWR-24354
 	SNOW-84
 	SNOW-477
 	SNOW-744
@@ -219,6 +224,8 @@ Catherine Pfeffer
 Celierra Darling
 	VWR-1274
 	VWR-6975
+Coaldust Numbers
+    VWR-1095
 Cron Stardust
 	VWR-10579
 Cypren Christenson
@@ -364,13 +371,19 @@ JB Kraft
 Joghert LeSabre
 	VWR-64
 Jonathan Yap
-	VWR-17801
 	STORM-523
+	STORM-596
+	STORM-615
 	STORM-616
 	STORM-679
-	STORM-596
+	STORM-723
 	STORM-726
+	STORM-737
+	STORM-869
 	STORM-785
+	STORM-812
+	VWR-17801
+	STORM-844
 Kage Pixel
 	VWR-11
 Ken March
@@ -387,6 +400,7 @@ Kitty Barnett
 	STORM-288
 	STORM-799
 	STORM-800
+    VWR-24217
 Kunnis Basiat
 	VWR-82
 	VWR-102
@@ -730,6 +744,7 @@ Thickbrick Sleaford
 	VWR-9287
 	VWR-13483
 	VWR-13947
+	VWR-24420
 Thraxis Epsilon
 	SVC-371
 	VWR-383
@@ -748,6 +763,9 @@ Tue Torok
 	CT-74
 Twisted Laws
 	SNOW-352
+	STORM-466
+	STORM-467
+	STORM-844
 Vadim Bigbear
 	VWR-2681
 Vector Hastings
@@ -796,6 +814,7 @@ WolfPup Lowenhar
 	STORM-654
 	STORM-674
 	STORM-776
+	STORM-825
 	VWR-20741
 	VWR-20933
 Zai Lynch
diff --git a/etc/message.xml b/etc/message.xml
index 7c4a927cc5e7997b7533e98ec4d2143c60f19b87..764aea387945c6797d4b14a67e5df4c1f7f65397 100644
--- a/etc/message.xml
+++ b/etc/message.xml
@@ -678,20 +678,17 @@
 			<key>EstateChangeInfo</key>
 			<boolean>true</boolean>
 		
-			<key>FetchInventoryDescendents</key>
+			<key>FetchInventoryDescendents2</key>
 			<boolean>false</boolean>
 		
-			<key>WebFetchInventoryDescendents</key>
-			<boolean>true</boolean>
-		
-			<key>FetchInventory</key>
-			<boolean>true</boolean>
+			<key>FetchInventory2</key>
+			<boolean>false</boolean>
 		
-			<key>FetchLibDescendents</key>
-			<boolean>true</boolean>
+			<key>FetchLibDescendents2</key>
+			<boolean>false</boolean>
 		
-			<key>FetchLib</key>
-			<boolean>true</boolean>
+			<key>FetchLib2</key>
+			<boolean>false</boolean>
 
 			<key>UploadBakedTexture</key>
 			<boolean>true</boolean>
diff --git a/indra/cmake/GetPrerequisites_2_8.cmake b/indra/cmake/GetPrerequisites_2_8.cmake
index 5a24842c896af36c13b8897a0285222dbffa2d12..05ec1539ba1bc5842565dbc419b65aef914e7319 100644
--- a/indra/cmake/GetPrerequisites_2_8.cmake
+++ b/indra/cmake/GetPrerequisites_2_8.cmake
@@ -1,786 +1,786 @@
-# GetPrerequisites.cmake
-#
-# This script provides functions to list the .dll, .dylib or .so files that an
-# executable or shared library file depends on. (Its prerequisites.)
-#
-# It uses various tools to obtain the list of required shared library files:
-#   dumpbin (Windows)
-#   ldd (Linux/Unix)
-#   otool (Mac OSX)
-#
-# The following functions are provided by this script:
-#   gp_append_unique
-#   is_file_executable
-#   gp_item_default_embedded_path
-#     (projects can override with gp_item_default_embedded_path_override)
-#   gp_resolve_item
-#     (projects can override with gp_resolve_item_override)
-#   gp_resolved_file_type
-#   gp_file_type
-#   get_prerequisites
-#   list_prerequisites
-#   list_prerequisites_by_glob
-#
-# Requires CMake 2.6 or greater because it uses function, break, return and
-# PARENT_SCOPE.
-
-#=============================================================================
-# Copyright 2008-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
-#  License text for the above reference.)
-
-# gp_append_unique list_var value
-#
-# Append value to the list variable ${list_var} only if the value is not
-# already in the list.
-#
-function(gp_append_unique list_var value)
-  set(contains 0)
-
-  foreach(item ${${list_var}})
-    if("${item}" STREQUAL "${value}")
-      set(contains 1)
-      break()
-    endif("${item}" STREQUAL "${value}")
-  endforeach(item)
-
-  if(NOT contains)
-    set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
-  endif(NOT contains)
-endfunction(gp_append_unique)
-
-
-# is_file_executable file result_var
-#
-# Return 1 in ${result_var} if ${file} is a binary executable.
-#
-# Return 0 in ${result_var} otherwise.
-#
-function(is_file_executable file result_var)
-  #
-  # A file is not executable until proven otherwise:
-  #
-  set(${result_var} 0 PARENT_SCOPE)
-
-  get_filename_component(file_full "${file}" ABSOLUTE)
-  string(TOLOWER "${file_full}" file_full_lower)
-
-  # If file name ends in .exe on Windows, *assume* executable:
-  #
-  if(WIN32)
-    if("${file_full_lower}" MATCHES "\\.exe$")
-      set(${result_var} 1 PARENT_SCOPE)
-      return()
-    endif("${file_full_lower}" MATCHES "\\.exe$")
-
-    # A clause could be added here that uses output or return value of dumpbin
-    # to determine ${result_var}. In 99%+? practical cases, the exe name
-    # match will be sufficient...
-    #
-  endif(WIN32)
-
-  # Use the information returned from the Unix shell command "file" to
-  # determine if ${file_full} should be considered an executable file...
-  #
-  # If the file command's output contains "executable" and does *not* contain
-  # "text" then it is likely an executable suitable for prerequisite analysis
-  # via the get_prerequisites macro.
-  #
-  if(UNIX)
-    if(NOT file_cmd)
-      find_program(file_cmd "file")
-    endif(NOT file_cmd)
-
-    if(file_cmd)
-      execute_process(COMMAND "${file_cmd}" "${file_full}"
-        OUTPUT_VARIABLE file_ov
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-      # Replace the name of the file in the output with a placeholder token
-      # (the string " _file_full_ ") so that just in case the path name of
-      # the file contains the word "text" or "executable" we are not fooled
-      # into thinking "the wrong thing" because the file name matches the
-      # other 'file' command output we are looking for...
-      #
-      string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
-      string(TOLOWER "${file_ov}" file_ov)
-
-      #message(STATUS "file_ov='${file_ov}'")
-      if("${file_ov}" MATCHES "executable")
-        #message(STATUS "executable!")
-        if("${file_ov}" MATCHES "text")
-          #message(STATUS "but text, so *not* a binary executable!")
-        else("${file_ov}" MATCHES "text")
-          set(${result_var} 1 PARENT_SCOPE)
-          return()
-        endif("${file_ov}" MATCHES "text")
-      endif("${file_ov}" MATCHES "executable")
-    else(file_cmd)
-      message(STATUS "warning: No 'file' command, skipping execute_process...")
-    endif(file_cmd)
-  endif(UNIX)
-endfunction(is_file_executable)
-
-
-# gp_item_default_embedded_path item default_embedded_path_var
-#
-# Return the path that others should refer to the item by when the item
-# is embedded inside a bundle.
-#
-# Override on a per-project basis by providing a project-specific
-# gp_item_default_embedded_path_override function.
-#
-function(gp_item_default_embedded_path item default_embedded_path_var)
-
-  # On Windows and Linux, "embed" prerequisites in the same directory
-  # as the executable by default:
-  #
-  set(path "@executable_path")
-  set(overridden 0)
-
-  # On the Mac, relative to the executable depending on the type
-  # of the thing we are embedding:
-  #
-  if(APPLE)
-    #
-    # The assumption here is that all executables in the bundle will be
-    # in same-level-directories inside the bundle. The parent directory
-    # of an executable inside the bundle should be MacOS or a sibling of
-    # MacOS and all embedded paths returned from here will begin with
-    # "@executable_path/../" and will work from all executables in all
-    # such same-level-directories inside the bundle.
-    #
-
-    # By default, embed things right next to the main bundle executable:
-    #
-    set(path "@executable_path/../../Contents/MacOS")
-
-    # Embed .dylibs right next to the main bundle executable:
-    #
-    if(item MATCHES "\\.dylib$")
-      set(path "@executable_path/../MacOS")
-      set(overridden 1)
-    endif(item MATCHES "\\.dylib$")
-
-    # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
-    #
-    if(NOT overridden)
-      if(item MATCHES "[^/]+\\.framework/")
-        set(path "@executable_path/../Frameworks")
-        set(overridden 1)
-      endif(item MATCHES "[^/]+\\.framework/")
-    endif(NOT overridden)
-  endif()
-
-  # Provide a hook so that projects can override the default embedded location
-  # of any given library by whatever logic they choose:
-  #
-  if(COMMAND gp_item_default_embedded_path_override)
-    gp_item_default_embedded_path_override("${item}" path)
-  endif(COMMAND gp_item_default_embedded_path_override)
-
-  set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
-endfunction(gp_item_default_embedded_path)
-
-
-# gp_resolve_item context item exepath dirs resolved_item_var
-#
-# Resolve an item into an existing full path file.
-#
-# Override on a per-project basis by providing a project-specific
-# gp_resolve_item_override function.
-#
-function(gp_resolve_item context item exepath dirs resolved_item_var)
-  set(resolved 0)
-  set(resolved_item "${item}")
-
-  # Is it already resolved?
-  #
-  if(EXISTS "${resolved_item}")
-    set(resolved 1)
-  endif(EXISTS "${resolved_item}")
-
-  if(NOT resolved)
-    if(item MATCHES "@executable_path")
-      #
-      # @executable_path references are assumed relative to exepath
-      #
-      string(REPLACE "@executable_path" "${exepath}" ri "${item}")
-      get_filename_component(ri "${ri}" ABSOLUTE)
-
-      if(EXISTS "${ri}")
-        #message(STATUS "info: embedded item exists (${ri})")
-        set(resolved 1)
-        set(resolved_item "${ri}")
-      else(EXISTS "${ri}")
-        message(STATUS "warning: embedded item does not exist '${ri}'")
-      endif(EXISTS "${ri}")
-    endif(item MATCHES "@executable_path")
-  endif(NOT resolved)
-
-  if(NOT resolved)
-    if(item MATCHES "@loader_path")
-      #
-      # @loader_path references are assumed relative to the
-      # PATH of the given "context" (presumably another library)
-      #
-      get_filename_component(contextpath "${context}" PATH)
-      string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
-      get_filename_component(ri "${ri}" ABSOLUTE)
-
-      if(EXISTS "${ri}")
-        #message(STATUS "info: embedded item exists (${ri})")
-        set(resolved 1)
-        set(resolved_item "${ri}")
-      else(EXISTS "${ri}")
-        message(STATUS "warning: embedded item does not exist '${ri}'")
-      endif(EXISTS "${ri}")
-    endif(item MATCHES "@loader_path")
-  endif(NOT resolved)
-
-  if(NOT resolved)
-    set(ri "ri-NOTFOUND")
-    find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
-    find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
-    if(ri)
-      #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
-      set(resolved 1)
-      set(resolved_item "${ri}")
-      set(ri "ri-NOTFOUND")
-    endif(ri)
-  endif(NOT resolved)
-
-  if(NOT resolved)
-    if(item MATCHES "[^/]+\\.framework/")
-      set(fw "fw-NOTFOUND")
-      find_file(fw "${item}"
-        "~/Library/Frameworks"
-        "/Library/Frameworks"
-        "/System/Library/Frameworks"
-      )
-      if(fw)
-        #message(STATUS "info: 'find_file' found framework (${fw})")
-        set(resolved 1)
-        set(resolved_item "${fw}")
-        set(fw "fw-NOTFOUND")
-      endif(fw)
-    endif(item MATCHES "[^/]+\\.framework/")
-  endif(NOT resolved)
-
-  # Using find_program on Windows will find dll files that are in the PATH.
-  # (Converting simple file names into full path names if found.)
-  #
-  if(WIN32)
-  if(NOT resolved)
-    set(ri "ri-NOTFOUND")
-    find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
-    find_program(ri "${item}" PATHS "${exepath};${dirs}")
-    if(ri)
-      #message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
-      set(resolved 1)
-      set(resolved_item "${ri}")
-      set(ri "ri-NOTFOUND")
-    endif(ri)
-  endif(NOT resolved)
-  endif(WIN32)
-
-  # Provide a hook so that projects can override item resolution
-  # by whatever logic they choose:
-  #
-  if(COMMAND gp_resolve_item_override)
-    gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
-  endif(COMMAND gp_resolve_item_override)
-
-  if(NOT resolved)
-    message(STATUS "
-warning: cannot resolve item '${item}'
-
-  possible problems:
-    need more directories?
-    need to use InstallRequiredSystemLibraries?
-    run in install tree instead of build tree?
-")
-#    message(STATUS "
-#******************************************************************************
-#warning: cannot resolve item '${item}'
-#
-#  possible problems:
-#    need more directories?
-#    need to use InstallRequiredSystemLibraries?
-#    run in install tree instead of build tree?
-#
-#    context='${context}'
-#    item='${item}'
-#    exepath='${exepath}'
-#    dirs='${dirs}'
-#    resolved_item_var='${resolved_item_var}'
-#******************************************************************************
-#")
-  endif(NOT resolved)
-
-  set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
-endfunction(gp_resolve_item)
-
-
-# gp_resolved_file_type original_file file exepath dirs type_var
-#
-# Return the type of ${file} with respect to ${original_file}. String
-# describing type of prerequisite is returned in variable named ${type_var}.
-#
-# Use ${exepath} and ${dirs} if necessary to resolve non-absolute ${file}
-# values -- but only for non-embedded items.
-#
-# Possible types are:
-#   system
-#   local
-#   embedded
-#   other
-#
-function(gp_resolved_file_type original_file file exepath dirs type_var)
-  #message(STATUS "**")
-
-  if(NOT IS_ABSOLUTE "${original_file}")
-    message(STATUS "warning: gp_resolved_file_type expects absolute full path for first arg original_file")
-  endif()
-
-  set(is_embedded 0)
-  set(is_local 0)
-  set(is_system 0)
-
-  set(resolved_file "${file}")
-
-  if("${file}" MATCHES "^@(executable|loader)_path")
-    set(is_embedded 1)
-  endif()
-
-  if(NOT is_embedded)
-    if(NOT IS_ABSOLUTE "${file}")
-      gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
-    endif()
-
-    string(TOLOWER "${original_file}" original_lower)
-    string(TOLOWER "${resolved_file}" lower)
-
-    if(UNIX)
-      if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)")
-        set(is_system 1)
-      endif()
-    endif()
-
-    if(APPLE)
-      if(resolved_file MATCHES "^(/System/Library/|/usr/lib/)")
-        set(is_system 1)
-      endif()
-    endif()
-
-    if(WIN32)
-      string(TOLOWER "$ENV{SystemRoot}" sysroot)
-      string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
-
-      string(TOLOWER "$ENV{windir}" windir)
-      string(REGEX REPLACE "\\\\" "/" windir "${windir}")
-
-      if(lower MATCHES "^(${sysroot}/system|${windir}/system|${sysroot}/syswow|${windir}/syswow|(.*/)*msvc[^/]+dll)")
-        set(is_system 1)
-      endif()
-    endif()
-
-    if(NOT is_system)
-      get_filename_component(original_path "${original_lower}" PATH)
-      get_filename_component(path "${lower}" PATH)
-      if("${original_path}" STREQUAL "${path}")
-        set(is_local 1)
-      endif()
-    endif()
-  endif()
-
-  # Return type string based on computed booleans:
-  #
-  set(type "other")
-
-  if(is_system)
-    set(type "system")
-  elseif(is_embedded)
-    set(type "embedded")
-  elseif(is_local)
-    set(type "local")
-  endif()
-
-  #message(STATUS "gp_resolved_file_type: '${file}' '${resolved_file}'")
-  #message(STATUS "                type: '${type}'")
-
-  if(NOT is_embedded)
-    if(NOT IS_ABSOLUTE "${resolved_file}")
-      if(lower MATCHES "^msvc[^/]+dll" AND is_system)
-        message(STATUS "info: non-absolute msvc file '${file}' returning type '${type}'")
-      else()
-        message(STATUS "warning: gp_resolved_file_type non-absolute file '${file}' returning type '${type}' -- possibly incorrect")
-      endif()
-    endif()
-  endif()
-
-  set(${type_var} "${type}" PARENT_SCOPE)
-
-  #message(STATUS "**")
-endfunction()
-
-
-# gp_file_type original_file file type_var
-#
-# Return the type of ${file} with respect to ${original_file}. String
-# describing type of prerequisite is returned in variable named ${type_var}.
-#
-# Possible types are:
-#   system
-#   local
-#   embedded
-#   other
-#
-function(gp_file_type original_file file type_var)
-  if(NOT IS_ABSOLUTE "${original_file}")
-    message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file")
-  endif()
-
-  get_filename_component(exepath "${original_file}" PATH)
-
-  set(type "")
-  gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type)
-
-  set(${type_var} "${type}" PARENT_SCOPE)
-endfunction(gp_file_type)
-
-
-# get_prerequisites target prerequisites_var exclude_system recurse dirs
-#
-# Get the list of shared library files required by ${target}. The list in
-# the variable named ${prerequisites_var} should be empty on first entry to
-# this function. On exit, ${prerequisites_var} will contain the list of
-# required shared library files.
-#
-#  target is the full path to an executable file
-#
-#  prerequisites_var is the name of a CMake variable to contain the results
-#
-#  exclude_system is 0 or 1: 0 to include "system" prerequisites , 1 to
-#   exclude them
-#
-#  recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites
-#   recursively
-#
-#  exepath is the path to the top level executable used for @executable_path
-#   replacment on the Mac
-#
-#  dirs is a list of paths where libraries might be found: these paths are
-#   searched first when a target without any path info is given. Then standard
-#   system locations are also searched: PATH, Framework locations, /usr/lib...
-#
-function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
-  set(verbose 0)
-  set(eol_char "E")
-
-  if(NOT IS_ABSOLUTE "${target}")
-    message("warning: target '${target}' is not absolute...")
-  endif(NOT IS_ABSOLUTE "${target}")
-
-  if(NOT EXISTS "${target}")
-    message("warning: target '${target}' does not exist...")
-  endif(NOT EXISTS "${target}")
-
-  # <setup-gp_tool-vars>
-  #
-  # Try to choose the right tool by default. Caller can set gp_tool prior to
-  # calling this function to force using a different tool.
-  #
-  if("${gp_tool}" STREQUAL "")
-    set(gp_tool "ldd")
-    if(APPLE)
-      set(gp_tool "otool")
-    endif(APPLE)
-    if(WIN32)
-      set(gp_tool "dumpbin")
-    endif(WIN32)
-  endif("${gp_tool}" STREQUAL "")
-
-  set(gp_tool_known 0)
-
-  if("${gp_tool}" STREQUAL "ldd")
-    set(gp_cmd_args "")
-    set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$")
-    set(gp_regex_cmp_count 1)
-    set(gp_tool_known 1)
-  endif("${gp_tool}" STREQUAL "ldd")
-
-  if("${gp_tool}" STREQUAL "otool")
-    set(gp_cmd_args "-L")
-    set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
-    set(gp_regex_cmp_count 3)
-    set(gp_tool_known 1)
-  endif("${gp_tool}" STREQUAL "otool")
-
-  if("${gp_tool}" STREQUAL "dumpbin")
-    set(gp_cmd_args "/dependents")
-    set(gp_regex "^    ([^ ].*[Dd][Ll][Ll])${eol_char}$")
-    set(gp_regex_cmp_count 1)
-    set(gp_tool_known 1)
-    set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
-  endif("${gp_tool}" STREQUAL "dumpbin")
-
-  if(NOT gp_tool_known)
-    message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
-    message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
-    message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.")
-    return()
-  endif(NOT gp_tool_known)
-
-  set(gp_cmd_paths ${gp_cmd_paths}
-    "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
-    "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
-    "C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
-    "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
-    "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
-    "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
-    "/usr/local/bin"
-    "/usr/bin"
-    )
-
-  find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths})
-
-  if(NOT gp_cmd)
-    message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...")
-    return()
-  endif(NOT gp_cmd)
-
-  if("${gp_tool}" STREQUAL "dumpbin")
-    # When running dumpbin, it also needs the "Common7/IDE" directory in the
-    # PATH. It will already be in the PATH if being run from a Visual Studio
-    # command prompt. Add it to the PATH here in case we are running from a
-    # different command prompt.
-    #
-    get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
-    get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
-    if(EXISTS "${gp_cmd_dlls_dir}")
-      # only add to the path if it is not already in the path
-      if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
-        set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
-      endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
-    endif(EXISTS "${gp_cmd_dlls_dir}")
-  endif("${gp_tool}" STREQUAL "dumpbin")
-  #
-  # </setup-gp_tool-vars>
-
-  if("${gp_tool}" STREQUAL "ldd")
-    set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
-    foreach(dir ${exepath} ${dirs})
-      set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}")
-    endforeach(dir)
-  endif("${gp_tool}" STREQUAL "ldd")
-
-
-  # Track new prerequisites at each new level of recursion. Start with an
-  # empty list at each level:
-  #
-  set(unseen_prereqs)
-
-  # Run gp_cmd on the target:
-  #
-  execute_process(
-    COMMAND ${gp_cmd} ${gp_cmd_args} ${target}
-    OUTPUT_VARIABLE gp_cmd_ov
-    )
-
-  if("${gp_tool}" STREQUAL "ldd")
-    set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
-  endif("${gp_tool}" STREQUAL "ldd")
-
-  if(verbose)
-    message(STATUS "<RawOutput cmd='${gp_cmd} ${gp_cmd_args} ${target}'>")
-    message(STATUS "gp_cmd_ov='${gp_cmd_ov}'")
-    message(STATUS "</RawOutput>")
-  endif(verbose)
-
-  get_filename_component(target_dir "${target}" PATH)
-
-  # Convert to a list of lines:
-  #
-  string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
-  string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}")
-
-  # Analyze each line for file names that match the regular expression:
-  #
-  foreach(candidate ${candidates})
-  if("${candidate}" MATCHES "${gp_regex}")
-    # Extract information from each candidate:
-    string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
-
-    if(gp_regex_cmp_count GREATER 1)
-      string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")
-      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
-      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
-      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
-    endif(gp_regex_cmp_count GREATER 1)
-
-    if(gp_regex_cmp_count GREATER 2)
-      string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}")
-      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
-      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
-      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
-    endif(gp_regex_cmp_count GREATER 2)
-
-    # Use the raw_item as the list entries returned by this function. Use the
-    # gp_resolve_item function to resolve it to an actual full path file if
-    # necessary.
-    #
-    set(item "${raw_item}")
-
-    # Add each item unless it is excluded:
-    #
-    set(add_item 1)
-
-    if(${exclude_system})
-      set(type "")
-      gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
-      if("${type}" STREQUAL "system")
-        set(add_item 0)
-      endif("${type}" STREQUAL "system")
-    endif(${exclude_system})
-
-    if(add_item)
-      list(LENGTH ${prerequisites_var} list_length_before_append)
-      gp_append_unique(${prerequisites_var} "${item}")
-      list(LENGTH ${prerequisites_var} list_length_after_append)
-
-      if(${recurse})
-        # If item was really added, this is the first time we have seen it.
-        # Add it to unseen_prereqs so that we can recursively add *its*
-        # prerequisites...
-        #
-        # But first: resolve its name to an absolute full path name such
-        # that the analysis tools can simply accept it as input.
-        #
-        if(NOT list_length_before_append EQUAL list_length_after_append)
-          gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
-          set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
-        endif(NOT list_length_before_append EQUAL list_length_after_append)
-      endif(${recurse})
-    endif(add_item)
-  else("${candidate}" MATCHES "${gp_regex}")
-    if(verbose)
-      message(STATUS "ignoring non-matching line: '${candidate}'")
-    endif(verbose)
-  endif("${candidate}" MATCHES "${gp_regex}")
-  endforeach(candidate)
-
-  list(LENGTH ${prerequisites_var} prerequisites_var_length)
-  if(prerequisites_var_length GREATER 0)
-    list(SORT ${prerequisites_var})
-  endif(prerequisites_var_length GREATER 0)
-  if(${recurse})
-    set(more_inputs ${unseen_prereqs})
-    foreach(input ${more_inputs})
-      get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
-    endforeach(input)
-  endif(${recurse})
-
-  set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE)
-endfunction(get_prerequisites)
-
-
-# list_prerequisites target all exclude_system verbose
-#
-#  ARGV0 (target) is the full path to an executable file
-#
-#  optional ARGV1 (all) is 0 or 1: 0 for direct prerequisites only,
-#   1 for all prerequisites recursively
-#
-#  optional ARGV2 (exclude_system) is 0 or 1: 0 to include "system"
-#   prerequisites , 1 to exclude them
-#
-#  optional ARGV3 (verbose) is 0 or 1: 0 to print only full path
-#   names of prerequisites, 1 to print extra information
-#
-function(list_prerequisites target)
-  if("${ARGV1}" STREQUAL "")
-    set(all 1)
-  else("${ARGV1}" STREQUAL "")
-    set(all "${ARGV1}")
-  endif("${ARGV1}" STREQUAL "")
-
-  if("${ARGV2}" STREQUAL "")
-    set(exclude_system 0)
-  else("${ARGV2}" STREQUAL "")
-    set(exclude_system "${ARGV2}")
-  endif("${ARGV2}" STREQUAL "")
-
-  if("${ARGV3}" STREQUAL "")
-    set(verbose 0)
-  else("${ARGV3}" STREQUAL "")
-    set(verbose "${ARGV3}")
-  endif("${ARGV3}" STREQUAL "")
-
-  set(count 0)
-  set(count_str "")
-  set(print_count "${verbose}")
-  set(print_prerequisite_type "${verbose}")
-  set(print_target "${verbose}")
-  set(type_str "")
-
-  get_filename_component(exepath "${target}" PATH)
-
-  set(prereqs "")
-  get_prerequisites("${target}" prereqs ${exclude_system} ${all} "${exepath}" "")
-
-  if(print_target)
-    message(STATUS "File '${target}' depends on:")
-  endif(print_target)
-
-  foreach(d ${prereqs})
-    math(EXPR count "${count} + 1")
-
-    if(print_count)
-      set(count_str "${count}. ")
-    endif(print_count)
-
-    if(print_prerequisite_type)
-      gp_file_type("${target}" "${d}" type)
-      set(type_str " (${type})")
-    endif(print_prerequisite_type)
-
-    message(STATUS "${count_str}${d}${type_str}")
-  endforeach(d)
-endfunction(list_prerequisites)
-
-
-# list_prerequisites_by_glob glob_arg glob_exp
-#
-#  glob_arg is GLOB or GLOB_RECURSE
-#
-#  glob_exp is a globbing expression used with "file(GLOB" to retrieve a list
-#   of matching files. If a matching file is executable, its prerequisites are
-#   listed.
-#
-# Any additional (optional) arguments provided are passed along as the
-# optional arguments to the list_prerequisites calls.
-#
-function(list_prerequisites_by_glob glob_arg glob_exp)
-  message(STATUS "=============================================================================")
-  message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")
-  message(STATUS "")
-  file(${glob_arg} file_list ${glob_exp})
-  foreach(f ${file_list})
-    is_file_executable("${f}" is_f_executable)
-    if(is_f_executable)
-      message(STATUS "=============================================================================")
-      list_prerequisites("${f}" ${ARGN})
-      message(STATUS "")
-    endif(is_f_executable)
-  endforeach(f)
-endfunction(list_prerequisites_by_glob)
+# GetPrerequisites.cmake
+#
+# This script provides functions to list the .dll, .dylib or .so files that an
+# executable or shared library file depends on. (Its prerequisites.)
+#
+# It uses various tools to obtain the list of required shared library files:
+#   dumpbin (Windows)
+#   ldd (Linux/Unix)
+#   otool (Mac OSX)
+#
+# The following functions are provided by this script:
+#   gp_append_unique
+#   is_file_executable
+#   gp_item_default_embedded_path
+#     (projects can override with gp_item_default_embedded_path_override)
+#   gp_resolve_item
+#     (projects can override with gp_resolve_item_override)
+#   gp_resolved_file_type
+#   gp_file_type
+#   get_prerequisites
+#   list_prerequisites
+#   list_prerequisites_by_glob
+#
+# Requires CMake 2.6 or greater because it uses function, break, return and
+# PARENT_SCOPE.
+
+#=============================================================================
+# Copyright 2008-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# gp_append_unique list_var value
+#
+# Append value to the list variable ${list_var} only if the value is not
+# already in the list.
+#
+function(gp_append_unique list_var value)
+  set(contains 0)
+
+  foreach(item ${${list_var}})
+    if("${item}" STREQUAL "${value}")
+      set(contains 1)
+      break()
+    endif("${item}" STREQUAL "${value}")
+  endforeach(item)
+
+  if(NOT contains)
+    set(${list_var} ${${list_var}} "${value}" PARENT_SCOPE)
+  endif(NOT contains)
+endfunction(gp_append_unique)
+
+
+# is_file_executable file result_var
+#
+# Return 1 in ${result_var} if ${file} is a binary executable.
+#
+# Return 0 in ${result_var} otherwise.
+#
+function(is_file_executable file result_var)
+  #
+  # A file is not executable until proven otherwise:
+  #
+  set(${result_var} 0 PARENT_SCOPE)
+
+  get_filename_component(file_full "${file}" ABSOLUTE)
+  string(TOLOWER "${file_full}" file_full_lower)
+
+  # If file name ends in .exe on Windows, *assume* executable:
+  #
+  if(WIN32)
+    if("${file_full_lower}" MATCHES "\\.exe$")
+      set(${result_var} 1 PARENT_SCOPE)
+      return()
+    endif("${file_full_lower}" MATCHES "\\.exe$")
+
+    # A clause could be added here that uses output or return value of dumpbin
+    # to determine ${result_var}. In 99%+? practical cases, the exe name
+    # match will be sufficient...
+    #
+  endif(WIN32)
+
+  # Use the information returned from the Unix shell command "file" to
+  # determine if ${file_full} should be considered an executable file...
+  #
+  # If the file command's output contains "executable" and does *not* contain
+  # "text" then it is likely an executable suitable for prerequisite analysis
+  # via the get_prerequisites macro.
+  #
+  if(UNIX)
+    if(NOT file_cmd)
+      find_program(file_cmd "file")
+    endif(NOT file_cmd)
+
+    if(file_cmd)
+      execute_process(COMMAND "${file_cmd}" "${file_full}"
+        OUTPUT_VARIABLE file_ov
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+
+      # Replace the name of the file in the output with a placeholder token
+      # (the string " _file_full_ ") so that just in case the path name of
+      # the file contains the word "text" or "executable" we are not fooled
+      # into thinking "the wrong thing" because the file name matches the
+      # other 'file' command output we are looking for...
+      #
+      string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
+      string(TOLOWER "${file_ov}" file_ov)
+
+      #message(STATUS "file_ov='${file_ov}'")
+      if("${file_ov}" MATCHES "executable")
+        #message(STATUS "executable!")
+        if("${file_ov}" MATCHES "text")
+          #message(STATUS "but text, so *not* a binary executable!")
+        else("${file_ov}" MATCHES "text")
+          set(${result_var} 1 PARENT_SCOPE)
+          return()
+        endif("${file_ov}" MATCHES "text")
+      endif("${file_ov}" MATCHES "executable")
+    else(file_cmd)
+      message(STATUS "warning: No 'file' command, skipping execute_process...")
+    endif(file_cmd)
+  endif(UNIX)
+endfunction(is_file_executable)
+
+
+# gp_item_default_embedded_path item default_embedded_path_var
+#
+# Return the path that others should refer to the item by when the item
+# is embedded inside a bundle.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_item_default_embedded_path_override function.
+#
+function(gp_item_default_embedded_path item default_embedded_path_var)
+
+  # On Windows and Linux, "embed" prerequisites in the same directory
+  # as the executable by default:
+  #
+  set(path "@executable_path")
+  set(overridden 0)
+
+  # On the Mac, relative to the executable depending on the type
+  # of the thing we are embedding:
+  #
+  if(APPLE)
+    #
+    # The assumption here is that all executables in the bundle will be
+    # in same-level-directories inside the bundle. The parent directory
+    # of an executable inside the bundle should be MacOS or a sibling of
+    # MacOS and all embedded paths returned from here will begin with
+    # "@executable_path/../" and will work from all executables in all
+    # such same-level-directories inside the bundle.
+    #
+
+    # By default, embed things right next to the main bundle executable:
+    #
+    set(path "@executable_path/../../Contents/MacOS")
+
+    # Embed .dylibs right next to the main bundle executable:
+    #
+    if(item MATCHES "\\.dylib$")
+      set(path "@executable_path/../MacOS")
+      set(overridden 1)
+    endif(item MATCHES "\\.dylib$")
+
+    # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
+    #
+    if(NOT overridden)
+      if(item MATCHES "[^/]+\\.framework/")
+        set(path "@executable_path/../Frameworks")
+        set(overridden 1)
+      endif(item MATCHES "[^/]+\\.framework/")
+    endif(NOT overridden)
+  endif()
+
+  # Provide a hook so that projects can override the default embedded location
+  # of any given library by whatever logic they choose:
+  #
+  if(COMMAND gp_item_default_embedded_path_override)
+    gp_item_default_embedded_path_override("${item}" path)
+  endif(COMMAND gp_item_default_embedded_path_override)
+
+  set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
+endfunction(gp_item_default_embedded_path)
+
+
+# gp_resolve_item context item exepath dirs resolved_item_var
+#
+# Resolve an item into an existing full path file.
+#
+# Override on a per-project basis by providing a project-specific
+# gp_resolve_item_override function.
+#
+function(gp_resolve_item context item exepath dirs resolved_item_var)
+  set(resolved 0)
+  set(resolved_item "${item}")
+
+  # Is it already resolved?
+  #
+  if(EXISTS "${resolved_item}")
+    set(resolved 1)
+  endif(EXISTS "${resolved_item}")
+
+  if(NOT resolved)
+    if(item MATCHES "@executable_path")
+      #
+      # @executable_path references are assumed relative to exepath
+      #
+      string(REPLACE "@executable_path" "${exepath}" ri "${item}")
+      get_filename_component(ri "${ri}" ABSOLUTE)
+
+      if(EXISTS "${ri}")
+        #message(STATUS "info: embedded item exists (${ri})")
+        set(resolved 1)
+        set(resolved_item "${ri}")
+      else(EXISTS "${ri}")
+        message(STATUS "warning: embedded item does not exist '${ri}'")
+      endif(EXISTS "${ri}")
+    endif(item MATCHES "@executable_path")
+  endif(NOT resolved)
+
+  if(NOT resolved)
+    if(item MATCHES "@loader_path")
+      #
+      # @loader_path references are assumed relative to the
+      # PATH of the given "context" (presumably another library)
+      #
+      get_filename_component(contextpath "${context}" PATH)
+      string(REPLACE "@loader_path" "${contextpath}" ri "${item}")
+      get_filename_component(ri "${ri}" ABSOLUTE)
+
+      if(EXISTS "${ri}")
+        #message(STATUS "info: embedded item exists (${ri})")
+        set(resolved 1)
+        set(resolved_item "${ri}")
+      else(EXISTS "${ri}")
+        message(STATUS "warning: embedded item does not exist '${ri}'")
+      endif(EXISTS "${ri}")
+    endif(item MATCHES "@loader_path")
+  endif(NOT resolved)
+
+  if(NOT resolved)
+    set(ri "ri-NOTFOUND")
+    find_file(ri "${item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+    find_file(ri "${item}" ${exepath} ${dirs} /usr/lib)
+    if(ri)
+      #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+      set(resolved 1)
+      set(resolved_item "${ri}")
+      set(ri "ri-NOTFOUND")
+    endif(ri)
+  endif(NOT resolved)
+
+  if(NOT resolved)
+    if(item MATCHES "[^/]+\\.framework/")
+      set(fw "fw-NOTFOUND")
+      find_file(fw "${item}"
+        "~/Library/Frameworks"
+        "/Library/Frameworks"
+        "/System/Library/Frameworks"
+      )
+      if(fw)
+        #message(STATUS "info: 'find_file' found framework (${fw})")
+        set(resolved 1)
+        set(resolved_item "${fw}")
+        set(fw "fw-NOTFOUND")
+      endif(fw)
+    endif(item MATCHES "[^/]+\\.framework/")
+  endif(NOT resolved)
+
+  # Using find_program on Windows will find dll files that are in the PATH.
+  # (Converting simple file names into full path names if found.)
+  #
+  if(WIN32)
+  if(NOT resolved)
+    set(ri "ri-NOTFOUND")
+    find_program(ri "${item}" PATHS "${exepath};${dirs}" NO_DEFAULT_PATH)
+    find_program(ri "${item}" PATHS "${exepath};${dirs}")
+    if(ri)
+      #message(STATUS "info: 'find_program' in exepath/dirs (${ri})")
+      set(resolved 1)
+      set(resolved_item "${ri}")
+      set(ri "ri-NOTFOUND")
+    endif(ri)
+  endif(NOT resolved)
+  endif(WIN32)
+
+  # Provide a hook so that projects can override item resolution
+  # by whatever logic they choose:
+  #
+  if(COMMAND gp_resolve_item_override)
+    gp_resolve_item_override("${context}" "${item}" "${exepath}" "${dirs}" resolved_item resolved)
+  endif(COMMAND gp_resolve_item_override)
+
+  if(NOT resolved)
+    message(STATUS "
+warning: cannot resolve item '${item}'
+
+  possible problems:
+    need more directories?
+    need to use InstallRequiredSystemLibraries?
+    run in install tree instead of build tree?
+")
+#    message(STATUS "
+#******************************************************************************
+#warning: cannot resolve item '${item}'
+#
+#  possible problems:
+#    need more directories?
+#    need to use InstallRequiredSystemLibraries?
+#    run in install tree instead of build tree?
+#
+#    context='${context}'
+#    item='${item}'
+#    exepath='${exepath}'
+#    dirs='${dirs}'
+#    resolved_item_var='${resolved_item_var}'
+#******************************************************************************
+#")
+  endif(NOT resolved)
+
+  set(${resolved_item_var} "${resolved_item}" PARENT_SCOPE)
+endfunction(gp_resolve_item)
+
+
+# gp_resolved_file_type original_file file exepath dirs type_var
+#
+# Return the type of ${file} with respect to ${original_file}. String
+# describing type of prerequisite is returned in variable named ${type_var}.
+#
+# Use ${exepath} and ${dirs} if necessary to resolve non-absolute ${file}
+# values -- but only for non-embedded items.
+#
+# Possible types are:
+#   system
+#   local
+#   embedded
+#   other
+#
+function(gp_resolved_file_type original_file file exepath dirs type_var)
+  #message(STATUS "**")
+
+  if(NOT IS_ABSOLUTE "${original_file}")
+    message(STATUS "warning: gp_resolved_file_type expects absolute full path for first arg original_file")
+  endif()
+
+  set(is_embedded 0)
+  set(is_local 0)
+  set(is_system 0)
+
+  set(resolved_file "${file}")
+
+  if("${file}" MATCHES "^@(executable|loader)_path")
+    set(is_embedded 1)
+  endif()
+
+  if(NOT is_embedded)
+    if(NOT IS_ABSOLUTE "${file}")
+      gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
+    endif()
+
+    string(TOLOWER "${original_file}" original_lower)
+    string(TOLOWER "${resolved_file}" lower)
+
+    if(UNIX)
+      if(resolved_file MATCHES "^(/lib/|/lib32/|/lib64/|/usr/lib/|/usr/lib32/|/usr/lib64/|/usr/X11R6/)")
+        set(is_system 1)
+      endif()
+    endif()
+
+    if(APPLE)
+      if(resolved_file MATCHES "^(/System/Library/|/usr/lib/)")
+        set(is_system 1)
+      endif()
+    endif()
+
+    if(WIN32)
+      string(TOLOWER "$ENV{SystemRoot}" sysroot)
+      string(REGEX REPLACE "\\\\" "/" sysroot "${sysroot}")
+
+      string(TOLOWER "$ENV{windir}" windir)
+      string(REGEX REPLACE "\\\\" "/" windir "${windir}")
+
+      if(lower MATCHES "^(${sysroot}/system|${windir}/system|${sysroot}/syswow|${windir}/syswow|(.*/)*msvc[^/]+dll)")
+        set(is_system 1)
+      endif()
+    endif()
+
+    if(NOT is_system)
+      get_filename_component(original_path "${original_lower}" PATH)
+      get_filename_component(path "${lower}" PATH)
+      if("${original_path}" STREQUAL "${path}")
+        set(is_local 1)
+      endif()
+    endif()
+  endif()
+
+  # Return type string based on computed booleans:
+  #
+  set(type "other")
+
+  if(is_system)
+    set(type "system")
+  elseif(is_embedded)
+    set(type "embedded")
+  elseif(is_local)
+    set(type "local")
+  endif()
+
+  #message(STATUS "gp_resolved_file_type: '${file}' '${resolved_file}'")
+  #message(STATUS "                type: '${type}'")
+
+  if(NOT is_embedded)
+    if(NOT IS_ABSOLUTE "${resolved_file}")
+      if(lower MATCHES "^msvc[^/]+dll" AND is_system)
+        message(STATUS "info: non-absolute msvc file '${file}' returning type '${type}'")
+      else()
+        message(STATUS "warning: gp_resolved_file_type non-absolute file '${file}' returning type '${type}' -- possibly incorrect")
+      endif()
+    endif()
+  endif()
+
+  set(${type_var} "${type}" PARENT_SCOPE)
+
+  #message(STATUS "**")
+endfunction()
+
+
+# gp_file_type original_file file type_var
+#
+# Return the type of ${file} with respect to ${original_file}. String
+# describing type of prerequisite is returned in variable named ${type_var}.
+#
+# Possible types are:
+#   system
+#   local
+#   embedded
+#   other
+#
+function(gp_file_type original_file file type_var)
+  if(NOT IS_ABSOLUTE "${original_file}")
+    message(STATUS "warning: gp_file_type expects absolute full path for first arg original_file")
+  endif()
+
+  get_filename_component(exepath "${original_file}" PATH)
+
+  set(type "")
+  gp_resolved_file_type("${original_file}" "${file}" "${exepath}" "" type)
+
+  set(${type_var} "${type}" PARENT_SCOPE)
+endfunction(gp_file_type)
+
+
+# get_prerequisites target prerequisites_var exclude_system recurse dirs
+#
+# Get the list of shared library files required by ${target}. The list in
+# the variable named ${prerequisites_var} should be empty on first entry to
+# this function. On exit, ${prerequisites_var} will contain the list of
+# required shared library files.
+#
+#  target is the full path to an executable file
+#
+#  prerequisites_var is the name of a CMake variable to contain the results
+#
+#  exclude_system is 0 or 1: 0 to include "system" prerequisites , 1 to
+#   exclude them
+#
+#  recurse is 0 or 1: 0 for direct prerequisites only, 1 for all prerequisites
+#   recursively
+#
+#  exepath is the path to the top level executable used for @executable_path
+#   replacment on the Mac
+#
+#  dirs is a list of paths where libraries might be found: these paths are
+#   searched first when a target without any path info is given. Then standard
+#   system locations are also searched: PATH, Framework locations, /usr/lib...
+#
+function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
+  set(verbose 0)
+  set(eol_char "E")
+
+  if(NOT IS_ABSOLUTE "${target}")
+    message("warning: target '${target}' is not absolute...")
+  endif(NOT IS_ABSOLUTE "${target}")
+
+  if(NOT EXISTS "${target}")
+    message("warning: target '${target}' does not exist...")
+  endif(NOT EXISTS "${target}")
+
+  # <setup-gp_tool-vars>
+  #
+  # Try to choose the right tool by default. Caller can set gp_tool prior to
+  # calling this function to force using a different tool.
+  #
+  if("${gp_tool}" STREQUAL "")
+    set(gp_tool "ldd")
+    if(APPLE)
+      set(gp_tool "otool")
+    endif(APPLE)
+    if(WIN32)
+      set(gp_tool "dumpbin")
+    endif(WIN32)
+  endif("${gp_tool}" STREQUAL "")
+
+  set(gp_tool_known 0)
+
+  if("${gp_tool}" STREQUAL "ldd")
+    set(gp_cmd_args "")
+    set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$")
+    set(gp_regex_cmp_count 1)
+    set(gp_tool_known 1)
+  endif("${gp_tool}" STREQUAL "ldd")
+
+  if("${gp_tool}" STREQUAL "otool")
+    set(gp_cmd_args "-L")
+    set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
+    set(gp_regex_cmp_count 3)
+    set(gp_tool_known 1)
+  endif("${gp_tool}" STREQUAL "otool")
+
+  if("${gp_tool}" STREQUAL "dumpbin")
+    set(gp_cmd_args "/dependents")
+    set(gp_regex "^    ([^ ].*[Dd][Ll][Ll])${eol_char}$")
+    set(gp_regex_cmp_count 1)
+    set(gp_tool_known 1)
+    set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
+  endif("${gp_tool}" STREQUAL "dumpbin")
+
+  if(NOT gp_tool_known)
+    message(STATUS "warning: gp_tool='${gp_tool}' is an unknown tool...")
+    message(STATUS "CMake function get_prerequisites needs more code to handle '${gp_tool}'")
+    message(STATUS "Valid gp_tool values are dumpbin, ldd and otool.")
+    return()
+  endif(NOT gp_tool_known)
+
+  set(gp_cmd_paths ${gp_cmd_paths}
+    "C:/Program Files/Microsoft Visual Studio 9.0/VC/bin"
+    "C:/Program Files (x86)/Microsoft Visual Studio 9.0/VC/bin"
+    "C:/Program Files/Microsoft Visual Studio 8/VC/BIN"
+    "C:/Program Files (x86)/Microsoft Visual Studio 8/VC/BIN"
+    "C:/Program Files/Microsoft Visual Studio .NET 2003/VC7/BIN"
+    "C:/Program Files (x86)/Microsoft Visual Studio .NET 2003/VC7/BIN"
+    "/usr/local/bin"
+    "/usr/bin"
+    )
+
+  find_program(gp_cmd ${gp_tool} PATHS ${gp_cmd_paths})
+
+  if(NOT gp_cmd)
+    message(STATUS "warning: could not find '${gp_tool}' - cannot analyze prerequisites...")
+    return()
+  endif(NOT gp_cmd)
+
+  if("${gp_tool}" STREQUAL "dumpbin")
+    # When running dumpbin, it also needs the "Common7/IDE" directory in the
+    # PATH. It will already be in the PATH if being run from a Visual Studio
+    # command prompt. Add it to the PATH here in case we are running from a
+    # different command prompt.
+    #
+    get_filename_component(gp_cmd_dir "${gp_cmd}" PATH)
+    get_filename_component(gp_cmd_dlls_dir "${gp_cmd_dir}/../../Common7/IDE" ABSOLUTE)
+    if(EXISTS "${gp_cmd_dlls_dir}")
+      # only add to the path if it is not already in the path
+      if(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
+        set(ENV{PATH} "$ENV{PATH};${gp_cmd_dlls_dir}")
+      endif(NOT "$ENV{PATH}" MATCHES "${gp_cmd_dlls_dir}")
+    endif(EXISTS "${gp_cmd_dlls_dir}")
+  endif("${gp_tool}" STREQUAL "dumpbin")
+  #
+  # </setup-gp_tool-vars>
+
+  if("${gp_tool}" STREQUAL "ldd")
+    set(old_ld_env "$ENV{LD_LIBRARY_PATH}")
+    foreach(dir ${exepath} ${dirs})
+      set(ENV{LD_LIBRARY_PATH} "${dir}:$ENV{LD_LIBRARY_PATH}")
+    endforeach(dir)
+  endif("${gp_tool}" STREQUAL "ldd")
+
+
+  # Track new prerequisites at each new level of recursion. Start with an
+  # empty list at each level:
+  #
+  set(unseen_prereqs)
+
+  # Run gp_cmd on the target:
+  #
+  execute_process(
+    COMMAND ${gp_cmd} ${gp_cmd_args} ${target}
+    OUTPUT_VARIABLE gp_cmd_ov
+    )
+
+  if("${gp_tool}" STREQUAL "ldd")
+    set(ENV{LD_LIBRARY_PATH} "${old_ld_env}")
+  endif("${gp_tool}" STREQUAL "ldd")
+
+  if(verbose)
+    message(STATUS "<RawOutput cmd='${gp_cmd} ${gp_cmd_args} ${target}'>")
+    message(STATUS "gp_cmd_ov='${gp_cmd_ov}'")
+    message(STATUS "</RawOutput>")
+  endif(verbose)
+
+  get_filename_component(target_dir "${target}" PATH)
+
+  # Convert to a list of lines:
+  #
+  string(REGEX REPLACE ";" "\\\\;" candidates "${gp_cmd_ov}")
+  string(REGEX REPLACE "\n" "${eol_char};" candidates "${candidates}")
+
+  # Analyze each line for file names that match the regular expression:
+  #
+  foreach(candidate ${candidates})
+  if("${candidate}" MATCHES "${gp_regex}")
+    # Extract information from each candidate:
+    string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
+
+    if(gp_regex_cmp_count GREATER 1)
+      string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
+    endif(gp_regex_cmp_count GREATER 1)
+
+    if(gp_regex_cmp_count GREATER 2)
+      string(REGEX REPLACE "${gp_regex}" "\\3" raw_current_version "${candidate}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
+      string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
+    endif(gp_regex_cmp_count GREATER 2)
+
+    # Use the raw_item as the list entries returned by this function. Use the
+    # gp_resolve_item function to resolve it to an actual full path file if
+    # necessary.
+    #
+    set(item "${raw_item}")
+
+    # Add each item unless it is excluded:
+    #
+    set(add_item 1)
+
+    if(${exclude_system})
+      set(type "")
+      gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
+      if("${type}" STREQUAL "system")
+        set(add_item 0)
+      endif("${type}" STREQUAL "system")
+    endif(${exclude_system})
+
+    if(add_item)
+      list(LENGTH ${prerequisites_var} list_length_before_append)
+      gp_append_unique(${prerequisites_var} "${item}")
+      list(LENGTH ${prerequisites_var} list_length_after_append)
+
+      if(${recurse})
+        # If item was really added, this is the first time we have seen it.
+        # Add it to unseen_prereqs so that we can recursively add *its*
+        # prerequisites...
+        #
+        # But first: resolve its name to an absolute full path name such
+        # that the analysis tools can simply accept it as input.
+        #
+        if(NOT list_length_before_append EQUAL list_length_after_append)
+          gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
+          set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
+        endif(NOT list_length_before_append EQUAL list_length_after_append)
+      endif(${recurse})
+    endif(add_item)
+  else("${candidate}" MATCHES "${gp_regex}")
+    if(verbose)
+      message(STATUS "ignoring non-matching line: '${candidate}'")
+    endif(verbose)
+  endif("${candidate}" MATCHES "${gp_regex}")
+  endforeach(candidate)
+
+  list(LENGTH ${prerequisites_var} prerequisites_var_length)
+  if(prerequisites_var_length GREATER 0)
+    list(SORT ${prerequisites_var})
+  endif(prerequisites_var_length GREATER 0)
+  if(${recurse})
+    set(more_inputs ${unseen_prereqs})
+    foreach(input ${more_inputs})
+      get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
+    endforeach(input)
+  endif(${recurse})
+
+  set(${prerequisites_var} ${${prerequisites_var}} PARENT_SCOPE)
+endfunction(get_prerequisites)
+
+
+# list_prerequisites target all exclude_system verbose
+#
+#  ARGV0 (target) is the full path to an executable file
+#
+#  optional ARGV1 (all) is 0 or 1: 0 for direct prerequisites only,
+#   1 for all prerequisites recursively
+#
+#  optional ARGV2 (exclude_system) is 0 or 1: 0 to include "system"
+#   prerequisites , 1 to exclude them
+#
+#  optional ARGV3 (verbose) is 0 or 1: 0 to print only full path
+#   names of prerequisites, 1 to print extra information
+#
+function(list_prerequisites target)
+  if("${ARGV1}" STREQUAL "")
+    set(all 1)
+  else("${ARGV1}" STREQUAL "")
+    set(all "${ARGV1}")
+  endif("${ARGV1}" STREQUAL "")
+
+  if("${ARGV2}" STREQUAL "")
+    set(exclude_system 0)
+  else("${ARGV2}" STREQUAL "")
+    set(exclude_system "${ARGV2}")
+  endif("${ARGV2}" STREQUAL "")
+
+  if("${ARGV3}" STREQUAL "")
+    set(verbose 0)
+  else("${ARGV3}" STREQUAL "")
+    set(verbose "${ARGV3}")
+  endif("${ARGV3}" STREQUAL "")
+
+  set(count 0)
+  set(count_str "")
+  set(print_count "${verbose}")
+  set(print_prerequisite_type "${verbose}")
+  set(print_target "${verbose}")
+  set(type_str "")
+
+  get_filename_component(exepath "${target}" PATH)
+
+  set(prereqs "")
+  get_prerequisites("${target}" prereqs ${exclude_system} ${all} "${exepath}" "")
+
+  if(print_target)
+    message(STATUS "File '${target}' depends on:")
+  endif(print_target)
+
+  foreach(d ${prereqs})
+    math(EXPR count "${count} + 1")
+
+    if(print_count)
+      set(count_str "${count}. ")
+    endif(print_count)
+
+    if(print_prerequisite_type)
+      gp_file_type("${target}" "${d}" type)
+      set(type_str " (${type})")
+    endif(print_prerequisite_type)
+
+    message(STATUS "${count_str}${d}${type_str}")
+  endforeach(d)
+endfunction(list_prerequisites)
+
+
+# list_prerequisites_by_glob glob_arg glob_exp
+#
+#  glob_arg is GLOB or GLOB_RECURSE
+#
+#  glob_exp is a globbing expression used with "file(GLOB" to retrieve a list
+#   of matching files. If a matching file is executable, its prerequisites are
+#   listed.
+#
+# Any additional (optional) arguments provided are passed along as the
+# optional arguments to the list_prerequisites calls.
+#
+function(list_prerequisites_by_glob glob_arg glob_exp)
+  message(STATUS "=============================================================================")
+  message(STATUS "List prerequisites of executables matching ${glob_arg} '${glob_exp}'")
+  message(STATUS "")
+  file(${glob_arg} file_list ${glob_exp})
+  foreach(f ${file_list})
+    is_file_executable("${f}" is_f_executable)
+    if(is_f_executable)
+      message(STATUS "=============================================================================")
+      list_prerequisites("${f}" ${ARGN})
+      message(STATUS "")
+    endif(is_f_executable)
+  endforeach(f)
+endfunction(list_prerequisites_by_glob)
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index 62b764bb307debcee404eb7bc355f8b361cabadb..05f0492234f059146f38ef586295707ef3456cff 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -1,276 +1,276 @@
-# -*- cmake -*-
-include(LLTestCommand)
-include(GoogleMock)
-
-MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
-  # Given a project name and a list of sourcefiles (with optional properties on each),
-  # add targets to build and run the tests specified.
-  # ASSUMPTIONS:
-  # * this macro is being executed in the project file that is passed in
-  # * current working SOURCE dir is that project dir
-  # * there is a subfolder tests/ with test code corresponding to the filenames passed in
-  # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT)
-  #
-  # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code
-  #
-  # WARNING: do NOT modify this code without working with poppy -
-  # there is another branch that will conflict heavily with any changes here.
-INCLUDE(GoogleMock)
-
-
-  IF(LL_TEST_VERBOSE)
-    MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}")
-  ENDIF(LL_TEST_VERBOSE)
-
-  # Start with the header and project-wide setup before making targets
-  #project(UNITTEST_PROJECT_${project})
-  # Setup includes, paths, etc
-  SET(alltest_SOURCE_FILES
-    ${CMAKE_SOURCE_DIR}/test/test.cpp
-    ${CMAKE_SOURCE_DIR}/test/lltut.cpp
-    )
-  SET(alltest_DEP_TARGETS
-    # needed by the test harness itself
-    ${APRUTIL_LIBRARIES}
-    ${APR_LIBRARIES}
-    llcommon
-    )
-  IF(NOT "${project}" STREQUAL "llmath")
-    # add llmath as a dep unless the tested module *is* llmath!
-    LIST(APPEND alltest_DEP_TARGETS
-      llmath
-      )
-  ENDIF(NOT "${project}" STREQUAL "llmath")
-  SET(alltest_INCLUDE_DIRS
-    ${LLMATH_INCLUDE_DIRS}
-    ${LLCOMMON_INCLUDE_DIRS}
-    ${LIBS_OPEN_DIR}/test
-    ${GOOGLEMOCK_INCLUDE_DIRS}
-    )
-  SET(alltest_LIBRARIES
-    ${GOOGLEMOCK_LIBRARIES}
-    ${PTHREAD_LIBRARY}
-    ${WINDOWS_LIBRARIES}
-    )
-  # Headers, for convenience in targets.
-  SET(alltest_HEADER_FILES
-    ${CMAKE_SOURCE_DIR}/test/test.h
-    )
-
-  # Use the default flags
-  if (LINUX)
-    SET(CMAKE_EXE_LINKER_FLAGS "")
-  endif (LINUX)
-
-  # start the source test executable definitions
-  SET(${project}_TEST_OUTPUT "")
-  FOREACH (source ${sources})
-    STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} )
-    STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} )
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})")
-    ENDIF(LL_TEST_VERBOSE)
-
-    #
-    # Per-codefile additional / external source, header, and include dir property extraction
-    #
-    # Source
-    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES)
-    IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND)
-      SET(${name}_test_additional_SOURCE_FILES "")
-    ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND)
-    SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} )
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}")
-    ENDIF(LL_TEST_VERBOSE)
-    # Headers
-    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES)
-    IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND)
-      SET(${name}_test_additional_HEADER_FILES "")
-    ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND)
-    SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES})
-    set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE)
-    LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES})
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}")
-    ENDIF(LL_TEST_VERBOSE)
-    # Include dirs
-    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS)
-    IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
-      SET(${name}_test_additional_INCLUDE_DIRS "")
-    ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
-    INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${name}_test_additional_INCLUDE_DIRS )
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}")
-    ENDIF(LL_TEST_VERBOSE)
-
-
-    # Setup target
-    ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
-    SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
-
-    #
-    # Per-codefile additional / external project dep and lib dep property extraction
-    #
-    # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19
-    # Projects
-    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS)
-    IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND)
-      SET(${name}_test_additional_PROJECTS "")
-    ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND)
-    # Libraries
-    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES)
-    IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND)
-      SET(${name}_test_additional_LIBRARIES "")
-    ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND)
-    IF(LL_TEST_VERBOSE)
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}")
-      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}")
-    ENDIF(LL_TEST_VERBOSE)
-    # Add to project
-    TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} )
-    # Compile-time Definitions
-    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS)
-     IF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND)
-       SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES COMPILE_FLAGS ${${name}_test_additional_CFLAGS} )
-       IF(LL_TEST_VERBOSE)
-         MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}")
-       ENDIF(LL_TEST_VERBOSE)
-     ENDIF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND)
-     
-    #
-    # Setup test targets
-    #
-    GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION)
-    SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt)
-    SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
-
-    # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19
-    IF(LL_TEST_VERBOSE)
-      MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd  = ${TEST_CMD}")
-    ENDIF(LL_TEST_VERBOSE)
-
-    SET_TEST_PATH(LD_LIBRARY_PATH)
-    LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD})
-    IF(LL_TEST_VERBOSE)
-      MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script  = ${TEST_SCRIPT_CMD}")
-    ENDIF(LL_TEST_VERBOSE)
-    # Add test 
-    ADD_CUSTOM_COMMAND(
-        OUTPUT ${TEST_OUTPUT}
-        COMMAND ${TEST_SCRIPT_CMD}
-        DEPENDS PROJECT_${project}_TEST_${name}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-        )
-    # Why not add custom target and add POST_BUILD command?
-    # Slightly less uncertain behavior
-    # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19
-    # > I did not use a post build step as I could not make it notify of a 
-    # > failure after the first time you build and fail a test. - daveh 2009-04-20
-    LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT})
-  ENDFOREACH (source)
-
-  # Add the test runner target per-project
-  # (replaces old _test_ok targets all over the place)
-  ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT})
-  ADD_DEPENDENCIES(${project} ${project}_tests)
-ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS)
-
-FUNCTION(LL_ADD_INTEGRATION_TEST 
-    testname
-    additional_source_files
-    library_dependencies
-# variable args
-    )
-  if(TEST_DEBUG)
-    message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on")
-  endif(TEST_DEBUG)
-  
-  SET(source_files
-    tests/${testname}_test.cpp
-    ${CMAKE_SOURCE_DIR}/test/test.cpp
-    ${CMAKE_SOURCE_DIR}/test/lltut.cpp
-    ${additional_source_files}
-    )
-
-  SET(libraries
-    ${library_dependencies}
-    ${GOOGLEMOCK_LIBRARIES}
-    ${PTHREAD_LIBRARY}
-    )
-
-  # Add test executable build target
-  if(TEST_DEBUG)
-    message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})")
-  endif(TEST_DEBUG)
-  ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
-  SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
-  if(STANDALONE)
-    SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}")
-  endif(STANDALONE)
-
-  # Add link deps to the executable
-  if(TEST_DEBUG)
-    message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})")
-  endif(TEST_DEBUG)
-  TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})
-
-  # Create the test running command
-  SET(test_command ${ARGN})
-  GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION)
-  LIST(FIND test_command "{}" test_exe_pos)
-  IF(test_exe_pos LESS 0)
-    # The {} marker means "the full pathname of the test executable."
-    # test_exe_pos -1 means we didn't find it -- so append the test executable
-    # name to $ARGN, the variable part of the arg list. This is convenient
-    # shorthand for both straightforward execution of the test program (empty
-    # $ARGN) and for running a "wrapper" program of some kind accepting the
-    # pathname of the test program as the last of its args. You need specify
-    # {} only if the test program's pathname isn't the last argument in the
-    # desired command line.
-    LIST(APPEND test_command "${TEST_EXE}")
-  ELSE (test_exe_pos LESS 0)
-    # Found {} marker at test_exe_pos. Remove the {}...
-    LIST(REMOVE_AT test_command test_exe_pos)
-    # ...and replace it with the actual name of the test executable.
-    LIST(INSERT test_command test_exe_pos "${TEST_EXE}")
-  ENDIF (test_exe_pos LESS 0)
-
-  SET_TEST_PATH(LD_LIBRARY_PATH)
-  LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command})
-
-  if(TEST_DEBUG)
-    message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}")
-  endif(TEST_DEBUG)
-
-  ADD_CUSTOM_COMMAND(
-    TARGET INTEGRATION_TEST_${testname}
-    POST_BUILD
-    COMMAND ${TEST_SCRIPT_CMD}
-    )
-
-  # Use CTEST? Not sure how to yet...
-  # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
-
-ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
-
-MACRO(SET_TEST_PATH LISTVAR)
-  IF(WINDOWS)
-    # We typically build/package only Release variants of third-party
-    # libraries, so append the Release staging dir in case the library being
-    # sought doesn't have a debug variant.
-    set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release)
-  ELSEIF(DARWIN)
-    # We typically build/package only Release variants of third-party
-    # libraries, so append the Release staging dir in case the library being
-    # sought doesn't have a debug variant.
-    set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib)
-  ELSE(WINDOWS)
-    # Linux uses a single staging directory anyway.
-    IF (STANDALONE)
-      set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib)
-    ELSE (STANDALONE)
-      set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib)
-    ENDIF (STANDALONE)
-  ENDIF(WINDOWS)
-ENDMACRO(SET_TEST_PATH)
+# -*- cmake -*-
+include(LLTestCommand)
+include(GoogleMock)
+
+MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
+  # Given a project name and a list of sourcefiles (with optional properties on each),
+  # add targets to build and run the tests specified.
+  # ASSUMPTIONS:
+  # * this macro is being executed in the project file that is passed in
+  # * current working SOURCE dir is that project dir
+  # * there is a subfolder tests/ with test code corresponding to the filenames passed in
+  # * properties for each sourcefile passed in indicate what libs to link that file with (MAKE NO ASSUMPTIONS ASIDE FROM TUT)
+  #
+  # More info and examples at: https://wiki.secondlife.com/wiki/How_to_add_unit_tests_to_indra_code
+  #
+  # WARNING: do NOT modify this code without working with poppy -
+  # there is another branch that will conflict heavily with any changes here.
+INCLUDE(GoogleMock)
+
+
+  IF(LL_TEST_VERBOSE)
+    MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}")
+  ENDIF(LL_TEST_VERBOSE)
+
+  # Start with the header and project-wide setup before making targets
+  #project(UNITTEST_PROJECT_${project})
+  # Setup includes, paths, etc
+  SET(alltest_SOURCE_FILES
+    ${CMAKE_SOURCE_DIR}/test/test.cpp
+    ${CMAKE_SOURCE_DIR}/test/lltut.cpp
+    )
+  SET(alltest_DEP_TARGETS
+    # needed by the test harness itself
+    ${APRUTIL_LIBRARIES}
+    ${APR_LIBRARIES}
+    llcommon
+    )
+  IF(NOT "${project}" STREQUAL "llmath")
+    # add llmath as a dep unless the tested module *is* llmath!
+    LIST(APPEND alltest_DEP_TARGETS
+      llmath
+      )
+  ENDIF(NOT "${project}" STREQUAL "llmath")
+  SET(alltest_INCLUDE_DIRS
+    ${LLMATH_INCLUDE_DIRS}
+    ${LLCOMMON_INCLUDE_DIRS}
+    ${LIBS_OPEN_DIR}/test
+    ${GOOGLEMOCK_INCLUDE_DIRS}
+    )
+  SET(alltest_LIBRARIES
+    ${GOOGLEMOCK_LIBRARIES}
+    ${PTHREAD_LIBRARY}
+    ${WINDOWS_LIBRARIES}
+    )
+  # Headers, for convenience in targets.
+  SET(alltest_HEADER_FILES
+    ${CMAKE_SOURCE_DIR}/test/test.h
+    )
+
+  # Use the default flags
+  if (LINUX)
+    SET(CMAKE_EXE_LINKER_FLAGS "")
+  endif (LINUX)
+
+  # start the source test executable definitions
+  SET(${project}_TEST_OUTPUT "")
+  FOREACH (source ${sources})
+    STRING( REGEX REPLACE "(.*)\\.[^.]+$" "\\1" name ${source} )
+    STRING( REGEX REPLACE ".*\\.([^.]+)$" "\\1" extension ${source} )
+    IF(LL_TEST_VERBOSE)
+      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} individual source: ${source} (${name}.${extension})")
+    ENDIF(LL_TEST_VERBOSE)
+
+    #
+    # Per-codefile additional / external source, header, and include dir property extraction
+    #
+    # Source
+    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_SOURCE_FILES ${source} LL_TEST_ADDITIONAL_SOURCE_FILES)
+    IF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND)
+      SET(${name}_test_additional_SOURCE_FILES "")
+    ENDIF(${name}_test_additional_SOURCE_FILES MATCHES NOTFOUND)
+    SET(${name}_test_SOURCE_FILES ${source} tests/${name}_test.${extension} ${alltest_SOURCE_FILES} ${${name}_test_additional_SOURCE_FILES} )
+    IF(LL_TEST_VERBOSE)
+      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_SOURCE_FILES ${${name}_test_SOURCE_FILES}")
+    ENDIF(LL_TEST_VERBOSE)
+    # Headers
+    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_HEADER_FILES ${source} LL_TEST_ADDITIONAL_HEADER_FILES)
+    IF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND)
+      SET(${name}_test_additional_HEADER_FILES "")
+    ENDIF(${name}_test_additional_HEADER_FILES MATCHES NOTFOUND)
+    SET(${name}_test_HEADER_FILES ${name}.h ${${name}_test_additional_HEADER_FILES})
+    set_source_files_properties(${${name}_test_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE)
+    LIST(APPEND ${name}_test_SOURCE_FILES ${${name}_test_HEADER_FILES})
+    IF(LL_TEST_VERBOSE)
+      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_HEADER_FILES ${${name}_test_HEADER_FILES}")
+    ENDIF(LL_TEST_VERBOSE)
+    # Include dirs
+    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_INCLUDE_DIRS ${source} LL_TEST_ADDITIONAL_INCLUDE_DIRS)
+    IF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
+      SET(${name}_test_additional_INCLUDE_DIRS "")
+    ENDIF(${name}_test_additional_INCLUDE_DIRS MATCHES NOTFOUND)
+    INCLUDE_DIRECTORIES(${alltest_INCLUDE_DIRS} ${name}_test_additional_INCLUDE_DIRS )
+    IF(LL_TEST_VERBOSE)
+      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}")
+    ENDIF(LL_TEST_VERBOSE)
+
+
+    # Setup target
+    ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
+    SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
+
+    #
+    # Per-codefile additional / external project dep and lib dep property extraction
+    #
+    # WARNING: it's REALLY IMPORTANT to not mix these. I guarantee it will not work in the future. + poppy 2009-04-19
+    # Projects
+    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_PROJECTS ${source} LL_TEST_ADDITIONAL_PROJECTS)
+    IF(${name}_test_additional_PROJECTS MATCHES NOTFOUND)
+      SET(${name}_test_additional_PROJECTS "")
+    ENDIF(${name}_test_additional_PROJECTS MATCHES NOTFOUND)
+    # Libraries
+    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_LIBRARIES ${source} LL_TEST_ADDITIONAL_LIBRARIES)
+    IF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND)
+      SET(${name}_test_additional_LIBRARIES "")
+    ENDIF(${name}_test_additional_LIBRARIES MATCHES NOTFOUND)
+    IF(LL_TEST_VERBOSE)
+      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_PROJECTS ${${name}_test_additional_PROJECTS}")
+      MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_LIBRARIES ${${name}_test_additional_LIBRARIES}")
+    ENDIF(LL_TEST_VERBOSE)
+    # Add to project
+    TARGET_LINK_LIBRARIES(PROJECT_${project}_TEST_${name} ${alltest_LIBRARIES} ${alltest_DEP_TARGETS} ${${name}_test_additional_PROJECTS} ${${name}_test_additional_LIBRARIES} )
+    # Compile-time Definitions
+    GET_SOURCE_FILE_PROPERTY(${name}_test_additional_CFLAGS ${source} LL_TEST_ADDITIONAL_CFLAGS)
+     IF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND)
+       SET_TARGET_PROPERTIES(PROJECT_${project}_TEST_${name} PROPERTIES COMPILE_FLAGS ${${name}_test_additional_CFLAGS} )
+       IF(LL_TEST_VERBOSE)
+         MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_CFLAGS ${${name}_test_additional_CFLAGS}")
+       ENDIF(LL_TEST_VERBOSE)
+     ENDIF(NOT ${name}_test_additional_CFLAGS MATCHES NOTFOUND)
+     
+    #
+    # Setup test targets
+    #
+    GET_TARGET_PROPERTY(TEST_EXE PROJECT_${project}_TEST_${name} LOCATION)
+    SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/PROJECT_${project}_TEST_${name}_ok.txt)
+    SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
+
+    # daveh - what configuration does this use? Debug? it's cmake-time, not build time. + poppy 2009-04-19
+    IF(LL_TEST_VERBOSE)
+      MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_cmd  = ${TEST_CMD}")
+    ENDIF(LL_TEST_VERBOSE)
+
+    SET_TEST_PATH(LD_LIBRARY_PATH)
+    LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${TEST_CMD})
+    IF(LL_TEST_VERBOSE)
+      MESSAGE(STATUS "LL_ADD_PROJECT_UNIT_TESTS ${name} test_script  = ${TEST_SCRIPT_CMD}")
+    ENDIF(LL_TEST_VERBOSE)
+    # Add test 
+    ADD_CUSTOM_COMMAND(
+        OUTPUT ${TEST_OUTPUT}
+        COMMAND ${TEST_SCRIPT_CMD}
+        DEPENDS PROJECT_${project}_TEST_${name}
+        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        )
+    # Why not add custom target and add POST_BUILD command?
+    # Slightly less uncertain behavior
+    # (OUTPUT commands run non-deterministically AFAIK) + poppy 2009-04-19
+    # > I did not use a post build step as I could not make it notify of a 
+    # > failure after the first time you build and fail a test. - daveh 2009-04-20
+    LIST(APPEND ${project}_TEST_OUTPUT ${TEST_OUTPUT})
+  ENDFOREACH (source)
+
+  # Add the test runner target per-project
+  # (replaces old _test_ok targets all over the place)
+  ADD_CUSTOM_TARGET(${project}_tests ALL DEPENDS ${${project}_TEST_OUTPUT})
+  ADD_DEPENDENCIES(${project} ${project}_tests)
+ENDMACRO(LL_ADD_PROJECT_UNIT_TESTS)
+
+FUNCTION(LL_ADD_INTEGRATION_TEST 
+    testname
+    additional_source_files
+    library_dependencies
+# variable args
+    )
+  if(TEST_DEBUG)
+    message(STATUS "Adding INTEGRATION_TEST_${testname} - debug output is on")
+  endif(TEST_DEBUG)
+  
+  SET(source_files
+    tests/${testname}_test.cpp
+    ${CMAKE_SOURCE_DIR}/test/test.cpp
+    ${CMAKE_SOURCE_DIR}/test/lltut.cpp
+    ${additional_source_files}
+    )
+
+  SET(libraries
+    ${library_dependencies}
+    ${GOOGLEMOCK_LIBRARIES}
+    ${PTHREAD_LIBRARY}
+    )
+
+  # Add test executable build target
+  if(TEST_DEBUG)
+    message(STATUS "ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})")
+  endif(TEST_DEBUG)
+  ADD_EXECUTABLE(INTEGRATION_TEST_${testname} ${source_files})
+  SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}")
+  if(STANDALONE)
+    SET_TARGET_PROPERTIES(INTEGRATION_TEST_${testname} PROPERTIES COMPILE_FLAGS -I"${TUT_INCLUDE_DIR}")
+  endif(STANDALONE)
+
+  # Add link deps to the executable
+  if(TEST_DEBUG)
+    message(STATUS "TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})")
+  endif(TEST_DEBUG)
+  TARGET_LINK_LIBRARIES(INTEGRATION_TEST_${testname} ${libraries})
+
+  # Create the test running command
+  SET(test_command ${ARGN})
+  GET_TARGET_PROPERTY(TEST_EXE INTEGRATION_TEST_${testname} LOCATION)
+  LIST(FIND test_command "{}" test_exe_pos)
+  IF(test_exe_pos LESS 0)
+    # The {} marker means "the full pathname of the test executable."
+    # test_exe_pos -1 means we didn't find it -- so append the test executable
+    # name to $ARGN, the variable part of the arg list. This is convenient
+    # shorthand for both straightforward execution of the test program (empty
+    # $ARGN) and for running a "wrapper" program of some kind accepting the
+    # pathname of the test program as the last of its args. You need specify
+    # {} only if the test program's pathname isn't the last argument in the
+    # desired command line.
+    LIST(APPEND test_command "${TEST_EXE}")
+  ELSE (test_exe_pos LESS 0)
+    # Found {} marker at test_exe_pos. Remove the {}...
+    LIST(REMOVE_AT test_command test_exe_pos)
+    # ...and replace it with the actual name of the test executable.
+    LIST(INSERT test_command test_exe_pos "${TEST_EXE}")
+  ENDIF (test_exe_pos LESS 0)
+
+  SET_TEST_PATH(LD_LIBRARY_PATH)
+  LL_TEST_COMMAND(TEST_SCRIPT_CMD "${LD_LIBRARY_PATH}" ${test_command})
+
+  if(TEST_DEBUG)
+    message(STATUS "TEST_SCRIPT_CMD: ${TEST_SCRIPT_CMD}")
+  endif(TEST_DEBUG)
+
+  ADD_CUSTOM_COMMAND(
+    TARGET INTEGRATION_TEST_${testname}
+    POST_BUILD
+    COMMAND ${TEST_SCRIPT_CMD}
+    )
+
+  # Use CTEST? Not sure how to yet...
+  # ADD_TEST(INTEGRATION_TEST_RUNNER_${testname} ${TEST_SCRIPT_CMD})
+
+ENDFUNCTION(LL_ADD_INTEGRATION_TEST)
+
+MACRO(SET_TEST_PATH LISTVAR)
+  IF(WINDOWS)
+    # We typically build/package only Release variants of third-party
+    # libraries, so append the Release staging dir in case the library being
+    # sought doesn't have a debug variant.
+    set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR} ${SHARED_LIB_STAGING_DIR}/Release)
+  ELSEIF(DARWIN)
+    # We typically build/package only Release variants of third-party
+    # libraries, so append the Release staging dir in case the library being
+    # sought doesn't have a debug variant.
+    set(${LISTVAR} ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/Resources ${SHARED_LIB_STAGING_DIR}/Release/Resources /usr/lib)
+  ELSE(WINDOWS)
+    # Linux uses a single staging directory anyway.
+    IF (STANDALONE)
+      set(${LISTVAR} ${CMAKE_BINARY_DIR}/llcommon /usr/lib /usr/local/lib)
+    ELSE (STANDALONE)
+      set(${LISTVAR} ${SHARED_LIB_STAGING_DIR} /usr/lib)
+    ENDIF (STANDALONE)
+  ENDIF(WINDOWS)
+ENDMACRO(SET_TEST_PATH)
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index c9cb1cd6e7c80366564891c9440a1630ea203a73..5e540ad8c58bd2b2ad4b7614329509aa43270a21 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -97,7 +97,11 @@ void LLAudioEngine::setDefaults()
 	}
 
 	mMasterGain = 1.f;
-	mInternalGain = 0.f;
+	// Setting mInternalGain to an out of range value fixes the issue reported in STORM-830.
+	// There is an edge case in setMasterGain during startup which prevents setInternalGain from 
+	// being called if the master volume setting and mInternalGain both equal 0, so using -1 forces
+	// the if statement in setMasterGain to execute when the viewer starts up.
+	mInternalGain = -1.f;
 	mNextWindUpdate = 0.f;
 
 	mStreamingAudioImpl = NULL;
diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp
index b1ec9e9875fde02adad2c946446f460086ae6cfb..ad1845d387a29614ad5956fba454dcdccd9aa236 100644
--- a/indra/llcommon/llavatarname.cpp
+++ b/indra/llcommon/llavatarname.cpp
@@ -48,7 +48,7 @@ LLAvatarName::LLAvatarName()
 	mLegacyFirstName(),
 	mLegacyLastName(),
 	mIsDisplayNameDefault(false),
-	mIsDummy(false),
+	mIsTemporaryName(false),
 	mExpires(F64_MAX),
 	mNextUpdate(0.0)
 { }
diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h
index 145aeccd35c1a4e6a738f4b2b5a00d6283e2c91e..ba258d6d52420788bf5256905bff53f2295426a2 100644
--- a/indra/llcommon/llavatarname.h
+++ b/indra/llcommon/llavatarname.h
@@ -79,7 +79,7 @@ class LL_COMMON_API LLAvatarName
 	// Under error conditions, we may insert "dummy" records with
 	// names like "???" into caches as placeholders.  These can be
 	// shown in UI, but are not serialized.
-	bool mIsDummy;
+	bool mIsTemporaryName;
 
 	// Names can change, so need to keep track of when name was
 	// last checked.
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index 8f02391e75a7dcbcf6f2d1b8734aca1550d7969f..c32a776c3f591f81e22fbabaf88af90d61266d7d 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -92,6 +92,17 @@ LLFILE*	LLFile::_fsopen(const std::string& filename, const char* mode, int shari
 #endif
 }
 
+int	LLFile::close(LLFILE * file)
+{
+	int ret_value = 0;
+	if (file)
+	{
+		ret_value = fclose(file);
+	}
+	return ret_value;
+}
+
+
 int	LLFile::remove(const std::string& filename)
 {
 #if	LL_WINDOWS
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 4913af7cb54dc52d09b81c2b67a6180e0673db90..dd7d36513a06d13c81638c1d7eafbdac2e60ab9e 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -71,6 +71,8 @@ class LL_COMMON_API LLFile
 	static	LLFILE*	fopen(const std::string& filename,const char* accessmode);	/* Flawfinder: ignore */
 	static	LLFILE*	_fsopen(const std::string& filename,const char* accessmode,int	sharingFlag);
 
+	static	int		close(LLFILE * file);
+
 	// perms is a permissions mask like 0777 or 0700.  In most cases it will
 	// be overridden by the user's umask.  It is ignored on Windows.
 	static	int		mkdir(const std::string& filename, int perms = 0700);
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 356e0f4c0f3344ca7bf0e5e332070b384eb7915c..7d5afe92dcbfcde6b78616a1e621e6f60062b6d4 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -28,7 +28,7 @@
 #define LL_LLVERSIONVIEWER_H
 
 const S32 LL_VERSION_MAJOR = 2;
-const S32 LL_VERSION_MINOR = 5;
+const S32 LL_VERSION_MINOR = 6;
 const S32 LL_VERSION_PATCH = 0;
 const S32 LL_VERSION_BUILD = 0;
 
diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp
index fe737e2072ab3be51faaa4052463221a22638668..2cc7d3c460c7ed93146271a1e013ab26d7ef7b49 100644
--- a/indra/llimage/llpngwrapper.cpp
+++ b/indra/llimage/llpngwrapper.cpp
@@ -50,8 +50,6 @@ LLPngWrapper::LLPngWrapper()
 	  mCompressionType( 0 ),
 	  mFilterMethod( 0 ),
 	  mFinalSize( 0 ),
-	  mHasBKGD(false),
-	  mBackgroundColor(),
 	  mGamma(0.f)
 {
 }
@@ -111,9 +109,9 @@ void LLPngWrapper::writeFlush(png_structp png_ptr)
 }
 
 // Read the PNG file using the libpng.  The low-level interface is used here
-// because we want to do various transformations (including setting the
-// matte background if any, and applying gama) which can't be done with
-// the high-level interface. The scanline also begins at the bottom of
+// because we want to do various transformations (including applying gama)
+// which can't be done with the high-level interface.
+// The scanline also begins at the bottom of
 // the image (per SecondLife conventions) instead of at the top, so we
 // must assign row-pointers in "reverse" order.
 BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop)
@@ -201,8 +199,7 @@ void LLPngWrapper::normalizeImage()
 	//		2. Convert grayscales to RGB
 	//		3. Create alpha layer from transparency
 	//		4. Ensure 8-bpp for all images
-	//		5. Apply background matte if any
-	//		6. Set (or guess) gamma
+	//		5. Set (or guess) gamma
 
 	if (mColorType == PNG_COLOR_TYPE_PALETTE)
 	{
@@ -229,12 +226,6 @@ void LLPngWrapper::normalizeImage()
 	{
 		png_set_strip_16(mReadPngPtr);
 	}
-	mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
-	if (mHasBKGD)
-	{
-		png_set_background(mReadPngPtr, mBackgroundColor,
-			PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
-	}
 
 #if LL_DARWIN
 	const F64 SCREEN_GAMMA = 1.8;
@@ -261,7 +252,6 @@ void LLPngWrapper::updateMetaData()
     mBitDepth = png_get_bit_depth(mReadPngPtr, mReadInfoPtr);
     mColorType = png_get_color_type(mReadPngPtr, mReadInfoPtr);
 	mChannels = png_get_channels(mReadPngPtr, mReadInfoPtr);
-	mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor);
 }
 
 // Method to write raw image into PNG at dest. The raw scanline begins
diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h
index 47a4207d6677a9927ed2322cd817359025e758e5..739f4359961c6155bcfb3bd68fb11c70326b8883 100644
--- a/indra/llimage/llpngwrapper.h
+++ b/indra/llimage/llpngwrapper.h
@@ -88,9 +88,6 @@ class LLPngWrapper
 
 	U32 mFinalSize;
 
-	bool mHasBKGD;
-	png_color_16p mBackgroundColor;
-
 	F64 mGamma;
 
 	std::string mErrorMessage;
diff --git a/indra/llmath/llbbox.cpp b/indra/llmath/llbbox.cpp
index b46a6e03d2ed198ed9680e31b98bc711e9b172e1..3e2c05a6e6d4d861c6755213b88fb785e87ad0cb 100644
--- a/indra/llmath/llbbox.cpp
+++ b/indra/llmath/llbbox.cpp
@@ -89,6 +89,19 @@ void LLBBox::addBBoxAgent(const LLBBox& b)
 	}
 }
 
+LLBBox LLBBox::getAxisAligned() const
+{
+	// no rotation = axis aligned rotation
+	LLBBox aligned(mPosAgent, LLQuaternion(), LLVector3(), LLVector3());
+
+	// add the center point so that it's not empty
+	aligned.addPointAgent(mPosAgent);
+
+	// add our BBox
+	aligned.addBBoxAgent(*this);
+
+	return aligned;
+}
 
 void LLBBox::expand( F32 delta )
 {
@@ -147,6 +160,15 @@ BOOL LLBBox::containsPointAgent(const LLVector3& p) const
 	return containsPointLocal(point_local);
 }
 
+LLVector3 LLBBox::getMinAgent() const
+{
+	return localToAgent(mMinLocal);
+}
+
+LLVector3 LLBBox::getMaxAgent() const
+{
+	return localToAgent(mMaxLocal);
+}
 
 /*
 LLBBox operator*(const LLBBox &a, const LLMatrix4 &b)
diff --git a/indra/llmath/llbbox.h b/indra/llmath/llbbox.h
index 5b911793f0f4ae12289deff4e00540a8ea8a877a..28e69b75e122629aa680b83927463be3aefd52c9 100644
--- a/indra/llmath/llbbox.h
+++ b/indra/llmath/llbbox.h
@@ -51,9 +51,11 @@ class LLBBox
 	const LLVector3&	getPositionAgent() const			{ return mPosAgent; }
 	const LLQuaternion&	getRotation() const					{ return mRotation; }
 
+	LLVector3           getMinAgent() const;
 	const LLVector3&	getMinLocal() const					{ return mMinLocal; }
 	void				setMinLocal( const LLVector3& min )	{ mMinLocal = min; }
 
+	LLVector3           getMaxAgent() const;
 	const LLVector3&	getMaxLocal() const					{ return mMaxLocal; }
 	void				setMaxLocal( const LLVector3& max )	{ mMaxLocal = max; }
 
@@ -80,6 +82,8 @@ class LLBBox
 	LLVector3			localToAgentBasis(const LLVector3& v) const;
 	LLVector3			agentToLocalBasis(const LLVector3& v) const;
 
+	// Get the smallest possible axis aligned bbox that contains this bbox
+	LLBBox              getAxisAligned() const;
 
 //	friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b);
 
diff --git a/indra/llmath/tests/m3math_test.cpp b/indra/llmath/tests/m3math_test.cpp
index 8abf61b740d21ca7bf927c7cd9f106a584e4ce5f..e4d31996a3629963bd7185efa0306d279f485000 100644
--- a/indra/llmath/tests/m3math_test.cpp
+++ b/indra/llmath/tests/m3math_test.cpp
@@ -280,7 +280,6 @@ namespace tut
 		llmat_obj.setRows(llvec1, llvec2, llvec3);
 		llmat_obj.orthogonalize();
 
-		skip("Grr, LLMatrix3::orthogonalize test is failing.  Has it ever worked?");
 		ensure("LLMatrix3::orthogonalize failed ",
 		       is_approx_equal(0.19611613f, llmat_obj.mMatrix[0][0]) &&
 		       is_approx_equal(0.78446454f, llmat_obj.mMatrix[0][1]) &&
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 03c28eb2a56bae5c34059273f637ec3a76fe4a79..767001b6337ad05a358914ef3406331aa3effa4a 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -81,8 +81,11 @@ namespace LLAvatarNameCache
 	// only need per-frame timing resolution
 	LLFrameTimer sRequestTimer;
 
-	// Periodically clean out expired entries from the cache
-	//LLFrameTimer sEraseExpiredTimer;
+    /// Maximum time an unrefreshed cache entry is allowed
+    const F64 MAX_UNREFRESHED_TIME = 20.0 * 60.0;
+
+    /// Time when unrefreshed cached names were checked last
+    static F64 sLastExpireCheck;
 
 	//-----------------------------------------------------------------------
 	// Internal methods
@@ -99,8 +102,9 @@ namespace LLAvatarNameCache
 
 	// Legacy name system callback
 	void legacyNameCallback(const LLUUID& agent_id,
-		const std::string& full_name,
-		bool is_group);
+							const std::string& full_name,
+							bool is_group
+							);
 
 	void requestNamesViaLegacy();
 
@@ -117,7 +121,7 @@ namespace LLAvatarNameCache
 	bool isRequestPending(const LLUUID& agent_id);
 
 	// Erase expired names from cache
-	void eraseExpired();
+	void eraseUnrefreshed();
 
 	bool expirationFromCacheControl(LLSD headers, F64 *expires);
 }
@@ -187,6 +191,7 @@ class LLAvatarNameResponder : public LLHTTPClient::Responder
 	{
 		// Pull expiration out of headers if available
 		F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mHeaders);
+		F64 now = LLFrameTimer::getTotalSeconds();
 
 		LLSD agents = content["agents"];
 		LLSD::array_const_iterator it = agents.beginArray();
@@ -207,84 +212,91 @@ class LLAvatarNameResponder : public LLHTTPClient::Responder
 				av_name.mDisplayName = av_name.mUsername;
 			}
 
+			LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << " "
+									 << "user '" << av_name.mUsername << "' "
+									 << "display '" << av_name.mDisplayName << "' "
+									 << "expires in " << expires - now << " seconds"
+									 << LL_ENDL;
+			
 			// cache it and fire signals
 			LLAvatarNameCache::processName(agent_id, av_name, true);
 		}
 
 		// Same logic as error response case
 		LLSD unresolved_agents = content["bad_ids"];
-		if (unresolved_agents.size() > 0)
+		S32  num_unresolved = unresolved_agents.size();
+		if (num_unresolved > 0)
 		{
-			const std::string DUMMY_NAME("\?\?\?");
-			LLAvatarName av_name;
-			av_name.mUsername = DUMMY_NAME;
-			av_name.mDisplayName = DUMMY_NAME;
-			av_name.mIsDisplayNameDefault = false;
-			av_name.mIsDummy = true;
-			av_name.mExpires = expires;
-
+            LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result " << num_unresolved << " unresolved ids; "
+                                    << "expires in " << expires - now << " seconds"
+                                    << LL_ENDL;
 			it = unresolved_agents.beginArray();
 			for ( ; it != unresolved_agents.endArray(); ++it)
 			{
 				const LLUUID& agent_id = *it;
-				// cache it and fire signals
-				LLAvatarNameCache::processName(agent_id, av_name, true);
+
+				LL_WARNS("AvNameCache") << "LLAvatarNameResponder::result "
+                                        << "failed id " << agent_id
+                                        << LL_ENDL;
+
+                LLAvatarNameCache::handleAgentError(agent_id);
 			}
 		}
-	}
+        LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result " 
+                                 << LLAvatarNameCache::sCache.size() << " cached names"
+                                 << LL_ENDL;
+    }
 
 	/*virtual*/ void error(U32 status, const std::string& reason)
 	{
 		// If there's an error, it might be caused by PeopleApi,
 		// or when loading textures on startup and using a very slow 
-		// network, this query may time out. Fallback to the legacy
-		// cache. 
-
-		llwarns << "LLAvatarNameResponder error " << status << " " << reason << llendl;
+		// network, this query may time out.
+		// What we should do depends on whether or not we have a cached name
+		LL_WARNS("AvNameCache") << "LLAvatarNameResponder::error " << status << " " << reason
+								<< LL_ENDL;
 
-		// Add dummy records for all agent IDs in this request
+		// Add dummy records for any agent IDs in this request that we do not have cached already
 		std::vector<LLUUID>::const_iterator it = mAgentIDs.begin();
 		for ( ; it != mAgentIDs.end(); ++it)
 		{
 			const LLUUID& agent_id = *it;
-			gCacheName->get(agent_id, false,  // legacy compatibility
-						boost::bind(&LLAvatarNameCache::legacyNameCallback,
-						_1, _2, _3));
-		}
-	}
-
-	// Return time to retry a request that generated an error, based on
-	// error type and headers.  Return value is seconds-since-epoch.
-	F64 errorRetryTimestamp(S32 status)
-	{
-		F64 now = LLFrameTimer::getTotalSeconds();
-
-		// Retry-After takes priority
-		LLSD retry_after = mHeaders["retry-after"];
-		if (retry_after.isDefined())
-		{
-			// We only support the delta-seconds type
-			S32 delta_seconds = retry_after.asInteger();
-			if (delta_seconds > 0)
-			{
-				// ...valid delta-seconds
-				return now + F64(delta_seconds);
-			}
+			LLAvatarNameCache::handleAgentError(agent_id);
 		}
-
-		// If no Retry-After, look for Cache-Control max-age
-		F64 expires = 0.0;
-		if (LLAvatarNameCache::expirationFromCacheControl(mHeaders, &expires))
-		{
-			return expires;
-		}
-
-		// No information in header, make a guess
-		const F64 DEFAULT_DELAY = 120.0; // 2 mintues
-		return now + DEFAULT_DELAY;
 	}
 };
 
+// Provide some fallback for agents that return errors
+void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id)
+{
+	std::map<LLUUID,LLAvatarName>::iterator existing = sCache.find(agent_id);
+	if (existing == sCache.end())
+    {
+        // there is no existing cache entry, so make a temporary name from legacy
+        LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent "
+                                << agent_id << LL_ENDL;
+        gCacheName->get(agent_id, false,  // legacy compatibility
+                        boost::bind(&LLAvatarNameCache::legacyNameCallback,
+                                    _1, _2, _3));
+    }
+	else
+    {
+        // we have a chached (but probably expired) entry - since that would have
+        // been returned by the get method, there is no need to signal anyone
+
+        // Clear this agent from the pending list
+        LLAvatarNameCache::sPendingQueue.erase(agent_id);
+
+        const LLAvatarName& av_name = existing->second;
+        LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent "
+                                 << agent_id 
+                                 << "user '" << av_name.mUsername << "' "
+                                 << "display '" << av_name.mDisplayName << "' "
+                                 << "expires in " << av_name.mExpires - LLFrameTimer::getTotalSeconds() << " seconds"
+                                 << LL_ENDL;
+    }
+}
+
 void LLAvatarNameCache::processName(const LLUUID& agent_id,
 									const LLAvatarName& av_name,
 									bool add_to_cache)
@@ -326,6 +338,7 @@ void LLAvatarNameCache::requestNamesViaCapability()
 	std::vector<LLUUID> agent_ids;
 	agent_ids.reserve(128);
 	
+	U32 ids = 0;
 	ask_queue_t::const_iterator it = sAskQueue.begin();
 	for ( ; it != sAskQueue.end(); ++it)
 	{
@@ -336,11 +349,13 @@ void LLAvatarNameCache::requestNamesViaCapability()
 			// ...starting new request
 			url += sNameLookupURL;
 			url += "?ids=";
+			ids = 1;
 		}
 		else
 		{
 			// ...continuing existing request
 			url += "&ids=";
+			ids++;
 		}
 		url += agent_id.asString();
 		agent_ids.push_back(agent_id);
@@ -350,8 +365,10 @@ void LLAvatarNameCache::requestNamesViaCapability()
 
 		if (url.size() > NAME_URL_SEND_THRESHOLD)
 		{
-			//llinfos << "requestNames " << url << llendl;
-			LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));//, LLSD(), 10.0f);
+			LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability first "
+									 << ids << " ids"
+									 << LL_ENDL;
+			LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
 			url.clear();
 			agent_ids.clear();
 		}
@@ -359,8 +376,10 @@ void LLAvatarNameCache::requestNamesViaCapability()
 
 	if (!url.empty())
 	{
-		//llinfos << "requestNames " << url << llendl;
-		LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));//, LLSD(), 10.0f);
+		LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability all "
+								 << ids << " ids"
+								 << LL_ENDL;
+		LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids));
 		url.clear();
 		agent_ids.clear();
 	}
@@ -376,6 +395,11 @@ void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id,
 	// Construct a dummy record for this name.  By convention, SLID is blank
 	// Never expires, but not written to disk, so lasts until end of session.
 	LLAvatarName av_name;
+	LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameCallback "
+							 << "agent " << agent_id << " "
+							 << "full name '" << full_name << "'"
+							 << ( is_group ? " [group]" : "" )
+							 << LL_ENDL;
 	buildLegacyName(full_name, &av_name);
 
 	// Don't add to cache, the data already exists in the legacy name system
@@ -397,6 +421,8 @@ void LLAvatarNameCache::requestNamesViaLegacy()
 		// invoked below.  This should never happen in practice.
 		sPendingQueue[agent_id] = now;
 
+		LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaLegacy agent " << agent_id << LL_ENDL;
+
 		gCacheName->get(agent_id, false,  // legacy compatibility
 			boost::bind(&LLAvatarNameCache::legacyNameCallback,
 				_1, _2, _3));
@@ -435,21 +461,24 @@ void LLAvatarNameCache::importFile(std::istream& istr)
 		av_name.fromLLSD( it->second );
 		sCache[agent_id] = av_name;
 	}
-	// entries may have expired since we last ran the viewer, just
-	// clean them out now
-	eraseExpired();
-	llinfos << "loaded " << sCache.size() << llendl;
+    LL_INFOS("AvNameCache") << "loaded " << sCache.size() << LL_ENDL;
+
+	// Some entries may have expired since the cache was stored,
+    // but they will be flushed in the first call to eraseUnrefreshed
+    // from LLAvatarNameResponder::idle
 }
 
 void LLAvatarNameCache::exportFile(std::ostream& ostr)
 {
 	LLSD agents;
+	F64 max_unrefreshed = LLFrameTimer::getTotalSeconds() - MAX_UNREFRESHED_TIME;
 	cache_t::const_iterator it = sCache.begin();
 	for ( ; it != sCache.end(); ++it)
 	{
 		const LLUUID& agent_id = it->first;
 		const LLAvatarName& av_name = it->second;
-		if (!av_name.mIsDummy)
+		// Do not write temporary or expired entries to the stored cache
+		if (!av_name.mIsTemporaryName && av_name.mExpires >= max_unrefreshed)
 		{
 			// key must be a string
 			agents[agent_id.asString()] = av_name.asLLSD();
@@ -484,62 +513,63 @@ void LLAvatarNameCache::idle()
 	//	return;
 	//}
 
-	// Must be large relative to above
-
-	// No longer deleting expired entries, just re-requesting in the get
-	// this way first synchronous get call on an expired entry won't return
-	// legacy name.  LF
-
-	//const F32 ERASE_EXPIRED_TIMEOUT = 60.f; // seconds
-	//if (sEraseExpiredTimer.checkExpirationAndReset(ERASE_EXPIRED_TIMEOUT))
-	//{
-	//	eraseExpired();
-	//}
-
-	if (sAskQueue.empty())
+	if (!sAskQueue.empty())
 	{
-		return;
+        if (useDisplayNames())
+        {
+            requestNamesViaCapability();
+        }
+        else
+        {
+            // ...fall back to legacy name cache system
+            requestNamesViaLegacy();
+        }
 	}
 
-	if (useDisplayNames())
-	{
-		requestNamesViaCapability();
-	}
-	else
-	{
-		// ...fall back to legacy name cache system
-		requestNamesViaLegacy();
-	}
+    // erase anything that has not been refreshed for more than MAX_UNREFRESHED_TIME
+    eraseUnrefreshed();
 }
 
 bool LLAvatarNameCache::isRequestPending(const LLUUID& agent_id)
 {
+	bool isPending = false;
 	const F64 PENDING_TIMEOUT_SECS = 5.0 * 60.0;
-	F64 now = LLFrameTimer::getTotalSeconds();
-	F64 expire_time = now - PENDING_TIMEOUT_SECS;
 
 	pending_queue_t::const_iterator it = sPendingQueue.find(agent_id);
 	if (it != sPendingQueue.end())
 	{
-		bool request_expired = (it->second < expire_time);
-		return !request_expired;
+		// in the list of requests in flight, retry if too old
+		F64 expire_time = LLFrameTimer::getTotalSeconds() - PENDING_TIMEOUT_SECS;
+		isPending = (it->second > expire_time);
 	}
-	return false;
+	return isPending;
 }
 
-void LLAvatarNameCache::eraseExpired()
+void LLAvatarNameCache::eraseUnrefreshed()
 {
 	F64 now = LLFrameTimer::getTotalSeconds();
-	cache_t::iterator it = sCache.begin();
-	while (it != sCache.end())
-	{
-		cache_t::iterator cur = it;
-		++it;
-		const LLAvatarName& av_name = cur->second;
-		if (av_name.mExpires < now)
-		{
-			sCache.erase(cur);
-		}
+	F64 max_unrefreshed = now - MAX_UNREFRESHED_TIME;
+
+    if (!sLastExpireCheck || sLastExpireCheck < max_unrefreshed)
+    {
+        sLastExpireCheck = now;
+        cache_t::iterator it = sCache.begin();
+        while (it != sCache.end())
+        {
+            cache_t::iterator cur = it;
+            ++it;
+            const LLAvatarName& av_name = cur->second;
+            if (av_name.mExpires < max_unrefreshed)
+            {
+                const LLUUID& agent_id = it->first;
+                LL_DEBUGS("AvNameCache") << agent_id 
+                                         << " user '" << av_name.mUsername << "' "
+                                         << "expired " << now - av_name.mExpires << " secs ago"
+                                         << LL_ENDL;
+                sCache.erase(cur);
+            }
+        }
+        LL_INFOS("AvNameCache") << sCache.size() << " cached avatar names" << LL_ENDL;
 	}
 }
 
@@ -550,8 +580,11 @@ void LLAvatarNameCache::buildLegacyName(const std::string& full_name,
 	av_name->mUsername = "";
 	av_name->mDisplayName = full_name;
 	av_name->mIsDisplayNameDefault = true;
-	av_name->mIsDummy = true;
-	av_name->mExpires = F64_MAX;
+	av_name->mIsTemporaryName = true;
+	av_name->mExpires = F64_MAX; // not used because these are not cached
+	LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::buildLegacyName "
+							 << full_name
+							 << LL_ENDL;
 }
 
 // fills in av_name if it has it in the cache, even if expired (can check expiry time)
@@ -574,6 +607,9 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
 				{
 					if (!isRequestPending(agent_id))
 					{
+						LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
+												 << "refresh agent " << agent_id
+												 << LL_ENDL;
 						sAskQueue.insert(agent_id);
 					}
 				}
@@ -595,6 +631,9 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
 
 	if (!isRequestPending(agent_id))
 	{
+		LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get "
+								 << "queue request for agent " << agent_id
+								 << LL_ENDL;
 		sAskQueue.insert(agent_id);
 	}
 
@@ -627,7 +666,6 @@ void LLAvatarNameCache::get(const LLUUID& agent_id, callback_slot_t slot)
 				{
 					// ...name already exists in cache, fire callback now
 					fireSignal(agent_id, slot, av_name);
-
 					return;
 				}
 			}
@@ -723,6 +761,9 @@ F64 LLAvatarNameCache::nameExpirationFromHeaders(LLSD headers)
 
 bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires)
 {
+	bool fromCacheControl = false;
+	F64 now = LLFrameTimer::getTotalSeconds();
+
 	// Allow the header to override the default
 	LLSD cache_control_header = headers["cache-control"];
 	if (cache_control_header.isDefined())
@@ -731,12 +772,16 @@ bool LLAvatarNameCache::expirationFromCacheControl(LLSD headers, F64 *expires)
 		std::string cache_control = cache_control_header.asString();
 		if (max_age_from_cache_control(cache_control, &max_age))
 		{
-			F64 now = LLFrameTimer::getTotalSeconds();
 			*expires = now + (F64)max_age;
-			return true;
+			fromCacheControl = true;
 		}
 	}
-	return false;
+	LL_DEBUGS("AvNameCache")
+		<< ( fromCacheControl ? "expires based on cache control " : "default expiration " )
+		<< "in " << *expires - now << " seconds"
+		<< LL_ENDL;
+	
+	return fromCacheControl;
 }
 
 
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index 8f21ace96a5ae5774e8105a51a292bb7a1ad3318..59c1329ffa5db3ac04a0775434a0a928f7bf2981 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -82,6 +82,9 @@ namespace LLAvatarNameCache
 
 	void erase(const LLUUID& agent_id);
 
+    /// Provide some fallback for agents that return errors
+	void handleAgentError(const LLUUID& agent_id);
+
 	// Force a re-fetch of the most recent data, but keep the current
 	// data in cache
 	void fetch(const LLUUID& agent_id);
diff --git a/indra/llmessage/llcircuit.cpp b/indra/llmessage/llcircuit.cpp
index 3ba2dfb104a975b3bbef5fb8fcea11ac4e712484..e0410906fb6d6ae974eaabba31902bd6058814d5 100644
--- a/indra/llmessage/llcircuit.cpp
+++ b/indra/llmessage/llcircuit.cpp
@@ -87,6 +87,7 @@ LLCircuitData::LLCircuitData(const LLHost &host, TPACKETID in_id,
 	mPingDelayAveraged((F32)INITIAL_PING_VALUE_MSEC), 
 	mUnackedPacketCount(0),
 	mUnackedPacketBytes(0),
+	mLastPacketInTime(0.0),
 	mLocalEndPointID(),
 	mPacketsOut(0),
 	mPacketsIn(0), 
@@ -667,6 +668,8 @@ void LLCircuitData::checkPacketInID(TPACKETID id, BOOL receive_resent)
 		mHighestPacketID = llmax(mHighestPacketID, id);
 	}
 
+	// Save packet arrival time
+	mLastPacketInTime = LLMessageSystem::getMessageTimeSeconds();
 
 	// Have we received anything on this circuit yet?
 	if (0 == mPacketsIn)
diff --git a/indra/llmessage/llcircuit.h b/indra/llmessage/llcircuit.h
index 874c0c0beea8ca53e2b67276bbe2db9463f3470d..d1c400c6a2491a278772f1c8559b0904650fa2db 100644
--- a/indra/llmessage/llcircuit.h
+++ b/indra/llmessage/llcircuit.h
@@ -122,7 +122,7 @@ class LLCircuitData
 	U32			getPacketsLost() const;
 	TPACKETID	getPacketOutID() const;
 	BOOL		getTrusted() const;
-	F32 getAgeInSeconds() const;
+	F32			getAgeInSeconds() const;
 	S32			getUnackedPacketCount() const	{ return mUnackedPacketCount; }
 	S32			getUnackedPacketBytes() const	{ return mUnackedPacketBytes; }
 	F64         getNextPingSendTime() const { return mNextPingSendTime; }
@@ -130,6 +130,7 @@ class LLCircuitData
                     { return mOutOfOrderRate.meanValue(scale); }
     U32         getLastPacketGap() const { return mLastPacketGap; }
     LLHost      getHost() const { return mHost; }
+	F64			getLastPacketInTime() const		{ return mLastPacketInTime;	}
 
 	LLThrottleGroup &getThrottleGroup()		{	return mThrottles; }
 
@@ -248,6 +249,7 @@ class LLCircuitData
 	S32										mUnackedPacketCount;
 	S32										mUnackedPacketBytes;
 
+	F64										mLastPacketInTime;		// Time of last packet arrival
 
 	LLUUID									mLocalEndPointID;
 
diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h
index b9b974ec4f6a8109cbad4859b0c8f4671767654e..7b796a0fa875f92785ac0f0c376338c453188f97 100644
--- a/indra/llmessage/llregionflags.h
+++ b/indra/llmessage/llregionflags.h
@@ -42,9 +42,6 @@ const U32 REGION_FLAGS_RESET_HOME_ON_TELEPORT	= (1 << 3);
 // Does the sun move?
 const U32 REGION_FLAGS_SUN_FIXED				= (1 << 4);
 
-// Tax free zone (no taxes on objects, land, etc.)
-const U32 REGION_FLAGS_TAX_FREE					= (1 << 5);
-
 // Can't change the terrain heightfield, even on owned parcels,
 // but can plant trees and grass.
 const U32 REGION_FLAGS_BLOCK_TERRAFORM			= (1 << 6);
@@ -54,17 +51,12 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL		= (1 << 7);
 
 // All content wiped once per night
 const U32 REGION_FLAGS_SANDBOX					= (1 << 8);
-const U32 REGION_FLAGS_NULL_LAYER				= (1 << 9);
-// const U32 REGION_FLAGS_SKIP_AGENT_ACTION		= (1 << 10);
-const U32 REGION_FLAGS_HARD_ALLOW_LAND_TRANSFER	= (1 << 10);	// Region allows land reselling
-// const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11);
-const U32 REGION_FLAGS_HARD_ALLOW_POST_CLASSIFIED	= (1 << 11);	// Region allows posting of classified ads
 const U32 REGION_FLAGS_SKIP_COLLISIONS			= (1 << 12); // Pin all non agent rigid bodies
 const U32 REGION_FLAGS_SKIP_SCRIPTS				= (1 << 13);
 const U32 REGION_FLAGS_SKIP_PHYSICS				= (1 << 14); // Skip all physics
 const U32 REGION_FLAGS_EXTERNALLY_VISIBLE		= (1 << 15);
-//const U32 REGION_FLAGS_MAINLAND_VISIBLE			= (1 << 16);
-const U32 REGION_FLAGS_PUBLIC_ALLOWED			= (1 << 17);
+const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16);
+const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17);
 const U32 REGION_FLAGS_BLOCK_DWELL				= (1 << 18);
 
 // Is flight allowed?
@@ -81,18 +73,13 @@ const U32 REGION_FLAGS_ESTATE_SKIP_SCRIPTS		= (1 << 21);
 const U32 REGION_FLAGS_RESTRICT_PUSHOBJECT		= (1 << 22);
 
 const U32 REGION_FLAGS_DENY_ANONYMOUS			= (1 << 23);
-// const U32 REGION_FLAGS_DENY_IDENTIFIED			= (1 << 24);
-// const U32 REGION_FLAGS_DENY_TRANSACTED			= (1 << 25);
 
 const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES		= (1 << 26);
 
-// const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); // We no longer support ELAR
-
 const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
 
 const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29);
 const U32 REGION_FLAGS_DENY_AGEUNVERIFIED	= (1 << 30);
-const U32 REGION_FLAGS_SKIP_MONO_SCRIPTS	= (1 << 31);
 
 const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
 								 REGION_FLAGS_ALLOW_SET_HOME |
@@ -105,7 +92,6 @@ const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK
 									   | REGION_FLAGS_ALLOW_SET_HOME;
 
 const U32 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE
-									 | REGION_FLAGS_PUBLIC_ALLOWED	
 									 | REGION_FLAGS_SUN_FIXED
 									 | REGION_FLAGS_DENY_ANONYMOUS
 									 | REGION_FLAGS_DENY_AGEUNVERIFIED;
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 6b06040b8a668d2cc99c70d112dd0b491f50e981..8b6a73af56a196343b3e5b1eba5690dde2fadcca 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -94,6 +94,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
 	mMaxChars(p.max_chars),
 	mPrearrangeCallback(p.prearrange_callback()),
 	mTextEntryCallback(p.text_entry_callback()),
+	mTextChangedCallback(p.text_changed_callback()),
 	mListPosition(p.list_position),
 	mLastSelectedIndex(-1),
 	mLabel(p.label)
@@ -834,6 +835,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor)
 			mList->deselectAllItems();
 			mLastSelectedIndex = -1;
 		}
+		if (mTextChangedCallback != NULL)
+		{
+			(mTextChangedCallback)(line_editor, LLSD());
+		}
 		return;
 	}
 
@@ -878,6 +883,10 @@ void LLComboBox::onTextEntry(LLLineEditor* line_editor)
 		// RN: presumably text entry
 		updateSelection();
 	}
+	if (mTextChangedCallback != NULL)
+	{
+		(mTextChangedCallback)(line_editor, LLSD());
+	}
 }
 
 void LLComboBox::updateSelection()
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 5f0e4a6843026dd8a5ff3de805f81764a0e3022a..74d64269bdf206ef761e26614b6323f2f334a833 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -73,7 +73,8 @@ class LLComboBox
 											allow_new_values;
 		Optional<S32>						max_chars;
 		Optional<commit_callback_t> 		prearrange_callback,
-											text_entry_callback;
+											text_entry_callback,
+											text_changed_callback;
 
 		Optional<EPreferredPosition, PreferredPositionValues>	list_position;
 		
@@ -190,6 +191,7 @@ class LLComboBox
 
 	void			setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; }
 	void			setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
+	void			setTextChangedCallback( commit_callback_t cb ) { mTextChangedCallback = cb; }
 
 	void			setButtonVisible(BOOL visible);
 
@@ -220,6 +222,7 @@ class LLComboBox
 	BOOL				mTextEntryTentative;
 	commit_callback_t	mPrearrangeCallback;
 	commit_callback_t	mTextEntryCallback;
+	commit_callback_t	mTextChangedCallback;
 	commit_callback_t	mSelectionCallback;
 	boost::signals2::connection mTopLostSignalConnection;
 	S32                 mLastSelectedIndex;
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 1265733bf5be3213a10d11280e6e5bf00e3db7ca..c4257827152fab8bf99420a3d2cb02e871f2f00b 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -272,9 +272,6 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
 	
 	initFromParams(p);
 	
-	// chrome floaters don't take focus at all
-	setFocusRoot(!getIsChrome());
-
 	initFloater(p);
 }
 
@@ -2910,7 +2907,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::str
 	params.from_xui = true;
 	applyXUILayout(params, parent);
  	initFromParams(params);
-	
+
 	initFloater(params);
 	
 	LLMultiFloater* last_host = LLFloater::getFloaterHost();
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 6c0d47ef63d08ffc776cb5bf2cb3de240c93585d..32d7be377a3386a34f769fbb20876712b7b0ef3f 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1637,6 +1637,10 @@ LLMenuScrollItem::LLMenuScrollItem(const Params& p)
 	}
 
 	LLButton::Params bparams;
+
+	// Disabled the Return key handling by LLMenuScrollItem instead of
+	// passing the key press to the currently selected menu item. See STORM-385.
+	bparams.commit_on_return(false);
 	bparams.mouse_opaque(true);
 	bparams.scale_image(false);
 	bparams.click_callback(p.scroll_callback);
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index cd0f0e36b0509d5d40bc311b4d5f8c2be8589ac7..cc9edfcdeabbc92c1cc05a05962608cf5adf5b86 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1367,7 +1367,6 @@ LLNotifications::TemplateNames LLNotifications::getTemplateNames() const
 typedef std::map<std::string, std::string> StringMap;
 void replaceSubstitutionStrings(LLXMLNodePtr node, StringMap& replacements)
 {
-	//llwarns << "replaceSubstitutionStrings" << llendl;
 	// walk the list of attributes looking for replacements
 	for (LLXMLAttribList::iterator it=node->mAttributes.begin();
 		 it != node->mAttributes.end(); ++it)
@@ -1381,13 +1380,12 @@ void replaceSubstitutionStrings(LLXMLNodePtr node, StringMap& replacements)
 			if (found != replacements.end())
 			{
 				replacement = found->second;
-				//llwarns << "replaceSubstituionStrings: value: " << value << " repl: " << replacement << llendl;
-
+				lldebugs << "replaceSubstitutionStrings: value: \"" << value << "\" repl: \"" << replacement << "\"." << llendl;
 				it->second->setValue(replacement);
 			}
 			else
 			{
-				llwarns << "replaceSubstituionStrings FAILURE: value: " << value << " repl: " << replacement << llendl;
+				llwarns << "replaceSubstitutionStrings FAILURE: could not find replacement \"" << value << "\"." << llendl;
 			}
 		}
 	}
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 4f7b4be52609206899dee5e9934bdf6c9aa49d62..9db1feafd1b179c9bea839139188158b4b4de205 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -36,6 +36,7 @@
 #include "llcachename.h"
 #include "lltrans.h"
 #include "lluicolortable.h"
+#include "message.h"
 
 #define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
 
@@ -684,8 +685,8 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa
 LLStyle::Params LLUrlEntryGroup::getStyle() const
 {
 	LLStyle::Params style_params = LLUrlEntryBase::getStyle();
-	style_params.color = LLUIColorTable::instance().getColor("GroupLinkColor");
-	style_params.readonly_color = LLUIColorTable::instance().getColor("GroupLinkColor");
+	style_params.color = LLUIColorTable::instance().getColor("HTMLLinkColor");
+	style_params.readonly_color = LLUIColorTable::instance().getColor("HTMLLinkColor");
 	return style_params;
 }
 
@@ -740,6 +741,13 @@ std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
 	return LLUrlEntryBase::getLocation(url);
 }
 
+// LLUrlEntryParcel statics.
+LLUUID	LLUrlEntryParcel::sAgentID(LLUUID::null);
+LLUUID	LLUrlEntryParcel::sSessionID(LLUUID::null);
+LLHost	LLUrlEntryParcel::sRegionHost(LLHost::invalid);
+bool	LLUrlEntryParcel::sDisconnected(false);
+std::set<LLUrlEntryParcel*> LLUrlEntryParcel::sParcelInfoObservers;
+
 ///
 /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
 /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
@@ -751,13 +759,88 @@ LLUrlEntryParcel::LLUrlEntryParcel()
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_parcel.xml";
 	mTooltip = LLTrans::getString("TooltipParcelUrl");
+
+	sParcelInfoObservers.insert(this);
+}
+
+LLUrlEntryParcel::~LLUrlEntryParcel()
+{
+	sParcelInfoObservers.erase(this);
 }
 
 std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
 {
+	LLSD path_array = LLURI(url).pathArray();
+	S32 path_parts = path_array.size();
+
+	if (path_parts < 3) // no parcel id
+	{
+		llwarns << "Failed to parse url [" << url << "]" << llendl;
+		return url;
+	}
+
+	std::string parcel_id_string = unescapeUrl(path_array[2]); // parcel id
+
+	// Add an observer to call LLUrlLabelCallback when we have parcel name.
+	addObserver(parcel_id_string, url, cb);
+
+	LLUUID parcel_id(parcel_id_string);
+
+	sendParcelInfoRequest(parcel_id);
+
 	return unescapeUrl(url);
 }
 
+void LLUrlEntryParcel::sendParcelInfoRequest(const LLUUID& parcel_id)
+{
+	if (sRegionHost == LLHost::invalid || sDisconnected) return;
+
+	LLMessageSystem *msg = gMessageSystem;
+	msg->newMessage("ParcelInfoRequest");
+	msg->nextBlockFast(_PREHASH_AgentData);
+	msg->addUUIDFast(_PREHASH_AgentID, sAgentID );
+	msg->addUUID("SessionID", sSessionID);
+	msg->nextBlock("Data");
+	msg->addUUID("ParcelID", parcel_id);
+	msg->sendReliable(sRegionHost);
+}
+
+void LLUrlEntryParcel::onParcelInfoReceived(const std::string &id, const std::string &label)
+{
+	callObservers(id, label.empty() ? LLTrans::getString("RegionInfoError") : label, mIcon);
+}
+
+// static
+void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data)
+{
+	std::string label(LLStringUtil::null);
+	if (!parcel_data.name.empty())
+	{
+		label = parcel_data.name;
+	}
+	// If parcel name is empty use Sim_name (x, y, z) for parcel label.
+	else if (!parcel_data.sim_name.empty())
+	{
+		S32 region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
+		S32 region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
+		S32 region_z = llround(parcel_data.global_z);
+
+		label = llformat("%s (%d, %d, %d)",
+				parcel_data.sim_name.c_str(), region_x, region_y, region_z);
+	}
+
+	for (std::set<LLUrlEntryParcel*>::iterator iter = sParcelInfoObservers.begin();
+			iter != sParcelInfoObservers.end();
+			++iter)
+	{
+		LLUrlEntryParcel* url_entry = *iter;
+		if (url_entry)
+		{
+			url_entry->onParcelInfoReceived(parcel_data.parcel_id.asString(), label);
+		}
+	}
+}
+
 //
 // LLUrlEntryPlace Describes secondlife://<location> URLs
 //
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 1791739061cdae4c3cf3db6891984ef99d2eeb08..5f82721c0fdf9067383f1d974a052242c4c8a2a3 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -31,6 +31,9 @@
 #include "lluuid.h"
 #include "lluicolor.h"
 #include "llstyle.h"
+
+#include "llhost.h" // for resolving parcel name by parcel id
+
 #include <boost/signals2.hpp>
 #include <boost/regex.hpp>
 #include <string>
@@ -285,8 +288,44 @@ class LLUrlEntryObjectIM : public LLUrlEntryBase
 class LLUrlEntryParcel : public LLUrlEntryBase
 {
 public:
+	struct LLParcelData
+	{
+		LLUUID		parcel_id;
+		std::string	name;
+		std::string	sim_name;
+		F32			global_x;
+		F32			global_y;
+		F32			global_z;
+	};
+
 	LLUrlEntryParcel();
+	~LLUrlEntryParcel();
 	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
+
+	// Sends a parcel info request to sim.
+	void sendParcelInfoRequest(const LLUUID& parcel_id);
+
+	// Calls observers of certain parcel id providing them with parcel label.
+	void onParcelInfoReceived(const std::string &id, const std::string &label);
+
+	// Processes parcel label and triggers notifying observers.
+	static void processParcelInfo(const LLParcelData& parcel_data);
+
+	// Next 4 setters are used to update agent and viewer connection information
+	// upon events like user login, viewer disconnect and user changing region host.
+	// These setters are made public to be accessible from newview and should not be
+	// used in other cases.
+	static void setAgentID(const LLUUID& id) { sAgentID = id; }
+	static void setSessionID(const LLUUID& id) { sSessionID = id; }
+	static void setRegionHost(const LLHost& host) { sRegionHost = host; }
+	static void setDisconnected(bool disconnected) { sDisconnected = disconnected; }
+
+private:
+	static LLUUID						sAgentID;
+	static LLUUID						sSessionID;
+	static LLHost						sRegionHost;
+	static bool							sDisconnected;
+	static std::set<LLUrlEntryParcel*>	sParcelInfoObservers;
 };
 
 ///
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index f30704cb2269c8b40b9fd5b0f44fe51aa934e7db..96ebe83826c5137dd90cd0458620a15d2777a4c8 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -30,6 +30,7 @@
 #include "llavatarnamecache.h"
 #include "llcachename.h"
 #include "lluuid.h"
+#include "message.h"
 
 #include <string>
 
@@ -191,3 +192,20 @@ LLFontGL* LLFontGL::getFontDefault()
 {
 	return NULL; 
 }
+
+char* _PREHASH_AgentData = "AgentData";
+char* _PREHASH_AgentID = "AgentID";
+
+LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS);
+
+LLMessageSystem* gMessageSystem = NULL;
+
+//
+// Stub implementation for LLMessageSystem
+//
+void LLMessageSystem::newMessage(const char *name) { }
+void LLMessageSystem::nextBlockFast(const char *blockname) { }
+void LLMessageSystem::nextBlock(const char *blockname) { }
+void LLMessageSystem::addUUIDFast( const char *varname, const LLUUID& uuid) { }
+void LLMessageSystem::addUUID( const char *varname, const LLUUID& uuid) { }
+S32 LLMessageSystem::sendReliable(const LLHost &host) { return 0; }
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index ce22a52460b4354ddb3bde5a0549a82a9e09c4c4..af6beacdfa9a69e6f2bc3858dde7a6ff7f8b9cee 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -405,6 +405,7 @@ set(viewer_SOURCE_FILES
     llsecapi.cpp
     llsechandler_basic.cpp
     llselectmgr.cpp
+    llshareavatarhandler.cpp
     llsidepanelappearance.cpp
     llsidepanelinventory.cpp
     llsidepanelinventorysubpanel.cpp
@@ -529,6 +530,7 @@ set(viewer_SOURCE_FILES
     llviewerregion.cpp
     llviewershadermgr.cpp
     llviewerstats.cpp
+    llviewerstatsrecorder.cpp
     llviewertexteditor.cpp
     llviewertexture.cpp
     llviewertextureanim.cpp
@@ -546,6 +548,7 @@ set(viewer_SOURCE_FILES
     llvoclouds.cpp
     llvograss.cpp
     llvoground.cpp
+    llvoicecallhandler.cpp
     llvoicechannel.cpp
     llvoiceclient.cpp
     llvoicevisualizer.cpp
@@ -1061,6 +1064,7 @@ set(viewer_HEADER_FILES
     llviewerregion.h
     llviewershadermgr.h
     llviewerstats.h
+    llviewerstatsrecorder.h
     llviewertexteditor.h
     llviewertexture.h
     llviewertextureanim.h
@@ -1714,6 +1718,17 @@ set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH
 if (LINUX)
   set(product SecondLife-${ARCH}-${viewer_VERSION})
 
+  # These are the generated targets that are copied to package/
+  set(COPY_INPUT_DEPENDENCIES
+	${VIEWER_BINARY_NAME}
+	linux-crash-logger
+	linux-updater
+	SLPlugin
+	media_plugin_webkit
+	media_plugin_gstreamer010
+	llcommon
+	)
+
   add_custom_command(
       OUTPUT ${product}.tar.bz2
       COMMAND ${PYTHON_EXECUTABLE}
@@ -1731,18 +1746,11 @@ if (LINUX)
         --login_channel=${VIEWER_LOGIN_CHANNEL}
         --source=${CMAKE_CURRENT_SOURCE_DIR}
         --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched
-      DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+      DEPENDS
+        ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+        ${COPY_INPUT_DEPENDENCIES}
       )
 
-  add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_gstreamer010 media_plugin_webkit)
-
-  if (PACKAGE)
-    add_custom_target(package ALL DEPENDS ${product}.tar.bz2)
-    add_dependencies(package linux-crash-logger-target)
-    add_dependencies(package linux-updater-target)
-    check_message_template(package)
-  endif (PACKAGE)
-
   add_custom_command(
     OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched
     COMMAND ${PYTHON_EXECUTABLE}
@@ -1762,9 +1770,15 @@ if (LINUX)
       ${COPY_INPUT_DEPENDENCIES}
     COMMENT "Performing viewer_manifest copy"
     )
-    
+
   add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched) 
-  add_dependencies(copy_l_viewer_manifest "${VIEWER_BINARY_NAME}" linux-crash-logger-target linux-updater-target)
+
+  if (PACKAGE)
+    add_custom_target(package ALL DEPENDS ${product}.tar.bz2)
+    # Make sure we don't run two instances of viewer_manifest.py at the same time.
+    add_dependencies(package copy_l_viewer_manifest)
+    check_message_template(package)
+  endif (PACKAGE)
 endif (LINUX)
 
 if (DARWIN)
@@ -1853,29 +1867,29 @@ if (PACKAGE)
   endif (LINUX)
 
   if(RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING)
-    if(CMAKE_CFG_INTDIR STREQUAL ".")
+  if(CMAKE_CFG_INTDIR STREQUAL ".")
       set(LLBUILD_CONFIG ${CMAKE_BUILD_TYPE})
-    else(CMAKE_CFG_INTDIR STREQUAL ".")
+  else(CMAKE_CFG_INTDIR STREQUAL ".")
       # set LLBUILD_CONFIG to be a shell variable evaluated at build time
       # reflecting the configuration we are currently building.
       set(LLBUILD_CONFIG ${CMAKE_CFG_INTDIR})
-    endif(CMAKE_CFG_INTDIR STREQUAL ".")
-    add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}"
-      COMMAND "${PYTHON_EXECUTABLE}"
-      ARGS
-        "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py"
-        "${LLBUILD_CONFIG}"
-        "${VIEWER_DIST_DIR}"
-        "${VIEWER_EXE_GLOBS}"
-        "${VIEWER_LIB_GLOB}"
-        "${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/bin/dump_syms"
-        "${VIEWER_SYMBOL_FILE}"
-        DEPENDS generate_breakpad_symbols.py
+  endif(CMAKE_CFG_INTDIR STREQUAL ".")
+  add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}"
+    COMMAND "${PYTHON_EXECUTABLE}"
+    ARGS
+      "${CMAKE_CURRENT_SOURCE_DIR}/generate_breakpad_symbols.py"
+      "${LLBUILD_CONFIG}"
+      "${VIEWER_DIST_DIR}"
+      "${VIEWER_EXE_GLOBS}"
+      "${VIEWER_LIB_GLOB}"
+      "${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/bin/dump_syms"
+      "${VIEWER_SYMBOL_FILE}"
+    DEPENDS generate_breakpad_symbols.py
         VERBATIM)
 
-    add_custom_target(generate_breakpad_symbols DEPENDS "${VIEWER_SYMBOL_FILE}")
-    add_dependencies(generate_breakpad_symbols "${VIEWER_BINARY_NAME}" "${VIEWER_COPY_MANIFEST}")
-    add_dependencies(package generate_breakpad_symbols)
+  add_custom_target(generate_breakpad_symbols DEPENDS "${VIEWER_SYMBOL_FILE}")
+  add_dependencies(generate_breakpad_symbols "${VIEWER_BINARY_NAME}" "${VIEWER_COPY_MANIFEST}")
+  add_dependencies(package generate_breakpad_symbols)
   endif(RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING)
 endif (PACKAGE)
 
diff --git a/indra/newview/app_settings/lindenlab.pem b/indra/newview/app_settings/lindenlab.pem
index cf88d0e04799bf09835f2c78959e9e8bce3d75f9..eddae0426def81a5524850381d29b865bf87b22e 100644
--- a/indra/newview/app_settings/lindenlab.pem
+++ b/indra/newview/app_settings/lindenlab.pem
@@ -24,4 +24,74 @@ xA39CIJ65Zozs28Eg1aV9/Y+Of7TnWhW+U3J3/wD/GghaAGiKK6vMn9gJBIdBX/9
 e6ef37VGyiOEFFjnUIbuk0RWty0orN76q/lI/xjCi15XSA/VSq2j4vmnwfZcPTDu
 glmQ1A==
 -----END CERTIFICATE-----
-
+-----BEGIN CERTIFICATE-----
+MIIEkDCCA3igAwIBAgICTSUwDQYJKoZIhvcNAQEFBQAwQDELMAkGA1UEBhMCVVMx
+FzAVBgNVBAoTDkdlb1RydXN0LCBJbmMuMRgwFgYDVQQDEw9HZW9UcnVzdCBTU0wg
+Q0EwHhcNMTAxMjIwMTkxMTI2WhcNMTIwMjIxMTI1NDAzWjCBnzEpMCcGA1UEBRMg
+UkMteW9jbXIwdXRmRTdOMVBlaHJHQXdqL0lNc2hJZS0xCzAJBgNVBAYTAlVTMRMw
+EQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMR0wGwYD
+VQQKExRMaW5kZW4gUmVzZWFyY2ggSW5jLjEZMBcGA1UEAwwQKi5zZWNvbmRsaWZl
+LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAN/VCCu1SZ5x4vNp
+XZZ8r3lzqeLwjxVZfMSQCKM4lV5DFbqiZMMBto4Y/ib7i0audzuTDnImCLsfzlTu
+7iZLoJNy42/43Rq4xtaDZ7joxALFmzXUKEipgHiTTbAbLQNCS4wPXts3tScODVZY
+/mhlmXdlLuGxJbqoyOEP6NEQbgXWDCKDERnAEG/FJBVHKyBfg3abrrIuQNwYCKCS
+2OZ5Z5MveGmY4tSKUOOi/c0vV9HsanQn/ymybZjxR5Kmb1CvQr7VVtbpR1MhlGkc
+sfJz1NFIFxdXkUggIny+XSG1dAAJRFFumyRM+X/eh0NHNmAI14JJ43hB6Zw3dzzl
+An9BSeECAwEAAaOCATIwggEuMB8GA1UdIwQYMBaAFEJ5VBthzVUrPmPVPEhX9Z/7
+Rc5KMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUH
+AwIwKwYDVR0RBCQwIoIQKi5zZWNvbmRsaWZlLmNvbYIOc2Vjb25kbGlmZS5jb20w
+PQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2d0c3NsLWNybC5nZW90cnVzdC5jb20v
+Y3Jscy9ndHNzbC5jcmwwHQYDVR0OBBYEFK9UTMkc4Fh/Ug4fVs6UVhxP6my0MAwG
+A1UdEwEB/wQCMAAwQwYIKwYBBQUHAQEENzA1MDMGCCsGAQUFBzAChidodHRwOi8v
+Z3Rzc2wtYWlhLmdlb3RydXN0LmNvbS9ndHNzbC5jcnQwDQYJKoZIhvcNAQEFBQAD
+ggEBACIR9yggGHDcZ60AMNdFmZ8XJeahTuv6q2X/It2JxqSQp5BVQUei0NGIYYOt
+yg0JFBZn5KqXiQ5Zz84K4hdvh/6grCEAn4v37sozSbkeZ92Lec8NOZR42HfYIOCo
+Hx9q7CNRxdhv6ehV4LekaRBxrtp5etVsIDaWvRZEswCWl46VuLrfjcpauj6DAdOQ
+FfPVAW+4nPgLr8KapZMnXYnabIwrj9DQLQ88w/D7durenu/SYJEahWW9mb++n9is
+eMjyuyzYW0PTUBTaDsj+2ZmHJtoR1tBiLqh0Q62UQnmDgsf5SK5PTb8jnta/1SvN
+3pirsuvjMPV19zuH6b9NpJfXfd0=
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIDfTCCAuagAwIBAgIDErvmMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
+MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
+aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDIwNTIxMDQwMDAwWhcNMTgwODIxMDQwMDAw
+WjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UE
+AxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9m
+OSm9BXiLnTjoBbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIu
+T8rxh0PBFpVXLVDviS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6c
+JmTM386DGXHKTubU1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmR
+Cw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5asz
+PeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo4HwMIHtMB8GA1UdIwQYMBaAFEjm
+aPkr0rKV10fYIyAQTzOYkJ/UMB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrM
+TjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjA6BgNVHR8EMzAxMC+g
+LaArhilodHRwOi8vY3JsLmdlb3RydXN0LmNvbS9jcmxzL3NlY3VyZWNhLmNybDBO
+BgNVHSAERzBFMEMGBFUdIAAwOzA5BggrBgEFBQcCARYtaHR0cHM6Ly93d3cuZ2Vv
+dHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5MA0GCSqGSIb3DQEBBQUAA4GB
+AHbhEm5OSxYShjAGsoEIz/AIx8dxfmbuwu3UOx//8PDITtZDOLC5MH0Y0FWDomrL
+NhGc6Ehmo21/uBPUR/6LWlxz/K7ZGzIZOKuXNBSqltLroxwUCEm2u+WR74M26x1W
+b8ravHNjkOR/ez4iyz0H7V84dJzjA1BOoa+Y7mHyhD8S
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIID2TCCAsGgAwIBAgIDAjbQMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
+MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
+YWwgQ0EwHhcNMTAwMjE5MjIzOTI2WhcNMjAwMjE4MjIzOTI2WjBAMQswCQYDVQQG
+EwJVUzEXMBUGA1UEChMOR2VvVHJ1c3QsIEluYy4xGDAWBgNVBAMTD0dlb1RydXN0
+IFNTTCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJCzgMHk5Uat
+cGA9uuUU3Z6KXot1WubKbUGlI+g5hSZ6p1V3mkihkn46HhrxJ6ujTDnMyz1Hr4Gu
+FmpcN+9FQf37mpc8oEOdxt8XIdGKolbCA0mEEoE+yQpUYGa5jFTk+eb5lPHgX3UR
+8im55IaisYmtph6DKWOy8FQchQt65+EuDa+kvc3nsVrXjAVaDktzKIt1XTTYdwvh
+dGLicTBi2LyKBeUxY0pUiWozeKdOVSQdl+8a5BLGDzAYtDRN4dgjOyFbLTAZJQ50
+96QhS6CkIMlszZhWwPKoXz4mdaAN+DaIiixafWcwqQ/RmXAueOFRJq9VeiS+jDkN
+d53eAsMMvR8CAwEAAaOB2TCB1jAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFEJ5
+VBthzVUrPmPVPEhX9Z/7Rc5KMB8GA1UdIwQYMBaAFMB6mGiNifurBWQMEX2qfWW4
+ysxOMBIGA1UdEwEB/wQIMAYBAf8CAQAwOgYDVR0fBDMwMTAvoC2gK4YpaHR0cDov
+L2NybC5nZW90cnVzdC5jb20vY3Jscy9ndGdsb2JhbC5jcmwwNAYIKwYBBQUHAQEE
+KDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5nZW90cnVzdC5jb20wDQYJKoZI
+hvcNAQEFBQADggEBANTvU4ToGr2hiwTAqfVfoRB4RV2yV2pOJMtlTjGXkZrUJPji
+J2ZwMZzBYlQG55cdOprApClICq8kx6jEmlTBfEx4TCtoLF0XplR4TEbigMMfOHES
+0tdT41SFULgCy+5jOvhWiU1Vuy7AyBh3hjELC3DwfjWDpCoTZFZnNF0WX3OsewYk
+2k9QbSqr0E1TQcKOu3EDSSmGGM8hQkx0YlEVxW+o78Qn5Rsz3VqI138S0adhJR/V
+4NwdzxoQ2KDLX4z6DOW/cf/lXUQdpj6HR/oaToODEj+IZpWYeZqF6wJHzSXj8gYE
+TpnKXKBuervdo5AaRTPvvz7SBMS24CqFZUE+ENQ=
+-----END CERTIFICATE-----
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index ea7ac6bedab5a401794e338bf4f9bfb81c91304f..85238cacdd96f9cda852521af703ab8a7cd34e8a 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -950,39 +950,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>BulkChangeIncludeAnimations</key>
-    <map>
-      <key>Comment</key>
-      <string>Bulk permission changes affect animations</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>BulkChangeIncludeAnimations</key>
-    <map>
-      <key>Comment</key>
-      <string>Bulk permission changes affect animations</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>BulkChangeIncludeAnimations</key>
-    <map>
-      <key>Comment</key>
-      <string>Bulk permission changes affect animations</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>BulkChangeIncludeBodyParts</key>
     <map>
       <key>Comment</key>
@@ -1195,18 +1162,7 @@
     <key>CacheLocationTopFolder</key>
     <map>
       <key>Comment</key>
-      <string>Controls the top folder location of the local disk cache</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string />
-    </map>	
-    <key>CacheLocationTopFolder</key>
-    <map>
-      <key>Comment</key>
-      <string>Controls the location of the local disk cache</string>
+      <string>Controls the top folder location of the the local disk cache</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
@@ -3118,17 +3074,6 @@
         <key>Value</key>
         <string>http://viewer-settings.secondlife.com</string>
     </map>
-    <key>FPSLogFrequency</key>
-    <map>
-      <key>Comment</key>
-      <string>Seconds between display of FPS in log (0 for never)</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>F32</string>
-      <key>Value</key>
-      <real>60.0</real>
-    </map>
     <key>FPSLogFrequency</key>
         <map>
         <key>Comment</key>
@@ -3932,6 +3877,17 @@
       <key>Value</key>
       <string>http://search.secondlife.com/viewer/[CATEGORY]/?q=[QUERY]&amp;p=[AUTH_TOKEN]&amp;r=[MATURITY]&amp;lang=[LANGUAGE]&amp;g=[GODLIKE]&amp;sid=[SESSION_ID]&amp;rid=[REGION_ID]&amp;pid=[PARCEL_ID]&amp;channel=[CHANNEL]&amp;version=[VERSION]&amp;major=[VERSION_MAJOR]&amp;minor=[VERSION_MINOR]&amp;patch=[VERSION_PATCH]&amp;build=[VERSION_BUILD]</string>
     </map>
+    <key>WebProfileURL</key>
+    <map>
+      <key>Comment</key>
+      <string>URL for Web Profiles</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string>https://my.secondlife.com/[AGENT_NAME]</string>
+    </map>
     <key>HighResSnapshot</key>
     <map>
       <key>Comment</key>
@@ -6071,17 +6027,6 @@
       <integer>0</integer>
     </map>
     <key>OutBandwidth</key>
-    <map>
-      <key>Comment</key>
-      <string>Expand render stats display</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>OutBandwidth</key>
     <map>
       <key>Comment</key>
       <string>Outgoing bandwidth throttle (bps)</string>
@@ -11441,8 +11386,6 @@
       <key>Type</key>
       <string>LLSD</string>
       <key>Value</key>
-      <map>
-      </map>
     </map>
     <key>VFSOldSize</key>
     <map>
@@ -11598,17 +11541,6 @@
       <key>Value</key>
       <string></string>
     </map>
-    <key>VivoxDebugSIPURIHostName</key>
-    <map>
-      <key>Comment</key>
-      <string>Hostname portion of vivox SIP URIs (empty string for the default).</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>VivoxDebugVoiceAccountServerURI</key>
     <map>
       <key>Comment</key>
@@ -12434,16 +12366,5 @@
       <key>Value</key>
       <string>name</string>
     </map>
-    <key>ReleaseNotesURL</key>
-    <map>
-      <key>Comment</key>
-      <string>Release notes URL template</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>http://secondlife.com/app/releasenotes/?channel=[CHANNEL]&amp;version=[VERSION]</string>
-    </map>
 </map>
 </llsd>
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index 705c73cbf7fef6dbc80fe916f7b36ac95c4f531d..8efec1cff0726becb82fcb834a8d90e85f9a7331 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -160,6 +160,17 @@
         <key>Value</key>
             <integer>0</integer>
         </map>
+      <key>ShowFavoritesOnLogin</key>
+        <map>
+        <key>Comment</key>
+             <string>Determines whether favorites of last logged in user will be saved on exit from viewer and shown on login screen</string>
+        <key>Persist</key>
+             <integer>1</integer>
+        <key>Type</key>
+             <string>Boolean</string>
+        <key>Value</key>
+             <integer>0</integer>
+        </map>
     <!-- End of back compatibility settings -->
     </map>
 </llsd>
diff --git a/indra/newview/app_settings/shaders/shader_heirarchy.txt b/indra/newview/app_settings/shaders/shader_hierarchy.txt
similarity index 100%
rename from indra/newview/app_settings/shaders/shader_heirarchy.txt
rename to indra/newview/app_settings/shaders/shader_hierarchy.txt
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index a95abd7dd185e55e8992b612dfbb20f393d61788..a82c3da4c568abf85d2f27034668ec0b7dc050d5 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -135,7 +135,7 @@ RenderFlexTimeFactor		1	1.0
 RenderGlowResolutionPow		1	9
 RenderMaxPartCount			1	4096
 RenderObjectBump			1	1
-RenderReflectionDetail		1	2
+RenderReflectionDetail		1	0
 RenderTerrainDetail			1	1
 RenderTerrainLODFactor		1	2.0
 RenderTransparentWater		1	1
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index a52b32355de22ba0efbafb2451686a9cf8fdf8d4..a2cd4b834c0845ed899f975c40d3ebfa5a96aa30 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -134,7 +134,7 @@ RenderFlexTimeFactor		1	1.0
 RenderGlowResolutionPow		1	9
 RenderMaxPartCount			1	4096
 RenderObjectBump			1	1
-RenderReflectionDetail		1	2
+RenderReflectionDetail		1	0
 RenderTerrainDetail			1	1
 RenderTerrainLODFactor		1	2.0
 RenderTransparentWater		1	1
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 6dabef53a846a54d69de2f6f83ed623c531c3e65..3ad7f4e89275cfbcb44fd5bc742ee296503e8376 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -133,7 +133,7 @@ RenderGlowResolutionPow		1	9
 RenderLightingDetail		1	1
 RenderMaxPartCount			1	4096
 RenderObjectBump			1	1
-RenderReflectionDetail		1	2
+RenderReflectionDetail		1	0
 RenderTerrainDetail			1	1
 RenderTerrainLODFactor		1	2.0
 RenderTransparentWater		1	1
diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt
index a09ba17c6246535e031014482d732addb02f9114..38e6bb1e5e9d01ce083277708836f2ce21743db0 100644
--- a/indra/newview/featuretable_xp.txt
+++ b/indra/newview/featuretable_xp.txt
@@ -135,7 +135,7 @@ RenderFlexTimeFactor		1	1.0
 RenderGlowResolutionPow		1	9
 RenderMaxPartCount			1	4096
 RenderObjectBump			1	1
-RenderReflectionDetail		1	2
+RenderReflectionDetail		1	0
 RenderTerrainDetail			1	1
 RenderTerrainLODFactor		1	2.0
 RenderTransparentWater		1	1
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index ea3c2eb312567fca46abcb563d771ee1581ec646..7d908df5ceed5469064c52543e304114be028dc7 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -64,6 +64,7 @@
 #include "lltool.h"
 #include "lltoolmgr.h"
 #include "lltrans.h"
+#include "llurlentry.h"
 #include "llviewercontrol.h"
 #include "llviewerdisplay.h"
 #include "llviewerjoystick.h"
@@ -218,7 +219,10 @@ LLAgent::LLAgent() :
 	mFirstLogin(FALSE),
 	mGenderChosen(FALSE),
 
-	mAppearanceSerialNum(0)
+	mAppearanceSerialNum(0),
+
+	mMouselookModeInSignal(NULL),
+	mMouselookModeOutSignal(NULL)
 {
 	for (U32 i = 0; i < TOTAL_CONTROLS; i++)
 	{
@@ -269,6 +273,9 @@ LLAgent::~LLAgent()
 {
 	cleanup();
 
+	delete mMouselookModeInSignal;
+	delete mMouselookModeOutSignal;
+
 	// *Note: this is where LLViewerCamera::getInstance() used to be deleted.
 }
 
@@ -643,6 +650,10 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
 	}
 	mRegionp = regionp;
 
+	// Pass the region host to LLUrlEntryParcel to resolve parcel name
+	// with a server request.
+	LLUrlEntryParcel::setRegionHost(getRegionHost());
+
 	// Must shift hole-covering water object locations because local
 	// coordinate frame changed.
 	LLWorld::getInstance()->updateWaterObjects();
@@ -1735,6 +1746,11 @@ void LLAgent::endAnimationUpdateUI()
 
 		LLFloaterCamera::onLeavingMouseLook();
 
+		if (mMouselookModeOutSignal)
+		{
+			(*mMouselookModeOutSignal)();
+		}
+
 		// Only pop if we have pushed...
 		if (TRUE == mViewsPushed)
 		{
@@ -1840,6 +1856,11 @@ void LLAgent::endAnimationUpdateUI()
 
 		mViewsPushed = TRUE;
 
+		if (mMouselookModeInSignal)
+		{
+			(*mMouselookModeInSignal)();
+		}
+
 		// hide all floaters except the mini map
 
 #if 0 // Use this once all floaters are registered
@@ -1899,7 +1920,6 @@ void LLAgent::endAnimationUpdateUI()
 				}
 			}
 		}
-
 	}
 	else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
 	{
@@ -1931,6 +1951,18 @@ void LLAgent::endAnimationUpdateUI()
 	gAgentCamera.updateLastCamera();
 }
 
+boost::signals2::connection LLAgent::setMouselookModeInCallback( const camera_signal_t::slot_type& cb )
+{
+	if (!mMouselookModeInSignal) mMouselookModeInSignal = new camera_signal_t();
+	return mMouselookModeInSignal->connect(cb);
+}
+
+boost::signals2::connection LLAgent::setMouselookModeOutCallback( const camera_signal_t::slot_type& cb )
+{
+	if (!mMouselookModeOutSignal) mMouselookModeOutSignal = new camera_signal_t();
+	return mMouselookModeOutSignal->connect(cb);
+}
+
 //-----------------------------------------------------------------------------
 // heardChat()
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index aebebad96aa580651df092103960ce68e795f967..896408c0dd6a9cc0417ece00063cf1664dcd64a0 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -39,6 +39,8 @@
 #include "llvoavatardefines.h"
 #include "llslurl.h"
 
+#include <boost/signals2.hpp>
+
 extern const BOOL 	ANIMATE;
 extern const U8 	AGENT_STATE_TYPING;  // Typing indication
 extern const U8 	AGENT_STATE_EDITING; // Set when agent has objects selected
@@ -410,7 +412,13 @@ class LLAgent : public LLOldEvents::LLObservable
 	BOOL			getCustomAnim() const { return mCustomAnim; }
 	void			setCustomAnim(BOOL anim) { mCustomAnim = anim; }
 	
+	typedef boost::signals2::signal<void ()> camera_signal_t;
+	boost::signals2::connection setMouselookModeInCallback( const camera_signal_t::slot_type& cb );
+	boost::signals2::connection setMouselookModeOutCallback( const camera_signal_t::slot_type& cb );
+
 private:
+	camera_signal_t* mMouselookModeInSignal;
+	camera_signal_t* mMouselookModeOutSignal;
 	BOOL            mCustomAnim; 		// Current animation is ANIM_AGENT_CUSTOMIZE ?
 	LLAnimPauseRequest mPauseRequest;
 	BOOL			mViewsPushed; 		// Keep track of whether or not we have pushed views
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 80734b0d41ae5231d670a03cf50c2bb5ef8f5868..f40fed5ad3450010bbfbc964f2b0b0332592cb84 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1300,8 +1300,16 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id)
 		return false;
 	}
 
-	// Check whether the outfit contains the full set of body parts (shape+skin+hair+eyes).
-	return getCanMakeFolderIntoOutfit(outfit_cat_id);
+	// Check whether the outfit contains any wearables we aren't wearing already (STORM-702).
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	LLFindWearablesEx is_worn(/*is_worn=*/ false, /*include_body_parts=*/ true);
+	gInventory.collectDescendentsIf(outfit_cat_id,
+		cats,
+		items,
+		LLInventoryModel::EXCLUDE_TRASH,
+		is_worn);
+	return items.size() > 0;
 }
 
 void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 3a98c23e05d70a2a4b43a32ebf6b05a666577a06..6a9dfaf21b6cbe21e3ade86ecc8983f129a04e04 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -44,6 +44,7 @@
 #include "llagentwearables.h"
 #include "llwindow.h"
 #include "llviewerstats.h"
+#include "llviewerstatsrecorder.h"
 #include "llmd5.h"
 #include "llpumpio.h"
 #include "llmimetypes.h"
@@ -93,6 +94,7 @@
 #include "llmemory.h"
 #include "llprimitive.h"
 #include "llurlaction.h"
+#include "llurlentry.h"
 #include "llvfile.h"
 #include "llvfsthread.h"
 #include "llvolumemgr.h"
@@ -471,8 +473,6 @@ static void settings_to_globals()
 	gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc");
 	gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
 	LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale");
-
-	LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap");
 }
 
 static void settings_modify()
@@ -666,6 +666,10 @@ bool LLAppViewer::init()
 
     mAlloc.setProfilingEnabled(gSavedSettings.getBOOL("MemProfiling"));
 
+#if LL_RECORD_VIEWER_STATS
+	LLViewerStatsRecorder::initClass();
+#endif
+
     // *NOTE:Mani - LLCurl::initClass is not thread safe. 
     // Called before threads are created.
     LLCurl::initClass();
@@ -848,6 +852,9 @@ bool LLAppViewer::init()
 	gGLActive = TRUE;
 	initWindow();
 
+	// initWindow also initializes the Feature List, so now we can initialize this global.
+	LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap");
+
 	// call all self-registered classes
 	LLInitClassList::instance().fireCallbacks();
 
@@ -989,6 +996,8 @@ bool LLAppViewer::init()
 
 	LLAgentLanguage::init();
 
+
+
 	return true;
 }
 
@@ -1389,16 +1398,6 @@ bool LLAppViewer::cleanup()
 	}
 	mPlugins.clear();
 
-	//----------------------------------------------
-	//this test code will be removed after the test
-	//test manual call stack tracer
-	if(gSavedSettings.getBOOL("QAMode"))
-	{
-		LLError::LLCallStacks::print() ;
-	}
-	//end of the test code
-	//----------------------------------------------
-
 	//flag all elements as needing to be destroyed immediately
 	// to ensure shutdown order
 	LLMortician::setZealous(TRUE);
@@ -1709,6 +1708,10 @@ bool LLAppViewer::cleanup()
 	}
 	LLMetricPerformanceTesterBasic::cleanClass() ;
 
+#if LL_RECORD_VIEWER_STATS
+	LLViewerStatsRecorder::cleanupClass();
+#endif
+
 	llinfos << "Cleaning up Media and Textures" << llendflush;
 
 	//Note:
@@ -3064,35 +3067,32 @@ void LLAppViewer::initMarkerFile()
 	std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
 	std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
 
-	
 	if (LLAPRFile::isExist(mMarkerFileName, NULL, LL_APR_RB) && !anotherInstanceRunning())
 	{
 		gLastExecEvent = LAST_EXEC_FROZE;
 		LL_INFOS("MarkerFile") << "Exec marker found: program froze on previous execution" << LL_ENDL;
 	}    
-    
 	if(LLAPRFile::isExist(logout_marker_file, NULL, LL_APR_RB))
 	{
-		LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << LL_ENDL;
 		gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
+		LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
+		LLAPRFile::remove(logout_marker_file);
 	}
 	if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB))
 	{
-		llinfos << "Last exec LLError crashed, setting LastExecEvent to " << LAST_EXEC_LLERROR_CRASH << llendl;
 		if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
 		else gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
+		LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
+		LLAPRFile::remove(llerror_marker_file);
 	}
 	if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
 	{
-		LL_INFOS("MarkerFile") << "Last exec crashed, setting LastExecEvent to " << LAST_EXEC_OTHER_CRASH << LL_ENDL;
 		if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
 		else gLastExecEvent = LAST_EXEC_OTHER_CRASH;
+		LL_INFOS("MarkerFile") << "Last exec crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
+		LLAPRFile::remove(error_marker_file);
 	}
-	
-	LLAPRFile::remove(logout_marker_file);
-	LLAPRFile::remove(llerror_marker_file);
-	LLAPRFile::remove(error_marker_file);
-	
+
 	// No new markers if another instance is running.
 	if(anotherInstanceRunning()) 
 	{
@@ -3734,6 +3734,7 @@ void LLAppViewer::loadNameCache()
 	// display names cache
 	std::string filename =
 		gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
+	LL_INFOS("AvNameCache") << filename << LL_ENDL;
 	llifstream name_cache_stream(filename);
 	if(name_cache_stream.is_open())
 	{
@@ -4567,6 +4568,10 @@ void LLAppViewer::disconnectViewer()
 
 	cleanup_xfer_manager();
 	gDisconnected = TRUE;
+
+	// Pass the connection state to LLUrlEntryParcel not to attempt
+	// parcel info requests while disconnected.
+	LLUrlEntryParcel::setDisconnected(gDisconnected);
 }
 
 void LLAppViewer::forceErrorLLError()
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index f12bc16d4b958eff310c64053081e92f15f93ab3..dd5bc74b2a7a2154b09d838c90850a1d162e40c6 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -126,6 +126,7 @@ void LLAssetUploadResponder::error(U32 statusNum, const std::string& reason)
 			break;
 	}
 	LLUploadDialog::modalUploadFinished();
+	LLFilePicker::instance().reset();  // unlock file picker when bulk upload fails
 }
 
 //virtual 
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
old mode 100644
new mode 100755
index 066b4d8bc3ac9f8c070967b6cd137e018c618403..f3f0cde221353bb0a77af4252e94cc3a83cb1514
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -56,9 +56,11 @@
 #include "llmutelist.h"
 #include "llnotificationsutil.h"	// for LLNotificationsUtil
 #include "llpaneloutfitedit.h"
+#include "llpanelprofile.h"
 #include "llrecentpeople.h"
 #include "llsidetray.h"
 #include "lltrans.h"
+#include "llviewercontrol.h"
 #include "llviewerobjectlist.h"
 #include "llviewermessage.h"	// for handle_lure
 #include "llviewerregion.h"
@@ -306,6 +308,20 @@ void LLAvatarActions::showProfile(const LLUUID& id)
 		params["id"] = id;
 		params["open_tab_name"] = "panel_profile";
 
+		// PROFILES: open in webkit window
+		std::string full_name;
+		if (gCacheName->getFullName(id,full_name))
+		{
+			std::string agent_name = LLCacheName::buildUsername(full_name);
+			llinfos << "opening web profile for " << agent_name << llendl;		
+			std::string url = getProfileURL(agent_name);
+			LLWeb::loadWebURLInternal(url);
+		}
+		else
+		{
+			llwarns << "no name info for agent id " << id << llendl;
+		}
+#if 0
 		//Show own profile
 		if(gAgent.getID() == id)
 		{
@@ -316,6 +332,7 @@ void LLAvatarActions::showProfile(const LLUUID& id)
 		{
 			LLSideTray::getInstance()->showPanel("panel_profile_view", params);
 		}
+#endif
 	}
 }
 
diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp
index 4a1ba6f1b5fe91903323ccb8f5ad23b280eb7305..6f02192d0aeacd99ef5fce0215591d876dd78bfa 100644
--- a/indra/newview/llcolorswatch.cpp
+++ b/indra/newview/llcolorswatch.cpp
@@ -319,7 +319,7 @@ void LLColorSwatchCtrl::onColorChanged ( void* data, EColorPickOp pick_op )
 // This is called when the main floatercustomize panel is closed.
 // Since this class has pointers up to its parents, we need to cleanup
 // this class first in order to avoid a crash.
-void LLColorSwatchCtrl::onParentFloaterClosed()
+void LLColorSwatchCtrl::closeFloaterColorPicker()
 {
 	LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
 	if (pickerp)
diff --git a/indra/newview/llcolorswatch.h b/indra/newview/llcolorswatch.h
index cd859ea1286c052a51d4247c627907f9f562d4d1..5bdd1712d2002cc84166b2643fb5fd9b7057085e 100644
--- a/indra/newview/llcolorswatch.h
+++ b/indra/newview/llcolorswatch.h
@@ -100,7 +100,7 @@ class LLColorSwatchCtrl
 	/*virtual*/ void	setEnabled( BOOL enabled );
 
 	static void		onColorChanged ( void* data, EColorPickOp pick_op = COLOR_CHANGE );
-	void			onParentFloaterClosed();
+	void			closeFloaterColorPicker();
 
 protected:
 	BOOL			mValid;
diff --git a/indra/newview/llcommandhandler.cpp b/indra/newview/llcommandhandler.cpp
old mode 100644
new mode 100755
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 0c0fdd5572cad3821ba4c91f938ac68c01beb005..0b17d64eb078a60daeebc5f3d33a2412f45b8395 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -607,6 +607,15 @@ void LLFavoritesBarCtrl::changed(U32 mask)
 	}	
 	else
 	{
+		LLInventoryModel::item_array_t items;
+		LLInventoryModel::cat_array_t cats;
+		LLIsType is_type(LLAssetType::AT_LANDMARK);
+		gInventory.collectDescendentsIf(mFavoriteFolderId, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+		
+		for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+		{
+			(*i)->getSLURL();
+		}
 		updateButtons();
 	}
 }
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index ca2ef5f5b8e1bdafcf462cccf502359253947c76..4e16cc4217dcb1c1c67f7fa944c929b2f8a822e2 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -290,11 +290,9 @@ BOOL LLFeatureManager::parseFeatureTable(std::string filename)
 	mTableVersion = version;
 
 	LLFeatureList *flp = NULL;
-	while (!file.eof() && file.good())
+	while (file >> name)
 	{
 		char buffer[MAX_STRING];		 /*Flawfinder: ignore*/
-
-		file >> name;
 		
 		if (name.substr(0,2) == "//")
 		{
@@ -303,13 +301,6 @@ BOOL LLFeatureManager::parseFeatureTable(std::string filename)
 			continue;
 		}
 
-		if (name.empty())
-		{
-			// This is a blank line
-			file.getline(buffer, MAX_STRING);
-			continue;
-		}
-
 		if (name == "list")
 		{
 			if (flp)
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 351b9ac5dad40a4423cfe24556ee7ba6acf5cccb..1b94d8cbcd2e7ccfe1bac70a41412eb07cc0f5f0 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -83,7 +83,6 @@ LLFloaterMap::~LLFloaterMap()
 BOOL LLFloaterMap::postBuild()
 {
 	mMap = getChild<LLNetMap>("Net Map");
-	mMap->setScale(gSavedSettings.getF32("MiniMapScale"));
 	mMap->setToolTipMsg(getString("ToolTipMsg"));	
 	sendChildToBack(mMap);
 	
@@ -288,7 +287,16 @@ void LLFloaterMap::handleZoom(const LLSD& userdata)
 	std::string level = userdata.asString();
 	
 	F32 scale = 0.0f;
-	if (level == std::string("close"))
+	if (level == std::string("default"))
+	{
+		LLControlVariable *pvar = gSavedSettings.getControl("MiniMapScale");
+		if(pvar)
+		{
+			pvar->resetToDefault();
+			scale = gSavedSettings.getF32("MiniMapScale");
+		}
+	}
+	else if (level == std::string("close"))
 		scale = LLNetMap::MAP_SCALE_MAX;
 	else if (level == std::string("medium"))
 		scale = LLNetMap::MAP_SCALE_MID;
@@ -296,7 +304,6 @@ void LLFloaterMap::handleZoom(const LLSD& userdata)
 		scale = LLNetMap::MAP_SCALE_MIN;
 	if (scale != 0.0f)
 	{
-		gSavedSettings.setF32("MiniMapScale", scale );
 		mMap->setScale(scale);
 	}
 }
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
old mode 100644
new mode 100755
index 338b6555ff7a2ffece95db72053ba9fa8bb60954..8c9dfe435a3865d62e6728b9458f55e95d72918a
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -105,6 +105,7 @@
 #include "llteleporthistorystorage.h"
 
 #include "lllogininstance.h"        // to check if logged in yet
+#include "llsdserialize.h"
 
 const F32 MAX_USER_FAR_CLIP = 512.f;
 const F32 MIN_USER_FAR_CLIP = 64.f;
@@ -284,8 +285,10 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mGotPersonalInfo(false),
 	mOriginalIMViaEmail(false),
 	mLanguageChanged(false),
-	mDoubleClickActionDirty(false)
+	mDoubleClickActionDirty(false),
+	mFavoritesRecordMayExist(false)
 {
+	
 	//Build Floater is now Called from 	LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
 	
 	static bool registered_dialog = false;
@@ -322,16 +325,61 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mCommitCallbackRegistrar.add("Pref.getUIColor",				boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2));
 	mCommitCallbackRegistrar.add("Pref.MaturitySettings",		boost::bind(&LLFloaterPreference::onChangeMaturity, this));
 	mCommitCallbackRegistrar.add("Pref.BlockList",				boost::bind(&LLFloaterPreference::onClickBlockList, this));
+	
+	sSkin = gSavedSettings.getString("SkinCurrent");
+
 	mCommitCallbackRegistrar.add("Pref.CommitDoubleClickChekbox",	boost::bind(&LLFloaterPreference::onDoubleClickCheckBox, this, _1));
 	mCommitCallbackRegistrar.add("Pref.CommitRadioDoubleClick",	boost::bind(&LLFloaterPreference::onDoubleClickRadio, this));
 
-	sSkin = gSavedSettings.getString("SkinCurrent");
-	
 	gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));	
 	gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));	
 	gSavedSettings.getControl("UseDisplayNames")->getCommitSignal()->connect(boost::bind(&handleDisplayNamesOptionChanged,  _2));
+
+	LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
+}
+
+void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type )
+{
+	if ( APT_PROPERTIES == type )
+	{
+		const LLAvatarData* pAvatarData = static_cast<const LLAvatarData*>( pData );
+		if( pAvatarData && gAgent.getID() == pAvatarData->avatar_id )
+		{
+			storeAvatarProperties( pAvatarData );
+			processProfileProperties( pAvatarData );
+		}
+	}	
 }
 
+void LLFloaterPreference::storeAvatarProperties( const LLAvatarData* pAvatarData )
+{
+	mAvatarProperties.avatar_id		= gAgent.getID();
+	mAvatarProperties.image_id		= pAvatarData->image_id;
+	mAvatarProperties.fl_image_id   = pAvatarData->fl_image_id;
+	mAvatarProperties.about_text	= pAvatarData->about_text;
+	mAvatarProperties.fl_about_text = pAvatarData->fl_about_text;
+	mAvatarProperties.profile_url   = pAvatarData->profile_url;
+	mAvatarProperties.flags		    = pAvatarData->flags;
+	mAvatarProperties.allow_publish	= pAvatarData->flags & AVATAR_ALLOW_PUBLISH;
+}
+
+void LLFloaterPreference::processProfileProperties(const LLAvatarData* pAvatarData )
+{
+	getChild<LLUICtrl>("online_searchresults")->setValue( (bool)(pAvatarData->flags & AVATAR_ALLOW_PUBLISH) );	
+}
+
+void LLFloaterPreference::saveAvatarProperties( void )
+{
+	mAvatarProperties.allow_publish = getChild<LLUICtrl>("online_searchresults")->getValue();
+	if ( mAvatarProperties.allow_publish )
+	{
+		mAvatarProperties.flags |= AVATAR_ALLOW_PUBLISH;
+	}
+	
+	LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate( &mAvatarProperties );
+}
+
+
 BOOL LLFloaterPreference::postBuild()
 {
 	gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2));
@@ -415,6 +463,8 @@ void LLFloaterPreference::saveSettings()
 
 void LLFloaterPreference::apply()
 {
+	LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
+	
 	LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
 	if (sSkin != gSavedSettings.getString("SkinCurrent"))
 	{
@@ -486,11 +536,41 @@ void LLFloaterPreference::apply()
 		}
 	}
 
+	saveAvatarProperties();
+
 	if (mDoubleClickActionDirty)
 	{
 		updateDoubleClickSettings();
 		mDoubleClickActionDirty = false;
 	}
+
+	if (mFavoritesRecordMayExist && !gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))
+	{
+		removeFavoritesRecordOfUser();		
+	}
+}
+
+void LLFloaterPreference::removeFavoritesRecordOfUser()
+{
+	mFavoritesRecordMayExist = false;
+	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
+	LLSD fav_llsd;
+	llifstream file;
+	file.open(filename);
+	if (!file.is_open()) return;
+	LLSDSerialize::fromXML(fav_llsd, file);
+	
+	LLAvatarName av_name;
+	LLAvatarNameCache::get( gAgentID, &av_name );
+	if (fav_llsd.has(av_name.getLegacyName()))
+	{
+		fav_llsd.erase(av_name.getLegacyName());
+	}
+	
+	llofstream out_file;
+	out_file.open(filename);
+	LLSDSerialize::toPrettyXML(fav_llsd, out_file);
+
 }
 
 void LLFloaterPreference::cancel()
@@ -527,6 +607,7 @@ void LLFloaterPreference::cancel()
 
 void LLFloaterPreference::onOpen(const LLSD& key)
 {
+	
 	// this variable and if that follows it are used to properly handle busy mode response message
 	static bool initialized = FALSE;
 	// if user is logged in and we haven't initialized busy_response yet, do it
@@ -553,7 +634,7 @@ void LLFloaterPreference::onOpen(const LLSD& key)
 		(gAgent.isMature() || gAgent.isGodlike());
 	
 	LLComboBox* maturity_combo = getChild<LLComboBox>("maturity_desired_combobox");
-	
+	LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest( gAgent.getID() );
 	if (can_choose_maturity)
 	{		
 		// if they're not adult or a god, they shouldn't see the adult selection, so delete it
@@ -575,6 +656,11 @@ void LLFloaterPreference::onOpen(const LLSD& key)
 		getChildView("maturity_desired_combobox")->setVisible( false);
 	}
 
+	if (LLStartUp::getStartupState() == STATE_STARTED)
+	{
+		mFavoritesRecordMayExist = gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin");
+	}
+
 	// Forget previous language changes.
 	mLanguageChanged = false;
 
@@ -1288,6 +1374,7 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
 	
 //	getChild<LLUICtrl>("busy_response")->setValue(gSavedSettings.getString("BusyModeResponse2"));
 	
+	getChildView("favorites_on_login_check")->setEnabled(TRUE);
 	getChildView("log_nearby_chat")->setEnabled(TRUE);
 	getChildView("log_instant_messages")->setEnabled(TRUE);
 	getChildView("show_timestamps_check_im")->setEnabled(TRUE);
@@ -1503,6 +1590,10 @@ BOOL LLPanelPreference::postBuild()
 	{
 		getChild<LLCheckBoxCtrl>("voice_call_friends_only_check")->setCommitCallback(boost::bind(&showFriendsOnlyWarning, _1, _2));
 	}
+	if (hasChild("favorites_on_login_check"))
+	{
+		getChild<LLCheckBoxCtrl>("favorites_on_login_check")->setCommitCallback(boost::bind(&showFavoritesOnLoginWarning, _1, _2));
+	}
 
 	// Panel Advanced
 	if (hasChild("modifier_combo"))
@@ -1570,6 +1661,14 @@ void LLPanelPreference::showFriendsOnlyWarning(LLUICtrl* checkbox, const LLSD& v
 	}
 }
 
+void LLPanelPreference::showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value)
+{
+	if (checkbox && checkbox->getValue())
+	{
+		LLNotificationsUtil::add("FavoritesOnLogin");
+	}
+}
+
 void LLPanelPreference::cancel()
 {
 	for (control_values_map_t::iterator iter =  mSavedValues.begin();
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 0f5118985347b100f17ad15c3ccb76c7c1fb7560..784033ae95c1afa4876ed65c1154db0bf45bcfc8 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -34,6 +34,7 @@
 #define LL_LLFLOATERPREFERENCE_H
 
 #include "llfloater.h"
+#include "llavatarpropertiesprocessor.h"
 
 class LLPanelPreference;
 class LLPanelLCD;
@@ -55,7 +56,7 @@ typedef enum
 
 
 // Floater to control preferences (display, audio, bandwidth, general.
-class LLFloaterPreference : public LLFloater
+class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver
 {
 public: 
 	LLFloaterPreference(const LLSD& key);
@@ -77,6 +78,11 @@ class LLFloaterPreference : public LLFloater
 	// translate user's busy response message according to current locale if message is default, otherwise do nothing
 	static void initBusyResponse();
 
+	void processProperties( void* pData, EAvatarProcessorType type );
+	void processProfileProperties(const LLAvatarData* pAvatarData );
+	void storeAvatarProperties( const LLAvatarData* pAvatarData );
+	void saveAvatarProperties( void );
+
 protected:	
 	void		onBtnOK();
 	void		onBtnCancel();
@@ -153,6 +159,8 @@ class LLFloaterPreference : public LLFloater
 	
 	void buildPopupLists();
 	static void refreshSkin(void* data);
+	// Remove record of current user's favorites from file on disk.
+	void removeFavoritesRecordOfUser();
 private:
 	static std::string sSkin;
 	// set true if state of double-click action checkbox or radio-group was changed by user
@@ -163,7 +171,11 @@ class LLFloaterPreference : public LLFloater
 	bool mLanguageChanged;
 	
 	bool mOriginalHideOnlineStatus;
+	// Record of current user's favorites may be stored in file on disk.
+	bool mFavoritesRecordMayExist;
 	std::string mDirectoryVisibility;
+	
+	LLAvatarData mAvatarProperties;
 };
 
 class LLPanelPreference : public LLPanel
@@ -184,6 +196,8 @@ class LLPanelPreference : public LLPanel
 private:
 	//for "Only friends and groups can call or IM me"
 	static void showFriendsOnlyWarning(LLUICtrl*, const LLSD&);
+	//for "Show my Favorite Landmarks at Login"
+	static void showFavoritesOnLoginWarning(LLUICtrl* checkbox, const LLSD& value);
 
 	typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
 	control_values_map_t mSavedValues;
diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp
index 71882fbb839b91e2f250b4af29d29d19835e6a4d..07f5220ab7f8419cc50d5b0723c1d7f7e63a97dc 100644
--- a/indra/newview/llfloatersettingsdebug.cpp
+++ b/indra/newview/llfloatersettingsdebug.cpp
@@ -178,7 +178,7 @@ void LLFloaterSettingsDebug::onClickDefault()
 
 	if (controlp)
 	{
-		controlp->resetToDefault();
+		controlp->resetToDefault(true);
 		updateControl(controlp);
 	}
 }
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 51726112a0fccb2c2081a701a8ddf16e9d2016bd..058567492be7ad57ee9a8a14cfd6b812b3827788 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -1,402 +1,402 @@
-/**
- * @file llfloaterwebcontent.cpp
- * @brief floater for displaying web content - e.g. profiles and search (eventually)
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-
-#include "llcombobox.h"
-#include "lliconctrl.h"
-#include "llfloaterreg.h"
-#include "lllayoutstack.h"
-#include "llpluginclassmedia.h"
-#include "llprogressbar.h"
-#include "lltextbox.h"
-#include "llurlhistory.h"
-#include "llviewercontrol.h"
-#include "llweb.h"
-#include "llwindow.h"
-
-#include "llfloaterwebcontent.h"
-
-LLFloaterWebContent::LLFloaterWebContent( const LLSD& key )
-	: LLFloater( key )
-{
-	mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
-	mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this ));
-	mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));
-	mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this ));
-	mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this ));
-	mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind( &LLFloaterWebContent::onPopExternal, this ));
-}
-
-BOOL LLFloaterWebContent::postBuild()
-{
-	// these are used in a bunch of places so cache them
-	mWebBrowser = getChild< LLMediaCtrl >( "webbrowser" );
-	mAddressCombo = getChild< LLComboBox >( "address" );
-	mStatusBarText = getChild< LLTextBox >( "statusbartext" );
-	mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
-
-	// observe browser events
-	mWebBrowser->addObserver( this );
-
-	// these buttons are always enabled
-	getChildView("reload")->setEnabled( true );
-	getChildView("popexternal")->setEnabled( true );
-
-	// cache image for secure browsing
-	mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag");
-
-	// initialize the URL history using the system URL History manager
-	initializeURLHistory();
-
-	return TRUE;
-}
-
-void LLFloaterWebContent::initializeURLHistory()
-{
-	// start with an empty list
-	LLCtrlListInterface* url_list = childGetListInterface("address");
-	if (url_list)
-	{
-		url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
-	}
-
-	// Get all of the entries in the "browser" collection
-	LLSD browser_history = LLURLHistory::getURLHistory("browser");
-	LLSD::array_iterator iter_history =
-		browser_history.beginArray();
-	LLSD::array_iterator end_history =
-		browser_history.endArray();
-	for(; iter_history != end_history; ++iter_history)
-	{
-		std::string url = (*iter_history).asString();
-		if(! url.empty())
-			url_list->addSimpleElement(url);
-	}
-}
-
-//static
-void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid )
-{
-	lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;
-
-	std::string tag = target;
-
-	if(target.empty() || target == "_blank")
-	{
-		if(!uuid.empty())
-		{
-			tag = uuid;
-		}
-		else
-		{
-			// create a unique tag for this instance
-			LLUUID id;
-			id.generate();
-			tag = id.asString();
-		}
-	}
-
-	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
-
-	if(LLFloaterReg::findInstance("web_content", tag) != NULL)
-	{
-		// There's already a web browser for this tag, so we won't be opening a new window.
-	}
-	else if(browser_window_limit != 0)
-	{
-		// showInstance will open a new window.  Figure out how many web browsers are already open,
-		// and close the least recently opened one if this will put us over the limit.
-
-		LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("web_content");
-		lldebugs << "total instance count is " << instances.size() << llendl;
-
-		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
-		{
-			lldebugs << "    " << (*iter)->getKey() << llendl;
-		}
-
-		if(instances.size() >= (size_t)browser_window_limit)
-		{
-			// Destroy the least recently opened instance
-			(*instances.begin())->closeFloater();
-		}
-	}
-
-	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag));
-	llassert(browser);
-	if(browser)
-	{
-		browser->mUUID = uuid;
-
-		// tell the browser instance to load the specified URL
-		browser->open_media(url, target);
-		LLViewerMedia::proxyWindowOpened(target, uuid);
-	}
-}
-
-//static
-void LLFloaterWebContent::closeRequest(const std::string &uuid)
-{
-	LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content");
-	lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
-	for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
-	{
-		LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter);
-		lldebugs << "    " << i->mUUID << llendl;
-		if (i && i->mUUID == uuid)
-		{
-			i->closeFloater(false);
-			return;
- 		}
- 	}
-}
-
-//static
-void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height)
-{
-	LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content");
-	lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
-	for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
-	{
-		LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter);
-		lldebugs << "    " << i->mUUID << llendl;
-		if (i && i->mUUID == uuid)
-		{
-			i->geometryChanged(x, y, width, height);
-			return;
-		}
-	}
-}
-
-void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
-{
-	// Make sure the layout of the browser control is updated, so this calculation is correct.
-	LLLayoutStack::updateClass();
-
-	// TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
-	LLCoordWindow window_size;
-	getWindow()->getSize(&window_size);
-
-	// Adjust width and height for the size of the chrome on the web Browser window.
-	width += getRect().getWidth() - mWebBrowser->getRect().getWidth();
-	height += getRect().getHeight() - mWebBrowser->getRect().getHeight();
-
-	LLRect geom;
-	geom.setOriginAndSize(x, window_size.mY - (y + height), width, height);
-
-	lldebugs << "geometry change: " << geom << llendl;
-
-	handleReshape(geom,false);
-}
-
-void LLFloaterWebContent::open_media(const std::string& web_url, const std::string& target)
-{
-	// Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin.
-	mWebBrowser->setHomePageUrl(web_url, "text/html");
-	mWebBrowser->setTarget(target);
-	mWebBrowser->navigateTo(web_url, "text/html");
-	set_current_url(web_url);
-}
-
-//virtual
-void LLFloaterWebContent::onClose(bool app_quitting)
-{
-	LLViewerMedia::proxyWindowClosed(mUUID);
-	destroy();
-}
-
-// virtual
-void LLFloaterWebContent::draw()
-{
-	// this is asychronous so we need to keep checking
-	getChildView( "back" )->setEnabled( mWebBrowser->canNavigateBack() );
-	getChildView( "forward" )->setEnabled( mWebBrowser->canNavigateForward() );
-
-	LLFloater::draw();
-}
-
-// virtual
-void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
-{
-	if(event == MEDIA_EVENT_LOCATION_CHANGED)
-	{
-		const std::string url = self->getLocation();
-
-		if ( url.length() )
-			mStatusBarText->setText( url );
-
-		set_current_url( url );
-	}
-	else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
-	{
-		// flags are sent with this event
-		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
-		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
-
-		// toggle visibility of these buttons based on browser state
-		getChildView("reload")->setVisible( false );
-		getChildView("stop")->setVisible( true );
-
-		// turn "on" progress bar now we're about to start loading
-		mStatusBarProgress->setVisible( true );
-	}
-	else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
-	{
-		// flags are sent with this event
-		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
-		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
-
-		// toggle visibility of these buttons based on browser state
-		getChildView("reload")->setVisible( true );
-		getChildView("stop")->setVisible( false );
-
-		// turn "off" progress bar now we're loaded
-		mStatusBarProgress->setVisible( false );
-
-		// we populate the status bar with URLs as they change so clear it now we're done
-		const std::string end_str = "";
-		mStatusBarText->setText( end_str );
-
-		// decide if secure browsing icon should be displayed
-		std::string prefix =  std::string("https://");
-		std::string test_prefix = mCurrentURL.substr(0, prefix.length());
-		LLStringUtil::toLower(test_prefix);
-		if(test_prefix == prefix)
-		{
-			mSecureLockIcon->setVisible(true);
-		}
-		else
-		{
-			mSecureLockIcon->setVisible(false);
-		}
-	}
-	else if(event == MEDIA_EVENT_CLOSE_REQUEST)
-	{
-		// The browser instance wants its window closed.
-		closeFloater();
-	}
-	else if(event == MEDIA_EVENT_GEOMETRY_CHANGE)
-	{
-		geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight());
-	}
-	else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED )
-	{
-		const std::string text = self->getStatusText();
-		if ( text.length() )
-			mStatusBarText->setText( text );
-	}
-	else if(event == MEDIA_EVENT_PROGRESS_UPDATED )
-	{
-		int percent = (int)self->getProgressPercent();
-		mStatusBarProgress->setValue( percent );
-	}
-	else if(event == MEDIA_EVENT_NAME_CHANGED )
-	{
-		std::string page_title = self->getMediaName();
-		// simulate browser behavior - title is empty, use the current URL
-		if ( page_title.length() > 0 )
-			setTitle( page_title );
-		else
-			setTitle( mCurrentURL );
-	}
-	else if(event == MEDIA_EVENT_LINK_HOVERED )
-	{
-		const std::string link = self->getHoverLink();
-		mStatusBarText->setText( link );
-	}
-}
-
-void LLFloaterWebContent::set_current_url(const std::string& url)
-{
-	mCurrentURL = url;
-
-	// serialize url history into the system URL History manager
-	LLURLHistory::removeURL("browser", mCurrentURL);
-	LLURLHistory::addURL("browser", mCurrentURL);
-
-	mAddressCombo->remove( mCurrentURL );
-	mAddressCombo->add( mCurrentURL );
-	mAddressCombo->selectByValue( mCurrentURL );
-}
-
-void LLFloaterWebContent::onClickForward()
-{
-	mWebBrowser->navigateForward();
-}
-
-void LLFloaterWebContent::onClickBack()
-{
-	mWebBrowser->navigateBack();
-}
-
-void LLFloaterWebContent::onClickReload()
-{
-
-	if( mWebBrowser->getMediaPlugin() )
-	{
-		bool ignore_cache = true;
-		mWebBrowser->getMediaPlugin()->browse_reload( ignore_cache );
-	}
-	else
-	{
-		mWebBrowser->navigateTo(mCurrentURL);
-	}
-}
-
-void LLFloaterWebContent::onClickStop()
-{
-	if( mWebBrowser->getMediaPlugin() )
-		mWebBrowser->getMediaPlugin()->browse_stop();
-
-	// still should happen when we catch the navigate complete event
-	// but sometimes (don't know why) that event isn't sent from Qt
-	// and we getto a point where the stop button stays active.
-	getChildView("reload")->setVisible( true );
-	getChildView("stop")->setVisible( false );
-}
-
-void LLFloaterWebContent::onEnterAddress()
-{
-	// make sure there is at least something there.
-	// (perhaps this test should be for minimum length of a URL)
-	std::string url = mAddressCombo->getValue().asString();
-	if ( url.length() > 0 )
-	{
-		mWebBrowser->navigateTo( url, "text/html");
-	};
-}
-
-void LLFloaterWebContent::onPopExternal()
-{
-	// make sure there is at least something there.
-	// (perhaps this test should be for minimum length of a URL)
-	std::string url = mAddressCombo->getValue().asString();
-	if ( url.length() > 0 )
-	{
-		LLWeb::loadURLExternal( url );
-	};
-}
+/**
+ * @file llfloaterwebcontent.cpp
+ * @brief floater for displaying web content - e.g. profiles and search (eventually)
+ *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llcombobox.h"
+#include "lliconctrl.h"
+#include "llfloaterreg.h"
+#include "lllayoutstack.h"
+#include "llpluginclassmedia.h"
+#include "llprogressbar.h"
+#include "lltextbox.h"
+#include "llurlhistory.h"
+#include "llviewercontrol.h"
+#include "llweb.h"
+#include "llwindow.h"
+
+#include "llfloaterwebcontent.h"
+
+LLFloaterWebContent::LLFloaterWebContent( const LLSD& key )
+	: LLFloater( key )
+{
+	mCommitCallbackRegistrar.add( "WebContent.Back", boost::bind( &LLFloaterWebContent::onClickBack, this ));
+	mCommitCallbackRegistrar.add( "WebContent.Forward", boost::bind( &LLFloaterWebContent::onClickForward, this ));
+	mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));
+	mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this ));
+	mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this ));
+	mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind( &LLFloaterWebContent::onPopExternal, this ));
+}
+
+BOOL LLFloaterWebContent::postBuild()
+{
+	// these are used in a bunch of places so cache them
+	mWebBrowser = getChild< LLMediaCtrl >( "webbrowser" );
+	mAddressCombo = getChild< LLComboBox >( "address" );
+	mStatusBarText = getChild< LLTextBox >( "statusbartext" );
+	mStatusBarProgress = getChild<LLProgressBar>("statusbarprogress" );
+
+	// observe browser events
+	mWebBrowser->addObserver( this );
+
+	// these buttons are always enabled
+	getChildView("reload")->setEnabled( true );
+	getChildView("popexternal")->setEnabled( true );
+
+	// cache image for secure browsing
+	mSecureLockIcon = getChild< LLIconCtrl >("media_secure_lock_flag");
+
+	// initialize the URL history using the system URL History manager
+	initializeURLHistory();
+
+	return TRUE;
+}
+
+void LLFloaterWebContent::initializeURLHistory()
+{
+	// start with an empty list
+	LLCtrlListInterface* url_list = childGetListInterface("address");
+	if (url_list)
+	{
+		url_list->operateOnAll(LLCtrlListInterface::OP_DELETE);
+	}
+
+	// Get all of the entries in the "browser" collection
+	LLSD browser_history = LLURLHistory::getURLHistory("browser");
+	LLSD::array_iterator iter_history =
+		browser_history.beginArray();
+	LLSD::array_iterator end_history =
+		browser_history.endArray();
+	for(; iter_history != end_history; ++iter_history)
+	{
+		std::string url = (*iter_history).asString();
+		if(! url.empty())
+			url_list->addSimpleElement(url);
+	}
+}
+
+//static
+void LLFloaterWebContent::create( const std::string &url, const std::string& target, const std::string& uuid )
+{
+	lldebugs << "url = " << url << ", target = " << target << ", uuid = " << uuid << llendl;
+
+	std::string tag = target;
+
+	if(target.empty() || target == "_blank")
+	{
+		if(!uuid.empty())
+		{
+			tag = uuid;
+		}
+		else
+		{
+			// create a unique tag for this instance
+			LLUUID id;
+			id.generate();
+			tag = id.asString();
+		}
+	}
+
+	S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
+
+	if(LLFloaterReg::findInstance("web_content", tag) != NULL)
+	{
+		// There's already a web browser for this tag, so we won't be opening a new window.
+	}
+	else if(browser_window_limit != 0)
+	{
+		// showInstance will open a new window.  Figure out how many web browsers are already open,
+		// and close the least recently opened one if this will put us over the limit.
+
+		LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList("web_content");
+		lldebugs << "total instance count is " << instances.size() << llendl;
+
+		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
+		{
+			lldebugs << "    " << (*iter)->getKey() << llendl;
+		}
+
+		if(instances.size() >= (size_t)browser_window_limit)
+		{
+			// Destroy the least recently opened instance
+			(*instances.begin())->closeFloater();
+		}
+	}
+
+	LLFloaterWebContent *browser = dynamic_cast<LLFloaterWebContent*> (LLFloaterReg::showInstance("web_content", tag));
+	llassert(browser);
+	if(browser)
+	{
+		browser->mUUID = uuid;
+
+		// tell the browser instance to load the specified URL
+		browser->open_media(url, target);
+		LLViewerMedia::proxyWindowOpened(target, uuid);
+	}
+}
+
+//static
+void LLFloaterWebContent::closeRequest(const std::string &uuid)
+{
+	LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content");
+	lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
+	for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+	{
+		LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter);
+		lldebugs << "    " << i->mUUID << llendl;
+		if (i && i->mUUID == uuid)
+		{
+			i->closeFloater(false);
+			return;
+ 		}
+ 	}
+}
+
+//static
+void LLFloaterWebContent::geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height)
+{
+	LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("web_content");
+	lldebugs << "instance list size is " << inst_list.size() << ", incoming uuid is " << uuid << llendl;
+	for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
+	{
+		LLFloaterWebContent* i = dynamic_cast<LLFloaterWebContent*>(*iter);
+		lldebugs << "    " << i->mUUID << llendl;
+		if (i && i->mUUID == uuid)
+		{
+			i->geometryChanged(x, y, width, height);
+			return;
+		}
+	}
+}
+
+void LLFloaterWebContent::geometryChanged(S32 x, S32 y, S32 width, S32 height)
+{
+	// Make sure the layout of the browser control is updated, so this calculation is correct.
+	LLLayoutStack::updateClass();
+
+	// TODO: need to adjust size and constrain position to make sure floaters aren't moved outside the window view, etc.
+	LLCoordWindow window_size;
+	getWindow()->getSize(&window_size);
+
+	// Adjust width and height for the size of the chrome on the web Browser window.
+	width += getRect().getWidth() - mWebBrowser->getRect().getWidth();
+	height += getRect().getHeight() - mWebBrowser->getRect().getHeight();
+
+	LLRect geom;
+	geom.setOriginAndSize(x, window_size.mY - (y + height), width, height);
+
+	lldebugs << "geometry change: " << geom << llendl;
+
+	handleReshape(geom,false);
+}
+
+void LLFloaterWebContent::open_media(const std::string& web_url, const std::string& target)
+{
+	// Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin.
+	mWebBrowser->setHomePageUrl(web_url, "text/html");
+	mWebBrowser->setTarget(target);
+	mWebBrowser->navigateTo(web_url, "text/html");
+	set_current_url(web_url);
+}
+
+//virtual
+void LLFloaterWebContent::onClose(bool app_quitting)
+{
+	LLViewerMedia::proxyWindowClosed(mUUID);
+	destroy();
+}
+
+// virtual
+void LLFloaterWebContent::draw()
+{
+	// this is asychronous so we need to keep checking
+	getChildView( "back" )->setEnabled( mWebBrowser->canNavigateBack() );
+	getChildView( "forward" )->setEnabled( mWebBrowser->canNavigateForward() );
+
+	LLFloater::draw();
+}
+
+// virtual
+void LLFloaterWebContent::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
+{
+	if(event == MEDIA_EVENT_LOCATION_CHANGED)
+	{
+		const std::string url = self->getLocation();
+
+		if ( url.length() )
+			mStatusBarText->setText( url );
+
+		set_current_url( url );
+	}
+	else if(event == MEDIA_EVENT_NAVIGATE_BEGIN)
+	{
+		// flags are sent with this event
+		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
+		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+
+		// toggle visibility of these buttons based on browser state
+		getChildView("reload")->setVisible( false );
+		getChildView("stop")->setVisible( true );
+
+		// turn "on" progress bar now we're about to start loading
+		mStatusBarProgress->setVisible( true );
+	}
+	else if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
+	{
+		// flags are sent with this event
+		getChildView("back")->setEnabled( self->getHistoryBackAvailable() );
+		getChildView("forward")->setEnabled( self->getHistoryForwardAvailable() );
+
+		// toggle visibility of these buttons based on browser state
+		getChildView("reload")->setVisible( true );
+		getChildView("stop")->setVisible( false );
+
+		// turn "off" progress bar now we're loaded
+		mStatusBarProgress->setVisible( false );
+
+		// we populate the status bar with URLs as they change so clear it now we're done
+		const std::string end_str = "";
+		mStatusBarText->setText( end_str );
+
+		// decide if secure browsing icon should be displayed
+		std::string prefix =  std::string("https://");
+		std::string test_prefix = mCurrentURL.substr(0, prefix.length());
+		LLStringUtil::toLower(test_prefix);
+		if(test_prefix == prefix)
+		{
+			mSecureLockIcon->setVisible(true);
+		}
+		else
+		{
+			mSecureLockIcon->setVisible(false);
+		}
+	}
+	else if(event == MEDIA_EVENT_CLOSE_REQUEST)
+	{
+		// The browser instance wants its window closed.
+		closeFloater();
+	}
+	else if(event == MEDIA_EVENT_GEOMETRY_CHANGE)
+	{
+		geometryChanged(self->getGeometryX(), self->getGeometryY(), self->getGeometryWidth(), self->getGeometryHeight());
+	}
+	else if(event == MEDIA_EVENT_STATUS_TEXT_CHANGED )
+	{
+		const std::string text = self->getStatusText();
+		if ( text.length() )
+			mStatusBarText->setText( text );
+	}
+	else if(event == MEDIA_EVENT_PROGRESS_UPDATED )
+	{
+		int percent = (int)self->getProgressPercent();
+		mStatusBarProgress->setValue( percent );
+	}
+	else if(event == MEDIA_EVENT_NAME_CHANGED )
+	{
+		std::string page_title = self->getMediaName();
+		// simulate browser behavior - title is empty, use the current URL
+		if ( page_title.length() > 0 )
+			setTitle( page_title );
+		else
+			setTitle( mCurrentURL );
+	}
+	else if(event == MEDIA_EVENT_LINK_HOVERED )
+	{
+		const std::string link = self->getHoverLink();
+		mStatusBarText->setText( link );
+	}
+}
+
+void LLFloaterWebContent::set_current_url(const std::string& url)
+{
+	mCurrentURL = url;
+
+	// serialize url history into the system URL History manager
+	LLURLHistory::removeURL("browser", mCurrentURL);
+	LLURLHistory::addURL("browser", mCurrentURL);
+
+	mAddressCombo->remove( mCurrentURL );
+	mAddressCombo->add( mCurrentURL );
+	mAddressCombo->selectByValue( mCurrentURL );
+}
+
+void LLFloaterWebContent::onClickForward()
+{
+	mWebBrowser->navigateForward();
+}
+
+void LLFloaterWebContent::onClickBack()
+{
+	mWebBrowser->navigateBack();
+}
+
+void LLFloaterWebContent::onClickReload()
+{
+
+	if( mWebBrowser->getMediaPlugin() )
+	{
+		bool ignore_cache = true;
+		mWebBrowser->getMediaPlugin()->browse_reload( ignore_cache );
+	}
+	else
+	{
+		mWebBrowser->navigateTo(mCurrentURL);
+	}
+}
+
+void LLFloaterWebContent::onClickStop()
+{
+	if( mWebBrowser->getMediaPlugin() )
+		mWebBrowser->getMediaPlugin()->browse_stop();
+
+	// still should happen when we catch the navigate complete event
+	// but sometimes (don't know why) that event isn't sent from Qt
+	// and we getto a point where the stop button stays active.
+	getChildView("reload")->setVisible( true );
+	getChildView("stop")->setVisible( false );
+}
+
+void LLFloaterWebContent::onEnterAddress()
+{
+	// make sure there is at least something there.
+	// (perhaps this test should be for minimum length of a URL)
+	std::string url = mAddressCombo->getValue().asString();
+	if ( url.length() > 0 )
+	{
+		mWebBrowser->navigateTo( url, "text/html");
+	};
+}
+
+void LLFloaterWebContent::onPopExternal()
+{
+	// make sure there is at least something there.
+	// (perhaps this test should be for minimum length of a URL)
+	std::string url = mAddressCombo->getValue().asString();
+	if ( url.length() > 0 )
+	{
+		LLWeb::loadURLExternal( url );
+	};
+}
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 001d822ada48b918eb4b5e0b8243377984224c44..ecc7e970d865c5ac94f181abe08224e0962cdf7b 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -1,82 +1,82 @@
-/**
- * @file llfloaterwebcontent.h
- * @brief floater for displaying web content - e.g. profiles and search (eventually)
- *
- * $LicenseInfo:firstyear=2006&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLFLOATERWEBCONTENT_H
-#define LL_LLFLOATERWEBCONTENT_H
-
-#include "llfloater.h"
-#include "llmediactrl.h"
-
-class LLMediaCtrl;
-class LLComboBox;
-class LLTextBox;
-class LLProgressBar;
-class LLIconCtrl;
-
-class LLFloaterWebContent :
-	public LLFloater,
-	public LLViewerMediaObserver
-{
-public:
-    LOG_CLASS(LLFloaterWebContent);
-	LLFloaterWebContent(const LLSD& key);
-
+/**
+ * @file llfloaterwebcontent.h
+ * @brief floater for displaying web content - e.g. profiles and search (eventually)
+ *
+ * $LicenseInfo:firstyear=2006&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERWEBCONTENT_H
+#define LL_LLFLOATERWEBCONTENT_H
+
+#include "llfloater.h"
+#include "llmediactrl.h"
+
+class LLMediaCtrl;
+class LLComboBox;
+class LLTextBox;
+class LLProgressBar;
+class LLIconCtrl;
+
+class LLFloaterWebContent :
+	public LLFloater,
+	public LLViewerMediaObserver
+{
+public:
+    LOG_CLASS(LLFloaterWebContent);
+	LLFloaterWebContent(const LLSD& key);
+
 	void initializeURLHistory();
-
-	static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
-
-	static void closeRequest(const std::string &uuid);
-	static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
-	void geometryChanged(S32 x, S32 y, S32 width, S32 height);
-
-	/* virtual */ BOOL postBuild();
-	/* virtual */ void onClose(bool app_quitting);
-	/* virtual */ void draw();
-
-	// inherited from LLViewerMediaObserver
-	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
-
-	void onClickBack();
-	void onClickForward();
-	void onClickReload();
-	void onClickStop();
-	void onEnterAddress();
-	void onPopExternal();
-
-private:
-	void open_media(const std::string& media_url, const std::string& target);
-	void set_current_url(const std::string& url);
-
-	LLMediaCtrl* mWebBrowser;
-	LLComboBox* mAddressCombo;
-	LLIconCtrl *mSecureLockIcon;
-	LLTextBox* mStatusBarText;
-	LLProgressBar* mStatusBarProgress;
-	std::string mCurrentURL;
-	std::string mUUID;
-};
-
-#endif  // LL_LLFLOATERWEBCONTENT_H
+
+	static void create(const std::string &url, const std::string& target, const std::string& uuid = LLStringUtil::null);
+
+	static void closeRequest(const std::string &uuid);
+	static void geometryChanged(const std::string &uuid, S32 x, S32 y, S32 width, S32 height);
+	void geometryChanged(S32 x, S32 y, S32 width, S32 height);
+
+	/* virtual */ BOOL postBuild();
+	/* virtual */ void onClose(bool app_quitting);
+	/* virtual */ void draw();
+
+	// inherited from LLViewerMediaObserver
+	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
+
+	void onClickBack();
+	void onClickForward();
+	void onClickReload();
+	void onClickStop();
+	void onEnterAddress();
+	void onPopExternal();
+
+private:
+	void open_media(const std::string& media_url, const std::string& target);
+	void set_current_url(const std::string& url);
+
+	LLMediaCtrl* mWebBrowser;
+	LLComboBox* mAddressCombo;
+	LLIconCtrl *mSecureLockIcon;
+	LLTextBox* mStatusBarText;
+	LLProgressBar* mStatusBarProgress;
+	std::string mCurrentURL;
+	std::string mUUID;
+};
+
+#endif  // LL_LLFLOATERWEBCONTENT_H
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
old mode 100644
new mode 100755
index ba0eb8a711c065f8cdca800c488d76f7e4af5335..017cd2fc490eff31d687fc7b4c5fcafbc9eec742
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -72,7 +72,6 @@
 #include "llweb.h"
 #include "llslider.h"
 #include "message.h"
-
 #include "llwindow.h"			// copyTextToClipboard()
 
 //---------------------------------------------------------------------------
@@ -106,8 +105,8 @@ class LLWorldMapHandler : public LLCommandHandler
 {
 public:
 	// requires trusted browser to trigger
-	LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_THROTTLE) { }
-
+	LLWorldMapHandler() : LLCommandHandler("worldmap", UNTRUSTED_THROTTLE ) { }
+	
 	bool handle(const LLSD& params, const LLSD& query_map,
 				LLMediaCtrl* web)
 	{
@@ -117,21 +116,52 @@ class LLWorldMapHandler : public LLCommandHandler
 			LLFloaterReg::showInstance("world_map", "center");
 			return true;
 		}
-
+		
 		// support the secondlife:///app/worldmap/{LOCATION}/{COORDS} SLapp
 		const std::string region_name = LLURI::unescape(params[0].asString());
 		S32 x = (params.size() > 1) ? params[1].asInteger() : 128;
 		S32 y = (params.size() > 2) ? params[2].asInteger() : 128;
 		S32 z = (params.size() > 3) ? params[3].asInteger() : 0;
-
+		
 		LLFloaterWorldMap::getInstance()->trackURL(region_name, x, y, z);
 		LLFloaterReg::showInstance("world_map", "center");
-
+		
 		return true;
 	}
 };
 LLWorldMapHandler gWorldMapHandler;
 
+// SocialMap handler secondlife:///app/maptrackavatar/id
+class LLMapTrackAvatarHandler : public LLCommandHandler
+{
+public:
+	// requires trusted browser to trigger
+	LLMapTrackAvatarHandler() : LLCommandHandler("maptrackavatar", UNTRUSTED_THROTTLE) 
+	{ 
+	}
+	
+	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+	{
+		//Make sure we have some parameters
+		if (params.size() == 0)
+		{
+			return false;
+		}
+		
+		//Get the ID
+		LLUUID id;
+		if (!id.set( params[0], FALSE ))
+		{
+			return false;
+		}
+		
+		LLFloaterWorldMap::getInstance()->avatarTrackFromSlapp( id  ); 
+		LLFloaterReg::showInstance( "world_map", "center" );
+		
+		return true;
+	}
+};	
+LLMapTrackAvatarHandler gMapTrackAvatar;
 
 LLFloaterWorldMap* gFloaterWorldMap = NULL;
 
@@ -142,7 +172,7 @@ class LLMapInventoryObserver : public LLInventoryObserver
 	virtual ~LLMapInventoryObserver() {}
 	virtual void changed(U32 mask);
 };
-  
+
 void LLMapInventoryObserver::changed(U32 mask)
 {
 	// if there's a change we're interested in.
@@ -184,16 +214,16 @@ const LLUUID LLFloaterWorldMap::sHomeID( "10000000-0000-0000-0000-000000000001"
 
 LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
 :	LLFloater(key),
-	mInventory(NULL),
-	mInventoryObserver(NULL),
-	mFriendObserver(NULL),
-	mCompletingRegionName(),
-	mCompletingRegionPos(),
-	mWaitingForTracker(FALSE),
-	mIsClosing(FALSE),
-	mSetToUserPosition(TRUE),
-	mTrackedLocation(0,0,0),
-	mTrackedStatus(LLTracker::TRACKING_NOTHING)
+mInventory(NULL),
+mInventoryObserver(NULL),
+mFriendObserver(NULL),
+mCompletingRegionName(),
+mCompletingRegionPos(),
+mWaitingForTracker(FALSE),
+mIsClosing(FALSE),
+mSetToUserPosition(TRUE),
+mTrackedLocation(0,0,0),
+mTrackedStatus(LLTracker::TRACKING_NOTHING)
 {
 	gFloaterWorldMap = this;
 	
@@ -210,7 +240,7 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
 	mCommitCallbackRegistrar.add("WMap.ShowAgent",		boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this));		
 	mCommitCallbackRegistrar.add("WMap.Clear",			boost::bind(&LLFloaterWorldMap::onClearBtn, this));		
 	mCommitCallbackRegistrar.add("WMap.CopySLURL",		boost::bind(&LLFloaterWorldMap::onCopySLURL, this));
-
+	
 	gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this));
 }
 
@@ -223,32 +253,32 @@ void* LLFloaterWorldMap::createWorldMapView(void* data)
 BOOL LLFloaterWorldMap::postBuild()
 {
 	mPanel = getChild<LLPanel>("objects_mapview");
-
+	
 	LLComboBox *avatar_combo = getChild<LLComboBox>("friend combo");
 	avatar_combo->selectFirstItem();
 	avatar_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onAvatarComboPrearrange, this) );
 	avatar_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
-
+	
 	LLSearchEditor *location_editor = getChild<LLSearchEditor>("location");
 	location_editor->setFocusChangedCallback(boost::bind(&LLFloaterWorldMap::onLocationFocusChanged, this, _1));
 	location_editor->setKeystrokeCallback( boost::bind(&LLFloaterWorldMap::onSearchTextEntry, this));
 	
 	getChild<LLScrollListCtrl>("search_results")->setDoubleClickCallback( boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));
-
+	
 	LLComboBox *landmark_combo = getChild<LLComboBox>( "landmark combo");
 	landmark_combo->selectFirstItem();
 	landmark_combo->setPrearrangeCallback( boost::bind(&LLFloaterWorldMap::onLandmarkComboPrearrange, this) );
 	landmark_combo->setTextEntryCallback( boost::bind(&LLFloaterWorldMap::onComboTextEntry, this) );
-
+	
 	mCurZoomVal = log(LLWorldMapView::sMapScale)/log(2.f);
 	getChild<LLUICtrl>("zoom slider")->setValue(LLWorldMapView::sMapScale);
-
+	
 	setDefaultBtn(NULL);
-
+	
 	mZoomTimer.stop();
-
+	
 	onChangeMaturity();
-
+	
 	return TRUE;
 }
 
@@ -257,11 +287,11 @@ LLFloaterWorldMap::~LLFloaterWorldMap()
 {
 	// All cleaned up by LLView destructor
 	mPanel = NULL;
-
+	
 	// Inventory deletes all observers on shutdown
 	mInventory = NULL;
 	mInventoryObserver = NULL;
-
+	
 	// avatar tracker will delete this for us.
 	mFriendObserver = NULL;
 	
@@ -285,13 +315,13 @@ void LLFloaterWorldMap::onClose(bool app_quitting)
 void LLFloaterWorldMap::onOpen(const LLSD& key)
 {
 	bool center_on_target = (key.asString() == "center");
-
+	
 	mIsClosing = FALSE;
-
+	
 	LLWorldMapView* map_panel;
 	map_panel = (LLWorldMapView*)gFloaterWorldMap->mPanel;
 	map_panel->clearLastClick();
-
+	
 	{
 		// reset pan on show, so it centers on you again
 		if (!center_on_target)
@@ -299,27 +329,27 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
 			LLWorldMapView::setPan(0, 0, TRUE);
 		}
 		map_panel->updateVisibleBlocks();
-
+		
 		// Reload items as they may have changed
 		LLWorldMap::getInstance()->reloadItems();
-
+		
 		// We may already have a bounding box for the regions of the world,
 		// so use that to adjust the view.
 		adjustZoomSliderBounds();
-
+		
 		// Could be first show
 		//LLFirstUse::useMap();
-
+		
 		// Start speculative download of landmarks
 		const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
 		LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id);
-
+		
 		getChild<LLUICtrl>("location")->setFocus( TRUE);
 		gFocusMgr.triggerFocusFlash();
-
+		
 		buildAvatarIDList();
 		buildLandmarkIDLists();
-
+		
 		// If nothing is being tracked, set flag so the user position will be found
 		mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
 	}
@@ -356,7 +386,7 @@ BOOL LLFloaterWorldMap::handleScrollWheel(S32 x, S32 y, S32 clicks)
 			return TRUE;
 		}
 	}
-
+	
 	return LLFloater::handleScrollWheel(x, y, clicks);
 }
 
@@ -381,7 +411,7 @@ void LLFloaterWorldMap::draw()
 	bool agent_on_prelude = (regionp && regionp->isPrelude());
 	bool enable_go_home = gAgent.isGodlike() || !agent_on_prelude;
 	getChildView("Go Home")->setEnabled(enable_go_home);
-
+	
 	updateLocation();
 	
 	LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus(); 
@@ -393,7 +423,7 @@ void LLFloaterWorldMap::draw()
 	{
 		getChild<LLUICtrl>("avatar_icon")->setColor( map_track_disabled_color);
 	}
-
+	
 	if (LLTracker::TRACKING_LANDMARK == tracking_status)
 	{
 		getChild<LLUICtrl>("landmark_icon")->setColor( map_track_color);
@@ -402,7 +432,7 @@ void LLFloaterWorldMap::draw()
 	{
 		getChild<LLUICtrl>("landmark_icon")->setColor( map_track_disabled_color);
 	}
-
+	
 	if (LLTracker::TRACKING_LOCATION == tracking_status)
 	{
 		getChild<LLUICtrl>("location_icon")->setColor( map_track_color);
@@ -422,21 +452,21 @@ void LLFloaterWorldMap::draw()
 			getChild<LLUICtrl>("location_icon")->setColor( map_track_disabled_color);
 		}
 	}
-
+	
 	// check for completion of tracking data
 	if (mWaitingForTracker)
 	{
 		centerOnTarget(TRUE);
 	}
-
+	
 	getChildView("Teleport")->setEnabled((BOOL)tracking_status);
-//	getChildView("Clear")->setEnabled((BOOL)tracking_status);
+	//	getChildView("Clear")->setEnabled((BOOL)tracking_status);
 	getChildView("Show Destination")->setEnabled((BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
 	getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) );
-
+	
 	setMouseOpaque(TRUE);
 	getDragHandle()->setMouseOpaque(TRUE);
-
+	
 	//RN: snaps to zoom value because interpolation caused jitter in the text rendering
 	if (!mZoomTimer.getStarted() && mCurZoomVal != (F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal())
 	{
@@ -451,7 +481,7 @@ void LLFloaterWorldMap::draw()
 	mCurZoomVal = lerp(mCurZoomVal, (F32)getChild<LLUICtrl>("zoom slider")->getValue().asReal(), interp);
 	F32 map_scale = 256.f*pow(2.f, mCurZoomVal);
 	LLWorldMapView::setScale( map_scale );
-
+	
 	// Enable/disable checkboxes depending on the zoom level
 	// If above threshold level (i.e. low res) -> Disable all checkboxes
 	// If under threshold level (i.e. high res) -> Enable all checkboxes
@@ -477,7 +507,7 @@ void LLFloaterWorldMap::trackAvatar( const LLUUID& avatar_id, const std::string&
 {
 	LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo");
 	if (!iface) return;
-
+	
 	buildAvatarIDList();
 	if(iface->setCurrentByID(avatar_id) || gAgent.isGodlike())
 	{
@@ -507,7 +537,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
 {
 	LLCtrlSelectionInterface *iface = childGetSelectionInterface("landmark combo");
 	if (!iface) return;
-
+	
 	buildLandmarkIDLists();
 	BOOL found = FALSE;
 	S32 idx;
@@ -519,7 +549,7 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
 			break;
 		}
 	}
-
+	
 	if (found && iface->setCurrentByID( landmark_item_id ) ) 
 	{
 		LLUUID asset_id = mLandmarkAssetIDList.get( idx );
@@ -528,17 +558,17 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id )
 		if (combo) name = combo->getSimple();
 		mTrackedStatus = LLTracker::TRACKING_LANDMARK;
 		LLTracker::trackLandmark(mLandmarkAssetIDList.get( idx ),	// assetID
-								mLandmarkItemIDList.get( idx ), // itemID
-								name);			// name
-
+								 mLandmarkItemIDList.get( idx ), // itemID
+								 name);			// name
+		
 		if( asset_id != sHomeID )
 		{
 			// start the download process
 			gLandmarkList.getAsset( asset_id);
 		}
-
+		
 		// We have to download both region info and landmark data, so set busy. JC
-//		getWindow()->incBusyCount();
+		//		getWindow()->incBusyCount();
 	}
 	else
 	{
@@ -574,10 +604,10 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 		S32 world_y = S32(pos_global.mdV[1] / 256);
 		LLWorldMapMessage::getInstance()->sendMapBlockRequest(world_x, world_y, world_x, world_y, true);
 		setDefaultBtn("");
-
+		
 		// clicked on a non-region - turn off coord display
 		enableTeleportCoordsDisplay( false );
-
+		
 		return;
 	}
 	if (sim_info->isDown())
@@ -588,33 +618,33 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
 		LLWorldMap::getInstance()->setTrackingInvalid();
 		LLTracker::stopTracking(NULL);
 		setDefaultBtn("");
-
+		
 		// clicked on a down region - turn off coord display
 		enableTeleportCoordsDisplay( false );
-
+		
 		return;
 	}
-
+	
 	std::string sim_name = sim_info->getName();
 	F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
 	F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
 	std::string full_name = llformat("%s (%d, %d, %d)", 
-								  sim_name.c_str(), 
-								  llround(region_x), 
-								  llround(region_y),
-								  llround((F32)pos_global.mdV[VZ]));
-
+									 sim_name.c_str(), 
+									 llround(region_x), 
+									 llround(region_y),
+									 llround((F32)pos_global.mdV[VZ]));
+	
 	std::string tooltip("");
 	mTrackedStatus = LLTracker::TRACKING_LOCATION;
 	LLTracker::trackLocation(pos_global, full_name, tooltip);
 	LLWorldMap::getInstance()->cancelTracking();		// The floater is taking over the tracking
-
+	
 	LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
 	updateTeleportCoordsDisplay( coord_pos );
-
+	
 	// we have a valid region - turn on coord display
 	enableTeleportCoordsDisplay( true );
-
+	
 	setDefaultBtn("Teleport");
 }
 
@@ -631,7 +661,7 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos )
 {
 	// if we're going to update their value, we should also enable them
 	enableTeleportCoordsDisplay( true );
-
+	
 	// convert global specified position to a local one
 	F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS );
 	F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS );
@@ -646,16 +676,16 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos )
 void LLFloaterWorldMap::updateLocation()
 {
 	bool gotSimName;
-
+	
 	LLTracker::ETrackingStatus status = LLTracker::getTrackingStatus();
-
+	
 	// These values may get updated by a message, so need to check them every frame
 	// The fields may be changed by the user, so only update them if the data changes
 	LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
 	if (pos_global.isExactlyZero())
 	{
 		LLVector3d agentPos = gAgent.getPositionGlobal();
-
+		
 		// Set to avatar's current postion if nothing is selected
 		if ( status == LLTracker::TRACKING_NOTHING && mSetToUserPosition )
 		{
@@ -665,19 +695,19 @@ void LLFloaterWorldMap::updateLocation()
 			if ( gotSimName )
 			{
 				mSetToUserPosition = FALSE;
-
+				
 				// Fill out the location field
 				getChild<LLUICtrl>("location")->setValue(agent_sim_name);
-
+				
 				// update the coordinate display with location of avatar in region
 				updateTeleportCoordsDisplay( agentPos );
-
+				
 				// Figure out where user is
 				// Set the current SLURL
 				mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
 			}
 		}
-
+		
 		return; // invalid location
 	}
 	std::string sim_name;
@@ -699,17 +729,17 @@ void LLFloaterWorldMap::updateLocation()
 				pos_global[2] = 200;
 			}
 		}
-
+		
 		getChild<LLUICtrl>("location")->setValue(sim_name);
-
+		
 		// refresh coordinate display to reflect where user clicked.
 		LLVector3d coord_pos = LLTracker::getTrackedPositionGlobal();
 		updateTeleportCoordsDisplay( coord_pos );
-
+		
 		// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
 		if ( gotSimName )
 		{
-		  mSLURL = LLSLURL(sim_name, pos_global);
+			mSLURL = LLSLURL(sim_name, pos_global);
 		}
 		else
 		{	// Empty SLURL will disable the "Copy SLURL to clipboard" button
@@ -736,12 +766,12 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3
 	{
 		// fill in UI based on URL
 		gFloaterWorldMap->getChild<LLUICtrl>("location")->setValue(region_name);
-
+		
 		// Save local coords to highlight position after region global
 		// position is returned.
 		gFloaterWorldMap->mCompletingRegionPos.set(
-			(F32)x_coord, (F32)y_coord, (F32)z_coord);
-
+												   (F32)x_coord, (F32)y_coord, (F32)z_coord);
+		
 		// pass sim name to combo box
 		gFloaterWorldMap->mCompletingRegionName = region_name;
 		LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name);
@@ -813,7 +843,7 @@ void LLFloaterWorldMap::buildAvatarIDList()
 {
 	LLCtrlListInterface *list = childGetListInterface("friend combo");
 	if (!list) return;
-
+	
     // Delete all but the "None" entry
 	S32 list_size = list->getItemCount();
 	if (list_size > 1)
@@ -821,7 +851,7 @@ void LLFloaterWorldMap::buildAvatarIDList()
 		list->selectItemRange(1, -1);
 		list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
 	}
-
+	
 	// Get all of the calling cards for avatar that are currently online
 	LLCollectMappableBuddies collector;
 	LLAvatarTracker::instance().applyFunctor(collector);
@@ -833,7 +863,7 @@ void LLFloaterWorldMap::buildAvatarIDList()
 	{
 		list->addSimpleElement((*it).first, ADD_BOTTOM, (*it).second);
 	}
-
+	
 	list->setCurrentByID( LLAvatarTracker::instance().getAvatarID() );
 	list->selectFirstItem();
 }
@@ -843,7 +873,7 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
 {
 	LLCtrlListInterface *list = childGetListInterface("landmark combo");
 	if (!list) return;
-
+	
     // Delete all but the "None" entry
 	S32 list_size = list->getItemCount();
 	if (list_size > 1)
@@ -851,17 +881,17 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
 		list->selectItemRange(1, -1);
 		list->operateOnSelection(LLCtrlListInterface::OP_DELETE);
 	}
-
+	
 	mLandmarkItemIDList.reset();
 	mLandmarkAssetIDList.reset();
-
+	
 	// Get all of the current landmarks
 	mLandmarkAssetIDList.put( LLUUID::null );
 	mLandmarkItemIDList.put( LLUUID::null );
-
+	
 	mLandmarkAssetIDList.put( sHomeID );
 	mLandmarkItemIDList.put( sHomeID );
-
+	
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
 	LLIsType is_landmark(LLAssetType::AT_LANDMARK);
@@ -870,20 +900,20 @@ void LLFloaterWorldMap::buildLandmarkIDLists()
 									items,
 									LLInventoryModel::EXCLUDE_TRASH,
 									is_landmark);
-
+	
 	std::sort(items.begin(), items.end(), LLViewerInventoryItem::comparePointers());
 	
 	S32 count = items.count();
 	for(S32 i = 0; i < count; ++i)
 	{
 		LLInventoryItem* item = items.get(i);
-
+		
 		list->addSimpleElement(item->getName(), ADD_BOTTOM, item->getUUID());
-
+		
 		mLandmarkAssetIDList.put( item->getAssetUUID() );
 		mLandmarkItemIDList.put( item->getUUID() );
 	}
-
+	
 	list->selectFirstItem();
 }
 
@@ -949,31 +979,31 @@ void LLFloaterWorldMap::adjustZoomSliderBounds()
 	// Currently (01/26/09), this value allows the whole grid to be visible in a 1024x1024 window.
 	S32 world_width_regions	 = MAX_VISIBLE_REGIONS;
 	S32 world_height_regions = MAX_VISIBLE_REGIONS;
-
+	
 	// Find how much space we have to display the world
 	LLWorldMapView* map_panel;
 	map_panel = (LLWorldMapView*)mPanel;
 	LLRect view_rect = map_panel->getRect();
-
+	
 	// View size in pixels
 	S32 view_width = view_rect.getWidth();
 	S32 view_height = view_rect.getHeight();
-
+	
 	// Pixels per region to display entire width/height
 	F32 width_pixels_per_region = (F32) view_width / (F32) world_width_regions;
 	F32 height_pixels_per_region = (F32) view_height / (F32) world_height_regions;
-
+	
 	F32 pixels_per_region = llmin(width_pixels_per_region,
 								  height_pixels_per_region);
-
+	
 	// Round pixels per region to an even number of slider increments
 	S32 slider_units = llfloor(pixels_per_region / 0.2f);
 	pixels_per_region = slider_units * 0.2f;
-
+	
 	// Make sure the zoom slider can be moved at least a little bit.
 	// Likewise, less than the increment pixels per region is just silly.
 	pixels_per_region = llclamp(pixels_per_region, 1.f, ZOOM_MAX);
-
+	
 	F32 min_power = log(pixels_per_region/256.f)/log(2.f);
 	
 	getChild<LLSlider>("zoom slider")->setMinValue(min_power);
@@ -997,19 +1027,19 @@ void LLFloaterWorldMap::onLandmarkComboPrearrange( )
 	{
 		return;
 	}
-
+	
 	LLCtrlListInterface *list = childGetListInterface("landmark combo");
 	if (!list) return;
-
+	
 	LLUUID current_choice = list->getCurrentID();
-
+	
 	buildLandmarkIDLists();
-
+	
 	if( current_choice.isNull() || !list->setCurrentByID( current_choice ) )
 	{
 		LLTracker::stopTracking(NULL);
 	}
-
+	
 }
 
 void LLFloaterWorldMap::onComboTextEntry()
@@ -1033,18 +1063,18 @@ void LLFloaterWorldMap::onLandmarkComboCommit()
 	{
 		return;
 	}
-
+	
 	LLCtrlListInterface *list = childGetListInterface("landmark combo");
 	if (!list) return;
-
+	
 	LLUUID asset_id;
 	LLUUID item_id = list->getCurrentID();
-
+	
 	LLTracker::stopTracking(NULL);
-
+	
 	//RN: stopTracking() clears current combobox selection, need to reassert it here
 	list->setCurrentByID(item_id);
-
+	
 	if( item_id.isNull() )
 	{
 	}
@@ -1068,7 +1098,7 @@ void LLFloaterWorldMap::onLandmarkComboCommit()
 	
 	trackLandmark( item_id);
 	onShowTargetBtn();
-
+	
 	// Reset to user postion if nothing is tracked
 	mSetToUserPosition = ( LLTracker::getTrackingStatus() == LLTracker::TRACKING_NOTHING );
 }
@@ -1080,19 +1110,19 @@ void LLFloaterWorldMap::onAvatarComboPrearrange( )
 	{
 		return;
 	}
-
+	
 	LLCtrlListInterface *list = childGetListInterface("friend combo");
 	if (!list) return;
-
+	
 	LLUUID current_choice;
-
+	
 	if( LLAvatarTracker::instance().haveTrackingInfo() )
 	{
 		current_choice = LLAvatarTracker::instance().getAvatarID();
 	}
-
+	
 	buildAvatarIDList();
-
+	
 	if( !list->setCurrentByID( current_choice ) || current_choice.isNull() )
 	{
 		LLTracker::stopTracking(NULL);
@@ -1105,10 +1135,10 @@ void LLFloaterWorldMap::onAvatarComboCommit()
 	{
 		return;
 	}
-
+	
 	LLCtrlListInterface *list = childGetListInterface("friend combo");
 	if (!list) return;
-
+	
 	const LLUUID& new_avatar_id = list->getCurrentID();
 	if (new_avatar_id.notNull())
 	{
@@ -1124,6 +1154,12 @@ void LLFloaterWorldMap::onAvatarComboCommit()
 	}
 }
 
+void LLFloaterWorldMap::avatarTrackFromSlapp( const LLUUID& id ) 
+{
+	trackAvatar( id, "av" );		
+	onShowTargetBtn();
+}
+
 void LLFloaterWorldMap::onLocationFocusChanged( LLFocusableElement* focus )
 {
 	updateSearchEnabled();
@@ -1148,13 +1184,13 @@ void LLFloaterWorldMap::onLocationCommit()
 	{
 		return;
 	}
-
+	
 	clearLocationSelection(FALSE);
 	mCompletingRegionName = "";
 	mLastRegionName = "";
-
+	
 	std::string str = getChild<LLUICtrl>("location")->getValue().asString();
-
+	
 	// Trim any leading and trailing spaces in the search target
 	std::string saved_str = str;
 	LLStringUtil::trim( str );
@@ -1162,7 +1198,7 @@ void LLFloaterWorldMap::onLocationCommit()
 	{	// Set the value in the UI if any spaces were removed
 		getChild<LLUICtrl>("location")->setValue(str);
 	}
-
+	
 	LLStringUtil::toLower(str);
 	mCompletingRegionName = str;
 	LLWorldMap::getInstance()->setTrackingCommit();
@@ -1183,13 +1219,13 @@ void LLFloaterWorldMap::onCoordinatesCommit()
 	{
 		return;
 	}
-
+	
 	S32 x_coord = (S32)childGetValue("teleport_coordinate_x").asReal();
 	S32 y_coord = (S32)childGetValue("teleport_coordinate_y").asReal();
 	S32 z_coord = (S32)childGetValue("teleport_coordinate_z").asReal();
-
+	
 	const std::string region_name = childGetValue("location").asString();
-
+	
 	trackURL( region_name, x_coord, y_coord, z_coord );
 }
 
@@ -1225,7 +1261,7 @@ void LLFloaterWorldMap::onCopySLURL()
 	
 	LLSD args;
 	args["SLURL"] = mSLURL.getSLURLString();
-
+	
 	LLNotificationsUtil::add("CopySLURL", args);
 }
 
@@ -1246,26 +1282,26 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
 		else
 		{
 			// We've got the position finally, so we're no longer busy. JC
-//			getWindow()->decBusyCount();
+			//			getWindow()->decBusyCount();
 			pos_global = LLTracker::getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();
 		}
 	}
 	else if(LLWorldMap::getInstance()->isTracking())
 	{
 		pos_global = LLWorldMap::getInstance()->getTrackedPositionGlobal() - gAgentCamera.getCameraPositionGlobal();;
-
-
-
+		
+		
+		
 	}
 	else
 	{
 		// default behavior = center on agent
 		pos_global.clearVec();
 	}
-
+	
 	LLWorldMapView::setPan( -llfloor((F32)(pos_global.mdV[VX] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)), 
-							-llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)),
-							!animate);
+						   -llfloor((F32)(pos_global.mdV[VY] * (F64)LLWorldMapView::sMapScale / REGION_WIDTH_METERS)),
+						   !animate);
 	mWaitingForTracker = FALSE;
 }
 
@@ -1273,7 +1309,7 @@ void LLFloaterWorldMap::centerOnTarget(BOOL animate)
 void LLFloaterWorldMap::fly()
 {
 	LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
-
+	
 	// Start the autopilot and close the floater, 
 	// so we can see where we're flying
 	if (!pos_global.isExactlyZero())
@@ -1294,7 +1330,7 @@ void LLFloaterWorldMap::teleport()
 	BOOL teleport_home = FALSE;
 	LLVector3d pos_global;
 	LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
-
+	
 	LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
 	if (LLTracker::TRACKING_AVATAR == tracking_status
 		&& av_tracker.haveTrackingInfo() )
@@ -1317,10 +1353,10 @@ void LLFloaterWorldMap::teleport()
 			   && landmark->getRegionID(region_id))
 			{
 				LLLandmark::requestRegionHandle(
-					gMessageSystem,
-					gAgent.getRegionHost(),
-					region_id,
-					NULL);
+												gMessageSystem,
+												gAgent.getRegionHost(),
+												region_id,
+												NULL);
 			}
 		}
 	}
@@ -1332,7 +1368,7 @@ void LLFloaterWorldMap::teleport()
 	{
 		make_ui_sound("UISndInvalidOp");
 	}
-
+	
 	// Do the teleport, which will also close the floater
 	if (teleport_home)
 	{
@@ -1367,7 +1403,7 @@ void LLFloaterWorldMap::teleportToLandmark()
 {
 	BOOL has_destination = FALSE;
 	LLUUID destination_id; // Null means "home"
-
+	
 	if( LLTracker::getTrackedLandmarkAssetID() == sHomeID )
 	{
 		has_destination = TRUE;
@@ -1388,14 +1424,14 @@ void LLFloaterWorldMap::teleportToLandmark()
 			if(landmark->getRegionID(region_id))
 			{
 				LLLandmark::requestRegionHandle(
-					gMessageSystem,
-					gAgent.getRegionHost(),
-					region_id,
-					NULL);
+												gMessageSystem,
+												gAgent.getRegionHost(),
+												region_id,
+												NULL);
 			}
 		}
 	}
-
+	
 	if( has_destination )
 	{
 		gAgent.teleportViaLandmark( destination_id );
@@ -1428,12 +1464,12 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
 	{
 		return;
 	}
-
+	
 	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("search_results");
 	list->operateOnAll(LLCtrlListInterface::OP_DELETE);
-
+	
 	S32 name_length = mCompletingRegionName.length();
-
+	
 	LLSD match;
 	
 	S32 num_results = 0;
@@ -1443,7 +1479,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
 		LLSimInfo* info = it->second;
 		std::string sim_name_lower = info->getName();
 		LLStringUtil::toLower(sim_name_lower);
-
+		
 		if (sim_name_lower.substr(0, name_length) == mCompletingRegionName)
 		{
 			if (sim_name_lower == mCompletingRegionName)
@@ -1459,12 +1495,12 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
 			num_results++;
 		}
 	}
-
+	
 	if (found_null_sim)
 	{
 		mCompletingRegionName = "";
 	}
-
+	
 	// if match found, highlight it and go
 	if (!match.isUndefined())
 	{
@@ -1472,7 +1508,7 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
 		getChild<LLUICtrl>("search_results")->setFocus(TRUE);
 		onCommitSearchResult();
 	}
-
+	
 	// if we found nothing, say "none"
 	if (num_results == 0)
 	{
@@ -1486,7 +1522,7 @@ void LLFloaterWorldMap::onCommitSearchResult()
 {
 	LLCtrlListInterface *list = childGetListInterface("search_results");
 	if (!list) return;
-
+	
 	LLSD selected_value = list->getSelectedValue();
 	std::string sim_name = selected_value.asString();
 	if (sim_name.empty())
@@ -1494,19 +1530,19 @@ void LLFloaterWorldMap::onCommitSearchResult()
 		return;
 	}
 	LLStringUtil::toLower(sim_name);
-
+	
 	std::map<U64, LLSimInfo*>::const_iterator it;
 	for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it)
 	{
 		LLSimInfo* info = it->second;
-
+		
 		if (info->isName(sim_name))
 		{
 			LLVector3d pos_global = info->getGlobalOrigin();
-
+			
 			const F64 SIM_COORD_DEFAULT = 128.0;
 			LLVector3 pos_local(SIM_COORD_DEFAULT, SIM_COORD_DEFAULT, 0.0f);
-
+			
 			// Did this value come from a trackURL() request?
 			if (!mCompletingRegionPos.isExactlyZero())
 			{
@@ -1516,14 +1552,14 @@ void LLFloaterWorldMap::onCommitSearchResult()
 			pos_global.mdV[VX] += (F64)pos_local.mV[VX];
 			pos_global.mdV[VY] += (F64)pos_local.mV[VY];
 			pos_global.mdV[VZ] = (F64)pos_local.mV[VZ];
-
+			
 			getChild<LLUICtrl>("location")->setValue(sim_name);
 			trackLocation(pos_global);
 			setDefaultBtn("Teleport");
 			break;
 		}
 	}
-
+	
 	onShowTargetBtn();
 }
 
@@ -1531,15 +1567,15 @@ void LLFloaterWorldMap::onChangeMaturity()
 {
 	bool can_access_mature = gAgent.canAccessMature();
 	bool can_access_adult = gAgent.canAccessAdult();
-
+	
 	getChildView("events_mature_icon")->setVisible( can_access_mature);
 	getChildView("events_mature_label")->setVisible( can_access_mature);
 	getChildView("events_mature_chk")->setVisible( can_access_mature);
-
+	
 	getChildView("events_adult_icon")->setVisible( can_access_adult);
 	getChildView("events_adult_label")->setVisible( can_access_adult);
 	getChildView("events_adult_chk")->setVisible( can_access_adult);
-
+	
 	// disable mature / adult events.
 	if (!can_access_mature)
 	{
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 1628a421ecb96777d63a9660f66e0ba226c16eba..783d9f48197f9a47c772530d5e313f2eed18509f 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -106,6 +106,11 @@ class LLFloaterWorldMap : public LLFloater
 	// teleport to the tracked item, if there is one
 	void			teleport();
 	void			onChangeMaturity();
+	
+	
+	//Slapp instigated avatar tracking
+	void			avatarTrackFromSlapp( const LLUUID& id ); 
+
 protected:	
 	void			onGoHome();
 
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index ce305dcd89741303bfc567e4f87732987d8d78fb..9623554200f4675e0e23997595f2c53c0d360169 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -279,20 +279,20 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 
 void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name)
 {
-	if (av_name.mIsDummy)
-	{
-		S32 separator_index = mName.rfind(" ");
-		std::string name = mName.substr(0, separator_index);
-		++separator_index;
-		std::string conference_word = mName.substr(separator_index, mName.length());
-
-		// additional check that session name is what we expected
-		if ("Conference" == conference_word)
-		{
-			LLStringUtil::format_map_t args;
-			args["[AGENT_NAME]"] = name;
-			LLTrans::findString(mName, "conference-title-incoming", args);
-		}
+	if (av_name.mIsTemporaryName)
+	{
+		S32 separator_index = mName.rfind(" ");
+		std::string name = mName.substr(0, separator_index);
+		++separator_index;
+		std::string conference_word = mName.substr(separator_index, mName.length());
+
+		// additional check that session name is what we expected
+		if ("Conference" == conference_word)
+		{
+			LLStringUtil::format_map_t args;
+			args["[AGENT_NAME]"] = name;
+			LLTrans::findString(mName, "conference-title-incoming", args);
+		}
 	}
 	else
 	{
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index e765a8da2fe69167dfd88eb8c8828cdfda28aae7..a15776c20791c4ab1aad7b9ead90491640203ae0 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -100,7 +100,7 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 
 		void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name);
 
-		void onAdHocNameCache(const LLAvatarName& av_name);
+		void onAdHocNameCache(const LLAvatarName& av_name);
 
 		//*TODO make private
 		static std::string generateHash(const std::set<LLUUID>& sorted_uuids);
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index ab0acbae5062f116cadc5b117936c9ec9d413cc1..5108f6859220e4e158756847f52298c8e6a4d3d7 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -5344,11 +5344,6 @@ void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 	menuentry_vec_t disabled_items, items = getMenuItems();
 
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Body Parts")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Clothes")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Note")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Gesture")), items.end());
-	items.erase(std::remove(items.begin(), items.end(), std::string("New Script")), items.end());
 	items.erase(std::remove(items.begin(), items.end(), std::string("New Folder")), items.end());
 
 	hide_context_entries(menu, items, disabled_items);
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ef2086911401ccdcda96cdaf0d3196fdccdd1694..61d0a150b719603072987d96288f4fed97d4b559 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -686,6 +686,12 @@ bool LLFindWearablesEx::operator()(LLInventoryCategory* cat, LLInventoryItem* it
 		return false;
 	}
 
+	// Skip broken links.
+	if (vitem->getIsBrokenLink())
+	{
+		return false;
+	}
+
 	return (bool) get_is_item_worn(item->getUUID()) == mIsWorn;
 }
 
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index eab8f187a70d7f9901122d3686a2b98e04efdef3..570e48d52694ab47f0fe1ec0dfa5090fc5bb9ef8 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -181,7 +181,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 	if (mBackgroundFetchActive && gAgent.getRegion())
 	{
 		// If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
-		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");   
+		std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");   
 		if (!url.empty()) 
 		{
 			bulkFetch(url);
@@ -604,7 +604,7 @@ void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
 		}
 		if (body_lib["folders"].size())
 		{
-			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
+			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
 			
 			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
 			LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 91ff8c7867c4d9e5519a4e5ae15bcbd458d50418..0fd4b2bee54fabc12bba9eb36cbe57899bb4e835 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -203,8 +203,8 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
 {
 	if (!items_llsd.size() || gDisconnected) return;
 	LLSD body;
-	body[0]["cap_name"] = "FetchInventory";
-	body[1]["cap_name"] = "FetchLib";
+	body[0]["cap_name"] = "FetchInventory2";
+	body[1]["cap_name"] = "FetchLib2";
 	for (S32 i=0; i<items_llsd.size();i++)
 	{
 		if (items_llsd[i]["owner_id"].asString() == gAgent.getID().asString())
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 0870b5b8dd3fad9d804218f284889809a49f2d0e..5a9d1524f3491963882a8444dceb98b1d3da0c6d 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -921,6 +921,8 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
 {
 	S32 z_min = S32_MAX;
 	LLInventoryPanel* res = NULL;
+	LLFloater* active_inv_floaterp = NULL;
+
 	// A. If the inventory side panel is open, use that preferably.
 	if (is_inventorysp_active())
 	{
@@ -941,6 +943,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
 		{
 			res = inventorySP->getActivePanel();
 			z_min = gFloaterView->getZOrder(inv_floater);
+			active_inv_floaterp = inv_floater;
 		}
 		else
 		{
@@ -960,10 +963,19 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
 			{
 				res = iv->getPanel();
 				z_min = z_order;
+				active_inv_floaterp = iv;
 			}
 		}
 	}
-	if (res) return res;
+
+	if (res)
+	{
+		// Make sure the floater is not minimized (STORM-438).
+		if (active_inv_floaterp && active_inv_floaterp->isMinimized())
+			active_inv_floaterp->setMinimized(FALSE);
+
+		return res;
+	}
 		
 	// C. If no panels are open and we don't want to force open a panel, then just abort out.
 	if (!auto_open) return NULL;
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 1527f8f4c9484ca1a36fb9aaad701922b40d4061..55164f609494e7e1214fb29cc1b50b2f6faa196c 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -547,6 +547,10 @@ void LLLocationInputCtrl::onFocusLost()
 {
 	LLUICtrl::onFocusLost();
 	refreshLocation();
+
+	// Setting cursor to 0  to show the left edge of the text. See STORM-370.
+	mTextEntry->setCursor(0);
+
 	if(mTextEntry->hasSelection()){
 		mTextEntry->deselect();
 	}
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 0121bbb1ed3dc88164c88cc39f66ee9c0aa1841c..9adf374c71642fc0f3525b36453d93572c7af1b2 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -89,15 +89,15 @@ const static boost::regex TIMESTAMP_AND_STUFF("^(\\[\\d{4}/\\d{1,2}/\\d{1,2}\\s+
  */
 const static boost::regex NAME_AND_TEXT("([^:]+[:]{1})?(\\s*)(.*)");
 
-/**
- * These are recognizers for matching the names of ad-hoc conferences when generating the log file name
- * On invited side, an ad-hoc is named like "<first name> <last name> Conference 2010/11/19 03:43 f0f4"
- * On initiating side, an ad-hoc is named like Ad-hoc Conference hash<hash>"
- * If the naming system for ad-hoc conferences are change in LLIMModel::LLIMSession::buildHistoryFileName()
- * then these definition need to be adjusted as well.
- */
-const static boost::regex INBOUND_CONFERENCE("^[a-zA-Z]{1,31} [a-zA-Z]{1,31} Conference [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2} [0-9a-f]{4}");
-const static boost::regex OUTBOUND_CONFERENCE("^Ad-hoc Conference hash[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
+/**
+ * These are recognizers for matching the names of ad-hoc conferences when generating the log file name
+ * On invited side, an ad-hoc is named like "<first name> <last name> Conference 2010/11/19 03:43 f0f4"
+ * On initiating side, an ad-hoc is named like Ad-hoc Conference hash<hash>"
+ * If the naming system for ad-hoc conferences are change in LLIMModel::LLIMSession::buildHistoryFileName()
+ * then these definition need to be adjusted as well.
+ */
+const static boost::regex INBOUND_CONFERENCE("^[a-zA-Z]{1,31} [a-zA-Z]{1,31} Conference [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2} [0-9a-f]{4}");
+const static boost::regex OUTBOUND_CONFERENCE("^Ad-hoc Conference hash[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
 
 //is used to parse complex object names like "Xstreet SL Terminal v2.2.5 st"
 const static std::string NAME_TEXT_DIVIDER(": ");
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index d866db1829240ac0ffbae648b380cacdaf8f39cc..33e051bfab8e6286f73c64862a8fe6ee05019c54 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -214,6 +214,9 @@ void MandatoryUpdateMachine::start(void)
 			case LLUpdaterService::CHECKING_FOR_UPDATE:
 				setCurrentState(new CheckingForUpdate(*this));
 				break;
+			case LLUpdaterService::TEMPORARY_ERROR:
+				setCurrentState(new Error(*this));
+				break;
 			case LLUpdaterService::DOWNLOADING:
 				setCurrentState(new WaitingForDownload(*this));
 				break;
@@ -289,6 +292,7 @@ bool MandatoryUpdateMachine::CheckingForUpdate::onEvent(LLSD const & event)
 			case LLUpdaterService::DOWNLOADING:
 				mMachine.setCurrentState(new WaitingForDownload(mMachine));
 				break;
+			case LLUpdaterService::TEMPORARY_ERROR:
 			case LLUpdaterService::UP_TO_DATE:
 			case LLUpdaterService::TERMINAL:
 			case LLUpdaterService::FAILURE:
@@ -324,7 +328,7 @@ MandatoryUpdateMachine::Error::Error(MandatoryUpdateMachine & machine):
 void MandatoryUpdateMachine::Error::enter(void)
 {
 	llinfos << "entering error" << llendl;
-	LLNotificationsUtil::add("FailedUpdateInstall", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::Error::onButtonClicked, this, _1, _2));
+	LLNotificationsUtil::add("FailedRequiredUpdateInstall", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::Error::onButtonClicked, this, _1, _2));
 }
 
 
@@ -468,7 +472,6 @@ LLLoginInstance::LLLoginInstance() :
 	mLoginModule(new LLLogin()),
 	mNotifications(NULL),
 	mLoginState("offline"),
-	mUserInteraction(true),
 	mSkipOptionalUpdate(false),
 	mAttemptComplete(false),
 	mTransferRate(0.0f),
@@ -637,64 +640,57 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
 	LLSD response = event["data"];
 	std::string reason_response = response["reason"].asString();
 	std::string message_response = response["message"].asString();
-	if(mUserInteraction)
+	// For the cases of critical message or TOS agreement,
+	// start the TOS dialog. The dialog response will be handled
+	// by the LLLoginInstance::handleTOSResponse() callback.
+	// The callback intiates the login attempt next step, either 
+	// to reconnect or to end the attempt in failure.
+	if(reason_response == "tos")
 	{
-		// For the cases of critical message or TOS agreement,
-		// start the TOS dialog. The dialog response will be handled
-		// by the LLLoginInstance::handleTOSResponse() callback.
-		// The callback intiates the login attempt next step, either 
-		// to reconnect or to end the attempt in failure.
-		if(reason_response == "tos")
-		{
-			LLSD data(LLSD::emptyMap());
-			data["message"] = message_response;
-			data["reply_pump"] = TOS_REPLY_PUMP;
-			gViewerWindow->setShowProgress(FALSE);
-			LLFloaterReg::showInstance("message_tos", data);
-			LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
-				.listen(TOS_LISTENER_NAME,
-						boost::bind(&LLLoginInstance::handleTOSResponse, 
-									this, _1, "agree_to_tos"));
-		}
-		else if(reason_response == "critical")
-		{
-			LLSD data(LLSD::emptyMap());
-			data["message"] = message_response;
-			data["reply_pump"] = TOS_REPLY_PUMP;
-			if(response.has("error_code"))
-			{
-				data["error_code"] = response["error_code"];
-			}
-			if(response.has("certificate"))
-			{
-				data["certificate"] = response["certificate"];
-			}
-			
-			gViewerWindow->setShowProgress(FALSE);
-			LLFloaterReg::showInstance("message_critical", data);
-			LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
-				.listen(TOS_LISTENER_NAME,
-						boost::bind(&LLLoginInstance::handleTOSResponse, 
-									this, _1, "read_critical"));
-		}
-		else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate"))
+		LLSD data(LLSD::emptyMap());
+		data["message"] = message_response;
+		data["reply_pump"] = TOS_REPLY_PUMP;
+		gViewerWindow->setShowProgress(FALSE);
+		LLFloaterReg::showInstance("message_tos", data);
+		LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
+			.listen(TOS_LISTENER_NAME,
+					boost::bind(&LLLoginInstance::handleTOSResponse, 
+								this, _1, "agree_to_tos"));
+	}
+	else if(reason_response == "critical")
+	{
+		LLSD data(LLSD::emptyMap());
+		data["message"] = message_response;
+		data["reply_pump"] = TOS_REPLY_PUMP;
+		if(response.has("error_code"))
 		{
-			gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE);
-			updateApp(true, message_response);
+			data["error_code"] = response["error_code"];
 		}
-		else if(reason_response == "optional")
+		if(response.has("certificate"))
 		{
-			updateApp(false, message_response);
+			data["certificate"] = response["certificate"];
 		}
-		else
-		{	
-			attemptComplete();
-		}	
+		
+		gViewerWindow->setShowProgress(FALSE);
+		LLFloaterReg::showInstance("message_critical", data);
+		LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
+			.listen(TOS_LISTENER_NAME,
+					boost::bind(&LLLoginInstance::handleTOSResponse, 
+								this, _1, "read_critical"));
 	}
-	else // no user interaction
+	else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate"))
 	{
-		attemptComplete();
+		gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE);
+		updateApp(true, message_response);
 	}
+	else if(reason_response == "optional")
+	{
+		updateApp(false, message_response);
+	}
+	else
+	{	
+		attemptComplete();
+	}	
 }
 
 void LLLoginInstance::handleLoginSuccess(const LLSD& event)
diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h
index b872d7d1b1a417b2e78025e4ba7f9aa2f34a4e6f..8b5343121907415e70fe547eafd05d32571259cd 100644
--- a/indra/newview/lllogininstance.h
+++ b/indra/newview/lllogininstance.h
@@ -61,12 +61,6 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
 	// Only valid when authSuccess == true.
 	const F64 getLastTransferRateBPS() { return mTransferRate; }
 
-		// Set whether this class will drive user interaction.
-	// If not, login failures like 'need tos agreement' will 
-	// end the login attempt.
-	void setUserInteraction(bool state) { mUserInteraction = state; } 
-	bool getUserInteraction() { return mUserInteraction; }
-
 	// Whether to tell login to skip optional update request.
 	// False by default.
 	void setSkipOptionalUpdate(bool state) { mSkipOptionalUpdate = state; }
@@ -100,7 +94,6 @@ class LLLoginInstance : public LLSingleton<LLLoginInstance>
 	std::string mLoginState;
 	LLSD mRequestData;
 	LLSD mResponseData;
-	bool mUserInteraction; 
 	bool mSkipOptionalUpdate;
 	bool mAttemptComplete;
 	F64 mTransferRate;
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index cebfac86e71effb2e97234041aeb6a07c977c003..de5439e4e03e5a88002a454a74e790cd503548db 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -527,7 +527,8 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
 
 	if( nearby_chat->getVisible()
 		|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
-			&& gSavedSettings.getBOOL("UseChatBubbles") ) )
+			&& gSavedSettings.getBOOL("UseChatBubbles") )
+		|| !mChannel->getShowToasts() ) // to prevent toasts in Busy mode
 		return;//no need in toast if chat is visible or if bubble chat is enabled
 
 	// Handle irc styled messages for toast panel
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index f084002385abd6952fd9398c163e4d24ea2c47ac..1a8ec4991d7dedef4b1f47cf0440dfce89b213e4 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -94,10 +94,12 @@ LLNetMap::LLNetMap (const Params & p)
 	mToolTipMsg()
 {
 	mDotRadius = llmax(DOT_SCALE * mPixelsPerMeter, MIN_DOT_RADIUS);
+	setScale(gSavedSettings.getF32("MiniMapScale"));
 }
 
 LLNetMap::~LLNetMap()
 {
+	gSavedSettings.setF32("MiniMapScale", mScale);
 }
 
 void LLNetMap::setScale( F32 scale )
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index a9bcdef47cf93b70f13021e19742c43b26216e7e..94b2340c937a2a8f7e75e32658b14f366d2f67d7 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -477,6 +477,7 @@ LLPanelAvatarProfile::LLPanelAvatarProfile()
 
 BOOL LLPanelAvatarProfile::postBuild()
 {
+	childSetCommitCallback("see_profile_btn",(boost::bind(&LLPanelAvatarProfile::onSeeProfileBtnClick,this)),NULL);
 	childSetCommitCallback("add_friend",(boost::bind(&LLPanelAvatarProfile::onAddFriendButtonClick,this)),NULL);
 	childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL);
 	childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL);
@@ -624,6 +625,35 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g
 	getChild<LLUICtrl>("sl_groups")->setValue(groups);
 }
 
+void LLPanelAvatarProfile::got_full_name_callback( const LLUUID& id, const std::string& full_name, bool is_group )
+{
+	LLStringUtil::format_map_t args;
+
+	std::string name;
+	if (LLAvatarNameCache::useDisplayNames())
+	{
+		name = LLCacheName::buildUsername(full_name);
+	}
+	else
+	{
+		name = full_name;
+	}
+
+	args["[NAME]"] = name;
+
+	std::string linden_name = getString("name_text_args", args);
+	getChild<LLUICtrl>("name_descr_text")->setValue(linden_name);
+}
+
+void LLPanelAvatarProfile::onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
+{
+	LLStringUtil::format_map_t args;
+	args["[DISPLAY_NAME]"] = av_name.mDisplayName;
+
+	std::string display_name = getString("display_name_text_args", args);
+	getChild<LLUICtrl>("display_name_descr_text")->setValue(display_name);
+}
+
 void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
 {
 	//remove avatar id from cache to get fresh info
@@ -635,6 +665,24 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
 		LLStringUtil::format(birth_date, LLSD().with("datetime", (S32) avatar_data->born_on.secondsSinceEpoch()));
 		args["[REG_DATE]"] = birth_date;
 	}
+
+	// ask (asynchronously) for the avatar name
+	std::string full_name;
+	if (gCacheName->getFullName(avatar_data->agent_id, full_name))
+	{
+		// name in cache, call callback directly
+		got_full_name_callback( avatar_data->agent_id, full_name, false );
+	}
+	else
+	{
+		// not in cache, lookup name 
+		gCacheName->get(avatar_data->agent_id, false, boost::bind( &LLPanelAvatarProfile::got_full_name_callback, this, _1, _2, _3 ));
+	}
+
+	// get display name
+	LLAvatarNameCache::get(avatar_data->avatar_id,
+		boost::bind(&LLPanelAvatarProfile::onNameCache, this, _1, _2));
+
 	args["[AGE]"] = LLDateUtil::ageFromDate( avatar_data->born_on, LLDate::now());
 	std::string register_date = getString("RegisterDateFormat", args);
 	getChild<LLUICtrl>("register_date")->setValue(register_date );
@@ -734,6 +782,11 @@ void LLPanelAvatarProfile::onAddFriendButtonClick()
 	LLAvatarActions::requestFriendshipDialog(getAvatarId());
 }
 
+void LLPanelAvatarProfile::onSeeProfileBtnClick()
+{
+	LLAvatarActions::showProfile(getAvatarId());
+}
+
 void LLPanelAvatarProfile::onIMButtonClick()
 {
 	LLAvatarActions::startIM(getAvatarId());
diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h
index 71d9d0a95a159ddac9e31bb1e71945bd63d36fca..070fe4579ac14499ab0d63d8c6bf7f36a0216f67 100644
--- a/indra/newview/llpanelavatar.h
+++ b/indra/newview/llpanelavatar.h
@@ -1,295 +1,298 @@
-/** 
- * @file llpanelavatar.h
- * @brief LLPanelAvatar and related class definitions
- *
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLPANELAVATAR_H
-#define LL_LLPANELAVATAR_H
-
-#include "llpanel.h"
-#include "llavatarpropertiesprocessor.h"
-#include "llcallingcard.h"
-#include "llvoiceclient.h"
-
-class LLComboBox;
-class LLLineEditor;
-
-enum EOnlineStatus
-{
-	ONLINE_STATUS_NO      = 0,
-	ONLINE_STATUS_YES     = 1
-};
-
-/**
-* Base class for any Profile View or My Profile Panel.
-*/
-class LLPanelProfileTab
-	: public LLPanel
-	, public LLAvatarPropertiesObserver
-{
-public:
-
-	/**
-	 * Sets avatar ID, sets panel as observer of avatar related info replies from server.
-	 */
-	virtual void setAvatarId(const LLUUID& id);
-
-	/**
-	 * Returns avatar ID.
-	 */
-	virtual const LLUUID& getAvatarId() { return mAvatarId; }
-
-	/**
-	 * Sends update data request to server.
-	 */
-	virtual void updateData() = 0;
-
-	/**
-	 * Clears panel data if viewing avatar info for first time and sends update data request.
-	 */
-	virtual void onOpen(const LLSD& key);
-
-	/**
-	 * Profile tabs should close any opened panels here.
-	 *
-	 * Called from LLPanelProfile::onOpen() before opening new profile.
-	 * See LLPanelPicks::onClosePanel for example. LLPanelPicks closes picture info panel
-	 * before new profile is displayed, otherwise new profile will 
-	 * be hidden behind picture info panel.
-	 */
-	virtual void onClosePanel() {}
-
-	/**
-	 * Resets controls visibility, state, etc.
-	 */
-	virtual void resetControls(){};
-
-	/**
-	 * Clears all data received from server.
-	 */
-	virtual void resetData(){};
-
-	/*virtual*/ ~LLPanelProfileTab();
-
-protected:
-
-	LLPanelProfileTab();
-
-	/**
-	 * Scrolls panel to top when viewing avatar info for first time.
-	 */
-	void scrollToTop();
-
-	virtual void onMapButtonClick();
-
-	virtual void updateButtons();
-
-private:
-
-	LLUUID mAvatarId;
-};
-
-/**
-* Panel for displaying Avatar's first and second life related info.
-*/
-class LLPanelAvatarProfile
-	: public LLPanelProfileTab
-	, public LLFriendObserver
-	, public LLVoiceClientStatusObserver
-{
-public:
-	LLPanelAvatarProfile();
-	/*virtual*/ ~LLPanelAvatarProfile();
-
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/**
-	 * LLFriendObserver trigger
-	 */
-	virtual void changed(U32 mask);
-
-	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
-	// button when voice is available
-	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
-
-	/*virtual*/ void setAvatarId(const LLUUID& id);
-
-	/**
-	 * Processes data received from server.
-	 */
-	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
-
-	/*virtual*/ BOOL postBuild();
-
-	/*virtual*/ void updateData();
-
-	/*virtual*/ void resetControls();
-
-	/*virtual*/ void resetData();
-
-protected:
-
-	/**
-	 * Process profile related data received from server.
-	 */
-	virtual void processProfileProperties(const LLAvatarData* avatar_data);
-
-	/**
-	 * Processes group related data received from server.
-	 */
-	virtual void processGroupProperties(const LLAvatarGroups* avatar_groups);
-
-	/**
-	 * Fills common for Avatar profile and My Profile fields.
-	 */
-	virtual void fillCommonData(const LLAvatarData* avatar_data);
-
-	/**
-	 * Fills partner data.
-	 */
-	virtual void fillPartnerData(const LLAvatarData* avatar_data);
-
-	/**
-	 * Fills account status.
-	 */
-	virtual void fillAccountStatus(const LLAvatarData* avatar_data);
-
-	/**
-	 * Opens "Pay Resident" dialog.
-	 */
-	void pay();
-
-	/**
-	 * opens inventory and IM for sharing items
-	 */
-	void share();
-
-	/**
-	 * Add/remove resident to/from your block list.
-	 */
-	void toggleBlock();
-
-	void kick();
-	void freeze();
-	void unfreeze();
-	void csr();
-	
-	bool enableShowOnMap();
-	bool enableBlock();
-	bool enableUnblock();
-	bool enableGod();
-
-
-	void onAddFriendButtonClick();
-	void onIMButtonClick();
-	void onCallButtonClick();
-	void onTeleportButtonClick();
-	void onShareButtonClick();
-
-private:
-
-	typedef std::map< std::string,LLUUID>	group_map_t;
-	group_map_t 			mGroups;
-};
-
-/**
- * Panel for displaying own first and second life related info.
- */
-class LLPanelMyProfile
-	: public LLPanelAvatarProfile
-{
-public:
-	LLPanelMyProfile();
-
-	/*virtual*/ BOOL postBuild();
-
-protected:
-
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/*virtual*/ void processProfileProperties(const LLAvatarData* avatar_data);
-
-	/*virtual*/ void resetControls();
-
-protected:
-	void onStatusMessageChanged();
-};
-
-/**
- * Panel for displaying Avatar's notes and modifying friend's rights.
- */
-class LLPanelAvatarNotes 
-	: public LLPanelProfileTab
-	, public LLFriendObserver
-	, public LLVoiceClientStatusObserver
-{
-public:
-	LLPanelAvatarNotes();
-	/*virtual*/ ~LLPanelAvatarNotes();
-
-	virtual void setAvatarId(const LLUUID& id);
-
-	/** 
-	 * LLFriendObserver trigger
-	 */
-	virtual void changed(U32 mask);
-
-	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
-	// button when voice is available
-	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
-
-	/*virtual*/ void onOpen(const LLSD& key);
-
-	/*virtual*/ BOOL postBuild();
-
-	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
-
-	/*virtual*/ void updateData();
-
-protected:
-
-	/*virtual*/ void resetControls();
-
-	/*virtual*/ void resetData();
-
-	/**
-	 * Fills rights data for friends.
-	 */
-	void fillRightsData();
-
-	void rightsConfirmationCallback(const LLSD& notification,
-			const LLSD& response, S32 rights);
-	void confirmModifyRights(bool grant, S32 rights);
-	void onCommitRights();
-	void onCommitNotes();
-
-	void onAddFriendButtonClick();
-	void onIMButtonClick();
-	void onCallButtonClick();
-	void onTeleportButtonClick();
-	void onShareButtonClick();
-	void enableCheckboxes(bool enable);
-};
-
-#endif // LL_LLPANELAVATAR_H
+/** 
+ * @file llpanelavatar.h
+ * @brief LLPanelAvatar and related class definitions
+ *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLPANELAVATAR_H
+#define LL_LLPANELAVATAR_H
+
+#include "llpanel.h"
+#include "llavatarpropertiesprocessor.h"
+#include "llcallingcard.h"
+#include "llvoiceclient.h"
+#include "llavatarnamecache.h"
+
+class LLComboBox;
+class LLLineEditor;
+
+enum EOnlineStatus
+{
+	ONLINE_STATUS_NO      = 0,
+	ONLINE_STATUS_YES     = 1
+};
+
+/**
+* Base class for any Profile View or My Profile Panel.
+*/
+class LLPanelProfileTab
+	: public LLPanel
+	, public LLAvatarPropertiesObserver
+{
+public:
+
+	/**
+	 * Sets avatar ID, sets panel as observer of avatar related info replies from server.
+	 */
+	virtual void setAvatarId(const LLUUID& id);
+
+	/**
+	 * Returns avatar ID.
+	 */
+	virtual const LLUUID& getAvatarId() { return mAvatarId; }
+
+	/**
+	 * Sends update data request to server.
+	 */
+	virtual void updateData() = 0;
+
+	/**
+	 * Clears panel data if viewing avatar info for first time and sends update data request.
+	 */
+	virtual void onOpen(const LLSD& key);
+
+	/**
+	 * Profile tabs should close any opened panels here.
+	 *
+	 * Called from LLPanelProfile::onOpen() before opening new profile.
+	 * See LLPanelPicks::onClosePanel for example. LLPanelPicks closes picture info panel
+	 * before new profile is displayed, otherwise new profile will 
+	 * be hidden behind picture info panel.
+	 */
+	virtual void onClosePanel() {}
+
+	/**
+	 * Resets controls visibility, state, etc.
+	 */
+	virtual void resetControls(){};
+
+	/**
+	 * Clears all data received from server.
+	 */
+	virtual void resetData(){};
+
+	/*virtual*/ ~LLPanelProfileTab();
+
+protected:
+
+	LLPanelProfileTab();
+
+	/**
+	 * Scrolls panel to top when viewing avatar info for first time.
+	 */
+	void scrollToTop();
+
+	virtual void onMapButtonClick();
+
+	virtual void updateButtons();
+
+private:
+
+	LLUUID mAvatarId;
+};
+
+/**
+* Panel for displaying Avatar's first and second life related info.
+*/
+class LLPanelAvatarProfile
+	: public LLPanelProfileTab
+	, public LLFriendObserver
+	, public LLVoiceClientStatusObserver
+{
+public:
+	LLPanelAvatarProfile();
+	/*virtual*/ ~LLPanelAvatarProfile();
+
+	/*virtual*/ void onOpen(const LLSD& key);
+
+	/**
+	 * LLFriendObserver trigger
+	 */
+	virtual void changed(U32 mask);
+
+	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
+	// button when voice is available
+	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
+
+	/*virtual*/ void setAvatarId(const LLUUID& id);
+
+	/**
+	 * Processes data received from server.
+	 */
+	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
+
+	/*virtual*/ BOOL postBuild();
+
+	/*virtual*/ void updateData();
+
+	/*virtual*/ void resetControls();
+
+	/*virtual*/ void resetData();
+
+protected:
+
+	/**
+	 * Process profile related data received from server.
+	 */
+	virtual void processProfileProperties(const LLAvatarData* avatar_data);
+
+	/**
+	 * Processes group related data received from server.
+	 */
+	virtual void processGroupProperties(const LLAvatarGroups* avatar_groups);
+
+	/**
+	 * Fills common for Avatar profile and My Profile fields.
+	 */
+	virtual void fillCommonData(const LLAvatarData* avatar_data);
+
+	/**
+	 * Fills partner data.
+	 */
+	virtual void fillPartnerData(const LLAvatarData* avatar_data);
+
+	/**
+	 * Fills account status.
+	 */
+	virtual void fillAccountStatus(const LLAvatarData* avatar_data);
+
+	/**
+	 * Opens "Pay Resident" dialog.
+	 */
+	void pay();
+
+	/**
+	 * opens inventory and IM for sharing items
+	 */
+	void share();
+
+	/**
+	 * Add/remove resident to/from your block list.
+	 */
+	void toggleBlock();
+
+	void kick();
+	void freeze();
+	void unfreeze();
+	void csr();
+	
+	bool enableShowOnMap();
+	bool enableBlock();
+	bool enableUnblock();
+	bool enableGod();
+
+	void onSeeProfileBtnClick();
+	void onAddFriendButtonClick();
+	void onIMButtonClick();
+	void onCallButtonClick();
+	void onTeleportButtonClick();
+	void onShareButtonClick();
+
+private:
+	void got_full_name_callback( const LLUUID& id, const std::string& full_name, bool is_group );
+	void onNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
+
+	typedef std::map< std::string,LLUUID>	group_map_t;
+	group_map_t 			mGroups;
+};
+
+/**
+ * Panel for displaying own first and second life related info.
+ */
+class LLPanelMyProfile
+	: public LLPanelAvatarProfile
+{
+public:
+	LLPanelMyProfile();
+
+	/*virtual*/ BOOL postBuild();
+
+protected:
+
+	/*virtual*/ void onOpen(const LLSD& key);
+
+	/*virtual*/ void processProfileProperties(const LLAvatarData* avatar_data);
+
+	/*virtual*/ void resetControls();
+
+protected:
+	void onStatusMessageChanged();
+};
+
+/**
+ * Panel for displaying Avatar's notes and modifying friend's rights.
+ */
+class LLPanelAvatarNotes 
+	: public LLPanelProfileTab
+	, public LLFriendObserver
+	, public LLVoiceClientStatusObserver
+{
+public:
+	LLPanelAvatarNotes();
+	/*virtual*/ ~LLPanelAvatarNotes();
+
+	virtual void setAvatarId(const LLUUID& id);
+
+	/** 
+	 * LLFriendObserver trigger
+	 */
+	virtual void changed(U32 mask);
+
+	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
+	// button when voice is available
+	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
+
+	/*virtual*/ void onOpen(const LLSD& key);
+
+	/*virtual*/ BOOL postBuild();
+
+	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
+
+	/*virtual*/ void updateData();
+
+protected:
+
+	/*virtual*/ void resetControls();
+
+	/*virtual*/ void resetData();
+
+	/**
+	 * Fills rights data for friends.
+	 */
+	void fillRightsData();
+
+	void rightsConfirmationCallback(const LLSD& notification,
+			const LLSD& response, S32 rights);
+	void confirmModifyRights(bool grant, S32 rights);
+	void onCommitRights();
+	void onCommitNotes();
+
+	void onAddFriendButtonClick();
+	void onIMButtonClick();
+	void onCallButtonClick();
+	void onTeleportButtonClick();
+	void onShareButtonClick();
+	void enableCheckboxes(bool enable);
+};
+
+#endif // LL_LLPANELAVATAR_H
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 90ed8b9e587a106dca3b0330913081c165d139bf..4a74b7925c1965afd7313369e74301d356d52df3 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -569,6 +569,7 @@ static void update_color_swatch_ctrl(LLPanelEditWearable* self, LLPanel* panel,
 	if (color_swatch_ctrl)
 	{
 		color_swatch_ctrl->set(self->getWearable()->getClothesColor(entry->mTextureIndex));
+		color_swatch_ctrl->closeFloaterColorPicker();
 	}
 }
 
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index d1362d79227f5826091a3eefeb027dd461465a8e..3dbc637318a7eab48a77cc668a45ee554eaa7d88 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -1843,7 +1843,8 @@ bool LLPanelGroupRolesSubTab::apply(std::string& mesg)
 {
 	lldebugs << "LLPanelGroupRolesSubTab::apply()" << llendl;
 
-	saveRoleChanges();
+	saveRoleChanges(true);
+
 	LLGroupMgr::getInstance()->sendGroupRoleChanges(mGroupID);
 
 	notifyObservers();
@@ -2022,7 +2023,7 @@ void LLPanelGroupRolesSubTab::handleRoleSelect()
 		return;
 	}
 
-	saveRoleChanges();
+	saveRoleChanges(false);
 
 	// Check if there is anything selected.
 	LLScrollListItem* item = mRolesList->getFirstSelected();
@@ -2385,7 +2386,7 @@ void LLPanelGroupRolesSubTab::handleDeleteRole()
 	notifyObservers();
 }
 
-void LLPanelGroupRolesSubTab::saveRoleChanges()
+void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role)
 {
 	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
 
@@ -2400,13 +2401,23 @@ void LLPanelGroupRolesSubTab::saveRoleChanges()
 		rd.mRoleDescription = mRoleDescription->getText();
 		rd.mRoleTitle = mRoleTitle->getText();
 
+		S32 role_members_count = 0;
+		if (mSelectedRole.isNull())
+		{
+			role_members_count = gdatap->mMemberCount;
+		}
+		else if(LLGroupRoleData* grd = get_ptr_in_map(gdatap->mRoles, mSelectedRole))
+		{
+			role_members_count = grd->getTotalMembersInRole();
+		}
+
 		gdatap->setRoleData(mSelectedRole,rd);
 
 		mRolesList->deleteSingleItem(mRolesList->getItemIndex(mSelectedRole));
 		
-		LLSD row = createRoleItem(mSelectedRole,rd.mRoleName,rd.mRoleTitle,0);
+		LLSD row = createRoleItem(mSelectedRole,rd.mRoleName,rd.mRoleTitle,role_members_count);
 		LLScrollListItem* item = mRolesList->addElement(row, ADD_BOTTOM, this);
-		item->setSelected(TRUE);
+		item->setSelected(select_saved_role);
 
 		mHasRoleChange = FALSE;
 	}
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index 270259c16f90824a5f9a34f5f41f40413dc83820..a55e26415077d169adc18333384aeee57b546403 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -257,7 +257,7 @@ class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
 	static void onDeleteRole(void*);
 	void handleDeleteRole();
 
-	void saveRoleChanges();
+	void saveRoleChanges(bool select_saved_role);
 
 	virtual void setGroupID(const LLUUID& id);
 protected:
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index e8c8273a9d038e0f64f143183bf9eda2a1eb4f27..80f68621697fe9487b0529ed1cf5e53b815b795d 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -71,6 +71,7 @@ static void collapse_all_folders(LLFolderView* root_folder);
 static void expand_all_folders(LLFolderView* root_folder);
 static bool has_expanded_folders(LLFolderView* root_folder);
 static bool has_collapsed_folders(LLFolderView* root_folder);
+static void toggle_restore_menu(LLMenuGL* menu, BOOL visible, BOOL enabled);
 
 /**
  * Functor counting expanded and collapsed folders in folder view tree to know
@@ -708,6 +709,9 @@ void LLLandmarksPanel::initListCommandsHandlers()
 	mGearFolderMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_folder.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 
+	mGearLandmarkMenu->setVisibilityChangeCallback(boost::bind(&LLLandmarksPanel::onMenuVisibilityChange, this, _1, _2));
+	mGearFolderMenu->setVisibilityChangeCallback(boost::bind(&LLLandmarksPanel::onMenuVisibilityChange, this, _1, _2));
+
 	mListCommands->childSetAction(ADD_BUTTON_NAME, boost::bind(&LLLandmarksPanel::showActionMenu, this, mMenuAdd, ADD_BUTTON_NAME));
 }
 
@@ -1079,6 +1083,60 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
 	{
 		doActionOnCurSelectedLandmark(boost::bind(&LLLandmarksPanel::doCreatePick, this, _1));
 	}
+	else if ("restore" == command_name && mCurrentSelectedList)
+	{
+		mCurrentSelectedList->doToSelected(userdata);
+	}
+}
+
+void LLLandmarksPanel::onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param)
+{
+	bool new_visibility = param["visibility"].asBoolean();
+
+	// We don't have to update items visibility if the menu is hiding.
+	if (!new_visibility) return;
+
+	BOOL are_any_items_in_trash = FALSE;
+	BOOL are_all_items_in_trash = TRUE;
+
+	LLFolderView* root_folder_view = mCurrentSelectedList ? mCurrentSelectedList->getRootFolder() : NULL;
+	if(root_folder_view)
+	{
+		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+
+		std::set<LLUUID> selected_uuids = root_folder_view->getSelectionList();
+
+		// Iterate through selected items to find out if any of these items are in Trash
+		// or all the items are in Trash category.
+		for (std::set<LLUUID>::const_iterator iter = selected_uuids.begin(); iter != selected_uuids.end(); ++iter)
+		{
+			LLFolderViewItem* item = root_folder_view->getItemByID(*iter);
+
+			// If no item is found it might be a folder id.
+			if (!item)
+			{
+				item = root_folder_view->getFolderByID(*iter);
+			}
+			if (!item) continue;
+
+			LLFolderViewEventListener* listenerp = item->getListener();
+			if(!listenerp) continue;
+
+			// Trash category itself should not be included because it can't be
+			// actually restored from trash.
+			are_all_items_in_trash &= listenerp->isItemInTrash() && *iter != trash_id;
+
+			// If there are any selected items in Trash including the Trash category itself
+			// we show "Restore Item" in context menu and hide other irrelevant items.
+			are_any_items_in_trash |= listenerp->isItemInTrash();
+		}
+	}
+
+	// Display "Restore Item" menu entry if at least one of the selected items
+	// is in Trash or the Trash category itself is among selected items.
+	// Hide other menu entries in this case.
+	// Enable this menu entry only if all selected items are in the Trash category.
+	toggle_restore_menu((LLMenuGL*)ctrl, are_any_items_in_trash, are_all_items_in_trash);
 }
 
 /*
@@ -1414,4 +1472,31 @@ static bool has_collapsed_folders(LLFolderView* root_folder)
 
 	return true;
 }
+
+// Displays "Restore Item" context menu entry while hiding
+// all other entries or vice versa.
+// Sets "Restore Item" enabled state.
+void toggle_restore_menu(LLMenuGL *menu, BOOL visible, BOOL enabled)
+{
+	if (!menu) return;
+
+	const LLView::child_list_t *list = menu->getChildList();
+	for (LLView::child_list_t::const_iterator itor = list->begin();
+		 itor != list->end();
+		 ++itor)
+	{
+		LLView *menu_item = (*itor);
+		std::string name = menu_item->getName();
+
+		if ("restore_item" == name)
+		{
+			menu_item->setVisible(visible);
+			menu_item->setEnabled(enabled);
+		}
+		else
+		{
+			menu_item->setVisible(!visible);
+		}
+	}
+}
 // EOF
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 8dcbca04406542ff0fc9b96bb416a8641b1b9454..b2f4e92473f587a0bce100d3e0d4da6f051e1bce 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -128,6 +128,14 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	bool isActionEnabled(const LLSD& command_name) const;
 	void onCustomAction(const LLSD& command_name);
 
+	/**
+	 * Updates context menu depending on the selected items location.
+	 *
+	 * For items in Trash category the menu includes the "Restore Item"
+	 * context menu entry.
+	 */
+	void onMenuVisibilityChange(LLUICtrl* ctrl, const LLSD& param);
+
 	/**
 	 * Determines if an item can be modified via context/gear menu.
 	 *
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 5f89097c1787c9f122d0adff740cee5af84e54c4..8d3b1fd7a0dbe0f9ee77c81eaae98ac7ba061db5 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -35,6 +35,7 @@
 #include "llsecondlifeurls.h"
 #include "v4color.h"
 
+#include "llappviewer.h"
 #include "llbutton.h"
 #include "llcheckboxctrl.h"
 #include "llcommandhandler.h"		// for secondlife:///app/login/
@@ -253,11 +254,67 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	gResponsePtr = LLIamHereLogin::build( this );
 
 	LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
-	
+
+	// Show last logged in user favorites in "Start at" combo.
+	addUsersWithFavoritesToUsername();
+	getChild<LLComboBox>("username_combo")->setTextChangedCallback(boost::bind(&LLPanelLogin::addFavoritesToStartLocation, this));
+
 	updateLocationCombo(false);
 
 }
 
+void LLPanelLogin::addUsersWithFavoritesToUsername()
+{
+	LLComboBox* combo = getChild<LLComboBox>("username_combo");
+	if (!combo) return;
+	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
+	LLSD fav_llsd;
+	llifstream file;
+	file.open(filename);
+	if (!file.is_open()) return;
+	LLSDSerialize::fromXML(fav_llsd, file);
+	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
+		iter != fav_llsd.endMap(); ++iter)
+	{
+		combo->add(iter->first);
+	}
+}
+
+void LLPanelLogin::addFavoritesToStartLocation()
+{
+	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
+	if (!combo) return;
+	int num_items = combo->getItemCount();
+	for (int i = num_items - 1; i > 2; i--)
+	{
+		combo->remove(i);
+	}
+	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
+	LLSD fav_llsd;
+	llifstream file;
+	file.open(filename);
+	if (!file.is_open()) return;
+	LLSDSerialize::fromXML(fav_llsd, file);
+	for (LLSD::map_const_iterator iter = fav_llsd.beginMap();
+		iter != fav_llsd.endMap(); ++iter)
+	{
+		if(iter->first != getChild<LLComboBox>("username_combo")->getSimple()) continue;
+		combo->addSeparator();
+		LLSD user_llsd = iter->second;
+		for (LLSD::array_const_iterator iter1 = user_llsd.beginArray();
+			iter1 != user_llsd.endArray(); ++iter1)
+		{
+			std::string label = (*iter1)["name"].asString();
+			std::string value = (*iter1)["slurl"].asString();
+			if(label != "" && value != "")
+			{
+				combo->add(label, value);
+			}
+		}
+		break;
+	}
+}
+
 // force the size to be correct (XML doesn't seem to be sufficient to do this)
 // (with some padding so the other login screen doesn't show through)
 void LLPanelLogin::reshapeBrowser()
@@ -393,13 +450,14 @@ void LLPanelLogin::giveFocus()
 	if( sInstance )
 	{
 		// Grab focus and move cursor to first blank input field
-		std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
+		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
 		std::string pass = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
 
 		BOOL have_username = !username.empty();
 		BOOL have_pass = !pass.empty();
 
 		LLLineEditor* edit = NULL;
+		LLComboBox* combo = NULL;
 		if (have_username && !have_pass)
 		{
 			// User saved his name but not his password.  Move
@@ -409,7 +467,7 @@ void LLPanelLogin::giveFocus()
 		else
 		{
 			// User doesn't have a name, so start there.
-			edit = sInstance->getChild<LLLineEditor>("username_edit");
+			combo = sInstance->getChild<LLComboBox>("username_combo");
 		}
 
 		if (edit)
@@ -417,6 +475,10 @@ void LLPanelLogin::giveFocus()
 			edit->setFocus(TRUE);
 			edit->selectAll();
 		}
+		else if (combo)
+		{
+			combo->setFocus(TRUE);
+		}
 	}
 }
 
@@ -431,8 +493,8 @@ void LLPanelLogin::showLoginWidgets()
 	// *TODO: Append all the usual login parameters, like first_login=Y etc.
 	std::string splash_screen_url = LLGridManager::getInstance()->getLoginPage();
 	web_browser->navigateTo( splash_screen_url, "text/html" );
-	LLUICtrl* username_edit = sInstance->getChild<LLUICtrl>("username_edit");
-	username_edit->setFocus(TRUE);
+	LLUICtrl* username_combo = sInstance->getChild<LLUICtrl>("username_combo");
+	username_combo->setFocus(TRUE);
 }
 
 // static
@@ -476,16 +538,17 @@ void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
 		    login_id += " ";
 		    login_id += lastname;
 	    }
-		sInstance->getChild<LLUICtrl>("username_edit")->setValue(login_id);	
+		sInstance->getChild<LLComboBox>("username_combo")->setLabel(login_id);	
 	}
 	else if((std::string)identifier["type"] == "account")
 	{
-		sInstance->getChild<LLUICtrl>("username_edit")->setValue((std::string)identifier["account_name"]);		
+		sInstance->getChild<LLComboBox>("username_combo")->setLabel((std::string)identifier["account_name"]);		
 	}
 	else
 	{
-	  sInstance->getChild<LLUICtrl>("username_edit")->setValue(std::string());	
+	  sInstance->getChild<LLComboBox>("username_combo")->setLabel(std::string());	
 	}
+	sInstance->addFavoritesToStartLocation();
 	// if the password exists in the credential, set the password field with
 	// a filler to get some stars
 	LLSD authenticator = credential->getAuthenticator();
@@ -533,7 +596,7 @@ void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
 		authenticator = credential->getAuthenticator();
 	}
 
-	std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
+	std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
 	LLStringUtil::trim(username);
 	std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
 
@@ -625,15 +688,15 @@ BOOL LLPanelLogin::areCredentialFieldsDirty()
 	}
 	else
 	{
-		std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
+		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
 		LLStringUtil::trim(username);
 		std::string password = sInstance->getChild<LLUICtrl>("password_edit")->getValue().asString();
-		LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
-		if(ctrl && ctrl->isDirty())
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("username_combo");
+		if(combo && combo->isDirty())
 		{
 			return true;
 		}
-		ctrl = sInstance->getChild<LLLineEditor>("password_edit");
+		LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("password_edit");
 		if(ctrl && ctrl->isDirty()) 
 		{
 			return true;
@@ -797,6 +860,13 @@ void LLPanelLogin::loadLoginPage()
 	char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLabel().c_str(), 0);
 	oStr << "&grid=" << curl_grid;
 	curl_free(curl_grid);
+	
+	// add OS info
+	char * os_info = curl_escape(LLAppViewer::instance()->getOSInfo().getOSStringSimple().c_str(), 0);
+	oStr << "&os=" << os_info;
+	curl_free(os_info);
+	
+	
 	gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
 	gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
 	
@@ -873,7 +943,7 @@ void LLPanelLogin::onClickConnect(void *)
 			return;
 		}
 		updateStartSLURL();
-		std::string username = sInstance->getChild<LLUICtrl>("username_edit")->getValue().asString();
+		std::string username = sInstance->getChild<LLUICtrl>("username_combo")->getValue().asString();
 
 		
 		if(username.empty())
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 83e76a308bc1abc229e1213c22a870453b2746c8..1ef6539ecc5432d5ebb2d18af8547a4771816a0c 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -85,6 +85,8 @@ class LLPanelLogin:
 private:
 	friend class LLPanelLoginListener;
 	void reshapeBrowser();
+	void addFavoritesToStartLocation();
+	void addUsersWithFavoritesToUsername();
 	static void onClickConnect(void*);
 	static void onClickNewAccount(void*);
 //	static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 17433a557b91d805bf4bd601c67b5dfef2b13ce0..c83176d9800083d4640bae6668eb7fbcfea50824 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -506,9 +506,6 @@ void LLPanelMainInventory::onFilterSelected()
 		return;
 	}
 
-	BOOL recent_active = ("Recent Items" == mActivePanel->getName());
-	getChildView("add_btn_panel")->setVisible( !recent_active);
-
 	setFilterSubString(mFilterSubString);
 	LLInventoryFilter* filter = mActivePanel->getFilter();
 	LLFloaterInventoryFinder *finder = getFinder();
@@ -944,6 +941,11 @@ void LLPanelMainInventory::updateListCommands()
 
 void LLPanelMainInventory::onAddButtonClick()
 {
+// Gray out the "New Folder" option when the Recent tab is active as new folders will not be displayed
+// unless "Always show folders" is checked in the filter options.
+	bool recent_active = ("Recent Items" == mActivePanel->getName());
+	mMenuAdd->getChild<LLMenuItemGL>("New Folder")->setEnabled(!recent_active);
+
 	setUploadCostIfNeeded();
 
 	showActionMenu(mMenuAdd,"add_btn");
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index 5ea94e06116c5546a4baf9f7a801f629acb54530..d3c9c3e1314014e3309d8a1631b52092d6872aef 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -76,17 +76,19 @@ void LLPanelMe::onOpen(const LLSD& key)
 {
 	LLPanelProfile::onOpen(key);
 
-	// Force Edit My Profile if this is the first time when user is opening Me Panel (EXT-5068)
-	bool opened = gSavedSettings.getBOOL("MePanelOpened");
-	// In some cases Side Tray my call onOpen() twice, check getCollapsed() to be sure this
-	// is the last time onOpen() is called
-	if( !opened && !LLSideTray::getInstance()->getCollapsed() )
-	{
-		buildEditPanel();
-		openPanel(mEditPanel, getAvatarId());
-
-		gSavedSettings.setBOOL("MePanelOpened", true);
-	}
+	// Removed this action as per SOCIAL-431 The first time a new resident opens the profile tab 
+	//                                       in the sidebar, they see the old profile editing panel
+	//
+	//// Force Edit My Profile if this is the first time when user is opening Me Panel (EXT-5068)
+	//bool opened = gSavedSettings.getBOOL("MePanelOpened");
+	//// In some cases Side Tray my call onOpen() twice, check getCollapsed() to be sure this
+	//// is the last time onOpen() is called
+	//if( !opened && !LLSideTray::getInstance()->getCollapsed() )
+	//{
+	//	buildEditPanel();
+	//	openPanel(mEditPanel, getAvatarId());
+	//	gSavedSettings.setBOOL("MePanelOpened", true);
+	//}
 }
 
 bool LLPanelMe::notifyChildren(const LLSD& info)
diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp
index fcc67d68407a1bc157407437515188b15635fd7e..14e39f2c48714eea00e81aa9c8a7a982ec0b5e26 100644
--- a/indra/newview/llpanelnearbymedia.cpp
+++ b/indra/newview/llpanelnearbymedia.cpp
@@ -958,7 +958,7 @@ void LLPanelNearByMedia::onAdvancedButtonClick()
 
 void LLPanelNearByMedia::onMoreLess()
 {
-	bool is_more = getChild<LLUICtrl>("more_btn")->getVisible();
+	bool is_more = getChild<LLButton>("more_btn")->getToggleState();
 	mNearbyMediaPanel->setVisible(is_more);
 
 	// enable resizing when expanded
@@ -969,8 +969,7 @@ void LLPanelNearByMedia::onMoreLess()
 
 	setShape(new_rect);
 
-	getChild<LLUICtrl>("more_btn")->setVisible(!is_more);
-	getChild<LLUICtrl>("less_btn")->setVisible(is_more);
+	getChild<LLUICtrl>("more_btn")->setVisible(true);
 }
 
 void LLPanelNearByMedia::updateControls()
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 211b9cf4b1a281fa23089b9386b1825daba8a6b1..0b6267c9e6e70ba098158ec471ff185f1ad5b27f 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -766,22 +766,12 @@ BOOL LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 		LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID());
 		if(object)
 		{
-			const LLInventoryItem *inv = dynamic_cast<LLInventoryItem*>(object->getInventoryObject(mUUID));
-			if (inv)
+			const LLInventoryObject* cat = object->getInventoryObject(mUUID);
+			if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, FALSE)) )
 			{
-				const LLPermissions& perm = inv->getPermissions();
-				bool can_copy = gAgent.allowOperation(PERM_COPY, perm,
-														GP_OBJECT_MANIPULATE);
-				if((can_copy && perm.allowTransferTo(gAgent.getID()))
-				   || object->permYouOwner())
-//				   || gAgent.isGodlike())
-
-				{
-					*type = LLViewerAssetType::lookupDragAndDropType(inv->getType());
-
-					*id = inv->getUUID();
-					return TRUE;
-				}
+				*type = LLViewerAssetType::lookupDragAndDropType(cat->getType());
+				*id = mUUID;
+				return TRUE;
 			}
 		}
 	}
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
old mode 100644
new mode 100755
index 15e826ac2c70018eeae5a7355144af499f0374a0..c4f3866cad95386478d35f5739504185f82a9e2f
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -70,6 +70,111 @@ static const std::string CLASSIFIED_NAME("classified_name");
 
 static LLRegisterPanelClassWrapper<LLPanelPicks> t_panel_picks("panel_picks");
 
+class LLPickHandler : public LLCommandHandler,
+					  public LLAvatarPropertiesObserver
+{
+public:
+
+	std::set<LLUUID> mPickIds;
+	
+	// requires trusted browser to trigger
+	LLPickHandler() : LLCommandHandler("pick", UNTRUSTED_THROTTLE) { }
+
+	bool handle(const LLSD& params, const LLSD& query_map,
+		LLMediaCtrl* web)
+	{
+		// handle app/classified/create urls first
+		if (params.size() == 1 && params[0].asString() == "create")
+		{
+			createPick();
+			return true;
+		}
+
+		// then handle the general app/pick/{UUID}/{CMD} urls
+		if (params.size() < 2)
+		{
+			return false;
+		}
+
+		// get the ID for the pick_id
+		LLUUID pick_id;
+		if (!pick_id.set(params[0], FALSE))
+		{
+			return false;
+		}
+
+		// edit the pick in the side tray.
+		// need to ask the server for more info first though...
+		const std::string verb = params[1].asString();
+		if (verb == "edit")
+		{		
+			mPickIds.insert(pick_id);
+			LLAvatarPropertiesProcessor::getInstance()->addObserver(LLUUID(), this);
+			LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(gAgent.getID(),pick_id);
+			return true;
+		}
+		else
+		{
+			llwarns << "unknown verb " << verb << llendl;
+			return false;
+		}
+	}
+
+	void createPick()
+	{
+		LLSD params;
+		params["id"] = gAgent.getID();
+		params["open_tab_name"] = "panel_picks";
+		params["show_tab_panel"] = "create_pick";
+		LLSideTray::getInstance()->showPanel("panel_me", params);
+	}
+
+	void editPick(LLPickData* pick_info)
+	{
+		LLSD params;
+		params["open_tab_name"] = "panel_picks";
+		params["show_tab_panel"] = "edit_pick";
+		params["pick_id"] = pick_info->pick_id;
+		params["avatar_id"] = pick_info->creator_id;
+		params["snapshot_id"] = pick_info->snapshot_id;
+		params["pick_name"] = pick_info->name;
+		params["pick_desc"] = pick_info->desc;
+		
+		LLSideTray::getInstance()->showPanel("panel_me", params);
+	}
+	
+	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type)
+	{
+		if (APT_PICK_INFO != type)
+		{
+			return;
+		}
+
+		// is this the pick that we asked for?
+		LLPickData* pick_info = static_cast<LLPickData*>(data);
+		if (!pick_info || mPickIds.find(pick_info->pick_id) == mPickIds.end())
+		{
+			return;
+		}
+
+		// open the edit side tray for this pick
+		if (pick_info->creator_id == gAgent.getID())
+		{
+			editPick(pick_info);
+		}
+		else
+		{
+			llwarns << "Can't edit a pick you did not create" << llendl;
+		}
+
+		// remove our observer now that we're done
+		mPickIds.erase(pick_info->pick_id);
+		LLAvatarPropertiesProcessor::getInstance()->removeObserver(LLUUID(), this);
+	}
+};
+
+LLPickHandler gPickHandler;
+
 class LLClassifiedHandler :
 	public LLCommandHandler,
 	public LLAvatarPropertiesObserver
@@ -80,6 +185,8 @@ class LLClassifiedHandler :
 
 	std::set<LLUUID> mClassifiedIds;
 
+	std::string mRequestVerb;
+	
 	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
 	{
 		// handle app/classified/create urls first
@@ -107,6 +214,15 @@ class LLClassifiedHandler :
 		const std::string verb = params[1].asString();
 		if (verb == "about")
 		{
+			mRequestVerb = verb;
+			mClassifiedIds.insert(classified_id);
+			LLAvatarPropertiesProcessor::getInstance()->addObserver(LLUUID(), this);
+			LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(classified_id);
+			return true;
+		}
+		else if (verb == "edit")
+		{
+			mRequestVerb = verb;
 			mClassifiedIds.insert(classified_id);
 			LLAvatarPropertiesProcessor::getInstance()->addObserver(LLUUID(), this);
 			LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(classified_id);
@@ -128,18 +244,39 @@ class LLClassifiedHandler :
 
 	void openClassified(LLAvatarClassifiedInfo* c_info)
 	{
-		// open the classified info panel on the Me > Picks sidetray
-		LLSD params;
-		params["id"] = c_info->creator_id;
-		params["open_tab_name"] = "panel_picks";
-		params["show_tab_panel"] = "classified_details";
-		params["classified_id"] = c_info->classified_id;
-		params["classified_creator_id"] = c_info->creator_id;
-		params["classified_snapshot_id"] = c_info->snapshot_id;
-		params["classified_name"] = c_info->name;
-		params["classified_desc"] = c_info->description;
-		params["from_search"] = true;
-		LLSideTray::getInstance()->showPanel("panel_profile_view", params);
+		if (mRequestVerb == "about")
+		{
+			// open the classified info panel on the Me > Picks sidetray
+			LLSD params;
+			params["id"] = c_info->creator_id;
+			params["open_tab_name"] = "panel_picks";
+			params["show_tab_panel"] = "classified_details";
+			params["classified_id"] = c_info->classified_id;
+			params["classified_creator_id"] = c_info->creator_id;
+			params["classified_snapshot_id"] = c_info->snapshot_id;
+			params["classified_name"] = c_info->name;
+			params["classified_desc"] = c_info->description;
+			params["from_search"] = true;
+			LLSideTray::getInstance()->showPanel("panel_profile_view", params);
+		}
+		else if (mRequestVerb == "edit")
+		{
+			if (c_info->creator_id == gAgent.getID())
+			{
+				llwarns << "edit in progress" << llendl;
+				// open the new classified panel on the Me > Picks sidetray
+				LLSD params;
+				params["id"] = gAgent.getID();
+				params["open_tab_name"] = "panel_picks";
+				params["show_tab_panel"] = "edit_classified";
+				params["classified_id"] = c_info->classified_id;
+				LLSideTray::getInstance()->showPanel("panel_me", params);
+			}
+			else
+			{
+				llwarns << "Can't edit a classified you did not create" << llendl;
+			}
+		}
 	}
 
 	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type)
@@ -299,7 +436,10 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type)
 				pick_value.insert(CLASSIFIED_ID, c_data.classified_id);
 				pick_value.insert(CLASSIFIED_NAME, c_data.name);
 
-				mClassifiedsList->addItem(c_item, pick_value);
+				if (!findClassifiedById(c_data.classified_id))
+				{
+					mClassifiedsList->addItem(c_item, pick_value);
+				}
 
 				c_item->setDoubleClickCallback(boost::bind(&LLPanelPicks::onDoubleClickClassifiedItem, this, _1));
 				c_item->setRightMouseUpCallback(boost::bind(&LLPanelPicks::onRightMouseUpItem, this, _1, _2, _3, _4));
@@ -776,6 +916,13 @@ void LLPanelPicks::openClassifiedInfo(const LLSD &params)
 	getProfilePanel()->openPanel(mPanelClassifiedInfo, params);
 }
 
+void LLPanelPicks::openClassifiedEdit(const LLSD& params)
+{
+	LLUUID classified_id = params["classified_id"].asUUID();;
+	llinfos << "opening classified " << classified_id << " for edit" << llendl;
+	editClassified(classified_id);
+}
+
 void LLPanelPicks::showAccordion(const std::string& name, bool show)
 {
 	LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(name);
@@ -945,6 +1092,12 @@ void LLPanelPicks::createPickEditPanel()
 // 	getProfilePanel()->openPanel(mPanelPickInfo, params);
 // }
 
+void LLPanelPicks::openPickEdit(const LLSD& params)
+{
+	createPickEditPanel();
+	getProfilePanel()->openPanel(mPanelPickEdit, params);
+}
+
 void LLPanelPicks::onPanelPickEdit()
 {
 	LLSD selected_value = mPicksList->getSelectedValue();
@@ -978,6 +1131,35 @@ void LLPanelPicks::onPanelClassifiedEdit()
 	{
 		return;
 	}
+	editClassified(c_item->getClassifiedId());
+}
+
+LLClassifiedItem *LLPanelPicks::findClassifiedById(const LLUUID& classified_id)
+{
+	// HACK - find item by classified id.  Should be a better way.
+	std::vector<LLPanel*> items;
+	mClassifiedsList->getItems(items);
+	LLClassifiedItem* c_item = NULL;
+	for(std::vector<LLPanel*>::iterator it = items.begin(); it != items.end(); ++it)
+	{
+		LLClassifiedItem *test_item = dynamic_cast<LLClassifiedItem*>(*it);
+		if (test_item && test_item->getClassifiedId() == classified_id)
+		{
+			c_item = test_item;
+			break;
+		}
+	}
+	return c_item;
+}
+
+void LLPanelPicks::editClassified(const LLUUID&  classified_id)
+{
+	LLClassifiedItem* c_item = findClassifiedById(classified_id);
+	if (!c_item)
+	{
+		llwarns << "item not found for classified_id " << classified_id << llendl;
+		return;
+	}
 
 	LLSD params;
 	params["classified_id"] = c_item->getClassifiedId();
diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h
old mode 100644
new mode 100755
index a02ed81bb06e1055fda0b6f52367f58153e4df51..29db1105233e8304ffe21927d2de447507789f55
--- a/indra/newview/llpanelpicks.h
+++ b/indra/newview/llpanelpicks.h
@@ -76,6 +76,7 @@ class LLPanelPicks
 	// returns the selected pick item
 	LLPickItem* getSelectedPickItem();
 	LLClassifiedItem* getSelectedClassifiedItem();
+	LLClassifiedItem* findClassifiedById(const LLUUID& classified_id);
 
 	//*NOTE top down approch when panel toggling is done only by 
 	// parent panels failed to work (picks related code was in my profile panel)
@@ -106,8 +107,10 @@ class LLPanelPicks
 	void onPanelPickSave(LLPanel* panel);
 	void onPanelClassifiedSave(LLPanelClassifiedEdit* panel);
 	void onPanelClassifiedClose(LLPanelClassifiedInfo* panel);
+	void openPickEdit(const LLSD& params);
 	void onPanelPickEdit();
 	void onPanelClassifiedEdit();
+	void editClassified(const LLUUID&  classified_id);
 	void onClickMenuEdit();
 
 	bool onEnableMenuItem(const LLSD& user_data);
@@ -118,6 +121,7 @@ class LLPanelPicks
 	void openPickInfo();
 	void openClassifiedInfo();
 	void openClassifiedInfo(const LLSD& params);
+	void openClassifiedEdit(const LLSD& params);
 	friend class LLPanelProfile;
 
 	void showAccordion(const std::string& name, bool show);
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 8ae3553857640f2461a665f6a341c3d340c50cfe..82ff6c3487e680e55eb9194e0150f3274d2272e6 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -92,7 +92,8 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
 	mZoomObjectID(LLUUID::null),
 	mZoomObjectFace(0),
 	mVolumeSliderVisible(0),
-	mWindowShade(NULL)
+	mWindowShade(NULL),
+	mHideImmediately(false)
 {
 	mCommitCallbackRegistrar.add("MediaCtrl.Close",		boost::bind(&LLPanelPrimMediaControls::onClickClose, this));
 	mCommitCallbackRegistrar.add("MediaCtrl.Back",		boost::bind(&LLPanelPrimMediaControls::onClickBack, this));
@@ -207,6 +208,8 @@ BOOL LLPanelPrimMediaControls::postBuild()
 		
 	mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
 	
+	gAgent.setMouselookModeInCallback(boost::bind(&LLPanelPrimMediaControls::onMouselookModeIn, this));
+
 	LLWindowShade::Params window_shade_params;
 	window_shade_params.name = "window_shade";
 
@@ -722,26 +725,22 @@ void LLPanelPrimMediaControls::draw()
 	}
 
 	F32 alpha = getDrawContext().mAlpha;
-	if(mFadeTimer.getStarted())
+	if(mHideImmediately)
+	{
+		//hide this panel
+		clearFaceOnFade();
+
+		mHideImmediately = false;
+	}
+	else if(mFadeTimer.getStarted())
 	{
 		F32 time = mFadeTimer.getElapsedTimeF32();
 		alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
 
 		if(time >= mControlFadeTime)
 		{
-			if(mClearFaceOnFade)
-			{
-				// Hiding this object makes scroll events go missing after it fades out 
-				// (see DEV-41755 for a full description of the train wreck).
-				// Only hide the controls when we're untargeting.
-				setVisible(FALSE);
-
-				mClearFaceOnFade = false;
-				mVolumeSliderVisible = 0;
-				mTargetImplID = LLUUID::null;
-				mTargetObjectID = LLUUID::null;
-				mTargetObjectFace = 0;
-			}
+			//hide this panel
+			clearFaceOnFade();
 		}
 	}
 	
@@ -1319,6 +1318,30 @@ bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
 	return mVolumeSliderVisible > 0;
 }
 
+
+void LLPanelPrimMediaControls::clearFaceOnFade()
+{
+	if(mClearFaceOnFade)
+	{
+		// Hiding this object makes scroll events go missing after it fades out
+		// (see DEV-41755 for a full description of the train wreck).
+		// Only hide the controls when we're untargeting.
+		setVisible(FALSE);
+
+		mClearFaceOnFade = false;
+		mVolumeSliderVisible = 0;
+		mTargetImplID = LLUUID::null;
+		mTargetObjectID = LLUUID::null;
+		mTargetObjectFace = 0;
+	}
+}
+
+void LLPanelPrimMediaControls::onMouselookModeIn()
+{
+	LLViewerMediaFocus::getInstance()->clearHover();
+	mHideImmediately = true;
+}
+
 void LLPanelPrimMediaControls::showNotification(LLNotificationPtr notify)
 {
 	delete mWindowShade;
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index 0b9664359c6ff7728d2542f1de1901fb1587f1c6..66956181f2b9d60146d967153711e4189460464b 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -59,6 +59,7 @@ class LLPanelPrimMediaControls : public LLPanel
 	void showNotification(LLNotificationPtr notify);
 	void hideNotification();
 
+
 	enum EZoomLevel
 	{
 		ZOOM_NONE = 0,
@@ -136,7 +137,11 @@ class LLPanelPrimMediaControls : public LLPanel
 	LLPluginClassMedia* getTargetMediaPlugin();
 	
 private:
-	
+
+	void clearFaceOnFade();
+
+	void onMouselookModeIn();
+
 	LLView *mMediaRegion;
 	LLUICtrl *mBackCtrl;
 	LLUICtrl *mFwdCtrl;
@@ -185,6 +190,7 @@ class LLPanelPrimMediaControls : public LLPanel
 	bool mPauseFadeout;
 	bool mUpdateSlider;
 	bool mClearFaceOnFade;
+	bool mHideImmediately;
 
 	LLMatrix4 mLastCameraMat;
 	EZoomLevel mCurrentZoom;
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
old mode 100644
new mode 100755
index b035d7d4733c007ea7c0088367afbf730c3f0513..4f13c0c022e42d4cefe30c665b48c746b407b2b8
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -33,10 +33,41 @@
 #include "llcommandhandler.h"
 #include "llpanelpicks.h"
 #include "lltabcontainer.h"
+#include "llviewercontrol.h"
 
 static const std::string PANEL_PICKS = "panel_picks";
 static const std::string PANEL_PROFILE = "panel_profile";
 
+std::string getProfileURL(const std::string& agent_name)
+{
+	std::string url = gSavedSettings.getString("WebProfileURL");
+	LLSD subs;
+	subs["AGENT_NAME"] = agent_name;
+	url = LLWeb::expandURLSubstitutions(url,subs);
+	LLStringUtil::toLower(url);
+	return url;
+}
+
+class LLProfileHandler : public LLCommandHandler
+{
+public:
+	// requires trusted browser to trigger
+	LLProfileHandler() : LLCommandHandler("profile", UNTRUSTED_THROTTLE) { }
+
+	bool handle(const LLSD& params, const LLSD& query_map,
+		LLMediaCtrl* web)
+	{
+		if (params.size() < 1) return false;
+		std::string agent_name = params[0];
+		llinfos << "Profile, agent_name " << agent_name << llendl;
+		std::string url = getProfileURL(agent_name);
+		LLWeb::loadWebURLInternal(url);
+
+		return true;
+	}
+};
+LLProfileHandler gProfileHandler;
+
 class LLAgentHandler : public LLCommandHandler
 {
 public:
@@ -281,6 +312,36 @@ void LLPanelProfile::onOpen(const LLSD& key)
 				picks->openClassifiedInfo(params);
 			}
 		}
+		else if (panel == "edit_classified")
+		{
+			LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
+			if (picks)
+			{
+				LLSD params = key;
+				params.erase("show_tab_panel");
+				params.erase("open_tab_name");
+				picks->openClassifiedEdit(params);
+			}
+		}
+		else if (panel == "create_pick")
+		{
+			LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
+			if (picks)
+			{
+				picks->createNewPick();
+			}
+		}
+		else if (panel == "edit_pick")
+		{
+			LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]);
+			if (picks)
+			{
+				LLSD params = key;
+				params.erase("show_tab_panel");
+				params.erase("open_tab_name");
+				picks->openPickEdit(params);
+			}
+		}
 	}
 }
 
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
old mode 100644
new mode 100755
index 0a572e6f25a58ae9326549f6b24f75dc72987b9b..fca359f51e1295ef68583dbdd6546c9ffe501498
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -32,6 +32,8 @@
 
 class LLTabContainer;
 
+std::string getProfileURL(const std::string& agent_name);
+
 /**
 * Base class for Profile View and My Profile.
 */
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index d0ebf047e8a314de691a4f8e7f301ca372eab3c5..22ff362b5a66d5c2c3869e78a7614ff7d1ed45e2 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -123,7 +123,9 @@ static bool have_script_upload_cap(LLUUID& object_id)
 class LLLiveLSLFile : public LLLiveFile
 {
 public:
-	LLLiveLSLFile(std::string file_path, LLLiveLSLEditor* parent);
+	typedef boost::function<bool (const std::string& filename)> change_callback_t;
+
+	LLLiveLSLFile(std::string file_path, change_callback_t change_cb);
 	~LLLiveLSLFile();
 
 	void ignoreNextUpdate() { mIgnoreNextUpdate = true; }
@@ -131,15 +133,16 @@ class LLLiveLSLFile : public LLLiveFile
 protected:
 	/*virtual*/ bool loadFile();
 
-	LLLiveLSLEditor*	mParent;
+	change_callback_t	mOnChangeCallback;
 	bool				mIgnoreNextUpdate;
 };
 
-LLLiveLSLFile::LLLiveLSLFile(std::string file_path, LLLiveLSLEditor* parent)
-:	mParent(parent)
+LLLiveLSLFile::LLLiveLSLFile(std::string file_path, change_callback_t change_cb)
+:	mOnChangeCallback(change_cb)
 ,	mIgnoreNextUpdate(false)
 ,	LLLiveFile(file_path, 1.0)
 {
+	llassert(mOnChangeCallback);
 }
 
 LLLiveLSLFile::~LLLiveLSLFile()
@@ -155,14 +158,7 @@ bool LLLiveLSLFile::loadFile()
 		return true;
 	}
 
-	if (!mParent->loadScriptText(filename()))
-	{
-		return false;
-	}
-
-	// Disable sync to avoid recursive load->save->load calls.
-	mParent->saveIfNeeded(false);
-	return true;
+	return mOnChangeCallback(filename());
 }
 
 /// ---------------------------------------------------------------------------
@@ -327,11 +323,11 @@ struct LLSECKeywordCompare
 };
 
 LLScriptEdCore::LLScriptEdCore(
+	LLScriptEdContainer* container,
 	const std::string& sample,
 	const LLHandle<LLFloater>& floater_handle,
 	void (*load_callback)(void*),
 	void (*save_callback)(void*, BOOL),
-	void (*edit_callback)(void*),
 	void (*search_replace_callback) (void* userdata),
 	void* userdata,
 	S32 bottom_pad)
@@ -341,19 +337,21 @@ LLScriptEdCore::LLScriptEdCore(
 	mEditor( NULL ),
 	mLoadCallback( load_callback ),
 	mSaveCallback( save_callback ),
-	mEditCallback( edit_callback ),
 	mSearchReplaceCallback( search_replace_callback ),
 	mUserdata( userdata ),
 	mForceClose( FALSE ),
 	mLastHelpToken(NULL),
 	mLiveHelpHistorySize(0),
 	mEnableSave(FALSE),
+	mLiveFile(NULL),
+	mContainer(container),
 	mHasScriptData(FALSE)
 {
 	setFollowsAll();
 	setBorderVisible(FALSE);
 
 	setXMLFilename("panel_script_ed.xml");
+	llassert_always(mContainer != NULL);
 }
 
 LLScriptEdCore::~LLScriptEdCore()
@@ -367,6 +365,8 @@ LLScriptEdCore::~LLScriptEdCore()
 		script_search->closeFloater();
 		delete script_search;
 	}
+
+	delete mLiveFile;
 }
 
 BOOL LLScriptEdCore::postBuild()
@@ -381,7 +381,7 @@ BOOL LLScriptEdCore::postBuild()
 
 	childSetCommitCallback("lsl errors", &LLScriptEdCore::onErrorList, this);
 	childSetAction("Save_btn", boost::bind(&LLScriptEdCore::doSave,this,FALSE));
-	childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::onEditButtonClick, this));
+	childSetAction("Edit_btn", boost::bind(&LLScriptEdCore::openInExternalEditor, this));
 
 	initMenu();
 
@@ -514,6 +514,79 @@ void LLScriptEdCore::setScriptText(const std::string& text, BOOL is_valid)
 	}
 }
 
+bool LLScriptEdCore::loadScriptText(const std::string& filename)
+{
+	if (filename.empty())
+	{
+		llwarns << "Empty file name" << llendl;
+		return false;
+	}
+
+	LLFILE* file = LLFile::fopen(filename, "rb");		/*Flawfinder: ignore*/
+	if (!file)
+	{
+		llwarns << "Error opening " << filename << llendl;
+		return false;
+	}
+
+	// read in the whole file
+	fseek(file, 0L, SEEK_END);
+	size_t file_length = (size_t) ftell(file);
+	fseek(file, 0L, SEEK_SET);
+	char* buffer = new char[file_length+1];
+	size_t nread = fread(buffer, 1, file_length, file);
+	if (nread < file_length)
+	{
+		llwarns << "Short read" << llendl;
+	}
+	buffer[nread] = '\0';
+	fclose(file);
+
+	mEditor->setText(LLStringExplicit(buffer));
+	delete[] buffer;
+
+	return true;
+}
+
+bool LLScriptEdCore::writeToFile(const std::string& filename)
+{
+	LLFILE* fp = LLFile::fopen(filename, "wb");
+	if (!fp)
+	{
+		llwarns << "Unable to write to " << filename << llendl;
+
+		LLSD row;
+		row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?";
+		row["columns"][0]["font"] = "SANSSERIF_SMALL";
+		mErrorList->addElement(row);
+		return false;
+	}
+
+	std::string utf8text = mEditor->getText();
+
+	// Special case for a completely empty script - stuff in one space so it can store properly.  See SL-46889
+	if (utf8text.size() == 0)
+	{
+		utf8text = " ";
+	}
+
+	fputs(utf8text.c_str(), fp);
+	fclose(fp);
+	return true;
+}
+
+void LLScriptEdCore::sync()
+{
+	// Sync with external editor.
+	std::string tmp_file = mContainer->getTmpFileName();
+	llstat s;
+	if (LLFile::stat(tmp_file, &s) == 0) // file exists
+	{
+		if (mLiveFile) mLiveFile->ignoreNextUpdate();
+		writeToFile(tmp_file);
+	}
+}
+
 bool LLScriptEdCore::hasChanged()
 {
 	if (!mEditor) return false;
@@ -690,6 +763,12 @@ BOOL LLScriptEdCore::canClose()
 	}
 }
 
+void LLScriptEdCore::setEnableEditing(bool enable)
+{
+	mEditor->setEnabled(enable);
+	getChildView("Edit_btn")->setEnabled(enable);
+}
+
 bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response )
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -862,11 +941,31 @@ void LLScriptEdCore::doSave( BOOL close_after_save )
 	}
 }
 
-void LLScriptEdCore::onEditButtonClick()
+void LLScriptEdCore::openInExternalEditor()
 {
-	if (mEditCallback)
+	delete mLiveFile; // deletes file
+
+	// Save the script to a temporary file.
+	std::string filename = mContainer->getTmpFileName();
+	writeToFile(filename);
+
+	// Start watching file changes.
+	mLiveFile = new LLLiveLSLFile(filename, boost::bind(&LLScriptEdContainer::onExternalChange, mContainer, _1));
+	mLiveFile->addToEventTimer();
+
+	// Open it in external editor.
 	{
-		mEditCallback(mUserdata);
+		LLExternalEditor ed;
+
+		if (!ed.setCommand("LL_SCRIPT_EDITOR"))
+		{
+			std::string msg = "Select an editor by setting the environment variable LL_SCRIPT_EDITOR "
+				"or the ExternalEditor setting"; // *TODO: localize
+			LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
+			return;
+		}
+
+		ed.run(filename);
 	}
 }
 
@@ -982,6 +1081,43 @@ BOOL LLScriptEdCore::handleKeyHere(KEY key, MASK mask)
 	return FALSE;
 }
 
+/// ---------------------------------------------------------------------------
+/// LLScriptEdContainer
+/// ---------------------------------------------------------------------------
+
+LLScriptEdContainer::LLScriptEdContainer(const LLSD& key)
+:	LLPreview(key)
+,	mScriptEd(NULL)
+{
+}
+
+std::string LLScriptEdContainer::getTmpFileName()
+{
+	// Take script inventory item id (within the object inventory)
+	// to consideration so that it's possible to edit multiple scripts
+	// in the same object inventory simultaneously (STORM-781).
+	std::string script_id = mObjectUUID.asString() + "_" + mItemUUID.asString();
+
+	// Use MD5 sum to make the file name shorter and not exceed maximum path length.
+	char script_id_hash_str[33];               /* Flawfinder: ignore */
+	LLMD5 script_id_hash((const U8 *)script_id.c_str());
+	script_id_hash.hex_digest(script_id_hash_str);
+
+	return std::string(LLFile::tmpdir()) + "sl_script_" + script_id_hash_str + ".lsl";
+}
+
+bool LLScriptEdContainer::onExternalChange(const std::string& filename)
+{
+	if (!mScriptEd->loadScriptText(filename))
+	{
+		return false;
+	}
+
+	// Disable sync to avoid recursive load->save->load calls.
+	saveIfNeeded(false);
+	return true;
+}
+
 /// ---------------------------------------------------------------------------
 /// LLPreviewLSL
 /// ---------------------------------------------------------------------------
@@ -1005,11 +1141,11 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata)
 	LLPreviewLSL *self = (LLPreviewLSL*)userdata;
 
 	self->mScriptEd =  new LLScriptEdCore(
+								   self,
 								   HELLO_LSL,
 								   self->getHandle(),
 								   LLPreviewLSL::onLoad,
 								   LLPreviewLSL::onSave,
-								   NULL, // no edit callback
 								   LLPreviewLSL::onSearchReplace,
 								   self,
 								   0);
@@ -1019,7 +1155,7 @@ void* LLPreviewLSL::createScriptEdPanel(void* userdata)
 
 
 LLPreviewLSL::LLPreviewLSL(const LLSD& key )
-  : LLPreview( key ),
+:	LLScriptEdContainer(key),
 	mPendingUploads(0)
 {
 	mFactoryMap["script panel"] = LLCallbackMap(LLPreviewLSL::createScriptEdPanel, this);
@@ -1110,7 +1246,6 @@ void LLPreviewLSL::loadAsset()
 		{
 			mScriptEd->setScriptText(mScriptEd->getString("can_not_view"), FALSE);
 			mScriptEd->mEditor->makePristine();
-			mScriptEd->mEditor->setEnabled(FALSE);
 			mScriptEd->mFunctions->setEnabled(FALSE);
 			mAssetStatus = PREVIEW_ASSET_LOADED;
 		}
@@ -1120,6 +1255,7 @@ void LLPreviewLSL::loadAsset()
 	else
 	{
 		mScriptEd->setScriptText(std::string(HELLO_LSL), TRUE);
+		mScriptEd->setEnableEditing(TRUE);
 		mAssetStatus = PREVIEW_ASSET_LOADED;
 	}
 }
@@ -1166,7 +1302,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save)
 // Save needs to compile the text in the buffer. If the compile
 // succeeds, then save both assets out to the database. If the compile
 // fails, go ahead and save the text anyway.
-void LLPreviewLSL::saveIfNeeded()
+void LLPreviewLSL::saveIfNeeded(bool sync /*= true*/)
 {
 	// llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl;
 	if(!mScriptEd->hasChanged())
@@ -1185,23 +1321,13 @@ void LLPreviewLSL::saveIfNeeded()
 	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_id.asString());
 	std::string filename = filepath + ".lsl";
 
-	LLFILE* fp = LLFile::fopen(filename, "wb");
-	if(!fp)
-	{
-		llwarns << "Unable to write to " << filename << llendl;
+	mScriptEd->writeToFile(filename);
 
-		LLSD row;
-		row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?";
-		row["columns"][0]["font"] = "SANSSERIF_SMALL";
-		mScriptEd->mErrorList->addElement(row);
-		return;
+	if (sync)
+	{
+		mScriptEd->sync();
 	}
 
-	std::string utf8text = mScriptEd->mEditor->getText();
-	fputs(utf8text.c_str(), fp);
-	fclose(fp);
-	fp = NULL;
-
 	const LLInventoryItem *inv_item = getItem();
 	// save it out to asset server
 	std::string url = gAgent.getRegion()->getCapability("UpdateScriptAgent");
@@ -1433,7 +1559,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset
 			{
 				is_modifiable = TRUE;		
 			}
-			preview->mScriptEd->mEditor->setEnabled(is_modifiable);
+			preview->mScriptEd->setEnableEditing(is_modifiable);
 			preview->mAssetStatus = PREVIEW_ASSET_LOADED;
 		}
 		else
@@ -1474,11 +1600,11 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata)
 	LLLiveLSLEditor *self = (LLLiveLSLEditor*)userdata;
 
 	self->mScriptEd =  new LLScriptEdCore(
+								   self,
 								   HELLO_LSL,
 								   self->getHandle(),
 								   &LLLiveLSLEditor::onLoad,
 								   &LLLiveLSLEditor::onSave,
-								   &LLLiveLSLEditor::onEdit,
 								   &LLLiveLSLEditor::onSearchReplace,
 								   self,
 								   0);
@@ -1488,14 +1614,12 @@ void* LLLiveLSLEditor::createScriptEdPanel(void* userdata)
 
 
 LLLiveLSLEditor::LLLiveLSLEditor(const LLSD& key) :
-	LLPreview(key),
-	mScriptEd(NULL),
+	LLScriptEdContainer(key),
 	mAskedForRunningInfo(FALSE),
 	mHaveRunningInfo(FALSE),
 	mCloseAfterSave(FALSE),
 	mPendingUploads(0),
 	mIsModifiable(FALSE),
-	mLiveFile(NULL),
 	mIsNew(false)
 {
 	mFactoryMap["script ed panel"] = LLCallbackMap(LLLiveLSLEditor::createScriptEdPanel, this);
@@ -1519,11 +1643,6 @@ BOOL LLLiveLSLEditor::postBuild()
 	return LLPreview::postBuild();
 }
 
-LLLiveLSLEditor::~LLLiveLSLEditor()
-{
-	delete mLiveFile;
-}
-
 // virtual
 void LLLiveLSLEditor::callbackLSLCompileSucceeded(const LLUUID& task_id,
 												  const LLUUID& item_id,
@@ -1580,7 +1699,6 @@ void LLLiveLSLEditor::loadAsset()
 				mItem = new LLViewerInventoryItem(item);
 				mScriptEd->setScriptText(getString("not_allowed"), FALSE);
 				mScriptEd->mEditor->makePristine();
-				mScriptEd->mEditor->setEnabled(FALSE);
 				mScriptEd->enableSave(FALSE);
 				mAssetStatus = PREVIEW_ASSET_LOADED;
 			}
@@ -1618,10 +1736,6 @@ void LLLiveLSLEditor::loadAsset()
 			mIsModifiable = item && gAgent.allowOperation(PERM_MODIFY, 
 										item->getPermissions(),
 				   						GP_OBJECT_MANIPULATE);
-			if(!mIsModifiable)
-			{
-				mScriptEd->mEditor->setEnabled(FALSE);
-			}
 			
 			// This is commented out, because we don't completely
 			// handle script exports yet.
@@ -1677,6 +1791,7 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id,
 		if( LL_ERR_NOERR == status )
 		{
 			instance->loadScriptText(vfs, asset_id, type);
+			instance->mScriptEd->setEnableEditing(TRUE);
 			instance->mAssetStatus = PREVIEW_ASSET_LOADED;
 		}
 		else
@@ -1703,40 +1818,6 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id,
 	delete xored_id;
 }
 
- bool LLLiveLSLEditor::loadScriptText(const std::string& filename)
- {
- 	if (filename.empty())
- 	{
- 		llwarns << "Empty file name" << llendl;
- 		return false;
- 	}
-
- 	LLFILE* file = LLFile::fopen(filename, "rb");		/*Flawfinder: ignore*/
- 	if (!file)
- 	{
- 		llwarns << "Error opening " << filename << llendl;
- 		return false;
- 	}
-
- 	// read in the whole file
-	fseek(file, 0L, SEEK_END);
-	size_t file_length = (size_t) ftell(file);
-	fseek(file, 0L, SEEK_SET);
-	char* buffer = new char[file_length+1];
-	size_t nread = fread(buffer, 1, file_length, file);
-	if (nread < file_length)
-	{
-		llwarns << "Short read" << llendl;
-	}
-	buffer[nread] = '\0';
-	fclose(file);
-	mScriptEd->mEditor->setText(LLStringExplicit(buffer));
-	//mScriptEd->mEditor->makePristine();
-	delete[] buffer;
-
-	return true;
- }
-
 void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type)
 {
 	LLVFile file(vfs, uuid, type);
@@ -1890,7 +1971,8 @@ LLLiveLSLSaveData::LLLiveLSLSaveData(const LLUUID& id,
 	mItem = new LLViewerInventoryItem(item);
 }
 
-void LLLiveLSLEditor::saveIfNeeded(bool sync)
+// virtual
+void LLLiveLSLEditor::saveIfNeeded(bool sync /*= true*/)
 {
 	LLViewerObject* object = gObjectList.findObject(mObjectUUID);
 	if(!object)
@@ -1941,18 +2023,11 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync)
 	mItem->setAssetUUID(asset_id);
 	mItem->setTransactionID(tid);
 
-	writeToFile(filename);
+	mScriptEd->writeToFile(filename);
 
 	if (sync)
 	{
-		// Sync with external ed2itor.
-		std::string tmp_file = getTmpFileName();
-		llstat s;
-		if (LLFile::stat(tmp_file, &s) == 0) // file exists
-		{
-			if (mLiveFile) mLiveFile->ignoreNextUpdate();
-			writeToFile(tmp_file);
-		}
+		mScriptEd->sync();
 	}
 	
 	// save it out to asset server
@@ -1970,83 +2045,6 @@ void LLLiveLSLEditor::saveIfNeeded(bool sync)
 	}
 }
 
-void LLLiveLSLEditor::openExternalEditor()
-{
-	LLViewerObject* object = gObjectList.findObject(mObjectUUID);
-	if(!object)
-	{
-		LLNotificationsUtil::add("SaveScriptFailObjectNotFound");
-		return;
-	}
-
-	delete mLiveFile; // deletes file
-
-	// Save the script to a temporary file.
-	std::string filename = getTmpFileName();
-	writeToFile(filename);
-
-	// Start watching file changes.
-	mLiveFile = new LLLiveLSLFile(filename, this);
-	mLiveFile->addToEventTimer();
-
-	// Open it in external editor.
-	{
-		LLExternalEditor ed;
-
-		if (!ed.setCommand("LL_SCRIPT_EDITOR"))
-		{
-			std::string msg = "Select an editor by setting the environment variable LL_SCRIPT_EDITOR "
-				"or the ExternalEditor setting"; // *TODO: localize
-			LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg));
-			return;
-		}
-
-		ed.run(filename);
-	}
-}
-
-bool LLLiveLSLEditor::writeToFile(const std::string& filename)
-{
-	LLFILE* fp = LLFile::fopen(filename, "wb");
-	if (!fp)
-	{
-		llwarns << "Unable to write to " << filename << llendl;
-
-		LLSD row;
-		row["columns"][0]["value"] = "Error writing to local file. Is your hard drive full?";
-		row["columns"][0]["font"] = "SANSSERIF_SMALL";
-		mScriptEd->mErrorList->addElement(row);
-		return false;
-	}
-
-	std::string utf8text = mScriptEd->mEditor->getText();
-
-	// Special case for a completely empty script - stuff in one space so it can store properly.  See SL-46889
-	if (utf8text.size() == 0)
-	{
-		utf8text = " ";
-	}
-
-	fputs(utf8text.c_str(), fp);
-	fclose(fp);
-	return true;
-}
-
-std::string LLLiveLSLEditor::getTmpFileName()
-{
-	// Take script inventory item id (within the object inventory)
-	// to consideration so that it's possible to edit multiple scripts
-	// in the same object inventory simultaneously (STORM-781).
-	std::string script_id = mObjectUUID.asString() + "_" + mItemUUID.asString();
-
-	// Use MD5 sum to make the file name shorter and not exceed maximum path length.
-	char script_id_hash_str[33];               /* Flawfinder: ignore */
-	LLMD5 script_id_hash((const U8 *)script_id.c_str());
-	script_id_hash.hex_digest(script_id_hash_str);
-
-	return std::string(LLFile::tmpdir()) + "sl_script_" + script_id_hash_str + ".lsl";
-}
-
 void LLLiveLSLEditor::uploadAssetViaCaps(const std::string& url,
 										 const std::string& filename,
 										 const LLUUID& task_id,
@@ -2270,13 +2268,6 @@ void LLLiveLSLEditor::onSave(void* userdata, BOOL close_after_save)
 }
 
 
-// static
-void LLLiveLSLEditor::onEdit(void* userdata)
-{
-	LLLiveLSLEditor* self = (LLLiveLSLEditor*)userdata;
-	self->openExternalEditor();
-}
-
 // static
 void LLLiveLSLEditor::processScriptRunningReply(LLMessageSystem* msg, void**)
 {
diff --git a/indra/newview/llpreviewscript.h b/indra/newview/llpreviewscript.h
index d35c6b85283b0445ee09b2b69f3f414f76b64544..f86be615c44ce396f69d295b7480ae545aeadf13 100644
--- a/indra/newview/llpreviewscript.h
+++ b/indra/newview/llpreviewscript.h
@@ -48,6 +48,7 @@ class LLFloaterScriptSearch;
 class LLKeywordToken;
 class LLVFS;
 class LLViewerInventoryItem;
+class LLScriptEdContainer;
 
 // Inner, implementation class.  LLPreviewScript and LLLiveLSLEditor each own one of these.
 class LLScriptEdCore : public LLPanel
@@ -56,17 +57,20 @@ class LLScriptEdCore : public LLPanel
 	friend class LLPreviewLSL;
 	friend class LLLiveLSLEditor;
 	friend class LLFloaterScriptSearch;
+	friend class LLScriptEdContainer;
 
-public:
+protected:
+	// Supposed to be invoked only by the container.
 	LLScriptEdCore(
+		LLScriptEdContainer* container,
 		const std::string& sample,
 		const LLHandle<LLFloater>& floater_handle,
 		void (*load_callback)(void* userdata),
 		void (*save_callback)(void* userdata, BOOL close_after_save),
-		void (*edit_callback)(void*),
 		void (*search_replace_callback)(void* userdata),
 		void* userdata,
 		S32 bottom_pad = 0);	// pad below bottom row of buttons
+public:
 	~LLScriptEdCore();
 	
 	void			initMenu();
@@ -74,15 +78,19 @@ class LLScriptEdCore : public LLPanel
 	virtual void	draw();
 	/*virtual*/	BOOL	postBuild();
 	BOOL			canClose();
+	void			setEnableEditing(bool enable);
 
 	void            setScriptText(const std::string& text, BOOL is_valid);
+	bool			loadScriptText(const std::string& filename);
+	bool			writeToFile(const std::string& filename);
+	void			sync();
 	
 	void			doSave( BOOL close_after_save );
 
 	bool			handleSaveChangesDialog(const LLSD& notification, const LLSD& response);
 	bool			handleReloadFromServerDialog(const LLSD& notification, const LLSD& response);
 
-	void			onEditButtonClick();
+	void			openInExternalEditor();
 
 	static void		onCheckLock(LLUICtrl*, void*);
 	static void		onHelpComboCommit(LLUICtrl* ctrl, void* userdata);
@@ -118,7 +126,6 @@ class LLScriptEdCore : public LLPanel
 	LLTextEditor*	mEditor;
 	void			(*mLoadCallback)(void* userdata);
 	void			(*mSaveCallback)(void* userdata, BOOL close_after_save);
-	void			(*mEditCallback)(void* userdata);
 	void			(*mSearchReplaceCallback) (void* userdata);
 	void*			mUserdata;
 	LLComboBox		*mFunctions;
@@ -132,11 +139,28 @@ class LLScriptEdCore : public LLPanel
 	S32				mLiveHelpHistorySize;
 	BOOL			mEnableSave;
 	BOOL			mHasScriptData;
+	LLLiveLSLFile*	mLiveFile;
+
+	LLScriptEdContainer* mContainer; // parent view
 };
 
+class LLScriptEdContainer : public LLPreview
+{
+	friend class LLScriptEdCore;
+
+public:
+	LLScriptEdContainer(const LLSD& key);
+
+protected:
+	std::string		getTmpFileName();
+	bool			onExternalChange(const std::string& filename);
+	virtual void	saveIfNeeded(bool sync = true) = 0;
+
+	LLScriptEdCore*		mScriptEd;
+};
 
 // Used to view and edit a LSL from your inventory.
-class LLPreviewLSL : public LLPreview
+class LLPreviewLSL : public LLScriptEdContainer
 {
 public:
 	LLPreviewLSL(const LLSD& key );
@@ -150,7 +174,7 @@ class LLPreviewLSL : public LLPreview
 	void closeIfNeeded();
 
 	virtual void loadAsset();
-	void saveIfNeeded();
+	/*virtual*/ void saveIfNeeded(bool sync = true);
 	void uploadAssetViaCaps(const std::string& url,
 							const std::string& filename, 
 							const LLUUID& item_id);
@@ -174,7 +198,6 @@ class LLPreviewLSL : public LLPreview
 
 protected:
 
-	LLScriptEdCore* mScriptEd;
 	// Can safely close only after both text and bytecode are uploaded
 	S32 mPendingUploads;
 
@@ -182,12 +205,11 @@ class LLPreviewLSL : public LLPreview
 
 
 // Used to view and edit an LSL that is attached to an object.
-class LLLiveLSLEditor : public LLPreview
+class LLLiveLSLEditor : public LLScriptEdContainer
 {
 	friend class LLLiveLSLFile;
 public: 
 	LLLiveLSLEditor(const LLSD& key);
-	~LLLiveLSLEditor();
 
 
 	static void processScriptRunningReply(LLMessageSystem* msg, void**);
@@ -208,10 +230,7 @@ class LLLiveLSLEditor : public LLPreview
 
 	virtual void loadAsset();
 	void loadAsset(BOOL is_new);
-	void saveIfNeeded(bool sync = true);
-	void openExternalEditor();
-	std::string getTmpFileName();
-	bool writeToFile(const std::string& filename);
+	/*virtual*/ void saveIfNeeded(bool sync = true);
 	void uploadAssetViaCaps(const std::string& url,
 							const std::string& filename, 
 							const LLUUID& task_id,
@@ -227,7 +246,6 @@ class LLLiveLSLEditor : public LLPreview
 	static void onSearchReplace(void* userdata);
 	static void onLoad(void* userdata);
 	static void onSave(void* userdata, BOOL close_after_save);
-	static void onEdit(void* userdata);
 
 	static void onLoadComplete(LLVFS *vfs, const LLUUID& asset_uuid,
 							   LLAssetType::EType type,
@@ -237,7 +255,6 @@ class LLLiveLSLEditor : public LLPreview
 	static void onRunningCheckboxClicked(LLUICtrl*, void* userdata);
 	static void onReset(void* userdata);
 
- 	bool loadScriptText(const std::string& filename);
 	void loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type);
 
 	static void onErrorList(LLUICtrl*, void* user_data);
@@ -248,7 +265,6 @@ class LLLiveLSLEditor : public LLPreview
 
 private:
 	bool				mIsNew;
-	LLScriptEdCore*		mScriptEd;
 	//LLUUID mTransmitID;
 	LLCheckBoxCtrl*		mRunningCheckbox;
 	BOOL				mAskedForRunningInfo;
@@ -263,7 +279,6 @@ class LLLiveLSLEditor : public LLPreview
 	
 	LLCheckBoxCtrl*	mMonoCheckbox;
 	BOOL mIsModifiable;
-	LLLiveLSLFile*		mLiveFile;
 };
 
 #endif  // LL_LLPREVIEWSCRIPT_H
diff --git a/indra/newview/llremoteparcelrequest.cpp b/indra/newview/llremoteparcelrequest.cpp
index e5ef51bdd18c6b54c1ac0e801fa3567f6f15ec87..3862dac340d0db44d3ed0411a56c7cbee3a4ac01 100644
--- a/indra/newview/llremoteparcelrequest.cpp
+++ b/indra/newview/llremoteparcelrequest.cpp
@@ -33,6 +33,7 @@
 #include "llpanel.h"
 #include "llhttpclient.h"
 #include "llsdserialize.h"
+#include "llurlentry.h"
 #include "llviewerregion.h"
 #include "llview.h"
 
@@ -168,6 +169,18 @@ void LLRemoteParcelInfoProcessor::processParcelInfoReply(LLMessageSystem* msg, v
 	{
 		observers.erase(*i);
 	}
+
+	LLUrlEntryParcel::LLParcelData url_data;
+	url_data.parcel_id = parcel_data.parcel_id;
+	url_data.name = parcel_data.name;
+	url_data.sim_name = parcel_data.sim_name;
+	url_data.global_x = parcel_data.global_x;
+	url_data.global_y = parcel_data.global_y;
+	url_data.global_z = parcel_data.global_z;
+
+	// Pass the parcel data to LLUrlEntryParcel to render
+	// human readable parcel name.
+	LLUrlEntryParcel::processParcelInfo(url_data);
 }
 
 void LLRemoteParcelInfoProcessor::sendParcelInfoRequest(const LLUUID& parcel_id)
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 7478ed5f9a3db2d1ff850a048c2f7c632e9d8d17..65a9a493f606f5bd69e39c1c0247c6e9ee95afb7 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -235,7 +235,7 @@ class LLObjectSelection : public LLRefCount
 	{
 		bool operator()(LLSelectNode* node);
 	};
-	typedef boost::filter_iterator<is_root, list_t::iterator > valid_root_iterator;
+	typedef boost::filter_iterator<is_valid_root, list_t::iterator > valid_root_iterator;
 	valid_root_iterator valid_root_begin() { return valid_root_iterator(mList.begin(), mList.end()); }
 	valid_root_iterator valid_root_end() { return valid_root_iterator(mList.end(), mList.end()); }
 	
diff --git a/indra/newview/llshareavatarhandler.cpp b/indra/newview/llshareavatarhandler.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..34194970b82c9dee53170fb58cd3ce2f72f96bdf
--- /dev/null
+++ b/indra/newview/llshareavatarhandler.cpp
@@ -0,0 +1,59 @@
+/** 
+ * @file llshareavatarhandler.cpp
+ * @brief slapp to handle sharing with an avatar
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llcommandhandler.h"
+#include "llavataractions.h"
+
+class LLShareWithAvatarHandler : public LLCommandHandler
+{
+public: 
+	// requires trusted browser to trigger
+	LLShareWithAvatarHandler() : LLCommandHandler("sharewithavatar", UNTRUSTED_THROTTLE) 
+	{ 
+	}
+	
+	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+	{
+		//Make sure we have some parameters
+		if (params.size() == 0)
+		{
+			return false;
+		}
+		
+		//Get the ID
+		LLUUID id;
+		if (!id.set( params[0], FALSE ))
+		{
+			return false;
+		}
+		
+		//instigate share with this avatar
+		LLAvatarActions::share( id );		
+		return true;
+	}
+};
+LLShareWithAvatarHandler gShareWithAvatar;
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index b316171604a52ca57471c8d6e464b314952cef48..363fe5f12b80f6a6b1453130458c183ae588ce7b 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -185,7 +185,7 @@ void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
 {
 	LLSD visibility;
 	visibility["visible"] = new_visibility.asBoolean();
-	visibility["reset_accordion"] = true;
+	visibility["reset_accordion"] = false;
 	updateToVisibility(visibility);
 }
 
diff --git a/indra/newview/llsidepaneltaskinfo.cpp b/indra/newview/llsidepaneltaskinfo.cpp
index 47d904dfcc7d15567dd8ead74b57974999f871c1..8774482acdfd261da04de871b3faf603fe1ba4c8 100644
--- a/indra/newview/llsidepaneltaskinfo.cpp
+++ b/indra/newview/llsidepaneltaskinfo.cpp
@@ -1120,17 +1120,17 @@ void LLSidepanelTaskInfo::updateVerbs()
 	*/
 
 	LLSafeHandle<LLObjectSelection> object_selection = LLSelectMgr::getInstance()->getSelection();
-	const BOOL multi_select = (object_selection->getNumNodes() > 1);
+	const BOOL any_selected = (object_selection->getNumNodes() > 0);
 
-	mOpenBtn->setVisible(!multi_select);
-	mPayBtn->setVisible(!multi_select);
-	mBuyBtn->setVisible(!multi_select);
-	mDetailsBtn->setVisible(multi_select);
-	mDetailsBtn->setEnabled(multi_select);
+	mOpenBtn->setVisible(true);
+	mPayBtn->setVisible(true);
+	mBuyBtn->setVisible(true);
+	mDetailsBtn->setVisible(true);
 
 	mOpenBtn->setEnabled(enable_object_open());
 	mPayBtn->setEnabled(enable_pay_object());
 	mBuyBtn->setEnabled(enable_buy_object());
+	mDetailsBtn->setEnabled(any_selected);
 }
 
 void LLSidepanelTaskInfo::onOpenButtonClicked()
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index aef665a35cd4db8079689d71296109b8f8dc4c40..19d1bdee862b5bafd624cae04bb367724fd0eb2d 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -498,8 +498,8 @@ class LLSideTrayButton : public LLButton
 
 LLSideTray::Params::Params()
 :	collapsed("collapsed",false),
-	tab_btn_image_normal("tab_btn_image",LLUI::getUIImage("sidebar_tab_left.tga")),
-	tab_btn_image_selected("tab_btn_image_selected",LLUI::getUIImage("button_enabled_selected_32x128.tga")),
+	tab_btn_image_normal("tab_btn_image",LLUI::getUIImage("taskpanel/TaskPanel_Tab_Off.png")),
+	tab_btn_image_selected("tab_btn_image_selected",LLUI::getUIImage("taskpanel/TaskPanel_Tab_Selected.png")),
 	default_button_width("tab_btn_width",32),
 	default_button_height("tab_btn_height",32),
 	default_button_margin("tab_btn_margin",0)
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 960e72ee421e9b3ac65de574fc0489ca81273c7a..8adb8c30e05410e2f6e393ca38bb9363bc89710c 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2578,6 +2578,49 @@ void renderCrossHairs(LLVector3 position, F32 size, LLColor4 color)
 	gGL.end();
 }
 
+void renderUpdateType(LLDrawable* drawablep)
+{
+	LLViewerObject* vobj = drawablep->getVObj();
+	if (!vobj || OUT_UNKNOWN == vobj->getLastUpdateType())
+	{
+		return;
+	}
+	LLGLEnable blend(GL_BLEND);
+	switch (vobj->getLastUpdateType())
+	{
+	case OUT_FULL:
+		glColor4f(0,1,0,0.5f);
+		break;
+	case OUT_TERSE_IMPROVED:
+		glColor4f(0,1,1,0.5f);
+		break;
+	case OUT_FULL_COMPRESSED:
+		if (vobj->getLastUpdateCached())
+		{
+			glColor4f(1,0,0,0.5f);
+		}
+		else
+		{
+			glColor4f(1,1,0,0.5f);
+		}
+		break;
+	case OUT_FULL_CACHED:
+		glColor4f(0,0,1,0.5f);
+		break;
+	default:
+		llwarns << "Unknown update_type " << vobj->getLastUpdateType() << llendl;
+		break;
+	};
+	S32 num_faces = drawablep->getNumFaces();
+	if (num_faces)
+	{
+		for (S32 i = 0; i < num_faces; ++i)
+		{
+			pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX);
+		}
+	}
+}
+
 
 void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
 {
@@ -3018,6 +3061,10 @@ class LLOctreeRenderNonOccluded : public LLOctreeTraveler<LLDrawable>
 			{
 				renderRaycast(drawable);
 			}
+			if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_UPDATE_TYPE))
+			{
+				renderUpdateType(drawable);
+			}
 
 			LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(drawable->getVObj().get());
 			
@@ -3180,6 +3227,7 @@ void LLSpatialPartition::renderDebug()
 									  LLPipeline::RENDER_DEBUG_OCCLUSION |
 									  LLPipeline::RENDER_DEBUG_LIGHTS |
 									  LLPipeline::RENDER_DEBUG_BATCH_SIZE |
+									  LLPipeline::RENDER_DEBUG_UPDATE_TYPE |
 									  LLPipeline::RENDER_DEBUG_BBOXES |
 									  LLPipeline::RENDER_DEBUG_POINTS |
 									  LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY |
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 611f9de2e6db8dcdb24f2edf9fe9789c0bcd6684..0eac7d5e2a7464127611cdf6225ba387b32fb14a 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -139,6 +139,7 @@
 #include "lltrans.h"
 #include "llui.h"
 #include "llurldispatcher.h"
+#include "llurlentry.h"
 #include "llslurl.h"
 #include "llurlhistory.h"
 #include "llurlwhitelist.h"
@@ -980,7 +981,6 @@ bool idle_startup()
 			login->setSkipOptionalUpdate(true);
 		}
 
-		login->setUserInteraction(show_connect_box);
 		login->setSerialNumber(LLAppViewer::instance()->getSerialNumber());
 		login->setLastExecEvent(gLastExecEvent);
 		login->setUpdaterLauncher(boost::bind(&LLAppViewer::launchUpdater, LLAppViewer::instance()));
@@ -2882,9 +2882,17 @@ bool process_login_success_response()
 	if(!text.empty()) gAgentID.set(text);
 	gDebugInfo["AgentID"] = text;
 	
+	// Agent id needed for parcel info request in LLUrlEntryParcel
+	// to resolve parcel name.
+	LLUrlEntryParcel::setAgentID(gAgentID);
+
 	text = response["session_id"].asString();
 	if(!text.empty()) gAgentSessionID.set(text);
 	gDebugInfo["SessionID"] = text;
+
+	// Session id needed for parcel info request in LLUrlEntryParcel
+	// to resolve parcel name.
+	LLUrlEntryParcel::setSessionID(gAgentSessionID);
 	
 	text = response["secure_session_id"].asString();
 	if(!text.empty()) gAgent.mSecureSessionID.set(text);
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 6a213309a0bff583ceb3b205df5fd4189ee01b40..92080d1fd75757d37706711dd6153628aabc8951 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1858,8 +1858,22 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id)
 //called after mHeaderMutex is locked.
 void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
 {
+ 	bool file_maybe_exists = true;	// Always attempt to remove when idx is invalid.
+
 	if(idx >= 0) //valid entry
 	{
+		if (entry.mBodySize == 0)	// Always attempt to remove when mBodySize > 0.
+		{
+		  if (LLAPRFile::isExist(filename, getLocalAPRFilePool()))		// Sanity check. Shouldn't exist when body size is 0.
+		  {
+			  LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL;
+		  }
+		  else
+		  {
+			  file_maybe_exists = false;
+		  }
+		}
+
 		entry.mImageSize = -1;
 		entry.mBodySize = 0;
 		mHeaderIDMap.erase(entry.mID);
@@ -1869,7 +1883,10 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
 		mFreeList.insert(idx);	
 	}
 
-	LLAPRFile::remove(filename, getLocalAPRFilePool());		
+	if (file_maybe_exists)
+	{
+		LLAPRFile::remove(filename, getLocalAPRFilePool());		
+	}
 }
 
 bool LLTextureCache::removeFromCache(const LLUUID& id)
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 7dbaa4cf9286875f25caa0baaad5479e667c7aac..cc851e676b7035e3248e3d3684bedcea64e95775 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -48,6 +48,7 @@
 #include "llinventorybridge.h"
 #include "llinventorypanel.h"
 #include "llfloaterinventory.h"
+#include "lllandmarkactions.h"
 
 #include "llviewerassettype.h"
 #include "llviewerregion.h"
@@ -59,6 +60,9 @@
 #include "llcommandhandler.h"
 #include "llviewermessage.h"
 #include "llsidepanelappearance.h"
+#include "llavatarnamecache.h"
+#include "llavataractions.h"
+#include "lllogininstance.h"
 
 ///----------------------------------------------------------------------------
 /// Helper class to store special inventory item names and their localized values.
@@ -211,6 +215,7 @@ class LLInventoryHandler : public LLCommandHandler
 };
 LLInventoryHandler gInventoryHandler;
 
+
 ///----------------------------------------------------------------------------
 /// Class LLViewerInventoryItem
 ///----------------------------------------------------------------------------
@@ -361,11 +366,11 @@ void LLViewerInventoryItem::fetchFromServer(void) const
 		{
 		  if(gAgent.getID() != mPermissions.getOwner())
 		    {
-		      url = region->getCapability("FetchLib");
+		      url = region->getCapability("FetchLib2");
 		    }
 		  else
 		    {	
-		      url = region->getCapability("FetchInventory");
+		      url = region->getCapability("FetchInventory2");
 		    }
 		}
 		else
@@ -643,7 +648,7 @@ bool LLViewerInventoryCategory::fetch()
 		std::string url;
 		if (gAgent.getRegion())
 		{
-			url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
+			url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");
 		}
 		else
 		{
@@ -655,7 +660,7 @@ bool LLViewerInventoryCategory::fetch()
 		}
 		else
 		{	//Deprecated, but if we don't have a capability, use the old system.
-			llinfos << "WebFetchInventoryDescendents capability not found.  Using deprecated UDP message." << llendl;
+			llinfos << "FetchInventoryDescendents2 capability not found.  Using deprecated UDP message." << llendl;
 			LLMessageSystem* msg = gMessageSystem;
 			msg->newMessage("FetchInventoryDescendents");
 			msg->nextBlock("AgentData");
@@ -1414,6 +1419,8 @@ class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
 	S32 getSortIndex(const LLUUID& inv_item_id);
 	void removeSortIndex(const LLUUID& inv_item_id);
 
+	void getSLURL(const LLUUID& asset_id);
+
 	/**
 	 * Implementation of LLDestroyClass. Calls cleanup() instance method.
 	 *
@@ -1440,9 +1447,17 @@ class LLFavoritesOrderStorage : public LLSingleton<LLFavoritesOrderStorage>
 	void load();
 	void save();
 
+	void saveFavoritesSLURLs();
+
+	void onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark);
+	void storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl);
+
 	typedef std::map<LLUUID, S32> sort_index_map_t;
 	sort_index_map_t mSortIndexes;
 
+	typedef std::map<LLUUID, std::string> slurls_map_t;
+	slurls_map_t mSLURLs;
+
 	bool mIsDirty;
 
 	struct IsNotInFavorites
@@ -1497,10 +1512,27 @@ void LLFavoritesOrderStorage::removeSortIndex(const LLUUID& inv_item_id)
 	mIsDirty = true;
 }
 
+void LLFavoritesOrderStorage::getSLURL(const LLUUID& asset_id)
+{
+	slurls_map_t::iterator slurl_iter = mSLURLs.find(asset_id);
+	if (slurl_iter != mSLURLs.end()) return; // SLURL for current landmark is already cached
+
+	LLLandmark* lm = gLandmarkList.getAsset(asset_id,
+			boost::bind(&LLFavoritesOrderStorage::onLandmarkLoaded, this, asset_id, _1));
+	if (lm)
+	{
+		onLandmarkLoaded(asset_id, lm);
+	}
+}
+
 // static
 void LLFavoritesOrderStorage::destroyClass()
 {
 	LLFavoritesOrderStorage::instance().cleanup();
+	if (gSavedPerAccountSettings.getBOOL("ShowFavoritesOnLogin"))
+	{
+		LLFavoritesOrderStorage::instance().saveFavoritesSLURLs();
+	}
 }
 
 void LLFavoritesOrderStorage::load()
@@ -1523,6 +1555,76 @@ void LLFavoritesOrderStorage::load()
 	}
 }
 
+void LLFavoritesOrderStorage::saveFavoritesSLURLs()
+{
+	// Do not change the file if we are not logged in yet.
+	if (!LLLoginInstance::getInstance()->authSuccess()) return;
+	
+	std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "");
+	if (user_dir.empty()) return;
+
+	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
+	llifstream in_file;
+	in_file.open(filename);
+	LLSD fav_llsd;
+	if (in_file.is_open())
+	{
+		LLSDSerialize::fromXML(fav_llsd, in_file);
+	}
+
+	const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	gInventory.collectDescendents(fav_id, cats, items, LLInventoryModel::EXCLUDE_TRASH);
+
+	LLSD user_llsd;
+	for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++)
+	{
+		LLSD value;
+		value["name"] = (*it)->getName();
+		value["asset_id"] = (*it)->getAssetUUID();
+
+		slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]);
+		if (slurl_iter != mSLURLs.end())
+		{
+			value["slurl"] = slurl_iter->second;
+			user_llsd[(*it)->getSortField()] = value;
+		}
+	}
+
+	LLAvatarName av_name;
+	LLAvatarNameCache::get( gAgentID, &av_name );
+	fav_llsd[av_name.getLegacyName()] = user_llsd;
+
+	llofstream file;
+	file.open(filename);
+	LLSDSerialize::toPrettyXML(fav_llsd, file);
+}
+
+void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark)
+{
+	if (!landmark) return;
+
+	LLVector3d pos_global;
+	if (!landmark->getGlobalPos(pos_global))
+	{
+		// If global position was unknown on first getGlobalPos() call
+		// it should be set for the subsequent calls.
+		landmark->getGlobalPos(pos_global);
+	}
+
+	if (!pos_global.isExactlyZero())
+	{
+		LLLandmarkActions::getSLURLfromPosGlobal(pos_global,
+				boost::bind(&LLFavoritesOrderStorage::storeFavoriteSLURL, this, asset_id, _1));
+	}
+}
+
+void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl)
+{
+	mSLURLs[asset_id] = slurl;
+}
+
 void LLFavoritesOrderStorage::save()
 {
 	// nothing to save if clean
@@ -1579,6 +1681,12 @@ S32 LLViewerInventoryItem::getSortField() const
 void LLViewerInventoryItem::setSortField(S32 sortField)
 {
 	LLFavoritesOrderStorage::instance().setSortIndex(mUUID, sortField);
+	getSLURL();
+}
+
+void LLViewerInventoryItem::getSLURL()
+{
+	LLFavoritesOrderStorage::instance().getSLURL(mAssetUUID);
 }
 
 const LLPermissions& LLViewerInventoryItem::getPermissions() const
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index 1af06a1be82d254441c0a336a578a306e649e7fe..41542a4e0ff9a20bd51043a8a1f9052ccc8835cc 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -62,6 +62,7 @@ class LLViewerInventoryItem : public LLInventoryItem, public boost::signals2::tr
 	virtual const std::string& getName() const;
 	virtual S32 getSortField() const;
 	virtual void setSortField(S32 sortField);
+	virtual void getSLURL(); //Caches SLURL for landmark. //*TODO: Find a better way to do it and remove this method from here.
 	virtual const LLPermissions& getPermissions() const;
 	virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied
 	virtual const LLUUID& getCreatorUUID() const;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 9e16bf2fbb0fc362ceae59b1e2e7a523f4c3d07f..7cc04e0338a0e81e8be7c2c3831531e4b471dfed 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -557,7 +557,7 @@ class LLAdvancedCheckConsole : public view_listener_t
 			new_value = get_visibility( (void*)gDebugView->mMemoryView );
 		}
 #endif
-
+		
 		return new_value;
 	}
 };
@@ -906,6 +906,10 @@ U32 info_display_from_string(std::string info_display)
 	{
 		return LLPipeline::RENDER_DEBUG_BATCH_SIZE;
 	}
+	else if ("update type" == info_display)
+	{
+		return LLPipeline::RENDER_DEBUG_UPDATE_TYPE;
+	}
 	else if ("texture anim" == info_display)
 	{
 		return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM;
@@ -4197,9 +4201,9 @@ class LLObjectEnableReturn : public view_listener_t
 					{
 						virtual bool apply(LLViewerObject* obj)
 						{
-							return (obj->isOverAgentOwnedLand() ||
-									obj->isOverGroupOwnedLand() ||
-									obj->permModify());
+							return 
+								obj->permModify() ||
+								obj->isReturnable();
 						}
 					} func;
 					const bool firstonly = true;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7dc5d96689d4449471ee7a736ca676137f444bf4..6fc85a39449ac2b44bc13747dd1106802b18bc4d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -171,31 +171,6 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] =
 	FALSE	// ControlYourCamera
 };
 
-// Extract channel and version from a string like "SL Web Viewer Beta 10.11.29.215604".
-// (channel: "SL Web Viewer Beta", version: "10.11.29.215604")
-static bool parse_version_info(const std::string& version_info, std::string& channel, std::string& ver)
-{
-	size_t last_space = version_info.rfind(" ");
-	channel = version_info;
-
-	if (last_space != std::string::npos)
-	{
-		try
-		{
-			ver = version_info.substr(last_space + 1);
-			channel.replace(last_space, ver.length() + 1, ""); // strip version
-		}
-		catch (std::out_of_range)
-		{
-			return false;
-		}
-
-		return true;
-	}
-
-	return false;
-}
-
 bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -3848,31 +3823,6 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		return;
 	}
 
-	if (!gLastVersionChannel.empty())
-	{
-		std::string url = regionp->getCapability("ServerReleaseNotes");
-		if (url.empty())
-		{
-			// The capability hasn't arrived yet or is not supported,
-			// fall back to parsing server version channel.
-			std::string channel, ver;
-			if (!parse_version_info(version_channel, channel, ver))
-			{
-				llwarns << "Failed to parse server version channel (" << version_channel << ")" << llendl;
-			}
-
-			url = gSavedSettings.getString("ReleaseNotesURL");
-			LLSD args;
-			args["CHANNEL"] = LLWeb::escapeURL(channel);
-			args["VERSION"] = LLWeb::escapeURL(ver);
-			LLStringUtil::format(url, args);
-		}
-
-		LLSD args;
-		args["URL"] = url;
-		LLNotificationsUtil::add("ServerVersionChanged", args);
-	}
-
 	gLastVersionChannel = version_channel;
 }
 
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 1804fac1b3dbfc3765a4c8b0a2bc4254c29ebb74..090d3cadd491f90404e9463aa13c3a7f9e816818 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -210,7 +210,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mLastInterpUpdateSecs(0.f),
 	mLastMessageUpdateSecs(0.f),
 	mLatestRecvPacketID(0),
-	mCircuitPacketCount(0),
 	mData(NULL),
 	mAudioSourcep(NULL),
 	mAudioGain(1.f),
@@ -234,7 +233,9 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mState(0),
 	mMedia(NULL),
 	mClickAction(0),
-	mAttachmentItemID(LLUUID::null)
+	mAttachmentItemID(LLUUID::null),
+	mLastUpdateType(OUT_UNKNOWN),
+	mLastUpdateCached(FALSE)
 {
 	if (!is_global)
 	{
@@ -516,20 +517,23 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list)
 
 // This method returns true if the object is over land owned by the
 // agent.
-BOOL LLViewerObject::isOverAgentOwnedLand() const
+bool LLViewerObject::isReturnable()
 {
-	return mRegionp
-		&& mRegionp->getParcelOverlay()
-		&& mRegionp->getParcelOverlay()->isOwnedSelf(getPositionRegion());
-}
+	if (isAttachment())
+	{
+		return false;
+	}
+	std::vector<LLBBox> boxes;
+	boxes.push_back(LLBBox(getPositionRegion(), getRotationRegion(), getScale() * -0.5f, getScale() * 0.5f).getAxisAligned());
+	for (child_list_t::iterator iter = mChildList.begin();
+		 iter != mChildList.end(); iter++)
+	{
+		LLViewerObject* child = *iter;
+		boxes.push_back(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());
+	}
 
-// This method returns true if the object is over land owned by the
-// agent.
-BOOL LLViewerObject::isOverGroupOwnedLand() const
-{
-	return mRegionp 
-		&& mRegionp->getParcelOverlay()
-		&& mRegionp->getParcelOverlay()->isOwnedGroup(getPositionRegion());
+	return mRegionp
+		&& mRegionp->objectIsReturnable(getPositionRegion(), boxes);
 }
 
 BOOL LLViewerObject::setParent(LLViewerObject* parent)
@@ -1879,7 +1883,6 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
 	}
 
 	mLatestRecvPacketID = packet_id;
-	mCircuitPacketCount = 0;
 
 	// Set the change flags for scale
 	if (new_scale != getScale())
@@ -2202,7 +2205,8 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
 		LLVector3 new_pos = (vel + (0.5f * (dt-PHYSICS_TIMESTEP)) * accel) * dt;	
 		LLVector3 new_v = accel * dt;
 
-		if (time_since_last_update > sPhaseOutUpdateInterpolationTime)
+		if (time_since_last_update > sPhaseOutUpdateInterpolationTime &&
+			sPhaseOutUpdateInterpolationTime > 0.0)
 		{	// Haven't seen a viewer update in a while, check to see if the ciruit is still active
 			if (mRegionp)
 			{	// The simulator will NOT send updates if the object continues normally on the path
@@ -2211,9 +2215,12 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
 				LLCircuitData *cdp = gMessageSystem->mCircuitInfo.findCircuit( mRegionp->getHost() );
 				if (cdp)
 				{
+					// Find out how many seconds since last packet arrived on the circuit
+					F64 time_since_last_packet = LLMessageSystem::getMessageTimeSeconds() - cdp->getLastPacketInTime();
+
 					if (!cdp->isAlive() ||		// Circuit is dead or blocked
 						 cdp->isBlocked() ||	// or doesn't seem to be getting any packets
-						 (mCircuitPacketCount > 0 && mCircuitPacketCount == cdp->getPacketsIn()))
+						 (time_since_last_packet > sPhaseOutUpdateInterpolationTime))
 					{
 						// Start to reduce motion interpolation since we haven't seen a server update in a while
 						F64 time_since_last_interpolation = time - mLastInterpUpdateSecs;
@@ -2244,9 +2251,6 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
 						new_pos = new_pos * ((F32) phase_out);
 						new_v = new_v * ((F32) phase_out);
 					}
-
-					// Save current circuit packet count to see if it changes 
-					mCircuitPacketCount = cdp->getPacketsIn();
 				}
 			}
 		}
@@ -5100,7 +5104,6 @@ void LLViewerObject::setRegion(LLViewerRegion *regionp)
 	}
 	
 	mLatestRecvPacketID = 0;
-	mCircuitPacketCount = 0;
 	mRegionp = regionp;
 
 	for (child_list_t::iterator i = mChildList.begin(); i != mChildList.end(); ++i)
@@ -5400,6 +5403,26 @@ void LLViewerObject::setAttachmentItemID(const LLUUID &id)
 	mAttachmentItemID = id;
 }
 
+EObjectUpdateType LLViewerObject::getLastUpdateType() const
+{
+	return mLastUpdateType;
+}
+
+void LLViewerObject::setLastUpdateType(EObjectUpdateType last_update_type)
+{
+	mLastUpdateType = last_update_type;
+}
+
+BOOL LLViewerObject::getLastUpdateCached() const
+{
+	return mLastUpdateCached;
+}
+
+void LLViewerObject::setLastUpdateCached(BOOL last_update_cached)
+{
+	mLastUpdateCached = last_update_cached;
+}
+
 const LLUUID &LLViewerObject::extractAttachmentItemID()
 {
 	LLUUID item_id = LLUUID::null;
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index fe670f882716efb39b69fa24270660384143610d..7afb7f464bb9cd747f3896812b95467a9c1d907a 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -77,6 +77,7 @@ typedef enum e_object_update_type
 	OUT_TERSE_IMPROVED,
 	OUT_FULL_COMPRESSED,
 	OUT_FULL_CACHED,
+	OUT_UNKNOWN,
 } EObjectUpdateType;
 
 
@@ -226,12 +227,9 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	virtual BOOL hasLightTexture() const			{ return FALSE; }
 
 	// This method returns true if the object is over land owned by
-	// the agent.
-	BOOL isOverAgentOwnedLand() const;
-
-	// True if over land owned by group of which the agent is
-	// either officer or member.
-	BOOL isOverGroupOwnedLand() const;
+	// the agent, one of its groups, or it encroaches and 
+	// anti-encroachment is enabled
+	bool isReturnable();
 
 	/*
 	// This method will scan through this object, and then query the
@@ -615,7 +613,6 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	F64				mLastInterpUpdateSecs;			// Last update for purposes of interpolation
 	F64				mLastMessageUpdateSecs;			// Last update from a message from the simulator
 	TPACKETID		mLatestRecvPacketID;			// Latest time stamp on message from simulator
-	U32				mCircuitPacketCount;			// Packet tracking for early detection of a stopped simulator circuit
 
 	// extra data sent from the sim...currently only used for tree species info
 	U8* mData;
@@ -696,8 +693,15 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	const LLUUID &getAttachmentItemID() const;
 	void setAttachmentItemID(const LLUUID &id);
 	const LLUUID &extractAttachmentItemID(); // find&set the inventory item ID of the attached object
+	EObjectUpdateType getLastUpdateType() const;
+	void setLastUpdateType(EObjectUpdateType last_update_type);
+	BOOL getLastUpdateCached() const;
+	void setLastUpdateCached(BOOL last_update_cached);
+
 private:
 	LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory.
+	EObjectUpdateType	mLastUpdateType;
+	BOOL	mLastUpdateCached;
 };
 
 ///////////////////
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index f5a32438cfef2effc43e3372208c528b924b9e0a..5849ab4307c016364537d3bac79839daf0f7f768 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -56,6 +56,7 @@
 #include "llresmgr.h"
 #include "llviewerregion.h"
 #include "llviewerstats.h"
+#include "llviewerstatsrecorder.h"
 #include "llvoavatarself.h"
 #include "lltoolmgr.h"
 #include "lltoolpie.h"
@@ -302,8 +303,10 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 	// have to transform to absolute coordinates.
 	num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
 
+	// I don't think this case is ever hit.  TODO* Test this.
 	if (!cached && !compressed && update_type != OUT_FULL)
 	{
+		//llinfos << "TEST: !cached && !compressed && update_type != OUT_FULL" << llendl;
 		gTerseObjectUpdates += num_objects;
 		S32 size;
 		if (mesgsys->getReceiveCompressedSize())
@@ -314,7 +317,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 		{
 			size = mesgsys->getReceiveSize();
 		}
-		// llinfos << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl;
+		//llinfos << "Received terse " << num_objects << " in " << size << " byte (" << size/num_objects << ")" << llendl;
 	}
 	else
 	{
@@ -345,9 +348,14 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 	U8 compressed_dpbuffer[2048];
 	LLDataPackerBinaryBuffer compressed_dp(compressed_dpbuffer, 2048);
 	LLDataPacker *cached_dpp = NULL;
-	
+
+#if LL_RECORD_VIEWER_STATS
+	LLViewerStatsRecorder::instance()->beginObjectUpdateEvents(regionp);
+#endif
+
 	for (i = 0; i < num_objects; i++)
 	{
+		// timer is unused?
 		LLTimer update_timer;
 		BOOL justCreated = FALSE;
 
@@ -359,9 +367,11 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_CRC, crc, i);
 		
 			// Lookup data packer and add this id to cache miss lists if necessary.
-			cached_dpp = regionp->getDP(id, crc);
+			U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE;
+			cached_dpp = regionp->getDP(id, crc, cache_miss_type);
 			if (cached_dpp)
 			{
+				// Cache Hit.
 				cached_dpp->reset();
 				cached_dpp->unpackUUID(fullid, "ID");
 				cached_dpp->unpackU32(local_id, "LocalID");
@@ -369,6 +379,11 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			}
 			else
 			{
+				// Cache Miss.
+				#if LL_RECORD_VIEWER_STATS
+				LLViewerStatsRecorder::instance()->recordCacheMissEvent(id, update_type, cache_miss_type);
+				#endif
+
 				continue; // no data packer, skip this object
 			}
 		}
@@ -380,13 +395,15 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			compressed_dp.reset();
 
 			U32 flags = 0;
-			if (update_type != OUT_TERSE_IMPROVED)
+			if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
 			{
 				mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i);
 			}
 			
+			// I don't think we ever use this flag from the server.  DK 2010/12/09
 			if (flags & FLAGS_ZLIB_COMPRESSED)
 			{
+				//llinfos << "TEST: flags & FLAGS_ZLIB_COMPRESSED" << llendl;
 				compressed_length = mesgsys->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_Data);
 				mesgsys->getBinaryDataFast(_PREHASH_ObjectData, _PREHASH_Data, compbuffer, 0, i);
 				uncompressed_length = 2048;
@@ -402,7 +419,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			}
 
 
-			if (update_type != OUT_TERSE_IMPROVED)
+			if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
 			{
 				compressed_dp.unpackUUID(fullid, "ID");
 				compressed_dp.unpackU32(local_id, "LocalID");
@@ -422,7 +439,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 				}
 			}
 		}
-		else if (update_type != OUT_FULL)
+		else if (update_type != OUT_FULL) // !compressed, !OUT_FULL ==> OUT_FULL_CACHED only?
 		{
 			mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
 			getUUIDFromLocal(fullid,
@@ -435,7 +452,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 				mNumUnknownUpdates++;
 			}
 		}
-		else
+		else // OUT_FULL only?
 		{
 			mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_FullID, fullid, i);
 			mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
@@ -467,12 +484,12 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 							gMessageSystem->getSenderPort());
 			
 			if (objectp->mLocalID != local_id)
-			{    // Update local ID in object with the one sent from the region
+			{	// Update local ID in object with the one sent from the region
 				objectp->mLocalID = local_id;
 			}
 			
 			if (objectp->getRegion() != regionp)
-			{    // Object changed region, so update it
+			{	// Object changed region, so update it
 				objectp->updateRegion(regionp); // for LLVOAvatar
 			}
 		}
@@ -483,18 +500,24 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			{
 				if (update_type == OUT_TERSE_IMPROVED)
 				{
-					// llinfos << "terse update for an unknown object:" << fullid << llendl;
+					// llinfos << "terse update for an unknown object (compressed):" << fullid << llendl;
+					#if LL_RECORD_VIEWER_STATS
+					LLViewerStatsRecorder::instance()->recordObjectUpdateFailure(local_id, update_type);
+					#endif
 					continue;
 				}
 			}
-			else if (cached)
+			else if (cached) // Cache hit only?
 			{
 			}
 			else
 			{
 				if (update_type != OUT_FULL)
 				{
-					// llinfos << "terse update for an unknown object:" << fullid << llendl;
+					//llinfos << "terse update for an unknown object:" << fullid << llendl;
+					#if LL_RECORD_VIEWER_STATS
+					LLViewerStatsRecorder::instance()->recordObjectUpdateFailure(local_id, update_type);
+					#endif
 					continue;
 				}
 
@@ -504,7 +527,10 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			if (mDeadObjects.find(fullid) != mDeadObjects.end())
 			{
 				mNumDeadObjectUpdates++;
-				// llinfos << "update for a dead object:" << fullid << llendl;
+				//llinfos << "update for a dead object:" << fullid << llendl;
+				#if LL_RECORD_VIEWER_STATS
+				LLViewerStatsRecorder::instance()->recordObjectUpdateFailure(local_id, update_type);
+				#endif
 				continue;
 			}
 #endif
@@ -512,6 +538,10 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender());
 			if (!objectp)
 			{
+				llinfos << "createObject failure for object: " << fullid << llendl;
+				#if LL_RECORD_VIEWER_STATS
+				LLViewerStatsRecorder::instance()->recordObjectUpdateFailure(local_id, update_type);
+				#endif
 				continue;
 			}
 			justCreated = TRUE;
@@ -524,19 +554,26 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			llwarns << "Dead object " << objectp->mID << " in UUID map 1!" << llendl;
 		}
 
+		bool bCached = false;
 		if (compressed)
 		{
-			if (update_type != OUT_TERSE_IMPROVED)
+			if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
 			{
 				objectp->mLocalID = local_id;
 			}
 			processUpdateCore(objectp, user_data, i, update_type, &compressed_dp, justCreated);
-			if (update_type != OUT_TERSE_IMPROVED)
+			if (update_type != OUT_TERSE_IMPROVED) // OUT_FULL_COMPRESSED only?
 			{
+				bCached = true;
+				#if LL_RECORD_VIEWER_STATS
+				LLViewerRegion::eCacheUpdateResult result = objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp);
+				LLViewerStatsRecorder::instance()->recordCacheFullUpdate(local_id, update_type, result, objectp);
+				#else
 				objectp->mRegionp->cacheFullUpdate(objectp, compressed_dp);
+				#endif
 			}
 		}
-		else if (cached)
+		else if (cached) // Cache hit only?
 		{
 			objectp->mLocalID = local_id;
 			processUpdateCore(objectp, user_data, i, update_type, cached_dpp, justCreated);
@@ -549,8 +586,17 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			}
 			processUpdateCore(objectp, user_data, i, update_type, NULL, justCreated);
 		}
+		#if LL_RECORD_VIEWER_STATS
+		LLViewerStatsRecorder::instance()->recordObjectUpdateEvent(local_id, update_type, objectp);
+		#endif
+		objectp->setLastUpdateType(update_type);
+		objectp->setLastUpdateCached(bCached);
 	}
 
+#if LL_RECORD_VIEWER_STATS
+	LLViewerStatsRecorder::instance()->endObjectUpdateEvents();
+#endif
+
 	LLVOAvatar::cullAvatarsByPixelArea();
 }
 
@@ -681,12 +727,12 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 
 	// update global timer
 	F32 last_time = gFrameTimeSeconds;
-	U64 time = totalTime();                 // this will become the new gFrameTime when the update is done
+	U64 time = totalTime();				 // this will become the new gFrameTime when the update is done
 	// Time _can_ go backwards, for example if the user changes the system clock.
 	// It doesn't cause any fatal problems (just some oddness with stats), so we shouldn't assert here.
 //	llassert(time > gFrameTime);
 	F64 time_diff = U64_to_F64(time - gFrameTime)/(F64)SEC_TO_MICROSEC;
-	gFrameTime    = time;
+	gFrameTime	= time;
 	F64 time_since_start = U64_to_F64(gFrameTime - gStartTime)/(F64)SEC_TO_MICROSEC;
 	gFrameTimeSeconds = (F32)time_since_start;
 
@@ -788,7 +834,7 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 		{
 			std::string id_str;
 			objectp->mID.toString(id_str);
-			std::string tmpstr = std::string("Par:    ") + id_str;
+			std::string tmpstr = std::string("Par:	") + id_str;
 			addDebugBeacon(objectp->getPositionAgent(),
 							tmpstr,
 							LLColor4(1.f,0.f,0.f,1.f),
@@ -808,12 +854,12 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 			std::string tmpstr;
 			if (objectp->getParent())
 			{
-				tmpstr = std::string("ChP:    ") + id_str;
+				tmpstr = std::string("ChP:	") + id_str;
 				text_color = LLColor4(0.f, 1.f, 0.f, 1.f);
 			}
 			else
 			{
-				tmpstr = std::string("ChNoP:    ") + id_str;
+				tmpstr = std::string("ChNoP:	") + id_str;
 				text_color = LLColor4(1.f, 0.f, 0.f, 1.f);
 			}
 			id = sIndexAndLocalIDToUUID[oi.mParentInfo];
@@ -1519,8 +1565,8 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
 			llinfos << "Agent: " << objectp->getPositionAgent() << llendl;
 			addDebugBeacon(objectp->getPositionAgent(),"");
 #endif
-            gPipeline.markMoved(objectp->mDrawable);                
-            objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE);
+			gPipeline.markMoved(objectp->mDrawable);				
+			objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE);
 
 			// Flag the object as no longer orphaned
 			childp->mOrphaned = FALSE;
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index eee653b0c163775d9dd97a99734d5c0d5b3098fc..d07e06f6a7ed171e7864517bcc8b6eaa89f287cf 100644
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -145,6 +145,35 @@ BOOL LLViewerParcelOverlay::isOwnedOther(const LLVector3& pos) const
 	return (PARCEL_OWNED == overlay || PARCEL_FOR_SALE == overlay);
 }
 
+bool LLViewerParcelOverlay::encroachesOwned(const std::vector<LLBBox>& boxes) const
+{
+	// boxes are expected to already be axis aligned
+	for (U32 i = 0; i < boxes.size(); ++i)
+	{
+		LLVector3 min = boxes[i].getMinAgent();
+		LLVector3 max = boxes[i].getMaxAgent();
+		
+		S32 left   = S32(llclamp((min.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+		S32 right  = S32(llclamp((max.mV[VX] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+		S32 top    = S32(llclamp((min.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+		S32 bottom = S32(llclamp((max.mV[VY] / PARCEL_GRID_STEP_METERS), 0.f, REGION_WIDTH_METERS - 1));
+	
+		for (S32 row = top; row <= bottom; row++)
+		{
+			for (S32 column = left; column <= right; column++)
+			{
+				U8 type = ownership(row, column);
+				if ((PARCEL_SELF == type)
+					|| (PARCEL_GROUP == type))
+				{
+					return true;
+				}
+			}
+		}
+	}
+	return false;
+}
+
 BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const
 {
 	S32 row =    S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h
index 61be2203121ff9d842a223a42c2ed21d84b4f38a..c80baedda6c6256d2fe12af5bee53a3476e1e746 100644
--- a/indra/newview/llviewerparceloverlay.h
+++ b/indra/newview/llviewerparceloverlay.h
@@ -30,6 +30,7 @@
 // The ownership data for land parcels.
 // One of these structures per region.
 
+#include "llbbox.h"
 #include "lldarray.h"
 #include "llframetimer.h"
 #include "lluuid.h"
@@ -54,6 +55,12 @@ class LLViewerParcelOverlay : public LLGLUpdate
 	BOOL			isOwnedSelf(const LLVector3& pos) const;
 	BOOL			isOwnedGroup(const LLVector3& pos) const;
 	BOOL			isOwnedOther(const LLVector3& pos) const;
+
+	// "encroaches" means the prim hangs over the parcel, but its center
+	// might be in another parcel. for now, we simply test axis aligned 
+	// bounding boxes which isn't perfect, but is close
+	bool encroachesOwned(const std::vector<LLBBox>& boxes) const;
+	
 	BOOL			isSoundLocal(const LLVector3& pos) const;
 
 	BOOL			isBuildCameraAllowed(const LLVector3& pos) const;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 551ba18dd549cbd5aa92ec01460d6a6915850c44..c7649001c5479563dac58a045907b465917fbc55 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -59,6 +59,7 @@
 #include "llurldispatcher.h"
 #include "llviewerobjectlist.h"
 #include "llviewerparceloverlay.h"
+#include "llviewerstatsrecorder.h"
 #include "llvlmanager.h"
 #include "llvlcomposition.h"
 #include "llvocache.h"
@@ -1032,7 +1033,7 @@ void LLViewerRegion::getInfo(LLSD& info)
 	info["Region"]["Handle"]["y"] = (LLSD::Integer)y;
 }
 
-void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp)
+LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp)
 {
 	U32 local_id = objectp->getLocalID();
 	U32 crc = objectp->getCRC();
@@ -1046,35 +1047,36 @@ void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinary
 		{
 			// Record a hit
 			entry->recordDupe();
+			return CACHE_UPDATE_DUPE;
 		}
-		else
-		{
-			// Update the cache entry
-			mCacheMap.erase(local_id);
-			delete entry;
-			entry = new LLVOCacheEntry(local_id, crc, dp);
-			mCacheMap[local_id] = entry;
-		}
-	}
-	else
-	{
-		// we haven't seen this object before
 
-		// Create new entry and add to map
-		if (mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES)
-		{
-			mCacheMap.erase(mCacheMap.begin());
-		}
+		// Update the cache entry
+		mCacheMap.erase(local_id);
+		delete entry;
 		entry = new LLVOCacheEntry(local_id, crc, dp);
-
 		mCacheMap[local_id] = entry;
+		return CACHE_UPDATE_CHANGED;
 	}
-	return ;
+
+	// we haven't seen this object before
+
+	// Create new entry and add to map
+	eCacheUpdateResult result = CACHE_UPDATE_ADDED;
+	if (mCacheMap.size() > MAX_OBJECT_CACHE_ENTRIES)
+	{
+		mCacheMap.erase(mCacheMap.begin());
+		result = CACHE_UPDATE_REPLACED;
+		
+	}
+	entry = new LLVOCacheEntry(local_id, crc, dp);
+
+	mCacheMap[local_id] = entry;
+	return result;
 }
 
 // Get data packer for this object, if we have cached data
 // AND the CRC matches. JC
-LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc)
+LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc, U8 &cache_miss_type)
 {
 	llassert(mCacheLoaded);
 
@@ -1087,17 +1089,20 @@ LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc)
 		{
 			// Record a hit
 			entry->recordHit();
+			cache_miss_type = CACHE_MISS_TYPE_NONE;
 			return entry->getDP(crc);
 		}
 		else
 		{
 			// llinfos << "CRC miss for " << local_id << llendl;
+			cache_miss_type = CACHE_MISS_TYPE_CRC;
 			mCacheMissCRC.put(local_id);
 		}
 	}
 	else
 	{
 		// llinfos << "Cache miss for " << local_id << llendl;
+		cache_miss_type = CACHE_MISS_TYPE_FULL;
 		mCacheMissFull.put(local_id);
 	}
 	return NULL;
@@ -1119,9 +1124,6 @@ void LLViewerRegion::requestCacheMisses()
 	S32 blocks = 0;
 	S32 i;
 
-	const U8 CACHE_MISS_TYPE_FULL = 0;
-	const U8 CACHE_MISS_TYPE_CRC  = 1;
-
 	// Send full cache miss updates.  For these, we KNOW we don't
 	// have a viewer object.
 	for (i = 0; i < full_count; i++)
@@ -1184,6 +1186,11 @@ void LLViewerRegion::requestCacheMisses()
 
 	mCacheDirty = TRUE ;
 	// llinfos << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << llendl;
+	#if LL_RECORD_VIEWER_STATS
+	LLViewerStatsRecorder::instance()->beginObjectUpdateEvents(this);
+	LLViewerStatsRecorder::instance()->recordRequestCacheMissesEvent(full_count + crc_count);
+	LLViewerStatsRecorder::instance()->endObjectUpdateEvents();
+	#endif
 }
 
 void LLViewerRegion::dumpCache()
@@ -1372,11 +1379,12 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
 	capabilityNames.append("DispatchRegionInfo");
 	capabilityNames.append("EstateChangeInfo");
 	capabilityNames.append("EventQueueGet");
-	capabilityNames.append("FetchInventory");
 	capabilityNames.append("ObjectMedia");
 	capabilityNames.append("ObjectMediaNavigate");
-	capabilityNames.append("FetchLib");
-	capabilityNames.append("FetchLibDescendents");
+	capabilityNames.append("FetchLib2");
+	capabilityNames.append("FetchLibDescendents2");
+	capabilityNames.append("FetchInventory2");
+	capabilityNames.append("FetchInventoryDescendents2");
 	capabilityNames.append("GetDisplayNames");
 	capabilityNames.append("GetTexture");
 	capabilityNames.append("GroupProposalBallot");
@@ -1400,7 +1408,6 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
 	capabilityNames.append("SendUserReportWithScreenshot");
 	capabilityNames.append("ServerReleaseNotes");
 	capabilityNames.append("SetDisplayName");
-	capabilityNames.append("SimConsole");
 	capabilityNames.append("SimConsoleAsync");
 	capabilityNames.append("StartGroupProposal");
 	capabilityNames.append("TextureStats");
@@ -1417,7 +1424,6 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
 	capabilityNames.append("ViewerMetrics");
 	capabilityNames.append("ViewerStartAuction");
 	capabilityNames.append("ViewerStats");
-	capabilityNames.append("WebFetchInventoryDescendents");
 	// Please add new capabilities alphabetically to reduce
 	// merge conflicts.
 
@@ -1497,6 +1503,20 @@ LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
 	return NULL;
 }
 
+// the viewer can not yet distinquish between normal- and estate-owned objects
+// so we collapse these two bits and enable the UI if either are set
+const U32 ALLOW_RETURN_ENCROACHING_OBJECT = REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT
+											| REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT;
+
+bool LLViewerRegion::objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const
+{
+	return (mParcelOverlay != NULL)
+		&& (mParcelOverlay->isOwnedSelf(pos)
+			|| mParcelOverlay->isOwnedGroup(pos)
+			|| ((mRegionFlags & ALLOW_RETURN_ENCROACHING_OBJECT)
+				&& mParcelOverlay->encroachesOwned(boxes)) );
+}
+
 void LLViewerRegion::showReleaseNotes()
 {
 	std::string url = this->getCapability("ServerReleaseNotes");
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 8b71998f6054ddbaa7fccb8a1ee94ee317a5e093..7c6559203e5fa7606685f67a5cc8b328e1ffdf4a 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -33,6 +33,7 @@
 
 #include "lldarray.h"
 #include "llwind.h"
+#include "llbbox.h"
 #include "llcloud.h"
 #include "llstat.h"
 #include "v3dmath.h"
@@ -50,7 +51,7 @@
 // Surface id's
 #define LAND  1
 #define WATER 2
-const U32	MAX_OBJECT_CACHE_ENTRIES = 10000;
+const U32	MAX_OBJECT_CACHE_ENTRIES = 50000;
 
 
 class LLEventPoll;
@@ -274,9 +275,24 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface
 
 	void getInfo(LLSD& info);
 
+	typedef enum
+	{
+		CACHE_MISS_TYPE_FULL = 0,
+		CACHE_MISS_TYPE_CRC,
+		CACHE_MISS_TYPE_NONE
+	} eCacheMissType;
+
+	typedef enum
+	{
+		CACHE_UPDATE_DUPE = 0,
+		CACHE_UPDATE_CHANGED,
+		CACHE_UPDATE_ADDED,
+		CACHE_UPDATE_REPLACED
+	} eCacheUpdateResult;
+
 	// handle a full update message
-	void cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp);
-	LLDataPacker *getDP(U32 local_id, U32 crc);
+	eCacheUpdateResult cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinaryBuffer &dp);
+	LLDataPacker *getDP(U32 local_id, U32 crc, U8 &cache_miss_type);
 	void requestCacheMisses();
 	void addCacheMissFull(const U32 local_id);
 
@@ -293,6 +309,8 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface
 	std::string getHttpUrl() const { return mHttpUrl ;}
 
 	LLSpatialPartition* getSpatialPartition(U32 type);
+
+	bool objectIsReturnable(const LLVector3& pos, const std::vector<LLBBox>& boxes) const;
 public:
 	struct CompareDistance
 	{
diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e9d21b4848e4c6d8069df681eaf66cee337a96aa
--- /dev/null
+++ b/indra/newview/llviewerstatsrecorder.cpp
@@ -0,0 +1,258 @@
+/**
+ * @file llviewerstatsrecorder.cpp
+ * @brief record info about viewer events to a metrics log file
+ *
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llviewerstatsrecorder.h"
+
+#if LL_RECORD_VIEWER_STATS
+
+#include "llfile.h"
+#include "llviewerregion.h"
+#include "llviewerobject.h"
+
+
+// To do - something using region name or global position
+#if LL_WINDOWS
+	static const std::string STATS_FILE_NAME("C:\\ViewerObjectCacheStats.csv");
+#else
+	static const std::string STATS_FILE_NAME("/tmp/viewerstats.csv");
+#endif
+
+LLViewerStatsRecorder* LLViewerStatsRecorder::sInstance = NULL;
+LLViewerStatsRecorder::LLViewerStatsRecorder() :
+	mObjectCacheFile(NULL),
+	mTimer(),
+	mRegionp(NULL),
+	mStartTime(0.f),
+	mProcessingTime(0.f)
+{
+	if (NULL != sInstance)
+	{
+		llerrs << "Attempted to create multiple instances of LLViewerStatsRecorder!" << llendl;
+	}
+	sInstance = this;
+	clearStats();
+}
+
+LLViewerStatsRecorder::~LLViewerStatsRecorder()
+{
+	if (mObjectCacheFile != NULL)
+	{
+		LLFile::close(mObjectCacheFile);
+		mObjectCacheFile = NULL;
+	}
+}
+
+// static
+void LLViewerStatsRecorder::initClass()
+{
+	sInstance = new LLViewerStatsRecorder();
+}
+
+// static
+void LLViewerStatsRecorder::cleanupClass()
+{
+	delete sInstance;
+	sInstance = NULL;
+}
+
+
+void LLViewerStatsRecorder::initStatsRecorder(LLViewerRegion *regionp)
+{
+	if (mObjectCacheFile == NULL)
+	{
+		mStartTime = LLTimer::getTotalTime();
+		mObjectCacheFile = LLFile::fopen(STATS_FILE_NAME, "wb");
+		if (mObjectCacheFile)
+		{	// Write column headers
+			std::ostringstream data_msg;
+			data_msg << "EventTime, "
+				<< "ProcessingTime, "
+				<< "CacheHits, "
+				<< "CacheFullMisses, "
+				<< "CacheCrcMisses, "
+				<< "FullUpdates, "
+				<< "TerseUpdates, "
+				<< "CacheMissRequests, "
+				<< "CacheMissResponses, "
+				<< "CacheUpdateDupes, "
+				<< "CacheUpdateChanges, "
+				<< "CacheUpdateAdds, "
+				<< "CacheUpdateReplacements, "
+				<< "UpdateFailures"
+				<< "\n";
+
+			fwrite(data_msg.str().c_str(), 1, data_msg.str().size(), mObjectCacheFile );
+		}
+	}
+}
+
+void LLViewerStatsRecorder::beginObjectUpdateEvents(LLViewerRegion *regionp)
+{
+	initStatsRecorder(regionp);
+	mRegionp = regionp;
+	mProcessingTime = LLTimer::getTotalTime();
+	clearStats();
+}
+
+void LLViewerStatsRecorder::clearStats()
+{
+	mObjectCacheHitCount = 0;
+	mObjectCacheMissFullCount = 0;
+	mObjectCacheMissCrcCount = 0;
+	mObjectFullUpdates = 0;
+	mObjectTerseUpdates = 0;
+	mObjectCacheMissRequests = 0;
+	mObjectCacheMissResponses = 0;
+	mObjectCacheUpdateDupes = 0;
+	mObjectCacheUpdateChanges = 0;
+	mObjectCacheUpdateAdds = 0;
+	mObjectCacheUpdateReplacements = 0;
+	mObjectUpdateFailures = 0;
+}
+
+
+void LLViewerStatsRecorder::recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type)
+{
+	mObjectUpdateFailures++;
+}
+
+void LLViewerStatsRecorder::recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type)
+{
+	if (LLViewerRegion::CACHE_MISS_TYPE_FULL == cache_miss_type)
+	{
+		mObjectCacheMissFullCount++;
+	}
+	else
+	{
+		mObjectCacheMissCrcCount++;
+	}
+}
+
+void LLViewerStatsRecorder::recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp)
+{
+	switch (update_type)
+	{
+	case OUT_FULL:
+		mObjectFullUpdates++;
+		break;
+	case OUT_TERSE_IMPROVED:
+		mObjectTerseUpdates++;
+		break;
+	case OUT_FULL_COMPRESSED:
+		mObjectCacheMissResponses++;
+		break;
+	case OUT_FULL_CACHED:
+		mObjectCacheHitCount++;
+		break;
+	default:
+		llwarns << "Unknown update_type" << llendl;
+		break;
+	};
+}
+
+void LLViewerStatsRecorder::recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp)
+{
+	switch (update_result)
+	{
+		case LLViewerRegion::CACHE_UPDATE_DUPE:
+			mObjectCacheUpdateDupes++;
+			break;
+		case LLViewerRegion::CACHE_UPDATE_CHANGED:
+			mObjectCacheUpdateChanges++;
+			break;
+		case LLViewerRegion::CACHE_UPDATE_ADDED:
+			mObjectCacheUpdateAdds++;
+			break;
+		case LLViewerRegion::CACHE_UPDATE_REPLACED:
+			mObjectCacheUpdateReplacements++;
+			break;
+		default:
+			llwarns << "Unknown update_result type" << llendl;
+			break;
+	};
+}
+
+void LLViewerStatsRecorder::recordRequestCacheMissesEvent(S32 count)
+{
+	mObjectCacheMissRequests += count;
+}
+
+void LLViewerStatsRecorder::endObjectUpdateEvents()
+{
+	llinfos << "ILX: " 
+		<< mObjectCacheHitCount << " hits, " 
+		<< mObjectCacheMissFullCount << " full misses, "
+		<< mObjectCacheMissCrcCount << " crc misses, "
+		<< mObjectFullUpdates << " full updates, "
+		<< mObjectTerseUpdates << " terse updates, "
+		<< mObjectCacheMissRequests << " cache miss requests, "
+		<< mObjectCacheMissResponses << " cache miss responses, "
+		<< mObjectCacheUpdateDupes << " cache update dupes, "
+		<< mObjectCacheUpdateChanges << " cache update changes, "
+		<< mObjectCacheUpdateAdds << " cache update adds, "
+		<< mObjectCacheUpdateReplacements << " cache update replacements, "
+		<< mObjectUpdateFailures << " update failures"
+		<< llendl;
+
+	S32 total_objects = mObjectCacheHitCount + mObjectCacheMissCrcCount + mObjectCacheMissFullCount + mObjectFullUpdates + mObjectTerseUpdates + mObjectCacheMissRequests + mObjectCacheMissResponses + mObjectCacheUpdateDupes + mObjectCacheUpdateChanges + mObjectCacheUpdateAdds + mObjectCacheUpdateReplacements + mObjectUpdateFailures;
+	if (mObjectCacheFile != NULL &&
+		total_objects > 0)
+	{
+		std::ostringstream data_msg;
+		F32 processing32 = (F32) ((LLTimer::getTotalTime() - mProcessingTime) / 1000.0);
+
+		data_msg << getTimeSinceStart()
+			<< ", " << processing32
+			<< ", " << mObjectCacheHitCount
+			<< ", " << mObjectCacheMissFullCount
+			<< ", " << mObjectCacheMissCrcCount
+			<< ", " << mObjectFullUpdates
+			<< ", " << mObjectTerseUpdates
+			<< ", " << mObjectCacheMissRequests
+			<< ", " << mObjectCacheMissResponses
+			<< ", " << mObjectCacheUpdateDupes
+			<< ", " << mObjectCacheUpdateChanges
+			<< ", " << mObjectCacheUpdateAdds
+			<< ", " << mObjectCacheUpdateReplacements
+			<< ", " << mObjectUpdateFailures
+			<< "\n";
+
+		fwrite(data_msg.str().c_str(), 1, data_msg.str().size(), mObjectCacheFile );
+	}
+
+	clearStats();
+}
+
+F32 LLViewerStatsRecorder::getTimeSinceStart()
+{
+	return (F32) ((LLTimer::getTotalTime() - mStartTime) / 1000.0);
+}
+
+#endif
+
+
+
diff --git a/indra/newview/llviewerstatsrecorder.h b/indra/newview/llviewerstatsrecorder.h
new file mode 100644
index 0000000000000000000000000000000000000000..612ac380f7f9c92ef13f9c79cfbb91e0f6686550
--- /dev/null
+++ b/indra/newview/llviewerstatsrecorder.h
@@ -0,0 +1,97 @@
+/**
+ * @file llviewerstatsrecorder.h
+ * @brief record info about viewer events to a metrics log file
+ *
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifndef LLVIEWERSTATSRECORDER_H
+#define LLVIEWERSTATSRECORDER_H
+
+
+// This is a diagnostic class used to record information from the viewer
+// for analysis.
+
+// This is normally 0.  Set to 1 to enable viewer stats recording
+#define LL_RECORD_VIEWER_STATS	0
+
+
+#if LL_RECORD_VIEWER_STATS
+#include "llframetimer.h"
+#include "llviewerobject.h"
+#include "llviewerregion.h"
+
+class LLMutex;
+class LLViewerRegion;
+class LLViewerObject;
+
+class LLViewerStatsRecorder
+{
+ public:
+	LLViewerStatsRecorder();
+	~LLViewerStatsRecorder();
+
+	static void initClass();
+	static void cleanupClass();
+	static LLViewerStatsRecorder* instance() {return sInstance; }
+
+	void initStatsRecorder(LLViewerRegion *regionp);
+
+	void beginObjectUpdateEvents(LLViewerRegion *regionp);
+	void recordObjectUpdateFailure(U32 local_id, const EObjectUpdateType update_type);
+	void recordCacheMissEvent(U32 local_id, const EObjectUpdateType update_type, U8 cache_miss_type);
+	void recordObjectUpdateEvent(U32 local_id, const EObjectUpdateType update_type, LLViewerObject * objectp);
+	void recordCacheFullUpdate(U32 local_id, const EObjectUpdateType update_type, LLViewerRegion::eCacheUpdateResult update_result, LLViewerObject* objectp);
+	void recordRequestCacheMissesEvent(S32 count);
+	void endObjectUpdateEvents();
+
+	F32 getTimeSinceStart();
+
+private:
+	static LLViewerStatsRecorder* sInstance;
+
+	LLFILE *	mObjectCacheFile;		// File to write data into
+	LLFrameTimer	mTimer;
+	LLViewerRegion*	mRegionp;
+	F64			mStartTime;
+	F64			mProcessingTime;
+
+	S32			mObjectCacheHitCount;
+	S32			mObjectCacheMissFullCount;
+	S32			mObjectCacheMissCrcCount;
+	S32			mObjectFullUpdates;
+	S32			mObjectTerseUpdates;
+	S32			mObjectCacheMissRequests;
+	S32			mObjectCacheMissResponses;
+	S32			mObjectCacheUpdateDupes;
+	S32			mObjectCacheUpdateChanges;
+	S32			mObjectCacheUpdateAdds;
+	S32			mObjectCacheUpdateReplacements;
+	S32			mObjectUpdateFailures;
+
+
+	void	clearStats();
+};
+#endif	// LL_RECORD_VIEWER_STATS
+
+#endif // LLVIEWERSTATSRECORDER_H
+
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index bb4c5b180416adbbeb2429aa66fc6efcb6eeb87a..fd89044995aab28a4d7107f698ed147bfcec6581 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2106,31 +2106,6 @@ void LLVOAvatar::computeBodySize()
 			gAgent.sendAgentSetAppearance();
 		}
 	}
-
-/* debug spam
-	std::cout << "skull = " << skull << std::endl;				// adebug
-	std::cout << "head = " << head << std::endl;				// adebug
-	std::cout << "head_scale = " << head_scale << std::endl;	// adebug
-	std::cout << "neck = " << neck << std::endl;				// adebug
-	std::cout << "neck_scale = " << neck_scale << std::endl;	// adebug
-	std::cout << "chest = " << chest << std::endl;				// adebug
-	std::cout << "chest_scale = " << chest_scale << std::endl;	// adebug
-	std::cout << "torso = " << torso << std::endl;				// adebug
-	std::cout << "torso_scale = " << torso_scale << std::endl;	// adebug
-	std::cout << std::endl;	// adebug
-
-	std::cout << "pelvis_scale = " << pelvis_scale << std::endl;// adebug
-	std::cout << std::endl;	// adebug
-
-	std::cout << "hip = " << hip << std::endl;					// adebug
-	std::cout << "hip_scale = " << hip_scale << std::endl;		// adebug
-	std::cout << "ankle = " << ankle << std::endl;				// adebug
-	std::cout << "ankle_scale = " << ankle_scale << std::endl;	// adebug
-	std::cout << "foot = " << foot << std::endl;				// adebug
-	std::cout << "mBodySize = " << mBodySize << std::endl;		// adebug
-	std::cout << "mPelvisToFoot = " << mPelvisToFoot << std::endl;	// adebug
-	std::cout << std::endl;		// adebug
-*/
 }
 
 //------------------------------------------------------------------------
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 145ee31260b94e43d1580fe2e6a129501a6f83a0..c26008d6406dcb71d9b313267576689b463cfea7 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -40,6 +40,7 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes)
 	return apr_file->write(src, n_bytes) == n_bytes ;
 }
 
+
 //---------------------------------------------------------------------------
 // LLVOCacheEntry
 //---------------------------------------------------------------------------
@@ -212,8 +213,8 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const
 		if(success)
 		{
 			success = check_write(apr_file, (void*)mBuffer, size);
+		}
 	}
-}
 
 	return success ;
 }
@@ -224,7 +225,8 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const
 // Format string used to construct filename for the object cache
 static const char OBJECT_CACHE_FILENAME[] = "objects_%d_%d.slc";
 
-const U32 NUM_ENTRIES_TO_PURGE = 16 ;
+// Throw out 1/20 (5%) of our cache entries if we run out of room.
+const U32 ENTRIES_PURGE_FACTOR = 20;
 const char* object_cache_dirname = "objectcache";
 const char* header_filename = "object.cache";
 
@@ -259,7 +261,6 @@ void LLVOCache::destroyClass()
 LLVOCache::LLVOCache():
 	mInitialized(FALSE),
 	mReadOnly(TRUE),
-	mNumEntries(0),
 	mCacheSize(1)
 {
 	mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
@@ -286,8 +287,15 @@ void LLVOCache::setDirNames(ELLPath location)
 
 void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version)
 {
-	if(mInitialized || !mEnabled)
+	if(!mEnabled)
 	{
+		llwarns << "Not initializing cache: Cache is currently disabled." << llendl;
+		return ;
+	}
+
+	if(mInitialized)
+	{
+		llwarns << "Cache already initialized." << llendl;
 		return ;
 	}
 
@@ -299,7 +307,6 @@ void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version)
 
 	mCacheSize = size;
 
-	mMetaInfo.mVersion = cache_version;
 	readCacheHeader();
 	mInitialized = TRUE ;
 
@@ -321,12 +328,14 @@ void LLVOCache::removeCache(ELLPath location)
 {
 	if(mReadOnly)
 	{
+		llwarns << "Not removing cache at " << location << ": Cache is currently in read-only mode." << llendl;
 		return ;
 	}
 
 	std::string delem = gDirUtilp->getDirDelimiter();
 	std::string mask = delem + "*";
 	std::string cache_dir = gDirUtilp->getExpandedFilename(location, object_cache_dirname);
+	llinfos << "Removing cache at " << cache_dir << llendl;
 	gDirUtilp->deleteFilesInDir(cache_dir, mask); //delete all files
 	LLFile::rmdir(cache_dir);
 
@@ -339,11 +348,13 @@ void LLVOCache::removeCache()
 	llassert_always(mInitialized) ;
 	if(mReadOnly)
 	{
+		llwarns << "Not clearing object cache: Cache is currently in read-only mode." << llendl;
 		return ;
 	}
 
 	std::string delem = gDirUtilp->getDirDelimiter();
 	std::string mask = delem + "*";
+	llinfos << "Removing cache at " << mObjectCacheDirName << llendl;
 	gDirUtilp->deleteFilesInDir(mObjectCacheDirName, mask); 
 
 	clearCacheInMemory() ;
@@ -352,16 +363,8 @@ void LLVOCache::removeCache()
 
 void LLVOCache::clearCacheInMemory()
 {
-	if(!mHeaderEntryQueue.empty()) 
-	{
-		for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin(); iter != mHeaderEntryQueue.end(); ++iter)
-		{
-			delete *iter ;
-		}
-		mHeaderEntryQueue.clear();
-		mHandleEntryMap.clear();
-		mNumEntries = 0 ;
-	}
+	std::for_each(mHandleEntryMap.begin(), mHandleEntryMap.end(), DeletePairedPointer());
+	mHandleEntryMap.clear();
 }
 
 void LLVOCache::getObjectCacheFilename(U64 handle, std::string& filename) 
@@ -379,6 +382,7 @@ void LLVOCache::removeFromCache(U64 handle)
 {
 	if(mReadOnly)
 	{
+		llwarns << "Not removing cache for handle " << handle << ": Cache is currently in read-only mode." << llendl;
 		return ;
 	}
 
@@ -387,24 +391,28 @@ void LLVOCache::removeFromCache(U64 handle)
 	LLAPRFile::remove(filename, mLocalAPRFilePoolp);	
 }
 
-BOOL LLVOCache::checkRead(LLAPRFile* apr_file, void* src, S32 n_bytes) 
+BOOL LLVOCache::checkRead(LLAPRFile* apr_file, void* src, S32 n_bytes, bool remove_cache_on_error)
 {
 	if(!check_read(apr_file, src, n_bytes))
 	{
-		delete apr_file ;
-		removeCache() ;
+		if (remove_cache_on_error)
+		{
+			removeCache() ;
+		}
 		return FALSE ;
 	}
 
 	return TRUE ;
 }
 
-BOOL LLVOCache::checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes) 
+BOOL LLVOCache::checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes, bool remove_cache_on_error) 
 {
 	if(!check_write(apr_file, src, n_bytes))
 	{
-		delete apr_file ;
-		removeCache() ;
+		if (remove_cache_on_error)
+		{
+			removeCache() ;
+		}
 		return FALSE ;
 	}
 
@@ -415,7 +423,8 @@ void LLVOCache::readCacheHeader()
 {
 	if(!mEnabled)
 	{
-		return ;
+		llwarns << "Not reading cache header: Cache is currently disabled." << llendl;
+		return;
 	}
 
 	//clear stale info.
@@ -423,33 +432,35 @@ void LLVOCache::readCacheHeader()
 
 	if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
 	{
-		LLAPRFile* apr_file = new LLAPRFile(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);		
+		LLAPRFile* apr_file = new LLAPRFile(mHeaderFileName, APR_FOPEN_READ|APR_FOPEN_BINARY, mLocalAPRFilePoolp);		
 		
 		//read the meta element
-		if(!checkRead(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)))
+		bool remove_cache_on_error = false;
+		if(!checkRead(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo), remove_cache_on_error))
 		{
-			return ;
+			llwarns << "Error reading meta information from cache header." << llendl;
+			delete apr_file;
+			return;
 		}
 
 		HeaderEntryInfo* entry ;
-		mNumEntries = 0 ;
-		while(mNumEntries < mCacheSize)
+		for(U32 entry_index = 0; entry_index < mCacheSize; ++entry_index)
 		{
 			entry = new HeaderEntryInfo() ;
-			if(!checkRead(apr_file, entry, sizeof(HeaderEntryInfo)))
+			if(!checkRead(apr_file, entry, sizeof(HeaderEntryInfo), remove_cache_on_error))
 			{
+				llwarns << "Error reading cache header entry. (entry_index=" << entry_index << ")" << llendl;
 				delete entry ;			
-				return ;
+				break;
 			}
 			else if(!entry->mTime) //end of the cache.
 			{
 				delete entry ;
-				return ;
+				break;
 			}
 
-			entry->mIndex = mNumEntries++ ;
-			mHeaderEntryQueue.insert(entry) ;
-			mHandleEntryMap[entry->mHandle] = entry ;
+			entry->mIndex = entry_index;
+			mHandleEntryMap[entry->mHandle] = entry;
 		}
 
 		delete apr_file ;
@@ -462,40 +473,57 @@ void LLVOCache::readCacheHeader()
 
 void LLVOCache::writeCacheHeader()
 {
-	if(mReadOnly || !mEnabled)
+	if (!mEnabled)
 	{
-		return ;
-	}	
+		llwarns << "Not writing cache header: Cache is currently disabled." << llendl;
+		return;
+	}
+
+	if(mReadOnly)
+	{
+		llwarns << "Not writing cache header: Cache is currently in read-only mode." << llendl;
+		return;
+	}
 
-	LLAPRFile* apr_file = new LLAPRFile(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+	LLAPRFile* apr_file = new LLAPRFile(mHeaderFileName, APR_FOPEN_CREATE|APR_FOPEN_WRITE|APR_FOPEN_BINARY|APR_FOPEN_TRUNCATE, mLocalAPRFilePoolp);
 
 	//write the meta element
 	if(!checkWrite(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)))
 	{
-		return ;
+		llwarns << "Error writing meta information to cache header." << llendl;
+		delete apr_file;
+		return;
 	}
 
-	mNumEntries = 0 ;
-	for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; iter != mHeaderEntryQueue.end(); ++iter)
+	U32 entry_index = 0;
+	handle_entry_map_t::iterator iter_end = mHandleEntryMap.end();
+	for(handle_entry_map_t::iterator iter = mHandleEntryMap.begin();
+		iter != iter_end;
+		++iter)
 	{
-		(*iter)->mIndex = mNumEntries++ ;
-		if(!checkWrite(apr_file, (void*)*iter, sizeof(HeaderEntryInfo)))
+		HeaderEntryInfo* entry = iter->second;
+		entry->mIndex = entry_index++;
+		if(!checkWrite(apr_file, (void*)entry, sizeof(HeaderEntryInfo)))
 		{
-			return ;
+			llwarns << "Failed to write cache header for entry " << entry->mHandle << " (entry_index = " << entry_index << ")" << llendl;
+			delete apr_file;
+			return;
 		}
 	}
 
-	mNumEntries = mHeaderEntryQueue.size() ;
-	if(mNumEntries < mCacheSize)
+	// Why do we need to fill the cache header with default entries?  DK 2010-12-14
+	// It looks like we currently rely on the file being pre-allocated so we can seek during updateEntry().
+	if(entry_index < mCacheSize)
 	{
 		HeaderEntryInfo* entry = new HeaderEntryInfo() ;
-		for(U32 i = mNumEntries ; i < mCacheSize; i++)
+		for(; entry_index < mCacheSize; ++entry_index)
 		{
 			//fill the cache with the default entry.
 			if(!checkWrite(apr_file, entry, sizeof(HeaderEntryInfo)))
 			{
+				llwarns << "Failed to fill cache header with default entries (entry_index = " << entry_index << ").  Switching to read-only mode." << llendl;
 				mReadOnly = TRUE ; //disable the cache.
-				return ;
+				break;
 			}
 		}
 		delete entry ;
@@ -505,16 +533,19 @@ void LLVOCache::writeCacheHeader()
 
 BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
 {
-	LLAPRFile* apr_file = new LLAPRFile(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+	LLAPRFile* apr_file = new LLAPRFile(mHeaderFileName, APR_FOPEN_WRITE|APR_FOPEN_BINARY, mLocalAPRFilePoolp);
 	apr_file->seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
 
-	return checkWrite(apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
+	BOOL result = checkWrite(apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
+	delete apr_file;
+	return result;
 }
 
 void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) 
 {
 	if(!mEnabled)
 	{
+		llwarns << "Not reading cache for handle " << handle << "): Cache is currently disabled." << llendl;
 		return ;
 	}
 	llassert_always(mInitialized);
@@ -522,22 +553,24 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
 	handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
 	if(iter == mHandleEntryMap.end()) //no cache
 	{
+		llwarns << "No handle map entry for " << handle << llendl;
 		return ;
 	}
 
 	std::string filename;
 	getObjectCacheFilename(handle, filename);
-	LLAPRFile* apr_file = new LLAPRFile(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+	LLAPRFile* apr_file = new LLAPRFile(filename, APR_FOPEN_READ|APR_FOPEN_BINARY, mLocalAPRFilePoolp);
 
 	LLUUID cache_id ;
 	if(!checkRead(apr_file, cache_id.mData, UUID_BYTES))
 	{
+		llwarns << "Error reading cache_id from " << filename << llendl;
+		delete apr_file;
 		return ;
 	}
 	if(cache_id != id)
 	{
-		llinfos << "Cache ID doesn't match for this region, discarding"<< llendl;
-
+		llwarns << "Cache ID (" << cache_id << ") doesn't match id for this region (" << id << "), discarding.  handle = " << handle << llendl;
 		delete apr_file ;
 		return ;
 	}
@@ -545,6 +578,8 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
 	S32 num_entries;
 	if(!checkRead(apr_file, &num_entries, sizeof(S32)))
 	{
+		llwarns << "Error reading num_entries from " << filename << llendl;
+		delete apr_file;
 		return ;
 	}
 	
@@ -553,13 +588,12 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
 		LLVOCacheEntry* entry = new LLVOCacheEntry(apr_file);
 		if (!entry->getLocalID())
 		{
-			llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl;
+			llwarns << "Aborting cache file load for " << filename << ", cache file corruption! (entry number = " << i << ")" << llendl;
 			delete entry ;
 			break;
 		}
 		cache_entry_map[entry->getLocalID()] = entry;
 	}
-	num_entries = cache_entry_map.size() ;
 
 	delete apr_file ;
 	return ;
@@ -567,86 +601,104 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
 	
 void LLVOCache::purgeEntries()
 {
-	U32 limit = mCacheSize - NUM_ENTRIES_TO_PURGE ;
-	while(mHeaderEntryQueue.size() > limit)
-	{
-		header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ;
-		HeaderEntryInfo* entry = *iter ;
+	U32 limit = mCacheSize - (mCacheSize / ENTRIES_PURGE_FACTOR);
+	limit = llclamp(limit, (U32)1, mCacheSize);
+	// Construct a vector of entries out of the map so we can sort by time.
+	std::vector<HeaderEntryInfo*> header_vector;
+	handle_entry_map_t::iterator iter_end = mHandleEntryMap.end();
+	for (handle_entry_map_t::iterator iter = mHandleEntryMap.begin();
+		iter != iter_end;
+		++iter)
+	{
+		header_vector.push_back(iter->second);
+	}
+	// Sort by time, oldest first.
+	std::sort(header_vector.begin(), header_vector.end(), header_entry_less());
+	while(header_vector.size() > limit)
+	{
+		HeaderEntryInfo* entry = header_vector.front();
 		
-		removeFromCache(entry->mHandle) ;
-		mHandleEntryMap.erase(entry->mHandle) ;		
-		mHeaderEntryQueue.erase(iter) ;
-		delete entry ;
+		removeFromCache(entry->mHandle);
+		mHandleEntryMap.erase(entry->mHandle);
+		header_vector.erase(header_vector.begin());
+		delete entry;
 	}
 
 	writeCacheHeader() ;
+	// *TODO: Verify that we can avoid re-reading the cache header.  DK 2010-12-14
 	readCacheHeader() ;
-	mNumEntries = mHandleEntryMap.size() ;
 }
 
 void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) 
 {
 	if(!mEnabled)
 	{
+		llwarns << "Not writing cache for handle " << handle << "): Cache is currently disabled." << llendl;
 		return ;
 	}
 	llassert_always(mInitialized);
 
 	if(mReadOnly)
 	{
+		llwarns << "Not writing cache for handle " << handle << "): Cache is currently in read-only mode." << llendl;
 		return ;
 	}
 
+	U32 num_handle_entries = mHandleEntryMap.size();
+	
 	HeaderEntryInfo* entry;
 	handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
 	if(iter == mHandleEntryMap.end()) //new entry
-	{		
-		if(mNumEntries >= mCacheSize)
+	{
+		if(num_handle_entries >= mCacheSize)
 		{
 			purgeEntries() ;
+			num_handle_entries = mHandleEntryMap.size();
 		}
 		
 		entry = new HeaderEntryInfo();
 		entry->mHandle = handle ;
 		entry->mTime = time(NULL) ;
-		entry->mIndex = mNumEntries++ ;
-		mHeaderEntryQueue.insert(entry) ;
+		entry->mIndex = num_handle_entries++;
 		mHandleEntryMap[handle] = entry ;
 	}
 	else
 	{
+		// Update access time.
 		entry = iter->second ;
 		entry->mTime = time(NULL) ;
-
-		//resort
-		mHeaderEntryQueue.erase(entry) ;
-		mHeaderEntryQueue.insert(entry) ;
 	}
 
 	//update cache header
 	if(!updateEntry(entry))
 	{
+		llwarns << "Failed to update cache header index " << entry->mIndex << ". handle = " << handle << llendl;
 		return ; //update failed.
 	}
 
 	if(!dirty_cache)
 	{
+		llwarns << "Skipping write to cache for handle " << handle << ": cache not dirty" << llendl;
 		return ; //nothing changed, no need to update.
 	}
 
 	//write to cache file
 	std::string filename;
 	getObjectCacheFilename(handle, filename);
-	LLAPRFile* apr_file = new LLAPRFile(filename, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+	LLAPRFile* apr_file = new LLAPRFile(filename, APR_FOPEN_CREATE|APR_FOPEN_WRITE|APR_FOPEN_BINARY|APR_FOPEN_TRUNCATE, mLocalAPRFilePoolp);
 	
 	if(!checkWrite(apr_file, (void*)id.mData, UUID_BYTES))
 	{
+		llwarns << "Error writing id to " << filename << llendl;
+		delete apr_file;
 		return ;
 	}
 
 	S32 num_entries = cache_entry_map.size() ;
 	if(!checkWrite(apr_file, &num_entries, sizeof(S32)))
 	{
+		llwarns << "Error writing num_entries to " << filename << llendl;
+		delete apr_file;
 		return ;
 	}
 
@@ -654,10 +706,10 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
 	{
 		if(!iter->second->writeToFile(apr_file))
 		{
+			llwarns << "Aborting cache file write for " << filename << ", error writing to file!" << llendl;
 			//failed
-			delete apr_file ;
 			removeCache() ;
-			return ;
+			break;
 		}
 	}
 
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index ed2bc8bafecbeaa49e600cc2afe1d46e93e7c05f..e1030079793a01a91e36c9c9cee9f670ae69dc57 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -95,10 +95,13 @@ class LLVOCache
 	{
 		bool operator()(const HeaderEntryInfo* lhs, const HeaderEntryInfo* rhs) const
 		{
-			return lhs->mTime < rhs->mTime; // older entry in front of queue (set)
+			if (lhs->mTime == rhs->mTime)
+			{
+				return lhs->mHandle < rhs->mHandle;
+			}
+			return lhs->mTime < rhs->mTime; // older entry in front
 		}
 	};
-	typedef std::set<HeaderEntryInfo*, header_entry_less> header_entry_queue_t;
 	typedef std::map<U64, HeaderEntryInfo*> handle_entry_map_t;
 private:
 	LLVOCache() ;
@@ -125,8 +128,8 @@ class LLVOCache
 	void removeCache() ;
 	void purgeEntries();
 	BOOL updateEntry(const HeaderEntryInfo* entry);
-	BOOL checkRead(LLAPRFile* apr_file, void* src, S32 n_bytes) ;
-	BOOL checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes) ;
+	BOOL checkRead(LLAPRFile* apr_file, void* src, S32 n_bytes, bool remove_cache_on_error = true) ;
+	BOOL checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes, bool remove_cache_on_error = true) ;
 	
 private:
 	BOOL                 mEnabled;
@@ -134,11 +137,9 @@ class LLVOCache
 	BOOL                 mReadOnly ;
 	HeaderMetaInfo       mMetaInfo;
 	U32                  mCacheSize;
-	U32                  mNumEntries;
 	std::string          mHeaderFileName ;
 	std::string          mObjectCacheDirName;
 	LLVolatileAPRPool*   mLocalAPRFilePoolp ; 	
-	header_entry_queue_t mHeaderEntryQueue;
 	handle_entry_map_t   mHandleEntryMap;	
 
 	static LLVOCache* sInstance ;
diff --git a/indra/newview/llvoicecallhandler.cpp b/indra/newview/llvoicecallhandler.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..274bd75208b544461c27eee6c0338a1013b297b7
--- /dev/null
+++ b/indra/newview/llvoicecallhandler.cpp
@@ -0,0 +1,61 @@
+ /** 
+ * @file llvoicecallhandler.cpp
+ * @brief slapp to handle avatar to avatar voice call.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llcommandhandler.h" 
+#include "llavataractions.h"
+
+class LLVoiceCallAvatarHandler : public LLCommandHandler
+{
+public: 
+	// requires trusted browser to trigger
+	LLVoiceCallAvatarHandler() : LLCommandHandler("voicecallavatar", UNTRUSTED_THROTTLE) 
+	{ 
+	}
+	
+	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+	{
+		//Make sure we have some parameters
+		if (params.size() == 0)
+		{
+			return false;
+		}
+		
+		//Get the ID
+		LLUUID id;
+		if (!id.set( params[0], FALSE ))
+		{
+			return false;
+		}
+		
+		//instigate call with this avatar
+		LLAvatarActions::startCall( id );		
+		return true;
+	}
+};
+
+LLVoiceCallAvatarHandler gVoiceCallAvatarHandler;
+
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 3f785a99fef3f178e8ea1fa4ed5f90173630dd56..cef3d87f3605c84c554d51a09ad755d35a69e175 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -424,6 +424,7 @@ class LLPipeline
 		RENDER_DEBUG_AVATAR_VOLUME      = 0x0100000,
 		RENDER_DEBUG_BUILD_QUEUE		= 0x0200000,
 		RENDER_DEBUG_AGENT_TARGET       = 0x0400000,
+		RENDER_DEBUG_UPDATE_TYPE		= 0x0800000,
 	};
 
 public:
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 62441fd9841df8d9ea98aa7b9f7423302d0c9dfd..75aec21f93b6c50732591715620b8d8e2bef8a97 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -114,9 +114,6 @@
     <color
      name="AlertCautionTextColor"
      reference="LtYellow" />
-    <color
-     name="AgentLinkColor"
-     reference="EmphasisColor" />
     <color
      name="AlertTextColor"
      value="0.58 0.66 0.84 1" />
@@ -348,9 +345,6 @@
     <color
      name="GridlineShadowColor"
      value="0 0 0 0.31" />
-    <color
-     name="GroupLinkColor"
-     reference="White" />
     <color
      name="GroupNotifyBoxColor"
      value="0.3344 0.5456 0.5159 1" />
diff --git a/indra/newview/skins/default/textures/icons/Web_Profile_Off.png b/indra/newview/skins/default/textures/icons/Web_Profile_Off.png
new file mode 100644
index 0000000000000000000000000000000000000000..f5fb774a6faac1d6f675fc2f566b2709c7b7d8ef
Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Web_Profile_Off.png differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 89611d8899d35a535d1aed8c3009cad078b9b3d8..2c00120177e094c589f8f7c594944f528186713b 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -553,11 +553,11 @@ with the same filename but different name
 
   <texture name="Wearables_Divider" file_name="windows/Wearables_Divider.png" preload="false" />
 
+  <texture name="Web_Profile_Off" file_name="icons/Web_Profile_Off.png" preload="false" />
+
   <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png"  preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="WellButton_Lit_Selected" file_name="bottomtray/WellButton_Lit_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
 
-
-
   <texture name="Window_Background" file_name="windows/Window_Background.png" preload="true"
            scale.left="4" scale.top="24" scale.right="26" scale.bottom="4" />
   <texture name="Window_Foreground" file_name="windows/Window_Foreground.png" preload="true"
diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml
index 70299c61b4e8506ecc0bc07506a46179d6be2535..27024f4eaaf4d443fe82af5702af5e2e7975aeae 100644
--- a/indra/newview/skins/default/xui/da/notifications.xml
+++ b/indra/newview/skins/default/xui/da/notifications.xml
@@ -1580,9 +1580,6 @@ Klik på Acceptér for at deltage eller Afvis for at afvise invitationen. Klik p
 	<notification name="VoiceCallGenericError">
 		En fejl er opstået under forsøget på at koble sig på stemme chatten [VOICE_CHANNEL_NAME].  Pråv venligst senere.
 	</notification>
-	<notification name="ServerVersionChanged">
-		Du er netop ankommet til en region der benytter en anden server version, hvilket kan influere på hastigheden. [[URL] For at se yderligere.]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		Den SLurl du klikkede på understøttes ikke.
 	</notification>
@@ -1636,7 +1633,7 @@ Knappen vil blive vist når der er nok plads til den.
 	<notification name="ShareItemsConfirmation">
 		Er du sikker på at du vil dele følgende genstande:
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 Med følgende beboere:
 
diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml
index 06cc02cd847a5181d9ec94da8d9bbffe6b9310b7..c26b02ec8fbe396f83c2d1e34aa10701e1fc5a16 100644
--- a/indra/newview/skins/default/xui/de/notifications.xml
+++ b/indra/newview/skins/default/xui/de/notifications.xml
@@ -2691,9 +2691,6 @@ Klicken Sie auf  &apos;Akzeptieren &apos;, um dem Chat beizutreten, oder auf  &a
 	<notification name="VoiceCallGenericError">
 		Fehler beim Versuch, eine Voice-Chat-Verbindung zu [VOICE_CHANNEL_NAME] herzustellen.  Bitte versuchen Sie es erneut.
 	</notification>
-	<notification name="ServerVersionChanged">
-		Sie haben eine Region betreten, die eine andere Server-Version verwendet. Dies kann sich auf die Leistung auswirken. [[URL] Versionshinweise anzeigen.]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		Die SLurl, auf die Sie geklickt haben, wird nicht unterstützt.
 	</notification>
@@ -2747,7 +2744,7 @@ Die Schaltfläche wird angezeigt, wenn genügend Platz vorhanden ist.
 	<notification name="ShareItemsConfirmation">
 		Möchten Sie diese Objekte wirklich für andere freigeben:
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 Für folgende Einwohner:
 
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index e70e1eb61b3a05db9c45570b418838b72f10e048..1808fea44541ec42ab88fe791c2be08e010ad6fd 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -872,12 +872,13 @@
              length="1"
              follows="left|top"
              left_pad="0"
-             height="30"
+             height="20"
              layout="topleft"
              name="Creator Name"
              top_delta="0"
              width="190"
-             word_wrap="true">
+             word_wrap="true"
+             use_ellipses="ture">
                 Mrs. Esbee Linden (esbee.linden)
             </text>
             <text
@@ -888,7 +889,7 @@
              height="19"
              layout="topleft"
              name="Owner:"
-             top_pad="3"
+             top_pad="13"
              width="90">
                 Owner:
             </text>
@@ -897,13 +898,14 @@
              type="string"
              length="1"
              follows="left|top"
-             height="30"
+             height="20"
              layout="topleft"
              name="Owner Name"
              left_pad="0"
              top_delta="0"
              width="190"
-             word_wrap="true">
+             word_wrap="true"
+             use_ellipses="true">
                 Mrs. Erica "Moose" Linden (erica.linden)
             </text>
            <text
@@ -914,7 +916,7 @@
              left="10"
              height="18"
              name="Group:"
-             top_pad="7"
+             top_pad="17"
              width="75">
                 Group:
             </text>
diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml
index 2ad46824c25def60bfef10ca725e16947a4184c4..6ec063cd26df9a1238fd6f4b7b26edec551af0c3 100644
--- a/indra/newview/skins/default/xui/en/floater_web_content.xml
+++ b/indra/newview/skins/default/xui/en/floater_web_content.xml
@@ -1,190 +1,190 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<floater
-  legacy_header_height="18"
-  can_resize="true"
-  height="440"
-  layout="topleft"
-  min_height="140"
-  min_width="467"
-  name="floater_web_content"
-  help_topic="floater_web_content"
-  save_rect="true"
-  auto_tile="true"
-  title=""
-  initial_mime_type="text/html"
-  width="820">
-  <layout_stack
-    bottom="440"
-    follows="left|right|top|bottom"
-    layout="topleft"
-    left="5"
-    name="stack1"
-    orientation="vertical"
-    top="20"
-    width="810">
-    <layout_panel
-      auto_resize="false"
-      default_tab_group="1"
-      height="22"
-      layout="topleft"
-      left="0"
-      min_height="20"
-      name="nav_controls"
-      top="400"
-      user_resize="false"
-      width="800">
-      <button
-        image_overlay="Arrow_Left_Off"
-		    image_disabled="PushButton_Disabled"
-		    image_disabled_selected="PushButton_Disabled"
-		    image_selected="PushButton_Selected"
-		    image_unselected="PushButton_Off"
-		    hover_glow_amount="0.15"
-        tool_tip="Navigate back"
-        follows="left|top"
-        height="22"
-        layout="topleft"
-        left="1"
-        name="back"
-        top="0"
-        width="22">
-        <button.commit_callback
-          function="WebContent.Back" />
-      </button>
-      <button
-        image_overlay="Arrow_Right_Off"
-		    image_disabled="PushButton_Disabled"
-		    image_disabled_selected="PushButton_Disabled"
-		    image_selected="PushButton_Selected"
-		    image_unselected="PushButton_Off"
-        tool_tip="Navigate forward"
-        follows="left|top"
-        height="22"
-        layout="topleft"
-        left="27"
-        name="forward"
-        top_delta="0"
-        width="22">
-        <button.commit_callback
-          function="WebContent.Forward" />
-      </button>
-      <button
-        image_overlay="Stop_Off"
-		    image_disabled="PushButton_Disabled"
-		    image_disabled_selected="PushButton_Disabled"
-		    image_selected="PushButton_Selected"
-		    image_unselected="PushButton_Off"
-        tool_tip="Stop navigation"
-        enabled="true"
-        follows="left|top"
-        height="22"
-        layout="topleft"
-        left="51"
-        name="stop"
-        top_delta="0"
-        width="22">
-        <button.commit_callback
-          function="WebContent.Stop" />
-      </button>
-      <button
-        image_overlay="Refresh_Off"
-		    image_disabled="PushButton_Disabled"
-		    image_disabled_selected="PushButton_Disabled"
-		    image_selected="PushButton_Selected"
-		    image_unselected="PushButton_Off"
-        tool_tip="Reload page"
-        follows="left|top"
-        height="22"
-        layout="topleft"
-        left="51"
-        name="reload"
-        top_delta="0"
-        width="22">
-        <button.commit_callback
-          function="WebContent.Reload" />
-      </button>
-      <combo_box
-        allow_text_entry="true"
-        follows="left|top|right"
-        tab_group="1"
-        height="22"
-        layout="topleft"
-        left_pad="4"
-        max_chars="1024"
-        name="address"
-        combo_editor.select_on_focus="true"
-        tool_tip="Enter URL here"
-        top_delta="0"
-        width="702">
-        <combo_box.commit_callback
-          function="WebContent.EnterAddress" />
-      </combo_box>
-      <icon
-        name="media_secure_lock_flag"
-        height="16"
-        follows="top|right"
-        image_name="Lock2"
-        layout="topleft"
-        left_delta="656"
-        top_delta="2"
-        visible="false" 
-        tool_tip="Secured Browsing"
-        width="16" />
-      <button
-        image_overlay="ExternalBrowser_Off"
-		    image_disabled="PushButton_Disabled"
-		    image_disabled_selected="PushButton_Disabled"
-		    image_selected="PushButton_Selected"
-		    image_unselected="PushButton_Off"
-        tool_tip="Open current URL in your desktop browser"
-        follows="right|top"
-        enabled="true" 
-        height="22"
-        layout="topleft"
-        name="popexternal"
-        right="800"
-        top_delta="-2"
-        width="22">
-        <button.commit_callback
-          function="WebContent.PopExternal" />
-      </button>
-    </layout_panel>
-    <layout_panel
-      height="40"
-      layout="topleft"
-      left_delta="0"
-      name="external_controls"
-      top_delta="0"
-      user_resize="false"
-      width="540">
-      <web_browser
-        bottom="-22"
-        follows="all"
-        layout="topleft"
-        left="0"
-        name="webbrowser"
-        top="0"/>
-      <text
-        type="string"
-        length="100"
-        follows="bottom|left"
-        height="20"
-        layout="topleft"
-        left_delta="0"
-        name="statusbartext"
-        parse_urls="false"
-        text_color="0.4 0.4 0.4 1" 
-        top_pad="5"
-        width="452"/>
-      <progress_bar
-        color_bar="0.3 1.0 0.3 1"
-        follows="bottom|right"
-        height="16"
-        top_delta="-1"
-        left_pad="24"
-        layout="topleft"
-        name="statusbarprogress"
-        width="64"/>
-    </layout_panel>
-  </layout_stack>
-</floater>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+  legacy_header_height="18"
+  can_resize="true"
+  height="775"
+  layout="topleft"
+  min_height="400"
+  min_width="500"
+  name="floater_web_content"
+  help_topic="floater_web_content"
+  save_rect="true"
+  auto_tile="true"
+  title=""
+  initial_mime_type="text/html"
+  width="735">
+  <layout_stack
+    bottom="775"
+    follows="left|right|top|bottom"
+    layout="topleft"
+    left="5"
+    name="stack1"
+    orientation="vertical"
+    top="20"
+    width="725">
+    <layout_panel
+      auto_resize="false"
+      default_tab_group="1"
+      height="22"
+      layout="topleft"
+      left="0"
+      min_height="20"
+      name="nav_controls"
+      top="400"
+      user_resize="false"
+      width="725">
+      <button
+        image_overlay="Arrow_Left_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+		    hover_glow_amount="0.15"
+        tool_tip="Navigate back"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="1"
+        name="back"
+        top="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Back" />
+      </button>
+      <button
+        image_overlay="Arrow_Right_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Navigate forward"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="27"
+        name="forward"
+        top_delta="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Forward" />
+      </button>
+      <button
+        image_overlay="Stop_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Stop navigation"
+        enabled="true"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="51"
+        name="stop"
+        top_delta="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Stop" />
+      </button>
+      <button
+        image_overlay="Refresh_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Reload page"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="51"
+        name="reload"
+        top_delta="0"
+        width="22">
+        <button.commit_callback
+          function="WebContent.Reload" />
+      </button>
+      <combo_box
+        allow_text_entry="true"
+        follows="left|top|right"
+        tab_group="1"
+        height="22"
+        layout="topleft"
+        left_pad="4"
+        max_chars="1024"
+        name="address"
+        combo_editor.select_on_focus="true"
+        tool_tip="Enter URL here"
+        top_delta="0"
+        width="627">
+        <combo_box.commit_callback
+          function="WebContent.EnterAddress" />
+      </combo_box>
+      <icon
+        name="media_secure_lock_flag"
+        height="16"
+        follows="top|right"
+        image_name="Lock2"
+        layout="topleft"
+        left_delta="575"
+        top_delta="2"
+        visible="false" 
+        tool_tip="Secured Browsing"
+        width="16" />
+      <button
+        image_overlay="ExternalBrowser_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        tool_tip="Open current URL in your desktop browser"
+        follows="right|top"
+        enabled="true" 
+        height="22"
+        layout="topleft"
+        name="popexternal"
+        right="725"
+        top_delta="-2"
+        width="22">
+        <button.commit_callback
+          function="WebContent.PopExternal" />
+      </button>
+    </layout_panel>
+    <layout_panel
+      height="40"
+      layout="topleft"
+      left_delta="0"
+      name="external_controls"
+      top_delta="0"
+      user_resize="false"
+      width="540">
+      <web_browser
+        bottom="-22"
+        follows="all"
+        layout="topleft"
+        left="0"
+        name="webbrowser"
+        top="0"/>
+      <text
+        type="string"
+        length="200"
+        follows="bottom|left"
+        height="20"
+        layout="topleft"
+        left_delta="0"
+        name="statusbartext"
+        parse_urls="false"
+        text_color="0.4 0.4 0.4 1"
+        top_pad="5"
+        width="520"/>
+      <progress_bar
+        color_bar="0.3 1.0 0.3 1"
+        follows="bottom|right"
+        height="16"
+        top_delta="-1"
+        left_pad="24"
+        layout="topleft"
+        name="statusbarprogress"
+        width="64"/>
+    </layout_panel>
+  </layout_stack>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml
index eb2e7ea7887fc79476e31c2234d38c9653cfb1b7..8d14c974b434b4ddef43e3b0a49a95732cbea132 100644
--- a/indra/newview/skins/default/xui/en/inspect_object.xml
+++ b/indra/newview/skins/default/xui/en/inspect_object.xml
@@ -76,13 +76,24 @@ L$30,000
   </text>
   <!-- Overlapping buttons for all default actions.  Show "Buy" if
   for sale, "Sit" if can sit, etc. -->
+  <icon
+   name="secure_browsing"
+   image_name="Lock"
+   left="0"
+   visible="false"
+   width="18"
+   height="18"
+   top="103"
+   tool_tip="Secure Browsing"
+   follows="left|top" />
    <text
    follows="all"
    font="SansSerifSmall"
    height="13"
    name="object_media_url"
-   width="220"
-   top_pad="0"
+   width="207"
+   left_pad="2"
+   top_delta="0"
    max_length = "50"
    use_ellipses="true">
    http://www.superdupertest.com
@@ -135,16 +146,6 @@ L$30,000
    name="open_btn"
    top_delta="0"
    width="80" />
-  <icon
-   name="secure_browsing"
-   image_name="Lock"
-   left_delta="80"
-   visible="false"
-   width="18"
-   height="18"
-   top_delta="0"
-   tool_tip="Secure Browsing"
-   follows="left|top" />
 
  <!--  non-overlapping buttons here -->
      <button
@@ -153,7 +154,7 @@ L$30,000
      label="More"
      layout="topleft"
      name="more_info_btn"
-     left_delta="10"
+     left_pad="10"
      top_delta="0"
      tab_stop="false"
      width="80" />
diff --git a/indra/newview/skins/default/xui/en/menu_mini_map.xml b/indra/newview/skins/default/xui/en/menu_mini_map.xml
index 8fe89d39343b3b75139bd74ca3ef921f7f4054e4..ea263d05ceff687978d60373687b44d8721e9c21 100644
--- a/indra/newview/skins/default/xui/en/menu_mini_map.xml
+++ b/indra/newview/skins/default/xui/en/menu_mini_map.xml
@@ -8,7 +8,7 @@
  top="724"
  visible="false"
  width="128">
-    <menu_item_call
+	<menu_item_call
      label="Zoom Close"
      name="Zoom Close">
         <menu_item_call.on_click
@@ -29,7 +29,14 @@
          function="Minimap.Zoom"
          parameter="far" />
     </menu_item_call>
-    <menu_item_separator />
+	<menu_item_call
+     label="Zoom Default"
+     name="Zoom Default">
+		<menu_item_call.on_click
+         function="Minimap.Zoom"
+         parameter="default" />
+	</menu_item_call>
+	<menu_item_separator />
     <menu_item_check
        label="Rotate Map"
        name="Rotate Map">
diff --git a/indra/newview/skins/default/xui/en/menu_object.xml b/indra/newview/skins/default/xui/en/menu_object.xml
index c751aa4e0c2caa949e8530d5cc5237750ab70ebf..719509301b0a9486393c0c5490df6ab4244b1620 100644
--- a/indra/newview/skins/default/xui/en/menu_object.xml
+++ b/indra/newview/skins/default/xui/en/menu_object.xml
@@ -100,7 +100,7 @@
          name="Object Attach HUD" />
    </context_menu>
    <context_menu
-         label="Remove"
+         label="Manage"
          name="Remove">
    <menu_item_call
          enabled="false"
@@ -129,15 +129,6 @@
          <menu_item_call.on_enable
           function="Object.EnableReturn" />
      </menu_item_call>
-     <menu_item_call
-   enabled="false"
-   label="Delete"
-   name="Delete">
-      <menu_item_call.on_click
-       function="Object.Delete" />
-      <menu_item_call.on_enable
-       function="Object.EnableDelete" />
-    </menu_item_call>
     </context_menu>
    <menu_item_separator layout="topleft" />
    <menu_item_call
@@ -176,4 +167,13 @@
       <menu_item_call.on_enable
        function="Object.EnableBuy" />
    </menu_item_call>
+   <menu_item_call
+     enabled="false"
+     label="Delete"
+     name="Delete">
+      <menu_item_call.on_click
+       function="Object.Delete" />
+      <menu_item_call.on_enable
+       function="Object.EnableDelete" />
+  </menu_item_call>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
index 6f46165883e4ac868caec8df4b2c280a480d99d4..1aeb166e01570aaccb4ead89d93c7a887e3a4cad 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
@@ -25,6 +25,14 @@
          function="Places.LandmarksGear.Enable"
          parameter="category" />
     </menu_item_call>
+    <menu_item_call
+     label="Restore Item"
+     layout="topleft"
+     name="restore_item">
+        <menu_item_call.on_click
+         function="Places.LandmarksGear.Custom.Action"
+         parameter="restore" />
+    </menu_item_call>
     <menu_item_separator
      layout="topleft" />
     <menu_item_call
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
index 121e7cc07ac23761271bf7cae52f205501bc3561..ff5fdd3795322d5c3582f0b7ff7d73b3240c6d29 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
@@ -60,6 +60,14 @@
          function="Places.LandmarksGear.Enable"
          parameter="category" />
     </menu_item_call>
+    <menu_item_call
+     label="Restore Item"
+     layout="topleft"
+     name="restore_item">
+        <menu_item_call.on_click
+         function="Places.LandmarksGear.Custom.Action"
+         parameter="restore" />
+    </menu_item_call>
     <menu_item_separator
      layout="topleft" />
     <menu_item_call
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index d997a262a820dae84ff8332bbf921cf10661a09a..2207e418c8dff036b8e58a3823378bb4cd10abd8 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2152,6 +2152,16 @@
            function="Advanced.ToggleInfoDisplay"
            parameter="render batches" />
         </menu_item_check>
+        <menu_item_check
+         label="Update Type"
+         name="Update Type">
+          <menu_item_check.on_check
+           function="Advanced.CheckInfoDisplay"
+           parameter="update type" />
+          <menu_item_check.on_click
+           function="Advanced.ToggleInfoDisplay"
+           parameter="update type" />
+        </menu_item_check>
         <menu_item_check
          label="Texture Anim"
          name="Texture Anim">
@@ -2717,6 +2727,18 @@
                  function="Floater.Toggle"
                  parameter="region_debug_console" />
             </menu_item_check>
+            <menu_item_check
+             label="Region Debug Console"
+             name="Region Debug Console"
+             shortcut="control|shift|`"
+             use_mac_ctrl="true">
+                <menu_item_check.on_check
+                 function="Floater.Visible"
+                 parameter="region_debug_console" />
+                <menu_item_check.on_click
+                 function="Floater.Toggle"
+                 parameter="region_debug_console" />
+            </menu_item_check>
 
             <menu_item_separator />
 
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 63c030b0687cd85f33fdadfe9b4f57ab400e77f7..f008042a81c4e7d3edb0d355a9440ddf7ba83849 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -251,6 +251,16 @@ Save all changes to clothing/body parts?
      yestext="OK"/>
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="FavoritesOnLogin"
+   type="alertmodal">    
+    Note: When you turn on this option, anyone who uses this computer can see your list of favorite locations.
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="GrantModifyRights"
@@ -6293,15 +6303,6 @@ An error has occurred while trying to connect to voice chat for [VOICE_CHANNEL_N
     </unique>
   </notification>
 
-  <notification
-   duration="10"
-   icon="notifytip.tga"
-   name="ServerVersionChanged"
-   priority="high"
-   type="notifytip">
-You just entered a region using a different server version, which may affect performance. [[URL] View the release notes.]
-  </notification>
-
   <notification
    icon="notifytip.tga"
    name="UnsupportedCommandSLURL"
@@ -6421,7 +6422,7 @@ Select residents to share with.
    type="alertmodal">
 Are you sure you want to share the following items:
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 With the following Residents:
 
diff --git a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml
index 4b21ffa1f915238ed2dede4cf5b3a1d4b0eea971..e40dc430fc50d9033b2c5121d3cf4e82bac84b43 100644
--- a/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_avatar_list_item.xml
@@ -134,7 +134,7 @@
     <button
      follows="right"
      height="20"
-     image_overlay="ForwardArrow_Off"
+     image_overlay="Web_Profile_Off"
      layout="topleft"
      left_pad="5"
      right="-28"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
index 90dbddaff7bda6e5a4be5abb33ce663906530f5a..37265d65f10e0f3d9a3b143776ed4ca8344fd132 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml
@@ -328,17 +328,6 @@
        name="homepage_edit"
        width="272">
       </line_editor>
-      <check_box
-       follows="left|top"
-       font="SansSerifSmall"
-       label="Show me in Search results"
-       layout="topleft"
-       left="8"
-       name="show_in_search_checkbox"
-       height="15"
-       label_text.text_color="white"
-       top_pad="12"
-       width="100" />
       <text
          follows="left|top"
          font="SansSerifSmall"
diff --git a/indra/newview/skins/default/xui/en/panel_group_invite.xml b/indra/newview/skins/default/xui/en/panel_group_invite.xml
index 15a3191bdfcb48e43ffe7a54274040e3254c4fcc..cd834b61ce61230dd06315d08cc65502696aaac7 100644
--- a/indra/newview/skins/default/xui/en/panel_group_invite.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_invite.xml
@@ -94,7 +94,7 @@
      left_pad="2"
      name="cancel_button"
      top_delta="0"
-     width="70" />
+     width="65" />
 	 <string 
 	 name="GroupInvitation">
 	 Group Invitation
diff --git a/indra/newview/skins/default/xui/en/panel_group_land_money.xml b/indra/newview/skins/default/xui/en/panel_group_land_money.xml
index 1270a21710bfafc03a7b9c1be88f51588cc414e8..eff674c628af3d10d055b2c393788ca3271d5298 100644
--- a/indra/newview/skins/default/xui/en/panel_group_land_money.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_land_money.xml
@@ -67,23 +67,23 @@
         <scroll_list.columns
          label="Parcel"
          name="name"
-         width="47" />
+         relative_width="0.2" />
         <scroll_list.columns
          label="Region"
          name="location"
-         width="47" />
+         relative_width="0.2" />
         <scroll_list.columns
          label="Type"
          name="type"
-         width="47" />
+         relative_width="0.2" />
         <scroll_list.columns
          label="Area"
          name="area"
-         width="47" />
+         relative_width="0.2" />
         <scroll_list.columns
          label="Hidden"
          name="hidden"
-         width="47" />
+         relative_width="0.2" />
     </scroll_list>
     <text
      type="string"
@@ -117,7 +117,7 @@
      name="map_button"
      top_delta="-4"
      left_pad="0"
-     width="60"
+     width="57"
      enabled="false" />
     <text
      type="string"
diff --git a/indra/newview/skins/default/xui/en/panel_group_list_item.xml b/indra/newview/skins/default/xui/en/panel_group_list_item.xml
index 7d0b0890f0250a97183bce3d5f06ca545de209e8..12735026fa0108ccad9be967a4e41100257e2b98 100644
--- a/indra/newview/skins/default/xui/en/panel_group_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_list_item.xml
@@ -63,7 +63,7 @@
     <button
      follows="right"
      height="20"
-     image_overlay="ForwardArrow_Off"
+     image_overlay="Web_Profile_Off"
      layout="topleft"
      left_pad="5"
      right="-3"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 257ed799da3e32f8971dc89f35c01b92e3c5a5a2..806182bcb4ea6054e66824469d17675bfd93202b 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -61,23 +61,28 @@ left="20"
 width="150">
 Username:
 </text>
-<line_editor
+<combo_box
+allow_text_entry="true"
 follows="left|bottom"
 height="22"
-label="bobsmith12 or Steller Sunshine"
 left_delta="0"
-max_length_bytes="63"
-name="username_edit"
-prevalidate_callback="ascii" 
+max_chars="128"
+prevalidate_callback="ascii"
 select_on_focus="true"
 tool_tip="The username you chose when you registered, like bobsmith12 or Steller Sunshine"
 top_pad="0"
-width="150" />
+name="username_combo"
+width="178">
+  <combo_box.combo_button
+   visible ="false"/>
+  <combo_box.drop_down_button
+   visible ="false"/>
+</combo_box>
 <text
 follows="left|bottom"
 font="SansSerifSmall"
 height="15"
-left_pad="8"
+left_pad="-19"
 name="password_text"
 top="20"
     width="150">
diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml
index 5b8abaca6f1b7467f72603bf44805969da26f482..4bd2235cdae86799fd169430d94132b0218d9b3f 100644
--- a/indra/newview/skins/default/xui/en/panel_my_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml
@@ -31,10 +31,18 @@
      name="no_group_text"
      value="None" />
     <string
-	 name="RegisterDateFormat">
-	 [REG_DATE] ([AGE])
-	</string>
-    <layout_stack
+	   name="RegisterDateFormat">
+	   [REG_DATE] ([AGE])
+	  </string>
+    <string
+      name="name_text_args">
+      [NAME]
+    </string>
+    <string
+      name="display_name_text_args">
+      [DISPLAY_NAME]
+    </string>
+  <layout_stack
      name="layout"
      orientation="vertical"
      follows="all"
@@ -79,11 +87,12 @@
                   name="second_life_image_panel"
                   top="0"
                   width="297">
+
               <texture_picker
                allow_no_texture="true"
                default_image_name="None"
                enabled="false"
-               fallback_image="Generic_Person_Large" 
+               fallback_image="Generic_Person_Large"
                follows="top|left"
                height="124"
                layout="topleft"
@@ -91,258 +100,47 @@
                name="2nd_life_pic"
                top="10"
                width="102" />
-              <icon
-              height="102"
-              image_name="Blank"
-              layout="topleft"
-              name="2nd_life_edit_icon"
-              label=""
-              left="3"
-              tool_tip="Click the Edit Profile button below to change image"
-              top="10"
-              width="102" />
-              <text
-               follows="left|top|right"
-         font.style="BOLD"
-               height="15"
-               layout="topleft"
-               left_pad="10"
-               name="title_sl_descr_text"
-               text_color="white"
-               top_delta="0"
-               value="[SECOND_LIFE]:"
-               width="180" />
-              <expandable_text
-               follows="left|top|right"
-               height="95"
-               layout="topleft"
-               left="107"
-               textbox.max_length="512"
-               textbox.show_context_menu="true"
-               name="sl_description_edit"
-               top_pad="-3"
-               translate="false"
-               width="181"
-               expanded_bg_visible="true"
-               expanded_bg_color="DkGray">
-                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum.
-              </expandable_text>
-            </panel>
-            <panel
-             follows="left|top|right"
-             height="117"
-             layout="topleft"
-       top_pad="0"
-             left="10"
-             name="first_life_image_panel"
-             width="297">
-              <texture_picker
-               allow_no_texture="true"
-               default_image_name="None"
-               enabled="false"
-               fallback_image="Generic_Person_Large"
-               follows="top|left"
-               height="124"
-               layout="topleft"
-               left="3"
-               name="real_world_pic"
-               width="102" />
-              <icon
-              height="102"
-              image_name="Blank"
-              layout="topleft"
-              name="real_world_edit_icon"
-              label=""
-              left="3"
-              tool_tip="Click the Edit Profile button below to change image"
-              top="4"
-              width="102" />
+
               <text
-               follows="left|top|right"
-         font.style="BOLD"
-               height="15"
-               layout="topleft"
-               left_pad="10"
-               name="title_rw_descr_text"
-               text_color="white"
-               top_delta="0"
-               value="Real World:"
-               width="180" />
-              <expandable_text
-               follows="left|top|right"
-               height="95"
-               layout="topleft"
-               left="107"
-               textbox.max_length="512"
-               textbox.show_context_menu="true"
-               name="fl_description_edit"
-               top_pad="-3"
-               translate="false"
-               width="181"
-               expanded_bg_visible="true"
-               expanded_bg_color="DkGray">
-                Lorem ipsum dolor sit amet, consectetur adlkjpiscing elit moose moose. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet. adipiscing elit. Aenean rigviverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet sorbet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum.
-              </expandable_text>
-            </panel>
-            <text
-             follows="left|top|right"
-             height="15"
-       font.style="BOLD"
-       font="SansSerifMedium"
-             layout="topleft"
-             left="10"
-             name="homepage_edit"
-             top_pad="0"
-             translate="false"
-             value="http://librarianavengers.org"
-             width="300"
-             word_wrap="false"
-             use_ellipses="true"
-         />
-            <text
-             follows="left|top|right"
-           font.style="BOLD"
-             height="10"
-             layout="topleft"
-             left="10"
-             name="title_member_text"
-             text_color="white"
-             top_pad="10"
-             value="Resident Since:"
-             width="300" />
-            <text_editor
-             allow_scroll="false"
-             bg_visible="false"
-             follows="left|top|right"
-             h_pad="0"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="register_date"
-             read_only="true"
-             translate="false"
-             v_pad="0"
-             value="05/31/2376"
-             width="300"
-             word_wrap="true" />
-            <text
-             follows="left|top|right"
-       font.style="BOLD"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="title_acc_status_text"
-             text_color="white"
-             top_pad="5"
-             value="Account Status:"
-             width="300" />
-            <!-- <text
-         type="string"
-         follows="left|top"
-         font="SansSerifSmall"
-         height="15"
-         layout="topleft"
-         left_pad="10"
-         name="my_account_link"
-         top_delta="0"
-	 value="Go to Dashboard"
-         width="100"/> -->
-            <text_editor
-            allow_scroll="false"
-            bg_visible="false"
-            follows="left|top|right"
-            h_pad="0"
-            height="28"
-            layout="topleft"
-            left="10"
-            name="acc_status_text"
-            read_only="true"
-            top_pad="0"
-            translate="false"
-            v_pad="0"
-            width="300"
-            word_wrap="true">
-              Resident. No payment info on file.
-              Linden.
-            </text_editor>
-            <text
-             follows="left|top|right"
-       font.style="BOLD"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="title_partner_text"
-             text_color="white"
-             top_pad="3"
-             value="Partner:"
-             width="300" />
-            <panel
-             follows="left|top|right"
-             height="15"
-             layout="topleft"
-             left="10"
-             name="partner_data_panel"
-             top_pad="0"
-             width="300">
+                follows="left|top|right"
+                font="SansSerifLarge"
+                font.style="BOLD"
+                height="15"
+                layout="topleft"
+                left_pad="10"
+                name="display_name_descr_text"
+                text_color="0.7 0.7 0.7 1.0"
+                top_delta="0"
+                width="280" >
+                User name
+                </text>
+
               <text
-               follows="left|top|right"
-               height="10"
-               initial_value="(retrieving)"
-               layout="topleft"
-               left="0"
-               link="true"
-               name="partner_text"
-               top="0"
-               use_ellipses="true" 
-           width="300" />
+                follows="left|top|right"
+                font.style="BOLD"
+                height="15"
+                layout="topleft"
+                left_delta="0"
+                name="name_descr_text"
+                text_color="0.4 0.4 0.4 1.0"
+                top_delta="20"
+                width="280">
+                Display Name
+              </text>
+
+              <button
+                follows="bottom"
+                height="23"
+                left_delta="0"
+                top_delta="20"
+                label="Profile"
+                name="see_profile_btn"
+                tool_tip="See profile for this avatar"
+                width="120" />
+
             </panel>
-            <text
-             follows="left|top|right"
-       font.style="BOLD"
-             height="13"
-             layout="topleft"
-             left="10"
-             name="title_groups_text"
-             text_color="white"
-             top_pad="3"
-             value="Groups:"
-             width="300" />
-            <expandable_text
-            follows="all"
-            height="113"
-            layout="topleft"
-            left="7"
-            name="sl_groups"
-          top_pad="0"
-            translate="false"
-            textbox.show_context_menu="true"
-            width="298"
-            expanded_bg_visible="true"
-            expanded_bg_color="DkGray">
-              Lorem ipsum dolor sit amet, consectetur adlkjpiscing elit moose moose. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet. adipiscing elit. Aenean rigviverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet sorbet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. Aenean viverra tulip moosetop. Slan de heelish marfnik tooplod. Sum sum to whop de wompam booster copm.
-            </expandable_text>
           </panel>
         </scroll_container>
       </layout_panel>
       </layout_stack>
- 	<panel
-     follows="bottom|left|right"
-     height="23"
-     layout="topleft"
-     left="0"
-     top_pad="1"
-     name="profile_me_buttons_panel"
-     visible="false"
-     width="315">
-        <button
-         follows="bottom"
-         height="23"
-         left="6"
-	 	 top="1"
-         label="Edit Profile"
-         name="edit_profile_btn"
-         tool_tip="Edit your personal information"
-         width="152" />
- 	</panel>
-
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_nearby_media.xml b/indra/newview/skins/default/xui/en/panel_nearby_media.xml
index 8c13ced8f39809db5747d939de65726529ad3824..9bd60b935f6cc49bba64da11999617736b3feb4c 100644
--- a/indra/newview/skins/default/xui/en/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/en/panel_nearby_media.xml
@@ -68,24 +68,12 @@
 		right="-8"
 		width="66"
 		height="22"
+		is_toggle="true"
 		label="More &gt;&gt;"
-		label_selected="Less &lt;&lt;">
+		label_selected="&lt;&lt; Less">
 	  <button.commit_callback
 		  function="MediaListCtrl.MoreLess" />
 	</button>
-  <button
-		name="less_btn"
-		follows="right"
-		tool_tip="Advanced Controls"
-		top_delta="0"
-		right="-8"
-		width="66"
-		height="22"
-		label="More &gt;&gt;"
-		label_selected="Less &lt;&lt;">
-      <button.commit_callback
-        function="MediaListCtrl.MoreLess" />
-  </button>
   </panel>
   <panel
 	  name="nearby_media_panel"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
index 626122c0b054774cb4213586b676117d8f0b3032..ef25588ca37c7909b5abb9ac75bf270020ee6060 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -40,6 +40,15 @@
      width="300">
        (Locations, images, web, search history)
     </text>
+    <check_box
+	 height="16"
+     enabled="true"
+     label="Show me in Search results"
+     layout="topleft"
+     left="30"
+     name="online_searchresults"
+     top_pad="20"
+     width="350" />
     <check_box
 	 height="16"
 	 enabled="false"
@@ -68,6 +77,16 @@
      left="30"
      name="auto_disengage_mic_check"
      top_pad="10"
+     width="350" />
+    <check_box
+     control_name="ShowFavoritesOnLogin"
+     enabled="false" 
+     height="16"
+     label="Show my Favorite Landmarks at Login (via &apos;Start At&apos; drop-down menu)"
+     layout="topleft"
+     left="30"
+     name="favorites_on_login_check"
+     top_pad="10"
      width="350" />
 	<text
       type="string"
@@ -78,7 +97,7 @@
      left="30"
      mouse_opaque="false"
      name="Logs:"
-     top_pad="30"
+     top_pad="20"
      width="350">
         Chat Logs:
     </text>
@@ -170,7 +189,7 @@
      layout="topleft"
      left="30"
      name="block_list"
-     top_pad="35"
+     top_pad="28"
      width="145">
         <!--<button.commit_callback
          function="SideTray.ShowPanel"-->
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
index da366f30aef79687850b22b734d8e380f433e25b..f0ce8b849a8c7a0698a4ab078ad826e7636668c3 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml
@@ -296,6 +296,7 @@
 	<check_box
 		name="media_auto_play_btn"
 		control_name="ParcelMediaAutoPlayEnable"
+		enabled_control="AudioStreamingMedia"
 		value="true"
 		follows="left|bottom|right"
 		height="15"
diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml
index a041c9b2293ffd777af8f2ae999622c6e9171b04..627b12cfe17a71f088ff2293474425d03207f7ca 100644
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -180,6 +180,7 @@
      name="Save_btn"
      width="81" />
     <button
+     enabled="false"
      follows="right|bottom"
      height="23"
      label="Edit..."
diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
index afaf41d0733087f584462b52718854f4a09d3e0a..e2b3d81bf686496bda7d875fcf66f63ce68f59df 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
@@ -533,7 +533,7 @@
 		     left="5"
 		     name="open_btn"
 		     top="0"
-		     width="100" />
+		     width="73" />
 	    <button
 		     follows="bottom|left"
 		     height="23"
@@ -542,7 +542,7 @@
 		     left_pad="5"
 		     name="pay_btn"
 		     top="0"
-		     width="100" />
+		     width="73" />
 	    <button
 		     follows="bottom|left"
 		     height="23"
@@ -551,17 +551,16 @@
 		     left_pad="5"
 		     name="buy_btn"
 		     top="0"
-		     width="100" />
+		     width="73" />
         <button
 		     follows="bottom|left"
 		     height="23"
 		     label="Details"
 		     layout="topleft"
-		     left="5"
+		     left_pad="5"
 		     name="details_btn"
 		     top="0"
-		     width="100"
-			 visible="false" />
+		     width="74" />
 
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/widgets/floater.xml b/indra/newview/skins/default/xui/en/widgets/floater.xml
index 85d0c633af5fb362983869118c12a711f1550fe5..2e5ebafe46bf3dd3a1c21829ecb9a578d6badcdc 100644
--- a/indra/newview/skins/default/xui/en/widgets/floater.xml
+++ b/indra/newview/skins/default/xui/en/widgets/floater.xml
@@ -21,4 +21,5 @@
  tear_off_pressed_image="tearoff_pressed.tga"
  dock_pressed_image="Icon_Dock_Press"
  help_pressed_image="Icon_Help_Press"
+ focus_root="true"
   />
diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml
index 2dd7a6b0f549de273aa8a827b7a1342fcefa2483..1c310669625c089f06f782dfc6f3d26ccd7183d3 100644
--- a/indra/newview/skins/default/xui/es/notifications.xml
+++ b/indra/newview/skins/default/xui/es/notifications.xml
@@ -2678,9 +2678,6 @@ Pulsa Aceptar o Rehusar para coger o no la llamada. Pulsa Ignorar para ignorar a
 	<notification name="VoiceCallGenericError">
 		Se ha producido un error al intentar conectarte al [VOICE_CHANNEL_NAME]. Por favor, inténtalo más tarde.
 	</notification>
-	<notification name="ServerVersionChanged">
-		Acabas de entrar en una región que usa un servidor con una versión distinta, y esto puede influir en el funcionamiento. [[URL] Ver las notas de desarrollo].
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		No se admite el formato de la SLurl que has pulsado.
 	</notification>
@@ -2734,7 +2731,7 @@ Se mostrará cuando haya suficiente espacio.
 	<notification name="ShareItemsConfirmation">
 		¿Estás seguro de que quieres compartir los elementos siguientes?
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 Con los siguientes residentes:
 
diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml
index ec362d7f22f73a87e66df815fe5463757c9d098e..2ccac5c19ae465040a943640cfcd318dce852688 100644
--- a/indra/newview/skins/default/xui/fr/notifications.xml
+++ b/indra/newview/skins/default/xui/fr/notifications.xml
@@ -2674,9 +2674,6 @@ Pour y participer, cliquez sur Accepter. Sinon, cliquez sur Refuser. Pour ignore
 	<notification name="VoiceCallGenericError">
 		Une erreur est survenue pendant la connexion au chat vocal pour [VOICE_CHANNEL_NAME]. Veuillez réessayer ultérieurement.
 	</notification>
-	<notification name="ServerVersionChanged">
-		La région dans laquelle vous avez pénétré utilise une version de serveur différente, ce qui peut avoir un impact sur votre performance. [[URL] Consultez les notes de version.]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		La SLurl que vous avez saisie n&apos;est pas prise en charge.
 	</notification>
@@ -2730,7 +2727,7 @@ Le bouton sera affiché quand il y aura suffisamment de place.
 	<notification name="ShareItemsConfirmation">
 		Voulez-vous vraiment partager les articles suivants :
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 avec les résidents suivants :
 
diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml
index 32483881b2b6d07aa2a5f62210bf4ab6df776145..cce588859824506c76dd138e61fab1e881d122f2 100644
--- a/indra/newview/skins/default/xui/it/notifications.xml
+++ b/indra/newview/skins/default/xui/it/notifications.xml
@@ -2623,9 +2623,6 @@ Clicca su Accetta per unirti alla chat oppure su Declina per declinare l&apos;in
 	<notification name="VoiceCallGenericError">
 		Si è verificato un errore durante il tentativo di collegarti a una voice chat con [VOICE_CHANNEL_NAME].  Riprova più tardi.
 	</notification>
-	<notification name="ServerVersionChanged">
-		Sei appena entrato in una regione che usa una versione differente del server: ciò potrebbe incidere sule prestazioni. [[URL] Visualizza le note sulla versione.]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		Lo SLurl su cui hai cliccato non è valido.
 	</notification>
@@ -2679,7 +2676,7 @@ Il pulsante verrà visualizzato quando lo spazio sarà sufficiente.
 	<notification name="ShareItemsConfirmation">
 		Sei sicuro di volere condividere gli oggetti
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 Con i seguenti residenti?
 
diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml
index c0af0e03ff2edfddb4ddeb85b97272b97703b3fe..baec8c073c2d3dc27d17fa4db389cd2ef3522c91 100644
--- a/indra/newview/skins/default/xui/ja/notifications.xml
+++ b/indra/newview/skins/default/xui/ja/notifications.xml
@@ -2675,9 +2675,6 @@ M キーを押して変更します。
 	<notification name="VoiceCallGenericError">
 		[VOICE_CHANNEL_NAME] のボイスチャットに接続中に、エラーが発生しました。後でもう一度お試しください。
 	</notification>
-	<notification name="ServerVersionChanged">
-		サーバーのバージョンが異なるリージョンに来ました。パフォーマンスに影響することがあります。 [[URL] リリースノートを確認]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		クリックした SLurl はサポートされていません。
 	</notification>
@@ -2731,7 +2728,7 @@ M キーを押して変更します。
 	<notification name="ShareItemsConfirmation">
 		次のアイテムを共有しますか:
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 次の住人と共有しますか:
 
diff --git a/indra/newview/skins/default/xui/nl/notifications.xml b/indra/newview/skins/default/xui/nl/notifications.xml
index be0c17d2ff8a7145f51aca577a62311a38bbe875..f27b83d3f92d1eaf7f68f7115276196e207821ef 100644
--- a/indra/newview/skins/default/xui/nl/notifications.xml
+++ b/indra/newview/skins/default/xui/nl/notifications.xml
@@ -3012,9 +3012,6 @@ Klik Accepteren om deel te nemen aan de chat of Afwijzen om de uitnodiging af te
 	<notification name="VoiceCallGenericError">
 		Er is een fout opgetreden tijdens het verbinden met voice chat voor [VOICE_CHANNEL_NAME]. Probeert u het later alstublieft opnieuw.
 	</notification>
-	<notification name="ServerVersionChanged">
-		De regio die u bent binnengetreden wordt onder een andere simulatorversie uitgevoerd. Klik dit bericht voor meer details.
-	</notification>
 	<notification name="UnableToOpenCommandURL">
 		De URL die u heeft geklikt kan niet binnen deze webbrowser worden geopend.
 	</notification>
diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml
index 8151c7eb938304846d51f890b8b1d769879b4d9f..138125ff0b7e65664df7176dc028cd45fed75eb8 100644
--- a/indra/newview/skins/default/xui/pl/notifications.xml
+++ b/indra/newview/skins/default/xui/pl/notifications.xml
@@ -2635,9 +2635,6 @@ Wybierz Zaakceptuj żeby zacząć czat albo Odmów żeby nie przyjąć zaproszen
 	<notification name="VoiceCallGenericError">
 		Błąd podczas łączenia z rozmową [VOICE_CHANNEL_NAME]. Spróbuj póżniej.
 	</notification>
-	<notification name="ServerVersionChanged">
-		Ten region używa innej wersji symulatora. Kliknij na tą wiadomość żeby uzyskać więcej informacji: [[URL] View the release notes.]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		Nie można otworzyć wybranego SLurl.
 	</notification>
@@ -2691,7 +2688,7 @@ Przycisk zostanie wyświetlony w przypadku dostatecznej ilości przestrzeni.
 	<notification name="ShareItemsConfirmation">
 		Jesteś pewien/pewna, że chcesz udostępnić następujące obiekty:
 
-[ITEMS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 następującym Rezydentom:
 
diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml
index dc38b740aaf54053ecb2bc2e575919a6937a26f0..9c3b9386e02bb665bff4e0af6068d72693bddf93 100644
--- a/indra/newview/skins/default/xui/pt/notifications.xml
+++ b/indra/newview/skins/default/xui/pt/notifications.xml
@@ -477,7 +477,7 @@ Para aumentar a qualidade do vídeo, vá para Preferências &gt; Vídeo.
 	</notification>
 	<notification name="CannotCopyWarning">
 		Você não tem autorização para copiar os itens abaixo:
-[ITENS]
+[ITEMS]
 ao dá-los, você ficará sem eles no seu inventário. Deseja realmente dar estes itens?
 		<usetemplate name="okcancelbuttons" notext="Não" yestext="Sim"/>
 	</notification>
@@ -2658,9 +2658,6 @@ Clique em Aceitar para atender ou em Recusar para recusar este convite.  Clique
 	<notification name="VoiceCallGenericError">
 		Ocorreu um erro enquanto você tentava se conectar à conversa de voz de [VOICE_CHANNEL_NAME].  Favor tentar novamente mais tarde.
 	</notification>
-	<notification name="ServerVersionChanged">
-		Você chegou a uma região com uma versão diferente de servidor, que pode afetar o desempenho.  [[URL] Consultar notas da versão.]
-	</notification>
 	<notification name="UnsupportedCommandSLURL">
 		O SLurl no qual você clicou não é suportado.
 	</notification>
@@ -2714,7 +2711,7 @@ O botão será exibido quando houver espaço suficente.
 	<notification name="ShareItemsConfirmation">
 		Tem certeza de que quer compartilhar os items abaixo?
 
-[ITENS]
+&lt;nolink&gt;[ITEMS]&lt;/nolink&gt;
 
 Com os seguintes residentes:
 
diff --git a/indra/newview/tests/llremoteparcelrequest_test.cpp b/indra/newview/tests/llremoteparcelrequest_test.cpp
index a6c1f69c82a4784958da65c248613f320117ae61..7862cce3a1de667ec909a8f26751c9f55a64dd36 100644
--- a/indra/newview/tests/llremoteparcelrequest_test.cpp
+++ b/indra/newview/tests/llremoteparcelrequest_test.cpp
@@ -1,134 +1,136 @@
-/** 
- * @file llremoteparcelrequest_test.cpp
- * @author Brad Kittenbrink <brad@lindenlab.com>
- *
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#include "../test/lltut.h"
-
-#include "../llremoteparcelrequest.h"
-
-#include "../llagent.h"
-#include "message.h"
-
-namespace {
-	LLControlGroup s_saved_settings("dummy_settings");
-	const LLUUID TEST_PARCEL_ID("11111111-1111-1111-1111-111111111111");
-}
-
-LLCurl::Responder::Responder() { }
-LLCurl::Responder::~Responder() { }
-void LLCurl::Responder::error(U32,std::string const &) { }
-void LLCurl::Responder::result(LLSD const &) { }
-void LLCurl::Responder::errorWithContent(U32 status,std::string const &,LLSD const &) { }
-void LLCurl::Responder::completedRaw(U32 status, std::string const &, LLChannelDescriptors const &,boost::shared_ptr<LLBufferArray> const &) { }
-void LLCurl::Responder::completed(U32 status, std::string const &, LLSD const &) { }
-void LLCurl::Responder::completedHeader(U32 status, std::string const &, LLSD const &) { }
-void LLMessageSystem::getF32(char const *,char const *,F32 &,S32) { }
-void LLMessageSystem::getU8(char const *,char const *,U8 &,S32) { }
-void LLMessageSystem::getS32(char const *,char const *,S32 &,S32) { }
-void LLMessageSystem::getString(char const *,char const *, std::string &,S32) { }
-void LLMessageSystem::getUUID(char const *,char const *, LLUUID & out_id,S32)
-{
-	out_id = TEST_PARCEL_ID;
-}
-void LLMessageSystem::nextBlock(char const *) { }
-void LLMessageSystem::addUUID(char const *,LLUUID const &) { }
-void LLMessageSystem::addUUIDFast(char const *,LLUUID const &) { }
-void LLMessageSystem::nextBlockFast(char const *) { }
-void LLMessageSystem::newMessage(char const *) { }
-LLMessageSystem * gMessageSystem;
-char * _PREHASH_AgentID;
-char * _PREHASH_AgentData;
-LLAgent gAgent;
-LLAgent::LLAgent() : mAgentAccess(s_saved_settings) { }
-LLAgent::~LLAgent() { }
-void LLAgent::sendReliableMessage(void) { }
-LLUUID gAgentSessionID;
-LLUUID gAgentID;
-LLUIColor::LLUIColor(void) { }
-LLAgentAccess::LLAgentAccess(LLControlGroup & settings) : mSavedSettings(settings) { }
-LLControlGroup::LLControlGroup(std::string const & name) : LLInstanceTracker<LLControlGroup, std::string>(name) { }
-LLControlGroup::~LLControlGroup(void) { }
-
-namespace tut
-{
-	struct TestObserver : public LLRemoteParcelInfoObserver {
-		TestObserver() : mProcessed(false) { }
-
-		virtual void processParcelInfo(const LLParcelData& parcel_data)
-		{
-			mProcessed = true;
-		}
-
-		virtual void setParcelID(const LLUUID& parcel_id) { }
-
-		virtual void setErrorStatus(U32 status, const std::string& reason) { }
-
-		bool mProcessed;
-	};
-
-    struct RemoteParcelRequestData
-    {
-		RemoteParcelRequestData()
-		{
-		}
-    };
-    
-	typedef test_group<RemoteParcelRequestData> remoteparcelrequest_t;
-	typedef remoteparcelrequest_t::object remoteparcelrequest_object_t;
-	tut::remoteparcelrequest_t tut_remoteparcelrequest("LLRemoteParcelRequest");
-
-	template<> template<>
-	void remoteparcelrequest_object_t::test<1>()
-	{
-		set_test_name("observer pointer");
-
-		boost::scoped_ptr<TestObserver> observer(new TestObserver());
-
-		LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
-		processor.addObserver(LLUUID(TEST_PARCEL_ID), observer.get());
-
-		processor.processParcelInfoReply(gMessageSystem, NULL);
-
-		ensure(observer->mProcessed);
-	}
-
-	template<> template<>
-	void remoteparcelrequest_object_t::test<2>()
-	{
-		set_test_name("CHOP-220: dangling observer pointer");
-
-		LLRemoteParcelInfoObserver * observer = new TestObserver();
-
-		LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
-		processor.addObserver(LLUUID(TEST_PARCEL_ID), observer);
-
-		delete observer;
-		observer = NULL;
-
-		processor.processParcelInfoReply(gMessageSystem, NULL);
-	}
-}
+/** 
+ * @file llremoteparcelrequest_test.cpp
+ * @author Brad Kittenbrink <brad@lindenlab.com>
+ *
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "../test/lltut.h"
+
+#include "../llremoteparcelrequest.h"
+
+#include "../llagent.h"
+#include "message.h"
+#include "llurlentry.h"
+
+namespace {
+	LLControlGroup s_saved_settings("dummy_settings");
+	const LLUUID TEST_PARCEL_ID("11111111-1111-1111-1111-111111111111");
+}
+
+LLCurl::Responder::Responder() { }
+LLCurl::Responder::~Responder() { }
+void LLCurl::Responder::error(U32,std::string const &) { }
+void LLCurl::Responder::result(LLSD const &) { }
+void LLCurl::Responder::errorWithContent(U32 status,std::string const &,LLSD const &) { }
+void LLCurl::Responder::completedRaw(U32 status, std::string const &, LLChannelDescriptors const &,boost::shared_ptr<LLBufferArray> const &) { }
+void LLCurl::Responder::completed(U32 status, std::string const &, LLSD const &) { }
+void LLCurl::Responder::completedHeader(U32 status, std::string const &, LLSD const &) { }
+void LLMessageSystem::getF32(char const *,char const *,F32 &,S32) { }
+void LLMessageSystem::getU8(char const *,char const *,U8 &,S32) { }
+void LLMessageSystem::getS32(char const *,char const *,S32 &,S32) { }
+void LLMessageSystem::getString(char const *,char const *, std::string &,S32) { }
+void LLMessageSystem::getUUID(char const *,char const *, LLUUID & out_id,S32)
+{
+	out_id = TEST_PARCEL_ID;
+}
+void LLMessageSystem::nextBlock(char const *) { }
+void LLMessageSystem::addUUID(char const *,LLUUID const &) { }
+void LLMessageSystem::addUUIDFast(char const *,LLUUID const &) { }
+void LLMessageSystem::nextBlockFast(char const *) { }
+void LLMessageSystem::newMessage(char const *) { }
+LLMessageSystem * gMessageSystem;
+char * _PREHASH_AgentID;
+char * _PREHASH_AgentData;
+LLAgent gAgent;
+LLAgent::LLAgent() : mAgentAccess(s_saved_settings) { }
+LLAgent::~LLAgent() { }
+void LLAgent::sendReliableMessage(void) { }
+LLUUID gAgentSessionID;
+LLUUID gAgentID;
+LLUIColor::LLUIColor(void) { }
+LLAgentAccess::LLAgentAccess(LLControlGroup & settings) : mSavedSettings(settings) { }
+LLControlGroup::LLControlGroup(std::string const & name) : LLInstanceTracker<LLControlGroup, std::string>(name) { }
+LLControlGroup::~LLControlGroup(void) { }
+void LLUrlEntryParcel::processParcelInfo(const LLUrlEntryParcel::LLParcelData& parcel_data) { }
+
+namespace tut
+{
+	struct TestObserver : public LLRemoteParcelInfoObserver {
+		TestObserver() : mProcessed(false) { }
+
+		virtual void processParcelInfo(const LLParcelData& parcel_data)
+		{
+			mProcessed = true;
+		}
+
+		virtual void setParcelID(const LLUUID& parcel_id) { }
+
+		virtual void setErrorStatus(U32 status, const std::string& reason) { }
+
+		bool mProcessed;
+	};
+
+    struct RemoteParcelRequestData
+    {
+		RemoteParcelRequestData()
+		{
+		}
+    };
+    
+	typedef test_group<RemoteParcelRequestData> remoteparcelrequest_t;
+	typedef remoteparcelrequest_t::object remoteparcelrequest_object_t;
+	tut::remoteparcelrequest_t tut_remoteparcelrequest("LLRemoteParcelRequest");
+
+	template<> template<>
+	void remoteparcelrequest_object_t::test<1>()
+	{
+		set_test_name("observer pointer");
+
+		boost::scoped_ptr<TestObserver> observer(new TestObserver());
+
+		LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
+		processor.addObserver(LLUUID(TEST_PARCEL_ID), observer.get());
+
+		processor.processParcelInfoReply(gMessageSystem, NULL);
+
+		ensure(observer->mProcessed);
+	}
+
+	template<> template<>
+	void remoteparcelrequest_object_t::test<2>()
+	{
+		set_test_name("CHOP-220: dangling observer pointer");
+
+		LLRemoteParcelInfoObserver * observer = new TestObserver();
+
+		LLRemoteParcelInfoProcessor & processor = LLRemoteParcelInfoProcessor::instance();
+		processor.addObserver(LLUUID(TEST_PARCEL_ID), observer);
+
+		delete observer;
+		observer = NULL;
+
+		processor.processParcelInfoReply(gMessageSystem, NULL);
+	}
+}
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index aa4983a3b6634984df873f706787e7a4a1c128d9..ea242f45cdad09799eabea2614371cc0e6acffd4 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -361,6 +361,7 @@ void LLUpdaterServiceImpl::error(std::string const & message)
 {
 	if(mIsChecking)
 	{
+		setState(LLUpdaterService::TEMPORARY_ERROR);
 		restartTimer(mCheckPeriod);
 	}
 }
diff --git a/indra/viewer_components/updater/llupdaterservice.h b/indra/viewer_components/updater/llupdaterservice.h
index 421481bc43d0adfe44ad6d6bb12dbd8bc22e2d93..450f19c1c6d18cbffc4b4f0c95621f0a6b9717ba 100644
--- a/indra/viewer_components/updater/llupdaterservice.h
+++ b/indra/viewer_components/updater/llupdaterservice.h
@@ -59,6 +59,7 @@ class LLUpdaterService
 	enum eUpdaterState {
 		INITIAL,
 		CHECKING_FOR_UPDATE,
+		TEMPORARY_ERROR,
 		DOWNLOADING,
 		INSTALLING,
 		UP_TO_DATE,
diff --git a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
index 5f8cd28f2976501f23f6eef2360ce4c228f6d215..88ab5a22845fe1b774dce553b4eb3c049d918ea6 100644
--- a/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
+++ b/indra/viewer_components/updater/tests/llupdaterservice_test.cpp
@@ -1,200 +1,200 @@
-/**
- * @file   llupdaterservice_test.cpp
- * @brief  Tests of llupdaterservice.cpp.
- * 
- * $LicenseInfo:firstyear=2010&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- * 
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- * 
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
- * $/LicenseInfo$
- */
-
-// Precompiled header
-#include "linden_common.h"
-// associated header
-#include "../llupdaterservice.h"
-#include "../llupdatechecker.h"
-#include "../llupdatedownloader.h"
-#include "../llupdateinstaller.h"
-
-#include "../../../test/lltut.h"
-//#define DEBUG_ON
-#include "../../../test/debug.h"
-
-#include "llevents.h"
-#include "lldir.h"
-
-/*****************************************************************************
-*   MOCK'd
-*****************************************************************************/
-LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client)
-{}
-void LLUpdateChecker::check(std::string const & protocolVersion, std::string const & hostUrl, 
-								  std::string const & servicePath, std::string channel, std::string version)
-{}
-LLUpdateDownloader::LLUpdateDownloader(Client & ) {}
-void LLUpdateDownloader::download(LLURI const & , std::string const &, std::string const &, bool){}
-
-class LLDir_Mock : public LLDir
-{
-	void initAppDirs(const std::string &app_name, 
-		   			 const std::string& app_read_only_data_dir = "") {}
-	U32 countFilesInDir(const std::string &dirname, const std::string &mask) 
-	{
-		return 0;
-	}
-
-	BOOL getNextFileInDir(const std::string &dirname, 
-						  const std::string &mask, 
-						  std::string &fname) 
-	{
-		return false;
-	}
-	void getRandomFileInDir(const std::string &dirname, 
-							const std::string &mask, 
-							std::string &fname) {}
-	std::string getCurPath() { return ""; }
-	BOOL fileExists(const std::string &filename) const { return false; }
-	std::string getLLPluginLauncher() { return ""; }
-	std::string getLLPluginFilename(std::string base_name) { return ""; }
-
-} gDirUtil;
-LLDir* gDirUtilp = &gDirUtil;
-LLDir::LLDir() {}
-LLDir::~LLDir() {}
-S32 LLDir::deleteFilesInDir(const std::string &dirname, 
-							const std::string &mask)
-{ return 0; }
-
-void LLDir::setChatLogsDir(const std::string &path){}		
-void LLDir::setPerAccountChatLogsDir(const std::string &username){}
-void LLDir::setLindenUserDir(const std::string &username){}		
-void LLDir::setSkinFolder(const std::string &skin_folder){}
-bool LLDir::setCacheDir(const std::string &path){ return true; }
-void LLDir::dumpCurrentDirectories() {}
-
-std::string LLDir::getExpandedFilename(ELLPath location, 
-									   const std::string &filename) const 
-{
-	return "";
-}
-
-std::string LLUpdateDownloader::downloadMarkerPath(void)
-{
-	return "";
-}
-
-void LLUpdateDownloader::resume(void) {}
-void LLUpdateDownloader::cancel(void) {}
-void LLUpdateDownloader::setBandwidthLimit(U64 bytesPerSecond) {}
-
-int ll_install_update(std::string const &, std::string const &, bool, LLInstallScriptMode)
-{
-	return 0;
-}
-
-std::string const & ll_install_failed_marker_path()
-{
-	static std::string wubba;
-	return wubba;
-}
-
-/*
-#pragma warning(disable: 4273)
-llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename,
-										   ios_base::openmode _Mode,
-										   int _Prot) :
-	std::basic_istream<char,std::char_traits< char > >(NULL,true)
-{}
-
-llus_mock_llifstream::~llus_mock_llifstream() {}
-bool llus_mock_llifstream::is_open() const {return true;}
-void llus_mock_llifstream::close() {}
-*/
-
-/*****************************************************************************
-*   TUT
-*****************************************************************************/
-namespace tut
-{
-    struct llupdaterservice_data
-    {
-		llupdaterservice_data() :
-            pumps(LLEventPumps::instance()),
-			test_url("dummy_url"),
-			test_channel("dummy_channel"),
-			test_version("dummy_version")
-		{}
-		LLEventPumps& pumps;
-		std::string test_url;
-		std::string test_channel;
-		std::string test_version;
-	};
-
-    typedef test_group<llupdaterservice_data> llupdaterservice_group;
-    typedef llupdaterservice_group::object llupdaterservice_object;
-    llupdaterservice_group llupdaterservicegrp("LLUpdaterService");
-
-    template<> template<>
-    void llupdaterservice_object::test<1>()
-    {
-        DEBUG;
-		LLUpdaterService updater;
-		bool got_usage_error = false;
-		try
-		{
-			updater.startChecking();
-		}
-		catch(LLUpdaterService::UsageError)
-		{
-			got_usage_error = true;
-		}
-		ensure("Caught start before params", got_usage_error);
-	}
-
-    template<> template<>
-    void llupdaterservice_object::test<2>()
-    {
-        DEBUG;
-		LLUpdaterService updater;
-		bool got_usage_error = false;
-		try
-		{
-			updater.initialize("1.0",test_url, "update" ,test_channel, test_version);
-			updater.startChecking();
-			updater.initialize("1.0", "other_url", "update", test_channel, test_version);
-		}
-		catch(LLUpdaterService::UsageError)
-		{
-			got_usage_error = true;
-		}
-		ensure("Caught params while running", got_usage_error);
-	}
-
-    template<> template<>
-    void llupdaterservice_object::test<3>()
-    {
-        DEBUG;
-		LLUpdaterService updater;
-		updater.initialize("1.0", test_url, "update", test_channel, test_version);
-		updater.startChecking();
-		ensure(updater.isChecking());
-		updater.stopChecking();
-		ensure(!updater.isChecking());
-	}
-}
+/**
+ * @file   llupdaterservice_test.cpp
+ * @brief  Tests of llupdaterservice.cpp.
+ * 
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+// Precompiled header
+#include "linden_common.h"
+// associated header
+#include "../llupdaterservice.h"
+#include "../llupdatechecker.h"
+#include "../llupdatedownloader.h"
+#include "../llupdateinstaller.h"
+
+#include "../../../test/lltut.h"
+//#define DEBUG_ON
+#include "../../../test/debug.h"
+
+#include "llevents.h"
+#include "lldir.h"
+
+/*****************************************************************************
+*   MOCK'd
+*****************************************************************************/
+LLUpdateChecker::LLUpdateChecker(LLUpdateChecker::Client & client)
+{}
+void LLUpdateChecker::check(std::string const & protocolVersion, std::string const & hostUrl, 
+								  std::string const & servicePath, std::string channel, std::string version)
+{}
+LLUpdateDownloader::LLUpdateDownloader(Client & ) {}
+void LLUpdateDownloader::download(LLURI const & , std::string const &, std::string const &, bool){}
+
+class LLDir_Mock : public LLDir
+{
+	void initAppDirs(const std::string &app_name, 
+		   			 const std::string& app_read_only_data_dir = "") {}
+	U32 countFilesInDir(const std::string &dirname, const std::string &mask) 
+	{
+		return 0;
+	}
+
+	BOOL getNextFileInDir(const std::string &dirname, 
+						  const std::string &mask, 
+						  std::string &fname) 
+	{
+		return false;
+	}
+	void getRandomFileInDir(const std::string &dirname, 
+							const std::string &mask, 
+							std::string &fname) {}
+	std::string getCurPath() { return ""; }
+	BOOL fileExists(const std::string &filename) const { return false; }
+	std::string getLLPluginLauncher() { return ""; }
+	std::string getLLPluginFilename(std::string base_name) { return ""; }
+
+} gDirUtil;
+LLDir* gDirUtilp = &gDirUtil;
+LLDir::LLDir() {}
+LLDir::~LLDir() {}
+S32 LLDir::deleteFilesInDir(const std::string &dirname, 
+							const std::string &mask)
+{ return 0; }
+
+void LLDir::setChatLogsDir(const std::string &path){}		
+void LLDir::setPerAccountChatLogsDir(const std::string &username){}
+void LLDir::setLindenUserDir(const std::string &username){}		
+void LLDir::setSkinFolder(const std::string &skin_folder){}
+bool LLDir::setCacheDir(const std::string &path){ return true; }
+void LLDir::dumpCurrentDirectories() {}
+
+std::string LLDir::getExpandedFilename(ELLPath location, 
+									   const std::string &filename) const 
+{
+	return "";
+}
+
+std::string LLUpdateDownloader::downloadMarkerPath(void)
+{
+	return "";
+}
+
+void LLUpdateDownloader::resume(void) {}
+void LLUpdateDownloader::cancel(void) {}
+void LLUpdateDownloader::setBandwidthLimit(U64 bytesPerSecond) {}
+
+int ll_install_update(std::string const &, std::string const &, bool, LLInstallScriptMode)
+{
+	return 0;
+}
+
+std::string const & ll_install_failed_marker_path()
+{
+	static std::string wubba;
+	return wubba;
+}
+
+/*
+#pragma warning(disable: 4273)
+llus_mock_llifstream::llus_mock_llifstream(const std::string& _Filename,
+										   ios_base::openmode _Mode,
+										   int _Prot) :
+	std::basic_istream<char,std::char_traits< char > >(NULL,true)
+{}
+
+llus_mock_llifstream::~llus_mock_llifstream() {}
+bool llus_mock_llifstream::is_open() const {return true;}
+void llus_mock_llifstream::close() {}
+*/
+
+/*****************************************************************************
+*   TUT
+*****************************************************************************/
+namespace tut
+{
+    struct llupdaterservice_data
+    {
+		llupdaterservice_data() :
+            pumps(LLEventPumps::instance()),
+			test_url("dummy_url"),
+			test_channel("dummy_channel"),
+			test_version("dummy_version")
+		{}
+		LLEventPumps& pumps;
+		std::string test_url;
+		std::string test_channel;
+		std::string test_version;
+	};
+
+    typedef test_group<llupdaterservice_data> llupdaterservice_group;
+    typedef llupdaterservice_group::object llupdaterservice_object;
+    llupdaterservice_group llupdaterservicegrp("LLUpdaterService");
+
+    template<> template<>
+    void llupdaterservice_object::test<1>()
+    {
+        DEBUG;
+		LLUpdaterService updater;
+		bool got_usage_error = false;
+		try
+		{
+			updater.startChecking();
+		}
+		catch(LLUpdaterService::UsageError)
+		{
+			got_usage_error = true;
+		}
+		ensure("Caught start before params", got_usage_error);
+	}
+
+    template<> template<>
+    void llupdaterservice_object::test<2>()
+    {
+        DEBUG;
+		LLUpdaterService updater;
+		bool got_usage_error = false;
+		try
+		{
+			updater.initialize("1.0",test_url, "update" ,test_channel, test_version);
+			updater.startChecking();
+			updater.initialize("1.0", "other_url", "update", test_channel, test_version);
+		}
+		catch(LLUpdaterService::UsageError)
+		{
+			got_usage_error = true;
+		}
+		ensure("Caught params while running", got_usage_error);
+	}
+
+    template<> template<>
+    void llupdaterservice_object::test<3>()
+    {
+        DEBUG;
+		LLUpdaterService updater;
+		updater.initialize("1.0", test_url, "update", test_channel, test_version);
+		updater.startChecking();
+		ensure(updater.isChecking());
+		updater.stopChecking();
+		ensure(!updater.isChecking());
+	}
+}