update Linux ref build to snapshot r68679

git-svn-id: http://src.chromium.org/svn/trunk/deps/reference_builds/chrome_linux@68697 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/chrome b/chrome
index 0d53cb8..4904798 100755
--- a/chrome
+++ b/chrome
Binary files differ
diff --git a/chrome-wrapper b/chrome-wrapper
index 7aeeb7a..09f43ac 100644
--- a/chrome-wrapper
+++ b/chrome-wrapper
@@ -1,6 +1,6 @@
-#!/bin/sh
+#!/bin/bash
 
-# Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
@@ -10,7 +10,15 @@
 DESKTOP="chromium-devel"
 TITLE="Chromium"
 
-# Check to see if there is a desktop file of the given name
+usage() {
+  echo "$0 [--gdb] [--help] [--man-page] [--] [chrome-options]"
+  echo
+  echo "        --gdb                   Start within gdb"
+  echo "        --help                  This help screen"
+  echo "        --man-page              Open the man page in the tree"
+}
+
+# Check to see if there is a desktop file of the given name.
 exists_desktop_file() {
     # Build a search list from $XDG_DATA_HOME and $XDG_DATA_DIRS, the latter
     # of which can itself be a colon-separated list of directories to search.
@@ -21,11 +29,11 @@
         [ "$dir" -a -d "$dir/applications" ] || continue
         [ -r "$dir/applications/$DESKTOP.desktop" ] && return
     done
-    # Didn't find it in the search path
+    # Didn't find it in the search path.
     return 1
 }
 
-# Checks a file to see if it's a 32 or 64-bit
+# Checks a file to see if it's a 32 or 64-bit.
 check_executable() {
     out=$(file $(readlink -f $1) 2> /dev/null)
     echo $out | grep -qs "ELF 32-bit LSB"
@@ -41,7 +49,7 @@
     echo neither
 }
 
-# Generate a desktop file that will run this script
+# Generate a desktop file that will run this script.
 generate_desktop_file() {
     apps="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
     mkdir -p "$apps"
@@ -59,24 +67,29 @@
 EOF
 }
 
-# Let the wrapped binary know that it has been run through the wrapper
+# Let the wrapped binary know that it has been run through the wrapper.
 export CHROME_WRAPPER="`readlink -f "$0"`"
 export CHROME_DESKTOP="$DESKTOP.desktop"
 
 HERE="`dirname "$CHROME_WRAPPER"`"
 
+# We include some xdg utilities next to the binary, and we want to prefer them
+# over the system versions because we know they work correctly for us. But if
+# our path already exists, we leave it where it is, to allow overriding this.
+# (Once distributions have picked up the updated xdg-mime, we can go back to
+# appending $HERE rather than prepending.)
 case ":$PATH:" in
   *:$HERE:*)
-    # $PATH already contains $HERE
+    # $PATH already contains $HERE, leave it where it is.
     ;;
   *)
-    # Append $HERE to $PATH
-    export PATH="$PATH:$HERE"
+    # Prepend $HERE to $PATH.
+    export PATH="$HERE:$PATH"
     ;;
 esac
 
 # Always use our ffmpeg and other shared libs.
-export LD_LIBRARY_PATH="$HERE:$HERE/lib:$HERE/lib.target:$LD_LIBRARY_PATH"
+export LD_LIBRARY_PATH="$HERE:$HERE/lib:$HERE/lib.target${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
 
 MISSING_LIBS=$(ldd "$HERE/chrome" 2> /dev/null |grep "not found$" | cut -d" " -f 1|sed 's/\t//')
 CHROME_ARCH=$(check_executable "$HERE/chrome")
@@ -125,4 +138,25 @@
 
 exists_desktop_file || generate_desktop_file
 
-exec "$HERE/chrome" "$@"
+CMD_PREFIX=
+ARGS=()
+while [ "$#" -gt 0 ]; do
+    case "$1" in
+    "--")
+        shift
+        break ;;
+    "--gdb")
+        CMD_PREFIX="gdb --args" ;;
+    "--help")
+        usage
+        exit 0 ;;
+    "--man-page")
+        exec man "$HERE/../../chrome/app/resources/manpage.1.in" ;;
+    *)
+        ARGS=( "${ARGS[@]}" "$1" ) ;;
+    esac
+    shift
+done
+set -- "${ARGS[@]}" "$@"
+
+exec $CMD_PREFIX "$HERE/chrome" "$@"
diff --git a/chrome.1 b/chrome.1
index 4430a90..9c489d8 100644
--- a/chrome.1
+++ b/chrome.1
@@ -24,7 +24,7 @@
 \fB\-\-user\-data\-dir\fR=\fIDIR\fR
 Specifies the directory that user data (your "profile") is kept in.
 Defaults to
-.I ~/.config/chromium/Default .
+.I ~/.config/chromium .
 Separate instances of Chromium must use separate user data directories;
 repeated invocations of chromium-browser will reuse an existing process for
 a given user data directory.
@@ -36,9 +36,46 @@
 in "app mode": with no browser toolbars.
 
 .TP
+\fB\-\-incognito\fR
+Open in incognito mode.
+
+.TP
 \fB\-\-proxy-server\fR=\fIhost:port\fR
-Specify the HTTP/HTTPS proxy server.  Overrides any environment variables
-or settings picked via the options dialog.
+Specify the HTTP/SOCKS4/SOCKS5 proxy server to use for requests.  This
+overrides any environment variables or settings picked via the options dialog.
+An individual proxy server is specified using the format:
+
+  [<proxy-scheme>://]<proxy-host>[:<proxy-port>]
+
+Where <proxy-scheme> is the protocol of the proxy server, and is one of:
+
+  "http", "socks", "socks4", "socks5".
+
+If the <proxy-scheme> is omitted, it defaults to "http". Also note that
+"socks" is equivalent to "socks5".
+
+Examples:
+
+  --proxy-server="foopy:99"
+      Use the HTTP proxy "foopy:99" to load all URLs.
+
+  --proxy-server="socks://foobar:1080"
+      Use the SOCKS v5 proxy "foobar:1080" to load all URLs.
+
+  --proxy-server="sock4://foobar:1080"
+      Use the SOCKS v4 proxy "foobar:1080" to load all URLs.
+
+  --proxy-server="socks5://foobar:66"
+      Use the SOCKS v5 proxy "foobar:66" to load all URLs.
+
+It is also possible to specify a separate proxy server for different URL types,
+by prefixing the proxy server specifier with a URL specifier:
+
+Example:
+
+  --proxy-server="https=proxy1:80;http=socks4://baz:1080"
+      Load https://* URLs using the HTTP proxy "proxy1:80". And load http://*
+      URLs using the SOCKS v4 proxy "baz:1080".
 
 .TP
 \fB\-\-no-proxy-server\fR
@@ -55,6 +92,10 @@
 Specify proxy autoconfiguration URL.  Overrides any environment variables
 or settings picked via the options dialog.
 
+.TP
+\fB\-\-version\fR
+Show version information.
+
 .PP
 As a GTK+ app, Chromium also obeys GTK+ command-line flags, such
 as
@@ -86,6 +127,16 @@
 Specify proxy autoconfiguration.  Defined and empty autodetects; otherwise,
 it should be an autoconfig URL.  But see above note about Gnome/KDE.
 
+.TP
+.B SOCKS_SERVER
+SOCKS proxy server (defaults to SOCKS v4, also set
+.B SOCKS_VERSION=5
+to use SOCKS v5).
+
+.TP
+.B no_proxy
+Comma separated list of hosts or patterns to bypass proxying.
+
 .SH FILES
 .TP
 .I ~/.config/chromium
diff --git a/chrome.pak b/chrome.pak
index de63951..46313d8 100644
--- a/chrome.pak
+++ b/chrome.pak
Binary files differ
diff --git a/chrome_sandbox b/chrome_sandbox
index a2a78e1..352dc5c 100644
--- a/chrome_sandbox
+++ b/chrome_sandbox
Binary files differ
diff --git a/libffmpegsumo.so b/libffmpegsumo.so
index 78ec4e5..ac3ca7c 100755
--- a/libffmpegsumo.so
+++ b/libffmpegsumo.so
Binary files differ
diff --git a/locales/am.pak b/locales/am.pak
index f636999..c904419 100644
--- a/locales/am.pak
+++ b/locales/am.pak
Binary files differ
diff --git a/locales/ar.pak b/locales/ar.pak
index d6d273c..9f6f552 100644
--- a/locales/ar.pak
+++ b/locales/ar.pak
Binary files differ
diff --git a/locales/bg.pak b/locales/bg.pak
index 80d93e3..aee0b61 100644
--- a/locales/bg.pak
+++ b/locales/bg.pak
Binary files differ
diff --git a/locales/bn.pak b/locales/bn.pak
index bef73f6..a8f7af2 100644
--- a/locales/bn.pak
+++ b/locales/bn.pak
Binary files differ
diff --git a/locales/ca.pak b/locales/ca.pak
index e7e9e97..35948db 100644
--- a/locales/ca.pak
+++ b/locales/ca.pak
Binary files differ
diff --git a/locales/cs.pak b/locales/cs.pak
index b09b4d8..6ba28f6 100644
--- a/locales/cs.pak
+++ b/locales/cs.pak
Binary files differ
diff --git a/locales/da.pak b/locales/da.pak
index 65eca3c..5b2c36d 100644
--- a/locales/da.pak
+++ b/locales/da.pak
Binary files differ
diff --git a/locales/de.pak b/locales/de.pak
index bb3da6d..80e553d 100644
--- a/locales/de.pak
+++ b/locales/de.pak
Binary files differ
diff --git a/locales/el.pak b/locales/el.pak
index f62d5f5..f27a210 100644
--- a/locales/el.pak
+++ b/locales/el.pak
Binary files differ
diff --git a/locales/en-GB.pak b/locales/en-GB.pak
index 6c67606..b193402 100644
--- a/locales/en-GB.pak
+++ b/locales/en-GB.pak
Binary files differ
diff --git a/locales/en-US.pak b/locales/en-US.pak
index e9f9da4..ee1856a 100644
--- a/locales/en-US.pak
+++ b/locales/en-US.pak
Binary files differ
diff --git a/locales/es-419.pak b/locales/es-419.pak
index cb3f2bb..9b85f12 100644
--- a/locales/es-419.pak
+++ b/locales/es-419.pak
Binary files differ
diff --git a/locales/es.pak b/locales/es.pak
index 7231bad..3e039d5 100644
--- a/locales/es.pak
+++ b/locales/es.pak
Binary files differ
diff --git a/locales/et.pak b/locales/et.pak
index 175d718..75edc00 100644
--- a/locales/et.pak
+++ b/locales/et.pak
Binary files differ
diff --git a/locales/fa.pak b/locales/fa.pak
new file mode 100644
index 0000000..75cf27b
--- /dev/null
+++ b/locales/fa.pak
Binary files differ
diff --git a/locales/fi.pak b/locales/fi.pak
index 8453ac7..825e985 100644
--- a/locales/fi.pak
+++ b/locales/fi.pak
Binary files differ
diff --git a/locales/fil.pak b/locales/fil.pak
index c8fa52c..fe5a496 100644
--- a/locales/fil.pak
+++ b/locales/fil.pak
Binary files differ
diff --git a/locales/fr.pak b/locales/fr.pak
index 2d0bb8a..c3d49fa 100644
--- a/locales/fr.pak
+++ b/locales/fr.pak
Binary files differ
diff --git a/locales/gu.pak b/locales/gu.pak
index ee682c8..d4b3c64 100644
--- a/locales/gu.pak
+++ b/locales/gu.pak
Binary files differ
diff --git a/locales/he.pak b/locales/he.pak
index 9a05721..6ce89df 100644
--- a/locales/he.pak
+++ b/locales/he.pak
Binary files differ
diff --git a/locales/hi.pak b/locales/hi.pak
index 8f3eded..6e4c5cc 100644
--- a/locales/hi.pak
+++ b/locales/hi.pak
Binary files differ
diff --git a/locales/hr.pak b/locales/hr.pak
index 38ac601..70920ca 100644
--- a/locales/hr.pak
+++ b/locales/hr.pak
Binary files differ
diff --git a/locales/hu.pak b/locales/hu.pak
index 3d2356a..179911b 100644
--- a/locales/hu.pak
+++ b/locales/hu.pak
Binary files differ
diff --git a/locales/id.pak b/locales/id.pak
index ed7ae63..b55d0b5 100644
--- a/locales/id.pak
+++ b/locales/id.pak
Binary files differ
diff --git a/locales/it.pak b/locales/it.pak
index 18c8d69..b060a6d 100644
--- a/locales/it.pak
+++ b/locales/it.pak
Binary files differ
diff --git a/locales/ja.pak b/locales/ja.pak
index 4475adf..bf6ddd7 100644
--- a/locales/ja.pak
+++ b/locales/ja.pak
Binary files differ
diff --git a/locales/kn.pak b/locales/kn.pak
index d1939c0..baf4e11 100644
--- a/locales/kn.pak
+++ b/locales/kn.pak
Binary files differ
diff --git a/locales/ko.pak b/locales/ko.pak
index 053750d..b4116f5 100644
--- a/locales/ko.pak
+++ b/locales/ko.pak
Binary files differ
diff --git a/locales/lt.pak b/locales/lt.pak
index e1674da..17b0a8a 100644
--- a/locales/lt.pak
+++ b/locales/lt.pak
Binary files differ
diff --git a/locales/lv.pak b/locales/lv.pak
index 417dc60..218665a 100644
--- a/locales/lv.pak
+++ b/locales/lv.pak
Binary files differ
diff --git a/locales/ml.pak b/locales/ml.pak
index 6e1ebe2..e16fe03 100644
--- a/locales/ml.pak
+++ b/locales/ml.pak
Binary files differ
diff --git a/locales/mr.pak b/locales/mr.pak
index dedc232..ed5d6cf 100644
--- a/locales/mr.pak
+++ b/locales/mr.pak
Binary files differ
diff --git a/locales/nb.pak b/locales/nb.pak
index 43a4ba3..45c6a69 100644
--- a/locales/nb.pak
+++ b/locales/nb.pak
Binary files differ
diff --git a/locales/nl.pak b/locales/nl.pak
index 3a8e093..f867a35 100644
--- a/locales/nl.pak
+++ b/locales/nl.pak
Binary files differ
diff --git a/locales/or.pak b/locales/or.pak
deleted file mode 100644
index 4ba66e8..0000000
--- a/locales/or.pak
+++ /dev/null
Binary files differ
diff --git a/locales/pl.pak b/locales/pl.pak
index 35c5edb..7c1a08c 100644
--- a/locales/pl.pak
+++ b/locales/pl.pak
Binary files differ
diff --git a/locales/pt-BR.pak b/locales/pt-BR.pak
index 42a2724..9c8d0ea 100644
--- a/locales/pt-BR.pak
+++ b/locales/pt-BR.pak
Binary files differ
diff --git a/locales/pt-PT.pak b/locales/pt-PT.pak
index 0dcc66b..33ece9a 100644
--- a/locales/pt-PT.pak
+++ b/locales/pt-PT.pak
Binary files differ
diff --git a/locales/ro.pak b/locales/ro.pak
index f1d061d..645aea5 100644
--- a/locales/ro.pak
+++ b/locales/ro.pak
Binary files differ
diff --git a/locales/ru.pak b/locales/ru.pak
index 7b9e6dd..29c13b8 100644
--- a/locales/ru.pak
+++ b/locales/ru.pak
Binary files differ
diff --git a/locales/sk.pak b/locales/sk.pak
index ca2c7e3..2b065cd 100644
--- a/locales/sk.pak
+++ b/locales/sk.pak
Binary files differ
diff --git a/locales/sl.pak b/locales/sl.pak
index 0be84cf..d01e0ed 100644
--- a/locales/sl.pak
+++ b/locales/sl.pak
Binary files differ
diff --git a/locales/sr.pak b/locales/sr.pak
index c199d9e..ac26186 100644
--- a/locales/sr.pak
+++ b/locales/sr.pak
Binary files differ
diff --git a/locales/sv.pak b/locales/sv.pak
index 1e15096..53a8cb5 100644
--- a/locales/sv.pak
+++ b/locales/sv.pak
Binary files differ
diff --git a/locales/sw.pak b/locales/sw.pak
index 7446207..de970fc 100644
--- a/locales/sw.pak
+++ b/locales/sw.pak
Binary files differ
diff --git a/locales/ta.pak b/locales/ta.pak
index d9d635c..7023474 100644
--- a/locales/ta.pak
+++ b/locales/ta.pak
Binary files differ
diff --git a/locales/te.pak b/locales/te.pak
index 2b3c425..1be3125 100644
--- a/locales/te.pak
+++ b/locales/te.pak
Binary files differ
diff --git a/locales/th.pak b/locales/th.pak
index 6794670..6f0d097 100644
--- a/locales/th.pak
+++ b/locales/th.pak
Binary files differ
diff --git a/locales/tr.pak b/locales/tr.pak
index 9a3af75..dfdd3d9 100644
--- a/locales/tr.pak
+++ b/locales/tr.pak
Binary files differ
diff --git a/locales/uk.pak b/locales/uk.pak
index 9837fca..bf05a22 100644
--- a/locales/uk.pak
+++ b/locales/uk.pak
Binary files differ
diff --git a/locales/vi.pak b/locales/vi.pak
index b8025d7..7c3e19f 100644
--- a/locales/vi.pak
+++ b/locales/vi.pak
Binary files differ
diff --git a/locales/zh-CN.pak b/locales/zh-CN.pak
index 9174b25..ff8cc66 100644
--- a/locales/zh-CN.pak
+++ b/locales/zh-CN.pak
Binary files differ
diff --git a/locales/zh-TW.pak b/locales/zh-TW.pak
index ea65d3e..8999d39 100644
--- a/locales/zh-TW.pak
+++ b/locales/zh-TW.pak
Binary files differ
diff --git a/product_logo_48.png b/product_logo_48.png
index 5239208..5347c53 100644
--- a/product_logo_48.png
+++ b/product_logo_48.png
Binary files differ
diff --git a/resources.pak b/resources.pak
new file mode 100644
index 0000000..778e25b
--- /dev/null
+++ b/resources.pak
Binary files differ
diff --git a/resources/bookmark_manager/css/bmm.css b/resources/bookmark_manager/css/bmm.css
deleted file mode 100644
index f3cbdfa..0000000
--- a/resources/bookmark_manager/css/bmm.css
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-Copyright (c) 2010 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
-*/
-html, body {
-  margin: 0;
-  width: 100%;
-  height: 100%;
-  cursor: default;
-}
-
-list {
-  display: block;
-  overflow-x: hidden;
-  overflow-y: visible; /* let the container do the scrolling */
-}
-
-list > * {
-  text-decoration: none;
-  padding: 5px;
-}
-
-list > * > * {
-  overflow: hidden;
-  text-overflow: ellipsis;
-  white-space: nowrap;
-  display: block;
-  color: black;
-  width: 100%;
-  -webkit-box-sizing: border-box;
-  background: 0 50% no-repeat;
-  -webkit-padding-start: 20px;
-}
-
-list > * > * > span {
-  -webkit-transition: all .15s;
-  text-decoration: none;
-  color: #000;
-  cursor: pointer;
-  opacity: .7;
-}
-
-list > * > :first-child {
-  font-weight: bold;
-  font-size: 110%;
-}
-
-list > * > :last-child {
-  overflow: hidden;
-}
-
-list > * > * > .folder {
-  background-image: url("../images/folder_closed.png");
-  background-repeat: no-repeat;
-  background-position: 0% 50%;
-  display: inline-block;
-  -webkit-padding-start: 18px;
-}
-
-html[dir=rtl] list > * > * > .folder {
-  background-image: url("../images/folder_closed_rtl.png");
-  background-position: 100% 50%;
-}
-
-html[os=mac] list > * > * > .folder {
-  background-image: url("../images/bookmark_bar_folder_mac.png");
-}
-
-list > * > * > :hover {
-  text-decoration: underline;
-  color: blue;
-  opacity: 1;
-}
-
-list > * > * > :active {
-  color: -webkit-activelink;
-}
-
-html[dir=rtl] list .label {
-  background-position: 100% 50%;
-}
-
-list > .folder > .label {
-  background-image: url("../images/folder_closed.png");
-}
-
-/* We need to ensure that even empty labels take up space */
-list > * > .label:empty:after,
-list > * > .url:empty:after {
-  content: " ";
-  white-space: pre;
-}
-
-list > .folder > .url:empty:after {
-  content: "";
-}
-
-/*
-/* Edit mode
-*/
-
-list .label input,
-list .url input {
-  /* Do not inherit the line-height */
-  font-family: inherit;
-  font-size: inherit;
-  font-weight: inherit;
-  color: black;
-  background: white;
-  border: 1px solid black;
-  margin: -2px -8px -2px -3px;
-  padding: 1px 7px 1px 1px;
-  outline: none;
-  text-decoration: none;
-}
-
-html[dir=rtl] list .label input,
-html[dir=rtl] list .url input {
-  margin: -2px -3px -2px -8px;
-  padding: 1px 1px 1px 7px;
-}
-
-list [editing] .label,
-list [editing] .url,
-list [editing] > * {
-  overflow: visible;
-  opacity: 1;
-}
-
-list [editing] .url {
-  text-decoration: none;
-  color: inherit;
-}
-
-list .url form {
-  display: inline;
-}
-
-list .url > form > input {
-  -webkit-transition: color .15s, background-color .15s;
-}
-
-list .url > form > :invalid {
-  background: #fdd;
-  color: black;
-}
-
-/* end editing */
-
-html[dir=rtl] list > .folder > .label {
-  background-image: url("../images/folder_closed_rtl.png");
-}
-
-html[os=mac] list > .folder > .label {
-  background-image: url("../images/bookmark_bar_folder_mac.png");
-}
-
-html[os=mac] .tree-label {
-  background-image: url("../images/bookmark_bar_folder_mac.png");
-}
-
-html[os=mac] .tree-row[selected] > .tree-label {
-  background-image: url("../images/bookmark_bar_folder_mac.png");
-}
-
-.main {
-  position: absolute;
-  top: 75px;
-  left: 0;
-  right: 0;
-  bottom: 0;
-}
-
-#tree-container {
-  position: absolute;
-  left: 0;
-  width: 200px;
-  top: 0;
-  bottom: 0;
-  overflow: auto;
-  -webkit-box-sizing: border-box;
-  padding: 0px 5px 5px 5px;
-}
-
-#tree {
-  min-width: 100%;
-  overflow: visible; /* let the container do the scrolling */
-  display: inline-block;
-}
-
-#list {
-  position: absolute;
-  left: 200px;
-  right: 0;
-  top: 0;
-  bottom: 0;
-  -webkit-box-sizing: border-box;
-  padding: 0 5px 5px 5px;
-}
-
-.logo {
-  -webkit-appearance: none;
-  border: 0;
-  background: transparent;
-  background: 50% 50% no-repeat url("../images/bookmarks_section.png");
-  width: 67px;
-  height: 67px;
-  cursor: pointer;
-  vertical-align: bottom;
-  margin: 5px;
-}
-
-html[dir=rtl] #tree-container {
-  left: auto;
-  right: 0;
-}
-
-html[dir=rtl] #list {
-  left: 0;
-  right: 200px;
-}
-
-.header > div {
-  display: inline-block;
-  margin: 5px;
-}
-
-#drop-overlay {
-  position: absolute;
-  display: none;
-  pointer-events: none;
-  border: 1px solid hsl(214, 91%, 85%);;
-  -webkit-border-radius: 3px;
-  -webkit-box-sizing: border-box;
-  background-color: hsla(214, 91%, 85%, .5);
-  overflow: hidden;
-  z-index: -1;
-}
-
-#drop-overlay.line {
-  border: 3px solid black;
-  border-top-color: transparent;
-  border-bottom-color: transparent;
-  background-color: black;
-  background-clip: padding-box;
-  height: 8px;
-  -webkit-border-radius: 0;
-  z-index: 10;
-}
-
-.toolbar button {
-  -webkit-appearance: none;
-  background: transparent;
-  border: 0;
-  font: inherit;
-  padding: 0;
-  background: -webkit-canvas(drop-down-arrow) 100% 50% no-repeat;
-  padding-right: 9px;
-}
-
-html[dir=rtl] .toolbar button {
-  background-position: 0% 50%;
-  padding-right: 0;
-  padding-left: 9px;
-}
diff --git a/resources/bookmark_manager/css/bmm.css.js b/resources/bookmark_manager/css/bmm.css.js
deleted file mode 100644
index 3ea295f..0000000
--- a/resources/bookmark_manager/css/bmm.css.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Create the drop down arrow for the drop down buttons.
-(function() {
-  var ctx = document.getCSSCanvasContext('2d', 'drop-down-arrow', 9, 4);
-  ctx.fillStyle = '#000';
-  ctx.translate(1.5, .5);
-  ctx.beginPath();
-  ctx.moveTo(0, 0);
-  ctx.lineTo(6, 0);
-  ctx.lineTo(3, 3);
-  ctx.closePath();
-  ctx.fill();
-  ctx.stroke();
-})();
diff --git a/resources/bookmark_manager/css/list.css b/resources/bookmark_manager/css/list.css
deleted file mode 100644
index e148337..0000000
--- a/resources/bookmark_manager/css/list.css
+++ /dev/null
@@ -1,60 +0,0 @@
-
-list {
-  overflow: auto;
-  outline: none;
-}
-
-list > * {
-  -webkit-user-select: none;
-  border: 1px solid rgba(255,255,255,0); /* transparent white */
-  background-color: rgba(255,255,255,0);
-  -webkit-border-radius: 2px;
-  padding: 0px 3px;
-  line-height: 20px;
-  white-space: nowrap;
-  cursor: default;
-  -webkit-transition: all .12s;
-  position: relative; /* to allow overlap */
-  display: block;
-}
-
-list > [lead] {
-  border-color: transparent;
-}
-
-list:focus > [lead] {
-  border-color: hsl(214, 91%, 65%);
-  z-index: 2;
-}
-
-list > [anchor] {
-
-}
-
-list > :hover {
-  border-color: hsl(214, 91%, 85%);
-  z-index: 1;
-  background-color: hsl(214,91%,97%);
-}
-
-list > :hover,
-list > [selected] {
-  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0)));
-}
-
-list > [selected] {
-  border-color: hsl(0,0%,85%);
-  background-color: hsl(0,0%,90%);
-  z-index: 2;
-}
-
-list:focus > [selected] {
-  background-color: hsl(214,91%,89%);
-  border-color: hsl(214, 91%, 65%);
-}
-
-list:focus > [lead][selected],
-list > [selected]:hover {
-  background-color: hsl(214,91%,87%);
-  border-color: hsl(214, 91%, 65%);
-}
diff --git a/resources/bookmark_manager/css/menu.css b/resources/bookmark_manager/css/menu.css
deleted file mode 100644
index b7e0942..0000000
--- a/resources/bookmark_manager/css/menu.css
+++ /dev/null
@@ -1,47 +0,0 @@
-
-menu {
-  display: none;
-  position: absolute;
-  border: 1px solid #999;
-  -webkit-box-shadow: 2px 2px 3px hsla(0, 0%, 0%, .3);
-  color: black;
-  background-color: hsla(213, 0%, 100%, .95);
-  left: 0;
-  white-space: nowrap;
-  z-index: 2;
-  padding: 1px;
-  margin: 0;
-  cursor: default;
-}
-
-menu > * {
-  display: block;
-  margin: 0;
-  width: 100%;
-  text-align: start;
-}
-
-menu > :not(hr) {
-  -webkit-appearance: none;
-  background: transparent;
-  font: inherit;
-  border: 0;
-  padding: 3px 8px;
-  overflow: hidden;
-  text-overflow: ellipsis;
-}
-
-menu > hr {
-  border: 0;
-  border-top: 1px solid rgb(153, 153, 153);
-  margin: 2px 0;
-}
-
-menu > [hidden] {
-  display: none;
-}
-
-menu > [selected] {
-  background-color: hsl(213, 66%, 57%);
-  color: white;
-}
diff --git a/resources/bookmark_manager/css/tree.css b/resources/bookmark_manager/css/tree.css
deleted file mode 100644
index d1825e4..0000000
--- a/resources/bookmark_manager/css/tree.css
+++ /dev/null
@@ -1,164 +0,0 @@
-tree {
-  outline: none;
-  overflow: auto;
-  display: block;
-}
-
-.tree-item > .tree-row {
-  color: black;
-  -webkit-user-select: none;
-  border: 1px solid rgba(255,255,255,0); /* transparent white */
-  background-color: rgba(255,255,255,0);
-  -webkit-border-radius: 2px;
-  padding: 0px 3px;
-  line-height: 20px;
-  white-space: nowrap;
-  cursor: default;
-  position: relative;
-}
-
-.expand-icon {
-  width: 11px;
-  height: 16px;
-  display: inline-block;
-  vertical-align: top;
-  position: relative;
-  top: 2px;
-  background-image: -webkit-canvas(triangle-empty);
-  background-position: 50% 50%;
-  background-repeat: no-repeat;
-  -webkit-transition: all .15s, opacity 1.5s;
-  opacity: 0;
-}
-
-html[dir=rtl] .expand-icon {
-  -webkit-transform: scale(-1, 1);
-}
-
-tree:hover .expand-icon,
-tree:focus .expand-icon {
-  opacity: 1;
-  -webkit-transition: all .15s, opacity .5s;
-}
-
-.tree-item[expanded] > .tree-row > .expand-icon {
-  background-image: -webkit-canvas(triangle-filled);
-  -webkit-transform: translate(0, 3px) rotate(45deg);
-}
-
-html[dir=rtl] .tree-item[expanded] > .tree-row > .expand-icon {
-  -webkit-transform: scale(-1, 1) translate(0, 3px) rotate(45deg); /* flip */
-}
-
-.tree-item > .tree-row > .expand-icon:hover {
-  background-image: -webkit-canvas(triangle-hover);
-}
-
-.tree-row .expand-icon {
-  visibility: hidden;
-}
-
-.tree-row[may-have-children] .expand-icon {
-  visibility: visible;
-}
-
-.tree-row[has-children=false] .expand-icon {
-  visibility: hidden;
-}
-
-.tree-item > .tree-row:hover {
-  border-color: hsl(214, 91%, 85%);
-  z-index: 1;
-  background-color: hsl(214, 91%, 97%);
-}
-
-/*
-  WebKit has a bug with attribute selectors so we apply selected to the tree row
-  as well.
-
-  https://bugs.webkit.org/show_bug.cgi?id=12519
-
-*/
-.tree-row[selected]:hover,
-.tree-row[selected] {
-  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0)));
-}
-
-.tree-row[selected] {
-  border-color: hsl(0,0%,85%);
-  background-color: hsl(0, 0%, 90%);
-  z-index: 2;
-}
-
-:focus .tree-row[selected] {
-  background-color: hsl(214, 91%, 89%);
-  border-color: #7da2ce;
-}
-
-.tree-children[expanded] {
-  display: block;
-}
-
-.tree-children {
-  display: none;
-}
-
-.tree-item > .tree-row > * {
-  display: inline-block;
-  -webkit-box-sizing: border-box;
-}
-
-.tree-label {
-  -webkit-padding-start: 20px;
-  background-repeat: no-repeat;
-  background-position: 0 50%;
-  background-image: url("../images/folder_closed.png");
-}
-
-/* We need to ensure that even empty labels take up space */
-.tree-label:empty:after {
-  content: " ";
-  white-space: pre;
-}
-
-.tree-rename > .tree-row > .tree-label {
-  -webkit-user-select: auto;
-  -webkit-user-modify: read-write-plaintext-only;
-  background: white;
-  color: black;
-  outline: 1px solid black;
-}
-
-html[dir=rtl] .tree-label {
-  background-position: 100% 50%;
-}
-
-.tree-row[selected] > .tree-label {
-  background-image: url("../images/folder_open.png");
-}
-
-html[dir='rtl'] .tree-label {
-  background-image: url("../images/folder_closed_rtl.png");
-}
-
-html[dir='rtl'] .tree-row[selected] > .tree-label {
-  background-image: url("../images/folder_open_rtl.png");
-}
-
-.tree-item[editing] input {
-  /* Do not inherit the line-height */
-  font-family: inherit;
-  font-size: inherit;
-  font-weight: inherit;
-  border: 1px solid black;
-  color: black;
-  background: white;
-  margin: -2px -8px -2px -3px;
-  padding: 1px 7px 1px 1px;
-  outline: none;
-}
-
-html[dir=rtl] .tree-item[editing] input {
-  margin: -2px -3px -2px -8px;
-  padding: 1px 1px 1px 7px;
-}
diff --git a/resources/bookmark_manager/css/tree.css.js b/resources/bookmark_manager/css/tree.css.js
deleted file mode 100644
index 74fb06d..0000000
--- a/resources/bookmark_manager/css/tree.css.js
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function() {
-  var a = 7;
-  var a2 = a / 2;
-  var ctx = document.getCSSCanvasContext('2d', 'triangle-filled', a2 + 2, a + 1);
-
-  ctx.fillStyle = '#000';
-  ctx.translate(.5, .5);
-  ctx.beginPath();
-  ctx.moveTo(0, 0);
-  ctx.lineTo(0, a);
-  ctx.lineTo(a2, a2);
-  ctx.closePath();
-  ctx.fill();
-  ctx.stroke();
-
-  var ctx = document.getCSSCanvasContext('2d', 'triangle-empty', a2 + 2, a + 1);
-
-  ctx.strokeStyle = '#999';
-  ctx.lineWidth  = 1.2;
-  ctx.translate(.5, .5);
-  ctx.fillStyle = '#000';
-  ctx.beginPath();
-
-
-  ctx.moveTo(0, 0);
-  ctx.lineTo(0, a);
-  ctx.lineTo(a2, a2);
-  ctx.closePath();
-  ctx.stroke();
-
-  var ctx = document.getCSSCanvasContext('2d', 'triangle-hover', a2 + 2 + 4, a + 1 + 4);
-
-  ctx.shadowColor = 'hsl(214,91%,89%)'
-  ctx.shadowBlur = 3;
-  ctx.shadowOffsetX = 1;
-  ctx.shadowOffsetY = 0;
-
-  ctx.strokeStyle = 'hsl(214,91%,79%)';
-  ctx.lineWidth  = 1.2;
-  ctx.translate(.5 + 2, .5 + 2);
-  ctx.fillStyle = '#000';
-  ctx.beginPath();
-
-  ctx.moveTo(0, 0);
-  ctx.lineTo(0, a);
-  ctx.lineTo(a2, a2);
-  ctx.closePath();
-  ctx.stroke();
-})();
-
-// We need to generate CSS for the indentation.
-(function() {
-  // We need to generat the following
-  //.tree-item > * > .tree-item > .tree-row {
-  //  -webkit-padding-start: 20px;
-  //}
-
-  //.tree-item > * .tree-item > * .tree-item > * > .tree-item > .tree-row {
-  //  -webkit-padding-start: 60px;
-  //}
-  var style = document.createElement('style');
-
-  function repeat(s, n) {
-    return Array(n + 1).join(s);
-  }
-
-  var s = '';
-  for (var i = 1; i < 10; i++) {
-    s += repeat('.tree-item > * ', i) + '.tree-item > .tree-row {\n' +
-         '-webkit-padding-start:' + i * 20 + 'px\n' +
-         '}\n';
-  }
-  style.textContent = s;
-  document.documentElement.firstElementChild.appendChild(style);
-})();
diff --git a/resources/bookmark_manager/images/bookmark_bar_folder_mac.png b/resources/bookmark_manager/images/bookmark_bar_folder_mac.png
deleted file mode 100644
index ec5d21f..0000000
--- a/resources/bookmark_manager/images/bookmark_bar_folder_mac.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/bookmark_manager_recent.png b/resources/bookmark_manager/images/bookmark_manager_recent.png
deleted file mode 100644
index 9740e90..0000000
--- a/resources/bookmark_manager/images/bookmark_manager_recent.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/bookmark_manager_search.png b/resources/bookmark_manager/images/bookmark_manager_search.png
deleted file mode 100644
index 76abc27..0000000
--- a/resources/bookmark_manager/images/bookmark_manager_search.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/bookmarks_favicon.png b/resources/bookmark_manager/images/bookmarks_favicon.png
deleted file mode 100644
index 4da0edc..0000000
--- a/resources/bookmark_manager/images/bookmarks_favicon.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/bookmarks_section.png b/resources/bookmark_manager/images/bookmarks_section.png
deleted file mode 100644
index 1633f68..0000000
--- a/resources/bookmark_manager/images/bookmarks_section.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/folder_closed.png b/resources/bookmark_manager/images/folder_closed.png
deleted file mode 100644
index 746fab9..0000000
--- a/resources/bookmark_manager/images/folder_closed.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/folder_closed_rtl.png b/resources/bookmark_manager/images/folder_closed_rtl.png
deleted file mode 100644
index dbd0b0a..0000000
--- a/resources/bookmark_manager/images/folder_closed_rtl.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/folder_open.png b/resources/bookmark_manager/images/folder_open.png
deleted file mode 100644
index 3276810..0000000
--- a/resources/bookmark_manager/images/folder_open.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/images/folder_open_rtl.png b/resources/bookmark_manager/images/folder_open_rtl.png
deleted file mode 100644
index 9ba7069..0000000
--- a/resources/bookmark_manager/images/folder_open_rtl.png
+++ /dev/null
Binary files differ
diff --git a/resources/bookmark_manager/js/bmm.js b/resources/bookmark_manager/js/bmm.js
deleted file mode 100644
index 73cefa6..0000000
--- a/resources/bookmark_manager/js/bmm.js
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('bmm', function() {
-  const TreeIterator = bmm.TreeIterator;
-  const Promise = cr.Promise;
-
-  /**
-   * Whether a node contains another node.
-   * @param {!BookmarkTreeNode} parent
-   * @param {!BookmarkTreeNode} descendant
-   * @return {boolean} Whether the parent contains the descendant.
-   */
-  function contains(parent, descendant) {
-    if (descendant.parentId == parent.id)
-      return true;
-    // the bmm.treeLookup contains all folders
-    var parentTreeItem = bmm.treeLookup[descendant.parentId];
-    if (!parentTreeItem || !parentTreeItem.bookmarkNode)
-      return false;
-    return this.contains(parent, parentTreeItem.bookmarkNode);
-  }
-
-  /**
-   * @param {!BookmarkTreeNode} node The node to test.
-   * @return {boolean} Whether a bookmark node is a folder.
-   */
-  function isFolder(node) {
-    return !('url' in node);
-  }
-
-  var loadingPromise;
-
-  /**
-   * Loads the entire bookmark tree and returns a {@code cr.Promise} that will
-   * be fulfilled when done. This reuses multiple loads so that we never load
-   * more than one tree at the same time.
-   * @return {!cr.Promise} The future promise for the load.
-   */
-  function loadTree() {
-    var p = new Promise;
-    if (!loadingPromise) {
-      loadingPromise = new Promise;
-      chrome.bookmarks.getTree(function(nodes) {
-        loadingPromise.value = nodes[0];
-        loadingPromise = null;
-      });
-    }
-    loadingPromise.addListener(function(n) {
-      p.value = n;
-    });
-    return p;
-  }
-
-  /**
-   * Helper function for {@code loadSubtree}. This does an in order search of
-   * the tree.
-   * @param {!BookmarkTreeNode} node The node to start searching at.
-   * @param {string} id The ID of the node to find.
-   * @return {BookmarkTreeNode} The found node or null if not found.
-   */
-  function findNode(node, id) {
-    var it = new TreeIterator(node);
-    var n;
-    while (it.moveNext()) {
-      n = it.current;
-      if (n.id == id)
-        return n;
-    }
-    return null;
-  }
-
-  /**
-   * Loads a subtree of the bookmark tree and returns a {@code cr.Promise} that
-   * will be fulfilled when done. This reuses multiple loads so that we never
-   * load more than one tree at the same time. (This actually loads the entire
-   * tree but it will only return the relevant subtree in the value of the
-   * future promise.)
-   * @return {!cr.Promise} The future promise for the load.
-   */
-  function loadSubtree(id) {
-    var p = new Promise;
-    var lp = loadTree();
-    lp.addListener(function(tree) {
-      var node = findNode(tree, id);
-      p.value = node || Error('Failed to load subtree ' + id);
-    });
-    return p;
-  }
-
-  return {
-    contains: contains,
-    isFolder: isFolder,
-    loadSubtree: loadSubtree,
-    loadTree: loadTree
-  };
-});
diff --git a/resources/bookmark_manager/js/bmm/bookmarklist.js b/resources/bookmark_manager/js/bmm/bookmarklist.js
deleted file mode 100644
index f244936..0000000
--- a/resources/bookmark_manager/js/bmm/bookmarklist.js
+++ /dev/null
@@ -1,420 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-cr.define('bmm', function() {
-  // require cr.ui.define
-  // require cr.ui.limitInputWidth.
-  // require cr.ui.contextMenuHandler
-  const List = cr.ui.List;
-  const ListItem = cr.ui.ListItem;
-
-  var listLookup = {};
-
-  /**
-   * Removes all children and appends a new child.
-   * @param {!Node} parent The node to remove all children from.
-   * @param {!Node} newChild The new child to append.
-   */
-  function replaceAllChildren(parent, newChild) {
-    var n;
-    while ((n = parent.lastChild)) {
-      parent.removeChild(n);
-    }
-    parent.appendChild(newChild);
-  }
-
-  /**
-   * Creates a new bookmark list.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLButtonElement}
-   */
-  var BookmarkList = cr.ui.define('list');
-
-  BookmarkList.prototype = {
-    __proto__: List.prototype,
-
-    decorate: function() {
-      List.prototype.decorate.call(this);
-      this.addEventListener('click', this.handleClick_);
-    },
-
-    parentId_: '',
-    get parentId() {
-      return this.parentId_;
-    },
-    set parentId(parentId) {
-      if (this.parentId_ == parentId)
-        return;
-
-      var oldParentId = this.parentId_;
-      this.parentId_ = parentId;
-
-      var callback = cr.bind(this.handleBookmarkCallback, this);
-
-      if (!parentId) {
-        callback([]);
-      } else if (/^q=/.test(parentId)) {
-        chrome.bookmarks.search(parentId.slice(2), callback);
-      } else if (parentId == 'recent') {
-        chrome.bookmarks.getRecent(50, callback);
-      } else {
-        chrome.bookmarks.getChildren(parentId, callback);
-      }
-
-      cr.dispatchPropertyChange(this, 'parentId', parentId, oldParentId);
-    },
-
-    handleBookmarkCallback: function(items) {
-      if (!items) {
-        // Failed to load bookmarks. Most likely due to the bookmark beeing
-        // removed.
-        cr.dispatchSimpleEvent(this, 'invalidId');
-        return;
-      }
-      // Remove all fields without recreating the object since other code
-      // references it.
-      for (var id in listLookup){
-        delete listLookup[id];
-      }
-      this.clear();
-      var showFolder = this.showFolder();
-      items.forEach(function(item) {
-        var li = createListItem(item, showFolder);
-        this.add(li);
-      }, this);
-      cr.dispatchSimpleEvent(this, 'load');
-    },
-
-    /**
-     * The bookmark node that the list is currently displaying. If we are currently
-     * displaying recent or search this returns null.
-     * @type {BookmarkTreeNode}
-     */
-    get bookmarkNode() {
-      if (this.isSearch() || this.isRecent())
-        return null;
-      var treeItem = bmm.treeLookup[this.parentId];
-      return treeItem && treeItem.bookmarkNode;
-    },
-
-    showFolder: function() {
-      return this.isSearch() || this.isRecent();
-    },
-
-    isSearch: function() {
-      return this.parentId_[0] == 'q';
-    },
-
-    isRecent: function() {
-      return this.parentId_ == 'recent';
-    },
-
-    /**
-     * Handles the clicks on the list so that we can check if the user clicked
-     * on a link or an folder.
-     * @private
-     * @param {Event} e The click event object.
-     */
-    handleClick_: function(e) {
-
-      var el = e.target;
-      if (el.href) {
-        var event = this.ownerDocument.createEvent('Event');
-        event.initEvent('urlClicked', true, false);
-        event.url = el.href;
-        event.kind = e.shiftKey ? 'window' : e.button == 1 ? 'tab' : 'self';
-        this.dispatchEvent(event);
-      }
-    },
-
-    // Bookmark model update callbacks
-    handleBookmarkChanged: function(id, changeInfo) {
-      var listItem = listLookup[id];
-      if (listItem) {
-        listItem.bookmarkNode.title = changeInfo.title;
-        if ('url' in changeInfo)
-          listItem.bookmarkNode.url = changeInfo['url'];
-        updateListItem(listItem, listItem.bookmarkNode, list.showFolder());
-      }
-    },
-
-    handleChildrenReordered: function(id, reorderInfo) {
-      if (this.parentId == id) {
-        var self = this;
-        reorderInfo.childIds.forEach(function(id, i) {
-          var li = listLookup[id]
-          self.addAt(li, i);
-          // At this point we do not read the index from the bookmark node so we
-          // do not need to update it.
-          li.bookmarkNode.index = i;
-        });
-      }
-    },
-
-    handleCreated: function(id, bookmarkNode) {
-      if (this.parentId == bookmarkNode.parentId) {
-        var li = createListItem(bookmarkNode, false);
-        this.addAt(li, bookmarkNode.index);
-      }
-    },
-
-    handleMoved: function(id, moveInfo) {
-      if (moveInfo.parentId == this.parentId ||
-          moveInfo.oldParentId == this.parentId) {
-
-        if (moveInfo.oldParentId == moveInfo.parentId) {
-          var listItem = listLookup[id];
-          if (listItem) {
-            this.remove(listItem);
-            this.addAt(listItem, moveInfo.index);
-          }
-        } else {
-          if (moveInfo.oldParentId == this.parentId) {
-            var listItem = listLookup[id];
-            if (listItem) {
-              this.remove(listItem);
-              delete listLookup[id];
-            }
-          }
-
-          if (moveInfo.parentId == list.parentId) {
-            var self = this;
-            chrome.bookmarks.get(id, function(bookmarkNodes) {
-              var bookmarkNode = bookmarkNodes[0];
-              var li = createListItem(bookmarkNode, false);
-              self.addAt(li, bookmarkNode.index);
-            });
-          }
-        }
-      }
-    },
-
-    handleRemoved: function(id, removeInfo) {
-      var listItem = listLookup[id];
-      if (listItem) {
-        this.remove(listItem);
-        delete listLookup[id];
-      }
-    }
-  };
-
-  /**
-   * The contextMenu property.
-   * @type {cr.ui.Menu}
-   */
-  cr.ui.contextMenuHandler.addContextMenuProperty(BookmarkList);
-
-  /**
-   * Creates a new bookmark list item.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {cr.ui.ListItem}
-   */
-  var BookmarkListItem = cr.ui.define('li');
-
-  BookmarkListItem.prototype = {
-    __proto__: ListItem.prototype,
-    /**
-     * Whether the user is currently able to edit the list item.
-     * @type {boolean}
-     */
-    get editing() {
-      return this.hasAttribute('editing');
-    },
-    set editing(editing) {
-      var oldEditing = this.editing;
-      if (oldEditing == editing)
-        return;
-
-      var url = this.bookmarkNode.url;
-      var title = this.bookmarkNode.title;
-      var isFolder = bmm.isFolder(this.bookmarkNode);
-      var listItem = this;
-      var labelEl = this.firstChild;
-      var urlEl = this.querySelector('.url');
-      var labelInput, urlInput;
-
-      // Handles enter and escape which trigger reset and commit respectively.
-      function handleKeydown(e) {
-        // Make sure that the tree does not handle the key.
-        e.stopPropagation();
-
-        // Calling list.focus blurs the input which will stop editing the list
-        // item.
-        switch (e.keyIdentifier) {
-          case 'U+001B':  // Esc
-            labelInput.value = title;
-            if (!isFolder)
-              urlInput.value = url;
-            // fall through
-            cr.dispatchSimpleEvent(listItem, 'canceledit', true);
-          case 'Enter':
-            if (listItem.parentNode)
-              listItem.parentNode.focus();
-        }
-      }
-
-      function handleBlur(e) {
-        // When the blur event happens we do not know who is getting focus so we
-        // delay this a bit since we want to know if the other input got focus
-        // before deciding if we should exit edit mode.
-        var doc = e.target.ownerDocument;
-        window.setTimeout(function() {
-          var activeElement = doc.activeElement;
-          if (activeElement != urlInput && activeElement != labelInput) {
-            listItem.editing = false;
-          }
-        }, 50);
-      }
-
-      var doc = this.ownerDocument;
-      if (editing) {
-        this.setAttribute('editing', '');
-        this.draggable = false;
-
-        labelInput = doc.createElement('input');
-        labelInput.placeholder =
-            localStrings.getString('name_input_placeholder');
-        replaceAllChildren(labelEl, labelInput);
-        labelInput.value = title;
-
-        if (!isFolder) {
-          // To use :invalid we need to put the input inside a form
-          // https://bugs.webkit.org/show_bug.cgi?id=34733
-          var form = doc.createElement('form');
-          urlInput = doc.createElement('input');
-          urlInput.type = 'url';
-          urlInput.required = true;
-          urlInput.placeholder =
-              localStrings.getString('url_input_placeholder');
-
-          // We also need a name for the input for the CSS to work.
-          urlInput.name = '-url-input-' + cr.createUid();
-          form.appendChild(urlInput);
-          replaceAllChildren(urlEl, form);
-          urlInput.value = url;
-        }
-
-        function stopPropagation(e) {
-          e.stopPropagation();
-        }
-
-        var eventsToStop = ['mousedown', 'mouseup', 'contextmenu', 'dblclick'];
-        eventsToStop.forEach(function(type) {
-          labelInput.addEventListener(type, stopPropagation);
-        });
-        labelInput.addEventListener('keydown', handleKeydown);
-        labelInput.addEventListener('blur', handleBlur);
-        cr.ui.limitInputWidth(labelInput, this, 200);
-        labelInput.focus();
-        labelInput.select();
-
-        if (!isFolder) {
-          eventsToStop.forEach(function(type) {
-            urlInput.addEventListener(type, stopPropagation);
-          });
-          urlInput.addEventListener('keydown', handleKeydown);
-          urlInput.addEventListener('blur', handleBlur);
-          cr.ui.limitInputWidth(urlInput, this, 200);
-        }
-
-      } else {
-
-        // Check that we have a valid URL and if not we do not change the
-        // editing mode.
-        if (!isFolder) {
-          var urlInput = this.querySelector('.url input');
-          var newUrl = urlInput.value;
-          if (!urlInput.validity.valid) {
-            // WebKit does not do URL fix up so we manually test if prepending
-            // 'http://' would make the URL valid.
-            // https://bugs.webkit.org/show_bug.cgi?id=29235
-            urlInput.value = 'http://' + newUrl;
-            if (!urlInput.validity.valid) {
-              // still invalid
-              urlInput.value = newUrl;
-
-              // In case the item was removed before getting here we should
-              // not alert.
-              if (listItem.parentNode) {
-                alert(localStrings.getString('invalid_url'));
-              }
-              urlInput.focus();
-              urlInput.select();
-              return;
-            }
-            newUrl = 'http://' + newUrl;
-          }
-          urlEl.textContent = this.bookmarkNode.url = newUrl;
-        }
-
-        this.removeAttribute('editing');
-        this.draggable = true;
-
-        labelInput = this.querySelector('.label input');
-        var newLabel = labelInput.value;
-        labelEl.textContent = this.bookmarkNode.title = newLabel;
-
-        if (isFolder) {
-          if (newLabel != title) {
-            cr.dispatchSimpleEvent(this, 'rename', true);
-          }
-        } else if (newLabel != title || newUrl != url) {
-          cr.dispatchSimpleEvent(this, 'edit', true);
-        }
-      }
-    }
-  };
-
-  function createListItem(bookmarkNode, showFolder) {
-    var li = listItemPromo.cloneNode(true);
-    BookmarkListItem.decorate(li);
-    updateListItem(li, bookmarkNode, showFolder);
-    li.bookmarkId = bookmarkNode.id;
-    li.bookmarkNode = bookmarkNode;
-    li.draggable = true;
-    listLookup[bookmarkNode.id] = li;
-    return li;
-  }
-
-  function updateListItem(el, bookmarkNode, showFolder) {
-    var labelEl = el.firstChild;
-    labelEl.textContent = bookmarkNode.title;
-    if (!bmm.isFolder(bookmarkNode)) {
-      labelEl.style.backgroundImage = url('chrome://favicon/' +
-                                          bookmarkNode.url);
-      var urlEl = el.childNodes[1].firstChild;
-      urlEl.textContent = urlEl.href = bookmarkNode.url;
-    } else {
-      el.className = 'folder';
-    }
-
-    var folderEl = el.lastChild.firstChild;
-    if (showFolder) {
-      folderEl.style.display = '';
-      folderEl.textContent = getFolder(bookmarkNode.parentId);
-      folderEl.href = '#' + bookmarkNode.parentId;
-    } else {
-      folderEl.style.display = 'none';
-    }
-  }
-
-  var listItemPromo = (function() {
-    var div = cr.doc.createElement('div');
-    div.innerHTML = '<div>' +
-        '<div class=label></div>' +
-        '<div><span class=url></span></div>' +
-        '<div><span class=folder></span></div>' +
-        '</div>';
-    return div.firstChild;
-  })();
-
-  return {
-    createListItem: createListItem,
-    BookmarkList: BookmarkList,
-    listLookup: listLookup
-  };
-});
diff --git a/resources/bookmark_manager/js/bmm/bookmarktree.js b/resources/bookmark_manager/js/bmm/bookmarktree.js
deleted file mode 100644
index 8acfa28..0000000
--- a/resources/bookmark_manager/js/bmm/bookmarktree.js
+++ /dev/null
@@ -1,189 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-
-cr.define('bmm', function() {
-  const Tree = cr.ui.Tree;
-  const TreeItem = cr.ui.TreeItem;
-
-  var treeLookup = {};
-
-  /**
-   * Creates a new tree item for a bookmark node.
-   * @param {!Object} bookmarkNode The bookmark node.
-   * @return {!cr.ui.TreeItem} The newly created tree item.
-   */
-  function createTreeItem(bookmarkNode) {
-    var id = bookmarkNode.id;
-    var ti = new TreeItem({
-      bookmarkId: id,
-      bookmarkNode: bookmarkNode,
-      // Bookmark toolbar and Other bookmarks are not draggable.
-      draggable: bookmarkNode.parentId != ROOT_ID
-    });
-    treeLookup[id] = ti;
-    updateTreeItem(ti, bookmarkNode);
-    return ti;
-  }
-
-  /**
-   * Updates an existing tree item to match a bookmark node.
-   * @param {!cr.ui.TreeItem} el The tree item to update.
-   * @param {!Object} bookmarkNode The bookmark node describing the tree item.
-   */
-  function updateTreeItem(el, bookmarkNode) {
-    el.label = bookmarkNode.title;
-  }
-
-  /**
-   * Asynchronousy adds a tree item at the correct index based on the bookmark
-   * backend.
-   *
-   * Since the bookmark tree only contains folders the index we get from certain
-   * callbacks is not very useful so we therefore have this async call which
-   * gets the children of the parent and adds the tree item at the desired
-   * index.
-   *
-   * This also exoands the parent so that newly added children are revealed.
-   *
-   * @param {!cr.ui.TreeItem} parent The parent tree item.
-   * @param {!cr.ui.TreeItem} treeItem The tree item to add.
-   * @param {Function=} f A function which gets called after the item has been
-   *     added at the right index.
-   */
-  function addTreeItem(parent, treeItem, opt_f) {
-    chrome.bookmarks.getChildren(parent.bookmarkNode.id, function(children) {
-      var index = children.filter(bmm.isFolder).map(function(item) {
-        return item.id;
-      }).indexOf(treeItem.bookmarkNode.id);
-      parent.addAt(treeItem, index);
-      parent.expanded = true;
-      if (opt_f)
-        opt_f();
-    });
-  }
-
-
-  /**
-   * Creates a new bookmark list.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLButtonElement}
-   */
-  var BookmarkTree = cr.ui.define('tree');
-
-  BookmarkTree.prototype = {
-    __proto__: Tree.prototype,
-
-    handleBookmarkChanged: function(id, changeInfo) {
-      var treeItem = treeLookup[id];
-      if (treeItem) {
-        treeItem.bookmarkNode.title = changeInfo.title;
-        updateTreeItem(treeItem, treeItem.bookmarkNode);
-      }
-    },
-
-    handleChildrenReordered: function(id, reorderInfo) {
-      var parentItem = treeLookup[id];
-      // The tree only contains folders.
-      var dirIds = reorderInfo.childIds.filter(function(id) {
-        return id in treeLookup;
-      }).forEach(function(id, i) {
-        parentItem.addAt(treeLookup[id], i);
-      });
-    },
-
-    handleCreated: function(id, bookmarkNode) {
-      if (bmm.isFolder(bookmarkNode)) {
-        var parentItem = treeLookup[bookmarkNode.parentId];
-        var newItem = createTreeItem(bookmarkNode);
-        addTreeItem(parentItem, newItem);
-      }
-    },
-
-    handleMoved: function(id, moveInfo) {
-      var treeItem = treeLookup[id];
-      if (treeItem) {
-        var oldParentItem = treeLookup[moveInfo.oldParentId];
-        oldParentItem.remove(treeItem);
-        var newParentItem = treeLookup[moveInfo.parentId];
-        // The tree only shows folders so the index is not the index we want. We
-        // therefore get the children need to adjust the index.
-        addTreeItem(newParentItem, treeItem);
-      }
-    },
-
-    handleRemoved: function(id, removeInfo) {
-      var parentItem = treeLookup[removeInfo.parentId];
-      var itemToRemove = treeLookup[id];
-      if (parentItem && itemToRemove) {
-        parentItem.remove(itemToRemove);
-      }
-    },
-
-    insertSubtree:function(folder) {
-      if (!bmm.isFolder(folder))
-        return;
-      var children = folder.children;
-      this.handleCreated(folder.id, folder);
-      for(var i = 0; i < children.length; i++) {
-        var child = children[i];
-        this.insertSubtree(child);
-      }
-    },
-
-    /**
-     * Returns the bookmark node with the given ID. The tree only maintains
-     * folder nodes.
-     * @param {string} id The ID of the node to find.
-     * @return {BookmarkTreeNode} The bookmark tree node or null if not found.
-     */
-    getBookmarkNodeById: function(id) {
-      var treeItem = treeLookup[id];
-      if (treeItem)
-        return treeItem.bookmarkNode;
-      return null;
-    },
-
-    /**
-     * Fetches the bookmark items and builds the tree control.
-     */
-    buildTree: function() {
-
-      /**
-       * Recursive helper function that adds all the directories to the
-       * parentTreeItem.
-       * @param {!cr.ui.Tree|!cr.ui.TreeItem} parentTreeItem The parent tree element
-       *     to append to.
-       * @param {!Array.<BookmarkTreeNode>} bookmarkNodes
-       * @return {boolean} Whether any directories where added.
-       */
-      function buildTreeItems(parentTreeItem, bookmarkNodes) {
-        var hasDirectories = false;
-        for (var i = 0, bookmarkNode; bookmarkNode = bookmarkNodes[i]; i++) {
-          if (bmm.isFolder(bookmarkNode)) {
-            hasDirectories = true;
-            var item = bmm.createTreeItem(bookmarkNode);
-            parentTreeItem.add(item);
-            var anyChildren = buildTreeItems(item, bookmarkNode.children);
-            item.expanded = anyChildren;
-          }
-        }
-        return hasDirectories;
-      }
-
-      var self = this;
-      chrome.bookmarks.getTree(function(root) {
-        buildTreeItems(self, root[0].children);
-        cr.dispatchSimpleEvent(self, 'load');
-      });
-    }
-  };
-
-  return {
-    BookmarkTree: BookmarkTree,
-    createTreeItem: createTreeItem,
-    treeLookup: treeLookup
-  };
-});
diff --git a/resources/bookmark_manager/js/bmm/treeiterator.js b/resources/bookmark_manager/js/bmm/treeiterator.js
deleted file mode 100644
index 042f24f..0000000
--- a/resources/bookmark_manager/js/bmm/treeiterator.js
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('bmm', function() {
-  /**
-   * An inorder (document order) iterator for iterating over a bookmark tree.
-   *
-   * <pre>
-   * var it = new TreeIterator(node);
-   * while (it.moveNext()) {
-   *   print(it.current.title);
-   * }
-   * </pre>
-   *
-   * @param {!BookmarkTreeNode} node The node to start at.
-   * @constructor
-   */
-  function TreeIterator(node) {
-    this.current_ = node;
-    this.parentStack_ = [];
-    this.indexStack_ = [];
-  }
-
-  /**
-   * Helper function for {@code TreeIterator.prototype.next}. This returns the
-   * next node in document order.
-   * @param {BookmarkTreeNode} node The current node.
-   * @param {!Array.<!BookmarkTreeNode>} parents A stack of parents.
-   * @param {!Array.<number>} index A stack of indexes.
-   * @return {BookmarkTreeNode} The next node or null if no more nodes can be
-   *     found.
-   */
-  function getNext(node, parents, index) {
-    var i, p;
-
-    if (!node)
-      return null;
-
-    // If the node has children return first child.
-    if (node.children && node.children.length) {
-      parents.push(node);
-      index.push(0);
-      return node.children[0];
-    }
-
-    if (!parents.length)
-      return null;
-
-    // Walk up the parent stack until we find a node that has a next sibling.
-    while (node) {
-      p = parents[parents.length - 1];
-      if (!p)
-        return null;
-      i = index[index.length - 1];
-      if (i + 1 < p.children.length)
-        break;
-      node = parents.pop();
-      index.pop();
-    }
-
-    // Walked out of subtree.
-    if (!parents.length || !node)
-      return null;
-
-    // Return next child.
-    i = ++index[index.length - 1];
-    p = parents[parents.length - 1];
-    return p.children[i];
-  }
-
-  TreeIterator.prototype = {
-    /**
-     * Whether the next move will be the first move.
-     * @type {boolean}
-     * @private
-     */
-    first_: true,
-
-    /**
-     * Moves the iterator to the next item.
-     * @return {boolean} Whether we succeeded moving to the next item. This
-     * returns false when we have moved off the end of the iterator.
-     */
-    moveNext: function() {
-      // The first call to this should move us to the first node.
-      if (this.first_) {
-        this.first_ = false;
-        return true;
-      }
-      this.current_ = getNext(this.current_, this.parentStack_,
-                              this.indexStack_);
-
-      return !!this.current_;
-    },
-
-    /**
-     * The current item. This throws an exception if trying to access after
-     * {@code moveNext} has returned false or before {@code moveNext} has been
-     * called.
-     * @type {!BookmarkTreeNode}
-     */
-    get current() {
-      if (!this.current_ || this.first_)
-        throw Error('No such element');
-      return this.current_;
-    }
-  };
-
-  return {
-    TreeIterator: TreeIterator
-  };
-});
diff --git a/resources/bookmark_manager/js/cr.js b/resources/bookmark_manager/js/cr.js
deleted file mode 100644
index 9de94da..0000000
--- a/resources/bookmark_manager/js/cr.js
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-const cr = (function() {
-
-  /**
-   * Whether we are using a Mac or not.
-   * @type {boolean}
-   */
-  const isMac = /Mac/.test(navigator.platform);
-
-  /**
-   * Builds an object structure for the provided namespace path,
-   * ensuring that names that already exist are not overwritten. For
-   * example:
-   * "a.b.c" -> a = {};a.b={};a.b.c={};
-   * @param {string} name Name of the object that this file defines.
-   * @param {*=} opt_object The object to expose at the end of the path.
-   * @param {Object=} opt_objectToExportTo The object to add the path to;
-   *     default is {@code window}.
-   * @private
-   */
-  function exportPath(name, opt_object, opt_objectToExportTo) {
-    var parts = name.split('.');
-    var cur = opt_objectToExportTo || window /* global */;
-
-    for (var part; parts.length && (part = parts.shift());) {
-      if (!parts.length && opt_object !== undefined) {
-        // last part and we have an object; use it
-        cur[part] = opt_object;
-      } else if (part in cur) {
-        cur = cur[part];
-      } else {
-        cur = cur[part] = {};
-      }
-    }
-    return cur;
-  };
-
-  /**
-   * Fires a property change event on the target.
-   * @param {EventTarget} target The target to dispatch the event on.
-   * @param {string} propertyName The name of the property that changed.
-   * @param {*} newValue The new value for the property.
-   * @param {*} oldValue The old value for the property.
-   */
-  function dispatchPropertyChange(target, propertyName, newValue, oldValue) {
-    // TODO(arv): Depending on cr.Event here is a bit ugly.
-    var e = new cr.Event(propertyName + 'Change');
-    e.propertyName = propertyName;
-    e.newValue = newValue;
-    e.oldValue = oldValue;
-    target.dispatchEvent(e);
-  }
-
-  /**
-   * The kind of property to define in {@code defineProperty}.
-   * @enum {number}
-   */
-  const PropertyKind = {
-    /**
-     * Plain old JS property where the backing data is stored as a "private"
-     * field on the object.
-     */
-    JS: 'js',
-
-    /**
-     * The property backing data is stored as an attribute on an element.
-     */
-    ATTR: 'attr',
-
-    /**
-     * The property backing data is stored as an attribute on an element. If the
-     * element has the attribute then the value is true.
-     */
-    BOOL_ATTR: 'boolAttr'
-  };
-
-  /**
-   * Helper function for defineProperty that returns the getter to use for the
-   * property.
-   * @param {string} name
-   * @param {cr.PropertyKind} kind
-   * @param {*} defaultValue The default value. This is only used for the ATTR
-   *    kind.
-   * @return {function():*} The getter for the property.
-   */
-  function getGetter(name, kind, defaultValue) {
-    switch (kind) {
-      case PropertyKind.JS:
-        var privateName = name + '_';
-        return function() {
-          return this[privateName];
-        };
-      case PropertyKind.ATTR:
-        // For attr with default value we return the default value if the
-        // element is missing the attribute.
-        if (defaultValue == undefined) {
-          return function() {
-            return this.getAttribute(name);
-          };
-        } else {
-          return function() {
-            // WebKit uses null for non existant attributes.
-            var value = this.getAttribute(name);
-            return value !== null ? value : defaultValue;
-          };
-        }
-      case PropertyKind.BOOL_ATTR:
-        // Boolean attributes don't support default values.
-        return function() {
-          return this.hasAttribute(name);
-        };
-    }
-  }
-
-  /**
-   * Helper function for defineProperty that returns the setter of the right
-   * kind.
-   * @param {string} name The name of the property we are defining the setter
-   *     for.
-   * @param {cr.PropertyKind} kind The kind of property we are getting the
-   *     setter for.
-   * @return {function(*):void} The function to use as a setter.
-   */
-  function getSetter(name, kind) {
-    switch (kind) {
-      case PropertyKind.JS:
-        var privateName = name + '_';
-        return function(value) {
-          var oldValue = this[privateName];
-          if (value !== oldValue) {
-            this[privateName] = value;
-            dispatchPropertyChange(this, name, value, oldValue);
-          }
-        };
-
-      case PropertyKind.ATTR:
-        return function(value) {
-          var oldValue = this[name];
-          if (value !== oldValue) {
-            this.setAttribute(name, value);
-            dispatchPropertyChange(this, name, value, oldValue);
-          }
-        };
-
-      case PropertyKind.BOOL_ATTR:
-        return function(value) {
-          var oldValue = this[name];
-          if (value !== oldValue) {
-            if (value)
-              this.setAttribute(name, name);
-            else
-              this.removeAttribute(name);
-            dispatchPropertyChange(this, name, value, oldValue);
-          }
-        };
-    }
-  }
-
-  /**
-   * Defines a property on an object. When the setter changes the value a
-   * property change event with the type {@code name + 'Change'} is fired.
-   * @param {!Object} The object to define the property for.
-   * @param {string} The name of the property.
-   * @param {cr.PropertyKind=} opt_kind What kind of underlying storage to use.
-   * @param {*} opt_defaultValue The default value.
-   */
-  function defineProperty(obj, name, opt_kind, opt_default) {
-    if (typeof obj == 'function')
-      obj = obj.prototype;
-
-    var kind = opt_kind || PropertyKind.JS;
-
-    if (!obj.__lookupGetter__(name)) {
-      // For js properties we set the default value on the prototype.
-      if (kind == PropertyKind.JS && arguments.length > 3)  {
-        var privateName = name + '_';
-        obj[privateName] = opt_default;
-      }
-      obj.__defineGetter__(name, getGetter(name, kind, opt_default));
-    }
-
-    if (!obj.__lookupSetter__(name)) {
-      obj.__defineSetter__(name, getSetter(name, kind));
-    }
-  }
-
-  /**
-   * Counter for use with createUid
-   */
-  var uidCounter = 1;
-
-  /**
-   * @return {number} A new unique ID.
-   */
-  function createUid() {
-    return uidCounter++;
-  }
-
-  /**
-   * Returns a unique ID for the item. This mutates the item so it needs to be
-   * an object
-   * @param {!Object} item The item to get the unique ID for.
-   * @return {number} The unique ID for the item.
-   */
-  function getUid(item) {
-    if (item.hasOwnProperty('uid'))
-      return item.uid;
-    return item.uid = createUid();
-  }
-
-  /**
-   * Partially applies this function to a particular 'this object' and zero or
-   * more arguments. The result is a new function with some arguments of the
-   * first function pre-filled and the value of |this| 'pre-specified'.
-   *
-   * Remaining arguments specified at call-time are appended to the pre-
-   * specified ones.
-   *
-   * Usage:
-   * <pre>var barMethBound = bind(myFunction, myObj, 'arg1', 'arg2');
-   * barMethBound('arg3', 'arg4');</pre>
-   *
-   * @param {Function} fn A function to partially apply.
-   * @param {Object|undefined} selfObj Specifies the object which |this| should
-   *     point to when the function is run. If the value is null or undefined,
-   *     it will default to the global object.
-   * @param {...*} var_args Additional arguments that are partially
-   *     applied to the function.
-   *
-   * @return {!Function} A partially-applied form of the function bind() was
-   *     invoked as a method of.
-   */
-  function bind(fn, selfObj, var_args) {
-    var boundArgs = Array.prototype.slice.call(arguments, 2);
-    return function() {
-      var args = Array.prototype.slice.call(arguments);
-      args.unshift.apply(args, boundArgs);
-      return fn.apply(selfObj, args);
-    }
-  }
-
-  /**
-   * Dispatches a simple event on an event target.
-   * @param {!EventTarget} target The event target to dispatch the event on.
-   * @param {string} type The type of the event.
-   * @param {boolean=} opt_bubbles Whether the event bubbles or not.
-   * @param {boolean=} opt_cancelable Whether the default action of the event
-   *     can be prevented.
-   * @return {boolean} If any of the listeners called {@code preventDefault}
-   *     during the dispatch this will return false.
-   */
-  function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) {
-    var e = new cr.Event(type, opt_bubbles, opt_cancelable);
-    return target.dispatchEvent(e);
-  }
-
-  /**
-   * @param {string} name
-   * @param {!Function} fun
-   */
-  function define(name, fun) {
-    var obj = exportPath(name);
-    var exports = fun();
-    for (var key in exports) {
-      obj[key] = exports[key];
-    }
-  }
-
-  /**
-   * Document used for various document related operations.
-   * @type {!Document}
-   */
-  var doc = document;
-
-
-  /**
-   * Allows you to run func in the context of a different document.
-   * @param {!Document} document The document to use.
-   * @param {function():*} func The function to call.
-   */
-  function withDoc(document, func) {
-    var oldDoc = doc;
-    doc = document;
-    try {
-      func();
-    } finally {
-      doc = oldDoc;
-    }
-  }
-
-  return {
-    isMac: isMac,
-    define: define,
-    defineProperty: defineProperty,
-    PropertyKind: PropertyKind,
-    createUid: createUid,
-    getUid: getUid,
-    bind: bind,
-    dispatchSimpleEvent: dispatchSimpleEvent,
-    dispatchPropertyChange: dispatchPropertyChange,
-
-    /**
-     * The document that we are currently using.
-     * @type {!Document}
-     */
-    get doc() {
-      return doc;
-    },
-    withDoc: withDoc
-  };
-})();
diff --git a/resources/bookmark_manager/js/cr/event.js b/resources/bookmark_manager/js/cr/event.js
deleted file mode 100644
index 19fee7e..0000000
--- a/resources/bookmark_manager/js/cr/event.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview This is a simple pure JS event class that can be used with
- * {@code cr.ui.EventTarget}. It should not be used with DOM EventTargets.
- */
-
-cr.define('cr', function() {
-
-  // cr.Event is called CustomEvent in here to prevent naming conflicts. We
-  // alse store the original Event in case someone does a global alias of
-  // cr.Event.
-
-  const DomEvent = Event;
-
-  /**
-   * Creates a new event to be used with cr.EventTarget or DOM EventTarget
-   * objects.
-   * @param {string} type The name of the event.
-   * @param {boolean=}
-   * @constructor
-   */
-  function CustomEvent(type, opt_bubbles, opt_capture) {
-    var e = cr.doc.createEvent('Event');
-    e.initEvent(type, !!opt_bubbles, !!opt_capture);
-    e.__proto__ = CustomEvent.prototype;
-    return e;
-  }
-
-  CustomEvent.prototype = {
-    __proto__: DomEvent.prototype
-  };
-
-  // Export
-  return {
-    Event: CustomEvent
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/eventtarget.js b/resources/bookmark_manager/js/cr/eventtarget.js
deleted file mode 100644
index f2bc733..0000000
--- a/resources/bookmark_manager/js/cr/eventtarget.js
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr', function() {
-
-  // TODO(arv): object.handleEvent
-
-  function EventTarget() {
-  }
-
-  EventTarget.prototype = {
-
-    /**
-     * Adds an event listener to the target.
-     * @param {string} type The name of the event.
-     * @param {!Function|{handleEvent:Function}} handler The handler for the
-     *     event. This is called when the event is dispatched.
-     */
-    addEventListener: function(type, handler) {
-      if (!this.listeners_)
-        this.listeners_ = {__proto__: null};
-      if (!(type in this.listeners_)) {
-        this.listeners_[type] = [handler];
-      } else {
-        var handlers = this.listeners_[type];
-        if (handlers.indexOf(handler) < 0)
-          handlers.push(handler);
-      }
-    },
-
-    /**
-     * Removes an event listener from the target.
-     * @param {string} type The name of the event.
-     * @param {!Function|{handleEvent:Function}} handler The handler for the
-     *     event.
-     */
-    removeEventListener: function(type, handler) {
-      if (!this.listeners_)
-        return;
-      if (type in this.listeners_) {
-        var handlers = this.listeners_[type];
-        var index = handlers.indexOf(handler);
-        if (index >= 0) {
-          // Clean up if this was the last listener.
-          if (handlers.length == 1)
-            delete this.listeners_[type];
-          else
-            handlers.splice(index, 1);
-        }
-      }
-    },
-
-    /**
-     * Dispatches an event and calls all the listeners that are listening to
-     * the type of the event.
-     * @param {!cr.event.Event} event The event to dispatch.
-     * @return {boolean} Whether the default action was prevented. If someone
-     *     calls preventDefault on the event object then this returns false.
-     */
-    dispatchEvent: function(event) {
-      if (!this.listeners_)
-        return true;
-
-      // Since we are using DOM Event objects we need to override some of the
-      // properties and methods so that we can emulate this correctly.
-      var self = this;
-      event.__defineGetter__('target', function() {
-        return self;
-      });
-      event.preventDefault = function() {
-        this.returnValue = false;
-      };
-
-      var type = event.type;
-      var prevented = 0;
-      if (type in this.listeners_) {
-        // Clone to prevent removal during dispatch
-        var handlers = this.listeners_[type].concat();
-        for (var i = 0, handler; handler = handlers[i]; i++) {
-          if (handler.handleEvent)
-            prevented |= handler.handleEvent.call(handler, event) === false;
-          else
-            prevented |= handler.call(this, event) === false;
-        }
-      }
-
-      return !prevented && event.returnValue;
-    }
-  };
-
-  // Export
-  return {
-    EventTarget: EventTarget
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/promise.js b/resources/bookmark_manager/js/cr/promise.js
deleted file mode 100644
index e0494a5..0000000
--- a/resources/bookmark_manager/js/cr/promise.js
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview This implementes a future promise class.
- */
-
-cr.define('cr', function() {
-
-  /**
-   * Sentinel used to mark a value as pending.
-   */
-  const PENDING_VALUE = {};
-
-  /**
-   * Creates a future promise.
-   * @param {Function=} opt_callback Callback.
-   * @constructor
-   */
-  function Promise(opt_callback) {
-    /**
-     * An array of the callbacks.
-     * @type {!Array.<!Function>}
-     * @private
-     */
-    this.callbacks_ = opt_callback ? [opt_callback] : [];
-  }
-
-  Promise.prototype = {
-    /**
-     * The current value.
-     * @type {*}
-     * @private
-     */
-    value_: PENDING_VALUE,
-
-    /**
-     * The value of the future promise. Accessing this before the promise has
-     * been fulfilled will throw an error. If this is set to an exception
-     * accessing this will throw as well.
-     * @type {*}
-     */
-    get value() {
-      return this.done ? this.value_ : undefined;
-    },
-    set value(value) {
-      if (!this.done) {
-        this.value_ = value;
-        for (var i = 0; i < this.callbacks_.length; i++) {
-          this.callbacks_[i].call(null, value);
-        }
-        this.callbacks_.length = 0;
-      }
-    },
-
-    /**
-     * Whether the future promise has been fulfilled.
-     * @type {boolean}
-     */
-    get done() {
-      return this.value_ !== PENDING_VALUE;
-    },
-
-    /**
-     * Adds a listener to the future promise. The function will be called when
-     * the promise is fulfilled. If the promise is already fullfilled this will
-     * never call the function.
-     * @param {!Function} fun The function to call.
-     */
-    addListener: function(fun) {
-      if (this.done)
-        fun(this.value);
-      else
-        this.callbacks_.push(fun);
-    },
-
-    /**
-     * Removes a previously added listener from the future promise.
-     * @param {!Function} fun The function to remove.
-     */
-    removeListener: function(fun) {
-      var i = this.callbacks_.indexOf(fun);
-      if (i >= 0)
-        this.callbacks_.splice(i, 1);
-    },
-
-    /**
-     * If the promise is done then this returns the string representation of
-     * the value.
-     * @return {string} The string representation of the promise.
-     * @override
-     */
-    toString: function() {
-      if (this.done)
-        return String(this.value);
-      else
-        return '[object Promise]';
-    },
-
-    /**
-     * Override to allow arithmetic.
-     * @override
-     */
-    valueOf: function() {
-      return this.value;
-    }
-  };
-
-  /**
-   * When a future promise is done call {@code fun}. This also calls the
-   * function if the promise has already been fulfilled.
-   * @param {!Promise} p The promise.
-   * @param {!Function} fun The function to call when the promise is fulfilled.
-   */
-  Promise.when = function(p, fun) {
-    p.addListener(fun);
-  };
-
-  /**
-   * Creates a new promise the will be fulfilled after {@code t} ms.
-   * @param {number} t The time to wait before the promise is fulfilled.
-   * @param {*=} opt_value The value to return after the wait.
-   * @return {!Promise} The new future promise.
-   */
-  Promise.wait = function(t, opt_value) {
-    var p = new Promise;
-    window.setTimeout(function() {
-      p.value = opt_value;
-    }, t);
-    return p;
-  };
-
-  /**
-   * Creates a new future promise that is fulfilled when any of the promises are
-   * fulfilled.
-   * @param {...!Promise} var_args The promises used to build up the new
-   *     promise.
-   * @return {!Promise} The new promise that will be fulfilled when any of th
-   *     passed in promises are fulfilled.
-   */
-  Promise.any = function(var_args) {
-    var p = new Promise;
-    function f(v) {
-      p.value = v;
-    }
-    for (var i = 0; i < arguments.length; i++) {
-      arguments[i].addListener(f);
-    }
-    return p;
-  };
-
-  /**
-   * Wraps an event in a future promise.
-   * @param {!EventTarget} target The object that dispatches the event.
-   * @param {string} type The type of the event.
-   * @param {boolean=} opt_useCapture Whether to listen to the capture phase or
-   *     the bubble phase.
-   * @return {!Promise} The promise that will be fulfilled when the event is
-   *     dispatched.
-   */
-  Promise.event = function(target, type, opt_useCapture) {
-    var p = new Promise;
-    target.addEventListener(type, function(e) {
-      p.value = e;
-    }, opt_useCapture);
-    return p;
-  };
-
-  return {
-    Promise: Promise
-  };
-})();
diff --git a/resources/bookmark_manager/js/cr/ui.js b/resources/bookmark_manager/js/cr/ui.js
deleted file mode 100644
index d87c04a..0000000
--- a/resources/bookmark_manager/js/cr/ui.js
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-
-  /**
-   * Decorates elements as an instance of a class.
-   * @param {string|!Element} source The way to find the element(s) to decorate.
-   *     If this is a string then {@code querySeletorAll} is used to find the
-   *     elements to decorate.
-   * @param {!Function} constr The constructor to decorate with. The constr
-   *     needs to have a {@code decorate} function.
-   */
-  function decorate(source, constr) {
-    var elements;
-    if (typeof source == 'string')
-      elements = cr.doc.querySelectorAll(source);
-    else
-      elements = [source];
-
-    for (var i = 0, el; el = elements[i]; i++) {
-      if (!(el instanceof constr))
-        constr.decorate(el);
-    }
-  }
-
-  /**
-   * Helper function for creating new element for define.
-   */
-  function createElementHelper(tagName, opt_bag) {
-    // Allow passing in ownerDocument to create in a different document.
-    var doc;
-    if (opt_bag && opt_bag.ownerDocument)
-      doc = opt_bag.ownerDocument;
-    else
-      doc = cr.doc;
-    return doc.createElement(tagName);
-  }
-
-  /**
-   * Creates the constructor for a UI element class.
-   *
-   * Usage:
-   * <pre>
-   * var List = cr.ui.define('list');
-   * List.prototype = {
-   *   __proto__: HTMLUListElement.prototype,
-   *   decorate: function() {
-   *     ...
-   *   },
-   *   ...
-   * };
-   * </pre>
-   *
-   * @param {string|Function} tagNameOrFunction The tagName or
-   *     function to use for newly created elements. If this is a function it
-   *     needs to return a new element when called.
-   * @return {function(Object=):Element} The constructor function which takes
-   *     an optional property bag. The function also has a static
-   *     {@code decorate} method added to it.
-   */
-  function define(tagNameOrFunction) {
-    var createFunction, tagName;
-    if (typeof tagNameOrFunction == 'function') {
-      createFunction = tagNameOrFunction;
-      tagName = '';
-    } else {
-      createFunction = createElementHelper;
-      tagName = tagNameOrFunction;
-    }
-
-    /**
-     * Creates a new UI element constructor.
-     * @param {Object=} opt_propertyBag Optional bag of properties to set on the
-     *     object after created. The property {@code ownerDocument} is special
-     *     cased and it allows you to create the element in a different
-     *     document than the default.
-     * @constructor
-     */
-    function f(opt_propertyBag) {
-      var el = createFunction(tagName, opt_propertyBag);
-      f.decorate(el);
-      for (var propertyName in opt_propertyBag) {
-        el[propertyName] = opt_propertyBag[propertyName];
-      }
-      return el;
-    }
-
-    /**
-     * Decorates an element as a UI element class.
-     * @param {!Element} el The element to decorate.
-     */
-    f.decorate = function(el) {
-      el.__proto__ = f.prototype;
-      el.decorate();
-    };
-
-    return f;
-  }
-
-  /**
-   * Input elements do not grow and shrink with their content. This is a simple
-   * (and not very efficient) way of handling shrinking to content with support
-   * for min width and limited by the width of the parent element.
-   * @param {HTMLElement} el The element to limit the width for.
-   * @param {number} parentEl The parent element that should limit the size.
-   * @param {number} min The minimum width.
-   */
-  function limitInputWidth(el, parentEl, min) {
-    // Needs a size larger than borders
-    el.style.width = '10px';
-    var doc = el.ownerDocument;
-    var win = doc.defaultView;
-    var computedStyle = win.getComputedStyle(el);
-    var parentComputedStyle = win.getComputedStyle(parentEl);
-    var rtl = computedStyle.direction == 'rtl';
-
-    // To get the max width we get the width of the treeItem minus the position
-    // of the input.
-    var inputRect = el.getBoundingClientRect();  // box-sizing
-    var parentRect = parentEl.getBoundingClientRect();
-    var startPos = rtl ? parentRect.right - inputRect.right :
-        inputRect.left - parentRect.left;
-
-    // Add up border and padding of the input.
-    var inner = parseInt(computedStyle.borderLeftWidth, 10) +
-        parseInt(computedStyle.paddingLeft, 10) +
-        parseInt(computedStyle.paddingRight, 10) +
-        parseInt(computedStyle.borderRightWidth, 10);
-
-    // We also need to subtract the padding of parent to prevent it to overflow.
-    var parentPadding = rtl ? parseInt(parentComputedStyle.paddingLeft, 10) :
-        parseInt(parentComputedStyle.paddingRight, 10);
-
-    // The magic number 14 comes from trial and error :'( It consists of:
-    // border + padding + treeItem.paddingEnd + treeItem.borderEnd +
-    // tree.paddingEnd
-    var max = parentEl.clientWidth - startPos - inner - parentPadding;
-
-    var pcs = getComputedStyle(parentEl);
-    console.log('pcs', 'borderLeft', pcs.borderLeftWidth,
-                'paddingLeft', pcs.paddingLeft,
-                'paddingRight', pcs.paddingRight,
-                'borderRight', pcs.borderRightWidth,
-                'width', pcs.width,
-                'clientWidth', parentEl.clientWidth,
-                'offsetWidth', parentEl.offsetWidth);
-
-    function limit() {
-      if (el.scrollWidth > max) {
-        el.style.width = max + 'px';
-      } else {
-        el.style.width = 0;
-        var sw = el.scrollWidth;
-        if (sw < min) {
-          el.style.width = min + 'px';
-        } else {
-          el.style.width = sw + 'px';
-        }
-      }
-    }
-
-    el.addEventListener('input', limit);
-    limit();
-  }
-
-  return {
-    decorate: decorate,
-    define: define,
-    limitInputWidth: limitInputWidth
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/command.js b/resources/bookmark_manager/js/cr/ui/command.js
deleted file mode 100644
index d1a0677..0000000
--- a/resources/bookmark_manager/js/cr/ui/command.js
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * @fileoverview A command is an abstraction of an action a user can do in the
- * UI.
- *
- * When the focus changes in the document for each command a canExecute event
- * is dispatched on the active element. By listening to this event you can
- * enable and disable the command by setting the event.canExecute property.
- *
- * When a command is executed a command event is dispatched on the active
- * element. Note that you should stop the propagation after you have handled the
- * command if there might be other command listeners higher up in the DOM tree.
- */
-
-cr.define('cr.ui', function() {
-
-  /**
-   * Creates a new command element.
-   * @constructor
-   * @extends {HTMLElement}
-   */
-  var Command = cr.ui.define('command');
-
-  Command.prototype = {
-    __proto__: HTMLElement.prototype,
-
-    /**
-     * Initializes the command.
-     */
-    decorate: function() {
-      CommandManager.init(this.ownerDocument);
-    },
-
-    /**
-     * Executes the command. This dispatches a command event on the active
-     * element. If the command is {@code disabled} this does nothing.
-     */
-    execute: function() {
-      if (this.disabled)
-        return;
-      var doc = this.ownerDocument;
-      if (doc.activeElement) {
-        var e = new cr.Event('command', true, false);
-        e.command = this;
-        doc.activeElement.dispatchEvent(e);
-      }
-    },
-
-    /**
-     * Call this when there have been changes that might change whether the
-     * command can be executed or not.
-     */
-    canExecuteChange: function() {
-      dispatchCanExecuteEvent(this, this.ownerDocument.activeElement);
-    },
-
-    /**
-     * The keyboard shortcut that triggers the command. This is a string
-     * consisting of a keyIdentifier (as reported by WebKit in keydown) as
-     * well as optional key modifiers joinded with a '-'.
-     * For example:
-     *   "F1"
-     *   "U+0008-Meta" for Apple command backspace.
-     *   "U+0041-Ctrl" for Control A
-     *
-     * @type {string}
-     */
-    shortcut_: null,
-    get shortcut() {
-      return this.shortcut_;
-    },
-    set shortcut(shortcut) {
-      var oldShortcut = this.shortcut_;
-      if (shortcut !== oldShortcut) {
-        this.shortcut_ = shortcut;
-
-        // TODO(arv): Multiple shortcuts?
-
-        var mods = {};
-        var ident = '';
-        shortcut.split('-').forEach(function(part) {
-          var partLc = part.toLowerCase();
-          switch (partLc) {
-            case 'alt':
-            case 'ctrl':
-            case 'meta':
-            case 'shift':
-              mods[partLc + 'Key'] = true;
-              break;
-            default:
-              if (ident)
-                throw Error('Multiple keyboard shortcuts are not supported');
-              ident = part;
-          }
-
-          this.keyIdentifier_ = ident;
-          this.keyModifiers_ = mods;
-        }, this);
-
-        cr.dispatchPropertyChange(this, 'shortcut', this.shortcut_,
-                                  oldShortcut);
-      }
-    },
-
-    /**
-     * Whether the event object matches the shortcut for this command.
-     * @param {!Event} e The key event object.
-     * @return {boolean} Whether it matched or not.
-     */
-    matchesEvent: function(e) {
-      if (!this.keyIdentifier_)
-        return false;
-
-      if (e.keyIdentifier == this.keyIdentifier_) {
-        // All keyboard modifiers needs to match.
-        var mods = this.keyModifiers_;
-        return ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].every(function(k) {
-          return e[k] == !!mods[k];
-        });
-      }
-      return false;
-    }
-  };
-
-  /**
-   * The label of the command.
-   * @type {string}
-   */
-  cr.defineProperty(Command, 'label', cr.PropertyKind.ATTR);
-
-  /**
-   * Whether the command is disabled or not.
-   * @type {boolean}
-   */
-  cr.defineProperty(Command, 'disabled', cr.PropertyKind.BOOL_ATTR);
-
-  /**
-   * Whether the command is hidden or not.
-   * @type {boolean}
-   */
-  cr.defineProperty(Command, 'hidden', cr.PropertyKind.BOOL_ATTR);
-
-  /**
-   * Dispatches a canExecute event on the target.
-   * @param {cr.ui.Command} command The command that we are testing for.
-   * @param {Element} target The target element to dispatch the event on.
-   */
-  function dispatchCanExecuteEvent(command, target) {
-    var e = new CanExecuteEvent(command, true)
-    target.dispatchEvent(e);
-    command.disabled = !e.canExecute;
-  }
-
-  /**
-   * The command managers for different documents.
-   */
-  var commandManagers = {};
-
-  /**
-   * Keeps track of the focused element and updates the commands when the focus
-   * changes.
-   * @param {!Document} doc The document that we are managing the commands for.
-   * @constructor
-   */
-  function CommandManager(doc) {
-    doc.addEventListener('focus', cr.bind(this.handleFocus_, this), true);
-    doc.addEventListener('keydown', cr.bind(this.handleKeyDown_, this), true);
-  }
-
-  /**
-   * Initializes a command manager for the document as needed.
-   * @param {!Document} doc The document to manage the commands for.
-   */
-  CommandManager.init = function(doc) {
-    var uid = cr.getUid(doc);
-    if (!(uid in commandManagers)) {
-      commandManagers[uid] = new CommandManager(doc);
-    }
-  },
-
-  CommandManager.prototype = {
-
-    /**
-     * Handles focus changes on the document.
-     * @param {Event} e The focus event object.
-     * @private
-     */
-    handleFocus_: function(e) {
-      var target = e.target;
-      var commands = Array.prototype.slice.call(
-          target.ownerDocument.querySelectorAll('command'));
-
-      commands.forEach(function(command) {
-        dispatchCanExecuteEvent(command, target);
-      });
-    },
-
-    /**
-     * Handles the keydown event and routes it to the right command.
-     * @param {!Event} e The keydown event.
-     */
-    handleKeyDown_: function(e) {
-      var target = e.target;
-      var commands = Array.prototype.slice.call(
-          target.ownerDocument.querySelectorAll('command'));
-
-      for (var i = 0, command; command = commands[i]; i++) {
-        if (!command.disabled && command.matchesEvent(e)) {
-          e.preventDefault();
-          // We do not want any other element to handle this.
-          e.stopPropagation();
-
-          command.execute();
-          return;
-        }
-      }
-    }
-  };
-
-  /**
-   * The event type used for canExecute events.
-   * @param {!cr.ui.Command} command The command that we are evaluating.
-   * @extends {Event}
-   */
-  function CanExecuteEvent(command) {
-    var e = command.ownerDocument.createEvent('Event');
-    e.initEvent('canExecute', true, false);
-    e.__proto__ = CanExecuteEvent.prototype;
-    e.command = command;
-    return e;
-  }
-
-  CanExecuteEvent.prototype = {
-    __proto__: Event.prototype,
-
-    /**
-     * The current command
-     * @type {cr.ui.Command}
-     */
-    command: null,
-
-    /**
-     * Whether the target can execute the command. Setting this also stops the
-     * propagation.
-     * @type {boolean}
-     */
-    canExecute_: false,
-    get canExecute() {
-      return this.canExecute_;
-    },
-    set canExecute(canExecute) {
-      this.canExecute_ = canExecute;
-      this.stopPropagation();
-    }
-  };
-
-  // Export
-  return {
-    Command: Command,
-    CanExecuteEvent: CanExecuteEvent
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/contextmenuhandler.js b/resources/bookmark_manager/js/cr/ui/contextmenuhandler.js
deleted file mode 100644
index 5ac0789..0000000
--- a/resources/bookmark_manager/js/cr/ui/contextmenuhandler.js
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-
-  /**
-   * Handles context menus.
-   * @constructor
-   */
-  function ContextMenuHandler() {}
-
-  ContextMenuHandler.prototype = {
-
-    /**
-     * The menu that we are currently showing.
-     * @type {cr.ui.Menu}
-     */
-    menu_: null,
-    get menu() {
-      return this.menu_;
-    },
-
-    /**
-     * Shows a menu as a context menu.
-     * @param {!Event} e The event triggering the show (usally a contextmenu
-     *     event).
-     * @param {!cr.ui.Menu} menu The menu to show.
-     */
-    showMenu: function(e, menu) {
-      this.menu_ = menu;
-
-      menu.style.display = 'block';
-      // when the menu is shown we steal all keyboard events.
-      menu.ownerDocument.addEventListener('keydown', this, true);
-      menu.ownerDocument.addEventListener('mousedown', this, true);
-      menu.ownerDocument.addEventListener('blur', this, true);
-      menu.addEventListener('activate', this);
-      this.positionMenu_(e, menu);
-    },
-
-    /**
-     * Hide the currently shown menu.
-     */
-    hideMenu: function() {
-      var menu = this.menu;
-      if (!menu)
-        return;
-
-      menu.style.display = 'none';
-      menu.ownerDocument.removeEventListener('keydown', this, true);
-      menu.ownerDocument.removeEventListener('mousedown', this, true);
-      menu.ownerDocument.removeEventListener('blur', this, true);
-      menu.removeEventListener('activate', this);
-      menu.selectedIndex = -1;
-      this.menu_ = null;
-
-      // On windows we might hide the menu in a right mouse button up and if
-      // that is the case we wait some short period before we allow the menu
-      // to be shown again.
-      this.hideTimestamp_ = Date.now();
-    },
-
-    /**
-     * Positions the menu
-     * @param {!Event} e The event object triggering the showing.
-     * @param {!cr.ui.Menu} menu The menu to position.
-     * @private
-     */
-    positionMenu_: function(e, menu) {
-      // TODO(arv): Handle scrolled documents when needed.
-
-      var x, y;
-      // When the user presses the context menu key (on the keyboard) we need
-      // to detect this.
-      if (e.screenX == 0 && e.screenY == 0) {
-        var rect = e.currentTarget.getBoundingClientRect();
-        x = rect.left;
-        y = rect.top;
-      } else {
-        x = e.clientX;
-        y = e.clientY;
-      }
-
-      var menuRect = menu.getBoundingClientRect();
-      var bodyRect = menu.ownerDocument.body.getBoundingClientRect();
-
-      // Does menu fit below?
-      if (y + menuRect.height > bodyRect.height) {
-        // Does menu fit above?
-        if (y - menuRect.height >= 0) {
-          y -= menuRect.height;
-        } else {
-          // Menu did not fit above nor below.
-          y = 0;
-          // We could resize the menu here but lets not worry about that at this
-          // point.
-        }
-      }
-
-      // Does menu fit to the right?
-      if (x + menuRect.width > bodyRect.width) {
-        // Does menu fit to the left?
-        if (x - menuRect.width >= 0) {
-          x -= menuRect.width;
-        } else {
-          // Menu did not fit to the right nor to the left.
-          x = 0;
-          // We could resize the menu here but lets not worry about that at this
-          // point.
-        }
-      }
-
-      menu.style.left = x + 'px';
-      menu.style.top = y + 'px';
-    },
-
-    /**
-     * Handles event callbacks.
-     * @param {!Event} e The event object.
-     */
-    handleEvent: function(e) {
-      // Context menu is handled even when we have no menu.
-      if (e.type != 'contextmenu' && !this.menu)
-        return;
-
-      switch (e.type) {
-        case 'mousedown':
-          if (!this.menu.contains(e.target))
-            this.hideMenu();
-          else
-            e.preventDefault();
-          break;
-        case 'keydown':
-          // keyIdentifier does not report 'Esc' correctly
-          if (e.keyCode == 27 /* Esc */) {
-            this.hideMenu();
-
-          // If the menu is visible we let it handle all the keyboard events.
-          } else if (this.menu) {
-            this.menu.handleKeyDown(e);
-            e.preventDefault();
-            e.stopPropagation();
-          }
-          break;
-
-        case 'activate':
-        case 'blur':
-          this.hideMenu();
-          break;
-
-        case 'contextmenu':
-          if ((!this.menu || !this.menu.contains(e.target)) &&
-              (!this.hideTimestamp_ || Date.now() - this.hideTimestamp_ > 50))
-            this.showMenu(e, e.currentTarget.contextMenu);
-          e.preventDefault();
-          // Don't allow elements further up in the DOM to show their menus.
-          e.stopPropagation();
-          break;
-      }
-    },
-
-    /**
-     * Adds a contextMenu property to an element or element class.
-     * @param {!Element|!Function} element The element or class to add the
-     *     contextMenu property to.
-     */
-    addContextMenuProperty: function(element) {
-      if (typeof element == 'function')
-        element = element.prototype;
-
-      element.__defineGetter__('contextMenu', function() {
-        return this.contextMenu_;
-      });
-      element.__defineSetter__('contextMenu', function(menu) {
-        var oldContextMenu = this.contextMenu;
-
-        if (typeof menu == 'string' && menu[0] == '#') {
-          menu = this.ownerDocument.getElementById(menu.slice(1));
-          cr.ui.decorate(menu, Menu);
-        }
-
-        if (menu === oldContextMenu)
-          return;
-
-        if (oldContextMenu && !menu)
-          this.removeEventListener('contextmenu', contextMenuHandler);
-        if (menu && !oldContextMenu)
-          this.addEventListener('contextmenu', contextMenuHandler);
-
-        this.contextMenu_ = menu;
-
-        if (menu && menu.id)
-          this.setAttribute('contextmenu', '#' + menu.id);
-
-        cr.dispatchPropertyChange(this, 'contextMenu', menu, oldContextMenu);
-      });
-    }
-  };
-
-  /**
-   * The singleton context menu handler.
-   * @type {!ContextMenuHandler}
-   */
-  var contextMenuHandler = new ContextMenuHandler;
-
-  // Export
-  return {
-    contextMenuHandler: contextMenuHandler
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/list.js b/resources/bookmark_manager/js/cr/ui/list.js
deleted file mode 100644
index 9bdcd38..0000000
--- a/resources/bookmark_manager/js/cr/ui/list.js
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// require: listselectionmodel.js
-
-/**
- * @fileoverview This implements a list control.
- */
-
-cr.define('cr.ui', function() {
-  const ListSelectionModel = cr.ui.ListSelectionModel;
-
-  /**
-   * Creates a new list element.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLUListElement}
-   */
-  var List = cr.ui.define('list');
-
-  List.prototype = {
-    __proto__: HTMLUListElement.prototype,
-
-    /**
-     * The selection model to use.
-     * @type {cr.ui.ListSelectionModel}
-     */
-    get selectionModel() {
-      return this.selectionModel_;
-    },
-    set selectionModel(sm) {
-      var oldSm = this.selectionModel_;
-      if (oldSm == sm)
-        return;
-
-      if (!this.boundHandleOnChange_) {
-        this.boundHandleOnChange_ = cr.bind(this.handleOnChange_, this);
-        this.boundHandleLeadChange_ = cr.bind(this.handleLeadChange_, this);
-      }
-
-      if (oldSm) {
-        oldSm.removeEventListener('change', this.boundHandleOnChange_);
-        oldSm.removeEventListener('leadItemChange', this.boundHandleLeadChange_);
-      }
-
-      this.selectionModel_ = sm;
-
-      if (sm) {
-        sm.addEventListener('change', this.boundHandleOnChange_);
-        sm.addEventListener('leadItemChange', this.boundHandleLeadChange_);
-      }
-    },
-
-    /**
-     * Convenience alias for selectionModel.selectedItem
-     * @type {cr.ui.ListItem}
-     */
-    get selectedItem() {
-      return this.selectionModel.selectedItem;
-    },
-    set selectedItem(selectedItem) {
-      this.selectionModel.selectedItem = selectedItem;
-    },
-
-    /**
-     * Convenience alias for selectionModel.selectedItems
-     * @type {!Array<cr.ui.ListItem>}
-     */
-    get selectedItems() {
-      return this.selectionModel.selectedItems;
-    },
-
-    /**
-     * The HTML elements representing the items. This is just all the element
-     * children but subclasses may override this to filter out certain elements.
-     * @type {HTMLCollection}
-     */
-    get items() {
-      return this.children;
-    },
-
-    add: function(listItem) {
-      this.appendChild(listItem);
-
-      var uid = cr.getUid(listItem);
-      this.uidToListItem_[uid] = listItem;
-
-      this.selectionModel.add(listItem);
-    },
-
-    addAt: function(listItem, index) {
-      this.insertBefore(listItem, this.items[index]);
-
-      var uid = cr.getUid(listItem);
-      this.uidToListItem_[uid] = listItem;
-
-      this.selectionModel.add(listItem);
-    },
-
-    remove: function(listItem) {
-      this.selectionModel.remove(listItem);
-
-      this.removeChild(listItem);
-
-      var uid = cr.getUid(listItem);
-      delete this.uidToListItem_[uid];
-    },
-
-    clear: function() {
-      this.innerHTML = '';
-      this.selectionModel.clear();
-    },
-
-    /**
-     * Initializes the element.
-     */
-    decorate: function() {
-      this.uidToListItem_ = {};
-
-      this.selectionModel = new ListSelectionModel(this);
-
-      this.addEventListener('mousedown', this.handleMouseDownUp_);
-      this.addEventListener('mouseup', this.handleMouseDownUp_);
-      this.addEventListener('keydown', this.handleKeyDown);
-      this.addEventListener('dblclick', this.handleDoubleClick_);
-
-      // Make list focusable
-      if (!this.hasAttribute('tabindex'))
-        this.tabIndex = 0;
-    },
-
-    /**
-     * Callback for mousedown and mouseup events.
-     * @param {Event} e The mouse event object.
-     * @private
-     */
-    handleMouseDownUp_: function(e) {
-      var target = e.target;
-      while (target && target.parentNode != this) {
-        target = target.parentNode;
-      }
-      this.selectionModel.handleMouseDownUp(e, target);
-    },
-
-    /**
-     * Callback for mousedown events.
-     * @param {Event} e The mouse event object.
-     * @private
-     */
-    handleMouseUp_: function(e) {
-      var target = e.target;
-      while (target && target.parentNode != this) {
-        target = target.parentNode;
-      }
-      if (target) {
-        this.selectionModel.handleMouseDown(e, target);
-      } else {
-        this.selectionModel.clear();
-      }
-    },
-
-
-    /**
-     * Handle a keydown event.
-     * @param {Event} e The keydown event.
-     * @return {boolean} Whether the key event was handled.
-     */
-    handleKeyDown: function(e) {
-      if (this.selectionModel.handleKeyDown(e))
-        return true;
-      if (e.keyIdentifier == 'Enter' && this.selectionModel.selectedItem) {
-        cr.dispatchSimpleEvent(this, 'activate');
-        return true;
-      }
-      return false;
-    },
-
-    /**
-     * Handler for double clicking. When the user double clicks on a selected
-     * item we dispatch an {@code activate} event.
-     * @param {Event} e The mouse event object.
-     * @private
-     */
-    handleDoubleClick_: function(e) {
-      if (e.button == 0 && this.selectionModel.selectedItem) {
-        cr.dispatchSimpleEvent(this, 'activate');
-      }
-    },
-
-    /**
-     * Callback from the selection model. We dispatch {@code change} events
-     * when the selection changes.
-     * @param {!cr.Event} e Event with change info.
-     * @private
-     */
-    handleOnChange_: function(ce) {
-      ce.changes.forEach(function(change) {
-        var listItem = this.uidToListItem_[change.uid];
-        listItem.selected = change.selected;
-      }, this);
-
-      cr.dispatchSimpleEvent(this, 'change');
-    },
-
-    /**
-     * Handles a change of the lead item from the selection model.
-     * @property {Event} pe The property change event.
-     * @private
-     */
-    handleLeadChange_: function(pe) {
-      if (pe.oldValue) {
-        pe.oldValue.lead = false;
-      }
-      if (pe.newValue) {
-        pe.newValue.lead = true;
-      }
-    },
-
-    /**
-     * Gets a unique ID for an item. This needs to be unique to the list but
-     * does not have to be gloabally unique. This uses {@code cr.getUid} by
-     * default. Override to provide a more efficient way to get the unique ID.
-     * @param {cr.ui.ListItem} item The item to get the unique ID for.
-     * @return
-     */
-    itemToUid: function(item) {
-      return cr.getUid(item);
-    }
-  };
-
-  return {
-    List: List
-  }
-});
diff --git a/resources/bookmark_manager/js/cr/ui/listitem.js b/resources/bookmark_manager/js/cr/ui/listitem.js
deleted file mode 100644
index 0cd8826..0000000
--- a/resources/bookmark_manager/js/cr/ui/listitem.js
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-
-  /**
-   * Creates a new list item element.
-   * @param {string} opt_label The text label for the item.
-   * @constructor
-   * @extends {HTMLLIElement}
-   */
-  var ListItem = cr.ui.define('li');
-
-  ListItem.prototype = {
-    __proto__: HTMLLIElement.prototype,
-
-    /**
-     * Plain text label.
-     * @type {string}
-     */
-    get label() {
-      return this.textContent;
-    },
-    set label(label) {
-      this.textContent = label;
-    },
-
-    /**
-     * Whether the item is the lead in a selection. Setting this does not update
-     * the underlying selection model. This is only used for display purpose.
-     * @type {boolean}
-     */
-    get lead() {
-      return this.hasAttribute('lead');
-    },
-    set lead(lead) {
-      if (lead) {
-        this.setAttribute('lead', '');
-        this.scrollIntoViewIfNeeded(false);
-      } else {
-        this.removeAttribute('lead');
-      }
-    },
-
-    /**
-     * Called when an element is decorated as a list item.
-     */
-    decorate: function() {
-    }
-  };
-
-  cr.defineProperty(ListItem, 'selected', cr.PropertyKind.BOOL_ATTR);
-
-  return {
-    ListItem: ListItem
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/listselectionmodel.js b/resources/bookmark_manager/js/cr/ui/listselectionmodel.js
deleted file mode 100644
index 385c80f..0000000
--- a/resources/bookmark_manager/js/cr/ui/listselectionmodel.js
+++ /dev/null
@@ -1,442 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-  const Event = cr.Event;
-  const EventTarget = cr.EventTarget;
-
-  /**
-   * Creates a new selection model that is to be used with lists. This is
-   * implemented for vertical lists but changing the behavior for horizontal
-   * lists or icon views is a matter of overriding {@code getItemBefore},
-   * {@code getItemAfter}, {@code getItemAbove} as well as {@code getItemBelow}.
-   *
-   * @constructor
-   * @extends {!cr.EventTarget}
-   */
-  function ListSelectionModel(list) {
-    this.list = list;
-    this.selectedItems_ = {};
-  }
-
-  ListSelectionModel.prototype = {
-    __proto__: EventTarget.prototype,
-
-    /**
-     * Returns the item below (y axis) the given element.
-     * @param {*} item The item to get the item below.
-     * @return {*} The item below or null if not found.
-     */
-    getItemBelow: function(item) {
-      return item.nextElementSibling;
-    },
-
-    /**
-     * Returns the item above (y axis) the given element.
-     * @param {*} item The item to get the item above.
-     * @return {*} The item below or null if not found.
-     */
-    getItemAbove: function(item) {
-      return item.previousElementSibling;
-    },
-
-    /**
-     * Returns the item before (x axis) the given element. This returns null
-     * by default but override this for icon view and horizontal selection
-     * models.
-     *
-     * @param {*} item The item to get the item before.
-     * @return {*} The item before or null if not found.
-     */
-    getItemBefore: function(item) {
-      return null;
-    },
-
-    /**
-     * Returns the item after (x axis) the given element. This returns null
-     * by default but override this for icon view and horizontal selection
-     * models.
-     *
-     * @param {*} item The item to get the item after.
-     * @return {*} The item after or null if not found.
-     */
-    getItemAfter: function(item) {
-      return null;
-    },
-
-    /**
-     * Returns the next list item. This is the next logical and should not
-     * depend on any kind of layout of the list.
-     * @param {*} item The item to get the next item for.
-     * @return {*} The next item or null if not found.
-     */
-    getNextItem: function(item) {
-      return item.nextElementSibling;
-    },
-
-    /**
-     * Returns the prevous list item. This is the previous logical and should
-     * not depend on any kind of layout of the list.
-     * @param {*} item The item to get the previous item for.
-     * @return {*} The previous item or null if not found.
-     */
-    getPreviousItem: function(item) {
-      return item.previousElementSibling;
-    },
-
-    /**
-     * @return {*} The first item.
-     */
-    getFirstItem: function() {
-      return this.list.firstElementChild;
-    },
-
-    /**
-     * @return {*} The last item.
-     */
-    getLastItem: function() {
-      return this.list.lastElementChild;
-    },
-
-    /**
-     * Called by the view when the user does a mousedown or mouseup on the list.
-     * @param {!Event} e The browser mousedown event.
-     * @param {*} item The item that was under the mouse pointer, null if none.
-     */
-    handleMouseDownUp: function(e, item) {
-      var anchorItem = this.anchorItem;
-
-      this.beginChange_();
-
-      if (!item && !e.ctrlKey && !e.shiftKey && !e.metaKey) {
-        this.clear();
-      } else {
-        var isDown = e.type == 'mousedown';
-        if (!cr.isMac && e.ctrlKey) {
-          // Handle ctrlKey on mouseup
-          if (!isDown) {
-            // toggle the current one and make it anchor item
-            this.setItemSelected(item, !this.getItemSelected(item));
-            this.leadItem = item;
-            this.anchorItem = item;
-          }
-        } else if (e.shiftKey && anchorItem && anchorItem != item) {
-          // Shift is done in mousedown
-          if (isDown) {
-            this.clearAllSelected_();
-            this.leadItem = item;
-            this.selectRange(anchorItem, item);
-          }
-        } else {
-          // Right click for a context menu need to not clear the selection.
-          var isRightClick = e.button == 2;
-
-          // If the item is selected this is handled in mouseup.
-          var itemSelected = this.getItemSelected(item);
-          if ((itemSelected && !isDown || !itemSelected && isDown) &&
-              !(itemSelected && isRightClick)) {
-            this.clearAllSelected_();
-            this.setItemSelected(item, true);
-            this.leadItem = item;
-            this.anchorItem = item;
-          }
-        }
-      }
-
-      this.endChange_();
-    },
-
-    /**
-     * Called by the view when it recieves a keydown event.
-     * @param {Event} e The keydown event.
-     */
-    handleKeyDown: function(e) {
-      var newItem = null;
-      var leadItem = this.leadItem;
-      var prevent = true;
-
-      // Ctrl/Meta+A
-      if (e.keyCode == 65 &&
-          (cr.isMac && e.metaKey || !cr.isMac && e.ctrlKey)) {
-        this.selectAll();
-        e.preventDefault();
-        return;
-      }
-
-      // Space
-      if (e.keyCode == 32) {
-        if (leadItem != null) {
-          var selected = this.getItemSelected(leadItem);
-          if (e.ctrlKey || !selected) {
-            this.beginChange_();
-            this.setItemSelected(leadItem, !selected);
-            this.endChange_();
-            return;
-          }
-        }
-      }
-
-      switch (e.keyIdentifier) {
-        case 'Home':
-          newItem = this.getFirstItem();
-          break;
-        case 'End':
-          newItem = this.getLastItem();
-          break;
-        case 'Up':
-          newItem = !leadItem  ?
-              this.getLastItem() : this.getItemAbove(leadItem);
-          break;
-        case 'Down':
-          newItem = !leadItem ?
-              this.getFirstItem() : this.getItemBelow(leadItem);
-          break;
-        case 'Left':
-          newItem = !leadItem ?
-              this.getLastItem() : this.getItemBefore(leadItem);
-          break;
-        case 'Right':
-          newItem = !leadItem ?
-              this.getFirstItem() : this.getItemAfter(leadItem);
-          break;
-        default:
-          prevent = false;
-      }
-
-      if (newItem) {
-        this.beginChange_();
-
-        this.leadItem = newItem;
-        if (e.shiftKey) {
-          var anchorItem = this.anchorItem;
-          this.clearAllSelected_();
-          if (!anchorItem) {
-            this.setItemSelected(newItem, true);
-            this.anchorItem = newItem;
-          } else {
-            this.selectRange(anchorItem, newItem);
-          }
-        } else if (e.ctrlKey && !cr.isMac) {
-          // Setting the lead item is done above
-          // Mac does not allow you to change the lead.
-        } else {
-          this.clearAllSelected_();
-          this.setItemSelected(newItem, true);
-          this.anchorItem = newItem;
-        }
-
-        this.endChange_();
-
-        if (prevent)
-          e.preventDefault();
-      }
-    },
-
-    /**
-     * @type {!Array} The selected items.
-     */
-    get selectedItems() {
-      return Object.keys(this.selectedItems_).map(function(uid) {
-        return this.selectedItems_[uid];
-      }, this);
-    },
-    set selectedItems(selectedItems) {
-      this.beginChange_();
-      this.clearAllSelected_();
-      for (var i = 0; i < selectedItems.length; i++) {
-        this.setItemSelected(selectedItems[i], true);
-      }
-      this.leadItem = this.anchorItem = selectedItems[0] || null;
-      this.endChange_();
-    },
-
-    /**
-     * Convenience getter which returns the first selected item.
-     * @type {*}
-     */
-    get selectedItem() {
-      for (var uid in this.selectedItems_) {
-        return this.selectedItems_[uid];
-      }
-      return null;
-    },
-    set selectedItem(selectedItem) {
-      this.beginChange_();
-      this.clearAllSelected_();
-      if (selectedItem) {
-        this.selectedItems = [selectedItem];
-      } else {
-        this.leadItem = this.anchorItem = null;
-      }
-      this.endChange_();
-    },
-
-    /**
-     * Selects a range of items, starting with {@code start} and ends with
-     * {@code end}.
-     * @param {*} start The first item to select.
-     * @param {*} end The last item to select.
-     */
-    selectRange: function(start, end) {
-      // Swap if starts comes after end.
-      if (start.compareDocumentPosition(end) & Node.DOCUMENT_POSITION_PRECEDING) {
-        var tmp = start;
-        start = end;
-        end = tmp;
-      }
-
-      this.beginChange_();
-
-      for (var item = start; item != end; item = this.getNextItem(item)) {
-        this.setItemSelected(item, true);
-      }
-      this.setItemSelected(end, true);
-
-      this.endChange_();
-    },
-
-    /**
-     * Selects all items.
-     */
-    selectAll: function() {
-      this.selectRange(this.getFirstItem(), this.getLastItem());
-    },
-
-    /**
-     * Clears the selection
-     */
-    clear: function() {
-      this.beginChange_();
-      this.clearAllSelected_();
-      this.endChange_();
-    },
-
-    /**
-     * Clears the selection and updates the view.
-     * @private
-     */
-    clearAllSelected_: function() {
-      for (var uid in this.selectedItems_) {
-        this.setItemSelected(this.selectedItems_[uid], false);
-      }
-    },
-
-    /**
-     * Sets the selecte state for an item.
-     * @param {*} item The item to set the selected state for.
-     * @param {boolean} b Whether to select the item or not.
-     */
-    setItemSelected: function(item, b) {
-      var uid = this.list.itemToUid(item);
-      var oldSelected = uid in this.selectedItems_;
-      if (oldSelected == b)
-        return;
-
-      if (b)
-        this.selectedItems_[uid] = item;
-      else
-        delete this.selectedItems_[uid];
-
-      this.beginChange_();
-
-      // Changing back?
-      if (uid in this.changedUids_ && this.changedUids_[uid] == !b) {
-        delete this.changedUids_[uid];
-      } else {
-        this.changedUids_[uid] = b;
-      }
-
-      // End change dispatches an event which in turn may update the view.
-      this.endChange_();
-    },
-
-    /**
-     * Whether a given item is selected or not.
-     * @param {*} item The item to check.
-     * @return {boolean} Whether an item is selected.
-     */
-    getItemSelected: function(item) {
-      var uid = this.list.itemToUid(item);
-      return uid in this.selectedItems_;
-    },
-
-    /**
-     * This is used to begin batching changes. Call {@code endChange_} when you
-     * are done making changes.
-     * @private
-     */
-    beginChange_: function() {
-      if (!this.changeCount_) {
-        this.changeCount_ = 0;
-        this.changedUids_ = {};
-      }
-      this.changeCount_++;
-    },
-
-    /**
-     * Call this after changes are done and it will dispatch a change event if
-     * any changes were actually done.
-     * @private
-     */
-    endChange_: function() {
-      this.changeCount_--;
-      if (!this.changeCount_) {
-        var uids = Object.keys(this.changedUids_);
-        if (uids.length) {
-          var e = new Event('change');
-          e.changes = uids.map(function(uid) {
-            return {
-              uid: uid,
-              selected: this.changedUids_[uid]
-            };
-          }, this);
-          this.dispatchEvent(e);
-        }
-        delete this.changedUids_;
-        delete this.changeCount_;
-      }
-    },
-
-    /**
-     * Called when an item is removed from the lisst.
-     * @param {cr.ui.ListItem} item The list item that was removed.
-     */
-    remove: function(item) {
-      if (item == this.leadItem)
-        this.leadItem = this.getNextItem(item) || this.getPreviousItem(item);
-      if (item == this.anchorItem)
-        this.anchorItem = this.getNextItem(item) || this.getPreviousItem(item);
-
-      // Deselect when removing items.
-      if (this.getItemSelected(item))
-        this.setItemSelected(item, false);
-    },
-
-    /**
-     * Called when an item was added to the list.
-     * @param {cr.ui.ListItem} item The list item to add.
-     */
-    add: function(item) {
-      // We could (should?) check if the item is selected here and update the
-      // selection model.
-    }
-  };
-
-  /**
-   * The anchorItem is used with multiple selection.
-   * @type {*}
-   */
-  cr.defineProperty(ListSelectionModel, 'anchorItem', cr.PropertyKind.JS, null);
-
-  /**
-   * The leadItem is used with multiple selection and it is the item that the
-   * user is moving uysing the arrow keys.
-   * @type {*}
-   */
-  cr.defineProperty(ListSelectionModel, 'leadItem', cr.PropertyKind.JS, null);
-
-  return {
-    ListSelectionModel: ListSelectionModel
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/menu.js b/resources/bookmark_manager/js/cr/ui/menu.js
deleted file mode 100644
index 1145d0f..0000000
--- a/resources/bookmark_manager/js/cr/ui/menu.js
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-
-  const MenuItem = cr.ui.MenuItem;
-
-  /**
-   * Creates a new menu element.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLMenuElement}
-   */
-  var Menu = cr.ui.define('menu');
-
-  Menu.prototype = {
-    __proto__: HTMLMenuElement.prototype,
-
-    /**
-     * Initializes the menu element.
-     */
-    decorate: function() {
-      this.addEventListener('mouseover', this.handleMouseOver_);
-      this.addEventListener('mouseout', this.handleMouseOut_);
-
-      // Decorate the children as menu items.
-      var children = this.children;
-      for (var i = 0, child; child = children[i]; i++) {
-        cr.ui.decorate(child, MenuItem);
-      }
-    },
-
-    /**
-     * Walks up the ancestors until a menu item belonging to this menu is found.
-     * @param {Element} el
-     * @return {cr.ui.MenuItem} The found menu item or null.
-     * @private
-     */
-    findMenuItem_: function(el) {
-      while (el && el.parentNode != this) {
-        el = el.parentNode;
-      }
-      return el;
-    },
-
-    /**
-     * Handles mouseover events and selects the hovered item.
-     * @param {Event} e The mouseover event.
-     * @private
-     */
-    handleMouseOver_: function(e) {
-      var overItem = this.findMenuItem_(e.target);
-      this.selectedItem = overItem;
-    },
-
-    /**
-     * Handles mouseout events and deselects any selected item.
-     * @param {Event} e The mouseout event.
-     * @private
-     */
-    handleMouseOut_: function(e) {
-      this.selectedItem = null;
-    },
-
-    /**
-     * The index of the selected item.
-     * @type {boolean}
-     */
-    // getter and default value is defined using cr.defineProperty.
-    set selectedIndex(selectedIndex) {
-      if (this.selectedIndex_ != selectedIndex) {
-        var oldSelectedItem = this.selectedItem;
-        this.selectedIndex_ = selectedIndex;
-        if (oldSelectedItem)
-          oldSelectedItem.selected = false;
-        var item = this.selectedItem;
-        if (item)
-          item.selected = true;
-
-        cr.dispatchSimpleEvent(this, 'change');
-      }
-    },
-
-    /**
-     * The selected menu item or null if none.
-     * @type {cr.ui.MenuItem}
-     */
-    get selectedItem() {
-      return this.children[this.selectedIndex];
-    },
-    set selectedItem(item) {
-      var index = Array.prototype.indexOf.call(this.children, item);
-      this.selectedIndex = index;
-    },
-
-    /**
-     * This is the function that handles keyboard navigation. This is usually
-     * called by the element responsible for managing the menu.
-     * @param {Event} e The keydown event object.
-     * @return {boolean} Whether the event was handled be the menu.
-     */
-    handleKeyDown: function(e) {
-      var item = this.selectedItem;
-
-      var self = this;
-      function selectNextVisible(m) {
-        var children = self.children;
-        var len = children.length;
-        var i = self.selectedIndex;
-        if (i == -1 && m == -1) {
-          // Edge case when we need to go the last item fisrt.
-          i = 0;
-        }
-        while (true) {
-          i = (i + m + len) % len;
-          item = children[i];
-          if (item && !item.isSeparator() && !item.hidden)
-            break;
-        }
-        if (item)
-          self.selectedIndex = i;
-      }
-
-      switch (e.keyIdentifier) {
-        case 'Down':
-          selectNextVisible(1);
-          return true;
-        case 'Up':
-          selectNextVisible(-1);
-          return true;
-        case 'Enter':
-        case 'U+0020': // Space
-          if (item) {
-            if (cr.dispatchSimpleEvent(item, 'activate', true, true)) {
-              if (item.command)
-                item.command.execute();
-            }
-          }
-          return true;
-      }
-
-      return false;
-    }
-  };
-
-  /**
-   * The selected menu item.
-   * @type {number}
-   */
-  cr.defineProperty(Menu, 'selectedIndex', cr.PropertyKind.JS, -1);
-
-  // Export
-  return {
-    Menu: Menu
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/menubutton.js b/resources/bookmark_manager/js/cr/ui/menubutton.js
deleted file mode 100644
index 469cfd8..0000000
--- a/resources/bookmark_manager/js/cr/ui/menubutton.js
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-  const Menu = cr.ui.Menu;
-
-  /**
-   * Creates a new menu button element.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLButtonElement}
-   */
-  var MenuButton = cr.ui.define('button');
-
-  MenuButton.prototype = {
-    __proto__: HTMLButtonElement.prototype,
-
-    /**
-     * Initializes the menu button.
-     */
-    decorate: function() {
-      this.addEventListener('mousedown', this);
-      this.addEventListener('keydown', this);
-
-      var menu;
-      if ((menu = this.getAttribute('menu')))
-        this.menu = menu;
-    },
-
-    /**
-     * The menu associated with the menu button.
-     * @type {cr.ui.Menu}
-     */
-    get menu() {
-      return this.menu_;
-    },
-    set menu(menu) {
-      if (typeof menu == 'string' && menu[0] == '#') {
-        menu = this.ownerDocument.getElementById(menu.slice(1));
-        cr.ui.decorate(menu, Menu);
-      }
-
-      this.menu_ = menu;
-      if (menu) {
-        if (menu.id)
-          this.setAttribute('menu', '#' + menu.id);
-      }
-    },
-
-    /**
-     * Handles event callbacks.
-     * @param {Event} e The event object.
-     */
-    handleEvent: function(e) {
-      if (!this.menu)
-        return;
-
-      switch (e.type) {
-        case 'mousedown':
-          if (e.currentTarget == this.ownerDocument) {
-            if (!this.contains(e.target) && !this.menu.contains(e.target))
-              this.hideMenu();
-            else
-              e.preventDefault();
-          } else {
-            if (this.isMenuShown()) {
-              this.hideMenu();
-            } else {
-              this.showMenu();
-              // Prevent the button from stealing focus on mousedown.
-              e.preventDefault();
-            }
-          }
-          break;
-        case 'keydown':
-          this.handleKeyDown(e);
-          // If the menu is visible we let it handle all the keyboard events.
-          if (this.isMenuShown() && e.currentTarget == this.ownerDocument) {
-            this.menu.handleKeyDown(e);
-            e.preventDefault();
-            e.stopPropagation();
-          }
-          break;
-
-        case 'activate':
-        case 'blur':
-          this.hideMenu();
-          break;
-      }
-    },
-
-    /**
-     * Shows the menu.
-     */
-    showMenu: function() {
-      this.menu.style.display = 'block';
-      // when the menu is shown we steal all keyboard events.
-      this.ownerDocument.addEventListener('keydown', this, true);
-      this.ownerDocument.addEventListener('mousedown', this, true);
-      this.ownerDocument.addEventListener('blur', this, true);
-      this.menu.addEventListener('activate', this);
-      this.positionMenu_();
-    },
-
-    /**
-     * Hides the menu.
-     */
-    hideMenu: function() {
-      this.menu.style.display = 'none';
-      this.ownerDocument.removeEventListener('keydown', this, true);
-      this.ownerDocument.removeEventListener('mousedown', this, true);
-      this.ownerDocument.removeEventListener('blur', this, true);
-      this.menu.removeEventListener('activate', this);
-      this.menu.selectedIndex = -1;
-    },
-
-    /**
-     * Whether the menu is shown.
-     */
-    isMenuShown: function() {
-      return window.getComputedStyle(this.menu).display != 'none';
-    },
-
-    /**
-     * Positions the menu below the menu button. At this point we do not use any
-     * advanced positioning logic to ensure the menu fits in the viewport.
-     * @private
-     */
-    positionMenu_: function() {
-      var buttonRect = this.getBoundingClientRect();
-      this.menu.style.top = buttonRect.bottom + 'px';
-      if (getComputedStyle(this).direction == 'rtl') {
-        var menuRect = this.menu.getBoundingClientRect();
-        this.menu.style.left = buttonRect.right - menuRect.width + 'px';
-      } else {
-        this.menu.style.left = buttonRect.left + 'px';
-      }
-    },
-
-    /**
-     * Handles the keydown event for the menu button.
-     */
-    handleKeyDown: function(e) {
-      switch (e.keyIdentifier) {
-        case 'Down':
-        case 'Up':
-        case 'Enter':
-        case 'U+0020': // Space
-          if (!this.isMenuShown())
-            this.showMenu();
-          e.preventDefault();
-          break;
-        case 'Esc':
-        case 'U+001B': // Maybe this is remote desktop playing a prank?
-          this.hideMenu();
-          break;
-      }
-    }
-  };
-
-  // Export
-  return {
-    MenuButton: MenuButton
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/menuitem.js b/resources/bookmark_manager/js/cr/ui/menuitem.js
deleted file mode 100644
index 5c66f17..0000000
--- a/resources/bookmark_manager/js/cr/ui/menuitem.js
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-  const Command = cr.ui.Command;
-
-  /**
-   * Creates a new menu item element.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLButtonElement}
-   */
-  var MenuItem = cr.ui.define('button');
-
-  /**
-   * Creates a new menu separator element.
-   * @return {cr.ui.MenuItem}
-   */
-  MenuItem.createSeparator = function() {
-    var el = cr.doc.createElement('hr');
-    MenuItem.decorate(el);
-    return el;
-  };
-
-  MenuItem.prototype = {
-    __proto__: HTMLButtonElement.prototype,
-
-    /**
-     * Initializes the menu item.
-     */
-    decorate: function() {
-      var commandId;
-      if ((commandId = this.getAttribute('command')))
-        this.command = commandId;
-
-      this.addEventListener('mouseup', this.handleMouseUp_);
-    },
-
-    /**
-     * The command associated with this menu item. If this is set to a string
-     * of the form "#element-id" then the element is looked up in the document
-     * of the command.
-     * @type {cr.ui.Command}
-     */
-    command_: null,
-    get command() {
-      return this.command_;
-    },
-    set command(command) {
-      if (this.command_) {
-        this.command_.removeEventListener('labelChange', this);
-        this.command_.removeEventListener('disabledChange', this);
-        this.command_.removeEventListener('hiddenChange', this);
-      }
-
-      if (typeof command == 'string' && command[0] == '#') {
-        command = this.ownerDocument.getElementById(command.slice(1));
-        cr.ui.decorate(command, Command);
-      }
-
-      this.command_ = command;
-      if (command) {
-        if (command.id)
-          this.setAttribute('command', '#' + command.id);
-
-        this.label = command.label;
-        this.disabled = command.disabled;
-        this.hidden = command.hidden;
-
-        this.command_.addEventListener('labelChange', this);
-        this.command_.addEventListener('disabledChange', this);
-        this.command_.addEventListener('hiddenChange', this);
-      }
-    },
-
-    /**
-     * The text label.
-     * @type {string}
-     */
-    get label() {
-      return this.textContent;
-    },
-    set label(label) {
-      this.textContent = label;
-    },
-
-    /**
-     * @return {boolean} Whether the menu item is a separator.
-     */
-    isSeparator: function() {
-      return this.tagName == 'HR';
-    },
-
-    /**
-     * Handles mouseup events. This dispatches an active event and if there
-     * is an assiciated command then that is executed.
-     * @param {Event} The mouseup event object.
-     * @private
-     */
-    handleMouseUp_: function(e) {
-      if (!this.disabled && !this.isSeparator()) {
-        // Dispatch command event followed by executing the command object.
-        if (cr.dispatchSimpleEvent(this, 'activate', true, true)) {
-          var command = this.command;
-          if (command)
-            command.execute();
-        }
-      }
-    },
-
-    /**
-     * Handles changes to the associated command.
-     * @param {Event} e The event object.
-     */
-    handleEvent: function(e) {
-      switch (e.type) {
-        case 'disabledChange':
-          this.disabled = this.command.disabled;
-          break;
-        case 'hiddenChange':
-          this.hidden = this.command.hidden;
-          break;
-        case 'labelChange':
-          this.label = this.command.label;
-          break;
-      }
-    }
-  };
-
-  /**
-   * Whether the menu item is hidden or not.
-   * @type {boolean}
-   */
-  cr.defineProperty(MenuItem, 'hidden', cr.PropertyKind.BOOL_ATTR);
-
-  /**
-   * Whether the menu item is selected or not.
-   * @type {boolean}
-   */
-  cr.defineProperty(MenuItem, 'selected', cr.PropertyKind.BOOL_ATTR);
-
-  // Export
-  return {
-    MenuItem: MenuItem
-  };
-});
diff --git a/resources/bookmark_manager/js/cr/ui/tree.js b/resources/bookmark_manager/js/cr/ui/tree.js
deleted file mode 100644
index 6f7088f..0000000
--- a/resources/bookmark_manager/js/cr/ui/tree.js
+++ /dev/null
@@ -1,597 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-cr.define('cr.ui', function() {
-  // require cr.ui.define
-  // require cr.ui.limitInputWidth
-
-  /**
-   * Helper function that finds the first ancestor tree item.
-   * @param {!Element} el The element to start searching from.
-   * @return {cr.ui.TreeItem} The found tree item or null if not found.
-   */
-  function findTreeItem(el) {
-    while (el && !(el instanceof TreeItem)) {
-      el = el.parentNode;
-    }
-    return el;
-  }
-
-  /**
-   * Creates a new tree element.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLElement}
-   */
-  var Tree = cr.ui.define('tree');
-
-  Tree.prototype = {
-    __proto__: HTMLElement.prototype,
-
-    /**
-     * Initializes the element.
-     */
-    decorate: function() {
-      // Make list focusable
-      if (!this.hasAttribute('tabindex'))
-        this.tabIndex = 0;
-
-      this.addEventListener('click', this.handleClick);
-      this.addEventListener('mousedown', this.handleMouseDown);
-      this.addEventListener('dblclick', this.handleDblClick);
-      this.addEventListener('keydown', this.handleKeyDown);
-    },
-
-    /**
-     * Returns the tree item that are children of this tree.
-     */
-    get items() {
-      return this.children;
-    },
-
-    /**
-     * Adds a tree item to the tree.
-     * @param {!cr.ui.TreeItem} treeItem The item to add.
-     */
-    add: function(treeItem) {
-      this.appendChild(treeItem);
-    },
-
-    /**
-     * Adds a tree item at the given index.
-     * @param {!cr.ui.TreeItem} treeItem The item to add.
-     * @param {number} index The index where we want to add the item.
-     */
-    addAt: function(treeItem, index) {
-      this.insertBefore(treeItem, this.children[index]);
-    },
-
-    /**
-     * Removes a tree item child.
-     * @param {!cr.ui.TreeItem} treeItem The tree item to remove.
-     */
-    remove: function(treeItem) {
-      this.removeChild(treeItem);
-    },
-
-    /**
-     * Handles click events on the tree and forwards the event to the relevant
-     * tree items as necesary.
-     * @param {Event} e The click event object.
-     */
-    handleClick: function(e) {
-      var treeItem = findTreeItem(e.target);
-      if (treeItem)
-        treeItem.handleClick(e);
-    },
-
-    handleMouseDown: function(e) {
-      if (e.button == 2) // right
-        this.handleClick(e);
-    },
-
-    /**
-     * Handles double click events on the tree.
-     * @param {Event} e The dblclick event object.
-     */
-    handleDblClick: function(e) {
-      var treeItem = findTreeItem(e.target);
-      if (treeItem)
-        treeItem.expanded = !treeItem.expanded;
-    },
-
-    /**
-     * Handles keydown events on the tree and updates selection and exanding
-     * of tree items.
-     * @param {Event} e The click event object.
-     */
-    handleKeyDown: function(e) {
-      var itemToSelect;
-      if (e.ctrlKey)
-        return;
-
-      var item = this.selectedItem;
-
-      var rtl = window.getComputedStyle(item).direction == 'rtl';
-
-      switch (e.keyIdentifier) {
-        case 'Up':
-          itemToSelect = item ? getPrevious(item) :
-              this.items[this.items.length - 1];
-          break;
-        case 'Down':
-          itemToSelect = item ? getNext(item) :
-              this.items[0];
-          break;
-        case 'Left':
-        case 'Right':
-          // Don't let back/forward keyboard shortcuts be used.
-          if (!cr.isMac && e.altKey || cr.isMac && e.metaKey)
-            break;
-
-          if (e.keyIdentifier == 'Left' && !rtl ||
-              e.keyIdentifier == 'Right' && rtl) {
-            if (item.expanded)
-              item.expanded = false;
-            else
-              itemToSelect = findTreeItem(item.parentNode);
-          } else {
-            if (!item.expanded)
-              item.expanded = true;
-            else
-              itemToSelect = item.items[0];
-          }
-          break;
-        case 'Home':
-          itemToSelect = this.items[0];
-          break;
-        case 'End':
-          itemToSelect = this.items[this.items.length - 1];
-          break;
-      }
-
-      if (itemToSelect) {
-        itemToSelect.selected = true;
-        e.preventDefault();
-      }
-    },
-
-    /**
-     * The selected tree item or null if none.
-     * @type {cr.ui.TreeItem}
-     */
-    get selectedItem() {
-      return this.selectedItem_ || null;
-    },
-    set selectedItem(item) {
-      var oldSelectedItem = this.selectedItem_;
-      if (oldSelectedItem != item) {
-        // Set the selectedItem_ before deselecting the old item since we only
-        // want one change when moving between items.
-        this.selectedItem_ = item;
-
-        if (oldSelectedItem)
-          oldSelectedItem.selected = false;
-
-        if (item)
-          item.selected = true;
-
-        cr.dispatchSimpleEvent(this, 'change');
-      }
-    }
-  };
-
-  /**
-   * This is used as a blueprint for new tree item elements.
-   * @type {!HTMLElement}
-   */
-  var treeItemProto = (function() {
-    var treeItem = cr.doc.createElement('div');
-    treeItem.className = 'tree-item';
-    treeItem.innerHTML = '<div class=tree-row>' +
-        '<span class=expand-icon></span>' +
-        '<span class=tree-label></span>' +
-        '</div>' +
-        '<div class=tree-children></div>';
-    return treeItem;
-  })();
-
-  /**
-   * Creates a new tree item.
-   * @param {Object=} opt_propertyBag Optional properties.
-   * @constructor
-   * @extends {HTMLElement}
-   */
-  var TreeItem = cr.ui.define(function() {
-    return treeItemProto.cloneNode(true);
-  });
-
-  TreeItem.prototype = {
-    __proto__: HTMLElement.prototype,
-
-    /**
-     * Initializes the element.
-     */
-    decorate: function() {
-
-    },
-
-    /**
-     * The tree items children.
-     */
-    get items() {
-      return this.lastElementChild.children;
-    },
-
-    /**
-     * Adds a tree item as a child.
-     * @param {!cr.ui.TreeItem} child The child to add.
-     */
-    add: function(child) {
-      this.addAt(child, 0xffffffff);
-    },
-
-    /**
-     * Adds a tree item as a child at a given index.
-     * @param {!cr.ui.TreeItem} child The child to add.
-     * @param {number} index The index where to add the child.
-     */
-    addAt: function(child, index) {
-      this.lastElementChild.insertBefore(child, this.items[index]);
-      if (this.items.length == 1)
-        this.hasChildren_ = true;
-    },
-
-    /**
-     * Removes a child.
-     * @param {!cr.ui.TreeItem} child The tree item child to remove.
-     */
-    remove: function(child) {
-      // If we removed the selected item we should become selected.
-      var tree = this.tree;
-      var selectedItem = tree.selectedItem;
-      if (selectedItem && child.contains(selectedItem))
-        this.selected = true;
-
-      this.lastElementChild.removeChild(child);
-      if (this.items.length == 0)
-        this.hasChildren_ = false;
-    },
-
-    /**
-     * The parent tree item.
-     * @type {!cr.ui.Tree|cr.ui.TreeItem}
-     */
-    get parentItem() {
-      var p = this.parentNode;
-      while (p && !(p instanceof TreeItem) && !(p instanceof Tree)) {
-        p = p.parentNode;
-      }
-      return p;
-    },
-
-    /**
-     * The tree that the tree item belongs to or null of no added to a tree.
-     * @type {cr.ui.Tree}
-     */
-    get tree() {
-      var t = this.parentItem;
-      while (t && !(t instanceof Tree)) {
-        t = t.parentItem;
-      }
-      return t;
-    },
-
-    /**
-     * Whether the tree item is expanded or not.
-     * @type {boolean}
-     */
-    get expanded() {
-      return this.hasAttribute('expanded');
-    },
-    set expanded(b) {
-      if (this.expanded == b)
-        return;
-
-      var treeChildren = this.lastElementChild;
-
-      if (b) {
-        if (this.mayHaveChildren_) {
-          this.setAttribute('expanded', '');
-          treeChildren.setAttribute('expanded', '');
-          cr.dispatchSimpleEvent(this, 'expand', true);
-          this.scrollIntoViewIfNeeded(false);
-        }
-      } else {
-        var tree = this.tree;
-        if (tree && !this.selected) {
-          var oldSelected = tree.selectedItem;
-          if (oldSelected && this.contains(oldSelected))
-            this.selected = true;
-        }
-        this.removeAttribute('expanded');
-        treeChildren.removeAttribute('expanded');
-        cr.dispatchSimpleEvent(this, 'collapse', true);
-      }
-    },
-
-    /**
-     * Expands all parent items.
-     */
-    reveal: function() {
-      var pi = this.parentItem;
-      while (pi && !(pi instanceof Tree)) {
-        pi.expanded = true;
-        pi = pi.parentItem;
-      }
-    },
-
-    /**
-     * The element representing the row that gets highlighted.
-     * @type {!HTMLElement}
-     */
-    get rowElement() {
-      return this.firstElementChild;
-    },
-
-    /**
-     * The element containing the label text and the icon.
-     * @type {!HTMLElement}
-     */
-    get labelElement() {
-      return this.firstElementChild.lastElementChild;
-    },
-
-    /**
-     * The label text.
-     * @type {string}
-     */
-    get label() {
-      return this.labelElement.textContent;
-    },
-    set label(s) {
-      this.labelElement.textContent = s;
-    },
-
-    /**
-     * The URL for the icon.
-     * @type {string}
-     */
-    get icon() {
-      return window.getComputedStyle(this.labelElement).
-          backgroundImage.slice(4, -1);
-    },
-    set icon(icon) {
-      return this.labelElement.style.backgroundImage = url(icon);
-    },
-
-    /**
-     * Whether the tree item is selected or not.
-     * @type {boolean}
-     */
-    get selected() {
-      return this.hasAttribute('selected');
-    },
-    set selected(b) {
-      if (this.selected == b)
-        return;
-      var rowItem = this.firstElementChild;
-      var tree = this.tree;
-      if (b) {
-        this.setAttribute('selected', '');
-        rowItem.setAttribute('selected', '');
-        this.labelElement.scrollIntoViewIfNeeded(false);
-        if (tree)
-          tree.selectedItem = this;
-      } else {
-        this.removeAttribute('selected');
-        rowItem.removeAttribute('selected');
-        if (tree && tree.selectedItem == this)
-          tree.selectedItem = null;
-      }
-    },
-
-    /**
-     * Whether the tree item has children.
-     * @type {boolean}
-     */
-    get mayHaveChildren_() {
-      return this.hasAttribute('may-have-children');
-    },
-    set mayHaveChildren_(b) {
-      var rowItem = this.firstElementChild;
-      if (b) {
-        this.setAttribute('may-have-children', '');
-        rowItem.setAttribute('may-have-children', '');
-      } else {
-        this.removeAttribute('may-have-children');
-        rowItem.removeAttribute('may-have-children');
-      }
-    },
-
-    /**
-     * Whether the tree item has children.
-     * @type {boolean}
-     */
-    get hasChildren() {
-      return !!this.items[0];
-    },
-
-    /**
-     * Whether the tree item has children.
-     * @type {boolean}
-     * @private
-     */
-    set hasChildren_(b) {
-      var rowItem = this.firstElementChild;
-      this.setAttribute('has-children', b);
-      rowItem.setAttribute('has-children', b);
-      if (b)
-        this.mayHaveChildren_ = true;
-    },
-
-    /**
-     * Called when the user clicks on a tree item. This is forwarded from the
-     * cr.ui.Tree.
-     * @param {Event} e The click event.
-     */
-    handleClick: function(e) {
-      if (e.target.className == 'expand-icon')
-        this.expanded = !this.expanded;
-      else
-        this.selected = true;
-    },
-
-    /**
-     * Makes the tree item user editable. If the user renamed the item a
-     * bubbling {@code rename} event is fired.
-     * @type {boolean}
-     */
-    set editing(editing) {
-      var oldEditing = this.editing;
-      if (editing == oldEditing)
-        return;
-
-      var self = this;
-      var labelEl = this.labelElement;
-      var text = this.label;
-      var input;
-
-      // Handles enter and escape which trigger reset and commit respectively.
-      function handleKeydown(e) {
-        // Make sure that the tree does not handle the key.
-        e.stopPropagation();
-
-        // Calling tree.focus blurs the input which will make the tree item
-        // non editable.
-        switch (e.keyIdentifier) {
-          case 'U+001B':  // Esc
-            input.value = text;
-            // fall through
-          case 'Enter':
-            self.tree.focus();
-        }
-      }
-
-      function stopPropagation(e) {
-        e.stopPropagation();
-      }
-
-      if (editing) {
-        this.selected = true;
-        this.setAttribute('editing', '');
-        this.draggable = false;
-
-        // We create an input[type=text] and copy over the label value. When
-        // the input loses focus we set editing to false again.
-        input = this.ownerDocument.createElement('input');
-        input.value = text;
-        if (labelEl.firstChild)
-          labelEl.replaceChild(input, labelEl.firstChild);
-        else
-          labelEl.appendChild(input);
-
-        input.addEventListener('keydown', handleKeydown);
-        input.addEventListener('blur', cr.bind(function() {
-          this.editing = false;
-        }, this));
-
-        // Make sure that double clicks do not expand and collapse the tree
-        // item.
-        var eventsToStop = ['mousedown', 'mouseup', 'contextmenu', 'dblclick'];
-        eventsToStop.forEach(function(type) {
-          input.addEventListener(type, stopPropagation);
-        });
-
-        input.focus();
-        input.select();
-        cr.ui.limitInputWidth(input, this.rowElement, 20);
-            // the padding and border of the tree-row
-
-        this.oldLabel_ = text;
-      } else {
-        this.removeAttribute('editing');
-        this.draggable = true;
-        input = labelEl.firstChild;
-        var value = input.value;
-        if (/^\s*$/.test(value)) {
-          labelEl.textContent = this.oldLabel_;
-        } else {
-          labelEl.textContent = value;
-          if (value != this.oldLabel_) {
-            cr.dispatchSimpleEvent(this, 'rename', true);
-          }
-        }
-        delete this.oldLabel_;
-      }
-    },
-
-    get editing() {
-      return this.hasAttribute('editing');
-    }
-  };
-
-  /**
-   * Helper function that returns the next visible tree item.
-   * @param {cr.ui.TreeItem} item The tree item.
-   * @retrun {cr.ui.TreeItem} The found item or null.
-   */
-  function getNext(item) {
-    if (item.expanded) {
-      var firstChild = item.items[0];
-      if (firstChild) {
-        return firstChild;
-      }
-    }
-
-    return getNextHelper(item);
-  }
-
-  /**
-   * Another helper function that returns the next visible tree item.
-   * @param {cr.ui.TreeItem} item The tree item.
-   * @retrun {cr.ui.TreeItem} The found item or null.
-   */
-  function getNextHelper(item) {
-    if (!item)
-      return null;
-
-    var nextSibling = item.nextElementSibling;
-    if (nextSibling) {
-      return nextSibling;
-    }
-    return getNextHelper(item.parentItem);
-  }
-
-  /**
-   * Helper function that returns the previous visible tree item.
-   * @param {cr.ui.TreeItem} item The tree item.
-   * @retrun {cr.ui.TreeItem} The found item or null.
-   */
-  function getPrevious(item) {
-    var previousSibling = item.previousElementSibling;
-    return previousSibling ? getLastHelper(previousSibling) : item.parentItem;
-  }
-
-  /**
-   * Helper function that returns the last visible tree item in the subtree.
-   * @param {cr.ui.TreeItem} item The item to find the last visible item for.
-   * @return {cr.ui.TreeItem} The found item or null.
-   */
-  function getLastHelper(item) {
-    if (!item)
-      return null;
-    if (item.expanded && item.hasChildren) {
-      var lastChild = item.items[item.items.length - 1];
-      return getLastHelper(lastChild);
-    }
-    return item;
-  }
-
-  // Export
-  return {
-    Tree: Tree,
-    TreeItem: TreeItem
-  };
-});
diff --git a/resources/bookmark_manager/js/i18ntemplate.js b/resources/bookmark_manager/js/i18ntemplate.js
deleted file mode 100644
index 8166ddc..0000000
--- a/resources/bookmark_manager/js/i18ntemplate.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @fileoverview This is a simple template engine inspired by JsTemplates
- * optimized for i18n.
- *
- * It currently supports two handlers:
- *
- *   * i18n-content which sets the textContent of the element
- *
- *     <span i18n-content="myContent"></span>
- *     i18nTemplate.process(element, {'myContent': 'Content'});
- *
- *   * i18n-values is a list of attribute-value or property-value pairs.
- *     Properties are prefixed with a '.' and can contain nested properties.
- *
- *     <span i18n-values="title:myTitle;.style.fontSize:fontSize"></span>
- *     i18nTemplate.process(element, {
- *       'myTitle': 'Title',
- *       'fontSize': '13px'
- *     });
- */
-
-var i18nTemplate = (function() {
-  /**
-   * This provides the handlers for the templating engine. The key is used as
-   * the attribute name and the value is the function that gets called for every
-   * single node that has this attribute.
-   * @type {Object}
-   */
-  var handlers = {
-    /**
-     * This handler sets the textContent of the element.
-     */
-    'i18n-content': function(element, attributeValue, obj) {
-      element.textContent = obj[attributeValue];
-    },
-
-    /**
-     * This is used to set HTML attributes and DOM properties,. The syntax is:
-     *   attributename:key;
-     *   .domProperty:key;
-     *   .nested.dom.property:key
-     */
-    'i18n-values': function(element, attributeValue, obj) {
-      var parts = attributeValue.replace(/\s/g, '').split(/;/);
-      for (var j = 0; j < parts.length; j++) {
-        var a = parts[j].match(/^([^:]+):(.+)$/);
-        if (a) {
-          var propName = a[1];
-          var propExpr = a[2];
-
-          // Ignore missing properties
-          if (propExpr in obj) {
-            var value = obj[propExpr];
-            if (propName.charAt(0) == '.') {
-              var path = propName.slice(1).split('.');
-              var object = element;
-              while (object && path.length > 1) {
-                object = object[path.shift()];
-              }
-              if (object) {
-                object[path] = value;
-                // In case we set innerHTML (ignoring others) we need to
-                // recursively check the content
-                if (path == 'innerHTML') {
-                  process(element, obj);
-                }
-              }
-            } else {
-              element.setAttribute(propName, value);
-            }
-          } else {
-            console.warn('i18n-values: Missing value for "' + propExpr + '"');
-          }
-        }
-      }
-    }
-  };
-
-  var attributeNames = [];
-  for (var key in handlers) {
-    attributeNames.push(key);
-  }
-  var selector = '[' + attributeNames.join('],[') + ']';
-
-  /**
-   * Processes a DOM tree with the {@code obj} map.
-   */
-  function process(node, obj) {
-    var elements = node.querySelectorAll(selector);
-    for (var element, i = 0; element = elements[i]; i++) {
-      for (var j = 0; j < attributeNames.length; j++) {
-        var name = attributeNames[j];
-        var att = element.getAttribute(name);
-        if (att != null) {
-          handlers[name](element, att, obj);
-        }
-      }
-    }
-  }
-
-  return {
-    process: process
-  };
-})();
diff --git a/resources/bookmark_manager/js/localstrings.js b/resources/bookmark_manager/js/localstrings.js
deleted file mode 100644
index 86f888b..0000000
--- a/resources/bookmark_manager/js/localstrings.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2009-2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// TODO(arv): Namespace and share code with DOMUI
-
-/**
- * The local strings get injected into the page usig a varaible named
- * {@code templateData}. This class provides a simpler interface to access those
- * strings.
- * @constructor
- */
-function LocalStrings() {
-}
-
-LocalStrings.prototype = {
-
-  /**
-   * The template data object.
-   * @type {Object}
-   */
-  templateData: null,
-
-  /**
-   * Gets a localized string by its id.
-   * @param {string} s The id of the string we want.
-   * @return {string} The localized string.
-   */
-  getString: function(id) {
-    return this.templateData[id] || '';
-  },
-
-  /**
-   * Returns a formatted localized string where all %s contents are replaced
-   * by the second argument and where $1 to $9 are replaced by the second to
-   * tenths arguments.
-   * @param {string} id The ID of the string we want.
-   * @param {string} v The string to include in the formatted string.
-   * @param {...string} The extra values to include in the fomatted output.
-   * @return {string} The formatted string.
-   */
-  getStringF: function(id, v, var_args) {
-    // The localized messages should contain $n but they also use %s from time
-    // to time so we support both until all the messages have been unified.
-    var s = this.getString(id);
-    var args = arguments;
-    return s.replace(/%s|\$[$1-9]/g, function(m) {
-      if (m == '%s')
-        return v;
-      if (m == '$$')
-        return '$';
-      return args[m[1]];
-    });
-  }
-};
diff --git a/resources/bookmark_manager/js/util.js b/resources/bookmark_manager/js/util.js
deleted file mode 100644
index 3fef5d2..0000000
--- a/resources/bookmark_manager/js/util.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/**
- * The global object.
- * @param {!Object}
- */
-const global = this;
-
-/**
- * Alias for document.getElementById.
- * @param {string} id The ID of the element to find.
- * @return {HTMLElement} The found element or null if not found.
- */
-function $(id) {
-  return document.getElementById(id);
-}
-
-/**
- * Calls chrome.send with a callback and restores the original afterwards.
- * @param {string} name The name of the message to send.
- * @param {!Array} params The parameters to send.
- * @param {string} callbackName The name of the function that the backend calls.
- * @param {!Function} The function to call.
- */
-function chromeSend(name, params, callbackName, callback) {
-  var old = global[callbackName];
-  global[callbackName] = function() {
-    // restore
-    global[callbackName] = old;
-
-    var args = Array.prototype.slice.call(arguments);
-    return callback.apply(global, args);
-  };
-  chrome.send(name, params);
-}
-
-
-/**
- * Generates a CSS url string.
- * @param {string} s The URL to generate the CSS url for.
- * @return {string} The CSS url string.
- */
-function url(s) {
-  // http://www.w3.org/TR/css3-values/#uris
-  // Parentheses, commas, whitespace characters, single quotes (') and double
-  // quotes (") appearing in a URI must be escaped with a backslash
-  var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1');
-  // WebKit has a bug when it comes to URLs that end with \
-  // https://bugs.webkit.org/show_bug.cgi?id=28885
-  if (/\\\\$/.test(s2)) {
-    // Add a space to work around the WebKit bug.
-    s2 += ' ';
-  }
-  return 'url("' + s2 + '")';
-}
diff --git a/resources/bookmark_manager/main.html b/resources/bookmark_manager/main.html
deleted file mode 100644
index b36b6c0..0000000
--- a/resources/bookmark_manager/main.html
+++ /dev/null
@@ -1,1587 +0,0 @@
-<!DOCTYPE html>
-<html i18n-values="dir:textdirection">
-<!--
-
-Copyright (c) 2010 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
-
-
-This is work in progress:
-
-Favicons: chrome-extension: is not allowed to access chrome://favicon. We need
-to whitelist it or expose a way to get the data URI for the favicon (slow and
-sucky).
-
-Favicon of bmm does not work. No icon is showed.
-
--->
-<head>
-<title i18n-content="title"></title>
-
-<link rel="stylesheet" href="css/list.css">
-<link rel="stylesheet" href="css/tree.css">
-<link rel="stylesheet" href="css/menu.css">
-<link rel="stylesheet" href="css/bmm.css">
-
-<script src="css/tree.css.js"></script>
-<script src="css/bmm.css.js"></script>
-
-<script src="js/cr.js"></script>
-<script src="js/cr/event.js"></script>
-<script src="js/cr/eventtarget.js"></script>
-<script src="js/cr/promise.js"></script>
-<script src="js/cr/ui.js"></script>
-<script src="js/cr/ui/listselectionmodel.js"></script>
-<script src="js/cr/ui/listitem.js"></script>
-<script src="js/cr/ui/list.js"></script>
-<script src="js/cr/ui/tree.js"></script>
-<script src="js/cr/ui/command.js"></script>
-<script src="js/cr/ui/menuitem.js"></script>
-<script src="js/cr/ui/menu.js"></script>
-<script src="js/cr/ui/menubutton.js"></script>
-<script src="js/cr/ui/contextmenuhandler.js"></script>
-
-<script src="js/util.js"></script>
-<script src="js/localstrings.js"></script>
-<script src="js/i18ntemplate.js"></script>
-
-<script src="js/bmm/treeiterator.js"></script>
-<script src="js/bmm.js"></script>
-<script src="js/bmm/bookmarklist.js"></script>
-<script src="js/bmm/bookmarktree.js"></script>
-
-<script>
-
-// Sometimes the extension API is not initialized.
-if (!chrome.bookmarks)
-  window.location.reload();
-
-// Allow platform specific CSS rules.
-if (cr.isMac)
-  document.documentElement.setAttribute('os', 'mac');
-
-</script>
-</head>
-<body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
-
-<div class="header">
-  <button onclick="resetSearch()" class="logo" tabindex=3></button>
-  <div>
-    <form onsubmit="setSearch(this.term.value); return false;"
-        class="form">
-      <input type="text" id="term" tabindex=1 autofocus>
-      <input type="submit" i18n-values=".value:search_button" tabindex=1>
-    </form>
-    <div class=toolbar>
-      <button menu="#organize-menu" tabindex="-1" i18n-content="organize_menu"></button>
-      <button menu="#tools-menu" tabindex="-1" i18n-content="tools_menu"></button>
-    </div>
-  </div>
-</div>
-
-<div class=main>
-  <div id=tree-container>
-    <tree id=tree tabindex=2></tree>
-  </div>
-  <list id=list tabindex=2></list>
-</div>
-
-
-<script>
-
-const BookmarkList = bmm.BookmarkList;
-const BookmarkTree = bmm.BookmarkTree;
-const ListItem = cr.ui.ListItem;
-const TreeItem = cr.ui.TreeItem;
-
-/**
- * The id of the bookmark root.
- * @type {number}
- */
-const ROOT_ID = '0';
-
-var bookmarkCache = {
-  /**
-   * This returns a reference to the bookmark node that is cached by the tree
-   * or list. Use this funciton when we need to update the local cachea after
-   * changes. It only returns bookmarks that are used by the tree and/or the
-   * list.
-   * @param {string} The ID of the bookmark that we want to get.
-   * @return {BookmarkTreeNode}
-   */
-  getById: function(id) {
-    var el = bmm.treeLookup[id] || bmm.listLookup[id];
-    return el && el.bookmarkNode;
-  },
-
-  /**
-   * Removes the cached item from both the list and tree lookups.
-   */
-  remove: function(id) {
-    delete bmm.listLookup[id];
-
-    var treeItem = bmm.treeLookup[id];
-    if (treeItem) {
-      var items = treeItem.items; // is an HTMLCollection
-      for (var i = 0, item; item = items[i]; i++) {
-        var bookmarkNode = item.bookmarkNode;
-        delete bmm.treeLookup[bookmarkNode.id];
-      }
-      delete bmm.treeLookup[id];
-    }
-  },
-
-  /**
-   * Updates the underlying bookmark node for the tree items and list items by
-   * querying the bookmark backend.
-   * @param {string} id The id of the node to update the children for.
-   * @param {Function=} opt_f A funciton to call when done.
-   */
-  updateChildren: function(id, opt_f) {
-    function updateItem(bookmarkNode) {
-      var treeItem = bmm.treeLookup[bookmarkNode.id];
-      if (treeItem) {
-        treeItem.bookmarkNode = bookmarkNode;
-      }
-      var listItem = bmm.listLookup[bookmarkNode.id];
-      if (listItem) {
-        listItem.bookmarkNode = bookmarkNode;
-      }
-    }
-
-    chrome.bookmarks.getChildren(id, function(children) {
-      children.forEach(updateItem);
-
-      if (opt_f)
-        opt_f(children);
-    });
-  }
-};
-
-</script>
-<script>
-
-BookmarkList.decorate(list);
-
-var searchTreeItem = new TreeItem({
-  label: 'Search',
-  icon: 'images/bookmark_manager_search.png',
-  bookmarkId: 'q='
-});
-bmm.treeLookup[searchTreeItem.bookmarkId] = searchTreeItem;
-
-var recentTreeItem = new TreeItem({
-  label: 'Recent',
-  icon: 'images/bookmark_manager_recent.png',
-  bookmarkId: 'recent'
-});
-bmm.treeLookup[recentTreeItem.bookmarkId] = recentTreeItem;
-
-BookmarkTree.decorate(tree);
-
-tree.addEventListener('change', function() {
-  navigateTo(tree.selectedItem.bookmarkId);
-});
-
-/**
- * Navigates to a bookmark ID.
- * @param {string} id The ID to navigate to.
- */
-function navigateTo(id) {
-  console.info('navigateTo', window.location.hash, id);
-  // Update the location hash using a timer to prevent reentrancy. This is how
-  // often we add history entries and the time here is a bit arbitrary but was
-  // picked as the smallest time a human perceives as instant.
-  clearTimeout(navigateTo.timer_);
-  navigateTo.timer_ = setTimeout(function() {
-    window.location.hash = tree.selectedItem.bookmarkId;
-  }, 300);
-  updateParentId(id);
-}
-
-/**
- * Updates the parent ID of the bookmark list and selects the correct tree item.
- * @param {string} id The id.
- */
-function updateParentId(id) {
-  list.parentId = id;
-  if (id in bmm.treeLookup)
-    tree.selectedItem = bmm.treeLookup[id];
-}
-
-// We listen to hashchange so that we can update the currently shown folder when
-// the user goes back and forward in the history.
-window.onhashchange = function(e) {
-  var id = window.location.hash.slice(1);
-
-  var valid = false;
-
-  // In case we got a search hash update the text input and the bmm.treeLookup
-  // to use the new id.
-  if (/^q=/.test(id)) {
-    delete bmm.treeLookup[searchTreeItem.bookmarkId];
-    $('term').value = id.slice(2);
-    searchTreeItem.bookmarkId = id;
-    bmm.treeLookup[id] = searchTreeItem;
-    valid = true;
-  } else if (id == 'recent') {
-    valid = true;
-  }
-
-  if (valid) {
-    updateParentId(id);
-  } else {
-    // We need to verify that this is a correct ID.
-    chrome.bookmarks.get(id, function(items) {
-      if (items && items.length == 1)
-        updateParentId(id);
-    });
-  }
-};
-
-list.addEventListener('activate', function(e) {
-  var bookmarkNodes = getSelectedBookmarkNodes();
-
-  // If we double clicked or pressed enter on a single folder navigate to it.
-  if (bookmarkNodes.length == 1 && bmm.isFolder(bookmarkNodes[0])) {
-    navigateTo(bookmarkNodes[0].id);
-  } else {
-    var command = $('open-in-new-tab-command');
-    command.execute();
-  }
-});
-
-// The list dispatches an event when the user clicks on the URL or the Show in
-// folder part.
-list.addEventListener('urlClicked', function(e) {
-  openUrls([e.url], e.kind);
-});
-
-/**
- * Timer id used for delaying find-as-you-type
- */
-var inputDelayTimer;
-
-// Capture input changes to the search term input element and delay searching
-// for 250ms to reduce flicker.
-$('term').oninput = function(e) {
-  clearTimeout(inputDelayTimer);
-  inputDelayTimer = setTimeout(function() {
-    setSearch($('term').value);
-  }, 250);
-};
-
-/**
- * Navigates to the search results for the search text.
- * @para {string} searchText The text to search for.
- */
-function setSearch(searchText) {
-  navigateTo('q=' + searchText);
-}
-
-/**
- * Clears the search.
- */
-function resetSearch() {
-  $('term').value = '';
-  setSearch('');
-  $('term').focus();
-}
-
-/**
- * Called when the title of a bookmark changes.
- * @param {string} id
- * @param {!Object} changeInfo
- */
-function handleBookmarkChanged(id, changeInfo) {
-  // console.log('handleBookmarkChanged', id, changeInfo);
-  list.handleBookmarkChanged(id, changeInfo);
-  tree.handleBookmarkChanged(id, changeInfo);
-}
-
-/**
- * Callback for when the user reorders by title.
- * @param {string} id The id of the bookmark folder that was reordered.
- * @param {!Object} reorderInfo The information about how the items where
- *     reordered.
- */
-function handleChildrenReordered(id, reorderInfo) {
-  // console.info('handleChildrenReordered', id, reorderInfo);
-  list.handleChildrenReordered(id, reorderInfo);
-  tree.handleChildrenReordered(id, reorderInfo);
-  bookmarkCache.updateChildren(id);
-}
-
-/**
- * Callback for when a bookmark node is created.
- * @param {string} id The id of the newly created bookmark node.
- * @param {!Object} bookmarkNode The new bookmark node.
- */
-function handleCreated(id, bookmarkNode) {
-  // console.info('handleCreated', id, bookmarkNode);
-  list.handleCreated(id, bookmarkNode);
-  tree.handleCreated(id, bookmarkNode);
-  bookmarkCache.updateChildren(bookmarkNode.parentId);
-}
-
-function handleMoved(id, moveInfo) {
-  // console.info('handleMoved', id, moveInfo);
-  list.handleMoved(id, moveInfo);
-  tree.handleMoved(id, moveInfo);
-
-  bookmarkCache.updateChildren(moveInfo.parentId);
-  if (moveInfo.parentId != moveInfo.oldParentId)
-    bookmarkCache.updateChildren(moveInfo.oldParentId);
-}
-
-function handleRemoved(id, removeInfo) {
-  // console.info('handleRemoved', id, removeInfo);
-  list.handleRemoved(id, removeInfo);
-  tree.handleRemoved(id, removeInfo);
-
-  bookmarkCache.updateChildren(removeInfo.parentId);
-  bookmarkCache.remove(id);
-}
-
-function handleImportBegan() {
-  chrome.bookmarks.onCreated.removeListener(handleCreated);
-}
-
-function handleImportEnded() {
-  chrome.bookmarks.onCreated.addListener(handleCreated);
-  var p = bmm.loadTree();
-  p.addListener(function(node) {
-    var otherBookmarks = node.children[1].children;
-    var importedFolder = otherBookmarks[otherBookmarks.length - 1];
-    var importId = importedFolder.id;
-    tree.insertSubtree(importedFolder);
-    navigateTo(importId)
-  });
-}
-
-/**
- * Adds the listeners for the bookmark model change events.
- */
-function addBookmarkModelListeners() {
-  chrome.bookmarks.onChanged.addListener(handleBookmarkChanged);
-  chrome.bookmarks.onChildrenReordered.addListener(handleChildrenReordered);
-  chrome.bookmarks.onCreated.addListener(handleCreated);
-  chrome.bookmarks.onMoved.addListener(handleMoved);
-  chrome.bookmarks.onRemoved.addListener(handleRemoved);
-  chrome.experimental.bookmarkManager.onImportBegan.addListener(
-      handleImportBegan);
-  chrome.experimental.bookmarkManager.onImportEnded.addListener(
-      handleImportEnded);
-}
-
-/**
- * This returns the user visible path to the folder where the bookmark is
- * located.
- * @param {number} parentId The ID of the parent folder.
- * @return {string} The path to the the bookmark,
- */
-function getFolder(parentId) {
-  var parentNode = tree.getBookmarkNodeById(parentId);
-  if (parentNode) {
-    var s = parentNode.title;
-    if (parentNode.parentId != ROOT_ID) {
-      return getFolder(parentNode.parentId) + '/' + s;
-    }
-    return s;
-  }
-}
-
-tree.addEventListener('load', function(e) {
-  // Add hard coded tree items
-  tree.add(recentTreeItem);
-  tree.add(searchTreeItem);
-
-  // Now we can select a tree item.
-  var hash = window.location.hash.slice(1);
-  if (!hash) {
-    // If we do not have a hash select first item in the tree.
-    hash = tree.items[0].bookmarkId;
-  }
-
-  if (/^q=/.test(hash))
-    $('term').value = hash.slice(2);
-  navigateTo(hash);
-});
-
-tree.buildTree();
-addBookmarkModelListeners();
-
-var dnd = {
-  DND_EFFECT_COPY: 'copy',
-  DND_EFFECT_MOVE: cr.isMac ? 'move' : 'copy', // http://crbug.com/14654
-
-  dragData: null,
-
-  getBookmarkElement: function(el) {
-    while (el && !el.bookmarkNode) {
-      el = el.parentNode;
-    }
-    return el;
-  },
-
-  // If we are over the list and the list is showing recent or search result
-  // we cannot drop.
-  isOverRecentOrSearch: function(overElement) {
-    return (list.isRecent() || list.isSearch()) && list.contains(overElement);
-  },
-
-  checkEvery_: function(f, overBookmarkNode, overElement) {
-    return this.dragData.elements.every(function(element) {
-      return f.call(this, element, overBookmarkNode, overElement);
-    }, this);
-  },
-
-  /**
-   * @return {boolean} Whether we are currently dragging any folders.
-   */
-  isDraggingFolders: function() {
-    return !!this.dragData && this.dragData.elements.some(function(node) {
-      return !node.url;
-    });
-  },
-
-  /**
-   * This is a first pass wether we can drop the dragged items.
-   *
-   * @param {!BookmarkTreeNode} overBookmarkNode The bookmark that we are
-   *     currently dragging over.
-   * @param {!HTMLElement} overElement The element that we are currently
-   *     dragging over.
-   * @return {boolean} If this returns false then we know we should not drop
-   *     the items. If it returns true we still have to call canDropOn,
-   *     canDropAbove and canDropBelow.
-   */
-  canDrop: function(overBookmarkNode, overElement) {
-    var dragData = this.dragData;
-    if (!dragData)
-      return false;
-
-    if (this.isOverRecentOrSearch(overElement))
-      return false;
-
-    if (!dragData.sameProfile)
-      return true;
-
-    return this.checkEvery_(this.canDrop_, overBookmarkNode, overElement);
-  },
-
-  /**
-   * Helper for canDrop that only checks one bookmark node.
-   * @private
-   */
-  canDrop_: function(dragNode, overBookmarkNode, overElement) {
-    var dragId = dragNode.id;
-
-    if (overBookmarkNode.id == dragId)
-      return false;
-
-    // If we are dragging a folder we cannot drop it on any of its descendants
-    var dragBookmarkItem = bmm.treeLookup[dragId];
-    var dragBookmarkNode = dragBookmarkItem && dragBookmarkItem.bookmarkNode;
-    if (dragBookmarkNode && bmm.contains(dragBookmarkNode, overBookmarkNode)) {
-      return false;
-    }
-
-    return true;
-  },
-
-  /**
-   * Whether we can drop the dragged items above the drop target.
-   *
-   * @param {!BookmarkTreeNode} overBookmarkNode The bookmark that we are
-   *     currently dragging over.
-   * @param {!HTMLElement} overElement The element that we are currently
-   *     dragging over.
-   * @return {boolean} Whether we can drop the dragged items above the drop
-   *     target.
-   */
-  canDropAbove: function(overBookmarkNode, overElement) {
-    if (overElement instanceof BookmarkList)
-      return false;
-
-    // We cannot drop between Bookmarks bar and Other bookmarks
-    if (overBookmarkNode.parentId == ROOT_ID)
-      return false;
-
-    var isOverTreeItem = overElement instanceof TreeItem;
-
-    // We can only drop between items in the tree if we have any folders.
-    if (isOverTreeItem && !this.isDraggingFolders())
-      return false;
-
-    if (!this.dragData.sameProfile)
-      return this.isDraggingFolders() || !isOverTreeItem;
-
-    return this.checkEvery_(this.canDropAbove_, overBookmarkNode, overElement);
-  },
-
-  /**
-   * Helper for canDropAbove that only checks one bookmark node.
-   * @private
-   */
-  canDropAbove_: function(dragNode, overBookmarkNode, overElement) {
-    var dragId = dragNode.id;
-
-    // We cannot drop above if the item below is already in the drag source
-    var previousElement = overElement.previousElementSibling;
-    if (previousElement &&
-        previousElement.bookmarkId == dragId)
-      return false;
-
-    return true;
-  },
-
-  /**
-   * Whether we can drop the dragged items below the drop target.
-   *
-   * @param {!BookmarkTreeNode} overBookmarkNode The bookmark that we are
-   *     currently dragging over.
-   * @param {!HTMLElement} overElement The element that we are currently
-   *     dragging over.
-   * @return {boolean} Whether we can drop the dragged items below the drop
-   *     target.
-   */
-  canDropBelow: function(overBookmarkNode, overElement) {
-    if (overElement instanceof BookmarkList)
-      return false;
-
-    // We cannot drop between Bookmarks bar and Other bookmarks
-    if (overBookmarkNode.parentId == ROOT_ID)
-      return false;
-
-    // We can only drop between items in the tree if we have any folders.
-    if (!this.isDraggingFolders() && overElement instanceof TreeItem)
-      return false;
-
-    var isOverTreeItem = overElement instanceof TreeItem;
-
-    // Don't allow dropping below an expanded tree item since it is confusing
-    // to the user anyway.
-    if (isOverTreeItem && overElement.expanded)
-      return false;
-
-    if (!this.dragData.sameProfile)
-      return this.isDraggingFolders() || !isOverTreeItem;
-
-    return this.checkEvery_(this.canDropBelow_, overBookmarkNode, overElement);
-  },
-
-  /**
-   * Helper for canDropBelow that only checks one bookmark node.
-   * @private
-   */
-  canDropBelow_: function(dragNode, overBookmarkNode, overElement) {
-    var dragId = dragNode.id;
-
-    // We cannot drop below if the item below is already in the drag source
-    var nextElement = overElement.nextElementSibling;
-    if (nextElement &&
-        nextElement.bookmarkId == dragId)
-      return false;
-
-    return true;
-  },
-
-  /**
-   * Whether we can drop the dragged items on the drop target.
-   *
-   * @param {!BookmarkTreeNode} overBookmarkNode The bookmark that we are
-   *     currently dragging over.
-   * @param {!HTMLElement} overElement The element that we are currently
-   *     dragging over.
-   * @return {boolean} Whether we can drop the dragged items on the drop
-   *     target.
-   */
-  canDropOn: function(overBookmarkNode, overElement) {
-    // We can only drop on a folder.
-    if (!bmm.isFolder(overBookmarkNode))
-      return false;
-
-    if (!this.dragData.sameProfile)
-      return true;
-
-    return this.checkEvery_(this.canDropOn_, overBookmarkNode, overElement);
-  },
-
-  /**
-   * Helper for canDropOn that only checks one bookmark node.
-   * @private
-   */
-  canDropOn_: function(dragNode, overBookmarkNode, overElement) {
-    var dragId = dragNode.id;
-
-    if (overElement instanceof BookmarkList) {
-      // We are trying to drop an item after the last item in the list. This
-      // is allowed if the item is different from the last item in the list
-      var listItems = list.items;
-      var len = listItems.length;
-      if (len == 0 ||
-          listItems[len - 1].bookmarkId != dragId) {
-        return true;
-      }
-    }
-
-    // Cannot drop on current parent.
-    if (overBookmarkNode.id == dragNode.parentId)
-      return false;
-
-    return true;
-  },
-
-  /**
-   * Callback for the dragstart event.
-   * @param {Event} e The dragstart event.
-   */
-  handleDragStart: function(e) {
-    // console.log(e.type);
-
-    // Determine the selected bookmarks.
-    var target = e.target;
-    var draggedItems = [];
-    if (target instanceof ListItem) {
-      // Use selected items.
-      draggedItems = target.parentNode.selectedItems;
-    } else if (target instanceof TreeItem) {
-      draggedItems.push(target);
-    }
-
-    // We manage starting the drag by using the extension API.
-    e.preventDefault();
-
-    if (draggedItems.length) {
-      // If we are dragging a single link we can do the *Link* effect, otherwise
-      // we only allow copy and move.
-      var effectAllowed;
-      if (draggedItems.length == 1 &&
-          !bmm.isFolder(draggedItems[0].bookmarkNode)) {
-        effectAllowed = 'copyMoveLink';
-      } else {
-        effectAllowed = 'copyMove';
-      }
-      e.dataTransfer.effectAllowed = effectAllowed;
-
-      var ids = draggedItems.map(function(el) {
-        return el.bookmarkId;
-      });
-
-      chrome.experimental.bookmarkManager.startDrag(ids);
-    }
-  },
-
-  handleDragEnter: function(e) {
-    // console.log(e.type);
-
-    e.preventDefault();
-  },
-
-  /**
-   * Calback for the dragover event.
-   * @param {Event} e The dragover event.
-   */
-  handleDragOver: function(e) {
-    // console.log(e.type);
-
-    // The default operation is to allow dropping links etc to do navigation.
-    // We never want to do that for the bookmark manager.
-    e.preventDefault();
-
-    if (!this.dragData)
-      return;
-
-    var overElement = this.getBookmarkElement(e.target);
-    if (!overElement && e.target == list)
-      overElement = list;
-
-    if (!overElement)
-      return;
-
-    var overBookmarkNode = overElement.bookmarkNode;
-
-    if (!this.canDrop(overBookmarkNode, overElement))
-      return;
-
-    var bookmarkNode = overElement.bookmarkNode;
-
-    var canDropAbove = this.canDropAbove(overBookmarkNode, overElement);
-    var canDropOn = this.canDropOn(overBookmarkNode, overElement);
-    var canDropBelow = this.canDropBelow(overBookmarkNode, overElement);
-
-    if (!canDropAbove && !canDropOn && !canDropBelow)
-      return;
-
-    // Now we know that we can drop. Determine if we will drop above, on or
-    // below based on mouse position etc.
-
-    var dropPos;
-
-    e.dataTransfer.dropEffect = this.dragData.sameProfile ?
-        this.DND_EFFECT_MOVE : this.DND_EFFECT_COPY;
-
-    var rect;
-    if (overElement instanceof TreeItem) {
-      // We only want the rect of the row representing the item and not
-      // its children
-      rect = overElement.rowElement.getBoundingClientRect();
-    } else {
-      rect = overElement.getBoundingClientRect();
-    }
-
-    var dy = e.clientY - rect.top;
-    var yRatio = dy / rect.height;
-
-    //  above
-    if (canDropAbove &&
-        (yRatio <= .25 || yRatio <= .5 && !(canDropBelow && canDropOn))) {
-      dropPos = 'above';
-
-    // below
-    } else if (canDropBelow &&
-               (yRatio > .75 || yRatio > .5 && !(canDropAbove && canDropOn))) {
-      dropPos = 'below';
-
-    // on
-    } else if (canDropOn) {
-      dropPos = 'on';
-
-    // none
-    } else {
-      // No drop can happen. Exit now.
-      e.dataTransfer.dropEffect = 'none';
-      return;
-    }
-
-    function cloneClientRect(rect) {
-      var newRect = {};
-      for (var key in rect) {
-        newRect[key] = rect[key];
-      }
-      return newRect;
-    }
-
-    // If we are dropping above or below a tree item adjust the width so
-    // that it is clearer where the item will be dropped.
-    if ((dropPos == 'above' || dropPos == 'below') &&
-        overElement instanceof TreeItem) {
-      // ClientRect is read only so clone in into a read-write object.
-      rect = cloneClientRect(rect);
-      var rtl = getComputedStyle(overElement).direction == 'rtl';
-      var labelElement = overElement.labelElement;
-      var labelRect = labelElement.getBoundingClientRect();
-      if (rtl) {
-        rect.width = labelRect.left + labelRect.width - rect.left;
-      } else {
-        rect.left = labelRect.left;
-        rect.width -= rect.left
-      }
-    }
-
-    var overlayType = dropPos;
-
-    // If we are dropping on a list we want to show a overlay drop line after
-    // the last element
-    if (overElement instanceof BookmarkList) {
-      overlayType = 'below';
-
-      // Get the rect of the last list item.
-      var items = overElement.items;
-      var length = items.length;
-      if (length) {
-        dropPos = 'below';
-        overElement = items[length - 1];
-        rect = overElement.getBoundingClientRect();
-      } else {
-        // If there are no items, collapse the height of the rect
-        rect = cloneClientRect(rect);
-        rect.height = 0;
-        // We do not use bottom so we don't care to adjust it.
-      }
-    }
-
-    this.showDropOverlay_(rect, overlayType);
-
-    this.dropDestination = {
-      dropPos: dropPos,
-      relatedNode: overElement.bookmarkNode
-    };
-  },
-
-  /**
-   * Shows and positions the drop marker overlay.
-   * @param {ClientRect} targetRect The drop target rect
-   * @param {string} overlayType The position relative to the target rect.
-   * @private
-   */
-  showDropOverlay_: function(targetRect, overlayType) {
-    window.clearTimeout(this.hideDropOverlayTimer_);
-    var overlay = $('drop-overlay');
-    if (overlayType == 'on') {
-      overlay.className = '';
-      overlay.style.top = targetRect.top + 'px';
-      overlay.style.height = targetRect.height + 'px';
-    } else {
-      overlay.className = 'line';
-      overlay.style.height = '';
-    }
-    overlay.style.width = targetRect.width + 'px';
-    overlay.style.left = targetRect.left + 'px';
-    overlay.style.display = 'block';
-
-    if (overlayType != 'on') {
-      var overlayRect = overlay.getBoundingClientRect();
-      if (overlayType == 'above') {
-        overlay.style.top = targetRect.top - overlayRect.height / 2 + 'px';
-      } else {
-        overlay.style.top = targetRect.top + targetRect.height -
-            overlayRect.height / 2 + 'px';
-      }
-    }
-  },
-
-  /**
-   * Hides the drop overlay element.
-   * @private
-   */
-  hideDropOverlay_: function() {
-    // Hide the overlay in a timeout to reduce flickering as we move between
-    // valid drop targets.
-    window.clearTimeout(this.hideDropOverlayTimer_);
-    this.hideDropOverlayTimer_ = window.setTimeout(function() {
-      $('drop-overlay').style.display = '';
-    }, 100);
-  },
-
-  handleDragLeave: function(e) {
-    // console.log(e.type);
-
-    this.hideDropOverlay_();
-  },
-
-  handleDrop: function(e) {
-    // console.log(e.type);
-
-    if (this.dropDestination && this.dragData) {
-      var dropPos = this.dropDestination.dropPos;
-      var relatedNode = this.dropDestination.relatedNode;
-      var parentId = dropPos == 'on' ? relatedNode.id : relatedNode.parentId;
-
-      var index;
-      if (dropPos == 'above')
-        index = relatedNode.index;
-      else if (dropPos == 'below')
-        index = relatedNode.index + 1;
-
-      if (index != undefined)
-        chrome.experimental.bookmarkManager.drop(parentId, index);
-      else
-        chrome.experimental.bookmarkManager.drop(parentId);
-
-      // TODO(arv): Select the newly dropped items.
-    }
-    this.dropDestination = null;
-    this.hideDropOverlay_();
-  },
-
-  handleDrag: function(e) {
-    // console.log(e.type);
-  },
-
-  handleDragEnd: function(e) {
-    // console.log(e.type);
-
-    var self = this;
-    // Chromium Win incorrectly fires the dragend event before the drop event.
-    // http://code.google.com/p/chromium/issues/detail?id=31292
-    window.setTimeout(function() {
-      self.dragData = null;
-    }, 1)
-  },
-
-  handleChromeDragEnter: function(dragData) {
-    this.dragData = dragData;
-  },
-
-  init: function() {
-    document.addEventListener('dragstart', cr.bind(this.handleDragStart, this));
-    document.addEventListener('dragenter', cr.bind(this.handleDragEnter, this));
-    document.addEventListener('dragover', cr.bind(this.handleDragOver, this));
-    document.addEventListener('dragleave', cr.bind(this.handleDragLeave, this));
-    document.addEventListener('drop', cr.bind(this.handleDrop, this));
-    document.addEventListener('dragend', cr.bind(this.handleDragEnd, this));
-    document.addEventListener('drag', cr.bind(this.handleDrag, this));
-
-    chrome.experimental.bookmarkManager.onDragEnter.addListener(cr.bind(
-        this.handleChromeDragEnter, this));
-  }
-
-};
-
-dnd.init();
-
-</script>
-
-<!-- Organize menu -->
-<command i18n-values=".label:rename_folder" id="rename-folder-command"></command>
-<command i18n-values=".label:edit" id="edit-command"></command>
-<command i18n-values=".label:delete" id="delete-command"></command>
-<command i18n-values=".label:show_in_folder" id="show-in-folder-command"></command>
-<command i18n-values=".label:cut" id="cut-command"></command>
-<command i18n-values=".label:copy" id="copy-command"></command>
-<command i18n-values=".label:paste" id="paste-command"></command>
-<command i18n-values=".label:sort" id="sort-command"></command>
-<command i18n-values=".label:add_new_bookmark" id="add-new-bookmark-command"></command>
-<command i18n-values=".label:new_folder" id="new-folder-command"></command>
-
-<!-- Tools menu -->
-<command i18n-values=".label:import_menu" id="import-menu-command"></command>
-<command i18n-values=".label:export_menu" id="export-menu-command"></command>
-
-<!-- open * are handled in canExecute handler -->
-<command id="open-in-new-tab-command"></command>
-<command id="open-in-new-window-command"></command>
-<command id="open-incognito-window-command"></command>
-
-<!-- TODO(arv): I think the commands might be better created in code? -->
-
-<menu id="organize-menu">
-  <button command="#rename-folder-command"></button>
-  <button command="#edit-command"></button>
-  <button command="#delete-command"></button>
-  <button command="#show-in-folder-command"></button>
-  <hr>
-  <button command="#cut-command"></button>
-  <button command="#copy-command"></button>
-  <button command="#paste-command"></button>
-  <hr>
-  <button command="#sort-command"></button>
-  <hr>
-  <button command="#add-new-bookmark-command"></button>
-  <button command="#new-folder-command"></button>
-</menu>
-
-<menu id="tools-menu">
-  <button command="#import-menu-command"></button>
-  <button command="#export-menu-command"></button>
-</menu>
-
-<menu id="context-menu">
-  <button command="#open-in-new-tab-command"></button>
-  <button command="#open-in-new-window-command"></button>
-  <button command="#open-incognito-window-command"></button>
-  <hr>
-  <button command="#rename-folder-command"></button>
-  <button command="#edit-command"></button>
-  <button command="#delete-command"></button>
-  <button command="#show-in-folder-command"></button>
-  <hr>
-  <button command="#cut-command"></button>
-  <button command="#copy-command"></button>
-  <button command="#paste-command"></button>
-  <hr>
-  <button command="#add-new-bookmark-command"></button>
-  <button command="#new-folder-command"></button>
-</menu>
-
-<script>
-
-// Commands
-
-const Command = cr.ui.Command;
-const CommandBinding = cr.ui.CommandBinding;
-const Menu = cr.ui.Menu;
-const MenuButton  = cr.ui.MenuButton;
-
-cr.ui.decorate('menu', Menu);
-cr.ui.decorate('button[menu]', MenuButton);
-cr.ui.decorate('command', Command);
-
-cr.ui.contextMenuHandler.addContextMenuProperty(tree);
-list.contextMenu = $('context-menu');
-tree.contextMenu = $('context-menu');
-
-/**
- * Helper function that updates the canExecute and labels for the open like
- * commands.
- * @param {!cr.ui.CanExecuteEvent} e The event fired by the command system.
- * @param {!cr.ui.Command} command The command we are currently precessing.
- */
-function updateOpenCommands(e, command) {
-  var selectedItem = e.target.selectedItem;
-  var selectionCount;
-  if (e.target == tree)
-    selectionCount = selectedItem ? 1 : 0;
-  else
-    selectionCount = e.target.selectedItems.length;
-
-  var isFolder = selectionCount == 1 &&
-                 selectedItem.bookmarkNode &&
-                 bmm.isFolder(selectedItem.bookmarkNode);
-  var multiple = selectionCount != 1 || isFolder;
-
-  function hasBookmarks(node) {
-    var it = new bmm.TreeIterator(node);
-    while (it.moveNext()) {
-      if (!bmm.isFolder(it.current))
-        return true;
-    }
-    return false;
-  }
-
-  switch (command.id) {
-    case 'open-in-new-tab-command':
-      command.label = localStrings.getString(multiple ?
-          'open_all' : 'open_in_new_tab');
-      break;
-
-    case 'open-in-new-window-command':
-      command.label = localStrings.getString(multiple ?
-          'open_all_new_window' : 'open_in_new_window');
-      break;
-    case 'open-incognito-window-command':
-      command.label = localStrings.getString(multiple ?
-          'open_all_incognito' : 'open_incognito');
-      break;
-  }
-  e.canExecute = selectionCount > 0 && !!selectedItem.bookmarkNode;
-  if (isFolder && e.canExecute) {
-    // We need to get all the bookmark items in this tree. If the tree does not
-    // contain any non-folders we need to disable the command.
-    var p = bmm.loadSubtree(selectedItem.bookmarkId);
-    p.addListener(function(node) {
-      command.disabled = !node || !hasBookmarks(node);
-    });
-  }
-}
-
-/**
- * Calls the backend to figure out if we can paste the clipboard into the active
- * folder.
- * @param {Function=} opt_f Function to call after the state has been
- *     updated.
- */
-function updatePasteCommand(opt_f) {
-  function update(canPaste) {
-    var command = $('paste-command');
-    command.disabled = !canPaste;
-    if (opt_f)
-      opt_f();
-  }
-  // We cannot paste into search and recent view.
-  if (list.isSearch() || list.isRecent()) {
-    update(false);
-  } else {
-    chrome.experimental.bookmarkManager.canPaste(list.parentId, update);
-  }
-}
-
-// We can always execute the import-menu and export-menu commands.
-document.addEventListener('canExecute', function(e) {
-  var command = e.command;
-  var commandId = command.id;
-  if (commandId == 'import-menu-command' || commandId == 'export-menu-command') {
-    e.canExecute = true;
-  }
-});
-
-// Update canExecute for the commands when the list is the active element.
-list.addEventListener('canExecute', function(e) {
-  if (e.target != list) return;
-
-  var command = e.command;
-  var commandId = command.id;
-
-  function hasSelected() {
-    return !!e.target.selectedItem;
-  }
-
-  function hasSingleSelected() {
-    return e.target.selectedItems.length == 1;
-  }
-
-  function isRecentOrSearch() {
-    return list.isRecent() || list.isSearch();
-  }
-
-  switch (commandId) {
-    case 'rename-folder-command':
-      // Show rename if a single folder is selected
-      var items = e.target.selectedItems;
-      if (items.length != 1) {
-        e.canExecute = false;
-        command.hidden = true;
-      } else {
-        var isFolder = bmm.isFolder(items[0].bookmarkNode);
-        e.canExecute = isFolder;
-        command.hidden = !isFolder;
-      }
-      break;
-
-    case 'edit-command':
-      // Show the edit command if not a folder
-      var items = e.target.selectedItems;
-      if (items.length != 1) {
-        e.canExecute = false;
-        command.hidden = false;
-      } else {
-        var isFolder = bmm.isFolder(items[0].bookmarkNode);
-        e.canExecute = !isFolder;
-        command.hidden = isFolder;
-      }
-      break;
-
-    case 'show-in-folder-command':
-      e.canExecute = isRecentOrSearch() && hasSingleSelected();
-      break;
-
-    case 'delete-command':
-    case 'cut-command':
-    case 'copy-command':
-      e.canExecute = hasSelected();
-      break;
-
-    case 'paste-command':
-      updatePasteCommand();
-      break;
-
-    case 'sort-command':
-    case 'add-new-bookmark-command':
-    case 'new-folder-command':
-      e.canExecute = !isRecentOrSearch();
-      break;
-
-    case 'open-in-new-tab-command':
-    case 'open-in-new-window-command':
-    case 'open-incognito-window-command':
-      updateOpenCommands(e, command);
-      break;
-  }
-});
-
-// Update canExecute for the commands when the tree is the active element.
-tree.addEventListener('canExecute', function(e) {
-  if (e.target != tree) return;
-
-  var command = e.command;
-  var commandId = command.id;
-
-  function hasSelected() {
-    return !!e.target.selectedItem;
-  }
-
-  function isRecentOrSearch() {
-    var item = e.target.selectedItem;
-    return item == recentTreeItem || item == searchTreeItem;
-  }
-
-  function isTopLevelItem() {
-    return e.target.selectedItem.parentNode == tree;
-  }
-
-  switch (commandId) {
-    case 'rename-folder-command':
-      command.hidden = false;
-      e.canExecute = hasSelected() && !isTopLevelItem();
-      break;
-
-    case 'edit-command':
-      command.hidden = true;
-      e.canExecute = false;
-      break;
-
-    case 'delete-command':
-    case 'cut-command':
-    case 'copy-command':
-      e.canExecute = hasSelected() && !isTopLevelItem();
-      break;
-
-    case 'paste-command':
-      updatePasteCommand();
-      break;
-
-    case 'sort-command':
-    case 'add-new-bookmark-command':
-    case 'new-folder-command':
-      e.canExecute = !isRecentOrSearch();
-      break;
-
-    case 'open-in-new-tab-command':
-    case 'open-in-new-window-command':
-    case 'open-incognito-window-command':
-      updateOpenCommands(e, command);
-      break;
-  }
-});
-
-/**
- * Update the canExecute state of the commands when the selection changes.
- * @param {Event} e The change event object.
- */
-function updateCommandsBasedOnSelection(e) {
-  if (e.target == document.activeElement) {
-    // Paste only needs to updated when the tree selection changes.
-    var commandNames = ['copy', 'cut', 'delete', 'rename-folder', 'edit',
-        'add-new-bookmark', 'new-folder', 'open-in-new-tab',
-        'open-in-new-window', 'open-incognito-window'];
-
-    if (e.target == tree) {
-      commandNames.push('paste', 'show-in-folder', 'sort');
-    }
-
-    commandNames.forEach(function(baseId) {
-      $(baseId + '-command').canExecuteChange();
-    });
-  }
-}
-
-list.addEventListener('change', updateCommandsBasedOnSelection);
-tree.addEventListener('change', updateCommandsBasedOnSelection);
-
-document.addEventListener('command', function(e) {
-  var command = e.command;
-  var commandId = command.id;
-  console.log(command.id, 'executed', 'on', e.target);
-  if (commandId == 'import-menu-command') {
-    chrome.experimental.bookmarkManager.import();
-  } else if (command.id == 'export-menu-command') {
-    chrome.experimental.bookmarkManager.export();
-  }
-});
-
-function handleRename(e) {
-  var item = e.target;
-  var bookmarkNode = item.bookmarkNode;
-  chrome.bookmarks.update(bookmarkNode.id, {title: item.label});
-}
-
-tree.addEventListener('rename', handleRename);
-list.addEventListener('rename', handleRename);
-
-list.addEventListener('edit', function(e) {
-  var item = e.target;
-  var bookmarkNode = item.bookmarkNode;
-  var context = {
-    title: bookmarkNode.title
-  };
-  if (!bmm.isFolder(bookmarkNode))
-    context.url = bookmarkNode.url;
-
-  if (bookmarkNode.id == 'new') {
-    // New page
-    context.parentId = bookmarkNode.parentId;
-    chrome.bookmarks.create(context, function(node) {
-      list.remove(item);
-      list.selectedItem = bmm.listLookup[node.id];
-    });
-  } else {
-    // Edit
-    chrome.bookmarks.update(bookmarkNode.id, context);
-  }
-});
-
-list.addEventListener('canceledit', function(e) {
-  var item = e.target;
-  var bookmarkNode = item.bookmarkNode;
-  if (bookmarkNode.id == 'new') {
-    list.remove(item);
-    list.selectionModel.leadItem = list.lastChild;
-    list.selectionModel.anchorItem = list.lastChild;
-    list.focus();
-  }
-});
-
-/**
- * Navigates to the folder that the selected item is in and selects it. This is
- * used for the show-in-folder command.
- */
-function showInFolder() {
-  var bookmarkId = list.selectedItem.bookmarkNode.id;
-  var parentId = list.selectedItem.bookmarkNode.parentId;
-
-  // After the list is loaded we should select the revealed item.
-  var f = function(e) {
-    var item = bmm.listLookup[bookmarkId];
-    if (item) {
-      list.selectionModel.leadItem = item;
-      item.selected = true;
-    }
-    list.removeEventListener('load', f);
-  }
-  list.addEventListener('load', f);
-  var treeItem = bmm.treeLookup[parentId];
-  treeItem.reveal();
-
-  navigateTo(parentId);
-}
-
-/**
- * Opens URLs in new tab, window or incognito mode.
- * @param {!Array.<string>} urls The URLs to open.
- * @param {string} kind The kind is either 'tab', 'window', or 'incognito'.
- */
-function openUrls(urls, kind) {
-  if (urls.length < 1)
-    return;
-
-  if (urls.length > 15) {
-    if (!confirm(localStrings.getStringF('should_open_all', urls.length)))
-      return;
-  }
-
-  // Fix '#124' URLs since open those in a new window does not work. We prepend
-  // the base URL when we encounter those.
-  var base = window.location.href.split('#')[0];
-  urls = urls.map(function(url) {
-    return url[0] == '#' ? base + url : url;
-  });
-
-  // Incognito mode is not yet supported by the extensions APIs.
-  // http://code.google.com/p/chromium/issues/detail?id=12658
-  if (kind == 'window') {
-    chrome.windows.create({url: urls[0]}, function(window) {
-      urls.forEach(function(url, i) {
-        if (i > 0)
-          chrome.tabs.create({url: url, windowId: window.id, selected: false});
-      });
-    });
-  } else if (kind == 'tab') {
-    urls.forEach(function(url, i) {
-      chrome.tabs.create({url: url, selected: !i});
-    });
-  } else {
-    window.location.href = urls[0];
-  }
-}
-
-/**
- * Returns the selected bookmark nodes of the active element. Only call this
- * if the list or the tree is focused.
- * @return {!Array} Array of bookmark nodes.
- */
-function getSelectedBookmarkNodes() {
-  if (document.activeElement == list) {
-    return list.selectedItems.map(function(item) {
-      return item.bookmarkNode;
-    });
-  } else if (document.activeElement == tree) {
-    return [tree.selectedItem.bookmarkNode];
-  } else {
-    throw Error('getSelectedBookmarkNodes called when wrong element focused.');
-  }
-}
-
-/**
- * @return {!Array.<string>} An array of the selected bookmark IDs.
- */
-function getSelectedBookmarkIds() {
-  return getSelectedBookmarkNodes().map(function(node) {
-    return node.id;
-  });
-}
-
-/**
- * Opens the selected bookmarks.
- */
-function openBookmarks(kind) {
-  // If we have selected any folders we need to find all items recursively.
-  // We can do several async calls to getChildren but instead we do a single
-  // call to getTree and only add the subtrees of the selected items.
-
-  var urls = [];
-  var idMap = {};
-
-  // Traverses the tree until it finds a node tree that should be added. Then
-  // we switch over to use addNodes. We could merge these two functions into
-  // one but that would make the code less readable.
-  function traverseNodes(node) {
-    // This is not using the iterator since it uses breadth first search.
-    if (node.id in idMap) {
-      addNodes(node);
-    } else if (node.children) {
-      for (var i = 0; i < node.children.length; i++) {
-        traverseNodes(node.children[i]);
-      }
-    }
-  }
-
-  // Adds the node and all the descendants
-  function addNodes(node) {
-    var it = new bmm.TreeIterator(node);
-    while (it.moveNext()) {
-      var n = it.current;
-      if (!bmm.isFolder(n))
-        urls.push(n.url);
-    }
-  }
-
-  var nodes = getSelectedBookmarkNodes();
-
-  // Create a map for simpler lookup later.
-  nodes.forEach(function(node) {
-    idMap[node.id] = true;
-  });
-  var p = bmm.loadTree();
-  p.addListener(function(node) {
-    traverseNodes(node);
-    openUrls(urls, kind);
-  });
-}
-
-/**
- * Deletes the selected bookmarks.
- */
-function deleteBookmarks() {
-  getSelectedBookmarkIds().forEach(function(id) {
-    chrome.bookmarks.removeTree(id);
-  });
-}
-
-/**
- * Callback for the new folder command. This creates a new folder and starts
- * a rename of it.
- */
-function newFolder() {
-  var parentId = list.parentId;
-  var isTree = document.activeElement == tree;
-  chrome.bookmarks.create({
-    title: localStrings.getString('new_folder_name'),
-    parentId: parentId
-  }, function(newNode) {
-    // We need to do this in a timeout to be able to focus the newly created
-    // item.
-    setTimeout(function() {
-      var newItem = isTree ? bmm.treeLookup[newNode.id] :
-          bmm.listLookup[newNode.id];
-      document.activeElement.selectedItem = newItem;
-      newItem.editing = true;
-    });
-  });
-}
-
-/**
- * Adds a page to the current folder. This is called by the
- * add-new-bookmark-command handler.
- */
-function addPage() {
-  var parentId = list.parentId;
-  var fakeNode = {
-    title: '',
-    url: '',
-    parentId: parentId,
-    id: 'new'
-  };
-  var newListItem = bmm.createListItem(fakeNode, false);
-  list.add(newListItem);
-  list.selectedItem = newListItem;
-  newListItem.editing = true;
-}
-
-/**
- * Handler for the command event. This is used both for the tree and the list.
- * @param {!Event} e The event object.
- */
-function handleCommand(e) {
-  var command = e.command;
-  var commandId = command.id;
-  switch (commandId) {
-    case 'show-in-folder-command':
-      showInFolder();
-      break;
-    case 'open-in-new-tab-command':
-      openBookmarks('tab');
-      break;
-    case 'open-in-new-window-command':
-      openBookmarks('window');
-      break;
-    case 'open-in-new-incognito-command':
-      openBookmarks('incognito');
-      break;
-    case 'delete-command':
-      deleteBookmarks();
-      break;
-    case 'copy-command':
-      chrome.experimental.bookmarkManager.copy(getSelectedBookmarkIds());
-      break;
-    case 'cut-command':
-      chrome.experimental.bookmarkManager.cut(getSelectedBookmarkIds());
-      break;
-    case 'paste-command':
-      chrome.experimental.bookmarkManager.paste(list.parentId);
-      break;
-    case 'sort-command':
-      chrome.experimental.bookmarkManager.sortChildren(list.parentId);
-      break;
-    case 'rename-folder-command':
-    case 'edit-command':
-      document.activeElement.selectedItem.editing = true;
-      break;
-    case 'new-folder-command':
-      newFolder();
-      break;
-    case 'add-new-bookmark-command':
-      addPage();
-      break;
-  }
-}
-
-// TODO(arv): Move shortcut to HTML?
-
-// Meta+Backspace on Mac, Del on other platforms.
-$('delete-command').shortcut = cr.isMac ? 'U+0008-meta' : 'U+007F';
-
-list.addEventListener('command', handleCommand);
-tree.addEventListener('command', handleCommand);
-
-// Execute the copy, cut and paste commands when those events are dispatched by
-// the browser. This allows us to rely on the browser to handle the keyboard
-// shortcuts for these commands.
-(function() {
-  function handle(id) {
-    return function(e) {
-      var command = $(id);
-      if (!command.disabled) {
-        command.execute();
-        e.preventDefault(); // Prevent the system beep
-      }
-    };
-  }
-
-  // Listen to copy, cut and paste events and execute the associated commands.
-  document.addEventListener('copy', handle('copy-command'));
-  document.addEventListener('cut', handle('cut-command'));
-
-  var pasteHandler = handle('paste-command');
-  document.addEventListener('paste', function(e) {
-    // Paste is a bit special since we need to do an async call to see if we can
-    // paste because the paste command might not be up to date.
-    updatePasteCommand(pasteHandler);
-  });
-})();
-
-/**
- * The local strings object which is used to do the translation.
- * @type {!LocalStrings}
- */
-var localStrings = new LocalStrings;
-
-// Get the localized strings from the backend.
-chrome.experimental.bookmarkManager.getStrings(function setTemplateData(data) {
-  // The strings may contain & which we need to strip.
-  for (var key in data) {
-    data[key] = data[key].replace(/&/, '');
-  }
-
-  localStrings.templateData = data;
-  i18nTemplate.process(document, data);
-});
-
-</script>
-
-<div id="drop-overlay"></div>
-
-</body>
-</html>
diff --git a/resources/bookmark_manager/manifest.json b/resources/bookmark_manager/manifest.json
deleted file mode 100644
index 070bf6f..0000000
--- a/resources/bookmark_manager/manifest.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-  "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDQcByy+eN9jzazWF/DPn7NW47sW7lgmpk6eKc0BQM18q8hvEM3zNm2n7HkJv/R6fU+X5mtqkDuKvq5skF6qqUF4oEyaleWDFhd1xFwV7JV+/DU7bZ00w2+6gzqsabkerFpoP33ZRIw7OviJenP0c0uWqDWF8EGSyMhB3txqhOtiQIDAQAB",
-  "name": "Bookmark Manager",
-  "version": "0.1",
-  "description": "Bookmark Manager",
-  "icons": {
-    "16": "images/bookmarks_favicon.png"
-  },
-  "permissions": [
-    "bookmarks",
-    "experimental",
-    "tabs"
-  ],
-  "chrome_url_overrides": {
-    "bookmarks": "main.html"
-  }
-}
diff --git a/resources/inspector/DevTools.js b/resources/inspector/DevTools.js
index 8c598b3..f0e2e03 100644
--- a/resources/inspector/DevTools.js
+++ b/resources/inspector/DevTools.js
@@ -1,313 +1,349 @@
-/* utilities.js */
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-Object.proxyType = function(objectProxy)
-{
-    if (objectProxy === null)
-        return "null";
 
-    var type = typeof objectProxy;
-    if (type !== "object" && type !== "function")
-        return type;
 
-    return objectProxy.type;
-}
-
-Object.properties = function(obj)
-{
-    var properties = [];
-    for (var prop in obj)
-        properties.push(prop);
-    return properties;
-}
-
-Object.sortedProperties = function(obj, sortFunc)
-{
-    return Object.properties(obj).sort(sortFunc);
-}
 
 Function.prototype.bind = function(thisObject)
 {
-    var func = this;
-    var args = Array.prototype.slice.call(arguments, 1);
-    return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))) };
+var func = this;
+var args = Array.prototype.slice.call(arguments, 1);
+function bound()
+{
+return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0)));
+}
+bound.toString = function() {
+return "bound: " + func;
+};
+return bound;
 }
 
 Node.prototype.rangeOfWord = function(offset, stopCharacters, stayWithinNode, direction)
 {
-    var startNode;
-    var startOffset = 0;
-    var endNode;
-    var endOffset = 0;
+var startNode;
+var startOffset = 0;
+var endNode;
+var endOffset = 0;
 
-    if (!stayWithinNode)
-        stayWithinNode = this;
+if (!stayWithinNode)
+stayWithinNode = this;
 
-    if (!direction || direction === "backward" || direction === "both") {
-        var node = this;
-        while (node) {
-            if (node === stayWithinNode) {
-                if (!startNode)
-                    startNode = stayWithinNode;
-                break;
-            }
+if (!direction || direction === "backward" || direction === "both") {
+var node = this;
+while (node) {
+if (node === stayWithinNode) {
+if (!startNode)
+startNode = stayWithinNode;
+break;
+}
 
-            if (node.nodeType === Node.TEXT_NODE) {
-                var start = (node === this ? (offset - 1) : (node.nodeValue.length - 1));
-                for (var i = start; i >= 0; --i) {
-                    if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {
-                        startNode = node;
-                        startOffset = i + 1;
-                        break;
-                    }
-                }
-            }
+if (node.nodeType === Node.TEXT_NODE) {
+var start = (node === this ? (offset - 1) : (node.nodeValue.length - 1));
+for (var i = start; i >= 0; --i) {
+if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {
+startNode = node;
+startOffset = i + 1;
+break;
+}
+}
+}
 
-            if (startNode)
-                break;
+if (startNode)
+break;
 
-            node = node.traversePreviousNode(stayWithinNode);
-        }
+node = node.traversePreviousNode(stayWithinNode);
+}
 
-        if (!startNode) {
-            startNode = stayWithinNode;
-            startOffset = 0;
-        }
-    } else {
-        startNode = this;
-        startOffset = offset;
-    }
+if (!startNode) {
+startNode = stayWithinNode;
+startOffset = 0;
+}
+} else {
+startNode = this;
+startOffset = offset;
+}
 
-    if (!direction || direction === "forward" || direction === "both") {
-        node = this;
-        while (node) {
-            if (node === stayWithinNode) {
-                if (!endNode)
-                    endNode = stayWithinNode;
-                break;
-            }
+if (!direction || direction === "forward" || direction === "both") {
+node = this;
+while (node) {
+if (node === stayWithinNode) {
+if (!endNode)
+endNode = stayWithinNode;
+break;
+}
 
-            if (node.nodeType === Node.TEXT_NODE) {
-                var start = (node === this ? offset : 0);
-                for (var i = start; i < node.nodeValue.length; ++i) {
-                    if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {
-                        endNode = node;
-                        endOffset = i;
-                        break;
-                    }
-                }
-            }
+if (node.nodeType === Node.TEXT_NODE) {
+var start = (node === this ? offset : 0);
+for (var i = start; i < node.nodeValue.length; ++i) {
+if (stopCharacters.indexOf(node.nodeValue[i]) !== -1) {
+endNode = node;
+endOffset = i;
+break;
+}
+}
+}
 
-            if (endNode)
-                break;
+if (endNode)
+break;
 
-            node = node.traverseNextNode(stayWithinNode);
-        }
+node = node.traverseNextNode(stayWithinNode);
+}
 
-        if (!endNode) {
-            endNode = stayWithinNode;
-            endOffset = stayWithinNode.nodeType === Node.TEXT_NODE ? stayWithinNode.nodeValue.length : stayWithinNode.childNodes.length;
-        }
-    } else {
-        endNode = this;
-        endOffset = offset;
-    }
+if (!endNode) {
+endNode = stayWithinNode;
+endOffset = stayWithinNode.nodeType === Node.TEXT_NODE ? stayWithinNode.nodeValue.length : stayWithinNode.childNodes.length;
+}
+} else {
+endNode = this;
+endOffset = offset;
+}
 
-    var result = this.ownerDocument.createRange();
-    result.setStart(startNode, startOffset);
-    result.setEnd(endNode, endOffset);
+var result = this.ownerDocument.createRange();
+result.setStart(startNode, startOffset);
+result.setEnd(endNode, endOffset);
 
-    return result;
+return result;
 }
 
 Node.prototype.traverseNextTextNode = function(stayWithin)
 {
-    var node = this.traverseNextNode(stayWithin);
-    if (!node)
-        return;
+var node = this.traverseNextNode(stayWithin);
+if (!node)
+return;
 
-    while (node && node.nodeType !== Node.TEXT_NODE)
-        node = node.traverseNextNode(stayWithin);
+while (node && node.nodeType !== Node.TEXT_NODE)
+node = node.traverseNextNode(stayWithin);
 
-    return node;
+return node;
 }
 
 Node.prototype.rangeBoundaryForOffset = function(offset)
 {
-    var node = this.traverseNextTextNode(this);
-    while (node && offset > node.nodeValue.length) {
-        offset -= node.nodeValue.length;
-        node = node.traverseNextTextNode(this);
-    }
-    if (!node)
-        return { container: this, offset: 0 };
-    return { container: node, offset: offset };
+var node = this.traverseNextTextNode(this);
+while (node && offset > node.nodeValue.length) {
+offset -= node.nodeValue.length;
+node = node.traverseNextTextNode(this);
+}
+if (!node)
+return { container: this, offset: 0 };
+return { container: node, offset: offset };
 }
 
 Element.prototype.removeStyleClass = function(className) 
 {
-    // Test for the simple case first.
-    if (this.className === className) {
-        this.className = "";
-        return;
-    }
 
-    var index = this.className.indexOf(className);
-    if (index === -1)
-        return;
+if (this.className === className) {
+this.className = "";
+return;
+}
 
-    var newClassName = " " + this.className + " ";
-    this.className = newClassName.replace(" " + className + " ", " ");
+var index = this.className.indexOf(className);
+if (index === -1)
+return;
+
+this.className = this.className.split(" ").filter(function(s) {
+return s && s !== className;
+}).join(" ");
 }
 
 Element.prototype.removeMatchingStyleClasses = function(classNameRegex)
 {
-    var regex = new RegExp("(^|\\s+)" + classNameRegex + "($|\\s+)");
-    if (regex.test(this.className))
-        this.className = this.className.replace(regex, " ");
+var regex = new RegExp("(^|\\s+)" + classNameRegex + "($|\\s+)");
+if (regex.test(this.className))
+this.className = this.className.replace(regex, " ");
 }
 
 Element.prototype.addStyleClass = function(className) 
 {
-    if (className && !this.hasStyleClass(className))
-        this.className += (this.className.length ? " " + className : className);
+if (className && !this.hasStyleClass(className))
+this.className += (this.className.length ? " " + className : className);
 }
 
 Element.prototype.hasStyleClass = function(className) 
 {
-    if (!className)
-        return false;
-    // Test for the simple case
-    if (this.className === className)
-        return true;
+if (!className)
+return false;
 
-    var index = this.className.indexOf(className);
-    if (index === -1)
-        return false;
-    var toTest = " " + this.className + " ";
-    return toTest.indexOf(" " + className + " ", index) !== -1;
+if (this.className === className)
+return true;
+
+var index = this.className.indexOf(className);
+if (index === -1)
+return false;
+var toTest = " " + this.className + " ";
+return toTest.indexOf(" " + className + " ", index) !== -1;
 }
 
 Element.prototype.positionAt = function(x, y)
 {
-    this.style.left = x + "px";
-    this.style.top = y + "px";
+this.style.left = x + "px";
+this.style.top = y + "px";
+}
+
+Element.prototype.pruneEmptyTextNodes = function()
+{
+var sibling = this.firstChild;
+while (sibling) {
+var nextSibling = sibling.nextSibling;
+if (sibling.nodeType === this.TEXT_NODE && sibling.nodeValue === "")
+this.removeChild(sibling);
+sibling = nextSibling;
+}
 }
 
 Node.prototype.enclosingNodeOrSelfWithNodeNameInArray = function(nameArray)
 {
-    for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
-        for (var i = 0; i < nameArray.length; ++i)
-            if (node.nodeName.toLowerCase() === nameArray[i].toLowerCase())
-                return node;
-    return null;
+for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
+for (var i = 0; i < nameArray.length; ++i)
+if (node.nodeName.toLowerCase() === nameArray[i].toLowerCase())
+return node;
+return null;
 }
 
 Node.prototype.enclosingNodeOrSelfWithNodeName = function(nodeName)
 {
-    return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);
+return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);
 }
 
 Node.prototype.enclosingNodeOrSelfWithClass = function(className)
 {
-    for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
-        if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className))
-            return node;
-    return null;
+for (var node = this; node && node !== this.ownerDocument; node = node.parentNode)
+if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className))
+return node;
+return null;
 }
 
 Node.prototype.enclosingNodeWithClass = function(className)
 {
-    if (!this.parentNode)
-        return null;
-    return this.parentNode.enclosingNodeOrSelfWithClass(className);
+if (!this.parentNode)
+return null;
+return this.parentNode.enclosingNodeOrSelfWithClass(className);
 }
 
 Element.prototype.query = function(query) 
 {
-    return this.ownerDocument.evaluate(query, this, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
+return this.ownerDocument.evaluate(query, this, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
 }
 
 Element.prototype.removeChildren = function()
 {
-    this.innerHTML = "";
+if (this.firstChild)
+this.textContent = "";
 }
 
 Element.prototype.isInsertionCaretInside = function()
 {
-    var selection = window.getSelection();
-    if (!selection.rangeCount || !selection.isCollapsed)
-        return false;
-    var selectionRange = selection.getRangeAt(0);
-    return selectionRange.startContainer === this || selectionRange.startContainer.isDescendant(this);
+var selection = window.getSelection();
+if (!selection.rangeCount || !selection.isCollapsed)
+return false;
+var selectionRange = selection.getRangeAt(0);
+return selectionRange.startContainer === this || selectionRange.startContainer.isDescendant(this);
+}
+
+Element.prototype.createChild = function(elementName, className)
+{
+var element = document.createElement(elementName);
+if (className)
+element.className = className;
+this.appendChild(element);
+return element;
 }
 
 Element.prototype.__defineGetter__("totalOffsetLeft", function()
 {
-    var total = 0;
-    for (var element = this; element; element = element.offsetParent)
-        total += element.offsetLeft + (this !== element ? element.clientLeft : 0);
-    return total;
+var total = 0;
+for (var element = this; element; element = element.offsetParent)
+total += element.offsetLeft + (this !== element ? element.clientLeft : 0);
+return total;
 });
 
 Element.prototype.__defineGetter__("totalOffsetTop", function()
 {
-    var total = 0;
-    for (var element = this; element; element = element.offsetParent)
-        total += element.offsetTop + (this !== element ? element.clientTop : 0);
-    return total;
+var total = 0;
+for (var element = this; element; element = element.offsetParent)
+total += element.offsetTop + (this !== element ? element.clientTop : 0);
+return total;
 });
 
 Element.prototype.offsetRelativeToWindow = function(targetWindow)
 {
-    var elementOffset = {x: 0, y: 0};
-    var curElement = this;
-    var curWindow = this.ownerDocument.defaultView;
-    while (curWindow && curElement) {
-        elementOffset.x += curElement.totalOffsetLeft;
-        elementOffset.y += curElement.totalOffsetTop;
-        if (curWindow === targetWindow)
-            break;
+var elementOffset = {x: 0, y: 0};
+var curElement = this;
+var curWindow = this.ownerDocument.defaultView;
+while (curWindow && curElement) {
+elementOffset.x += curElement.totalOffsetLeft;
+elementOffset.y += curElement.totalOffsetTop;
+if (curWindow === targetWindow)
+break;
 
-        curElement = curWindow.frameElement;
-        curWindow = curWindow.parent;
-    }
-
-    return elementOffset;
+curElement = curWindow.frameElement;
+curWindow = curWindow.parent;
 }
 
+return elementOffset;
+}
+
+KeyboardEvent.prototype.__defineGetter__("data", function()
+{
+
+
+switch (this.type) {
+case "keypress":
+if (!this.ctrlKey && !this.metaKey)
+return String.fromCharCode(this.charCode);
+else
+return "";
+case "keydown":
+case "keyup":
+if (!this.ctrlKey && !this.metaKey && !this.altKey)
+return String.fromCharCode(this.which);
+else
+return "";
+}
+});
+
+Text.prototype.select = function(start, end)
+{
+start = start || 0;
+end = end || this.textContent.length;
+
+if (start < 0)
+start = end + start;
+
+var selection = window.getSelection();
+selection.removeAllRanges();
+var range = document.createRange();
+range.setStart(this, start);
+range.setEnd(this, end);
+selection.addRange(range);
+return this;
+}
+
+Element.prototype.__defineGetter__("selectionLeftOffset", function() {
+
+
+var selection = window.getSelection();
+if (!selection.containsNode(this, true))
+return null;
+
+var leftOffset = selection.anchorOffset;
+var node = selection.anchorNode;
+
+while (node !== this) {
+while (node.previousSibling) {
+node = node.previousSibling;
+leftOffset += node.textContent.length;
+}
+node = node.parentNode;
+}
+
+return leftOffset;
+});
+
 Node.prototype.isWhitespace = isNodeWhitespace;
 Node.prototype.displayName = nodeDisplayName;
 Node.prototype.isAncestor = function(node)
 {
-    return isAncestorNode(this, node);
+return isAncestorNode(this, node);
 };
 Node.prototype.isDescendant = isDescendantNode;
 Node.prototype.traverseNextNode = traverseNextNode;
@@ -316,1024 +352,1086 @@
 
 String.prototype.hasSubstring = function(string, caseInsensitive)
 {
-    if (!caseInsensitive)
-        return this.indexOf(string) !== -1;
-    return this.match(new RegExp(string.escapeForRegExp(), "i"));
+if (!caseInsensitive)
+return this.indexOf(string) !== -1;
+return this.match(new RegExp(string.escapeForRegExp(), "i"));
+}
+
+String.prototype.asParsedURL = function()
+{
+
+
+
+
+
+
+var match = this.match(/^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);
+if (!match)
+return null;
+var result = {};
+result.scheme = match[1].toLowerCase();
+result.host = match[2];
+result.port = match[3];
+result.path = match[4] || "/";
+result.fragment = match[5];
+return result;
 }
 
 String.prototype.escapeCharacters = function(chars)
 {
-    var foundChar = false;
-    for (var i = 0; i < chars.length; ++i) {
-        if (this.indexOf(chars.charAt(i)) !== -1) {
-            foundChar = true;
-            break;
-        }
-    }
+var foundChar = false;
+for (var i = 0; i < chars.length; ++i) {
+if (this.indexOf(chars.charAt(i)) !== -1) {
+foundChar = true;
+break;
+}
+}
 
-    if (!foundChar)
-        return this;
+if (!foundChar)
+return this;
 
-    var result = "";
-    for (var i = 0; i < this.length; ++i) {
-        if (chars.indexOf(this.charAt(i)) !== -1)
-            result += "\\";
-        result += this.charAt(i);
-    }
+var result = "";
+for (var i = 0; i < this.length; ++i) {
+if (chars.indexOf(this.charAt(i)) !== -1)
+result += "\\";
+result += this.charAt(i);
+}
 
-    return result;
+return result;
 }
 
 String.prototype.escapeForRegExp = function()
 {
-    return this.escapeCharacters("^[]{}()\\.$*+?|");
+return this.escapeCharacters("^[]{}()\\.$*+?|");
 }
 
 String.prototype.escapeHTML = function()
 {
-    return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
+return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
 }
 
 String.prototype.collapseWhitespace = function()
 {
-    return this.replace(/[\s\xA0]+/g, " ");
+return this.replace(/[\s\xA0]+/g, " ");
 }
 
 String.prototype.trimURL = function(baseURLDomain)
 {
-    var result = this.replace(/^https?:\/\//i, "");
-    if (baseURLDomain)
-        result = result.replace(new RegExp("^" + baseURLDomain.escapeForRegExp(), "i"), "");
-    return result;
+var result = this.replace(/^(https|http|file):\/\//i, "");
+if (baseURLDomain)
+result = result.replace(new RegExp("^" + baseURLDomain.escapeForRegExp(), "i"), "");
+return result;
 }
 
 function isNodeWhitespace()
 {
-    if (!this || this.nodeType !== Node.TEXT_NODE)
-        return false;
-    if (!this.nodeValue.length)
-        return true;
-    return this.nodeValue.match(/^[\s\xA0]+$/);
+if (!this || this.nodeType !== Node.TEXT_NODE)
+return false;
+if (!this.nodeValue.length)
+return true;
+return this.nodeValue.match(/^[\s\xA0]+$/);
 }
 
 function nodeDisplayName()
 {
-    if (!this)
-        return "";
+if (!this)
+return "";
 
-    switch (this.nodeType) {
-        case Node.DOCUMENT_NODE:
-            return "Document";
+switch (this.nodeType) {
+case Node.DOCUMENT_NODE:
+return "Document";
 
-        case Node.ELEMENT_NODE:
-            var name = "<" + this.nodeName.toLowerCase();
+case Node.ELEMENT_NODE:
+var name = "<" + this.nodeName.toLowerCase();
 
-            if (this.hasAttributes()) {
-                var value = this.getAttribute("id");
-                if (value)
-                    name += " id=\"" + value + "\"";
-                value = this.getAttribute("class");
-                if (value)
-                    name += " class=\"" + value + "\"";
-                if (this.nodeName.toLowerCase() === "a") {
-                    value = this.getAttribute("name");
-                    if (value)
-                        name += " name=\"" + value + "\"";
-                    value = this.getAttribute("href");
-                    if (value)
-                        name += " href=\"" + value + "\"";
-                } else if (this.nodeName.toLowerCase() === "img") {
-                    value = this.getAttribute("src");
-                    if (value)
-                        name += " src=\"" + value + "\"";
-                } else if (this.nodeName.toLowerCase() === "iframe") {
-                    value = this.getAttribute("src");
-                    if (value)
-                        name += " src=\"" + value + "\"";
-                } else if (this.nodeName.toLowerCase() === "input") {
-                    value = this.getAttribute("name");
-                    if (value)
-                        name += " name=\"" + value + "\"";
-                    value = this.getAttribute("type");
-                    if (value)
-                        name += " type=\"" + value + "\"";
-                } else if (this.nodeName.toLowerCase() === "form") {
-                    value = this.getAttribute("action");
-                    if (value)
-                        name += " action=\"" + value + "\"";
-                }
-            }
+if (this.hasAttributes()) {
+var value = this.getAttribute("id");
+if (value)
+name += " id=\"" + value + "\"";
+value = this.getAttribute("class");
+if (value)
+name += " class=\"" + value + "\"";
+if (this.nodeName.toLowerCase() === "a") {
+value = this.getAttribute("name");
+if (value)
+name += " name=\"" + value + "\"";
+value = this.getAttribute("href");
+if (value)
+name += " href=\"" + value + "\"";
+} else if (this.nodeName.toLowerCase() === "img") {
+value = this.getAttribute("src");
+if (value)
+name += " src=\"" + value + "\"";
+} else if (this.nodeName.toLowerCase() === "iframe") {
+value = this.getAttribute("src");
+if (value)
+name += " src=\"" + value + "\"";
+} else if (this.nodeName.toLowerCase() === "input") {
+value = this.getAttribute("name");
+if (value)
+name += " name=\"" + value + "\"";
+value = this.getAttribute("type");
+if (value)
+name += " type=\"" + value + "\"";
+} else if (this.nodeName.toLowerCase() === "form") {
+value = this.getAttribute("action");
+if (value)
+name += " action=\"" + value + "\"";
+}
+}
 
-            return name + ">";
+return name + ">";
 
-        case Node.TEXT_NODE:
-            if (isNodeWhitespace.call(this))
-                return "(whitespace)";
-            return "\"" + this.nodeValue + "\"";
+case Node.TEXT_NODE:
+if (isNodeWhitespace.call(this))
+return "(whitespace)";
+return "\"" + this.nodeValue + "\"";
 
-        case Node.COMMENT_NODE:
-            return "<!--" + this.nodeValue + "-->";
-            
-        case Node.DOCUMENT_TYPE_NODE:
-            var docType = "<!DOCTYPE " + this.nodeName;
-            if (this.publicId) {
-                docType += " PUBLIC \"" + this.publicId + "\"";
-                if (this.systemId)
-                    docType += " \"" + this.systemId + "\"";
-            } else if (this.systemId)
-                docType += " SYSTEM \"" + this.systemId + "\"";
-            if (this.internalSubset)
-                docType += " [" + this.internalSubset + "]";
-            return docType + ">";
-    }
+case Node.COMMENT_NODE:
+return "<!--" + this.nodeValue + "-->";
 
-    return this.nodeName.toLowerCase().collapseWhitespace();
+case Node.DOCUMENT_TYPE_NODE:
+var docType = "<!DOCTYPE " + this.nodeName;
+if (this.publicId) {
+docType += " PUBLIC \"" + this.publicId + "\"";
+if (this.systemId)
+docType += " \"" + this.systemId + "\"";
+} else if (this.systemId)
+docType += " SYSTEM \"" + this.systemId + "\"";
+if (this.internalSubset)
+docType += " [" + this.internalSubset + "]";
+return docType + ">";
+}
+
+return this.nodeName.toLowerCase().collapseWhitespace();
 }
 
 function isAncestorNode(ancestor, node)
 {
-    if (!node || !ancestor)
-        return false;
+if (!node || !ancestor)
+return false;
 
-    var currentNode = node.parentNode;
-    while (currentNode) {
-        if (ancestor === currentNode)
-            return true;
-        currentNode = currentNode.parentNode;
-    }
-    return false;
+var currentNode = node.parentNode;
+while (currentNode) {
+if (ancestor === currentNode)
+return true;
+currentNode = currentNode.parentNode;
+}
+return false;
 }
 
 function isDescendantNode(descendant)
 {
-    return isAncestorNode(descendant, this);
+return isAncestorNode(descendant, this);
 }
 
 function traverseNextNode(stayWithin)
 {
-    if (!this)
-        return;
+if (!this)
+return;
 
-    var node = this.firstChild;
-    if (node)
-        return node;
+var node = this.firstChild;
+if (node)
+return node;
 
-    if (stayWithin && this === stayWithin)
-        return null;
+if (stayWithin && this === stayWithin)
+return null;
 
-    node = this.nextSibling;
-    if (node)
-        return node;
+node = this.nextSibling;
+if (node)
+return node;
 
-    node = this;
-    while (node && !node.nextSibling && (!stayWithin || !node.parentNode || node.parentNode !== stayWithin))
-        node = node.parentNode;
-    if (!node)
-        return null;
+node = this;
+while (node && !node.nextSibling && (!stayWithin || !node.parentNode || node.parentNode !== stayWithin))
+node = node.parentNode;
+if (!node)
+return null;
 
-    return node.nextSibling;
+return node.nextSibling;
 }
 
 function traversePreviousNode(stayWithin)
 {
-    if (!this)
-        return;
-    if (stayWithin && this === stayWithin)
-        return null;
-    var node = this.previousSibling;
-    while (node && node.lastChild)
-        node = node.lastChild;
-    if (node)
-        return node;
-    return this.parentNode;
+if (!this)
+return;
+if (stayWithin && this === stayWithin)
+return null;
+var node = this.previousSibling;
+while (node && node.lastChild)
+node = node.lastChild;
+if (node)
+return node;
+return this.parentNode;
 }
 
 function onlyTextChild()
 {
-    if (!this)
-        return null;
+if (!this)
+return null;
 
-    var firstChild = this.firstChild;
-    if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE)
-        return null;
+var firstChild = this.firstChild;
+if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE)
+return null;
 
-    var sibling = firstChild.nextSibling;
-    return sibling ? null : firstChild;
+var sibling = firstChild.nextSibling;
+return sibling ? null : firstChild;
 }
 
 function appropriateSelectorForNode(node, justSelector)
 {
-    if (!node)
-        return "";
+if (!node)
+return "";
 
-    var lowerCaseName = node.localName || node.nodeName.toLowerCase();
+var lowerCaseName = node.localName || node.nodeName.toLowerCase();
 
-    var id = node.getAttribute("id");
-    if (id) {
-        var selector = "#" + id;
-        return (justSelector ? selector : lowerCaseName + selector);
-    }
+var id = node.getAttribute("id");
+if (id) {
+var selector = "#" + id;
+return (justSelector ? selector : lowerCaseName + selector);
+}
 
-    var className = node.getAttribute("class");
-    if (className) {
-        var selector = "." + className.replace(/\s+/, ".");
-        return (justSelector ? selector : lowerCaseName + selector);
-    }
+var className = node.getAttribute("class");
+if (className) {
+var selector = "." + className.replace(/\s+/, ".");
+return (justSelector ? selector : lowerCaseName + selector);
+}
 
-    if (lowerCaseName === "input" && node.getAttribute("type"))
-        return lowerCaseName + "[type=\"" + node.getAttribute("type") + "\"]";
+if (lowerCaseName === "input" && node.getAttribute("type"))
+return lowerCaseName + "[type=\"" + node.getAttribute("type") + "\"]";
 
-    return lowerCaseName;
+return lowerCaseName;
 }
 
 function getDocumentForNode(node)
 {
-    return node.nodeType == Node.DOCUMENT_NODE ? node : node.ownerDocument;
+return node.nodeType == Node.DOCUMENT_NODE ? node : node.ownerDocument;
 }
 
 function parentNode(node)
 {
-    return node.parentNode;
+return node.parentNode;
+}
+
+Number.millisToString = function(ms, formatterFunction, higherResolution)
+{
+return Number.secondsToString(ms / 1000, formatterFunction, higherResolution);
 }
 
 Number.secondsToString = function(seconds, formatterFunction, higherResolution)
 {
-    if (!formatterFunction)
-        formatterFunction = String.sprintf;
+if (!formatterFunction)
+formatterFunction = String.sprintf;
 
-    if (seconds === 0)
-        return "0";
+if (seconds === 0)
+return "0";
 
-    var ms = seconds * 1000;
-    if (higherResolution && ms < 1000)
-        return formatterFunction("%.3fms", ms);
-    else if (ms < 1000)
-        return formatterFunction("%.0fms", ms);
+var ms = seconds * 1000;
+if (higherResolution && ms < 1000)
+return formatterFunction("%.3fms", ms);
+else if (ms < 1000)
+return formatterFunction("%.0fms", ms);
 
-    if (seconds < 60)
-        return formatterFunction("%.2fs", seconds);
+if (seconds < 60)
+return formatterFunction("%.2fs", seconds);
 
-    var minutes = seconds / 60;
-    if (minutes < 60)
-        return formatterFunction("%.1fmin", minutes);
+var minutes = seconds / 60;
+if (minutes < 60)
+return formatterFunction("%.1fmin", minutes);
 
-    var hours = minutes / 60;
-    if (hours < 24)
-        return formatterFunction("%.1fhrs", hours);
+var hours = minutes / 60;
+if (hours < 24)
+return formatterFunction("%.1fhrs", hours);
 
-    var days = hours / 24;
-    return formatterFunction("%.1f days", days);
+var days = hours / 24;
+return formatterFunction("%.1f days", days);
 }
 
 Number.bytesToString = function(bytes, formatterFunction, higherResolution)
 {
-    if (!formatterFunction)
-        formatterFunction = String.sprintf;
-    if (typeof higherResolution === "undefined")
-        higherResolution = true;
+if (!formatterFunction)
+formatterFunction = String.sprintf;
+if (typeof higherResolution === "undefined")
+higherResolution = true;
 
-    if (bytes < 1024)
-        return formatterFunction("%.0fB", bytes);
+if (bytes < 1024)
+return formatterFunction("%.0fB", bytes);
 
-    var kilobytes = bytes / 1024;
-    if (higherResolution && kilobytes < 1024)
-        return formatterFunction("%.2fKB", kilobytes);
-    else if (kilobytes < 1024)
-        return formatterFunction("%.0fKB", kilobytes);
+var kilobytes = bytes / 1024;
+if (higherResolution && kilobytes < 1024)
+return formatterFunction("%.2fKB", kilobytes);
+else if (kilobytes < 1024)
+return formatterFunction("%.0fKB", kilobytes);
 
-    var megabytes = kilobytes / 1024;
-    if (higherResolution)
-        return formatterFunction("%.3fMB", megabytes);
-    else
-        return formatterFunction("%.0fMB", megabytes);
+var megabytes = kilobytes / 1024;
+if (higherResolution)
+return formatterFunction("%.2fMB", megabytes);
+else
+return formatterFunction("%.0fMB", megabytes);
 }
 
 Number.constrain = function(num, min, max)
 {
-    if (num < min)
-        num = min;
-    else if (num > max)
-        num = max;
-    return num;
+if (num < min)
+num = min;
+else if (num > max)
+num = max;
+return num;
 }
 
 HTMLTextAreaElement.prototype.moveCursorToEnd = function()
 {
-    var length = this.value.length;
-    this.setSelectionRange(length, length);
+var length = this.value.length;
+this.setSelectionRange(length, length);
 }
 
 Array.prototype.remove = function(value, onlyFirst)
 {
-    if (onlyFirst) {
-        var index = this.indexOf(value);
-        if (index !== -1)
-            this.splice(index, 1);
-        return;
-    }
+if (onlyFirst) {
+var index = this.indexOf(value);
+if (index !== -1)
+this.splice(index, 1);
+return;
+}
 
-    var length = this.length;
-    for (var i = 0; i < length; ++i) {
-        if (this[i] === value)
-            this.splice(i, 1);
-    }
+var length = this.length;
+for (var i = 0; i < length; ++i) {
+if (this[i] === value)
+this.splice(i, 1);
+}
 }
 
 Array.prototype.keySet = function()
 {
-    var keys = {};
-    for (var i = 0; i < this.length; ++i)
-        keys[this[i]] = true;
-    return keys;
+var keys = {};
+for (var i = 0; i < this.length; ++i)
+keys[this[i]] = true;
+return keys;
+}
+
+Array.diff = function(left, right)
+{
+var o = left;
+var n = right;
+
+var ns = {};
+var os = {};
+
+for (var i = 0; i < n.length; i++) {
+if (ns[n[i]] == null)
+ns[n[i]] = { rows: [], o: null };
+ns[n[i]].rows.push(i);
+}
+
+for (var i = 0; i < o.length; i++) {
+if (os[o[i]] == null)
+os[o[i]] = { rows: [], n: null };
+os[o[i]].rows.push(i);
+}
+
+for (var i in ns) {
+if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
+n[ns[i].rows[0]] = { text: n[ns[i].rows[0]], row: os[i].rows[0] };
+o[os[i].rows[0]] = { text: o[os[i].rows[0]], row: ns[i].rows[0] };
+}
+}
+
+for (var i = 0; i < n.length - 1; i++) {
+if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && n[i + 1] == o[n[i].row + 1]) {
+n[i + 1] = { text: n[i + 1], row: n[i].row + 1 };
+o[n[i].row + 1] = { text: o[n[i].row + 1], row: i + 1 };
+}
+}
+
+for (var i = n.length - 1; i > 0; i--) {
+if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && 
+n[i - 1] == o[n[i].row - 1]) {
+n[i - 1] = { text: n[i - 1], row: n[i].row - 1 };
+o[n[i].row - 1] = { text: o[n[i].row - 1], row: i - 1 };
+}
+}
+
+return { left: o, right: n };
+}
+
+Array.convert = function(list)
+{
+
+return Array.prototype.slice.call(list);
 }
 
 function insertionIndexForObjectInListSortedByFunction(anObject, aList, aFunction)
 {
-    // indexOf returns (-lowerBound - 1). Taking (-result - 1) works out to lowerBound.
-    return (-indexOfObjectInListSortedByFunction(anObject, aList, aFunction) - 1);
+var first = 0;
+var last = aList.length - 1;
+var floor = Math.floor;
+var mid, c;
+
+while (first <= last) {
+mid = floor((first + last) / 2);
+c = aFunction(anObject, aList[mid]);
+
+if (c > 0)
+first = mid + 1;
+else if (c < 0)
+last = mid - 1;
+else {
+
+while (mid > 0 && aFunction(anObject, aList[mid - 1]) === 0)
+mid--;
+first = mid;
+break;
+}
 }
 
-function indexOfObjectInListSortedByFunction(anObject, aList, aFunction)
-{
-    var first = 0;
-    var last = aList.length - 1;
-    var floor = Math.floor;
-    var mid, c;
-
-    while (first <= last) {
-        mid = floor((first + last) / 2);
-        c = aFunction(anObject, aList[mid]);
-
-        if (c > 0)
-            first = mid + 1;
-        else if (c < 0)
-            last = mid - 1;
-        else {
-            // Return the first occurance of an item in the list.
-            while (mid > 0 && aFunction(anObject, aList[mid - 1]) === 0)
-                mid--;
-            first = mid;
-            break;
-        }
-    }
-
-    // By returning 1 less than the negative lower search bound, we can reuse this function
-    // for both indexOf and insertionIndexFor, with some simple arithmetic.
-    return (-first - 1);
+return first;
 }
 
 String.sprintf = function(format)
 {
-    return String.vsprintf(format, Array.prototype.slice.call(arguments, 1));
+return String.vsprintf(format, Array.prototype.slice.call(arguments, 1));
 }
 
 String.tokenizeFormatString = function(format)
 {
-    var tokens = [];
-    var substitutionIndex = 0;
+var tokens = [];
+var substitutionIndex = 0;
 
-    function addStringToken(str)
-    {
-        tokens.push({ type: "string", value: str });
-    }
+function addStringToken(str)
+{
+tokens.push({ type: "string", value: str });
+}
 
-    function addSpecifierToken(specifier, precision, substitutionIndex)
-    {
-        tokens.push({ type: "specifier", specifier: specifier, precision: precision, substitutionIndex: substitutionIndex });
-    }
+function addSpecifierToken(specifier, precision, substitutionIndex)
+{
+tokens.push({ type: "specifier", specifier: specifier, precision: precision, substitutionIndex: substitutionIndex });
+}
 
-    var index = 0;
-    for (var precentIndex = format.indexOf("%", index); precentIndex !== -1; precentIndex = format.indexOf("%", index)) {
-        addStringToken(format.substring(index, precentIndex));
-        index = precentIndex + 1;
+var index = 0;
+for (var precentIndex = format.indexOf("%", index); precentIndex !== -1; precentIndex = format.indexOf("%", index)) {
+addStringToken(format.substring(index, precentIndex));
+index = precentIndex + 1;
 
-        if (format[index] === "%") {
-            addStringToken("%");
-            ++index;
-            continue;
-        }
+if (format[index] === "%") {
+addStringToken("%");
+++index;
+continue;
+}
 
-        if (!isNaN(format[index])) {
-            // The first character is a number, it might be a substitution index.
-            var number = parseInt(format.substring(index));
-            while (!isNaN(format[index]))
-                ++index;
-            // If the number is greater than zero and ends with a "$",
-            // then this is a substitution index.
-            if (number > 0 && format[index] === "$") {
-                substitutionIndex = (number - 1);
-                ++index;
-            }
-        }
+if (!isNaN(format[index])) {
 
-        var precision = -1;
-        if (format[index] === ".") {
-            // This is a precision specifier. If no digit follows the ".",
-            // then the precision should be zero.
-            ++index;
-            precision = parseInt(format.substring(index));
-            if (isNaN(precision))
-                precision = 0;
-            while (!isNaN(format[index]))
-                ++index;
-        }
+var number = parseInt(format.substring(index));
+while (!isNaN(format[index]))
+++index;
 
-        addSpecifierToken(format[index], precision, substitutionIndex);
 
-        ++substitutionIndex;
-        ++index;
-    }
+if (number > 0 && format[index] === "$") {
+substitutionIndex = (number - 1);
+++index;
+}
+}
 
-    addStringToken(format.substring(index));
+var precision = -1;
+if (format[index] === ".") {
 
-    return tokens;
+
+++index;
+precision = parseInt(format.substring(index));
+if (isNaN(precision))
+precision = 0;
+while (!isNaN(format[index]))
+++index;
+}
+
+addSpecifierToken(format[index], precision, substitutionIndex);
+
+++substitutionIndex;
+++index;
+}
+
+addStringToken(format.substring(index));
+
+return tokens;
 }
 
 String.standardFormatters = {
-    d: function(substitution)
-    {
-        if (typeof substitution == "object" && Object.proxyType(substitution) === "number")
-            substitution = substitution.description;
-        substitution = parseInt(substitution);
-        return !isNaN(substitution) ? substitution : 0;
-    },
+d: function(substitution)
+{
+if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number")
+substitution = substitution.description;
+substitution = parseInt(substitution);
+return !isNaN(substitution) ? substitution : 0;
+},
 
-    f: function(substitution, token)
-    {
-        if (typeof substitution == "object" && Object.proxyType(substitution) === "number")
-            substitution = substitution.description;
-        substitution = parseFloat(substitution);
-        if (substitution && token.precision > -1)
-            substitution = substitution.toFixed(token.precision);
-        return !isNaN(substitution) ? substitution : (token.precision > -1 ? Number(0).toFixed(token.precision) : 0);
-    },
+f: function(substitution, token)
+{
+if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) === "number")
+substitution = substitution.description;
+substitution = parseFloat(substitution);
+if (substitution && token.precision > -1)
+substitution = substitution.toFixed(token.precision);
+return !isNaN(substitution) ? substitution : (token.precision > -1 ? Number(0).toFixed(token.precision) : 0);
+},
 
-    s: function(substitution)
-    {
-        if (typeof substitution == "object" && Object.proxyType(substitution) !== "null")
-            substitution = substitution.description;
-        return substitution;
-    },
+s: function(substitution)
+{
+if (typeof substitution == "object" && WebInspector.RemoteObject.type(substitution) !== "null")
+substitution = substitution.description;
+return substitution;
+},
 };
 
 String.vsprintf = function(format, substitutions)
 {
-    return String.format(format, substitutions, String.standardFormatters, "", function(a, b) { return a + b; }).formattedResult;
+return String.format(format, substitutions, String.standardFormatters, "", function(a, b) { return a + b; }).formattedResult;
 }
 
 String.format = function(format, substitutions, formatters, initialValue, append)
 {
-    if (!format || !substitutions || !substitutions.length)
-        return { formattedResult: append(initialValue, format), unusedSubstitutions: substitutions };
+if (!format || !substitutions || !substitutions.length)
+return { formattedResult: append(initialValue, format), unusedSubstitutions: substitutions };
 
-    function prettyFunctionName()
-    {
-        return "String.format(\"" + format + "\", \"" + substitutions.join("\", \"") + "\")";
-    }
+function prettyFunctionName()
+{
+return "String.format(\"" + format + "\", \"" + substitutions.join("\", \"") + "\")";
+}
 
-    function warn(msg)
-    {
-        console.warn(prettyFunctionName() + ": " + msg);
-    }
+function warn(msg)
+{
+console.warn(prettyFunctionName() + ": " + msg);
+}
 
-    function error(msg)
-    {
-        console.error(prettyFunctionName() + ": " + msg);
-    }
+function error(msg)
+{
+console.error(prettyFunctionName() + ": " + msg);
+}
 
-    var result = initialValue;
-    var tokens = String.tokenizeFormatString(format);
-    var usedSubstitutionIndexes = {};
+var result = initialValue;
+var tokens = String.tokenizeFormatString(format);
+var usedSubstitutionIndexes = {};
 
-    for (var i = 0; i < tokens.length; ++i) {
-        var token = tokens[i];
+for (var i = 0; i < tokens.length; ++i) {
+var token = tokens[i];
 
-        if (token.type === "string") {
-            result = append(result, token.value);
-            continue;
-        }
+if (token.type === "string") {
+result = append(result, token.value);
+continue;
+}
 
-        if (token.type !== "specifier") {
-            error("Unknown token type \"" + token.type + "\" found.");
-            continue;
-        }
+if (token.type !== "specifier") {
+error("Unknown token type \"" + token.type + "\" found.");
+continue;
+}
 
-        if (token.substitutionIndex >= substitutions.length) {
-            // If there are not enough substitutions for the current substitutionIndex
-            // just output the format specifier literally and move on.
-            error("not enough substitution arguments. Had " + substitutions.length + " but needed " + (token.substitutionIndex + 1) + ", so substitution was skipped.");
-            result = append(result, "%" + (token.precision > -1 ? token.precision : "") + token.specifier);
-            continue;
-        }
+if (token.substitutionIndex >= substitutions.length) {
 
-        usedSubstitutionIndexes[token.substitutionIndex] = true;
 
-        if (!(token.specifier in formatters)) {
-            // Encountered an unsupported format character, treat as a string.
-            warn("unsupported format character \u201C" + token.specifier + "\u201D. Treating as a string.");
-            result = append(result, substitutions[token.substitutionIndex]);
-            continue;
-        }
+error("not enough substitution arguments. Had " + substitutions.length + " but needed " + (token.substitutionIndex + 1) + ", so substitution was skipped.");
+result = append(result, "%" + (token.precision > -1 ? token.precision : "") + token.specifier);
+continue;
+}
 
-        result = append(result, formatters[token.specifier](substitutions[token.substitutionIndex], token));
-    }
+usedSubstitutionIndexes[token.substitutionIndex] = true;
 
-    var unusedSubstitutions = [];
-    for (var i = 0; i < substitutions.length; ++i) {
-        if (i in usedSubstitutionIndexes)
-            continue;
-        unusedSubstitutions.push(substitutions[i]);
-    }
+if (!(token.specifier in formatters)) {
 
-    return { formattedResult: result, unusedSubstitutions: unusedSubstitutions };
+warn("unsupported format character \u201C" + token.specifier + "\u201D. Treating as a string.");
+result = append(result, substitutions[token.substitutionIndex]);
+continue;
+}
+
+result = append(result, formatters[token.specifier](substitutions[token.substitutionIndex], token));
+}
+
+var unusedSubstitutions = [];
+for (var i = 0; i < substitutions.length; ++i) {
+if (i in usedSubstitutionIndexes)
+continue;
+unusedSubstitutions.push(substitutions[i]);
+}
+
+return { formattedResult: result, unusedSubstitutions: unusedSubstitutions };
 }
 
 function isEnterKey(event) {
-    // Check if in IME.
-    return event.keyCode !== 229 && event.keyIdentifier === "Enter";
+
+return event.keyCode !== 229 && event.keyIdentifier === "Enter";
 }
 
 
 function highlightSearchResult(element, offset, length)
 {
-    var lineText = element.textContent;
-    var endOffset = offset + length;
-    var highlightNode = document.createElement("span");
-    highlightNode.className = "webkit-search-result";
-    highlightNode.textContent = lineText.substring(offset, endOffset);
+var lineText = element.textContent;
+var endOffset = offset + length;
+var highlightNode = document.createElement("span");
+highlightNode.className = "webkit-search-result";
+highlightNode.textContent = lineText.substring(offset, endOffset);
 
-    var boundary = element.rangeBoundaryForOffset(offset);
-    var textNode = boundary.container;
-    var text = textNode.textContent;
+var boundary = element.rangeBoundaryForOffset(offset);
+var textNode = boundary.container;
+var text = textNode.textContent;
 
-    if (boundary.offset + length < text.length) {
-        // Selection belong to a single split mode.
-        textNode.textContent = text.substring(boundary.offset + length);
-        textNode.parentElement.insertBefore(highlightNode, textNode);
-        var prefixNode = document.createTextNode(text.substring(0, boundary.offset));
-        textNode.parentElement.insertBefore(prefixNode, highlightNode);
-        return highlightNode;
-    }
+if (boundary.offset + length < text.length) {
 
-    var parentElement = textNode.parentElement;
-    var anchorElement = textNode.nextSibling;
+textNode.textContent = text.substring(boundary.offset + length);
+textNode.parentElement.insertBefore(highlightNode, textNode);
+var prefixNode = document.createTextNode(text.substring(0, boundary.offset));
+textNode.parentElement.insertBefore(prefixNode, highlightNode);
+return highlightNode;
+}
 
-    length -= text.length - boundary.offset;
-    textNode.textContent = text.substring(0, boundary.offset);
-    textNode = textNode.traverseNextTextNode(element);
+var parentElement = textNode.parentElement;
+var anchorElement = textNode.nextSibling;
 
-    while (textNode) {
-        var text = textNode.textContent;
-        if (length < text.length) {
-            textNode.textContent = text.substring(length);
-            break;
-        }
+length -= text.length - boundary.offset;
+textNode.textContent = text.substring(0, boundary.offset);
+textNode = textNode.traverseNextTextNode(element);
 
-        length -= text.length;
-        textNode.textContent = "";
-        textNode = textNode.traverseNextTextNode(element);
-    }
+while (textNode) {
+var text = textNode.textContent;
+if (length < text.length) {
+textNode.textContent = text.substring(length);
+break;
+}
 
-    parentElement.insertBefore(highlightNode, anchorElement);
-    return highlightNode;
+length -= text.length;
+textNode.textContent = "";
+textNode = textNode.traverseNextTextNode(element);
+}
+
+parentElement.insertBefore(highlightNode, anchorElement);
+return highlightNode;
 }
 
 function createSearchRegex(query)
 {
-    var regex = "";
-    for (var i = 0; i < query.length; ++i) {
-        var char = query.charAt(i);
-        if (char === "]")
-            char = "\\]";
-        regex += "[" + char + "]";
-    }
-    return new RegExp(regex, "i");
+var regex = "";
+for (var i = 0; i < query.length; ++i) {
+var char = query.charAt(i);
+if (char === "]")
+char = "\\]";
+regex += "[" + char + "]";
+}
+return new RegExp(regex, "i");
 }
 
-/* treeoutline.js */
+function offerFileForDownload(contents)
+{
+var builder = new BlobBuilder();
+builder.append(contents);
+var blob = builder.getBlob("application/octet-stream");
+var url = window.createObjectURL(blob);
+window.open(url);
+}
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
 
 function TreeOutline(listNode)
 {
-    this.children = [];
-    this.selectedTreeElement = null;
-    this._childrenListNode = listNode;
-    this._childrenListNode.removeChildren();
-    this._knownTreeElements = [];
-    this._treeElementsExpandedState = [];
-    this.expandTreeElementsWhenArrowing = false;
-    this.root = true;
-    this.hasChildren = false;
-    this.expanded = true;
-    this.selected = false;
-    this.treeOutline = this;
+this.children = [];
+this.selectedTreeElement = null;
+this._childrenListNode = listNode;
+this._childrenListNode.removeChildren();
+this._knownTreeElements = [];
+this._treeElementsExpandedState = [];
+this.expandTreeElementsWhenArrowing = false;
+this.root = true;
+this.hasChildren = false;
+this.expanded = true;
+this.selected = false;
+this.treeOutline = this;
 
-    this._childrenListNode.tabIndex = 0;
-    this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
+this._childrenListNode.tabIndex = 0;
+this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
 }
 
 TreeOutline._knownTreeElementNextIdentifier = 1;
 
 TreeOutline._appendChild = function(child)
 {
-    if (!child)
-        throw("child can't be undefined or null");
+if (!child)
+throw("child can't be undefined or null");
 
-    var lastChild = this.children[this.children.length - 1];
-    if (lastChild) {
-        lastChild.nextSibling = child;
-        child.previousSibling = lastChild;
-    } else {
-        child.previousSibling = null;
-        child.nextSibling = null;
-    }
+var lastChild = this.children[this.children.length - 1];
+if (lastChild) {
+lastChild.nextSibling = child;
+child.previousSibling = lastChild;
+} else {
+child.previousSibling = null;
+child.nextSibling = null;
+}
 
-    this.children.push(child);
-    this.hasChildren = true;
-    child.parent = this;
-    child.treeOutline = this.treeOutline;
-    child.treeOutline._rememberTreeElement(child);
+this.children.push(child);
+this.hasChildren = true;
+child.parent = this;
+child.treeOutline = this.treeOutline;
+child.treeOutline._rememberTreeElement(child);
 
-    var current = child.children[0];
-    while (current) {
-        current.treeOutline = this.treeOutline;
-        current.treeOutline._rememberTreeElement(current);
-        current = current.traverseNextTreeElement(false, child, true);
-    }
+var current = child.children[0];
+while (current) {
+current.treeOutline = this.treeOutline;
+current.treeOutline._rememberTreeElement(current);
+current = current.traverseNextTreeElement(false, child, true);
+}
 
-    if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
-        child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
+if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
+child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (!this._childrenListNode) {
-        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
-        this._childrenListNode.parentTreeElement = this;
-        this._childrenListNode.addStyleClass("children");
-        if (this.hidden)
-            this._childrenListNode.addStyleClass("hidden");
-    }
+if (!this._childrenListNode) {
+this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+this._childrenListNode.parentTreeElement = this;
+this._childrenListNode.addStyleClass("children");
+if (this.hidden)
+this._childrenListNode.addStyleClass("hidden");
+}
 
-    child._attach();
+child._attach();
 }
 
 TreeOutline._insertChild = function(child, index)
 {
-    if (!child)
-        throw("child can't be undefined or null");
+if (!child)
+throw("child can't be undefined or null");
 
-    var previousChild = (index > 0 ? this.children[index - 1] : null);
-    if (previousChild) {
-        previousChild.nextSibling = child;
-        child.previousSibling = previousChild;
-    } else {
-        child.previousSibling = null;
-    }
+var previousChild = (index > 0 ? this.children[index - 1] : null);
+if (previousChild) {
+previousChild.nextSibling = child;
+child.previousSibling = previousChild;
+} else {
+child.previousSibling = null;
+}
 
-    var nextChild = this.children[index];
-    if (nextChild) {
-        nextChild.previousSibling = child;
-        child.nextSibling = nextChild;
-    } else {
-        child.nextSibling = null;
-    }
+var nextChild = this.children[index];
+if (nextChild) {
+nextChild.previousSibling = child;
+child.nextSibling = nextChild;
+} else {
+child.nextSibling = null;
+}
 
-    this.children.splice(index, 0, child);
-    this.hasChildren = true;
-    child.parent = this;
-    child.treeOutline = this.treeOutline;
-    child.treeOutline._rememberTreeElement(child);
+this.children.splice(index, 0, child);
+this.hasChildren = true;
+child.parent = this;
+child.treeOutline = this.treeOutline;
+child.treeOutline._rememberTreeElement(child);
 
-    var current = child.children[0];
-    while (current) {
-        current.treeOutline = this.treeOutline;
-        current.treeOutline._rememberTreeElement(current);
-        current = current.traverseNextTreeElement(false, child, true);
-    }
+var current = child.children[0];
+while (current) {
+current.treeOutline = this.treeOutline;
+current.treeOutline._rememberTreeElement(current);
+current = current.traverseNextTreeElement(false, child, true);
+}
 
-    if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
-        child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
+if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined)
+child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier];
 
-    if (!this._childrenListNode) {
-        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
-        this._childrenListNode.parentTreeElement = this;
-        this._childrenListNode.addStyleClass("children");
-        if (this.hidden)
-            this._childrenListNode.addStyleClass("hidden");
-    }
+if (!this._childrenListNode) {
+this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+this._childrenListNode.parentTreeElement = this;
+this._childrenListNode.addStyleClass("children");
+if (this.hidden)
+this._childrenListNode.addStyleClass("hidden");
+}
 
-    child._attach();
+child._attach();
 }
 
 TreeOutline._removeChildAtIndex = function(childIndex)
 {
-    if (childIndex < 0 || childIndex >= this.children.length)
-        throw("childIndex out of range");
+if (childIndex < 0 || childIndex >= this.children.length)
+throw("childIndex out of range");
 
-    var child = this.children[childIndex];
-    this.children.splice(childIndex, 1);
+var child = this.children[childIndex];
+this.children.splice(childIndex, 1);
 
-    var parent = child.parent;
-    if (child.deselect()) {
-        if (child.previousSibling)
-            child.previousSibling.select();
-        else if (child.nextSibling)
-            child.nextSibling.select();
-        else
-            parent.select();
-    }
+var parent = child.parent;
+if (child.deselect()) {
+if (child.previousSibling)
+child.previousSibling.select();
+else if (child.nextSibling)
+child.nextSibling.select();
+else
+parent.select();
+}
 
-    if (child.previousSibling)
-        child.previousSibling.nextSibling = child.nextSibling;
-    if (child.nextSibling)
-        child.nextSibling.previousSibling = child.previousSibling;
+if (child.previousSibling)
+child.previousSibling.nextSibling = child.nextSibling;
+if (child.nextSibling)
+child.nextSibling.previousSibling = child.previousSibling;
 
-    if (child.treeOutline) {
-        child.treeOutline._forgetTreeElement(child);
-        child.treeOutline._forgetChildrenRecursive(child);
-    }
+if (child.treeOutline) {
+child.treeOutline._forgetTreeElement(child);
+child.treeOutline._forgetChildrenRecursive(child);
+}
 
-    child._detach();
-    child.treeOutline = null;
-    child.parent = null;
-    child.nextSibling = null;
-    child.previousSibling = null;
+child._detach();
+child.treeOutline = null;
+child.parent = null;
+child.nextSibling = null;
+child.previousSibling = null;
 }
 
 TreeOutline._removeChild = function(child)
 {
-    if (!child)
-        throw("child can't be undefined or null");
+if (!child)
+throw("child can't be undefined or null");
 
-    var childIndex = this.children.indexOf(child);
-    if (childIndex === -1)
-        throw("child not found in this node's children");
+var childIndex = this.children.indexOf(child);
+if (childIndex === -1)
+throw("child not found in this node's children");
 
-    TreeOutline._removeChildAtIndex.call(this, childIndex);
+TreeOutline._removeChildAtIndex.call(this, childIndex);
 }
 
 TreeOutline._removeChildren = function()
 {
-    for (var i = 0; i < this.children.length; ++i) {
-        var child = this.children[i];
-        child.deselect();
+for (var i = 0; i < this.children.length; ++i) {
+var child = this.children[i];
+child.deselect();
 
-        if (child.treeOutline) {
-            child.treeOutline._forgetTreeElement(child);
-            child.treeOutline._forgetChildrenRecursive(child);
-        }
+if (child.treeOutline) {
+child.treeOutline._forgetTreeElement(child);
+child.treeOutline._forgetChildrenRecursive(child);
+}
 
-        child._detach();
-        child.treeOutline = null;
-        child.parent = null;
-        child.nextSibling = null;
-        child.previousSibling = null;
-    }
+child._detach();
+child.treeOutline = null;
+child.parent = null;
+child.nextSibling = null;
+child.previousSibling = null;
+}
 
-    this.children = [];
+this.children = [];
 }
 
 TreeOutline._removeChildrenRecursive = function()
 {
-    var childrenToRemove = this.children;
+var childrenToRemove = this.children;
 
-    var child = this.children[0];
-    while (child) {
-        if (child.children.length)
-            childrenToRemove = childrenToRemove.concat(child.children);
-        child = child.traverseNextTreeElement(false, this, true);
-    }
+var child = this.children[0];
+while (child) {
+if (child.children.length)
+childrenToRemove = childrenToRemove.concat(child.children);
+child = child.traverseNextTreeElement(false, this, true);
+}
 
-    for (var i = 0; i < childrenToRemove.length; ++i) {
-        var child = childrenToRemove[i];
-        child.deselect();
-        if (child.treeOutline)
-            child.treeOutline._forgetTreeElement(child);
-        child._detach();
-        child.children = [];
-        child.treeOutline = null;
-        child.parent = null;
-        child.nextSibling = null;
-        child.previousSibling = null;
-    }
+for (var i = 0; i < childrenToRemove.length; ++i) {
+var child = childrenToRemove[i];
+child.deselect();
+if (child.treeOutline)
+child.treeOutline._forgetTreeElement(child);
+child._detach();
+child.children = [];
+child.treeOutline = null;
+child.parent = null;
+child.nextSibling = null;
+child.previousSibling = null;
+}
 
-    this.children = [];
+this.children = [];
 }
 
 TreeOutline.prototype._rememberTreeElement = function(element)
 {
-    if (!this._knownTreeElements[element.identifier])
-        this._knownTreeElements[element.identifier] = [];
+if (!this._knownTreeElements[element.identifier])
+this._knownTreeElements[element.identifier] = [];
 
-    // check if the element is already known
-    var elements = this._knownTreeElements[element.identifier];
-    if (elements.indexOf(element) !== -1)
-        return;
 
-    // add the element
-    elements.push(element);
+var elements = this._knownTreeElements[element.identifier];
+if (elements.indexOf(element) !== -1)
+return;
+
+
+elements.push(element);
 }
 
 TreeOutline.prototype._forgetTreeElement = function(element)
 {
-    if (this._knownTreeElements[element.identifier])
-        this._knownTreeElements[element.identifier].remove(element, true);
+if (this._knownTreeElements[element.identifier])
+this._knownTreeElements[element.identifier].remove(element, true);
 }
 
 TreeOutline.prototype._forgetChildrenRecursive = function(parentElement)
 {
-    var child = parentElement.children[0];
-    while (child) {
-        this._forgetTreeElement(child);
-        child = child.traverseNextTreeElement(false, this, true);
-    }
+var child = parentElement.children[0];
+while (child) {
+this._forgetTreeElement(child);
+child = child.traverseNextTreeElement(false, this, true);
+}
 }
 
 TreeOutline.prototype.getCachedTreeElement = function(representedObject)
 {
-    if (!representedObject)
-        return null;
+if (!representedObject)
+return null;
 
-    if ("__treeElementIdentifier" in representedObject) {
-        // If this representedObject has a tree element identifier, and it is a known TreeElement
-        // in our tree we can just return that tree element.
-        var elements = this._knownTreeElements[representedObject.__treeElementIdentifier];
-        if (elements) {
-            for (var i = 0; i < elements.length; ++i)
-                if (elements[i].representedObject === representedObject)
-                    return elements[i];
-        }
-    }
-    return null;
+if ("__treeElementIdentifier" in representedObject) {
+
+
+var elements = this._knownTreeElements[representedObject.__treeElementIdentifier];
+if (elements) {
+for (var i = 0; i < elements.length; ++i)
+if (elements[i].representedObject === representedObject)
+return elements[i];
+}
+}
+return null;
 }
 
 TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent)
 {
-    if (!representedObject)
-        return null;
+if (!representedObject)
+return null;
 
-    var cachedElement = this.getCachedTreeElement(representedObject);
-    if (cachedElement)
-        return cachedElement;
+var cachedElement = this.getCachedTreeElement(representedObject);
+if (cachedElement)
+return cachedElement;
 
-    // The representedObject isn't know, so we start at the top of the tree and work down to find the first
-    // tree element that represents representedObject or one of its ancestors.
-    var item;
-    var found = false;
-    for (var i = 0; i < this.children.length; ++i) {
-        item = this.children[i];
-        if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) {
-            found = true;
-            break;
-        }
-    }
 
-    if (!found)
-        return null;
 
-    // Make sure the item that we found is connected to the root of the tree.
-    // Build up a list of representedObject's ancestors that aren't already in our tree.
-    var ancestors = [];
-    var currentObject = representedObject;
-    while (currentObject) {
-        ancestors.unshift(currentObject);
-        if (currentObject === item.representedObject)
-            break;
-        currentObject = getParent(currentObject);
-    }
+var item;
+var found = false;
+for (var i = 0; i < this.children.length; ++i) {
+item = this.children[i];
+if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) {
+found = true;
+break;
+}
+}
 
-    // For each of those ancestors we populate them to fill in the tree.
-    for (var i = 0; i < ancestors.length; ++i) {
-        // Make sure we don't call findTreeElement with the same representedObject
-        // again, to prevent infinite recursion.
-        if (ancestors[i] === representedObject)
-            continue;
-        // FIXME: we could do something faster than findTreeElement since we will know the next
-        // ancestor exists in the tree.
-        item = this.findTreeElement(ancestors[i], isAncestor, getParent);
-        if (item && item.onpopulate)
-            item.onpopulate(item);
-    }
+if (!found)
+return null;
 
-    return this.getCachedTreeElement(representedObject);
+
+
+var ancestors = [];
+var currentObject = representedObject;
+while (currentObject) {
+ancestors.unshift(currentObject);
+if (currentObject === item.representedObject)
+break;
+currentObject = getParent(currentObject);
+}
+
+
+for (var i = 0; i < ancestors.length; ++i) {
+
+
+if (ancestors[i] === representedObject)
+continue;
+
+
+item = this.findTreeElement(ancestors[i], isAncestor, getParent);
+if (item && item.onpopulate)
+item.onpopulate(item);
+}
+
+return this.getCachedTreeElement(representedObject);
 }
 
 TreeOutline.prototype.treeElementFromPoint = function(x, y)
 {
-    var node = this._childrenListNode.ownerDocument.elementFromPoint(x, y);
-    var listNode = node.enclosingNodeOrSelfWithNodeNameInArray(["ol", "li"]);
-    if (listNode)
-        return listNode.parentTreeElement || listNode.treeElement;
-    return null;
+var node = this._childrenListNode.ownerDocument.elementFromPoint(x, y);
+var listNode = node.enclosingNodeOrSelfWithNodeNameInArray(["ol", "li"]);
+if (listNode)
+return listNode.parentTreeElement || listNode.treeElement;
+return null;
 }
 
 TreeOutline.prototype._treeKeyDown = function(event)
 {
-    if (event.target !== this._childrenListNode)
-        return;
+if (event.target !== this._childrenListNode)
+return;
 
-    if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey)
-        return;
+if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey)
+return;
 
-    var handled = false;
-    var nextSelectedElement;
-    if (event.keyIdentifier === "Up" && !event.altKey) {
-        nextSelectedElement = this.selectedTreeElement.traversePreviousTreeElement(true);
-        while (nextSelectedElement && !nextSelectedElement.selectable)
-            nextSelectedElement = nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);
-        handled = nextSelectedElement ? true : false;
-    } else if (event.keyIdentifier === "Down" && !event.altKey) {
-        nextSelectedElement = this.selectedTreeElement.traverseNextTreeElement(true);
-        while (nextSelectedElement && !nextSelectedElement.selectable)
-            nextSelectedElement = nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);
-        handled = nextSelectedElement ? true : false;
-    } else if (event.keyIdentifier === "Left") {
-        if (this.selectedTreeElement.expanded) {
-            if (event.altKey)
-                this.selectedTreeElement.collapseRecursively();
-            else
-                this.selectedTreeElement.collapse();
-            handled = true;
-        } else if (this.selectedTreeElement.parent && !this.selectedTreeElement.parent.root) {
-            handled = true;
-            if (this.selectedTreeElement.parent.selectable) {
-                nextSelectedElement = this.selectedTreeElement.parent;
-                handled = nextSelectedElement ? true : false;
-            } else if (this.selectedTreeElement.parent)
-                this.selectedTreeElement.parent.collapse();
-        }
-    } else if (event.keyIdentifier === "Right") {
-        if (!this.selectedTreeElement.revealed()) {
-            this.selectedTreeElement.reveal();
-            handled = true;
-        } else if (this.selectedTreeElement.hasChildren) {
-            handled = true;
-            if (this.selectedTreeElement.expanded) {
-                nextSelectedElement = this.selectedTreeElement.children[0];
-                handled = nextSelectedElement ? true : false;
-            } else {
-                if (event.altKey)
-                    this.selectedTreeElement.expandRecursively();
-                else
-                    this.selectedTreeElement.expand();
-            }
-        }
-    }
+var handled = false;
+var nextSelectedElement;
+if (event.keyIdentifier === "Up" && !event.altKey) {
+nextSelectedElement = this.selectedTreeElement.traversePreviousTreeElement(true);
+while (nextSelectedElement && !nextSelectedElement.selectable)
+nextSelectedElement = nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing);
+handled = nextSelectedElement ? true : false;
+} else if (event.keyIdentifier === "Down" && !event.altKey) {
+nextSelectedElement = this.selectedTreeElement.traverseNextTreeElement(true);
+while (nextSelectedElement && !nextSelectedElement.selectable)
+nextSelectedElement = nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing);
+handled = nextSelectedElement ? true : false;
+} else if (event.keyIdentifier === "Left") {
+if (this.selectedTreeElement.expanded) {
+if (event.altKey)
+this.selectedTreeElement.collapseRecursively();
+else
+this.selectedTreeElement.collapse();
+handled = true;
+} else if (this.selectedTreeElement.parent && !this.selectedTreeElement.parent.root) {
+handled = true;
+if (this.selectedTreeElement.parent.selectable) {
+nextSelectedElement = this.selectedTreeElement.parent;
+handled = nextSelectedElement ? true : false;
+} else if (this.selectedTreeElement.parent)
+this.selectedTreeElement.parent.collapse();
+}
+} else if (event.keyIdentifier === "Right") {
+if (!this.selectedTreeElement.revealed()) {
+this.selectedTreeElement.reveal();
+handled = true;
+} else if (this.selectedTreeElement.hasChildren) {
+handled = true;
+if (this.selectedTreeElement.expanded) {
+nextSelectedElement = this.selectedTreeElement.children[0];
+handled = nextSelectedElement ? true : false;
+} else {
+if (event.altKey)
+this.selectedTreeElement.expandRecursively();
+else
+this.selectedTreeElement.expand();
+}
+}
+} else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Backspace.code || event.keyCode === WebInspector.KeyboardShortcut.Keys.Delete.code) {
+if (this.selectedTreeElement.ondelete)
+handled = this.selectedTreeElement.ondelete();
+} else if (isEnterKey(event)) {
+if (this.selectedTreeElement.onenter)
+handled = this.selectedTreeElement.onenter();
+}
 
-    if (nextSelectedElement) {
-        nextSelectedElement.reveal();
-        nextSelectedElement.select();
-    }
+if (nextSelectedElement) {
+nextSelectedElement.reveal();
+nextSelectedElement.select(false, true);
+}
 
-    if (handled) {
-        event.preventDefault();
-        event.stopPropagation();
-    }
+if (handled) {
+event.preventDefault();
+event.stopPropagation();
+}
 }
 
 TreeOutline.prototype.expand = function()
 {
-    // this is the root, do nothing
+
 }
 
 TreeOutline.prototype.collapse = function()
 {
-    // this is the root, do nothing
+
 }
 
 TreeOutline.prototype.revealed = function()
 {
-    return true;
+return true;
 }
 
 TreeOutline.prototype.reveal = function()
 {
-    // this is the root, do nothing
+
+}
+
+TreeOutline.prototype.select = function()
+{
+
 }
 
 TreeOutline.prototype.appendChild = TreeOutline._appendChild;
@@ -1345,113 +1443,140 @@
 
 function TreeElement(title, representedObject, hasChildren)
 {
-    this._title = title;
-    this.representedObject = (representedObject || {});
+this._title = title;
+this.representedObject = (representedObject || {});
 
-    if (this.representedObject.__treeElementIdentifier)
-        this.identifier = this.representedObject.__treeElementIdentifier;
-    else {
-        this.identifier = TreeOutline._knownTreeElementNextIdentifier++;
-        this.representedObject.__treeElementIdentifier = this.identifier;
-    }
+if (this.representedObject.__treeElementIdentifier)
+this.identifier = this.representedObject.__treeElementIdentifier;
+else {
+this.identifier = TreeOutline._knownTreeElementNextIdentifier++;
+this.representedObject.__treeElementIdentifier = this.identifier;
+}
 
-    this._hidden = false;
-    this.expanded = false;
-    this.selected = false;
-    this.hasChildren = hasChildren;
-    this.children = [];
-    this.treeOutline = null;
-    this.parent = null;
-    this.previousSibling = null;
-    this.nextSibling = null;
-    this._listItemNode = null;
+this._hidden = false;
+this.expanded = false;
+this.selected = false;
+this.hasChildren = hasChildren;
+this.children = [];
+this.treeOutline = null;
+this.parent = null;
+this.previousSibling = null;
+this.nextSibling = null;
+this._listItemNode = null;
 }
 
 TreeElement.prototype = {
-    selectable: true,
-    arrowToggleWidth: 10,
+selectable: true,
+arrowToggleWidth: 10,
 
-    get listItemElement() {
-        return this._listItemNode;
-    },
+get listItemElement() {
+return this._listItemNode;
+},
 
-    get childrenListElement() {
-        return this._childrenListNode;
-    },
+get childrenListElement() {
+return this._childrenListNode;
+},
 
-    get title() {
-        return this._title;
-    },
+get title() {
+return this._title;
+},
 
-    set title(x) {
-        this._title = x;
-        if (this._listItemNode)
-            this._listItemNode.innerHTML = x;
-    },
+set title(x) {
+this._title = x;
+this._setListItemNodeContent();
+},
 
-    get tooltip() {
-        return this._tooltip;
-    },
+get titleHTML() {
+return this._titleHTML;
+},
 
-    set tooltip(x) {
-        this._tooltip = x;
-        if (this._listItemNode)
-            this._listItemNode.title = x ? x : "";
-    },
+set titleHTML(x) {
+this._titleHTML = x;
+this._setListItemNodeContent();
+},
 
-    get hasChildren() {
-        return this._hasChildren;
-    },
+get tooltip() {
+return this._tooltip;
+},
 
-    set hasChildren(x) {
-        if (this._hasChildren === x)
-            return;
+set tooltip(x) {
+this._tooltip = x;
+if (this._listItemNode)
+this._listItemNode.title = x ? x : "";
+},
 
-        this._hasChildren = x;
+get hasChildren() {
+return this._hasChildren;
+},
 
-        if (!this._listItemNode)
-            return;
+set hasChildren(x) {
+if (this._hasChildren === x)
+return;
 
-        if (x)
-            this._listItemNode.addStyleClass("parent");
-        else {
-            this._listItemNode.removeStyleClass("parent");
-            this.collapse();
-        }
-    },
+this._hasChildren = x;
 
-    get hidden() {
-        return this._hidden;
-    },
+if (!this._listItemNode)
+return;
 
-    set hidden(x) {
-        if (this._hidden === x)
-            return;
+if (x)
+this._listItemNode.addStyleClass("parent");
+else {
+this._listItemNode.removeStyleClass("parent");
+this.collapse();
+}
+},
 
-        this._hidden = x;
+get hidden() {
+return this._hidden;
+},
 
-        if (x) {
-            if (this._listItemNode)
-                this._listItemNode.addStyleClass("hidden");
-            if (this._childrenListNode)
-                this._childrenListNode.addStyleClass("hidden");
-        } else {
-            if (this._listItemNode)
-                this._listItemNode.removeStyleClass("hidden");
-            if (this._childrenListNode)
-                this._childrenListNode.removeStyleClass("hidden");
-        }
-    },
+set hidden(x) {
+if (this._hidden === x)
+return;
 
-    get shouldRefreshChildren() {
-        return this._shouldRefreshChildren;
-    },
+this._hidden = x;
 
-    set shouldRefreshChildren(x) {
-        this._shouldRefreshChildren = x;
-        if (x && this.expanded)
-            this.expand();
-    }
+if (x) {
+if (this._listItemNode)
+this._listItemNode.addStyleClass("hidden");
+if (this._childrenListNode)
+this._childrenListNode.addStyleClass("hidden");
+} else {
+if (this._listItemNode)
+this._listItemNode.removeStyleClass("hidden");
+if (this._childrenListNode)
+this._childrenListNode.removeStyleClass("hidden");
+}
+},
+
+get shouldRefreshChildren() {
+return this._shouldRefreshChildren;
+},
+
+set shouldRefreshChildren(x) {
+this._shouldRefreshChildren = x;
+if (x && this.expanded)
+this.expand();
+},
+
+_setListItemNodeContent: function()
+{
+if (!this._listItemNode)
+return;
+
+if (!this._titleHTML && !this._title)
+this._listItemNode.removeChildren();
+else if (typeof this._titleHTML === "string")
+this._listItemNode.innerHTML = this._titleHTML;
+else if (typeof this._title === "string")
+this._listItemNode.textContent = this._title;
+else {
+this._listItemNode.removeChildren();
+if (this._title.parentNode)
+this._title.parentNode.removeChild(this._title);
+this._listItemNode.appendChild(this._title);
+}
+}
 }
 
 TreeElement.prototype.appendChild = TreeOutline._appendChild;
@@ -1463,1859 +1588,1905 @@
 
 TreeElement.prototype._attach = function()
 {
-    if (!this._listItemNode || this.parent._shouldRefreshChildren) {
-        if (this._listItemNode && this._listItemNode.parentNode)
-            this._listItemNode.parentNode.removeChild(this._listItemNode);
+if (!this._listItemNode || this.parent._shouldRefreshChildren) {
+if (this._listItemNode && this._listItemNode.parentNode)
+this._listItemNode.parentNode.removeChild(this._listItemNode);
 
-        this._listItemNode = this.treeOutline._childrenListNode.ownerDocument.createElement("li");
-        this._listItemNode.treeElement = this;
-        this._listItemNode.innerHTML = this._title;
-        this._listItemNode.title = this._tooltip ? this._tooltip : "";
+this._listItemNode = this.treeOutline._childrenListNode.ownerDocument.createElement("li");
+this._listItemNode.treeElement = this;
+this._setListItemNodeContent();
+this._listItemNode.title = this._tooltip ? this._tooltip : "";
 
-        if (this.hidden)
-            this._listItemNode.addStyleClass("hidden");
-        if (this.hasChildren)
-            this._listItemNode.addStyleClass("parent");
-        if (this.expanded)
-            this._listItemNode.addStyleClass("expanded");
-        if (this.selected)
-            this._listItemNode.addStyleClass("selected");
+if (this.hidden)
+this._listItemNode.addStyleClass("hidden");
+if (this.hasChildren)
+this._listItemNode.addStyleClass("parent");
+if (this.expanded)
+this._listItemNode.addStyleClass("expanded");
+if (this.selected)
+this._listItemNode.addStyleClass("selected");
 
-        this._listItemNode.addEventListener("mousedown", TreeElement.treeElementSelected, false);
-        this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false);
-        this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false);
+this._listItemNode.addEventListener("mousedown", TreeElement.treeElementMouseDown, false);
+this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false);
+this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false);
 
-        if (this.onattach)
-            this.onattach(this);
-    }
+if (this.onattach)
+this.onattach(this);
+}
 
-    var nextSibling = null;
-    if (this.nextSibling && this.nextSibling._listItemNode && this.nextSibling._listItemNode.parentNode === this.parent._childrenListNode)
-        nextSibling = this.nextSibling._listItemNode;
-    this.parent._childrenListNode.insertBefore(this._listItemNode, nextSibling);
-    if (this._childrenListNode)
-        this.parent._childrenListNode.insertBefore(this._childrenListNode, this._listItemNode.nextSibling);
-    if (this.selected)
-        this.select();
-    if (this.expanded)
-        this.expand();
+var nextSibling = null;
+if (this.nextSibling && this.nextSibling._listItemNode && this.nextSibling._listItemNode.parentNode === this.parent._childrenListNode)
+nextSibling = this.nextSibling._listItemNode;
+this.parent._childrenListNode.insertBefore(this._listItemNode, nextSibling);
+if (this._childrenListNode)
+this.parent._childrenListNode.insertBefore(this._childrenListNode, this._listItemNode.nextSibling);
+if (this.selected)
+this.select();
+if (this.expanded)
+this.expand();
 }
 
 TreeElement.prototype._detach = function()
 {
-    if (this._listItemNode && this._listItemNode.parentNode)
-        this._listItemNode.parentNode.removeChild(this._listItemNode);
-    if (this._childrenListNode && this._childrenListNode.parentNode)
-        this._childrenListNode.parentNode.removeChild(this._childrenListNode);
+if (this._listItemNode && this._listItemNode.parentNode)
+this._listItemNode.parentNode.removeChild(this._listItemNode);
+if (this._childrenListNode && this._childrenListNode.parentNode)
+this._childrenListNode.parentNode.removeChild(this._childrenListNode);
 }
 
-TreeElement.treeElementSelected = function(event)
+TreeElement.treeElementMouseDown = function(event)
 {
-    var element = event.currentTarget;
-    if (!element || !element.treeElement || !element.treeElement.selectable)
-        return;
+var element = event.currentTarget;
+if (!element || !element.treeElement || !element.treeElement.selectable)
+return;
 
-    if (element.treeElement.isEventWithinDisclosureTriangle(event))
-        return;
+if (element.treeElement.isEventWithinDisclosureTriangle(event))
+return;
 
-    element.treeElement.select();
+element.treeElement.selectOnMouseDown(event);
 }
 
 TreeElement.treeElementToggled = function(event)
 {
-    var element = event.currentTarget;
-    if (!element || !element.treeElement)
-        return;
+var element = event.currentTarget;
+if (!element || !element.treeElement)
+return;
 
-    if (!element.treeElement.isEventWithinDisclosureTriangle(event))
-        return;
+if (!element.treeElement.isEventWithinDisclosureTriangle(event))
+return;
 
-    if (element.treeElement.expanded) {
-        if (event.altKey)
-            element.treeElement.collapseRecursively();
-        else
-            element.treeElement.collapse();
-    } else {
-        if (event.altKey)
-            element.treeElement.expandRecursively();
-        else
-            element.treeElement.expand();
-    }
+if (element.treeElement.expanded) {
+if (event.altKey)
+element.treeElement.collapseRecursively();
+else
+element.treeElement.collapse();
+} else {
+if (event.altKey)
+element.treeElement.expandRecursively();
+else
+element.treeElement.expand();
+}
+event.stopPropagation();
 }
 
 TreeElement.treeElementDoubleClicked = function(event)
 {
-    var element = event.currentTarget;
-    if (!element || !element.treeElement)
-        return;
+var element = event.currentTarget;
+if (!element || !element.treeElement)
+return;
 
-    if (element.treeElement.ondblclick)
-        element.treeElement.ondblclick.call(element.treeElement, event);
-    else if (element.treeElement.hasChildren && !element.treeElement.expanded)
-        element.treeElement.expand();
+if (element.treeElement.ondblclick)
+element.treeElement.ondblclick.call(element.treeElement, event);
+else if (element.treeElement.hasChildren && !element.treeElement.expanded)
+element.treeElement.expand();
 }
 
 TreeElement.prototype.collapse = function()
 {
-    if (this._listItemNode)
-        this._listItemNode.removeStyleClass("expanded");
-    if (this._childrenListNode)
-        this._childrenListNode.removeStyleClass("expanded");
+if (this._listItemNode)
+this._listItemNode.removeStyleClass("expanded");
+if (this._childrenListNode)
+this._childrenListNode.removeStyleClass("expanded");
 
-    this.expanded = false;
-    if (this.treeOutline)
-        this.treeOutline._treeElementsExpandedState[this.identifier] = true;
+this.expanded = false;
+if (this.treeOutline)
+this.treeOutline._treeElementsExpandedState[this.identifier] = true;
 
-    if (this.oncollapse)
-        this.oncollapse(this);
+if (this.oncollapse)
+this.oncollapse(this);
 }
 
 TreeElement.prototype.collapseRecursively = function()
 {
-    var item = this;
-    while (item) {
-        if (item.expanded)
-            item.collapse();
-        item = item.traverseNextTreeElement(false, this, true);
-    }
+var item = this;
+while (item) {
+if (item.expanded)
+item.collapse();
+item = item.traverseNextTreeElement(false, this, true);
+}
 }
 
 TreeElement.prototype.expand = function()
 {
-    if (!this.hasChildren || (this.expanded && !this._shouldRefreshChildren && this._childrenListNode))
-        return;
+if (!this.hasChildren || (this.expanded && !this._shouldRefreshChildren && this._childrenListNode))
+return;
 
-    if (this.treeOutline && (!this._childrenListNode || this._shouldRefreshChildren)) {
-        if (this._childrenListNode && this._childrenListNode.parentNode)
-            this._childrenListNode.parentNode.removeChild(this._childrenListNode);
+if (this.treeOutline && (!this._childrenListNode || this._shouldRefreshChildren)) {
+if (this._childrenListNode && this._childrenListNode.parentNode)
+this._childrenListNode.parentNode.removeChild(this._childrenListNode);
 
-        this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
-        this._childrenListNode.parentTreeElement = this;
-        this._childrenListNode.addStyleClass("children");
+this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol");
+this._childrenListNode.parentTreeElement = this;
+this._childrenListNode.addStyleClass("children");
 
-        if (this.hidden)
-            this._childrenListNode.addStyleClass("hidden");
+if (this.hidden)
+this._childrenListNode.addStyleClass("hidden");
 
-        if (this.onpopulate)
-            this.onpopulate(this);
+if (this.onpopulate)
+this.onpopulate(this);
 
-        for (var i = 0; i < this.children.length; ++i)
-            this.children[i]._attach();
+for (var i = 0; i < this.children.length; ++i)
+this.children[i]._attach();
 
-        delete this._shouldRefreshChildren;
-    }
+delete this._shouldRefreshChildren;
+}
 
-    if (this._listItemNode) {
-        this._listItemNode.addStyleClass("expanded");
-        if (this._childrenListNode && this._childrenListNode.parentNode != this._listItemNode.parentNode)
-            this.parent._childrenListNode.insertBefore(this._childrenListNode, this._listItemNode.nextSibling);
-    }
+if (this._listItemNode) {
+this._listItemNode.addStyleClass("expanded");
+if (this._childrenListNode && this._childrenListNode.parentNode != this._listItemNode.parentNode)
+this.parent._childrenListNode.insertBefore(this._childrenListNode, this._listItemNode.nextSibling);
+}
 
-    if (this._childrenListNode)
-        this._childrenListNode.addStyleClass("expanded");
+if (this._childrenListNode)
+this._childrenListNode.addStyleClass("expanded");
 
-    this.expanded = true;
-    if (this.treeOutline)
-        this.treeOutline._treeElementsExpandedState[this.identifier] = true;
+this.expanded = true;
+if (this.treeOutline)
+this.treeOutline._treeElementsExpandedState[this.identifier] = true;
 
-    if (this.onexpand)
-        this.onexpand(this);
+if (this.onexpand)
+this.onexpand(this);
 }
 
 TreeElement.prototype.expandRecursively = function(maxDepth)
 {
-    var item = this;
-    var info = {};
-    var depth = 0;
+var item = this;
+var info = {};
+var depth = 0;
 
-    // The Inspector uses TreeOutlines to represents object properties, so recursive expansion
-    // in some case can be infinite, since JavaScript objects can hold circular references.
-    // So default to a recursion cap of 3 levels, since that gives fairly good results.
-    if (typeof maxDepth === "undefined" || typeof maxDepth === "null")
-        maxDepth = 3;
 
-    while (item) {
-        if (depth < maxDepth)
-            item.expand();
-        item = item.traverseNextTreeElement(false, this, (depth >= maxDepth), info);
-        depth += info.depthChange;
-    }
+
+
+if (typeof maxDepth === "undefined" || typeof maxDepth === "null")
+maxDepth = 3;
+
+while (item) {
+if (depth < maxDepth)
+item.expand();
+item = item.traverseNextTreeElement(false, this, (depth >= maxDepth), info);
+depth += info.depthChange;
+}
 }
 
 TreeElement.prototype.hasAncestor = function(ancestor) {
-    if (!ancestor)
-        return false;
+if (!ancestor)
+return false;
 
-    var currentNode = this.parent;
-    while (currentNode) {
-        if (ancestor === currentNode)
-            return true;
-        currentNode = currentNode.parent;
-    }
+var currentNode = this.parent;
+while (currentNode) {
+if (ancestor === currentNode)
+return true;
+currentNode = currentNode.parent;
+}
 
-    return false;
+return false;
 }
 
 TreeElement.prototype.reveal = function()
 {
-    var currentAncestor = this.parent;
-    while (currentAncestor && !currentAncestor.root) {
-        if (!currentAncestor.expanded)
-            currentAncestor.expand();
-        currentAncestor = currentAncestor.parent;
-    }
+var currentAncestor = this.parent;
+while (currentAncestor && !currentAncestor.root) {
+if (!currentAncestor.expanded)
+currentAncestor.expand();
+currentAncestor = currentAncestor.parent;
+}
 
-    if (this.onreveal)
-        this.onreveal(this);
+if (this.onreveal)
+this.onreveal(this);
 }
 
 TreeElement.prototype.revealed = function()
 {
-    var currentAncestor = this.parent;
-    while (currentAncestor && !currentAncestor.root) {
-        if (!currentAncestor.expanded)
-            return false;
-        currentAncestor = currentAncestor.parent;
-    }
-
-    return true;
+var currentAncestor = this.parent;
+while (currentAncestor && !currentAncestor.root) {
+if (!currentAncestor.expanded)
+return false;
+currentAncestor = currentAncestor.parent;
 }
 
-TreeElement.prototype.select = function(supressOnSelect)
+return true;
+}
+
+TreeElement.prototype.selectOnMouseDown = function(event)
 {
-    if (!this.treeOutline || !this.selectable || this.selected)
-        return;
+this.select(false, true);
+}
 
-    if (this.treeOutline.selectedTreeElement)
-        this.treeOutline.selectedTreeElement.deselect();
+TreeElement.prototype.select = function(supressOnSelect, selectedByUser)
+{
+if (!this.treeOutline || !this.selectable || this.selected)
+return;
 
-    this.selected = true;
-    this.treeOutline._childrenListNode.focus();
-    this.treeOutline.selectedTreeElement = this;
-    if (this._listItemNode)
-        this._listItemNode.addStyleClass("selected");
+if (this.treeOutline.selectedTreeElement)
+this.treeOutline.selectedTreeElement.deselect();
 
-    if (this.onselect && !supressOnSelect)
-        this.onselect(this);
+this.selected = true;
+this.treeOutline._childrenListNode.focus();
+this.treeOutline.selectedTreeElement = this;
+if (this._listItemNode)
+this._listItemNode.addStyleClass("selected");
+
+if (this.onselect && !supressOnSelect)
+this.onselect(this, selectedByUser);
 }
 
 TreeElement.prototype.deselect = function(supressOnDeselect)
 {
-    if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected)
-        return false;
+if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected)
+return false;
 
-    this.selected = false;
-    this.treeOutline.selectedTreeElement = null;
-    if (this._listItemNode)
-        this._listItemNode.removeStyleClass("selected");
+this.selected = false;
+this.treeOutline.selectedTreeElement = null;
+if (this._listItemNode)
+this._listItemNode.removeStyleClass("selected");
 
-    if (this.ondeselect && !supressOnDeselect)
-        this.ondeselect(this);
-    return true;
+if (this.ondeselect && !supressOnDeselect)
+this.ondeselect(this);
+return true;
 }
 
 TreeElement.prototype.traverseNextTreeElement = function(skipHidden, stayWithin, dontPopulate, info)
 {
-    if (!dontPopulate && this.hasChildren && this.onpopulate)
-        this.onpopulate(this);
+if (!dontPopulate && this.hasChildren && this.onpopulate)
+this.onpopulate(this);
 
-    if (info)
-        info.depthChange = 0;
+if (info)
+info.depthChange = 0;
 
-    var element = skipHidden ? (this.revealed() ? this.children[0] : null) : this.children[0];
-    if (element && (!skipHidden || (skipHidden && this.expanded))) {
-        if (info)
-            info.depthChange = 1;
-        return element;
-    }
+var element = skipHidden ? (this.revealed() ? this.children[0] : null) : this.children[0];
+if (element && (!skipHidden || (skipHidden && this.expanded))) {
+if (info)
+info.depthChange = 1;
+return element;
+}
 
-    if (this === stayWithin)
-        return null;
+if (this === stayWithin)
+return null;
 
-    element = skipHidden ? (this.revealed() ? this.nextSibling : null) : this.nextSibling;
-    if (element)
-        return element;
+element = skipHidden ? (this.revealed() ? this.nextSibling : null) : this.nextSibling;
+if (element)
+return element;
 
-    element = this;
-    while (element && !element.root && !(skipHidden ? (element.revealed() ? element.nextSibling : null) : element.nextSibling) && element.parent !== stayWithin) {
-        if (info)
-            info.depthChange -= 1;
-        element = element.parent;
-    }
+element = this;
+while (element && !element.root && !(skipHidden ? (element.revealed() ? element.nextSibling : null) : element.nextSibling) && element.parent !== stayWithin) {
+if (info)
+info.depthChange -= 1;
+element = element.parent;
+}
 
-    if (!element)
-        return null;
+if (!element)
+return null;
 
-    return (skipHidden ? (element.revealed() ? element.nextSibling : null) : element.nextSibling);
+return (skipHidden ? (element.revealed() ? element.nextSibling : null) : element.nextSibling);
 }
 
 TreeElement.prototype.traversePreviousTreeElement = function(skipHidden, dontPopulate)
 {
-    var element = skipHidden ? (this.revealed() ? this.previousSibling : null) : this.previousSibling;
-    if (!dontPopulate && element && element.hasChildren && element.onpopulate)
-        element.onpopulate(element);
+var element = skipHidden ? (this.revealed() ? this.previousSibling : null) : this.previousSibling;
+if (!dontPopulate && element && element.hasChildren && element.onpopulate)
+element.onpopulate(element);
 
-    while (element && (skipHidden ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1])) {
-        if (!dontPopulate && element.hasChildren && element.onpopulate)
-            element.onpopulate(element);
-        element = (skipHidden ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1]);
-    }
+while (element && (skipHidden ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1])) {
+if (!dontPopulate && element.hasChildren && element.onpopulate)
+element.onpopulate(element);
+element = (skipHidden ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1]);
+}
 
-    if (element)
-        return element;
+if (element)
+return element;
 
-    if (!this.parent || this.parent.root)
-        return null;
+if (!this.parent || this.parent.root)
+return null;
 
-    return this.parent;
+return this.parent;
 }
 
 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event)
 {
-    var left = this._listItemNode.totalOffsetLeft;
-    return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
+var left = this._listItemNode.totalOffsetLeft;
+return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
 }
 
-/* inspector.js */
 
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-function preloadImages()
+
+
+
+;(function preloadImages()
 {
-    (new Image()).src = "Images/clearConsoleButtonGlyph.png";
-    (new Image()).src = "Images/consoleButtonGlyph.png";
-    (new Image()).src = "Images/dockButtonGlyph.png";
-    (new Image()).src = "Images/enableOutlineButtonGlyph.png";
-    (new Image()).src = "Images/enableSolidButtonGlyph.png";
-    (new Image()).src = "Images/excludeButtonGlyph.png";
-    (new Image()).src = "Images/focusButtonGlyph.png";
-    (new Image()).src = "Images/largerResourcesButtonGlyph.png";
-    (new Image()).src = "Images/nodeSearchButtonGlyph.png";
-    (new Image()).src = "Images/pauseOnExceptionButtonGlyph.png";
-    (new Image()).src = "Images/percentButtonGlyph.png";
-    (new Image()).src = "Images/recordButtonGlyph.png";
-    (new Image()).src = "Images/recordToggledButtonGlyph.png";
-    (new Image()).src = "Images/reloadButtonGlyph.png";
-    (new Image()).src = "Images/undockButtonGlyph.png";
-}
-
-preloadImages();
+(new Image()).src = "Images/clearConsoleButtonGlyph.png";
+(new Image()).src = "Images/consoleButtonGlyph.png";
+(new Image()).src = "Images/dockButtonGlyph.png";
+(new Image()).src = "Images/enableOutlineButtonGlyph.png";
+(new Image()).src = "Images/enableSolidButtonGlyph.png";
+(new Image()).src = "Images/excludeButtonGlyph.png";
+(new Image()).src = "Images/focusButtonGlyph.png";
+(new Image()).src = "Images/largerResourcesButtonGlyph.png";
+(new Image()).src = "Images/nodeSearchButtonGlyph.png";
+(new Image()).src = "Images/pauseOnExceptionButtonGlyph.png";
+(new Image()).src = "Images/percentButtonGlyph.png";
+(new Image()).src = "Images/recordButtonGlyph.png";
+(new Image()).src = "Images/recordToggledButtonGlyph.png";
+(new Image()).src = "Images/reloadButtonGlyph.png";
+(new Image()).src = "Images/undockButtonGlyph.png";
+})();
 
 var WebInspector = {
-    resources: {},
-    resourceURLMap: {},
-    cookieDomains: {},
-    missingLocalizedStrings: {},
-    pendingDispatches: 0,
+resources: {},
+missingLocalizedStrings: {},
+pendingDispatches: 0,
 
-    // RegExp groups:
-    // 1 - scheme
-    // 2 - hostname
-    // 3 - ?port
-    // 4 - ?path
-    // 5 - ?fragment
-    URLRegExp: /^(http[s]?|file):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i,
-    GenericURLRegExp: /^([^:]+):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i,
+get platform()
+{
+if (!("_platform" in this))
+this._platform = InspectorFrontendHost.platform();
 
-    get platform()
-    {
-        if (!("_platform" in this))
-            this._platform = InspectorFrontendHost.platform();
+return this._platform;
+},
 
-        return this._platform;
-    },
+get platformFlavor()
+{
+if (!("_platformFlavor" in this))
+this._platformFlavor = this._detectPlatformFlavor();
 
-    get platformFlavor()
-    {
-        if (!("_platformFlavor" in this))
-            this._platformFlavor = this._detectPlatformFlavor();
+return this._platformFlavor;
+},
 
-        return this._platformFlavor;
-    },
+_detectPlatformFlavor: function()
+{
+const userAgent = navigator.userAgent;
 
-    _detectPlatformFlavor: function()
-    {
-        const userAgent = navigator.userAgent;
+if (this.platform === "windows") {
+var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/);
+if (match && match[1] >= 6)
+return WebInspector.PlatformFlavor.WindowsVista;
+return null;
+} else if (this.platform === "mac") {
+var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);
+if (!match || match[1] != 10)
+return WebInspector.PlatformFlavor.MacSnowLeopard;
+switch (Number(match[2])) {
+case 4:
+return WebInspector.PlatformFlavor.MacTiger;
+case 5:
+return WebInspector.PlatformFlavor.MacLeopard;
+case 6:
+default:
+return WebInspector.PlatformFlavor.MacSnowLeopard;
+}
+}
 
-        if (this.platform === "windows") {
-            var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/);
-            if (match && match[1] >= 6)
-                return WebInspector.PlatformFlavor.WindowsVista;
-            return null;
-        } else if (this.platform === "mac") {
-            var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);
-            if (!match || match[1] != 10)
-                return WebInspector.PlatformFlavor.MacSnowLeopard;
-            switch (Number(match[2])) {
-                case 4:
-                    return WebInspector.PlatformFlavor.MacTiger;
-                case 5:
-                    return WebInspector.PlatformFlavor.MacLeopard;
-                case 6:
-                default:
-                    return WebInspector.PlatformFlavor.MacSnowLeopard;
-            }
-        }
+return null;
+},
 
-        return null;
-    },
+get port()
+{
+if (!("_port" in this))
+this._port = InspectorFrontendHost.port();
 
-    get port()
-    {
-        if (!("_port" in this))
-            this._port = InspectorFrontendHost.port();
+return this._port;
+},
 
-        return this._port;
-    },
+get previousFocusElement()
+{
+return this._previousFocusElement;
+},
 
-    get previousFocusElement()
-    {
-        return this._previousFocusElement;
-    },
+get currentFocusElement()
+{
+return this._currentFocusElement;
+},
 
-    get currentFocusElement()
-    {
-        return this._currentFocusElement;
-    },
+set currentFocusElement(x)
+{
+if (this._currentFocusElement !== x)
+this._previousFocusElement = this._currentFocusElement;
+this._currentFocusElement = x;
 
-    set currentFocusElement(x)
-    {
-        if (this._currentFocusElement !== x)
-            this._previousFocusElement = this._currentFocusElement;
-        this._currentFocusElement = x;
+if (this._currentFocusElement) {
+this._currentFocusElement.focus();
 
-        if (this._currentFocusElement) {
-            this._currentFocusElement.focus();
 
-            // Make a caret selection inside the new element if there isn't a range selection and
-            // there isn't already a caret selection inside.
-            var selection = window.getSelection();
-            if (selection.isCollapsed && !this._currentFocusElement.isInsertionCaretInside()) {
-                var selectionRange = this._currentFocusElement.ownerDocument.createRange();
-                selectionRange.setStart(this._currentFocusElement, 0);
-                selectionRange.setEnd(this._currentFocusElement, 0);
 
-                selection.removeAllRanges();
-                selection.addRange(selectionRange);
-            }
-        } else if (this._previousFocusElement)
-            this._previousFocusElement.blur();
-    },
+var selection = window.getSelection();
+if (selection.isCollapsed && !this._currentFocusElement.isInsertionCaretInside()) {
+var selectionRange = this._currentFocusElement.ownerDocument.createRange();
+selectionRange.setStart(this._currentFocusElement, 0);
+selectionRange.setEnd(this._currentFocusElement, 0);
 
-    get currentPanel()
-    {
-        return this._currentPanel;
-    },
+selection.removeAllRanges();
+selection.addRange(selectionRange);
+}
+} else if (this._previousFocusElement)
+this._previousFocusElement.blur();
+},
 
-    set currentPanel(x)
-    {
-        if (this._currentPanel === x)
-            return;
+get currentPanel()
+{
+return this._currentPanel;
+},
 
-        if (this._currentPanel)
-            this._currentPanel.hide();
+set currentPanel(x)
+{
+if (this._currentPanel === x)
+return;
 
-        this._currentPanel = x;
+if (this._currentPanel)
+this._currentPanel.hide();
 
-        this.updateSearchLabel();
+this._currentPanel = x;
 
-        if (x) {
-            x.show();
+this.updateSearchLabel();
 
-            if (this.currentQuery) {
-                if (x.performSearch) {
-                    function performPanelSearch()
-                    {
-                        this.updateSearchMatchesCount();
+if (x) {
+x.show();
 
-                        x.currentQuery = this.currentQuery;
-                        x.performSearch(this.currentQuery);
-                    }
+if (this.currentQuery) {
+if (x.performSearch) {
+function performPanelSearch()
+{
+this.updateSearchMatchesCount();
 
-                    // Perform the search on a timeout so the panel switches fast.
-                    setTimeout(performPanelSearch.bind(this), 0);
-                } else {
-                    // Update to show Not found for panels that can't be searched.
-                    this.updateSearchMatchesCount();
-                }
-            }
-        }
+x.currentQuery = this.currentQuery;
+x.performSearch(this.currentQuery);
+}
 
-        for (var panelName in WebInspector.panels) {
-            if (WebInspector.panels[panelName] == x)
-                InspectorBackend.storeLastActivePanel(panelName);
-        }
-    },
 
-    _createPanels: function()
-    {
-        var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
-        if (hiddenPanels.indexOf("elements") === -1)
-            this.panels.elements = new WebInspector.ElementsPanel();
-        if (hiddenPanels.indexOf("resources") === -1)
-            this.panels.resources = new WebInspector.ResourcesPanel();
-        if (hiddenPanels.indexOf("scripts") === -1)
-            this.panels.scripts = new WebInspector.ScriptsPanel();
-        if (hiddenPanels.indexOf("timeline") === -1)
-            this.panels.timeline = new WebInspector.TimelinePanel();
-        if (hiddenPanels.indexOf("profiles") === -1) {
-            this.panels.profiles = new WebInspector.ProfilesPanel();
-            this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType());
-        }
-        if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1)
-            this.panels.storage = new WebInspector.StoragePanel();
-        if (Preferences.auditsPanelEnabled && hiddenPanels.indexOf("audits") === -1)
-            this.panels.audits = new WebInspector.AuditsPanel();
-        if (hiddenPanels.indexOf("console") === -1)
-            this.panels.console = new WebInspector.ConsolePanel();
-    },
+setTimeout(performPanelSearch.bind(this), 0);
+} else {
 
-    get attached()
-    {
-        return this._attached;
-    },
+this.updateSearchMatchesCount();
+}
+}
+}
 
-    set attached(x)
-    {
-        if (this._attached === x)
-            return;
+for (var panelName in WebInspector.panels) {
+if (WebInspector.panels[panelName] === x) {
+WebInspector.settings.lastActivePanel = panelName;
+this._panelHistory.setPanel(panelName);
+}
+}
+},
 
-        this._attached = x;
+createJSBreakpointsSidebarPane: function()
+{
+var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("Breakpoints"));
+function breakpointAdded(event)
+{
+pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data));
+}
+WebInspector.debuggerModel.addEventListener("breakpoint-added", breakpointAdded);
+return pane;
+},
 
-        this.updateSearchLabel();
+createDOMBreakpointsSidebarPane: function()
+{
+var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("DOM Breakpoints"));
+function breakpointAdded(event)
+{
+pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data));
+}
+WebInspector.breakpointManager.addEventListener("dom-breakpoint-added", breakpointAdded);
+return pane;
+},
 
-        var dockToggleButton = document.getElementById("dock-status-bar-item");
-        var body = document.body;
+createXHRBreakpointsSidebarPane: function()
+{
+var pane = new WebInspector.XHRBreakpointsSidebarPane();
+function breakpointAdded(event)
+{
+pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data));
+}
+WebInspector.breakpointManager.addEventListener("xhr-breakpoint-added", breakpointAdded);
+return pane;
+},
 
-        if (x) {
-            InspectorFrontendHost.attach();
-            body.removeStyleClass("detached");
-            body.addStyleClass("attached");
-            dockToggleButton.title = WebInspector.UIString("Undock into separate window.");
-        } else {
-            InspectorFrontendHost.detach();
-            body.removeStyleClass("attached");
-            body.addStyleClass("detached");
-            dockToggleButton.title = WebInspector.UIString("Dock to main window.");
-        }
-    },
+_createPanels: function()
+{
+var hiddenPanels = (InspectorFrontendHost.hiddenPanels() || "").split(',');
+if (hiddenPanels.indexOf("elements") === -1)
+this.panels.elements = new WebInspector.ElementsPanel();
+if (hiddenPanels.indexOf("resources") === -1)
+this.panels.resources = new WebInspector.ResourcesPanel();
+if (hiddenPanels.indexOf("network") === -1)
+this.panels.network = new WebInspector.NetworkPanel();
+if (hiddenPanels.indexOf("scripts") === -1)
+this.panels.scripts = new WebInspector.ScriptsPanel();
+if (hiddenPanels.indexOf("timeline") === -1)
+this.panels.timeline = new WebInspector.TimelinePanel();
+if (hiddenPanels.indexOf("profiles") === -1) {
+this.panels.profiles = new WebInspector.ProfilesPanel();
+this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType());
+if (Preferences.heapProfilerPresent)
+this.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType());
+}
+if (hiddenPanels.indexOf("audits") === -1)
+this.panels.audits = new WebInspector.AuditsPanel();
+if (hiddenPanels.indexOf("console") === -1)
+this.panels.console = new WebInspector.ConsolePanel();
+},
 
-    get errors()
-    {
-        return this._errors || 0;
-    },
+get attached()
+{
+return this._attached;
+},
 
-    set errors(x)
-    {
-        x = Math.max(x, 0);
+set attached(x)
+{
+if (this._attached === x)
+return;
 
-        if (this._errors === x)
-            return;
-        this._errors = x;
-        this._updateErrorAndWarningCounts();
-    },
+this._attached = x;
 
-    get warnings()
-    {
-        return this._warnings || 0;
-    },
+this.updateSearchLabel();
 
-    set warnings(x)
-    {
-        x = Math.max(x, 0);
+var dockToggleButton = document.getElementById("dock-status-bar-item");
+var body = document.body;
 
-        if (this._warnings === x)
-            return;
-        this._warnings = x;
-        this._updateErrorAndWarningCounts();
-    },
+if (x) {
+body.removeStyleClass("detached");
+body.addStyleClass("attached");
+dockToggleButton.title = WebInspector.UIString("Undock into separate window.");
+} else {
+body.removeStyleClass("attached");
+body.addStyleClass("detached");
+dockToggleButton.title = WebInspector.UIString("Dock to main window.");
+}
+if (this.drawer)
+this.drawer.resize();
+},
 
-    _updateErrorAndWarningCounts: function()
-    {
-        var errorWarningElement = document.getElementById("error-warning-count");
-        if (!errorWarningElement)
-            return;
+get errors()
+{
+return this._errors || 0;
+},
 
-        if (!this.errors && !this.warnings) {
-            errorWarningElement.addStyleClass("hidden");
-            return;
-        }
+set errors(x)
+{
+x = Math.max(x, 0);
 
-        errorWarningElement.removeStyleClass("hidden");
+if (this._errors === x)
+return;
+this._errors = x;
+this._updateErrorAndWarningCounts();
+},
 
-        errorWarningElement.removeChildren();
+get warnings()
+{
+return this._warnings || 0;
+},
 
-        if (this.errors) {
-            var errorElement = document.createElement("span");
-            errorElement.id = "error-count";
-            errorElement.textContent = this.errors;
-            errorWarningElement.appendChild(errorElement);
-        }
+set warnings(x)
+{
+x = Math.max(x, 0);
 
-        if (this.warnings) {
-            var warningsElement = document.createElement("span");
-            warningsElement.id = "warning-count";
-            warningsElement.textContent = this.warnings;
-            errorWarningElement.appendChild(warningsElement);
-        }
+if (this._warnings === x)
+return;
+this._warnings = x;
+this._updateErrorAndWarningCounts();
+},
 
-        if (this.errors) {
-            if (this.warnings) {
-                if (this.errors == 1) {
-                    if (this.warnings == 1)
-                        errorWarningElement.title = WebInspector.UIString("%d error, %d warning", this.errors, this.warnings);
-                    else
-                        errorWarningElement.title = WebInspector.UIString("%d error, %d warnings", this.errors, this.warnings);
-                } else if (this.warnings == 1)
-                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warning", this.errors, this.warnings);
-                else
-                    errorWarningElement.title = WebInspector.UIString("%d errors, %d warnings", this.errors, this.warnings);
-            } else if (this.errors == 1)
-                errorWarningElement.title = WebInspector.UIString("%d error", this.errors);
-            else
-                errorWarningElement.title = WebInspector.UIString("%d errors", this.errors);
-        } else if (this.warnings == 1)
-            errorWarningElement.title = WebInspector.UIString("%d warning", this.warnings);
-        else if (this.warnings)
-            errorWarningElement.title = WebInspector.UIString("%d warnings", this.warnings);
-        else
-            errorWarningElement.title = null;
-    },
+_updateErrorAndWarningCounts: function()
+{
+var errorWarningElement = document.getElementById("error-warning-count");
+if (!errorWarningElement)
+return;
 
-    get styleChanges()
-    {
-        return this._styleChanges;
-    },
+if (!this.errors && !this.warnings) {
+errorWarningElement.addStyleClass("hidden");
+return;
+}
 
-    set styleChanges(x)
-    {
-        x = Math.max(x, 0);
+errorWarningElement.removeStyleClass("hidden");
 
-        if (this._styleChanges === x)
-            return;
-        this._styleChanges = x;
-        this._updateChangesCount();
-    },
+errorWarningElement.removeChildren();
 
-    _updateChangesCount: function()
-    {
-        // TODO: Remove immediate return when enabling the Changes Panel
-        return;
+if (this.errors) {
+var errorElement = document.createElement("span");
+errorElement.id = "error-count";
+errorElement.textContent = this.errors;
+errorWarningElement.appendChild(errorElement);
+}
 
-        var changesElement = document.getElementById("changes-count");
-        if (!changesElement)
-            return;
+if (this.warnings) {
+var warningsElement = document.createElement("span");
+warningsElement.id = "warning-count";
+warningsElement.textContent = this.warnings;
+errorWarningElement.appendChild(warningsElement);
+}
 
-        if (!this.styleChanges) {
-            changesElement.addStyleClass("hidden");
-            return;
-        }
+if (this.errors) {
+if (this.warnings) {
+if (this.errors == 1) {
+if (this.warnings == 1)
+errorWarningElement.title = WebInspector.UIString("%d error, %d warning", this.errors, this.warnings);
+else
+errorWarningElement.title = WebInspector.UIString("%d error, %d warnings", this.errors, this.warnings);
+} else if (this.warnings == 1)
+errorWarningElement.title = WebInspector.UIString("%d errors, %d warning", this.errors, this.warnings);
+else
+errorWarningElement.title = WebInspector.UIString("%d errors, %d warnings", this.errors, this.warnings);
+} else if (this.errors == 1)
+errorWarningElement.title = WebInspector.UIString("%d error", this.errors);
+else
+errorWarningElement.title = WebInspector.UIString("%d errors", this.errors);
+} else if (this.warnings == 1)
+errorWarningElement.title = WebInspector.UIString("%d warning", this.warnings);
+else if (this.warnings)
+errorWarningElement.title = WebInspector.UIString("%d warnings", this.warnings);
+else
+errorWarningElement.title = null;
+},
 
-        changesElement.removeStyleClass("hidden");
-        changesElement.removeChildren();
+get styleChanges()
+{
+return this._styleChanges;
+},
 
-        if (this.styleChanges) {
-            var styleChangesElement = document.createElement("span");
-            styleChangesElement.id = "style-changes-count";
-            styleChangesElement.textContent = this.styleChanges;
-            changesElement.appendChild(styleChangesElement);
-        }
+set styleChanges(x)
+{
+x = Math.max(x, 0);
 
-        if (this.styleChanges) {
-            if (this.styleChanges === 1)
-                changesElement.title = WebInspector.UIString("%d style change", this.styleChanges);
-            else
-                changesElement.title = WebInspector.UIString("%d style changes", this.styleChanges);
-        }
-    },
+if (this._styleChanges === x)
+return;
+this._styleChanges = x;
+this._updateChangesCount();
+},
 
-    get hoveredDOMNode()
-    {
-        return this._hoveredDOMNode;
-    },
+_updateChangesCount: function()
+{
 
-    set hoveredDOMNode(x)
-    {
-        if (this._hoveredDOMNode === x)
-            return;
+return;
 
-        this._hoveredDOMNode = x;
+var changesElement = document.getElementById("changes-count");
+if (!changesElement)
+return;
 
-        if (this._hoveredDOMNode)
-            this._updateHoverHighlightSoon(this.showingDOMNodeHighlight ? 50 : 500);
-        else
-            this._updateHoverHighlight();
-    },
+if (!this.styleChanges) {
+changesElement.addStyleClass("hidden");
+return;
+}
 
-    _updateHoverHighlightSoon: function(delay)
-    {
-        if ("_updateHoverHighlightTimeout" in this)
-            clearTimeout(this._updateHoverHighlightTimeout);
-        this._updateHoverHighlightTimeout = setTimeout(this._updateHoverHighlight.bind(this), delay);
-    },
+changesElement.removeStyleClass("hidden");
+changesElement.removeChildren();
 
-    _updateHoverHighlight: function()
-    {
-        if ("_updateHoverHighlightTimeout" in this) {
-            clearTimeout(this._updateHoverHighlightTimeout);
-            delete this._updateHoverHighlightTimeout;
-        }
+if (this.styleChanges) {
+var styleChangesElement = document.createElement("span");
+styleChangesElement.id = "style-changes-count";
+styleChangesElement.textContent = this.styleChanges;
+changesElement.appendChild(styleChangesElement);
+}
 
-        if (this._hoveredDOMNode) {
-            InspectorBackend.highlightDOMNode(this._hoveredDOMNode.id);
-            this.showingDOMNodeHighlight = true;
-        } else {
-            InspectorBackend.hideDOMNodeHighlight();
-            this.showingDOMNodeHighlight = false;
-        }
-    }
+if (this.styleChanges) {
+if (this.styleChanges === 1)
+changesElement.title = WebInspector.UIString("%d style change", this.styleChanges);
+else
+changesElement.title = WebInspector.UIString("%d style changes", this.styleChanges);
+}
+},
+
+highlightDOMNode: function(nodeId)
+{
+if ("_hideDOMNodeHighlightTimeout" in this) {
+clearTimeout(this._hideDOMNodeHighlightTimeout);
+delete this._hideDOMNodeHighlightTimeout;
+}
+
+if (this._highlightedDOMNodeId === nodeId)
+return;
+
+this._highlightedDOMNodeId = nodeId;
+if (nodeId)
+InspectorBackend.highlightDOMNode(nodeId);
+else
+InspectorBackend.hideDOMNodeHighlight();
+},
+
+highlightDOMNodeForTwoSeconds: function(nodeId)
+{
+this.highlightDOMNode(nodeId);
+this._hideDOMNodeHighlightTimeout = setTimeout(this.highlightDOMNode.bind(this, 0), 2000);
+},
+
+wireElementWithDOMNode: function(element, nodeId)
+{
+element.addEventListener("click", this._updateFocusedNode.bind(this, nodeId), false);
+element.addEventListener("mouseover", this.highlightDOMNode.bind(this, nodeId), false);
+element.addEventListener("mouseout", this.highlightDOMNode.bind(this, 0), false);
+},
+
+_updateFocusedNode: function(nodeId)
+{
+this.currentPanel = this.panels.elements;
+this.panels.elements.updateFocusedNode(nodeId);
+},
+
+get networkResources()
+{
+return this.panels.network.resources;
+},
+
+forAllResources: function(callback)
+{
+WebInspector.resourceManager.forAllResources(callback);
+},
+
+resourceForURL: function(url)
+{
+return this.resourceManager.resourceForURL(url);
+}
 }
 
 WebInspector.PlatformFlavor = {
-    WindowsVista: "windows-vista",
-    MacTiger: "mac-tiger",
-    MacLeopard: "mac-leopard",
-    MacSnowLeopard: "mac-snowleopard"
+WindowsVista: "windows-vista",
+MacTiger: "mac-tiger",
+MacLeopard: "mac-leopard",
+MacSnowLeopard: "mac-snowleopard"
+};
+
+(function parseQueryParameters()
+{
+WebInspector.queryParamsObject = {};
+var queryParams = window.location.search;
+if (!queryParams)
+return;
+var params = queryParams.substring(1).split("&");
+for (var i = 0; i < params.length; ++i) {
+var pair = params[i].split("=");
+WebInspector.queryParamsObject[pair[0]] = pair[1];
 }
+})();
 
 WebInspector.loaded = function()
 {
-    InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");");
+if ("page" in WebInspector.queryParamsObject) {
+WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector.queryParamsObject.page);
+WebInspector.socket.onmessage = function(message) { InspectorBackend.dispatch(message.data); }
+WebInspector.socket.onerror = function(error) { console.error(error); }
+WebInspector.socket.onopen = function() {
+InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket);
+InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded");
+WebInspector.doLoadedDone();
+}
+return;
+}
+WebInspector.doLoadedDone();
+}
 
-    var platform = WebInspector.platform;
-    document.body.addStyleClass("platform-" + platform);
-    var flavor = WebInspector.platformFlavor;
-    if (flavor)
-        document.body.addStyleClass("platform-" + flavor);
-    var port = WebInspector.port;
-    document.body.addStyleClass("port-" + port);
+WebInspector.doLoadedDone = function()
+{
+InspectorBackend.setInjectedScriptSource("(" + injectedScriptConstructor + ");");
 
-    this.settings = new WebInspector.Settings();
+var platform = WebInspector.platform;
+document.body.addStyleClass("platform-" + platform);
+var flavor = WebInspector.platformFlavor;
+if (flavor)
+document.body.addStyleClass("platform-" + flavor);
+var port = WebInspector.port;
+document.body.addStyleClass("port-" + port);
 
-    this.drawer = new WebInspector.Drawer();
-    this.console = new WebInspector.ConsoleView(this.drawer);
-    // TODO: Uncomment when enabling the Changes Panel
-    // this.changes = new WebInspector.ChangesView(this.drawer);
-    // TODO: Remove class="hidden" from inspector.html on button#changes-status-bar-item
-    this.drawer.visibleView = this.console;
-    this.domAgent = new WebInspector.DOMAgent();
+InspectorFrontendHost.loaded();
+WebInspector.settings = new WebInspector.Settings();
 
-    this.resourceCategories = {
-        documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"),
-        stylesheets: new WebInspector.ResourceCategory("stylesheets", WebInspector.UIString("Stylesheets"), "rgb(157,231,119)"),
-        images: new WebInspector.ResourceCategory("images", WebInspector.UIString("Images"), "rgb(164,60,255)"),
-        scripts: new WebInspector.ResourceCategory("scripts", WebInspector.UIString("Scripts"), "rgb(255,121,0)"),
-        xhr: new WebInspector.ResourceCategory("xhr", WebInspector.UIString("XHR"), "rgb(231,231,10)"),
-        fonts: new WebInspector.ResourceCategory("fonts", WebInspector.UIString("Fonts"), "rgb(255,82,62)"),
-        other: new WebInspector.ResourceCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)")
-    };
+this._registerShortcuts();
 
-    this.panels = {};
-    this._createPanels();
 
-    var toolbarElement = document.getElementById("toolbar");
-    var previousToolbarItem = toolbarElement.children[0];
+WebInspector.shortcutsHelp.section(WebInspector.UIString("Console"));
+WebInspector.shortcutsHelp.section(WebInspector.UIString("Elements Panel"));
 
-    this.panelOrder = [];
-    for (var panelName in this.panels)
-        previousToolbarItem = WebInspector.addPanelToolbarIcon(toolbarElement, this.panels[panelName], previousToolbarItem);
+this.drawer = new WebInspector.Drawer();
+this.console = new WebInspector.ConsoleView(this.drawer);
 
-    this.Tips = {
-        ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")}
-    };
 
-    this.Warnings = {
-        IncorrectMIMEType: {id: 0, message: WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s.")}
-    };
 
-    this.addMainEventListeners(document);
+this.drawer.visibleView = this.console;
+this.resourceManager = new WebInspector.ResourceManager();
+this.domAgent = new WebInspector.DOMAgent();
 
-    window.addEventListener("unload", this.windowUnload.bind(this), true);
-    window.addEventListener("resize", this.windowResize.bind(this), true);
+InspectorBackend.registerDomainDispatcher("Inspector", this);
 
-    document.addEventListener("focus", this.focusChanged.bind(this), true);
-    document.addEventListener("keydown", this.documentKeyDown.bind(this), false);
-    document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true);
-    document.addEventListener("copy", this.documentCopy.bind(this), true);
-    document.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true);
+this.resourceCategories = {
+documents: new WebInspector.ResourceCategory("documents", WebInspector.UIString("Documents"), "rgb(47,102,236)"),
+stylesheets: new WebInspector.ResourceCategory("stylesheets", WebInspector.UIString("Stylesheets"), "rgb(157,231,119)"),
+images: new WebInspector.ResourceCategory("images", WebInspector.UIString("Images"), "rgb(164,60,255)"),
+scripts: new WebInspector.ResourceCategory("scripts", WebInspector.UIString("Scripts"), "rgb(255,121,0)"),
+xhr: new WebInspector.ResourceCategory("xhr", WebInspector.UIString("XHR"), "rgb(231,231,10)"),
+fonts: new WebInspector.ResourceCategory("fonts", WebInspector.UIString("Fonts"), "rgb(255,82,62)"),
+websockets: new WebInspector.ResourceCategory("websockets", WebInspector.UIString("WebSocket"), "rgb(186,186,186)"), 
+other: new WebInspector.ResourceCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)")
+};
 
-    var dockToggleButton = document.getElementById("dock-status-bar-item");
-    dockToggleButton.addEventListener("click", this.toggleAttach.bind(this), false);
+this.cssModel = new WebInspector.CSSStyleModel();
+this.debuggerModel = new WebInspector.DebuggerModel();
 
-    if (this.attached)
-        dockToggleButton.title = WebInspector.UIString("Undock into separate window.");
-    else
-        dockToggleButton.title = WebInspector.UIString("Dock to main window.");
+this.breakpointManager = new WebInspector.BreakpointManager();
 
-    var errorWarningCount = document.getElementById("error-warning-count");
-    errorWarningCount.addEventListener("click", this.showConsole.bind(this), false);
-    this._updateErrorAndWarningCounts();
+this.panels = {};
+this._createPanels();
+this._panelHistory = new WebInspector.PanelHistory();
 
-    this.styleChanges = 0;
-    // TODO: Uncomment when enabling the Changes Panel
-    // var changesElement = document.getElementById("changes-count");
-    // changesElement.addEventListener("click", this.showChanges.bind(this), false);
-    // this._updateErrorAndWarningCounts();
+var toolbarElement = document.getElementById("toolbar");
+var previousToolbarItem = toolbarElement.children[0];
 
-    var searchField = document.getElementById("search");
-    searchField.addEventListener("search", this.performSearch.bind(this), false); // when the search is emptied
-    searchField.addEventListener("mousedown", this._searchFieldManualFocus.bind(this), false); // when the search field is manually selected
-    searchField.addEventListener("keydown", this._searchKeyDown.bind(this), true);
+this.panelOrder = [];
+for (var panelName in this.panels)
+previousToolbarItem = WebInspector.addPanelToolbarIcon(toolbarElement, this.panels[panelName], previousToolbarItem);
 
-    toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true);
-    document.getElementById("close-button-left").addEventListener("click", this.close, true);
-    document.getElementById("close-button-right").addEventListener("click", this.close, true);
+this.Tips = {
+ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")}
+};
 
-    InspectorFrontendHost.loaded();
+this.Warnings = {
+IncorrectMIMEType: {id: 0, message: WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s.")}
+};
+
+this.addMainEventListeners(document);
+
+window.addEventListener("resize", this.windowResize.bind(this), true);
+
+document.addEventListener("focus", this.focusChanged.bind(this), true);
+document.addEventListener("keydown", this.documentKeyDown.bind(this), false);
+document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true);
+document.addEventListener("copy", this.documentCopy.bind(this), true);
+document.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true);
+
+var dockToggleButton = document.getElementById("dock-status-bar-item");
+dockToggleButton.addEventListener("click", this.toggleAttach.bind(this), false);
+
+if (this.attached)
+dockToggleButton.title = WebInspector.UIString("Undock into separate window.");
+else
+dockToggleButton.title = WebInspector.UIString("Dock to main window.");
+
+var errorWarningCount = document.getElementById("error-warning-count");
+errorWarningCount.addEventListener("click", this.showConsole.bind(this), false);
+this._updateErrorAndWarningCounts();
+
+this.styleChanges = 0;
+
+
+
+
+
+var searchField = document.getElementById("search");
+searchField.addEventListener("search", this.performSearch.bind(this), false); 
+searchField.addEventListener("mousedown", this._searchFieldManualFocus.bind(this), false); 
+searchField.addEventListener("keydown", this._searchKeyDown.bind(this), true);
+
+toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true);
+document.getElementById("close-button-left").addEventListener("click", this.close, true);
+document.getElementById("close-button-right").addEventListener("click", this.close, true);
+
+this.extensionServer.initExtensions();
+
+function populateInspectorState(inspectorState)
+{
+WebInspector.monitoringXHREnabled = inspectorState.monitoringXHREnabled;
+if ("pauseOnExceptionsState" in inspectorState)
+WebInspector.panels.scripts.updatePauseOnExceptionsState(inspectorState.pauseOnExceptionsState);
+}
+InspectorBackend.getInspectorState(populateInspectorState);
+
+function onPopulateScriptObjects()
+{
+if (!WebInspector.currentPanel)
+WebInspector.showPanel(WebInspector.settings.lastActivePanel);
+}
+InspectorBackend.populateScriptObjects(onPopulateScriptObjects);
+
+InspectorBackend.setConsoleMessagesEnabled(true);
+
+
+InspectorBackend.getSupportedCSSProperties(WebInspector.CSSCompletions._load);
 }
 
 WebInspector.addPanelToolbarIcon = function(toolbarElement, panel, previousToolbarItem)
 {
-    var panelToolbarItem = panel.toolbarItem;
-    this.panelOrder.push(panel);
-    panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this));
-    if (previousToolbarItem)
-        toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling);
-    else
-        toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstChild);
-    return panelToolbarItem;
+var panelToolbarItem = panel.toolbarItem;
+this.panelOrder.push(panel);
+panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this));
+if (previousToolbarItem)
+toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling);
+else
+toolbarElement.insertBefore(panelToolbarItem, toolbarElement.firstChild);
+return panelToolbarItem;
 }
 
 var windowLoaded = function()
 {
-    var localizedStringsURL = InspectorFrontendHost.localizedStringsURL();
-    if (localizedStringsURL) {
-        var localizedStringsScriptElement = document.createElement("script");
-        localizedStringsScriptElement.addEventListener("load", WebInspector.loaded.bind(WebInspector), false);
-        localizedStringsScriptElement.type = "text/javascript";
-        localizedStringsScriptElement.src = localizedStringsURL;
-        document.head.appendChild(localizedStringsScriptElement);
-    } else
-        WebInspector.loaded();
+var localizedStringsURL = InspectorFrontendHost.localizedStringsURL();
+if (localizedStringsURL) {
+var localizedStringsScriptElement = document.createElement("script");
+localizedStringsScriptElement.addEventListener("load", WebInspector.loaded.bind(WebInspector), false);
+localizedStringsScriptElement.type = "text/javascript";
+localizedStringsScriptElement.src = localizedStringsURL;
+document.head.appendChild(localizedStringsScriptElement);
+} else
+WebInspector.loaded();
 
-    window.removeEventListener("load", windowLoaded, false);
-    delete windowLoaded;
+window.removeEventListener("DOMContentLoaded", windowLoaded, false);
+delete windowLoaded;
 };
 
-window.addEventListener("load", windowLoaded, false);
+window.addEventListener("DOMContentLoaded", windowLoaded, false);
 
-WebInspector.dispatch = function() {
-    var methodName = arguments[0];
-    var parameters = Array.prototype.slice.call(arguments, 1);
+WebInspector.dispatch = function(message) {
 
-    // We'd like to enforce asynchronous interaction between the inspector controller and the frontend.
-    // This is important to LayoutTests.
-    function delayDispatch()
-    {
-        WebInspector[methodName].apply(WebInspector, parameters);
-        WebInspector.pendingDispatches--;
-    }
-    WebInspector.pendingDispatches++;
-    setTimeout(delayDispatch, 0);
+
+function delayDispatch()
+{
+InspectorBackend.dispatch(message);
+WebInspector.pendingDispatches--;
+}
+WebInspector.pendingDispatches++;
+setTimeout(delayDispatch, 0);
 }
 
-WebInspector.windowUnload = function(event)
+WebInspector.dispatchMessageFromBackend = function(messageObject)
 {
-    InspectorFrontendHost.windowUnloading();
+WebInspector.dispatch(messageObject);
 }
 
 WebInspector.windowResize = function(event)
 {
-    if (this.currentPanel)
-        this.currentPanel.resize();
-    this.drawer.resize();
+if (this.currentPanel)
+this.currentPanel.resize();
+this.drawer.resize();
 }
 
 WebInspector.windowFocused = function(event)
 {
-    // Fires after blur, so when focusing on either the main inspector
-    // or an <iframe> within the inspector we should always remove the
-    // "inactive" class.
-    if (event.target.document.nodeType === Node.DOCUMENT_NODE)
-        document.body.removeStyleClass("inactive");
+
+
+
+if (event.target.document.nodeType === Node.DOCUMENT_NODE)
+document.body.removeStyleClass("inactive");
 }
 
 WebInspector.windowBlurred = function(event)
 {
-    // Leaving the main inspector or an <iframe> within the inspector.
-    // We can add "inactive" now, and if we are moving the focus to another
-    // part of the inspector then windowFocused will correct this.
-    if (event.target.document.nodeType === Node.DOCUMENT_NODE)
-        document.body.addStyleClass("inactive");
+
+
+
+if (event.target.document.nodeType === Node.DOCUMENT_NODE)
+document.body.addStyleClass("inactive");
 }
 
 WebInspector.focusChanged = function(event)
 {
-    this.currentFocusElement = event.target;
+this.currentFocusElement = event.target;
 }
 
 WebInspector.setAttachedWindow = function(attached)
 {
-    this.attached = attached;
+this.attached = attached;
 }
 
 WebInspector.close = function(event)
 {
-    InspectorFrontendHost.closeWindow();
+if (this._isClosing)
+return;
+this._isClosing = true;
+InspectorFrontendHost.closeWindow();
 }
 
-WebInspector.documentMouseOver = function(event)
+WebInspector.disconnectFromBackend = function()
 {
-    if (event.target.tagName !== "A")
-        return;
-
-    const anchor = event.target;
-    if (!anchor.hasStyleClass("webkit-html-resource-link"))
-        return;
-    if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel) || WebInspector.ProfileType.URLRegExp.exec(anchor.href)) {
-        if (event.target.originalTitle)
-            event.target.title = event.target.originalTitle;
-        return;
-    }
-
-    if (!event.target.originalTitle)
-        event.target.originalTitle = event.target.title;
-    event.target.title = WebInspector.UIString("Cannot open this link. Make sure that resource tracking is enabled in the Resources panel.");
+InspectorFrontendHost.disconnectFromBackend();
 }
 
 WebInspector.documentClick = function(event)
 {
-    var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
-    if (!anchor)
-        return;
+var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
+if (!anchor || anchor.target === "_blank")
+return;
 
-    // Prevent the link from navigating, since we don't do any navigation by following links normally.
-    event.preventDefault();
 
-    function followLink()
-    {
-        // FIXME: support webkit-html-external-link links here.
-        if (WebInspector.canShowSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel)) {
-            if (anchor.hasStyleClass("webkit-html-external-link")) {
-                anchor.removeStyleClass("webkit-html-external-link");
-                anchor.addStyleClass("webkit-html-resource-link");
-            }
+event.preventDefault();
+event.stopPropagation();
 
-            WebInspector.showSourceLine(anchor.href, anchor.lineNumber, anchor.preferredPanel);
-            return;
-        }
+function followLink()
+{
 
-        const profileMatch = WebInspector.ProfileType.URLRegExp.exec(anchor.href);
-        if (profileMatch) {
-            WebInspector.showProfileForURL(anchor.href);
-            return;
-        }
+if (WebInspector.canShowSourceLine(anchor.href, anchor.getAttribute("line_number"), anchor.getAttribute("preferred_panel"))) {
+if (anchor.hasStyleClass("webkit-html-external-link")) {
+anchor.removeStyleClass("webkit-html-external-link");
+anchor.addStyleClass("webkit-html-resource-link");
+}
 
-        const urlMatch = WebInspector.GenericURLRegExp.exec(anchor.href);
-        if (urlMatch && urlMatch[1] === "webkit-link-action") {
-            if (urlMatch[2] === "show-panel") {
-                const panel = urlMatch[4].substring(1);
-                if (WebInspector.panels[panel])
-                    WebInspector.currentPanel = WebInspector.panels[panel];
-            }
-            return;
-        }
-    }
+WebInspector.showSourceLine(anchor.href, anchor.getAttribute("line_number"), anchor.getAttribute("preferred_panel"));
+return;
+}
 
-    if (WebInspector.followLinkTimeout)
-        clearTimeout(WebInspector.followLinkTimeout);
+const profileMatch = WebInspector.ProfileType.URLRegExp.exec(anchor.href);
+if (profileMatch) {
+WebInspector.showProfileForURL(anchor.href);
+return;
+}
 
-    if (anchor.preventFollowOnDoubleClick) {
-        // Start a timeout if this is the first click, if the timeout is canceled
-        // before it fires, then a double clicked happened or another link was clicked.
-        if (event.detail === 1)
-            WebInspector.followLinkTimeout = setTimeout(followLink, 333);
-        return;
-    }
+var parsedURL = anchor.href.asParsedURL();
+if (parsedURL && parsedURL.scheme === "webkit-link-action") {
+if (parsedURL.host === "show-panel") {
+var panel = parsedURL.path.substring(1);
+if (WebInspector.panels[panel])
+WebInspector.showPanel(panel);
+}
+return;
+}
 
-    followLink();
+WebInspector.showPanel("resources");
+}
+
+if (WebInspector.followLinkTimeout)
+clearTimeout(WebInspector.followLinkTimeout);
+
+if (anchor.preventFollowOnDoubleClick) {
+
+
+if (event.detail === 1)
+WebInspector.followLinkTimeout = setTimeout(followLink, 333);
+return;
+}
+
+followLink();
+}
+
+WebInspector.openResource = function(resourceURL, inResourcesPanel)
+{
+var resource = WebInspector.resourceForURL(resourceURL);
+if (inResourcesPanel && resource) {
+WebInspector.panels.resources.showResource(resource);
+WebInspector.showPanel("resources");
+} else
+InspectorBackend.openInInspectedWindow(resource ? resource.url : resourceURL);
+}
+
+WebInspector._registerShortcuts = function()
+{
+var shortcut = WebInspector.KeyboardShortcut;
+var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("All Panels"));
+var keys = [
+shortcut.shortcutToString("]", shortcut.Modifiers.CtrlOrMeta),
+shortcut.shortcutToString("[", shortcut.Modifiers.CtrlOrMeta)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Next/previous panel"));
+section.addKey(shortcut.shortcutToString(shortcut.Keys.Esc), WebInspector.UIString("Toggle console"));
+section.addKey(shortcut.shortcutToString("f", shortcut.Modifiers.CtrlOrMeta), WebInspector.UIString("Search"));
+keys = [
+shortcut.shortcutToString("g", shortcut.Modifiers.CtrlOrMeta),
+shortcut.shortcutToString("g", shortcut.Modifiers.CtrlOrMeta | shortcut.Modifiers.Shift)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Find next/previous"));
 }
 
 WebInspector.documentKeyDown = function(event)
 {
-    if (this.currentFocusElement && this.currentFocusElement.handleKeyEvent) {
-        this.currentFocusElement.handleKeyEvent(event);
-        if (event.handled) {
-            event.preventDefault();
-            return;
-        }
-    }
+var isInputElement = event.target.nodeName === "INPUT";
+var isInEditMode = event.target.enclosingNodeOrSelfWithClass("text-prompt") || WebInspector.isEditingAnyField();
+const helpKey = WebInspector.isMac() ? "U+003F" : "U+00BF"; 
 
-    if (this.currentPanel && this.currentPanel.handleShortcut) {
-        this.currentPanel.handleShortcut(event);
-        if (event.handled) {
-            event.preventDefault();
-            return;
-        }
-    }
+if (event.keyIdentifier === "F1" ||
+(event.keyIdentifier === helpKey && event.shiftKey && (!isInEditMode && !isInputElement || event.metaKey))) {
+WebInspector.shortcutsHelp.show();
+event.stopPropagation();
+event.preventDefault();
+return;
+}
 
-    var isMac = WebInspector.isMac();
+if (WebInspector.isEditingAnyField())
+return;
 
-    switch (event.keyIdentifier) {
-        case "U+001B": // Escape key
-            event.preventDefault();
-            if (this.drawer.fullPanel)
-                return;
+if (this.currentFocusElement && this.currentFocusElement.handleKeyEvent) {
+this.currentFocusElement.handleKeyEvent(event);
+if (event.handled) {
+event.preventDefault();
+return;
+}
+}
 
-            this.drawer.visible = !this.drawer.visible;
-            break;
+if (this.currentPanel && this.currentPanel.handleShortcut) {
+this.currentPanel.handleShortcut(event);
+if (event.handled) {
+event.preventDefault();
+return;
+}
+}
 
-        case "U+0046": // F key
-            if (isMac)
-                var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
-            else
-                var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey;
+var isMac = WebInspector.isMac();
+switch (event.keyIdentifier) {
+case "Left":
+var isBackKey = !isInEditMode && (isMac ? event.metaKey : event.ctrlKey);
+if (isBackKey && this._panelHistory.canGoBack()) {
+this._panelHistory.goBack();
+event.preventDefault();
+}
+break;
 
-            if (isFindKey) {
-                WebInspector.focusSearchField();
-                event.preventDefault();
-            }
-            break;
+case "Right":
+var isForwardKey = !isInEditMode && (isMac ? event.metaKey : event.ctrlKey);
+if (isForwardKey && this._panelHistory.canGoForward()) {
+this._panelHistory.goForward();
+event.preventDefault();
+}
+break;
 
-        case "F3":
-            if (!isMac) {
-                WebInspector.focusSearchField();
-                event.preventDefault();
-            }
-            break;
+case "U+001B": 
+event.preventDefault();
+if (this.drawer.fullPanel)
+return;
 
-        case "U+0047": // G key
-            if (isMac)
-                var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey;
-            else
-                var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey;
+this.drawer.visible = !this.drawer.visible;
+break;
 
-            if (isFindAgainKey) {
-                if (event.shiftKey) {
-                    if (this.currentPanel.jumpToPreviousSearchResult)
-                        this.currentPanel.jumpToPreviousSearchResult();
-                } else if (this.currentPanel.jumpToNextSearchResult)
-                    this.currentPanel.jumpToNextSearchResult();
-                event.preventDefault();
-            }
+case "U+0046": 
+if (isMac)
+var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
+else
+var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey;
 
-            break;
+if (isFindKey) {
+WebInspector.focusSearchField();
+event.preventDefault();
+}
+break;
 
-        // Windows and Mac have two different definitions of [, so accept both.
-        case "U+005B":
-        case "U+00DB": // [ key
-            if (isMac)
-                var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
-            else
-                var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+case "F3":
+if (!isMac) {
+WebInspector.focusSearchField();
+event.preventDefault();
+}
+break;
 
-            if (isRotateLeft) {
-                var index = this.panelOrder.indexOf(this.currentPanel);
-                index = (index === 0) ? this.panelOrder.length - 1 : index - 1;
-                this.panelOrder[index].toolbarItem.click();
-                event.preventDefault();
-            }
+case "U+0047": 
+if (isMac)
+var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey;
+else
+var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey;
 
-            break;
+if (isFindAgainKey) {
+if (event.shiftKey) {
+if (this.currentPanel.jumpToPreviousSearchResult)
+this.currentPanel.jumpToPreviousSearchResult();
+} else if (this.currentPanel.jumpToNextSearchResult)
+this.currentPanel.jumpToNextSearchResult();
+event.preventDefault();
+}
 
-        // Windows and Mac have two different definitions of ], so accept both.
-        case "U+005D":
-        case "U+00DD":  // ] key
-            if (isMac)
-                var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
-            else
-                var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+break;
 
-            if (isRotateRight) {
-                var index = this.panelOrder.indexOf(this.currentPanel);
-                index = (index + 1) % this.panelOrder.length;
-                this.panelOrder[index].toolbarItem.click();
-                event.preventDefault();
-            }
 
-            break;
+case "U+005B":
+case "U+00DB": 
+if (isMac)
+var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
+else
+var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
 
-        case "U+0052": // R key
-            if ((event.metaKey && isMac) || (event.ctrlKey && !isMac))
-                InspectorBackend.reloadPage();
-            break;
-        case "F5":
-            if (!isMac)
-                InspectorBackend.reloadPage();
-            break;
-    }
+if (isRotateLeft) {
+var index = this.panelOrder.indexOf(this.currentPanel);
+index = (index === 0) ? this.panelOrder.length - 1 : index - 1;
+this.panelOrder[index].toolbarItem.click();
+event.preventDefault();
+}
+
+break;
+
+
+case "U+005D":
+case "U+00DD":  
+if (isMac)
+var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
+else
+var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+
+if (isRotateRight) {
+var index = this.panelOrder.indexOf(this.currentPanel);
+index = (index + 1) % this.panelOrder.length;
+this.panelOrder[index].toolbarItem.click();
+event.preventDefault();
+}
+
+break;
+
+case "U+0052": 
+if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
+InspectorBackend.reloadPage();
+event.preventDefault();
+}
+break;
+case "F5":
+if (!isMac)
+InspectorBackend.reloadPage();
+break;
+}
 }
 
 WebInspector.documentCanCopy = function(event)
 {
-    if (this.currentPanel && this.currentPanel.handleCopyEvent)
-        event.preventDefault();
+if (this.currentPanel && this.currentPanel.handleCopyEvent)
+event.preventDefault();
 }
 
 WebInspector.documentCopy = function(event)
 {
-    if (this.currentPanel && this.currentPanel.handleCopyEvent)
-        this.currentPanel.handleCopyEvent(event);
+if (this.currentPanel && this.currentPanel.handleCopyEvent)
+this.currentPanel.handleCopyEvent(event);
 }
 
 WebInspector.contextMenuEventFired = function(event)
 {
-    if (event.handled || event.target.hasStyleClass("popup-glasspane"))
-        event.preventDefault();
+if (event.handled || event.target.hasStyleClass("popup-glasspane"))
+event.preventDefault();
 }
 
 WebInspector.animateStyle = function(animations, duration, callback)
 {
-    var interval;
-    var complete = 0;
+var interval;
+var complete = 0;
 
-    const intervalDuration = (1000 / 30); // 30 frames per second.
-    const animationsLength = animations.length;
-    const propertyUnit = {opacity: ""};
-    const defaultUnit = "px";
+const intervalDuration = (1000 / 30); 
+const animationsLength = animations.length;
+const propertyUnit = {opacity: ""};
+const defaultUnit = "px";
 
-    function cubicInOut(t, b, c, d)
-    {
-        if ((t/=d/2) < 1) return c/2*t*t*t + b;
-        return c/2*((t-=2)*t*t + 2) + b;
-    }
+function cubicInOut(t, b, c, d)
+{
+if ((t/=d/2) < 1) return c/2*t*t*t + b;
+return c/2*((t-=2)*t*t + 2) + b;
+}
 
-    // Pre-process animations.
-    for (var i = 0; i < animationsLength; ++i) {
-        var animation = animations[i];
-        var element = null, start = null, end = null, key = null;
-        for (key in animation) {
-            if (key === "element")
-                element = animation[key];
-            else if (key === "start")
-                start = animation[key];
-            else if (key === "end")
-                end = animation[key];
-        }
 
-        if (!element || !end)
-            continue;
+for (var i = 0; i < animationsLength; ++i) {
+var animation = animations[i];
+var element = null, start = null, end = null, key = null;
+for (key in animation) {
+if (key === "element")
+element = animation[key];
+else if (key === "start")
+start = animation[key];
+else if (key === "end")
+end = animation[key];
+}
 
-        if (!start) {
-            var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element);
-            start = {};
-            for (key in end)
-                start[key] = parseInt(computedStyle.getPropertyValue(key));
-            animation.start = start;
-        } else
-            for (key in start)
-                element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-    }
+if (!element || !end)
+continue;
 
-    function animateLoop()
-    {
-        // Advance forward.
-        complete += intervalDuration;
-        var next = complete + intervalDuration;
+if (!start) {
+var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element);
+start = {};
+for (key in end)
+start[key] = parseInt(computedStyle.getPropertyValue(key));
+animation.start = start;
+} else
+for (key in start)
+element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
+}
 
-        // Make style changes.
-        for (var i = 0; i < animationsLength; ++i) {
-            var animation = animations[i];
-            var element = animation.element;
-            var start = animation.start;
-            var end = animation.end;
-            if (!element || !end)
-                continue;
+function animateLoop()
+{
 
-            var style = element.style;
-            for (key in end) {
-                var endValue = end[key];
-                if (next < duration) {
-                    var startValue = start[key];
-                    var newValue = cubicInOut(complete, startValue, endValue - startValue, duration);
-                    style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-                } else
-                    style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
-            }
-        }
+complete += intervalDuration;
+var next = complete + intervalDuration;
 
-        // End condition.
-        if (complete >= duration) {
-            clearInterval(interval);
-            if (callback)
-                callback();
-        }
-    }
 
-    interval = setInterval(animateLoop, intervalDuration);
-    return interval;
+for (var i = 0; i < animationsLength; ++i) {
+var animation = animations[i];
+var element = animation.element;
+var start = animation.start;
+var end = animation.end;
+if (!element || !end)
+continue;
+
+var style = element.style;
+for (key in end) {
+var endValue = end[key];
+if (next < duration) {
+var startValue = start[key];
+var newValue = cubicInOut(complete, startValue, endValue - startValue, duration);
+style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
+} else
+style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit));
+}
+}
+
+
+if (complete >= duration) {
+clearInterval(interval);
+if (callback)
+callback();
+}
+}
+
+interval = setInterval(animateLoop, intervalDuration);
+return interval;
 }
 
 WebInspector.updateSearchLabel = function()
 {
-    if (!this.currentPanel)
-        return;
+if (!this.currentPanel)
+return;
 
-    var newLabel = WebInspector.UIString("Search %s", this.currentPanel.toolbarItemLabel);
-    if (this.attached)
-        document.getElementById("search").setAttribute("placeholder", newLabel);
-    else {
-        document.getElementById("search").removeAttribute("placeholder");
-        document.getElementById("search-toolbar-label").textContent = newLabel;
-    }
+var newLabel = WebInspector.UIString("Search %s", this.currentPanel.toolbarItemLabel);
+if (this.attached)
+document.getElementById("search").setAttribute("placeholder", newLabel);
+else {
+document.getElementById("search").removeAttribute("placeholder");
+document.getElementById("search-toolbar-label").textContent = newLabel;
+}
 }
 
 WebInspector.focusSearchField = function()
 {
-    var searchField = document.getElementById("search");
-    searchField.focus();
-    searchField.select();
+var searchField = document.getElementById("search");
+searchField.focus();
+searchField.select();
 }
 
 WebInspector.toggleAttach = function()
 {
-    if (!this.attached && !InspectorFrontendHost.canAttachWindow())
-        return;
-
-    this.attached = !this.attached;
-    this.drawer.resize();
+if (!this.attached)
+InspectorFrontendHost.requestAttachWindow();
+else
+InspectorFrontendHost.requestDetachWindow();
 }
 
 WebInspector.toolbarDragStart = function(event)
 {
-    if ((!WebInspector.attached && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port == "qt")
-        return;
+if ((!WebInspector.attached && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port == "qt")
+return;
 
-    var target = event.target;
-    if (target.hasStyleClass("toolbar-item") && target.hasStyleClass("toggleable"))
-        return;
+var target = event.target;
+if (target.hasStyleClass("toolbar-item") && target.hasStyleClass("toggleable"))
+return;
 
-    var toolbar = document.getElementById("toolbar");
-    if (target !== toolbar && !target.hasStyleClass("toolbar-item"))
-        return;
+var toolbar = document.getElementById("toolbar");
+if (target !== toolbar && !target.hasStyleClass("toolbar-item"))
+return;
 
-    toolbar.lastScreenX = event.screenX;
-    toolbar.lastScreenY = event.screenY;
+toolbar.lastScreenX = event.screenX;
+toolbar.lastScreenY = event.screenY;
 
-    WebInspector.elementDragStart(toolbar, WebInspector.toolbarDrag, WebInspector.toolbarDragEnd, event, (WebInspector.attached ? "row-resize" : "default"));
+WebInspector.elementDragStart(toolbar, WebInspector.toolbarDrag, WebInspector.toolbarDragEnd, event, (WebInspector.attached ? "row-resize" : "default"));
 }
 
 WebInspector.toolbarDragEnd = function(event)
 {
-    var toolbar = document.getElementById("toolbar");
+var toolbar = document.getElementById("toolbar");
 
-    WebInspector.elementDragEnd(event);
+WebInspector.elementDragEnd(event);
 
-    delete toolbar.lastScreenX;
-    delete toolbar.lastScreenY;
+delete toolbar.lastScreenX;
+delete toolbar.lastScreenY;
 }
 
 WebInspector.toolbarDrag = function(event)
 {
-    var toolbar = document.getElementById("toolbar");
+var toolbar = document.getElementById("toolbar");
 
-    if (WebInspector.attached) {
-        var height = window.innerHeight - (event.screenY - toolbar.lastScreenY);
+if (WebInspector.attached) {
+var height = window.innerHeight - (event.screenY - toolbar.lastScreenY);
 
-        InspectorFrontendHost.setAttachedWindowHeight(height);
-    } else {
-        var x = event.screenX - toolbar.lastScreenX;
-        var y = event.screenY - toolbar.lastScreenY;
+InspectorFrontendHost.setAttachedWindowHeight(height);
+} else {
+var x = event.screenX - toolbar.lastScreenX;
+var y = event.screenY - toolbar.lastScreenY;
 
-        // We cannot call window.moveBy here because it restricts the movement
-        // of the window at the edges.
-        InspectorFrontendHost.moveWindowBy(x, y);
-    }
 
-    toolbar.lastScreenX = event.screenX;
-    toolbar.lastScreenY = event.screenY;
 
-    event.preventDefault();
+InspectorFrontendHost.moveWindowBy(x, y);
+}
+
+toolbar.lastScreenX = event.screenX;
+toolbar.lastScreenY = event.screenY;
+
+event.preventDefault();
 }
 
 WebInspector.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor)
 {
-    if (this._elementDraggingEventListener || this._elementEndDraggingEventListener)
-        this.elementDragEnd(event);
+if (this._elementDraggingEventListener || this._elementEndDraggingEventListener)
+this.elementDragEnd(event);
 
-    this._elementDraggingEventListener = dividerDrag;
-    this._elementEndDraggingEventListener = elementDragEnd;
+this._elementDraggingEventListener = dividerDrag;
+this._elementEndDraggingEventListener = elementDragEnd;
 
-    document.addEventListener("mousemove", dividerDrag, true);
-    document.addEventListener("mouseup", elementDragEnd, true);
+document.addEventListener("mousemove", dividerDrag, true);
+document.addEventListener("mouseup", elementDragEnd, true);
 
-    document.body.style.cursor = cursor;
+document.body.style.cursor = cursor;
 
-    event.preventDefault();
+event.preventDefault();
 }
 
 WebInspector.elementDragEnd = function(event)
 {
-    document.removeEventListener("mousemove", this._elementDraggingEventListener, true);
-    document.removeEventListener("mouseup", this._elementEndDraggingEventListener, true);
+document.removeEventListener("mousemove", this._elementDraggingEventListener, true);
+document.removeEventListener("mouseup", this._elementEndDraggingEventListener, true);
 
-    document.body.style.removeProperty("cursor");
+document.body.style.removeProperty("cursor");
 
-    delete this._elementDraggingEventListener;
-    delete this._elementEndDraggingEventListener;
+delete this._elementDraggingEventListener;
+delete this._elementEndDraggingEventListener;
 
-    event.preventDefault();
+event.preventDefault();
+}
+
+WebInspector.toggleSearchingForNode = function()
+{
+if (this.panels.elements) {
+this.showPanel("elements");
+this.panels.elements.toggleSearchingForNode();
+}
 }
 
 WebInspector.showConsole = function()
 {
-    this.drawer.showView(this.console);
+this.drawer.showView(this.console);
 }
 
 WebInspector.showChanges = function()
 {
-    this.drawer.showView(this.changes);
+this.drawer.showView(this.changes);
 }
 
-WebInspector.showElementsPanel = function()
+WebInspector.showPanel = function(panel)
 {
-    this.currentPanel = this.panels.elements;
-}
-
-WebInspector.showResourcesPanel = function()
-{
-    this.currentPanel = this.panels.resources;
-}
-
-WebInspector.showScriptsPanel = function()
-{
-    this.currentPanel = this.panels.scripts;
-}
-
-WebInspector.showTimelinePanel = function()
-{
-    this.currentPanel = this.panels.timeline;
-}
-
-WebInspector.showProfilesPanel = function()
-{
-    this.currentPanel = this.panels.profiles;
-}
-
-WebInspector.showStoragePanel = function()
-{
-    this.currentPanel = this.panels.storage;
-}
-
-WebInspector.showConsolePanel = function()
-{
-    this.currentPanel = this.panels.console;
-}
-
-WebInspector.clearConsoleMessages = function()
-{
-    WebInspector.console.clearMessages();
+if (!(panel in this.panels))
+panel = "elements";
+this.currentPanel = this.panels[panel];
 }
 
 WebInspector.selectDatabase = function(o)
 {
-    WebInspector.showStoragePanel();
-    WebInspector.panels.storage.selectDatabase(o);
+WebInspector.showPanel("resources");
+WebInspector.panels.resources.selectDatabase(o);
+}
+
+WebInspector.consoleMessagesCleared = function()
+{
+WebInspector.console.clearMessages();
 }
 
 WebInspector.selectDOMStorage = function(o)
 {
-    WebInspector.showStoragePanel();
-    WebInspector.panels.storage.selectDOMStorage(o);
+WebInspector.showPanel("resources");
+WebInspector.panels.resources.selectDOMStorage(o);
 }
 
-WebInspector.updateResource = function(identifier, payload)
+WebInspector.domContentEventFired = function(time)
 {
-    var resource = this.resources[identifier];
-    if (!resource) {
-        resource = new WebInspector.Resource(identifier, payload.url);
-        this.resources[identifier] = resource;
-        this.resourceURLMap[resource.url] = resource;
-        if (this.panels.resources)
-            this.panels.resources.addResource(resource);
-    }
-
-    if (payload.didRequestChange) {
-        resource.domain = payload.host;
-        resource.path = payload.path;
-        resource.lastPathComponent = payload.lastPathComponent;
-        resource.requestHeaders = payload.requestHeaders;
-        resource.mainResource = payload.mainResource;
-        resource.requestMethod = payload.requestMethod;
-        resource.requestFormData = payload.requestFormData;
-        resource.cached = payload.cached;
-        resource.documentURL = payload.documentURL;
-
-        if (resource.mainResource)
-            this.mainResource = resource;
-
-        var match = payload.documentURL.match(WebInspector.URLRegExp);
-        if (match) {
-            var protocol = match[1].toLowerCase();
-            if (protocol.indexOf("http") === 0 || protocol === "file")
-                this._addCookieDomain(protocol === "file" ? "" : match[2]);
-        }
-    }
-
-    if (payload.didResponseChange) {
-        resource.mimeType = payload.mimeType;
-        resource.suggestedFilename = payload.suggestedFilename;
-        resource.expectedContentLength = payload.expectedContentLength;
-        resource.statusCode = payload.statusCode;
-        resource.suggestedFilename = payload.suggestedFilename;
-        resource.responseHeaders = payload.responseHeaders;
-    }
-
-    if (payload.didTypeChange) {
-        resource.type = payload.type;
-    }
-
-    if (payload.didLengthChange) {
-        resource.resourceSize = payload.resourceSize;
-    }
-
-    if (payload.didCompletionChange) {
-        resource.failed = payload.failed;
-        resource.finished = payload.finished;
-    }
-
-    if (payload.didTimingChange) {
-        if (payload.startTime)
-            resource.startTime = payload.startTime;
-        if (payload.responseReceivedTime)
-            resource.responseReceivedTime = payload.responseReceivedTime;
-        if (payload.endTime)
-            resource.endTime = payload.endTime;
-
-        if (payload.loadEventTime) {
-            // This loadEventTime is for the main resource, and we want to show it
-            // for all resources on this page. This means we want to set it as a member
-            // of the resources panel instead of the individual resource.
-            if (this.panels.resources)
-                this.panels.resources.mainResourceLoadTime = payload.loadEventTime;
-            if (this.panels.audits)
-                this.panels.audits.mainResourceLoadTime = payload.loadEventTime;
-        }
-
-        if (payload.domContentEventTime) {
-            // This domContentEventTime is for the main resource, so it should go in
-            // the resources panel for the same reasons as above.
-            if (this.panels.resources)
-                this.panels.resources.mainResourceDOMContentTime = payload.domContentEventTime;
-            if (this.panels.audits)
-                this.panels.audits.mainResourceDOMContentTime = payload.domContentEventTime;
-        }
-    }
+this.panels.audits.mainResourceDOMContentTime = time;
+if (this.panels.network)
+this.panels.network.mainResourceDOMContentTime = time;
+this.extensionServer.notifyPageDOMContentLoaded((time - WebInspector.mainResource.startTime) * 1000);
+this.mainResourceDOMContentTime = time;
 }
 
-WebInspector.removeResource = function(identifier)
+WebInspector.loadEventFired = function(time)
 {
-    var resource = this.resources[identifier];
-    if (!resource)
-        return;
-
-    resource.category.removeResource(resource);
-    delete this.resourceURLMap[resource.url];
-    delete this.resources[identifier];
-
-    if (this.panels.resources)
-        this.panels.resources.removeResource(resource);
+this.panels.audits.mainResourceLoadTime = time;
+if (this.panels.network)
+this.panels.network.mainResourceLoadTime = time;
+this.extensionServer.notifyPageLoaded((time - WebInspector.mainResource.startTime) * 1000);
+this.mainResourceLoadTime = time;
 }
 
 WebInspector.addDatabase = function(payload)
 {
-    if (!this.panels.storage)
-        return;
-    var database = new WebInspector.Database(
-        payload.id,
-        payload.domain,
-        payload.name,
-        payload.version);
-    this.panels.storage.addDatabase(database);
-}
-
-WebInspector._addCookieDomain = function(domain)
-{
-    // Eliminate duplicate domains from the list.
-    if (domain in this.cookieDomains)
-        return;
-    this.cookieDomains[domain] = true;
-
-    if (!this.panels.storage)
-        return;
-    this.panels.storage.addCookieDomain(domain);
+if (!this.panels.resources)
+return;
+var database = new WebInspector.Database(
+payload.id,
+payload.domain,
+payload.name,
+payload.version);
+this.panels.resources.addDatabase(database);
 }
 
 WebInspector.addDOMStorage = function(payload)
 {
-    if (!this.panels.storage)
-        return;
-    var domStorage = new WebInspector.DOMStorage(
-        payload.id,
-        payload.host,
-        payload.isLocalStorage);
-    this.panels.storage.addDOMStorage(domStorage);
+if (!this.panels.resources)
+return;
+var domStorage = new WebInspector.DOMStorage(
+payload.id,
+payload.host,
+payload.isLocalStorage);
+this.panels.resources.addDOMStorage(domStorage);
 }
 
 WebInspector.updateDOMStorage = function(storageId)
 {
-    if (!this.panels.storage)
-        return;
-    this.panels.storage.updateDOMStorage(storageId);
+this.panels.resources.updateDOMStorage(storageId);
 }
 
-WebInspector.resourceTrackingWasEnabled = function()
+WebInspector.updateApplicationCacheStatus = function(status)
 {
-    this.panels.resources.resourceTrackingWasEnabled();
+this.panels.resources.updateApplicationCacheStatus(status);
 }
 
-WebInspector.resourceTrackingWasDisabled = function()
+WebInspector.didGetFileSystemPath = function(root, type, origin)
 {
-    this.panels.resources.resourceTrackingWasDisabled();
+this.panels.resources.updateFileSystemPath(root, type, origin);
 }
 
+WebInspector.didGetFileSystemError = function(type, origin)
+{
+this.panels.resources.updateFileSystemError(type, origin);
+}
+
+WebInspector.didGetFileSystemDisabled = function()
+{
+this.panels.resources.setFileSystemDisabled();
+}
+
+WebInspector.updateNetworkState = function(isNowOnline)
+{
+this.panels.resources.updateNetworkState(isNowOnline);
+}
 
 WebInspector.searchingForNodeWasEnabled = function()
 {
-    this.panels.elements.searchingForNodeWasEnabled();
+this.panels.elements.searchingForNodeWasEnabled();
 }
 
 WebInspector.searchingForNodeWasDisabled = function()
 {
-    this.panels.elements.searchingForNodeWasDisabled();
+this.panels.elements.searchingForNodeWasDisabled();
 }
 
 WebInspector.attachDebuggerWhenShown = function()
 {
-    this.panels.scripts.attachDebuggerWhenShown();
+this.panels.scripts.attachDebuggerWhenShown();
 }
 
 WebInspector.debuggerWasEnabled = function()
 {
-    this.panels.scripts.debuggerWasEnabled();
-}
-
-WebInspector.updatePauseOnExceptionsState = function(pauseOnExceptionsState)
-{
-    this.panels.scripts.updatePauseOnExceptionsState(pauseOnExceptionsState);
+this.panels.scripts.debuggerWasEnabled();
 }
 
 WebInspector.debuggerWasDisabled = function()
 {
-    this.panels.scripts.debuggerWasDisabled();
+this.panels.scripts.debuggerWasDisabled();
 }
 
 WebInspector.profilerWasEnabled = function()
 {
-    this.panels.profiles.profilerWasEnabled();
+this.panels.profiles.profilerWasEnabled();
 }
 
 WebInspector.profilerWasDisabled = function()
 {
-    this.panels.profiles.profilerWasDisabled();
+this.panels.profiles.profilerWasDisabled();
 }
 
-WebInspector.parsedScriptSource = function(sourceID, sourceURL, source, startingLine)
+WebInspector.parsedScriptSource = function(sourceID, sourceURL, source, startingLine, scriptWorldType)
 {
-    this.panels.scripts.addScript(sourceID, sourceURL, source, startingLine);
+this.panels.scripts.addScript(sourceID, sourceURL, source, startingLine, undefined, undefined, scriptWorldType);
 }
 
 WebInspector.restoredBreakpoint = function(sourceID, sourceURL, line, enabled, condition)
 {
-    var breakpoint = new WebInspector.Breakpoint(sourceURL, line, sourceID, condition);
-    breakpoint.enabled = enabled;
-    this.panels.scripts.addBreakpoint(breakpoint);
+this.debuggerModel.breakpointRestored(sourceID, sourceURL, line, enabled, condition);
 }
 
 WebInspector.failedToParseScriptSource = function(sourceURL, source, startingLine, errorLine, errorMessage)
 {
-    this.panels.scripts.addScript(null, sourceURL, source, startingLine, errorLine, errorMessage);
+this.panels.scripts.addScript(null, sourceURL, source, startingLine, errorLine, errorMessage);
 }
 
-WebInspector.pausedScript = function(callFrames)
+WebInspector.pausedScript = function(details)
 {
-    this.panels.scripts.debuggerPaused(callFrames);
+this.debuggerModel.debuggerPaused(details);
 }
 
 WebInspector.resumedScript = function()
 {
-    this.panels.scripts.debuggerResumed();
-}
-
-WebInspector.populateInterface = function()
-{
-    for (var panelName in this.panels) {
-        var panel = this.panels[panelName];
-        if ("populateInterface" in panel)
-            panel.populateInterface();
-    }
+this.debuggerModel.debuggerResumed();
 }
 
 WebInspector.reset = function()
 {
-    for (var panelName in this.panels) {
-        var panel = this.panels[panelName];
-        if ("reset" in panel)
-            panel.reset();
-    }
+this.debuggerModel.reset();
+this.breakpointManager.reset();
 
-    for (var category in this.resourceCategories)
-        this.resourceCategories[category].removeAllResources();
-
-    this.resources = {};
-    this.resourceURLMap = {};
-    this.cookieDomains = {};
-    this.hoveredDOMNode = null;
-
-    delete this.mainResource;
-
-    this.console.clearMessages();
+for (var panelName in this.panels) {
+var panel = this.panels[panelName];
+if ("reset" in panel)
+panel.reset();
 }
 
-WebInspector.resourceURLChanged = function(resource, oldURL)
+this.resources = {};
+this.highlightDOMNode(0);
+
+this.console.clearMessages();
+this.extensionServer.notifyInspectorReset();
+
+this.breakpointManager.restoreBreakpoints();
+}
+
+WebInspector.resetProfilesPanel = function()
 {
-    delete this.resourceURLMap[oldURL];
-    this.resourceURLMap[resource.url] = resource;
+if (WebInspector.panels.profiles)
+WebInspector.panels.profiles.resetProfiles();
+}
+
+WebInspector.bringToFront = function()
+{
+InspectorFrontendHost.bringToFront();
+}
+
+WebInspector.inspectedURLChanged = function(url)
+{
+InspectorFrontendHost.inspectedURLChanged(url);
+this.settings.inspectedURLChanged(url);
+this.extensionServer.notifyInspectedURLChanged();
+if (!this._breakpointsRestored) {
+this.breakpointManager.restoreBreakpoints();
+this._breakpointsRestored = true;
+}
 }
 
 WebInspector.didCommitLoad = function()
 {
-    // Cleanup elements panel early on inspected page refresh.
-    WebInspector.setDocument(null);
+
+WebInspector.domAgent.setDocument(null);
 }
 
 WebInspector.updateConsoleMessageExpiredCount = function(count)
 {
-    var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
-    WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
+var message = String.sprintf(WebInspector.UIString("%d console messages are not shown."), count);
+WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage(message, WebInspector.ConsoleMessage.MessageLevel.Warning));
 }
 
-WebInspector.addConsoleMessage = function(payload, opt_args)
+WebInspector.addConsoleMessage = function(payload)
 {
-    var consoleMessage = new WebInspector.ConsoleMessage(
-        payload.source,
-        payload.type,
-        payload.level,
-        payload.line,
-        payload.url,
-        payload.groupLevel,
-        payload.repeatCount);
-    consoleMessage.setMessageBody(Array.prototype.slice.call(arguments, 1));
-    this.console.addMessage(consoleMessage);
+var consoleMessage = new WebInspector.ConsoleMessage(
+payload.source,
+payload.type,
+payload.level,
+payload.line,
+payload.url,
+payload.repeatCount,
+payload.message,
+payload.parameters,
+payload.stackTrace);
+this.console.addMessage(consoleMessage);
 }
 
 WebInspector.updateConsoleMessageRepeatCount = function(count)
 {
-    this.console.updateMessageRepeatCount(count);
+this.console.updateMessageRepeatCount(count);
 }
 
-WebInspector.log = function(message)
+WebInspector.log = function(message, messageLevel)
 {
-    // remember 'this' for setInterval() callback
-    var self = this;
 
-    // return indication if we can actually log a message
-    function isLogAvailable()
-    {
-        return WebInspector.ConsoleMessage && WebInspector.ObjectProxy && self.console;
-    }
+var self = this;
 
-    // flush the queue of pending messages
-    function flushQueue()
-    {
-        var queued = WebInspector.log.queued;
-        if (!queued)
-            return;
 
-        for (var i = 0; i < queued.length; ++i)
-            logMessage(queued[i]);
+function isLogAvailable()
+{
+return WebInspector.ConsoleMessage && WebInspector.RemoteObject && self.console;
+}
 
-        delete WebInspector.log.queued;
-    }
 
-    // flush the queue if it console is available
-    // - this function is run on an interval
-    function flushQueueIfAvailable()
-    {
-        if (!isLogAvailable())
-            return;
+function flushQueue()
+{
+var queued = WebInspector.log.queued;
+if (!queued)
+return;
 
-        clearInterval(WebInspector.log.interval);
-        delete WebInspector.log.interval;
+for (var i = 0; i < queued.length; ++i)
+logMessage(queued[i]);
 
-        flushQueue();
-    }
+delete WebInspector.log.queued;
+}
 
-    // actually log the message
-    function logMessage(message)
-    {
-        var repeatCount = 1;
-        if (message == WebInspector.log.lastMessage)
-            repeatCount = WebInspector.log.repeatCount + 1;
 
-        WebInspector.log.lastMessage = message;
-        WebInspector.log.repeatCount = repeatCount;
 
-        // ConsoleMessage expects a proxy object
-        message = new WebInspector.ObjectProxy(null, null, [], message, false);
+function flushQueueIfAvailable()
+{
+if (!isLogAvailable())
+return;
 
-        // post the message
-        var msg = new WebInspector.ConsoleMessage(
-            WebInspector.ConsoleMessage.MessageSource.Other,
-            WebInspector.ConsoleMessage.MessageType.Log,
-            WebInspector.ConsoleMessage.MessageLevel.Debug,
-            -1,
-            null,
-            null,
-            repeatCount,
-            message);
+clearInterval(WebInspector.log.interval);
+delete WebInspector.log.interval;
 
-        self.console.addMessage(msg);
-    }
+flushQueue();
+}
 
-    // if we can't log the message, queue it
-    if (!isLogAvailable()) {
-        if (!WebInspector.log.queued)
-            WebInspector.log.queued = [];
 
-        WebInspector.log.queued.push(message);
+function logMessage(message)
+{
+var repeatCount = 1;
+if (message == WebInspector.log.lastMessage)
+repeatCount = WebInspector.log.repeatCount + 1;
 
-        if (!WebInspector.log.interval)
-            WebInspector.log.interval = setInterval(flushQueueIfAvailable, 1000);
+WebInspector.log.lastMessage = message;
+WebInspector.log.repeatCount = repeatCount;
 
-        return;
-    }
 
-    // flush the pending queue if any
-    flushQueue();
+message = new WebInspector.RemoteObject.fromPrimitiveValue(message);
 
-    // log the message
-    logMessage(message);
+
+var msg = new WebInspector.ConsoleMessage(
+WebInspector.ConsoleMessage.MessageSource.Other,
+WebInspector.ConsoleMessage.MessageType.Log,
+messageLevel || WebInspector.ConsoleMessage.MessageLevel.Debug,
+-1,
+null,
+repeatCount,
+null,
+[message],
+null);
+
+self.console.addMessage(msg);
+}
+
+
+if (!isLogAvailable()) {
+if (!WebInspector.log.queued)
+WebInspector.log.queued = [];
+
+WebInspector.log.queued.push(message);
+
+if (!WebInspector.log.interval)
+WebInspector.log.interval = setInterval(flushQueueIfAvailable, 1000);
+
+return;
+}
+
+
+flushQueue();
+
+
+logMessage(message);
 }
 
 WebInspector.addProfileHeader = function(profile)
 {
-    this.panels.profiles.addProfileHeader(profile);
+this.panels.profiles.addProfileHeader(profile);
 }
 
 WebInspector.setRecordingProfile = function(isProfiling)
 {
-    this.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling);
-    this.panels.profiles.updateProfileTypeButtons();
+this.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling);
+if (this.panels.profiles.hasTemporaryProfile(WebInspector.CPUProfileType.TypeId) !== isProfiling) {
+if (!this._temporaryRecordingProfile) {
+this._temporaryRecordingProfile = {
+typeId: WebInspector.CPUProfileType.TypeId,
+title: WebInspector.UIString("Recording…"),
+uid: -1,
+isTemporary: true
+};
+}
+if (isProfiling)
+this.panels.profiles.addProfileHeader(this._temporaryRecordingProfile);
+else
+this.panels.profiles.removeProfileHeader(this._temporaryRecordingProfile);
+}
+this.panels.profiles.updateProfileTypeButtons();
+}
+
+WebInspector.addHeapSnapshotChunk = function(uid, chunk)
+{
+this.panels.profiles.addHeapSnapshotChunk(uid, chunk);
+}
+
+WebInspector.finishHeapSnapshot = function(uid)
+{
+this.panels.profiles.finishHeapSnapshot(uid);
 }
 
 WebInspector.drawLoadingPieChart = function(canvas, percent) {
-    var g = canvas.getContext("2d");
-    var darkColor = "rgb(122, 168, 218)";
-    var lightColor = "rgb(228, 241, 251)";
-    var cx = 8;
-    var cy = 8;
-    var r = 7;
+var g = canvas.getContext("2d");
+var darkColor = "rgb(122, 168, 218)";
+var lightColor = "rgb(228, 241, 251)";
+var cx = 8;
+var cy = 8;
+var r = 7;
 
-    g.beginPath();
-    g.arc(cx, cy, r, 0, Math.PI * 2, false);
-    g.closePath();
+g.beginPath();
+g.arc(cx, cy, r, 0, Math.PI * 2, false);
+g.closePath();
 
-    g.lineWidth = 1;
-    g.strokeStyle = darkColor;
-    g.fillStyle = lightColor;
-    g.fill();
-    g.stroke();
+g.lineWidth = 1;
+g.strokeStyle = darkColor;
+g.fillStyle = lightColor;
+g.fill();
+g.stroke();
 
-    var startangle = -Math.PI / 2;
-    var endangle = startangle + (percent * Math.PI * 2);
+var startangle = -Math.PI / 2;
+var endangle = startangle + (percent * Math.PI * 2);
 
-    g.beginPath();
-    g.moveTo(cx, cy);
-    g.arc(cx, cy, r, startangle, endangle, false);
-    g.closePath();
+g.beginPath();
+g.moveTo(cx, cy);
+g.arc(cx, cy, r, startangle, endangle, false);
+g.closePath();
 
-    g.fillStyle = darkColor;
-    g.fill();
+g.fillStyle = darkColor;
+g.fill();
 }
 
 WebInspector.updateFocusedNode = function(nodeId)
 {
-    var node = WebInspector.domAgent.nodeForId(nodeId);
-    if (!node)
-        // FIXME: Should we deselect if null is passed in?
-        return;
-
-    this.currentPanel = this.panels.elements;
-    this.panels.elements.focusedDOMNode = node;
+this._updateFocusedNode(nodeId);
+this.highlightDOMNodeForTwoSeconds(nodeId);
 }
 
 WebInspector.displayNameForURL = function(url)
 {
-    if (!url)
-        return "";
-    var resource = this.resourceURLMap[url];
-    if (resource)
-        return resource.displayName;
-    return url.trimURL(WebInspector.mainResource ? WebInspector.mainResource.domain : "");
+if (!url)
+return "";
+
+var resource = this.resourceForURL(url);
+if (resource)
+return resource.displayName;
+
+if (!WebInspector.mainResource)
+return url.trimURL("");
+
+var lastPathComponent = WebInspector.mainResource.lastPathComponent;
+var index = WebInspector.mainResource.url.indexOf(lastPathComponent);
+if (index !== -1 && index + lastPathComponent.length === WebInspector.mainResource.url.length) {
+var baseURL = WebInspector.mainResource.url.substring(0, index);
+if (url.indexOf(baseURL) === 0)
+return url.substring(index);
 }
 
-WebInspector.resourceForURL = function(url)
-{
-    if (url in this.resourceURLMap)
-        return this.resourceURLMap[url];
-
-    // No direct match found. Search for resources that contain
-    // a substring of the URL.
-    for (var resourceURL in this.resourceURLMap) {
-        if (resourceURL.hasSubstring(url))
-            return this.resourceURLMap[resourceURL];
-    }
-
-    return null;
+return url.trimURL(WebInspector.mainResource.domain);
 }
 
 WebInspector._choosePanelToShowSourceLine = function(url, line, preferredPanel)
 {
-    preferredPanel = preferredPanel || "resources";
-    var panel = this.panels[preferredPanel];
-    if (panel && panel.canShowSourceLine(url, line))
-        return panel;
-    panel = this.panels.resources;
-    return panel.canShowSourceLine(url, line) ? panel : null;
+preferredPanel = preferredPanel || "resources";
+
+var panel = this.panels[preferredPanel];
+if (panel && panel.canShowSourceLine(url, line))
+return panel;
+panel = this.panels.resources;
+return panel.canShowSourceLine(url, line) ? panel : null;
 }
 
 WebInspector.canShowSourceLine = function(url, line, preferredPanel)
 {
-    return !!this._choosePanelToShowSourceLine(url, line, preferredPanel);
+return !!this._choosePanelToShowSourceLine(url, line, preferredPanel);
 }
 
 WebInspector.showSourceLine = function(url, line, preferredPanel)
 {
-    this.currentPanel = this._choosePanelToShowSourceLine(url, line, preferredPanel);
-    if (!this.currentPanel)
-        return false;
-    this.currentPanel.showSourceLine(url, line);
-    return true;
+this.currentPanel = this._choosePanelToShowSourceLine(url, line, preferredPanel);
+if (!this.currentPanel)
+return false;
+this.currentPanel.showSourceLine(url, line);
+return true;
 }
 
 WebInspector.linkifyStringAsFragment = function(string)
 {
-    var container = document.createDocumentFragment();
-    var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|www\.)[\w$\-_+*'=\|\/\\(){}[\]%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({%@&#~]/;
+var container = document.createDocumentFragment();
+var linkStringRegEx = /(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|www\.)[\w$\-_+*'=\|\/\\(){}[\]%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({%@&#~]/;
+    var lineColumnRegEx = /:(\d+)(:(\d+))?$/;
 
     while (string) {
         var linkString = linkStringRegEx.exec(string);
@@ -3333,7 +3504,17 @@
             title = WebInspector.panels.profiles.displayTitleForProfileLink(profileStringMatches[2], profileStringMatches[1]);
 
         var realURL = (linkString.indexOf("www.") === 0 ? "http://" + linkString : linkString);
-        container.appendChild(WebInspector.linkifyURLAsNode(realURL, title, null, (realURL in WebInspector.resourceURLMap)));
+        var lineColumnMatch = lineColumnRegEx.exec(realURL);
+        if (lineColumnMatch)
+            realURL = realURL.substring(0, realURL.length - lineColumnMatch[0].length);
+
+        var hasResourceWithURL = !!WebInspector.resourceForURL(realURL);
+        var urlNode = WebInspector.linkifyURLAsNode(realURL, title, null, hasResourceWithURL);
+        container.appendChild(urlNode);
+        if (lineColumnMatch) {
+            urlNode.setAttribute("line_number", lineColumnMatch[1]);
+            urlNode.setAttribute("preferred_panel", "scripts");
+        }
         string = string.substring(linkIndex + linkString.length, string.length);
     }
 
@@ -3345,7 +3526,7 @@
 
 WebInspector.showProfileForURL = function(url)
 {
-    WebInspector.showProfilesPanel();
+    WebInspector.showPanel("profiles");
     WebInspector.panels.profiles.showProfileForURL(url);
 }
 
@@ -3359,8 +3540,10 @@
     var a = document.createElement("a");
     a.href = url;
     a.className = classes;
-    a.title = tooltipText || url;
-    a.target = "_blank";
+    if (typeof tooltipText === "undefined")
+        a.title = url;
+    else if (typeof tooltipText !== "string" || tooltipText.length)
+        a.title = tooltipText;
     a.textContent = linkText;
 
     return a;
@@ -3379,21 +3562,51 @@
     if (lineNumber)
         linkText += ":" + lineNumber;
     var node = WebInspector.linkifyURLAsNode(url, linkText, classes, false, tooltipText);
-    node.lineNumber = lineNumber;
-    node.preferredPanel = preferredPanel;
+    node.setAttribute("line_number", lineNumber);
+    node.setAttribute("preferred_panel", preferredPanel);
     return node;
 }
 
+WebInspector.resourceURLForRelatedNode = function(node, url)
+{
+    if (!url || url.indexOf("://") > 0)
+        return url;
+
+    for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
+        if (frameOwnerCandidate.documentURL) {
+            var result = WebInspector.completeURL(frameOwnerCandidate.documentURL, url);
+            if (result)
+                return result;
+            break;
+        }
+    }
+
+    // documentURL not found or has bad value
+    var resourceURL = url;
+    function callback(resource)
+    {
+        if (resource.path === url) {
+            resourceURL = resource.url;
+            return true;
+        }
+    }
+    WebInspector.forAllResources(callback);
+    return resourceURL;
+}
+
 WebInspector.completeURL = function(baseURL, href)
 {
-    var match = baseURL.match(WebInspector.URLRegExp);
-    if (match) {
+    var parsedURL = baseURL.asParsedURL();
+    if (parsedURL) {
         var path = href;
         if (path.charAt(0) !== "/") {
-            var basePath = match[4] || "/";
+            var basePath = parsedURL.path;
             path = basePath.substring(0, basePath.lastIndexOf("/")) + "/" + path;
+        } else if (path.length > 1 && path.charAt(1) === "/") {
+            // href starts with "//" which is a full URL with the protocol dropped (use the baseURL protocol).
+            return parsedURL.scheme + ":" + path;
         }
-        return match[1] + "://" + match[2] + (match[3] ? (":" + match[3]) : "") + path;
+        return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "") + path;
     }
     return null;
 }
@@ -3403,7 +3616,6 @@
     doc.defaultView.addEventListener("focus", this.windowFocused.bind(this), false);
     doc.defaultView.addEventListener("blur", this.windowBlurred.bind(this), false);
     doc.addEventListener("click", this.documentClick.bind(this), true);
-    doc.addEventListener("mouseover", this.documentMouseOver.bind(this), true);
 }
 
 WebInspector._searchFieldManualFocus = function(event)
@@ -3415,16138 +3627,18815 @@
 WebInspector._searchKeyDown = function(event)
 {
     // Escape Key will clear the field and clear the search results
-    if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) {
+    if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code) {
         // If focus belongs here and text is empty - nothing to do, return unhandled.
         if (event.target.value === "" && this.currentFocusElement === this.previousFocusElement)
             return;
         event.preventDefault();
         event.stopPropagation();
         // When search was selected manually and is currently blank, we'd like Esc stay unhandled
-        // and hit console drawer handler.
-        event.target.value = "";
 
-        this.performSearch(event);
-        this.currentFocusElement = this.previousFocusElement;
-        if (this.currentFocusElement === event.target)
-            this.currentFocusElement.select();
-        return false;
-    }
+event.target.value = "";
 
-    if (!isEnterKey(event))
-        return false;
+this.performSearch(event);
+this.currentFocusElement = this.previousFocusElement;
+if (this.currentFocusElement === event.target)
+this.currentFocusElement.select();
+return false;
+}
 
-    // Select all of the text so the user can easily type an entirely new query.
-    event.target.select();
+if (!isEnterKey(event))
+return false;
 
-    // Only call performSearch if the Enter key was pressed. Otherwise the search
-    // performance is poor because of searching on every key. The search field has
-    // the incremental attribute set, so we still get incremental searches.
-    this.performSearch(event);
 
-    // Call preventDefault since this was the Enter key. This prevents a "search" event
-    // from firing for key down. This stops performSearch from being called twice in a row.
-    event.preventDefault();
+event.target.select();
+
+
+
+
+this.performSearch(event);
+
+
+
+event.preventDefault();
 }
 
 WebInspector.performSearch = function(event)
 {
-    var query = event.target.value;
-    var forceSearch = event.keyIdentifier === "Enter";
-    var isShortSearch = (query.length < 3);
+var forceSearch = event.keyIdentifier === "Enter";
+this.doPerformSearch(event.target.value, forceSearch, event.shiftKey, false);
+}
 
-    // Clear a leftover short search flag due to a non-conflicting forced search.
-    if (isShortSearch && this.shortSearchWasForcedByKeyEvent && this.currentQuery !== query)
-        delete this.shortSearchWasForcedByKeyEvent;
+WebInspector.doPerformSearch = function(query, forceSearch, isBackwardSearch, repeatSearch)
+{
+var isShortSearch = (query.length < 3);
 
-    // Indicate this was a forced search on a short query.
-    if (isShortSearch && forceSearch)
-        this.shortSearchWasForcedByKeyEvent = true;
 
-    if (!query || !query.length || (!forceSearch && isShortSearch)) {
-        // Prevent clobbering a short search forced by the user.
-        if (this.shortSearchWasForcedByKeyEvent) {
-            delete this.shortSearchWasForcedByKeyEvent;
-            return;
-        }
+if (isShortSearch && this.shortSearchWasForcedByKeyEvent && this.currentQuery !== query)
+delete this.shortSearchWasForcedByKeyEvent;
 
-        delete this.currentQuery;
 
-        for (var panelName in this.panels) {
-            var panel = this.panels[panelName];
-            if (panel.currentQuery && panel.searchCanceled)
-                panel.searchCanceled();
-            delete panel.currentQuery;
-        }
+if (isShortSearch && forceSearch)
+this.shortSearchWasForcedByKeyEvent = true;
 
-        this.updateSearchMatchesCount();
+if (!query || !query.length || (!forceSearch && isShortSearch)) {
 
-        return;
-    }
+if (this.shortSearchWasForcedByKeyEvent) {
+delete this.shortSearchWasForcedByKeyEvent;
+return;
+}
 
-    if (query === this.currentPanel.currentQuery && this.currentPanel.currentQuery === this.currentQuery) {
-        // When this is the same query and a forced search, jump to the next
-        // search result for a good user experience.
-        if (forceSearch && this.currentPanel.jumpToNextSearchResult)
-            this.currentPanel.jumpToNextSearchResult();
-        return;
-    }
+delete this.currentQuery;
 
-    this.currentQuery = query;
+for (var panelName in this.panels) {
+var panel = this.panels[panelName];
+var hadCurrentQuery = !!panel.currentQuery;
+delete panel.currentQuery;
+if (hadCurrentQuery && panel.searchCanceled)
+panel.searchCanceled();
+}
 
-    this.updateSearchMatchesCount();
+this.updateSearchMatchesCount();
 
-    if (!this.currentPanel.performSearch)
-        return;
+return;
+}
 
-    this.currentPanel.currentQuery = query;
-    this.currentPanel.performSearch(query);
+if (!repeatSearch && query === this.currentPanel.currentQuery && this.currentPanel.currentQuery === this.currentQuery) {
+
+
+if (forceSearch) {
+if (!isBackwardSearch && this.currentPanel.jumpToNextSearchResult)
+this.currentPanel.jumpToNextSearchResult();
+else if (isBackwardSearch && this.currentPanel.jumpToPreviousSearchResult)
+this.currentPanel.jumpToPreviousSearchResult();
+}
+return;
+}
+
+this.currentQuery = query;
+
+this.updateSearchMatchesCount();
+
+if (!this.currentPanel.performSearch)
+return;
+
+this.currentPanel.currentQuery = query;
+this.currentPanel.performSearch(query);
 }
 
 WebInspector.addNodesToSearchResult = function(nodeIds)
 {
-    WebInspector.panels.elements.addNodesToSearchResult(nodeIds);
+WebInspector.panels.elements.addNodesToSearchResult(nodeIds);
 }
 
 WebInspector.updateSearchMatchesCount = function(matches, panel)
 {
-    if (!panel)
-        panel = this.currentPanel;
+if (!panel)
+panel = this.currentPanel;
 
-    panel.currentSearchMatches = matches;
+panel.currentSearchMatches = matches;
 
-    if (panel !== this.currentPanel)
-        return;
+if (panel !== this.currentPanel)
+return;
 
-    if (!this.currentPanel.currentQuery) {
-        document.getElementById("search-results-matches").addStyleClass("hidden");
-        return;
-    }
+if (!this.currentPanel.currentQuery) {
+document.getElementById("search-results-matches").addStyleClass("hidden");
+return;
+}
 
-    if (matches) {
-        if (matches === 1)
-            var matchesString = WebInspector.UIString("1 match");
-        else
-            var matchesString = WebInspector.UIString("%d matches", matches);
-    } else
-        var matchesString = WebInspector.UIString("Not Found");
+if (matches) {
+if (matches === 1)
+var matchesString = WebInspector.UIString("1 match");
+else
+var matchesString = WebInspector.UIString("%d matches", matches);
+} else
+var matchesString = WebInspector.UIString("Not Found");
 
-    var matchesToolbarElement = document.getElementById("search-results-matches");
-    matchesToolbarElement.removeStyleClass("hidden");
-    matchesToolbarElement.textContent = matchesString;
+var matchesToolbarElement = document.getElementById("search-results-matches");
+matchesToolbarElement.removeStyleClass("hidden");
+matchesToolbarElement.textContent = matchesString;
 }
 
 WebInspector.UIString = function(string)
 {
-    if (window.localizedStrings && string in window.localizedStrings)
-        string = window.localizedStrings[string];
-    else {
-        if (!(string in this.missingLocalizedStrings)) {
-            if (!WebInspector.InspectorBackendStub)
-                console.error("Localized string \"" + string + "\" not found.");
-            this.missingLocalizedStrings[string] = true;
-        }
+if (window.localizedStrings && string in window.localizedStrings)
+string = window.localizedStrings[string];
+else {
+if (!(string in WebInspector.missingLocalizedStrings)) {
+if (!WebInspector.InspectorBackendStub)
+console.error("Localized string \"" + string + "\" not found.");
+WebInspector.missingLocalizedStrings[string] = true;
+}
 
-        if (Preferences.showMissingLocalizedStrings)
-            string += " (not localized)";
-    }
+if (Preferences.showMissingLocalizedStrings)
+string += " (not localized)";
+}
 
-    return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
+return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
+}
+
+WebInspector.formatLocalized = function(format, substitutions, formatters, initialValue, append)
+{
+return String.format(WebInspector.UIString(format), substitutions, formatters, initialValue, append);
 }
 
 WebInspector.isMac = function()
 {
-    if (!("_isMac" in this))
-        this._isMac = WebInspector.platform === "mac";
+if (!("_isMac" in this))
+this._isMac = WebInspector.platform === "mac";
 
-    return this._isMac;
+return this._isMac;
 }
 
 WebInspector.isBeingEdited = function(element)
 {
-    return element.__editing;
+return element.__editing;
+}
+
+WebInspector.isEditingAnyField = function()
+{
+return this.__editing;
 }
 
 WebInspector.startEditing = function(element, committedCallback, cancelledCallback, context, multiline)
 {
-    if (element.__editing)
-        return;
-    element.__editing = true;
+if (element.__editing)
+return;
+element.__editing = true;
+WebInspector.__editing = true;
 
-    var oldText = getContent(element);
-    var moveDirection = "";
+var oldText = getContent(element);
+var moveDirection = "";
 
-    element.addStyleClass("editing");
+element.addStyleClass("editing");
 
-    var oldTabIndex = element.tabIndex;
-    if (element.tabIndex < 0)
-        element.tabIndex = 0;
+var oldTabIndex = element.tabIndex;
+if (element.tabIndex < 0)
+element.tabIndex = 0;
 
-    function blurEventListener() {
-        editingCommitted.call(element);
-    }
+function blurEventListener() {
+editingCommitted.call(element);
+}
 
-    function getContent(element) {
-        if (element.tagName === "INPUT" && element.type === "text")
-            return element.value;
-        else
-            return element.textContent;
-    }
+function getContent(element) {
+if (element.tagName === "INPUT" && element.type === "text")
+return element.value;
+else
+return element.textContent;
+}
 
-    function cleanUpAfterEditing() {
-        delete this.__editing;
+function cleanUpAfterEditing() {
+delete this.__editing;
+delete WebInspector.__editing;
 
-        this.removeStyleClass("editing");
-        this.tabIndex = oldTabIndex;
-        this.scrollTop = 0;
-        this.scrollLeft = 0;
+this.removeStyleClass("editing");
+this.tabIndex = oldTabIndex;
+this.scrollTop = 0;
+this.scrollLeft = 0;
 
-        element.removeEventListener("blur", blurEventListener, false);
-        element.removeEventListener("keydown", keyDownEventListener, true);
+element.removeEventListener("blur", blurEventListener, false);
+element.removeEventListener("keydown", keyDownEventListener, true);
 
-        if (element === WebInspector.currentFocusElement || element.isAncestor(WebInspector.currentFocusElement))
-            WebInspector.currentFocusElement = WebInspector.previousFocusElement;
-    }
+if (element === WebInspector.currentFocusElement || element.isAncestor(WebInspector.currentFocusElement))
+WebInspector.currentFocusElement = WebInspector.previousFocusElement;
+}
 
-    function editingCancelled() {
-        if (this.tagName === "INPUT" && this.type === "text")
-            this.value = oldText;
-        else
-            this.textContent = oldText;
+function editingCancelled() {
+if (this.tagName === "INPUT" && this.type === "text")
+this.value = oldText;
+else
+this.textContent = oldText;
 
-        cleanUpAfterEditing.call(this);
+cleanUpAfterEditing.call(this);
 
-        if (cancelledCallback)
-            cancelledCallback(this, context);
-    }
+if (cancelledCallback)
+cancelledCallback(this, context);
+}
 
-    function editingCommitted() {
-        cleanUpAfterEditing.call(this);
+function editingCommitted() {
+cleanUpAfterEditing.call(this);
 
-        if (committedCallback)
-            committedCallback(this, getContent(this), oldText, context, moveDirection);
-    }
+if (committedCallback)
+committedCallback(this, getContent(this), oldText, context, moveDirection);
+}
 
-    function keyDownEventListener(event) {
-        var isMetaOrCtrl = WebInspector.isMac() ?
-            event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey :
-            event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
-        if (isEnterKey(event) && (!multiline || isMetaOrCtrl)) {
-            editingCommitted.call(element);
-            event.preventDefault();
-            event.stopPropagation();
-        } else if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) {
-            editingCancelled.call(element);
-            event.preventDefault();
-            event.stopPropagation();
-        } else if (event.keyIdentifier === "U+0009") // Tab key
-            moveDirection = (event.shiftKey ? "backward" : "forward");
-    }
+function keyDownEventListener(event) {
+var isMetaOrCtrl = WebInspector.isMac() ?
+event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey :
+event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+if (isEnterKey(event) && (!multiline || isMetaOrCtrl)) {
+editingCommitted.call(element);
+event.preventDefault();
+event.stopPropagation();
+} else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code) {
+editingCancelled.call(element);
+event.preventDefault();
+event.stopPropagation();
+} else if (event.keyIdentifier === "U+0009") 
+moveDirection = (event.shiftKey ? "backward" : "forward");
+}
 
-    element.addEventListener("blur", blurEventListener, false);
-    element.addEventListener("keydown", keyDownEventListener, true);
+element.addEventListener("blur", blurEventListener, false);
+element.addEventListener("keydown", keyDownEventListener, true);
 
-    WebInspector.currentFocusElement = element;
+WebInspector.currentFocusElement = element;
+return {
+cancel: editingCancelled.bind(element),
+commit: editingCommitted.bind(element)
+};
 }
 
 WebInspector._toolbarItemClicked = function(event)
 {
-    var toolbarItem = event.currentTarget;
-    this.currentPanel = toolbarItem.panel;
+var toolbarItem = event.currentTarget;
+this.currentPanel = toolbarItem.panel;
 }
 
-// This table maps MIME types to the Resource.Types which are valid for them.
-// The following line:
-//    "text/html":                {0: 1},
-// means that text/html is a valid MIME type for resources that have type
-// WebInspector.Resource.Type.Document (which has a value of 0).
+
+
+
+
+
 WebInspector.MIMETypes = {
-    "text/html":                   {0: true},
-    "text/xml":                    {0: true},
-    "text/plain":                  {0: true},
-    "application/xhtml+xml":       {0: true},
-    "text/css":                    {1: true},
-    "text/xsl":                    {1: true},
-    "image/jpeg":                  {2: true},
-    "image/png":                   {2: true},
-    "image/gif":                   {2: true},
-    "image/bmp":                   {2: true},
-    "image/vnd.microsoft.icon":    {2: true},
-    "image/x-icon":                {2: true},
-    "image/x-xbitmap":             {2: true},
-    "font/ttf":                    {3: true},
-    "font/opentype":               {3: true},
-    "application/x-font-type1":    {3: true},
-    "application/x-font-ttf":      {3: true},
-    "application/x-truetype-font": {3: true},
-    "text/javascript":             {4: true},
-    "text/ecmascript":             {4: true},
-    "application/javascript":      {4: true},
-    "application/ecmascript":      {4: true},
-    "application/x-javascript":    {4: true},
-    "text/javascript1.1":          {4: true},
-    "text/javascript1.2":          {4: true},
-    "text/javascript1.3":          {4: true},
-    "text/jscript":                {4: true},
-    "text/livescript":             {4: true},
+"text/html":                   {0: true},
+"text/xml":                    {0: true},
+"text/plain":                  {0: true},
+"application/xhtml+xml":       {0: true},
+"text/css":                    {1: true},
+"text/xsl":                    {1: true},
+"image/jpeg":                  {2: true},
+"image/png":                   {2: true},
+"image/gif":                   {2: true},
+"image/bmp":                   {2: true},
+"image/vnd.microsoft.icon":    {2: true},
+"image/x-icon":                {2: true},
+"image/x-xbitmap":             {2: true},
+"font/ttf":                    {3: true},
+"font/opentype":               {3: true},
+"application/x-font-type1":    {3: true},
+"application/x-font-ttf":      {3: true},
+"application/x-truetype-font": {3: true},
+"text/javascript":             {4: true},
+"text/ecmascript":             {4: true},
+"application/javascript":      {4: true},
+"application/ecmascript":      {4: true},
+"application/x-javascript":    {4: true},
+"text/javascript1.1":          {4: true},
+"text/javascript1.2":          {4: true},
+"text/javascript1.3":          {4: true},
+"text/jscript":                {4: true},
+"text/livescript":             {4: true},
 }
 
-/* InspectorBackendStub.js */
+WebInspector.PanelHistory = function()
+{
+this._history = [];
+this._historyIterator = -1;
+}
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+WebInspector.PanelHistory.prototype = {
+canGoBack: function()
+{
+return this._historyIterator > 0;
+},
 
-if (!window.InspectorBackend) {
+goBack: function()
+{
+this._inHistory = true;
+WebInspector.currentPanel = WebInspector.panels[this._history[--this._historyIterator]];
+delete this._inHistory;
+},
+
+canGoForward: function()
+{
+return this._historyIterator < this._history.length - 1;
+},
+
+goForward: function()
+{
+this._inHistory = true;
+WebInspector.currentPanel = WebInspector.panels[this._history[++this._historyIterator]];
+delete this._inHistory;
+},
+
+setPanel: function(panelName)
+{
+if (this._inHistory)
+return;
+
+this._history.splice(this._historyIterator + 1, this._history.length - this._historyIterator - 1);
+if (!this._history.length || this._history[this._history.length - 1] !== panelName)
+this._history.push(panelName);
+this._historyIterator = this._history.length - 1;
+}
+}
+
+
+
+
+
+
+
 
 WebInspector.InspectorBackendStub = function()
 {
-    this._searchingForNode = false;
-    this._attachedWindowHeight = 0;
-    this._timelineEnabled = false;
+this._domainDispatchers = {};
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "populateScriptObjects", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "getInspectorState", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "setSearchingForNode", "arguments": {"enabled": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "setMonitoringXHREnabled", "arguments": {"enable": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "reloadPage", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "startTimelineProfiler", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "stopTimelineProfiler", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Resources", "command": "cachedResources", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Resources", "command": "resourceContent", "arguments": {"frameId": "number","url": "string","base64Encode": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Backend", "command": "enableDebugger", "arguments": {"always": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "disableDebugger", "arguments": {"always": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "setBreakpoint", "arguments": {"sourceID": "string","lineNumber": "number","enabled": "boolean","condition": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "removeBreakpoint", "arguments": {"sourceID": "string","lineNumber": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "activateBreakpoints", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "deactivateBreakpoints", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "pause", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "resume", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "stepOverStatement", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "stepIntoStatement", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "stepOutOfFunction", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "setPauseOnExceptionsState", "arguments": {"pauseOnExceptionsState": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "editScriptSource", "arguments": {"sourceID": "string","newContent": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Debugger", "command": "getScriptSource", "arguments": {"sourceID": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "setNativeBreakpoint", "arguments": {"breakpoint": "object"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "removeNativeBreakpoint", "arguments": {"breakpointId": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "enableProfiler", "arguments": {"always": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "disableProfiler", "arguments": {"always": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "startProfiling", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "stopProfiling", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Profiler", "command": "getProfileHeaders", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Profiler", "command": "getProfile", "arguments": {"type": "string","uid": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Profiler", "command": "removeProfile", "arguments": {"type": "string","uid": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Profiler", "command": "clearProfiles", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Profiler", "command": "takeHeapSnapshot", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Backend", "command": "setInjectedScriptSource", "arguments": {"scriptSource": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Backend", "command": "dispatchOnInjectedScript", "arguments": {"injectedScriptId": "number","methodName": "string","arguments": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "addScriptToEvaluateOnLoad", "arguments": {"scriptSource": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "removeAllScriptsToEvaluateOnLoad", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "getChildNodes", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "setAttribute", "arguments": {"elementId": "number","name": "string","value": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "removeAttribute", "arguments": {"elementId": "number","name": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "setTextNodeValue", "arguments": {"nodeId": "number","value": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "getEventListenersForNode", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "copyNode", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "removeNode", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "changeTagName", "arguments": {"nodeId": "number","newTagName": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "getOuterHTML", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "setOuterHTML", "arguments": {"nodeId": "number","outerHTML": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "addInspectedNode", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "performSearch", "arguments": {"query": "string","runSynchronously": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "searchCanceled", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "DOM", "command": "pushNodeByPathToFrontend", "arguments": {"path": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "setConsoleMessagesEnabled", "arguments": {"enabled": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "clearConsoleMessages", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "highlightDOMNode", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "hideDOMNodeHighlight", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "openInInspectedWindow", "arguments": {"url": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "highlightFrame", "arguments": {"frameId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "hideFrameHighlight", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getStylesForNode2", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getComputedStyleForNode2", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getInlineStyleForNode2", "arguments": {"nodeId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getAllStyles2", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getStyleSheet2", "arguments": {"styleSheetId": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getStyleSheetText2", "arguments": {"styleSheetId": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "setStyleSheetText2", "arguments": {"styleSheetId": "string","text": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "setPropertyText2", "arguments": {"styleId": "object","propertyIndex": "number","text": "string","overwrite": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "toggleProperty2", "arguments": {"styleId": "object","propertyIndex": "number","disable": "boolean"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "setRuleSelector2", "arguments": {"ruleId": "object","selector": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "addRule2", "arguments": {"contextNodeId": "number","selector": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "getSupportedCSSProperties", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "CSS", "command": "querySelectorAll", "arguments": {"documentId": "number","selector": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "getCookies", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "deleteCookie", "arguments": {"cookieName": "string","domain": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "ApplicationCache", "command": "getApplicationCaches", "arguments": {}}');
+this._registerDelegate('{"seq": 0, "domain": "FileSystem", "command": "getFileSystemPathAsync", "arguments": {"type": "number","origin": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "FileSystem", "command": "revealFolderInOS", "arguments": {"path": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Backend", "command": "releaseWrapperObjectGroup", "arguments": {"injectedScriptId": "number","objectGroup": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "didEvaluateForTestInFrontend", "arguments": {"testCallId": "number","jsonResult": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Backend", "command": "getDatabaseTableNames", "arguments": {"databaseId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Backend", "command": "executeSQL", "arguments": {"databaseId": "number","query": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "getDOMStorageEntries", "arguments": {"storageId": "number"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "setDOMStorageItem", "arguments": {"storageId": "number","key": "string","value": "string"}}');
+this._registerDelegate('{"seq": 0, "domain": "Inspector", "command": "removeDOMStorageItem", "arguments": {"storageId": "number","key": "string"}}');
 }
 
 WebInspector.InspectorBackendStub.prototype = {
-    wrapCallback: function(func)
-    {
-        return func;
-    },
 
-    closeWindow: function()
-    {
-        this._windowVisible = false;
-    },
+_registerDelegate: function(commandInfo)
+{
+var commandObject = JSON.parse(commandInfo);
+this[commandObject.command] = this.sendMessageToBackend.bind(this, commandInfo);
+},
 
-    attach: function()
-    {
-    },
+sendMessageToBackend: function()
+{
+var args = Array.prototype.slice.call(arguments);
+var request = JSON.parse(args.shift());
 
-    detach: function()
-    {
-    },
+for (var key in request.arguments) {
+if (args.length === 0) {
+console.error("Protocol Error: Invalid number of arguments for 'InspectorBackend.%s' call. It should have the next arguments '%s'.", request.command, JSON.stringify(request.arguments));
+return;
+}
+var value = args.shift();
+if (typeof value !== request.arguments[key]) {
+console.error("Protocol Error: Invalid type of argument '%s' for 'InspectorBackend.%s' call. It should be '%s' but it is '%s'.", key, request.command, request.arguments[key], typeof value);
+return;
+}
+request.arguments[key] = value;
+}
 
-    storeLastActivePanel: function(panel)
-    {
-    },
+if (args.length === 1) {
+if (typeof args[0] !== "function" && typeof args[0] !== "undefined") {
+console.error("Protocol Error: Optional callback argument for 'InspectorBackend.%s' call should be a function but its type is '%s'.", request.command, typeof args[0]);
+return;
+}
+request.seq = WebInspector.Callback.wrap(args[0]);
+}
 
-    clearMessages: function()
-    {
-    },
+if (window.dumpInspectorProtocolMessages)
+console.log("frontend: " + JSON.stringify(request));
 
-    searchingForNode: function()
-    {
-        return this._searchingForNode;
-    },
+var message = JSON.stringify(request);
+InspectorFrontendHost.sendMessageToBackend(message);
+},
 
-    search: function(sourceRow, query)
-    {
-    },
+registerDomainDispatcher: function(domain, dispatcher)
+{
+this._domainDispatchers[domain] = dispatcher;
+},
 
-    toggleNodeSearch: function()
-    {
-        this._searchingForNode = !this._searchingForNode;
-    },
+dispatch: function(message)
+{
+if (window.dumpInspectorProtocolMessages)
+console.log("backend: " + ((typeof message === "string") ? message : JSON.stringify(message)));
 
-    setAttachedWindowHeight: function(height)
-    {
-    },
+var messageObject = (typeof message === "string") ? JSON.parse(message) : message;
 
-    moveByUnrestricted: function(x, y)
-    {
-    },
+var arguments = [];
+if (messageObject.data)
+for (var key in messageObject.data)
+arguments.push(messageObject.data[key]);
 
-    getResourceContent: function(callId, identifier)
-    {
-        WebInspector.didGetResourceContent(callId, "");
-    },
+if ("seq" in messageObject) { 
+if (messageObject.success)
+WebInspector.Callback.processResponse(messageObject.seq, arguments);
+else {
+WebInspector.Callback.removeResponseCallbackEntry(messageObject.seq)
+this.reportProtocolError(messageObject);
+}
+return;
+}
 
-    highlightDOMNode: function(node)
-    {
-    },
+if (messageObject.type === "event") {
+if (!(messageObject.domain in this._domainDispatchers)) {
+console.error("Protocol Error: the message is for non-existing domain '%s'", messageObject.domain);
+return;
+}
+var dispatcher = this._domainDispatchers[messageObject.domain];
+if (!(messageObject.event in dispatcher)) {
+console.error("Protocol Error: Attempted to dispatch an unimplemented method '%s.%s'", messageObject.domain, messageObject.event);
+return;
+}
+dispatcher[messageObject.event].apply(dispatcher, arguments);
+}
+},
 
-    hideDOMNodeHighlight: function()
-    {
-    },
-
-    inspectedWindow: function()
-    {
-        return window;
-    },
-
-    loaded: function()
-    {
-    },
-
-    localizedStringsURL: function()
-    {
-        return undefined;
-    },
-
-    windowUnloading: function()
-    {
-        return false;
-    },
-
-    hiddenPanels: function()
-    {
-        return "";
-    },
-
-    enableResourceTracking: function()
-    {
-        WebInspector.resourceTrackingWasEnabled();
-    },
-
-    disableResourceTracking: function()
-    {
-        WebInspector.resourceTrackingWasDisabled();
-    },
-
-
-    enableSearchingForNode: function()
-    {
-        WebInspector.searchingForNodeWasEnabled();
-    },
-
-    disableSearchingForNode: function()
-    {
-        WebInspector.searchingForNodeWasDisabled();
-    },
-
-    reloadPage: function()
-    {
-    },
-
-    enableDebugger: function()
-    {
-        WebInspector.debuggerWasEnabled();
-    },
-
-    disableDebugger: function()
-    {
-        WebInspector.debuggerWasDisabled();
-    },
-
-    setBreakpoint: function(sourceID, line, enabled, condition)
-    {
-    },
-
-    removeBreakpoint: function(sourceID, line)
-    {
-    },
-
-    activateBreakpoints: function()
-    {
-        this._breakpointsActivated = true;
-    },
-
-    deactivateBreakpoints: function()
-    {
-        this._breakpointsActivated = false;
-    },
-
-    pauseInDebugger: function()
-    {
-    },
-
-    setPauseOnExceptionsState: function(value)
-    {
-        WebInspector.updatePauseOnExceptionsState(value);
-    },
-
-    resumeDebugger: function()
-    {
-    },
-
-    enableProfiler: function()
-    {
-        WebInspector.profilerWasEnabled();
-    },
-
-    disableProfiler: function()
-    {
-        WebInspector.profilerWasDisabled();
-    },
-
-    startProfiling: function()
-    {
-    },
-
-    stopProfiling: function()
-    {
-    },
-
-    getProfileHeaders: function(callId)
-    {
-        WebInspector.didGetProfileHeaders(callId, []);
-    },
-
-    getProfile: function(callId, uid)
-    {
-        if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles))
-        {
-            WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]);
-        }
-    },
-
-    takeHeapSnapshot: function()
-    {
-    },
-
-    databaseTableNames: function(database)
-    {
-        return [];
-    },
-
-    stepIntoStatementInDebugger: function()
-    {
-    },
-
-    stepOutOfFunctionInDebugger: function()
-    {
-    },
-
-    stepOverStatementInDebugger: function()
-    {
-    },
-
-    saveFrontendSettings: function()
-    {
-    },
-
-    dispatchOnInjectedScript: function()
-    {
-    },
-
-    releaseWrapperObjectGroup: function()
-    {
-    },
-
-    setInjectedScriptSource: function()
-    {
-    },
-    
-    addScriptToEvaluateOnLoad: function()
-    {
-    },
-
-    removeAllScriptsToEvaluateOnLoad: function()
-    {
-    }
+reportProtocolError: function(messageObject)
+{
+console.error("Protocol Error: InspectorBackend request with seq = %d failed.", messageObject.seq);
+for (var i = 0; i < messageObject.errors.length; ++i)
+console.error("    " + messageObject.errors[i]);
+WebInspector.Callback.removeResponseCallbackEntry(messageObject.seq);
+}
 }
 
 InspectorBackend = new WebInspector.InspectorBackendStub();
 
-}
 
-/* InspectorFrontendHostStub.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
 if (!window.InspectorFrontendHost) {
 
 WebInspector.InspectorFrontendHostStub = function()
 {
-    this._attachedWindowHeight = 0;
+this._attachedWindowHeight = 0;
 }
 
 WebInspector._platformFlavor = WebInspector.PlatformFlavor.MacLeopard;
 
 WebInspector.InspectorFrontendHostStub.prototype = {
-    platform: function()
-    {
-        return "mac";
-    },
+platform: function()
+{
+var match = navigator.userAgent.match(/Windows NT/);
+if (match)
+return "windows";
+match = navigator.userAgent.match(/Mac OS X/);
+if (match)
+return "mac";
+return "linux";
+},
 
-    port: function()
-    {
-        return "unknown";
-    },
+port: function()
+{
+return "unknown";
+},
 
-    closeWindow: function()
-    {
-        this._windowVisible = false;
-    },
+bringToFront: function()
+{
+this._windowVisible = true;
+},
 
-    attach: function()
-    {
-    },
+closeWindow: function()
+{
+this._windowVisible = false;
+},
 
-    detach: function()
-    {
-    },
+disconnectFromBackend: function()
+{
+this._windowVisible = false;
+},
 
-    search: function(sourceRow, query)
-    {
-    },
+attach: function()
+{
+},
 
-    setAttachedWindowHeight: function(height)
-    {
-    },
+detach: function()
+{
+},
 
-    moveWindowBy: function(x, y)
-    {
-    },
+search: function(sourceRow, query)
+{
+},
 
-    loaded: function()
-    {
-    },
+setAttachedWindowHeight: function(height)
+{
+},
 
-    localizedStringsURL: function()
-    {
-        return undefined;
-    },
+moveWindowBy: function(x, y)
+{
+},
 
-    hiddenPanels: function()
-    {
-        return "";
-    },
+setExtensionAPI: function(script)
+{
+},
 
-    windowUnloading: function()
-    {
-    },
+loaded: function()
+{
+},
 
-    copyText: function()
-    {
-    },
+localizedStringsURL: function()
+{
+return undefined;
+},
 
-    canAttachWindow: function()
-    {
-        return false;
-    }
+hiddenPanels: function()
+{
+return "";
+},
+
+inspectedURLChanged: function(url)
+{
+},
+
+copyText: function()
+{
+},
+
+canAttachWindow: function()
+{
+return false;
+},
+
+sendMessageToBackend: function(message)
+{
+}
 }
 
 InspectorFrontendHost = new WebInspector.InspectorFrontendHostStub();
 
 }
 
-/* Object.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+if (!window.InspectorExtensionRegistry) {
+
+WebInspector.InspectorExtensionRegistryStub = function()
+{
+}
+
+WebInspector.InspectorExtensionRegistryStub.prototype = {
+getExtensionsAsync: function()
+{
+}
+};
+
+InspectorExtensionRegistry = new WebInspector.InspectorExtensionRegistryStub();
+
+}
+
+
+
+
 
 WebInspector.Object = function() {
 }
 
 WebInspector.Object.prototype = {
-    addEventListener: function(eventType, listener, thisObject) {
-        if (!("_listeners" in this))
-            this._listeners = {};
-        if (!(eventType in this._listeners))
-            this._listeners[eventType] = [];
-        this._listeners[eventType].push({ thisObject: thisObject, listener: listener });
-    },
+addEventListener: function(eventType, listener, thisObject)
+{
+if (!("_listeners" in this))
+this._listeners = {};
+if (!(eventType in this._listeners))
+this._listeners[eventType] = [];
+this._listeners[eventType].push({ thisObject: thisObject, listener: listener });
+},
 
-    removeEventListener: function(eventType, listener, thisObject) {
-        if (!("_listeners" in this) || !(eventType in this._listeners))
-            return;
-        var listeners = this._listeners[eventType];
-        for (var i = 0; i < listeners.length; ++i) {
-            if (listener && listeners[i].listener === listener && listeners[i].thisObject === thisObject)
-                listeners.splice(i, 1);
-            else if (!listener && thisObject && listeners[i].thisObject === thisObject)
-                listeners.splice(i, 1);
-        }
-
-        if (!listeners.length)
-            delete this._listeners[eventType];
-    },
-
-    dispatchEventToListeners: function(eventType) {
-        if (!("_listeners" in this) || !(eventType in this._listeners))
-            return;
-
-        var stoppedPropagation = false;
-
-        function stopPropagation()
-        {
-            stoppedPropagation = true;
-        }
-
-        function preventDefault()
-        {
-            this.defaultPrevented = true;
-        }
-
-        var event = {target: this, type: eventType, defaultPrevented: false};
-        event.stopPropagation = stopPropagation;
-        event.preventDefault = preventDefault;
-
-        var listeners = this._listeners[eventType].slice(0);
-        for (var i = 0; i < listeners.length; ++i) {
-            listeners[i].listener.call(listeners[i].thisObject, event);
-            if (stoppedPropagation)
-                break;
-        }
-
-        return event.defaultPrevented;
-    }
+removeEventListener: function(eventType, listener, thisObject)
+{
+if (!("_listeners" in this) || !(eventType in this._listeners))
+return;
+var listeners = this._listeners[eventType];
+for (var i = 0; i < listeners.length; ++i) {
+if (listener && listeners[i].listener === listener && listeners[i].thisObject === thisObject)
+listeners.splice(i, 1);
+else if (!listener && thisObject && listeners[i].thisObject === thisObject)
+listeners.splice(i, 1);
 }
 
-/* Settings.js */
+if (!listeners.length)
+delete this._listeners[eventType];
+},
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+removeAllListeners: function()
+{
+delete this._listeners;
+},
+
+dispatchEventToListeners: function(eventType, eventData)
+{
+if (!("_listeners" in this) || !(eventType in this._listeners))
+return;
+
+var stoppedPropagation = false;
+
+function stopPropagation()
+{
+stoppedPropagation = true;
+}
+
+function preventDefault()
+{
+this.defaultPrevented = true;
+}
+
+var event = {target: this, type: eventType, data: eventData, defaultPrevented: false};
+event.stopPropagation = stopPropagation;
+event.preventDefault = preventDefault;
+
+var listeners = this._listeners[eventType].slice(0);
+for (var i = 0; i < listeners.length; ++i) {
+listeners[i].listener.call(listeners[i].thisObject, event);
+if (stoppedPropagation)
+break;
+}
+
+return event.defaultPrevented;
+}
+}
+
+
+
+
 
 
 var Preferences = {
-    maxInlineTextChildLength: 80,
-    minConsoleHeight: 75,
-    minSidebarWidth: 100,
-    minElementsSidebarWidth: 200,
-    minScriptsSidebarWidth: 200,
-    styleRulesExpandedState: {},
-    showMissingLocalizedStrings: false,
-    samplingCPUProfiler: false,
-    showColorNicknames: true,
-    debuggerAlwaysEnabled: false,
-    profilerAlwaysEnabled: false,
-    auditsPanelEnabled: false
-}
-
-WebInspector.populateFrontendSettings = function(settingsString)
-{
-    WebInspector.settings._load(settingsString);
+canEditScriptSource: false,
+maxInlineTextChildLength: 80,
+minConsoleHeight: 75,
+minSidebarWidth: 100,
+minElementsSidebarWidth: 200,
+minScriptsSidebarWidth: 200,
+styleRulesExpandedState: {},
+showMissingLocalizedStrings: false,
+samplingCPUProfiler: false,
+showColorNicknames: true,
+debuggerAlwaysEnabled: false,
+profilerAlwaysEnabled: false,
+onlineDetectionEnabled: true,
+nativeInstrumentationEnabled: false,
+resourceExportEnabled: false,
+fileSystemEnabled: false,
+useDataURLForResourceImageIcons: true,
+showTimingTab: false,
+showCookiesTab: false,
+debugMode: false
 }
 
 WebInspector.Settings = function()
 {
+this.installApplicationSetting("colorFormat", "hex");
+this.installApplicationSetting("consoleHistory", []);
+this.installApplicationSetting("eventListenersFilter", "all");
+this.installApplicationSetting("lastViewedScriptFile", "application");
+this.installApplicationSetting("resourcesLargeRows", true);
+this.installApplicationSetting("resourcesSortOptions", {timeOption: "responseTime", sizeOption: "transferSize"});
+this.installApplicationSetting("resourceViewTab", "content");
+this.installApplicationSetting("showInheritedComputedStyleProperties", false);
+this.installApplicationSetting("showUserAgentStyles", true);
+this.installApplicationSetting("watchExpressions", []);
+this.installApplicationSetting("lastActivePanel", "elements");
+
+this.installProjectSetting("breakpoints", {});
+this.installProjectSetting("nativeBreakpoints", []);
 }
 
 WebInspector.Settings.prototype = {
-    _load: function(settingsString)
-    {
-        try {
-            this._store = JSON.parse(settingsString);
-        } catch (e) {
-            // May fail;
-            this._store = {};
-        }
+installApplicationSetting: function(key, defaultValue)
+{
+if (key in this)
+return;
 
-        this._installSetting("eventListenersFilter", "event-listeners-filter", "all");
-        this._installSetting("colorFormat", "color-format", "hex");
-        this._installSetting("resourcesLargeRows", "resources-large-rows", true);
-        this._installSetting("watchExpressions", "watch-expressions", []);
-        this._installSetting("lastViewedScriptFile", "last-viewed-script-file");
-        this._installSetting("showInheritedComputedStyleProperties", "show-inherited-computed-style-properties", false);
-        this._installSetting("showUserAgentStyles", "show-user-agent-styles", true);
-        this._installSetting("resourceViewTab", "resource-view-tab", "content");
-        this.dispatchEventToListeners("loaded");
-    },
+this.__defineGetter__(key, this._get.bind(this, key, defaultValue));
+this.__defineSetter__(key, this._set.bind(this, key));
+},
 
-    _installSetting: function(name, propertyName, defaultValue)
-    {
-        this.__defineGetter__(name, this._get.bind(this, propertyName));
-        this.__defineSetter__(name, this._set.bind(this, propertyName));
-        if (!(propertyName in this._store)) {
-            this._store[propertyName] = defaultValue;
-        }
-    },
+installProjectSetting: function(key, defaultValue)
+{
+this.__defineGetter__(key, this._getProjectSetting.bind(this, key, defaultValue));
+this.__defineSetter__(key, this._setProjectSetting.bind(this, key));
+},
 
-    _get: function(propertyName)
-    {
-        return this._store[propertyName];
-    },
+inspectedURLChanged: function(url)
+{
+var fragmentIndex = url.indexOf("#");
+if (fragmentIndex !== -1)
+url = url.substring(0, fragmentIndex);
+this._inspectedURL = url;
+},
 
-    _set: function(propertyName, newValue)
-    {
-        this._store[propertyName] = newValue;
-        try {
-            InspectorBackend.saveFrontendSettings(JSON.stringify(this._store));
-        } catch (e) {
-            // May fail;
-        }
-    }
+_get: function(key, defaultValue)
+{
+if (key in window.localStorage) {
+try {
+return JSON.parse(window.localStorage[key]);
+} catch(e) {
+window.localStorage.removeItem(key);
+}
+}
+return defaultValue;
+},
+
+_set: function(key, value)
+{
+window.localStorage[key] = JSON.stringify(value);
+},
+
+_getProjectSetting: function(key, defaultValue)
+{
+return this._get(this._formatProjectKey(key), defaultValue);
+},
+
+_setProjectSetting: function(key, value)
+{
+return this._set(this._formatProjectKey(key), value);
+},
+
+_formatProjectKey: function(key)
+{
+return key + ":" + this._inspectedURL;
+}
 }
 
 WebInspector.Settings.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* ContextMenu.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+WebInspector.CSSStyleModel = function()
+{
+}
+
+WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
+{
+var result = [];
+for (var i = 0; i < ruleArray.length; ++i)
+result.push(WebInspector.CSSRule.parsePayload(ruleArray[i]));
+return result;
+}
+
+WebInspector.CSSStyleModel.prototype = {
+getStylesAsync: function(nodeId, userCallback)
+{
+function callback(userCallback, payload)
+{
+if (!payload) {
+if (userCallback)
+userCallback(null);
+return;
+}
+
+var result = {};
+if ("inlineStyle" in payload)
+result.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(payload.inlineStyle);
+
+result.computedStyle = WebInspector.CSSStyleDeclaration.parsePayload(payload.computedStyle);
+result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(payload.matchedCSSRules);
+
+result.styleAttributes = {};
+for (var name in payload.styleAttributes)
+result.styleAttributes[name] = WebInspector.CSSStyleDeclaration.parsePayload(payload.styleAttributes[name]);
+
+result.pseudoElements = [];
+for (var i = 0; i < payload.pseudoElements.length; ++i) {
+var entryPayload = payload.pseudoElements[i];
+result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.rules) });
+}
+
+result.inherited = [];
+for (var i = 0; i < payload.inherited.length; ++i) {
+var entryPayload = payload.inherited[i];
+var entry = {};
+if ("inlineStyle" in entryPayload)
+entry.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);
+if ("matchedCSSRules" in entryPayload)
+entry.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.matchedCSSRules);
+result.inherited.push(entry);
+}
+
+if (userCallback)
+userCallback(result);
+}
+
+InspectorBackend.getStylesForNode2(nodeId, callback.bind(null, userCallback));
+},
+
+getComputedStyleAsync: function(nodeId, userCallback)
+{
+function callback(userCallback, stylePayload)
+{
+if (!stylePayload)
+userCallback(null);
+else
+userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
+}
+
+InspectorBackend.getComputedStyleForNode2(nodeId, callback.bind(null, userCallback));
+},
+
+getInlineStyleAsync: function(nodeId, userCallback)
+{
+function callback(userCallback, stylePayload)
+{
+if (!stylePayload)
+userCallback(null);
+else
+userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
+}
+
+InspectorBackend.getInlineStyleForNode2(nodeId, callback.bind(null, userCallback));
+},
+
+setRuleSelector: function(ruleId, nodeId, newSelector, successCallback, failureCallback)
+{
+function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
+{
+var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
+var rule = WebInspector.CSSRule.parsePayload(rulePayload);
+successCallback(rule, doesAffectSelectedNode);
+this._styleSheetChanged(rule.id.styleSheetId, true);
+}
+
+function callback(nodeId, successCallback, failureCallback, newSelector, rulePayload)
+{
+if (!rulePayload)
+failureCallback();
+else
+InspectorBackend.querySelectorAll(nodeId, newSelector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
+}
+
+InspectorBackend.setRuleSelector2(ruleId, newSelector, callback.bind(this, nodeId, successCallback, failureCallback));
+},
+
+addRule: function(nodeId, selector, successCallback, failureCallback)
+{
+function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds)
+{
+var doesAffectSelectedNode = (selectedNodeIds.indexOf(nodeId) >= 0);
+var rule = WebInspector.CSSRule.parsePayload(rulePayload);
+successCallback(rule, doesAffectSelectedNode);
+this._styleSheetChanged(rule.id.styleSheetId, true);
+}
+
+function callback(successCallback, failureCallback, selector, rulePayload)
+{
+if (!rulePayload) {
+
+failureCallback();
+} else
+InspectorBackend.querySelectorAll(nodeId, selector, checkAffectsCallback.bind(this, nodeId, successCallback, rulePayload));
+}
+
+InspectorBackend.addRule2(nodeId, selector, callback.bind(this, successCallback, failureCallback, selector));
+},
+
+_styleSheetChanged: function(styleSheetId, majorChange)
+{
+if (!majorChange || !styleSheetId)
+return;
+
+function callback(href, content)
+{
+var resource = WebInspector.resourceManager.resourceForURL(href);
+if (resource && resource.type === WebInspector.Resource.Type.Stylesheet)
+resource.setContent(content, this._onRevert.bind(this, styleSheetId));
+}
+InspectorBackend.getStyleSheetText2(styleSheetId, callback.bind(this));
+},
+
+_onRevert: function(styleSheetId, contentToRevertTo)
+{
+function callback(success)
+{
+this._styleSheetChanged(styleSheetId, true);
+}
+InspectorBackend.setStyleSheetText2(styleSheetId, contentToRevertTo, callback.bind(this));
+}
+}
+
+WebInspector.CSSStyleDeclaration = function(payload)
+{
+this.id = payload.styleId;
+this.properties = payload.properties;
+this._shorthandValues = payload.shorthandValues;
+this._livePropertyMap = {}; 
+this._allProperties = []; 
+this._longhandProperties = {}; 
+this.__disabledProperties = {}; 
+var payloadPropertyCount = payload.cssProperties.length;
+
+var propertyIndex = 0;
+for (var i = 0; i < payloadPropertyCount; ++i) {
+var property = new WebInspector.CSSProperty.parsePayload(this, i, payload.cssProperties[i]);
+this._allProperties.push(property);
+if (property.disabled)
+this.__disabledProperties[i] = property;
+if (!property.active && !property.styleBased)
+continue;
+var name = property.name;
+this[propertyIndex] = name;
+this._livePropertyMap[name] = property;
+
+
+if (property.shorthand) { 
+var longhands = this._longhandProperties[property.shorthand];
+if (!longhands) {
+longhands = [];
+this._longhandProperties[property.shorthand] = longhands;
+}
+longhands.push(property);
+}
+++propertyIndex;
+}
+this.length = propertyIndex;
+if ("cssText" in payload)
+this.cssText = payload.cssText;
+}
+
+WebInspector.CSSStyleDeclaration.parsePayload = function(payload)
+{
+return new WebInspector.CSSStyleDeclaration(payload);
+}
+
+WebInspector.CSSStyleDeclaration.prototype = {
+get allProperties()
+{
+return this._allProperties;
+},
+
+getLiveProperty: function(name)
+{
+return this._livePropertyMap[name];
+},
+
+getPropertyValue: function(name)
+{
+var property = this._livePropertyMap[name];
+return property ? property.value : "";
+},
+
+getPropertyPriority: function(name)
+{
+var property = this._livePropertyMap[name];
+return property ? property.priority : "";
+},
+
+getPropertyShorthand: function(name)
+{
+var property = this._livePropertyMap[name];
+return property ? property.shorthand : "";
+},
+
+isPropertyImplicit: function(name)
+{
+var property = this._livePropertyMap[name];
+return property ? property.implicit : "";
+},
+
+styleTextWithShorthands: function()
+{
+var cssText = "";
+var foundProperties = {};
+for (var i = 0; i < this.length; ++i) {
+var individualProperty = this[i];
+var shorthandProperty = this.getPropertyShorthand(individualProperty);
+var propertyName = (shorthandProperty || individualProperty);
+
+if (propertyName in foundProperties)
+continue;
+
+if (shorthandProperty) {
+var value = this.getShorthandValue(shorthandProperty);
+var priority = this.getShorthandPriority(shorthandProperty);
+} else {
+var value = this.getPropertyValue(individualProperty);
+var priority = this.getPropertyPriority(individualProperty);
+}
+
+foundProperties[propertyName] = true;
+
+cssText += propertyName + ": " + value;
+if (priority)
+cssText += " !" + priority;
+cssText += "; ";
+}
+
+return cssText;
+},
+
+getLonghandProperties: function(name)
+{
+return this._longhandProperties[name] || [];
+},
+
+getShorthandValue: function(shorthandProperty)
+{
+var property = this.getLiveProperty(shorthandProperty);
+return property ? property.value : this._shorthandValues[shorthandProperty];
+},
+
+getShorthandPriority: function(shorthandProperty)
+{
+var priority = this.getPropertyPriority(shorthandProperty);
+if (priority)
+return priority;
+
+var longhands = this._longhandProperties[shorthandProperty];
+return longhands ? this.getPropertyPriority(longhands[0]) : null;
+},
+
+propertyAt: function(index)
+{
+return (index < this.allProperties.length) ? this.allProperties[index] : null;
+},
+
+pastLastSourcePropertyIndex: function()
+{
+for (var i = this.allProperties.length - 1; i >= 0; --i) {
+var property = this.allProperties[i];
+if (property.active || property.disabled)
+return i + 1;
+}
+return 0;
+},
+
+newBlankProperty: function()
+{
+return new WebInspector.CSSProperty(this, this.pastLastSourcePropertyIndex(), "", "", "", "active", true, false, false, "");
+},
+
+insertPropertyAt: function(index, name, value, userCallback)
+{
+function callback(userCallback, payload)
+{
+if (!userCallback)
+return;
+
+if (!payload)
+userCallback(null);
+else {
+userCallback(WebInspector.CSSStyleDeclaration.parsePayload(payload));
+WebInspector.cssModel._styleSheetChanged(this.id.styleSheetId, true);
+}
+}
+
+InspectorBackend.setPropertyText2(this.id, index, name + ": " + value + ";", false, callback.bind(null, userCallback));
+},
+
+appendProperty: function(name, value, userCallback)
+{
+this.insertPropertyAt(this.allProperties.length, name, value, userCallback);
+}
+}
+
+WebInspector.CSSRule = function(payload)
+{
+this.id = payload.ruleId;
+this.selectorText = payload.selectorText;
+this.sourceLine = payload.sourceLine;
+this.sourceURL = payload.sourceURL;
+this.origin = payload.origin;
+this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
+this.style.parentRule = this;
+this.selectorRange = payload.selectorRange;
+}
+
+WebInspector.CSSRule.parsePayload = function(payload)
+{
+return new WebInspector.CSSRule(payload);
+}
+
+WebInspector.CSSRule.prototype = {
+get isUserAgent()
+{
+return this.origin === "user-agent";
+},
+
+get isUser()
+{
+return this.origin === "user";
+},
+
+get isViaInspector()
+{
+return this.origin === "inspector";
+},
+
+get isRegular()
+{
+return this.origin === "";
+}
+}
+
+WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, shorthand, text)
+{
+this.ownerStyle = ownerStyle;
+this.index = index;
+this.name = name;
+this.value = value;
+this.priority = priority;
+this.status = status;
+this.parsedOk = parsedOk;
+this.implicit = implicit;
+this.shorthand = shorthand;
+this.text = text;
+}
+
+WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
+{
+var result = new WebInspector.CSSProperty(
+ownerStyle, index, payload.name, payload.value, payload.priority, payload.status, payload.parsedOk, payload.implicit, payload.shorthandName, payload.text);
+return result;
+}
+
+WebInspector.CSSProperty.prototype = {
+get propertyText()
+{
+if (this.text !== undefined)
+return this.text;
+
+if (this.name === "")
+return "";
+return this.name + ": " + this.value + (this.priority ? " !" + this.priority : "") + ";";
+},
+
+get isLive()
+{
+return this.active || this.styleBased;
+},
+
+get active()
+{
+return this.status === "active";
+},
+
+get styleBased()
+{
+return this.status === "style";
+},
+
+get inactive()
+{
+return this.status === "inactive";
+},
+
+get disabled()
+{
+return this.status === "disabled";
+},
+
+
+setText: function(propertyText, majorChange, userCallback)
+{
+function callback(stylePayload)
+{
+if (stylePayload)
+this.text = propertyText;
+
+if (!userCallback)
+return;
+if (!stylePayload)
+userCallback(null);
+else {
+var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
+userCallback(style);
+WebInspector.cssModel._styleSheetChanged(style.id.styleSheetId, majorChange);
+}
+}
+
+if (!this.ownerStyle)
+throw "No ownerStyle for property";
+
+
+InspectorBackend.setPropertyText2(this.ownerStyle.id, this.index, propertyText, this.index < this.ownerStyle.pastLastSourcePropertyIndex(), callback.bind(this));
+},
+
+setValue: function(newValue, userCallback)
+{
+var text = this.name + ": " + newValue + (this.priority ? " !" + this.priority : "") + ";"
+this.setText(text, userCallback);
+},
+
+setDisabled: function(disabled, userCallback)
+{
+if (!this.ownerStyle && userCallback)
+userCallback(null);
+if (disabled === this.disabled && userCallback)
+userCallback(this.ownerStyle);
+
+function callback(stylePayload)
+{
+if (!userCallback)
+return;
+if (!stylePayload)
+userCallback(null);
+else {
+var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
+userCallback(style);
+WebInspector.cssModel._styleSheetChanged(this.ownerStyle.id.styleSheetId, false);
+}
+}
+
+InspectorBackend.toggleProperty2(this.ownerStyle.id, this.index, disabled, callback.bind(this));
+}
+}
+
+WebInspector.CSSStyleSheet = function(payload)
+{
+this.id = payload.styleSheetId;
+this.sourceURL = payload.sourceURL;
+this.title = payload.title;
+this.disabled = payload.disabled;
+this.rules = [];
+this.styles = {};
+for (var i = 0; i < payload.rules.length; ++i) {
+var rule = WebInspector.CSSRule.parsePayload(payload.rules[i]);
+this.rules.push(rule);
+if (rule.style)
+this.styles[rule.style.id] = rule.style;
+}
+if ("text" in payload)
+this._text = payload.text;
+}
+
+WebInspector.CSSStyleSheet.createForId = function(styleSheetId, userCallback)
+{
+function callback(styleSheetPayload)
+{
+if (!styleSheetPayload)
+userCallback(null);
+else
+userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
+}
+InspectorBackend.getStyleSheet2(styleSheetId, callback.bind(this));
+}
+
+WebInspector.CSSStyleSheet.prototype = {
+getText: function()
+{
+return this._text;
+},
+
+setText: function(newText, userCallback)
+{
+function callback(styleSheetPayload)
+{
+if (!styleSheetPayload)
+userCallback(null);
+else {
+userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload));
+WebInspector.cssModel._styleSheetChanged(this.id, true);
+}
+}
+
+InspectorBackend.setStyleSheetText2(this.id, newText, callback.bind(this));
+}
+}
+
+
+
+
+
+WebInspector.Checkbox = function(label, className, tooltip)
+{
+this.element = document.createElement('label');
+this._inputElement = document.createElement('input');
+this._inputElement.type = "checkbox";
+
+this.element.className = className;
+this.element.appendChild(this._inputElement);
+this.element.appendChild(document.createTextNode(label));
+if (tooltip)
+this.element.title = tooltip;
+}
+
+WebInspector.Checkbox.prototype = {
+set checked(checked)
+{
+this._inputElement.checked = checked;
+},
+
+get checked()
+{
+return this._inputElement.checked;
+},
+
+addEventListener: function(listener)
+{
+function listenerWrapper(event)
+{
+if (listener)
+listener(event);
+event.stopPropagation();
+return true;
+}
+
+this._inputElement.addEventListener("click", listenerWrapper, false);
+this.element.addEventListener("click", listenerWrapper, false);
+}
+}
+
+
+
+
 
 WebInspector.ContextMenu = function() {
-    this._items = [];
-    this._handlers = {};
+this._items = [];
+this._handlers = {};
 }
 
 WebInspector.ContextMenu.prototype = {
-    show: function(event)
-    {
-        // Remove trailing separator.
-        while (this._items.length > 0 && !("id" in this._items[this._items.length - 1]))
-            this._items.splice(this._items.length - 1, 1);
+show: function(event)
+{
 
-        if (this._items.length) {
-            WebInspector._contextMenu = this;
-            InspectorFrontendHost.showContextMenu(event, this._items);
-        }
-    },
+while (this._items.length > 0 && !("id" in this._items[this._items.length - 1]))
+this._items.splice(this._items.length - 1, 1);
 
-    appendItem: function(label, handler)
-    {
-        var id = this._items.length;
-        this._items.push({id: id, label: label});
-        this._handlers[id] = handler;
-    },
+if (this._items.length) {
+WebInspector._contextMenu = this;
+InspectorFrontendHost.showContextMenu(event, this._items);
+}
+},
 
-    appendSeparator: function()
-    {
-        // No separator dupes allowed.
-        if (this._items.length === 0)
-            return;
-        if (!("id" in this._items[this._items.length - 1]))
-            return;
-        this._items.push({});
-    },
+appendItem: function(label, handler, disabled)
+{
+var id = this._items.length;
+this._items.push({type: "item", id: id, label: label, enabled: !disabled});
+this._handlers[id] = handler;
+},
 
-    _itemSelected: function(id)
-    {
-        if (this._handlers[id])
-            this._handlers[id].call(this);
-    }
+appendCheckboxItem: function(label, handler, checked, disabled)
+{
+var id = this._items.length;
+this._items.push({type: "checkbox", id: id, label: label, checked: !!checked, enabled: !disabled});
+this._handlers[id] = handler;
+},
+
+appendSeparator: function()
+{
+
+if (this._items.length === 0)
+return;
+if (!("id" in this._items[this._items.length - 1]))
+return;
+this._items.push({type: "separator"});
+},
+
+_itemSelected: function(id)
+{
+if (this._handlers[id])
+this._handlers[id].call(this);
+}
 }
 
 WebInspector.contextMenuItemSelected = function(id)
 {
-    if (WebInspector._contextMenu)
-        WebInspector._contextMenu._itemSelected(id);
+if (WebInspector._contextMenu)
+WebInspector._contextMenu._itemSelected(id);
 }
 
 WebInspector.contextMenuCleared = function()
 {
-    // FIXME: Unfortunately, contextMenuCleared is invoked between show and item selected
-    // so we can't delete last menu object from WebInspector. Fix the contract.
+
+
 }
 
-/* KeyboardShortcut.js */
 
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.KeyboardShortcut = function()
 {
 };
 
-/**
- * Constants for encoding modifier key set as a bit mask.
- * @see #_makeKeyFromCodeAndModifiers
- */
+
 WebInspector.KeyboardShortcut.Modifiers = {
-    None: 0,   // Constant for empty modifiers set.
-    Shift: 1,
-    Ctrl: 2,
-    Alt: 4,
-    Meta: 8    // Command key on Mac, Win key on other platforms.
+None: 0,   
+Shift: 1,
+Ctrl: 2,
+Alt: 4,
+Meta: 8,   
+get CtrlOrMeta()
+{
+
+return WebInspector.isMac() ? this.Meta : this.Ctrl;
+}
 };
 
-WebInspector.KeyboardShortcut.KeyCodes = {
-    Backspace: 8,
-    Tab: 9,
-    Esc: 27,
-    Space: 32,
-    PageUp: 33,      // also NUM_NORTH_EAST
-    PageDown: 34,    // also NUM_SOUTH_EAST
-    End: 35,         // also NUM_SOUTH_WEST
-    Home: 36,        // also NUM_NORTH_WEST
-    Left: 37,        // also NUM_WEST
-    Up: 38,          // also NUM_NORTH
-    Right: 39,       // also NUM_EAST
-    Down: 40,        // also NUM_SOUTH
-    Delete: 46,
-    Zero: 48,
-    F1: 112,
-    F2: 113,
-    F3: 114,
-    F4: 115,
-    F5: 116,
-    F6: 117,
-    F7: 118,
-    F8: 119,
-    F9: 120,
-    F10: 121,
-    F11: 122,
-    F12: 123,
-    Semicolon: 186,    // ;
-    Plus: 187,         // +
-    Comma: 188,        // ,
-    Minus: 189,        // -
-    Period: 190,       // .
-    Slash: 191,        // /
-    Apostrophe: 192,   // `
-    SingleQuote: 222   // '
+WebInspector.KeyboardShortcut.Keys = {
+Backspace: { code: 8, name: "\u21a4" },
+Tab: { code: 9, name: { mac: "\u21e5", other: "<Tab>" } },
+Enter: { code: 13, name: { mac: "\u21a9", other: "<Enter>" } },
+Esc: { code: 27, name: { mac: "\u238b", other: "<Esc>" } },
+Space: { code: 32, name: "<Space>" },
+PageUp: { code: 33,  name: { mac: "\u21de", other: "<PageUp>" } },      
+PageDown: { code: 34, name: { mac: "\u21df", other: "<PageDown>" } },   
+End: { code: 35, name: { mac: "\u2197", other: "<End>" } },             
+Home: { code: 36, name: { mac: "\u2196", other: "<Home>" } },           
+Left: { code: 37, name: "\u2190" },           
+Up: { code: 38, name: "\u2191" },             
+Right: { code: 39, name: "\u2192" },          
+Down: { code: 40, name: "\u2193" },           
+Delete: { code: 46, name: "<Del>" },
+Zero: { code: 48, name: "0" },
+F1: { code: 112, name: "F1" },
+F2: { code: 113, name: "F2" },
+F3: { code: 114, name: "F3" },
+F4: { code: 115, name: "F4" },
+F5: { code: 116, name: "F5" },
+F6: { code: 117, name: "F6" },
+F7: { code: 118, name: "F7" },
+F8: { code: 119, name: "F8" },
+F9: { code: 120, name: "F9" },
+F10: { code: 121, name: "F10" },
+F11: { code: 122, name: "F11" },
+F12: { code: 123, name: "F12" },
+Semicolon: { code: 186, name: ";" },
+Plus: { code: 187, name: "+" },
+Comma: { code: 188, name: "," },
+Minus: { code: 189, name: "-" },
+Period: { code: 190, name: "." },
+Slash: { code: 191, name: "/" },
+Apostrophe: { code: 192, name: "`" },
+SingleQuote: { code: 222, name: "\'" }
 };
 
-/**
- * Creates a number encoding keyCode in the lower 8 bits and modifiers mask in the higher 8 bits.
- * It is useful for matching pressed keys.
- * keyCode is the Code of the key, or a character "a-z" which is converted to a keyCode value.
- * optModifiers is an Optional list of modifiers passed as additional paramerters.
- */
+
 WebInspector.KeyboardShortcut.makeKey = function(keyCode, optModifiers)
 {
-    if (typeof keyCode === "string")
-        keyCode = keyCode.charCodeAt(0) - 32;
-    var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
-    for (var i = 1; i < arguments.length; i++)
-        modifiers |= arguments[i];
-    return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode, modifiers);
+if (typeof keyCode === "string")
+keyCode = keyCode.charCodeAt(0) - 32;
+var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
+for (var i = 1; i < arguments.length; i++)
+modifiers |= arguments[i];
+return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyCode, modifiers);
 };
 
 WebInspector.KeyboardShortcut.makeKeyFromEvent = function(keyboardEvent)
 {
-    var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
-    if (keyboardEvent.shiftKey)
-        modifiers |= WebInspector.KeyboardShortcut.Modifiers.Shift;
-    if (keyboardEvent.ctrlKey)
-        modifiers |= WebInspector.KeyboardShortcut.Modifiers.Ctrl;
-    if (keyboardEvent.altKey)
-        modifiers |= WebInspector.KeyboardShortcut.Modifiers.Alt;
-    if (keyboardEvent.metaKey)
-        modifiers |= WebInspector.KeyboardShortcut.Modifiers.Meta;
-    return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEvent.keyCode, modifiers);
+var modifiers = WebInspector.KeyboardShortcut.Modifiers.None;
+if (keyboardEvent.shiftKey)
+modifiers |= WebInspector.KeyboardShortcut.Modifiers.Shift;
+if (keyboardEvent.ctrlKey)
+modifiers |= WebInspector.KeyboardShortcut.Modifiers.Ctrl;
+if (keyboardEvent.altKey)
+modifiers |= WebInspector.KeyboardShortcut.Modifiers.Alt;
+if (keyboardEvent.metaKey)
+modifiers |= WebInspector.KeyboardShortcut.Modifiers.Meta;
+return WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers(keyboardEvent.keyCode, modifiers);
 };
 
+WebInspector.KeyboardShortcut.makeDescriptor = function(key, optModifiers)
+{
+var modifiers = 0;
+for (var i = 1; i < arguments.length; i++)
+modifiers |= arguments[i];
+
+return {
+key: WebInspector.KeyboardShortcut.makeKey(typeof key === "string" ? key : key.code, modifiers),
+name: WebInspector.KeyboardShortcut.shortcutToString(key, modifiers)
+};
+}
+
+WebInspector.KeyboardShortcut.shortcutToString = function(key, modifiers)
+{
+return WebInspector.KeyboardShortcut._modifiersToString(modifiers) + WebInspector.KeyboardShortcut._keyName(key);
+}
+
+WebInspector.KeyboardShortcut._keyName = function(key)
+{
+if (typeof key === "string")
+return key.toUpperCase();
+if (typeof key.name === "string")
+return key.name;
+return key.name[WebInspector.platform] || key.name.other;
+}
+
 WebInspector.KeyboardShortcut._makeKeyFromCodeAndModifiers = function(keyCode, modifiers)
 {
-    return (keyCode & 255) | (modifiers << 8);
+return (keyCode & 255) | (modifiers << 8);
 };
 
-/* TextPrompt.js */
+WebInspector.KeyboardShortcut._modifiersToString = function(modifiers)
+{
+const cmdKey = "\u2318";
+const optKey = "\u2325";
+const shiftKey = "\u21e7";
+const ctrlKey = "\u2303";
 
-/*
- * Copyright (C) 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+var isMac = WebInspector.isMac();
+var res = "";
+if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Ctrl)
+res += isMac ? ctrlKey : "<Ctrl> + ";
+if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Alt)
+res += isMac ? optKey : "<Alt> + ";
+if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Shift)
+res += isMac ? shiftKey : "<Shift> + ";
+if (modifiers & WebInspector.KeyboardShortcut.Modifiers.Meta)
+res += isMac ? cmdKey : "<Win> + ";
+
+return res;
+};
+
+
+
+
 
 WebInspector.TextPrompt = function(element, completions, stopCharacters)
 {
-    this.element = element;
-    this.completions = completions;
-    this.completionStopCharacters = stopCharacters;
-    this.history = [];
-    this.historyOffset = 0;
-    this.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
+this.element = element;
+this.element.addStyleClass("text-prompt");
+this.completions = completions;
+this.completionStopCharacters = stopCharacters;
+this.history = [];
+this.historyOffset = 0;
+this.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
 }
 
 WebInspector.TextPrompt.prototype = {
-    get text()
-    {
-        return this.element.textContent;
-    },
+get text()
+{
+return this.element.textContent;
+},
 
-    set text(x)
-    {
-        if (!x) {
-            // Append a break element instead of setting textContent to make sure the selection is inside the prompt.
-            this.element.removeChildren();
-            this.element.appendChild(document.createElement("br"));
-        } else
-            this.element.textContent = x;
+set text(x)
+{
+if (!x) {
 
-        this.moveCaretToEndOfPrompt();
-    },
+this.element.removeChildren();
+this.element.appendChild(document.createElement("br"));
+} else
+this.element.textContent = x;
 
-    _onKeyDown: function(event)
-    {
-        function defaultAction()
-        {
-            this.clearAutoComplete();
-            this.autoCompleteSoon();
-        }
+this.moveCaretToEndOfPrompt();
+},
 
-        var handled = false;
-        switch (event.keyIdentifier) {
-            case "Up":
-                this._upKeyPressed(event);
-                break;
-            case "Down":
-                this._downKeyPressed(event);
-                break;
-            case "U+0009": // Tab
-                this._tabKeyPressed(event);
-                break;
-            case "Right":
-            case "End":
-                if (!this.acceptAutoComplete())
-                    this.autoCompleteSoon();
-                break;
-            case "Alt":
-            case "Meta":
-            case "Shift":
-            case "Control":
-                break;
-            case "U+0050": // Ctrl+P = Previous
-                if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
-                    handled = true;
-                    this._moveBackInHistory();
-                    break;
-                }
-                defaultAction.call(this);
-                break;
-            case "U+004E": // Ctrl+N = Next
-                if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
-                    handled = true;
-                    this._moveForwardInHistory();
-                    break;
-                }
-                defaultAction.call(this);
-                break;
-            default:
-                defaultAction.call(this);
-                break;
-        }
-
-        if (handled) {
-            event.preventDefault();
-            event.stopPropagation();
-        }
-    },
-
-    acceptAutoComplete: function()
-    {
-        if (!this.autoCompleteElement || !this.autoCompleteElement.parentNode)
-            return false;
-
-        var text = this.autoCompleteElement.textContent;
-        var textNode = document.createTextNode(text);
-        this.autoCompleteElement.parentNode.replaceChild(textNode, this.autoCompleteElement);
-        delete this.autoCompleteElement;
-
-        var finalSelectionRange = document.createRange();
-        finalSelectionRange.setStart(textNode, text.length);
-        finalSelectionRange.setEnd(textNode, text.length);
-
-        var selection = window.getSelection();
-        selection.removeAllRanges();
-        selection.addRange(finalSelectionRange);
-
-        return true;
-    },
-
-    clearAutoComplete: function(includeTimeout)
-    {
-        if (includeTimeout && "_completeTimeout" in this) {
-            clearTimeout(this._completeTimeout);
-            delete this._completeTimeout;
-        }
-
-        if (!this.autoCompleteElement)
-            return;
-
-        if (this.autoCompleteElement.parentNode)
-            this.autoCompleteElement.parentNode.removeChild(this.autoCompleteElement);
-        delete this.autoCompleteElement;
-
-        if (!this._userEnteredRange || !this._userEnteredText)
-            return;
-
-        this._userEnteredRange.deleteContents();
-
-        var userTextNode = document.createTextNode(this._userEnteredText);
-        this._userEnteredRange.insertNode(userTextNode);
-
-        var selectionRange = document.createRange();
-        selectionRange.setStart(userTextNode, this._userEnteredText.length);
-        selectionRange.setEnd(userTextNode, this._userEnteredText.length);
-
-        var selection = window.getSelection();
-        selection.removeAllRanges();
-        selection.addRange(selectionRange);
-
-        delete this._userEnteredRange;
-        delete this._userEnteredText;
-    },
-
-    autoCompleteSoon: function()
-    {
-        if (!("_completeTimeout" in this))
-            this._completeTimeout = setTimeout(this.complete.bind(this, true), 250);
-    },
-
-    complete: function(auto)
-    {
-        this.clearAutoComplete(true);
-        var selection = window.getSelection();
-        if (!selection.rangeCount)
-            return;
-
-        var selectionRange = selection.getRangeAt(0);
-        if (!selectionRange.commonAncestorContainer.isDescendant(this.element))
-            return;
-        if (auto && !this.isCaretAtEndOfPrompt())
-            return;
-        var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this.completionStopCharacters, this.element, "backward");
-        this.completions(wordPrefixRange, auto, this._completionsReady.bind(this, selection, auto, wordPrefixRange));
-    },
-
-    _completionsReady: function(selection, auto, originalWordPrefixRange, completions)
-    {
-        if (!completions || !completions.length)
-            return;
-
-        var selectionRange = selection.getRangeAt(0);
-
-        var fullWordRange = document.createRange();
-        fullWordRange.setStart(originalWordPrefixRange.startContainer, originalWordPrefixRange.startOffset);
-        fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset);
-
-        if (originalWordPrefixRange.toString() + selectionRange.toString() != fullWordRange.toString())
-            return;
-
-        if (completions.length === 1 || selection.isCollapsed || auto) {
-            var completionText = completions[0];
-        } else {
-            var currentText = fullWordRange.toString();
-
-            var foundIndex = null;
-            for (var i = 0; i < completions.length; ++i)
-                if (completions[i] === currentText)
-                    foundIndex = i;
-
-            if (foundIndex === null || (foundIndex + 1) >= completions.length)
-                var completionText = completions[0];
-            else
-                var completionText = completions[foundIndex + 1];
-        }
-
-        var wordPrefixLength = originalWordPrefixRange.toString().length;
-
-        this._userEnteredRange = fullWordRange;
-        this._userEnteredText = fullWordRange.toString();
-
-        fullWordRange.deleteContents();
-
-        var finalSelectionRange = document.createRange();
-
-        if (auto) {
-            var prefixText = completionText.substring(0, wordPrefixLength);
-            var suffixText = completionText.substring(wordPrefixLength);
-
-            var prefixTextNode = document.createTextNode(prefixText);
-            fullWordRange.insertNode(prefixTextNode);
-
-            this.autoCompleteElement = document.createElement("span");
-            this.autoCompleteElement.className = "auto-complete-text";
-            this.autoCompleteElement.textContent = suffixText;
-
-            prefixTextNode.parentNode.insertBefore(this.autoCompleteElement, prefixTextNode.nextSibling);
-
-            finalSelectionRange.setStart(prefixTextNode, wordPrefixLength);
-            finalSelectionRange.setEnd(prefixTextNode, wordPrefixLength);
-        } else {
-            var completionTextNode = document.createTextNode(completionText);
-            fullWordRange.insertNode(completionTextNode);
-
-            if (completions.length > 1)
-                finalSelectionRange.setStart(completionTextNode, wordPrefixLength);
-            else
-                finalSelectionRange.setStart(completionTextNode, completionText.length);
-
-            finalSelectionRange.setEnd(completionTextNode, completionText.length);
-        }
-
-        selection.removeAllRanges();
-        selection.addRange(finalSelectionRange);
-    },
-
-    isCaretInsidePrompt: function()
-    {
-        return this.element.isInsertionCaretInside();
-    },
-
-    isCaretAtEndOfPrompt: function()
-    {
-        var selection = window.getSelection();
-        if (!selection.rangeCount || !selection.isCollapsed)
-            return false;
-
-        var selectionRange = selection.getRangeAt(0);
-        var node = selectionRange.startContainer;
-        if (node !== this.element && !node.isDescendant(this.element))
-            return false;
-
-        if (node.nodeType === Node.TEXT_NODE && selectionRange.startOffset < node.nodeValue.length)
-            return false;
-
-        var foundNextText = false;
-        while (node) {
-            if (node.nodeType === Node.TEXT_NODE && node.nodeValue.length) {
-                if (foundNextText)
-                    return false;
-                foundNextText = true;
-            }
-
-            node = node.traverseNextNode(this.element);
-        }
-
-        return true;
-    },
-
-    isCaretOnFirstLine: function()
-    {
-        var selection = window.getSelection();
-        var focusNode = selection.focusNode;
-        if (!focusNode || focusNode.nodeType !== Node.TEXT_NODE || focusNode.parentNode !== this.element)
-            return true;
-
-        if (focusNode.textContent.substring(0, selection.focusOffset).indexOf("\n") !== -1)
-            return false;
-        focusNode = focusNode.previousSibling;
-
-        while (focusNode) {
-            if (focusNode.nodeType !== Node.TEXT_NODE)
-                return true;
-            if (focusNode.textContent.indexOf("\n") !== -1)
-                return false;
-            focusNode = focusNode.previousSibling;
-        }
-
-        return true;
-    },
-
-    isCaretOnLastLine: function()
-    {
-        var selection = window.getSelection();
-        var focusNode = selection.focusNode;
-        if (!focusNode || focusNode.nodeType !== Node.TEXT_NODE || focusNode.parentNode !== this.element)
-            return true;
-
-        if (focusNode.textContent.substring(selection.focusOffset).indexOf("\n") !== -1)
-            return false;
-        focusNode = focusNode.nextSibling;
-
-        while (focusNode) {
-            if (focusNode.nodeType !== Node.TEXT_NODE)
-                return true;
-            if (focusNode.textContent.indexOf("\n") !== -1)
-                return false;
-            focusNode = focusNode.nextSibling;
-        }
-
-        return true;
-    },
-
-    moveCaretToEndOfPrompt: function()
-    {
-        var selection = window.getSelection();
-        var selectionRange = document.createRange();
-
-        var offset = this.element.childNodes.length;
-        selectionRange.setStart(this.element, offset);
-        selectionRange.setEnd(this.element, offset);
-
-        selection.removeAllRanges();
-        selection.addRange(selectionRange);
-    },
-
-    _tabKeyPressed: function(event)
-    {
-        event.preventDefault();
-        event.stopPropagation();
-
-        this.complete();
-    },
-
-    _upKeyPressed: function(event)
-    {
-        if (!this.isCaretOnFirstLine())
-            return;
-
-        event.preventDefault();
-        event.stopPropagation();
-
-        this._moveBackInHistory();
-    },
-
-    _downKeyPressed: function(event)
-    {
-        if (!this.isCaretOnLastLine())
-            return;
-
-        event.preventDefault();
-        event.stopPropagation();
-
-        this._moveForwardInHistory();
-    },
-
-    _moveBackInHistory: function()
-    {
-        if (this.historyOffset == this.history.length)
-            return;
-
-        this.clearAutoComplete(true);
-
-        if (this.historyOffset === 0)
-            this.tempSavedCommand = this.text;
-
-        ++this.historyOffset;
-        this.text = this.history[this.history.length - this.historyOffset];
-
-        this.element.scrollIntoViewIfNeeded();
-        var firstNewlineIndex = this.text.indexOf("\n");
-        if (firstNewlineIndex === -1)
-            this.moveCaretToEndOfPrompt();
-        else {
-            var selection = window.getSelection();
-            var selectionRange = document.createRange();
-
-            selectionRange.setStart(this.element.firstChild, firstNewlineIndex);
-            selectionRange.setEnd(this.element.firstChild, firstNewlineIndex);
-
-            selection.removeAllRanges();
-            selection.addRange(selectionRange);
-        }
-    },
-
-    _moveForwardInHistory: function()
-    {
-        if (this.historyOffset === 0)
-            return;
-
-        this.clearAutoComplete(true);
-
-        --this.historyOffset;
-
-        if (this.historyOffset === 0) {
-            this.text = this.tempSavedCommand;
-            delete this.tempSavedCommand;
-            return;
-        }
-
-        this.text = this.history[this.history.length - this.historyOffset];
-        this.element.scrollIntoViewIfNeeded();
-    }
+_onKeyDown: function(event)
+{
+function defaultAction()
+{
+this.clearAutoComplete();
+this.autoCompleteSoon();
 }
 
-/* Popover.js */
+var handled = false;
+switch (event.keyIdentifier) {
+case "Up":
+this._upKeyPressed(event);
+break;
+case "Down":
+this._downKeyPressed(event);
+break;
+case "U+0009": 
+this._tabKeyPressed(event);
+break;
+case "Right":
+case "End":
+if (!this.acceptAutoComplete())
+this.autoCompleteSoon();
+break;
+case "Alt":
+case "Meta":
+case "Shift":
+case "Control":
+break;
+case "U+0050": 
+if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
+handled = true;
+this._moveBackInHistory();
+break;
+}
+defaultAction.call(this);
+break;
+case "U+004E": 
+if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
+handled = true;
+this._moveForwardInHistory();
+break;
+}
+defaultAction.call(this);
+break;
+default:
+defaultAction.call(this);
+break;
+}
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+if (handled) {
+event.preventDefault();
+event.stopPropagation();
+}
+},
+
+acceptAutoComplete: function()
+{
+if (!this.autoCompleteElement || !this.autoCompleteElement.parentNode)
+return false;
+
+var text = this.autoCompleteElement.textContent;
+var textNode = document.createTextNode(text);
+this.autoCompleteElement.parentNode.replaceChild(textNode, this.autoCompleteElement);
+delete this.autoCompleteElement;
+
+var finalSelectionRange = document.createRange();
+finalSelectionRange.setStart(textNode, text.length);
+finalSelectionRange.setEnd(textNode, text.length);
+
+var selection = window.getSelection();
+selection.removeAllRanges();
+selection.addRange(finalSelectionRange);
+
+return true;
+},
+
+clearAutoComplete: function(includeTimeout)
+{
+if (includeTimeout && "_completeTimeout" in this) {
+clearTimeout(this._completeTimeout);
+delete this._completeTimeout;
+}
+
+if (!this.autoCompleteElement)
+return;
+
+if (this.autoCompleteElement.parentNode)
+this.autoCompleteElement.parentNode.removeChild(this.autoCompleteElement);
+delete this.autoCompleteElement;
+
+if (!this._userEnteredRange || !this._userEnteredText)
+return;
+
+this._userEnteredRange.deleteContents();
+this.element.pruneEmptyTextNodes();
+
+var userTextNode = document.createTextNode(this._userEnteredText);
+this._userEnteredRange.insertNode(userTextNode);
+
+var selectionRange = document.createRange();
+selectionRange.setStart(userTextNode, this._userEnteredText.length);
+selectionRange.setEnd(userTextNode, this._userEnteredText.length);
+
+var selection = window.getSelection();
+selection.removeAllRanges();
+selection.addRange(selectionRange);
+
+delete this._userEnteredRange;
+delete this._userEnteredText;
+},
+
+autoCompleteSoon: function()
+{
+if (!("_completeTimeout" in this))
+this._completeTimeout = setTimeout(this.complete.bind(this, true), 250);
+},
+
+complete: function(auto, reverse)
+{
+this.clearAutoComplete(true);
+var selection = window.getSelection();
+if (!selection.rangeCount)
+return;
+
+var selectionRange = selection.getRangeAt(0);
+if (!selectionRange.commonAncestorContainer.isDescendant(this.element))
+return;
+if (auto && !this.isCaretAtEndOfPrompt())
+return;
+var wordPrefixRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, this.completionStopCharacters, this.element, "backward");
+this.completions(wordPrefixRange, auto, this._completionsReady.bind(this, selection, auto, wordPrefixRange, reverse));
+},
+
+_completionsReady: function(selection, auto, originalWordPrefixRange, reverse, completions)
+{
+if (!completions || !completions.length)
+return;
+
+var selectionRange = selection.getRangeAt(0);
+
+var fullWordRange = document.createRange();
+fullWordRange.setStart(originalWordPrefixRange.startContainer, originalWordPrefixRange.startOffset);
+fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset);
+
+if (originalWordPrefixRange.toString() + selectionRange.toString() != fullWordRange.toString())
+return;
+
+var wordPrefixLength = originalWordPrefixRange.toString().length;
+
+if (auto)
+var completionText = completions[0];
+else {
+if (completions.length === 1) {
+var completionText = completions[0];
+wordPrefixLength = completionText.length;
+} else {
+var commonPrefix = completions[0];
+for (var i = 0; i < completions.length; ++i) {
+var completion = completions[i];
+var lastIndex = Math.min(commonPrefix.length, completion.length);
+for (var j = wordPrefixLength; j < lastIndex; ++j) {
+if (commonPrefix[j] !== completion[j]) {
+commonPrefix = commonPrefix.substr(0, j);
+break;
+}
+}
+}
+wordPrefixLength = commonPrefix.length;
+
+if (selection.isCollapsed)
+var completionText = completions[0];
+else {
+var currentText = fullWordRange.toString();
+
+var foundIndex = null;
+for (var i = 0; i < completions.length; ++i) {
+if (completions[i] === currentText)
+foundIndex = i;
+}
+
+var nextIndex = foundIndex + (reverse ? -1 : 1);
+if (foundIndex === null || nextIndex >= completions.length)
+var completionText = completions[0];
+else if (nextIndex < 0)
+var completionText = completions[completions.length - 1];
+else
+var completionText = completions[nextIndex];
+}
+}
+}
+
+this._userEnteredRange = fullWordRange;
+this._userEnteredText = fullWordRange.toString();
+
+fullWordRange.deleteContents();
+this.element.pruneEmptyTextNodes();
+
+var finalSelectionRange = document.createRange();
+
+if (auto) {
+var prefixText = completionText.substring(0, wordPrefixLength);
+var suffixText = completionText.substring(wordPrefixLength);
+
+var prefixTextNode = document.createTextNode(prefixText);
+fullWordRange.insertNode(prefixTextNode);
+
+this.autoCompleteElement = document.createElement("span");
+this.autoCompleteElement.className = "auto-complete-text";
+this.autoCompleteElement.textContent = suffixText;
+
+prefixTextNode.parentNode.insertBefore(this.autoCompleteElement, prefixTextNode.nextSibling);
+
+finalSelectionRange.setStart(prefixTextNode, wordPrefixLength);
+finalSelectionRange.setEnd(prefixTextNode, wordPrefixLength);
+} else {
+var completionTextNode = document.createTextNode(completionText);
+fullWordRange.insertNode(completionTextNode);
+
+if (completions.length > 1)
+finalSelectionRange.setStart(completionTextNode, wordPrefixLength);
+else
+finalSelectionRange.setStart(completionTextNode, completionText.length);
+
+finalSelectionRange.setEnd(completionTextNode, completionText.length);
+}
+
+selection.removeAllRanges();
+selection.addRange(finalSelectionRange);
+},
+
+isCaretInsidePrompt: function()
+{
+return this.element.isInsertionCaretInside();
+},
+
+isCaretAtEndOfPrompt: function()
+{
+var selection = window.getSelection();
+if (!selection.rangeCount || !selection.isCollapsed)
+return false;
+
+var selectionRange = selection.getRangeAt(0);
+var node = selectionRange.startContainer;
+if (node !== this.element && !node.isDescendant(this.element))
+return false;
+
+if (node.nodeType === Node.TEXT_NODE && selectionRange.startOffset < node.nodeValue.length)
+return false;
+
+var foundNextText = false;
+while (node) {
+if (node.nodeType === Node.TEXT_NODE && node.nodeValue.length) {
+if (foundNextText)
+return false;
+foundNextText = true;
+}
+
+node = node.traverseNextNode(this.element);
+}
+
+return true;
+},
+
+isCaretOnFirstLine: function()
+{
+var selection = window.getSelection();
+var focusNode = selection.focusNode;
+if (!focusNode || focusNode.nodeType !== Node.TEXT_NODE || focusNode.parentNode !== this.element)
+return true;
+
+if (focusNode.textContent.substring(0, selection.focusOffset).indexOf("\n") !== -1)
+return false;
+focusNode = focusNode.previousSibling;
+
+while (focusNode) {
+if (focusNode.nodeType !== Node.TEXT_NODE)
+return true;
+if (focusNode.textContent.indexOf("\n") !== -1)
+return false;
+focusNode = focusNode.previousSibling;
+}
+
+return true;
+},
+
+isCaretOnLastLine: function()
+{
+var selection = window.getSelection();
+var focusNode = selection.focusNode;
+if (!focusNode || focusNode.nodeType !== Node.TEXT_NODE || focusNode.parentNode !== this.element)
+return true;
+
+if (focusNode.textContent.substring(selection.focusOffset).indexOf("\n") !== -1)
+return false;
+focusNode = focusNode.nextSibling;
+
+while (focusNode) {
+if (focusNode.nodeType !== Node.TEXT_NODE)
+return true;
+if (focusNode.textContent.indexOf("\n") !== -1)
+return false;
+focusNode = focusNode.nextSibling;
+}
+
+return true;
+},
+
+moveCaretToEndOfPrompt: function()
+{
+var selection = window.getSelection();
+var selectionRange = document.createRange();
+
+var offset = this.element.childNodes.length;
+selectionRange.setStart(this.element, offset);
+selectionRange.setEnd(this.element, offset);
+
+selection.removeAllRanges();
+selection.addRange(selectionRange);
+},
+
+_tabKeyPressed: function(event)
+{
+event.preventDefault();
+event.stopPropagation();
+
+this.complete(false, event.shiftKey);
+},
+
+_upKeyPressed: function(event)
+{
+if (!this.isCaretOnFirstLine())
+return;
+
+event.preventDefault();
+event.stopPropagation();
+
+this._moveBackInHistory();
+},
+
+_downKeyPressed: function(event)
+{
+if (!this.isCaretOnLastLine())
+return;
+
+event.preventDefault();
+event.stopPropagation();
+
+this._moveForwardInHistory();
+},
+
+_moveBackInHistory: function()
+{
+if (this.historyOffset == this.history.length)
+return;
+
+this.clearAutoComplete(true);
+
+if (this.historyOffset === 0)
+this.tempSavedCommand = this.text;
+
+++this.historyOffset;
+this.text = this.history[this.history.length - this.historyOffset];
+
+this.element.scrollIntoViewIfNeeded();
+var firstNewlineIndex = this.text.indexOf("\n");
+if (firstNewlineIndex === -1)
+this.moveCaretToEndOfPrompt();
+else {
+var selection = window.getSelection();
+var selectionRange = document.createRange();
+
+selectionRange.setStart(this.element.firstChild, firstNewlineIndex);
+selectionRange.setEnd(this.element.firstChild, firstNewlineIndex);
+
+selection.removeAllRanges();
+selection.addRange(selectionRange);
+}
+},
+
+_moveForwardInHistory: function()
+{
+if (this.historyOffset === 0)
+return;
+
+this.clearAutoComplete(true);
+
+--this.historyOffset;
+
+if (this.historyOffset === 0) {
+this.text = this.tempSavedCommand;
+delete this.tempSavedCommand;
+return;
+}
+
+this.text = this.history[this.history.length - this.historyOffset];
+this.element.scrollIntoViewIfNeeded();
+}
+}
+
+
+
+
 
 WebInspector.Popover = function(contentElement)
 {
-    this.element = document.createElement("div");
-    this.element.className = "popover";
+this.element = document.createElement("div");
+this.element.className = "popover";
 
-    this._popupArrowElement = document.createElement("div");
-    this._popupArrowElement.className = "arrow";
-    this.element.appendChild(this._popupArrowElement);
+this._popupArrowElement = document.createElement("div");
+this._popupArrowElement.className = "arrow";
+this.element.appendChild(this._popupArrowElement);
 
-    this.contentElement = contentElement;
-    this._contentDiv = document.createElement("div");
-    this._contentDiv.className = "content";
+this.contentElement = contentElement;
+this._contentDiv = document.createElement("div");
+this._contentDiv.className = "content";
 }
 
 WebInspector.Popover.prototype = {
-    show: function(anchor, preferredWidth, preferredHeight)
-    {
-        // This should not happen, but we hide previous popup to be on the safe side.
-        if (WebInspector.Popover._popoverElement)
-            document.body.removeChild(WebInspector.Popover._popoverElement);
-        WebInspector.Popover._popoverElement = this.element;
+show: function(anchor, preferredWidth, preferredHeight)
+{
 
-        // Temporarily attach in order to measure preferred dimensions.
-        this.contentElement.positionAt(0, 0);
-        document.body.appendChild(this.contentElement);
-        var preferredWidth = preferredWidth || this.contentElement.offsetWidth;
-        var preferredHeight = preferredHeight || this.contentElement.offsetHeight;
+if (WebInspector.Popover._popoverElement)
+document.body.removeChild(WebInspector.Popover._popoverElement);
+WebInspector.Popover._popoverElement = this.element;
 
-        this._contentDiv.appendChild(this.contentElement);
-        this.element.appendChild(this._contentDiv);
-        document.body.appendChild(this.element);
-        this._positionElement(anchor, preferredWidth, preferredHeight);
-    },
 
-    hide: function()
-    {
-        if (WebInspector.Popover._popoverElement) {
-            delete WebInspector.Popover._popoverElement;
-            document.body.removeChild(this.element);
-        }
-    },
+this.contentElement.positionAt(0, 0);
+document.body.appendChild(this.contentElement);
+var preferredWidth = preferredWidth || this.contentElement.offsetWidth;
+var preferredHeight = preferredHeight || this.contentElement.offsetHeight;
 
-    _positionElement: function(anchorElement, preferredWidth, preferredHeight)
-    {
-        const borderWidth = 25;
-        const scrollerWidth = 11;
-        const arrowHeight = 15;
-        const arrowOffset = 10;
-        const borderRadius = 10;
+this._contentDiv.appendChild(this.contentElement);
+this.element.appendChild(this._contentDiv);
+document.body.appendChild(this.element);
+this._positionElement(anchor, preferredWidth, preferredHeight);
+},
 
-        // Skinny tooltips are not pretty, their arrow location is not nice.
-        preferredWidth = Math.max(preferredWidth, 50);
-        const totalWidth = window.innerWidth;
-        const totalHeight = window.innerHeight;
+hide: function()
+{
+if (WebInspector.Popover._popoverElement) {
+delete WebInspector.Popover._popoverElement;
+document.body.removeChild(this.element);
+}
+},
 
-        var anchorBox = {x: anchorElement.totalOffsetLeft, y: anchorElement.totalOffsetTop, width: anchorElement.offsetWidth, height: anchorElement.offsetHeight};
-        while (anchorElement !== document.body) {
-            if (anchorElement.scrollLeft)
-                anchorBox.x -= anchorElement.scrollLeft;
-            if (anchorElement.scrollTop)
-                anchorBox.y -= anchorElement.scrollTop;
-            anchorElement = anchorElement.parentElement;
-        }
+_positionElement: function(anchorElement, preferredWidth, preferredHeight)
+{
+const borderWidth = 25;
+const scrollerWidth = 11;
+const arrowHeight = 15;
+const arrowOffset = 10;
+const borderRadius = 10;
 
-        var newElementPosition = { x: 0, y: 0, width: preferredWidth + scrollerWidth, height: preferredHeight };
 
-        var verticalAlignment;
-        var roomAbove = anchorBox.y;
-        var roomBelow = totalHeight - anchorBox.y - anchorBox.height;
+preferredWidth = Math.max(preferredWidth, 50);
+const totalWidth = window.innerWidth;
+const totalHeight = window.innerHeight;
 
-        if (roomAbove > roomBelow) {
-            // Positioning above the anchor.
-            if (anchorBox.y > newElementPosition.height + arrowHeight + borderRadius)
-                newElementPosition.y = anchorBox.y - newElementPosition.height - arrowHeight;
-            else {
-                newElementPosition.y = borderRadius * 2;
-                newElementPosition.height = anchorBox.y - borderRadius * 2 - arrowHeight;
-            }
-            verticalAlignment = "bottom";
-        } else {
-            // Positioning below the anchor.
-            newElementPosition.y = anchorBox.y + anchorBox.height + arrowHeight;
-            if (newElementPosition.y + newElementPosition.height + arrowHeight - borderWidth >= totalHeight)
-                newElementPosition.height = totalHeight - anchorBox.y - anchorBox.height - borderRadius * 2 - arrowHeight;
-            // Align arrow.
-            verticalAlignment = "top";
-        }
+var anchorBox = {x: anchorElement.totalOffsetLeft, y: anchorElement.totalOffsetTop, width: anchorElement.offsetWidth, height: anchorElement.offsetHeight};
+while (anchorElement !== document.body) {
+if (anchorElement.scrollLeft)
+anchorBox.x -= anchorElement.scrollLeft;
+if (anchorElement.scrollTop)
+anchorBox.y -= anchorElement.scrollTop;
+anchorElement = anchorElement.parentElement;
+}
 
-        var horizontalAlignment;
-        if (anchorBox.x + newElementPosition.width < totalWidth) {
-            newElementPosition.x = Math.max(borderRadius, anchorBox.x - borderRadius - arrowOffset);
-            horizontalAlignment = "left";
-        } else if (newElementPosition.width + borderRadius * 2 < totalWidth) {
-            newElementPosition.x = totalWidth - newElementPosition.width - borderRadius;
-            horizontalAlignment = "right";
-            // Position arrow accurately.
-            var arrowRightPosition = Math.max(0, totalWidth - anchorBox.x - anchorBox.width - borderRadius - arrowOffset);
-            arrowRightPosition += anchorBox.width / 2;
-            this._popupArrowElement.style.right = arrowRightPosition + "px";
-        } else {
-            newElementPosition.x = borderRadius;
-            newElementPosition.width = totalWidth - borderRadius * 2;
-            newElementPosition.height += scrollerWidth;
-            horizontalAlignment = "left";
-            if (verticalAlignment === "bottom")
-                newElementPosition.y -= scrollerWidth;
-            // Position arrow accurately.
-            this._popupArrowElement.style.left = Math.max(0, anchorBox.x - borderRadius * 2 - arrowOffset) + "px";
-            this._popupArrowElement.style.left += anchorBox.width / 2;
-        }
+var newElementPosition = { x: 0, y: 0, width: preferredWidth + scrollerWidth, height: preferredHeight };
 
-        this.element.className = "popover " + verticalAlignment + "-" + horizontalAlignment + "-arrow";
-        this.element.positionAt(newElementPosition.x - borderWidth, newElementPosition.y - borderWidth);
-        this.element.style.width = newElementPosition.width + borderWidth * 2 + "px";
-        this.element.style.height = newElementPosition.height + borderWidth * 2 + "px";
-    }
+var verticalAlignment;
+var roomAbove = anchorBox.y;
+var roomBelow = totalHeight - anchorBox.y - anchorBox.height;
+
+if (roomAbove > roomBelow) {
+
+if (anchorBox.y > newElementPosition.height + arrowHeight + borderRadius)
+newElementPosition.y = anchorBox.y - newElementPosition.height - arrowHeight;
+else {
+newElementPosition.y = borderRadius * 2;
+newElementPosition.height = anchorBox.y - borderRadius * 2 - arrowHeight;
+}
+verticalAlignment = "bottom";
+} else {
+
+newElementPosition.y = anchorBox.y + anchorBox.height + arrowHeight;
+if (newElementPosition.y + newElementPosition.height + arrowHeight - borderWidth >= totalHeight)
+newElementPosition.height = totalHeight - anchorBox.y - anchorBox.height - borderRadius * 2 - arrowHeight;
+
+verticalAlignment = "top";
+}
+
+var horizontalAlignment;
+if (anchorBox.x + newElementPosition.width < totalWidth) {
+newElementPosition.x = Math.max(borderRadius, anchorBox.x - borderRadius - arrowOffset);
+horizontalAlignment = "left";
+} else if (newElementPosition.width + borderRadius * 2 < totalWidth) {
+newElementPosition.x = totalWidth - newElementPosition.width - borderRadius;
+horizontalAlignment = "right";
+
+var arrowRightPosition = Math.max(0, totalWidth - anchorBox.x - anchorBox.width - borderRadius - arrowOffset);
+arrowRightPosition += anchorBox.width / 2;
+this._popupArrowElement.style.right = arrowRightPosition + "px";
+} else {
+newElementPosition.x = borderRadius;
+newElementPosition.width = totalWidth - borderRadius * 2;
+newElementPosition.height += scrollerWidth;
+horizontalAlignment = "left";
+if (verticalAlignment === "bottom")
+newElementPosition.y -= scrollerWidth;
+
+this._popupArrowElement.style.left = Math.max(0, anchorBox.x - borderRadius * 2 - arrowOffset) + "px";
+this._popupArrowElement.style.left += anchorBox.width / 2;
+}
+
+this.element.className = "popover " + verticalAlignment + "-" + horizontalAlignment + "-arrow";
+this.element.positionAt(newElementPosition.x - borderWidth, newElementPosition.y - borderWidth);
+this.element.style.width = newElementPosition.width + borderWidth * 2 + "px";
+this.element.style.height = newElementPosition.height + borderWidth * 2 + "px";
+}
 }
 
 WebInspector.PopoverHelper = function(panelElement, getAnchor, showPopup, showOnClick, onHide)
 {
-    this._panelElement = panelElement;
-    this._getAnchor = getAnchor;
-    this._showPopup = showPopup;
-    this._showOnClick = showOnClick;
-    this._onHide = onHide;
-    panelElement.addEventListener("mousedown", this._mouseDown.bind(this), false);
-    panelElement.addEventListener("mousemove", this._mouseMove.bind(this), false);
+this._panelElement = panelElement;
+this._getAnchor = getAnchor;
+this._showPopup = showPopup;
+this._showOnClick = showOnClick;
+this._onHide = onHide;
+panelElement.addEventListener("mousedown", this._mouseDown.bind(this), false);
+panelElement.addEventListener("mousemove", this._mouseMove.bind(this), false);
+this.setTimeout(1000);
 }
 
 WebInspector.PopoverHelper.prototype = {
-    _mouseDown: function(event)
-    {
-        this._killHidePopupTimer();
-        this._handleMouseAction(event, true);
-    },
+setTimeout: function(timeout)
+{
+this._timeout = timeout;
+},
 
-    _mouseMove: function(event)
-    {
-        // Pretend that nothing has happened.
-        if (this._hoverElement === event.target || (this._hoverElement && this._hoverElement.isAncestor(event.target)))
-            return;
+_mouseDown: function(event)
+{
+this._killHidePopupTimer();
+this._handleMouseAction(event, true);
+},
 
-        // User has 500ms to reach the popup.
-        if (this._popup && !this._hidePopupTimer) {
-            var self = this;
-            function doHide()
-            {
-                self.hidePopup();
-                delete self._hidePopupTimer;
-            }
-            this._hidePopupTimer = setTimeout(doHide, 500);
-        }
+_mouseMove: function(event)
+{
 
-        this._handleMouseAction(event);
-    },
+if (this._hoverElement === event.target || (this._hoverElement && this._hoverElement.isAncestor(event.target)))
+return;
 
-    _handleMouseAction: function(event, isMouseDown)
-    {
-        this._resetHoverTimer();
 
-        this._hoverElement = this._getAnchor(event.target);
-        if (!this._hoverElement)
-            return;
-
-        const toolTipDelay = isMouseDown ? 0 : (this._popup ? 600 : 1000);
-        this._hoverTimer = setTimeout(this._mouseHover.bind(this, this._hoverElement), toolTipDelay);
-    },
-
-    _resetHoverTimer: function()
-    {
-        if (this._hoverTimer) {
-            clearTimeout(this._hoverTimer);
-            delete this._hoverTimer;
-        }
-    },
-
-    hidePopup: function()
-    {
-        if (!this._popup)
-            return;
-
-        if (this._onHide)
-            this._onHide();
-
-        this._popup.hide();
-        delete this._popup;
-    },
-
-    _mouseHover: function(element)
-    {
-        delete this._hoverTimer;
-
-        this._popup = this._showPopup(element);
-        this._popup.contentElement.addEventListener("mousemove", this._killHidePopupTimer.bind(this), true);
-    },
-
-    _killHidePopupTimer: function()
-    {
-        if (this._hidePopupTimer) {
-            clearTimeout(this._hidePopupTimer);
-            delete this._hidePopupTimer;
-
-            // We know that we reached the popup, but we might have moved over other elements.
-            // Discard pending command.
-            this._resetHoverTimer();
-        }
-    }
+if (this._popup && !this._hidePopupTimer) {
+var self = this;
+function doHide()
+{
+self._hidePopup();
+delete self._hidePopupTimer;
+}
+this._hidePopupTimer = setTimeout(doHide, this._timeout / 2);
 }
 
-/* Placard.js */
+this._handleMouseAction(event);
+},
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+_handleMouseAction: function(event, isMouseDown)
+{
+this._resetHoverTimer();
+
+this._hoverElement = this._getAnchor(event.target);
+if (!this._hoverElement)
+return;
+
+const toolTipDelay = isMouseDown ? 0 : (this._popup ? this._timeout * 0.6 : this._timeout);
+this._hoverTimer = setTimeout(this._mouseHover.bind(this, this._hoverElement), toolTipDelay);
+},
+
+_resetHoverTimer: function()
+{
+if (this._hoverTimer) {
+clearTimeout(this._hoverTimer);
+delete this._hoverTimer;
+}
+},
+
+hidePopup: function()
+{
+this._resetHoverTimer();
+this._hidePopup();
+},
+
+_hidePopup: function()
+{
+if (!this._popup)
+return;
+
+if (this._onHide)
+this._onHide();
+
+this._popup.hide();
+delete this._popup;
+},
+
+_mouseHover: function(element)
+{
+delete this._hoverTimer;
+
+this._popup = this._showPopup(element);
+if (this._popup)
+this._popup.contentElement.addEventListener("mousemove", this._killHidePopupTimer.bind(this), true);
+},
+
+_killHidePopupTimer: function()
+{
+if (this._hidePopupTimer) {
+clearTimeout(this._hidePopupTimer);
+delete this._hidePopupTimer;
+
+
+
+this._resetHoverTimer();
+}
+}
+}
+
+
+
+
+
+WebInspector.TabbedPane = function(element)
+{
+this.element = element || document.createElement("div");
+this.element.addStyleClass("tabbed-pane");
+this._tabsElement = this.element.createChild("div", "tabbed-pane-header");
+this._contentElement = this.element.createChild("div", "tabbed-pane-content");
+this._tabs = {};
+}
+
+WebInspector.TabbedPane.prototype = {
+appendTab: function(id, tabTitle, view)
+{
+var tabElement = document.createElement("li");
+tabElement.textContent = tabTitle;
+tabElement.addEventListener("click", this.selectTab.bind(this, id, true), false);
+
+this._tabsElement.appendChild(tabElement);
+this._contentElement.appendChild(view.element);
+
+this._tabs[id] = { tabElement: tabElement, view: view }
+},
+
+selectTab: function(id, userGesture)
+{
+if (!(id in this._tabs))
+return false;
+
+if (this._currentTab) {
+this._hideTab(this._currentTab)
+delete this._currentTab;
+}
+
+var tab = this._tabs[id];
+this._showTab(tab);
+this._currentTab = tab;
+if (userGesture) {
+var event = {tabId: id};
+this.dispatchEventToListeners("tab-selected", event);
+}
+return true;
+},
+
+_showTab: function(tab)
+{
+tab.tabElement.addStyleClass("selected");
+tab.view.show(this._contentElement);
+},
+
+_hideTab: function(tab)
+{
+tab.tabElement.removeStyleClass("selected");
+tab.view.visible = false;
+}
+}
+
+WebInspector.TabbedPane.prototype.__proto__ = WebInspector.Object.prototype;
+
+
+
+
 
 WebInspector.Placard = function(title, subtitle)
 {
-    this.element = document.createElement("div");
-    this.element.className = "placard";
-    this.element.placard = this;
+this.element = document.createElement("div");
+this.element.className = "placard";
+this.element.placard = this;
 
-    this.titleElement = document.createElement("div");
-    this.titleElement.className = "title";
+this.titleElement = document.createElement("div");
+this.titleElement.className = "title";
 
-    this.subtitleElement = document.createElement("div");
-    this.subtitleElement.className = "subtitle";
+this.subtitleElement = document.createElement("div");
+this.subtitleElement.className = "subtitle";
 
-    this.element.appendChild(this.subtitleElement);
-    this.element.appendChild(this.titleElement);
+this.element.appendChild(this.subtitleElement);
+this.element.appendChild(this.titleElement);
 
-    this.title = title;
-    this.subtitle = subtitle;
-    this.selected = false;
+this.title = title;
+this.subtitle = subtitle;
+this.selected = false;
 }
 
 WebInspector.Placard.prototype = {
-    get title()
-    {
-        return this._title;
-    },
+get title()
+{
+return this._title;
+},
 
-    set title(x)
-    {
-        if (this._title === x)
-            return;
-        this._title = x;
-        this.titleElement.textContent = x;
-    },
+set title(x)
+{
+if (this._title === x)
+return;
+this._title = x;
+this.titleElement.textContent = x;
+},
 
-    get subtitle()
-    {
-        return this._subtitle;
-    },
+get subtitle()
+{
+return this._subtitle;
+},
 
-    set subtitle(x)
-    {
-        if (this._subtitle === x)
-            return;
-        this._subtitle = x;
-        this.subtitleElement.innerHTML = x;
-    },
+set subtitle(x)
+{
+if (this._subtitle === x)
+return;
+this._subtitle = x;
+this.subtitleElement.innerHTML = x;
+},
 
-    get selected()
-    {
-        return this._selected;
-    },
+get selected()
+{
+return this._selected;
+},
 
-    set selected(x)
-    {
-        if (x)
-            this.select();
-        else
-            this.deselect();
-    },
+set selected(x)
+{
+if (x)
+this.select();
+else
+this.deselect();
+},
 
-    select: function()
-    {
-        if (this._selected)
-            return;
-        this._selected = true;
-        this.element.addStyleClass("selected");
-    },
+select: function()
+{
+if (this._selected)
+return;
+this._selected = true;
+this.element.addStyleClass("selected");
+},
 
-    deselect: function()
-    {
-        if (!this._selected)
-            return;
-        this._selected = false;
-        this.element.removeStyleClass("selected");
-    },
+deselect: function()
+{
+if (!this._selected)
+return;
+this._selected = false;
+this.element.removeStyleClass("selected");
+},
 
-    toggleSelected: function()
-    {
-        this.selected = !this.selected;
-    }
+toggleSelected: function()
+{
+this.selected = !this.selected;
+}
 }
 
-/* View.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.View = function(element)
 {
-    this.element = element || document.createElement("div");
-    this._visible = false;
+this.element = element || document.createElement("div");
+this._visible = false;
 }
 
 WebInspector.View.prototype = {
-    get visible()
-    {
-        return this._visible;
-    },
+get visible()
+{
+return this._visible;
+},
 
-    set visible(x)
-    {
-        if (this._visible === x)
-            return;
+set visible(x)
+{
+if (this._visible === x)
+return;
 
-        if (x)
-            this.show();
-        else
-            this.hide();
-    },
+if (x)
+this.show();
+else
+this.hide();
+},
 
-    show: function(parentElement)
-    {
-        this._visible = true;
-        if (parentElement && parentElement !== this.element.parentNode) {
-            this.detach();
-            parentElement.appendChild(this.element);
-        }
-        if (!this.element.parentNode && this.attach)
-            this.attach();
-        this.element.addStyleClass("visible");
-    },
+show: function(parentElement)
+{
+this._visible = true;
+if (parentElement && parentElement !== this.element.parentNode) {
+this.detach();
+parentElement.appendChild(this.element);
+}
+if (!this.element.parentNode && this.attach)
+this.attach();
+this.element.addStyleClass("visible");
+},
 
-    hide: function()
-    {
-        this.element.removeStyleClass("visible");
-        this._visible = false;
-    },
+hide: function()
+{
+this.element.removeStyleClass("visible");
+this._visible = false;
+},
 
-    detach: function()
-    {
-        if (this.element.parentNode)
-            this.element.parentNode.removeChild(this.element);
-    }
+detach: function()
+{
+if (this.element.parentNode)
+this.element.parentNode.removeChild(this.element);
+}
 }
 
 WebInspector.View.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* Callback.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.Callback = function()
 {
-    this._lastCallbackId = 1;
-    this._callbacks = {};
+this._lastCallbackId = 1;
+this._callbacks = {};
 }
 
 WebInspector.Callback.prototype = {
-    wrap: function(callback)
-    {
-        var callbackId = this._lastCallbackId++;
-        this._callbacks[callbackId] = callback || function() {};
-        return callbackId;
-    },
+wrap: function(callback)
+{
+var callbackId = this._lastCallbackId++;
+this._callbacks[callbackId] = callback || function() {};
+return callbackId;
+},
 
-    processCallback: function(callbackId, opt_vararg)
-    {
-        var args = Array.prototype.slice.call(arguments, 1);
-        var callback = this._callbacks[callbackId];
-        callback.apply(null, args);
-        delete this._callbacks[callbackId];
-    }
+processResponse: function(callbackId, args)
+{
+var callback = this._callbacks[callbackId];
+callback.apply(null, args);
+delete this._callbacks[callbackId];
+},
+
+removeResponseCallbackEntry: function(callbackId)
+{
+delete this._callbacks[callbackId];
+}
 }
 
 WebInspector.Callback._INSTANCE = new WebInspector.Callback();
 WebInspector.Callback.wrap = WebInspector.Callback._INSTANCE.wrap.bind(WebInspector.Callback._INSTANCE);
-WebInspector.Callback.processCallback = WebInspector.Callback._INSTANCE.processCallback.bind(WebInspector.Callback._INSTANCE);
+WebInspector.Callback.processResponse = WebInspector.Callback._INSTANCE.processResponse.bind(WebInspector.Callback._INSTANCE);
+WebInspector.Callback.removeResponseCallbackEntry = WebInspector.Callback._INSTANCE.removeResponseCallbackEntry.bind(WebInspector.Callback._INSTANCE);
 
-/* Drawer.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.Drawer = function()
 {
-    WebInspector.View.call(this, document.getElementById("drawer"));
+WebInspector.View.call(this, document.getElementById("drawer"));
 
-    this._savedHeight = 200; // Default.
-    this.state = WebInspector.Drawer.State.Hidden;
-    this.fullPanel = false;
+this._savedHeight = 200; 
+this.state = WebInspector.Drawer.State.Hidden;
+this.fullPanel = false;
 
-    this.mainElement = document.getElementById("main");
-    this.toolbarElement = document.getElementById("toolbar");
-    this.mainStatusBar = document.getElementById("main-status-bar");
-    this.mainStatusBar.addEventListener("mousedown", this._startStatusBarDragging.bind(this), true);
-    this.viewStatusBar = document.getElementById("other-drawer-status-bar-items");
+this.mainElement = document.getElementById("main");
+this.toolbarElement = document.getElementById("toolbar");
+this.mainStatusBar = document.getElementById("main-status-bar");
+this.mainStatusBar.addEventListener("mousedown", this._startStatusBarDragging.bind(this), true);
+this.viewStatusBar = document.getElementById("other-drawer-status-bar-items");
+this._counters = document.getElementById("counters");
+this._drawerStatusBar = document.getElementById("drawer-status-bar");
 }
 
 WebInspector.Drawer.prototype = {
-    get visibleView()
-    {
-        return this._visibleView;
-    },
+get visibleView()
+{
+return this._visibleView;
+},
 
-    set visibleView(x)
-    {
-        if (this._visibleView === x) {
-            if (this.visible && this.fullPanel)
-                return;
-            this.visible = !this.visible;
-            return;
-        }
+set visibleView(x)
+{
+if (this._visibleView === x) {
+if (this.visible && this.fullPanel)
+return;
+this.visible = !this.visible;
+return;
+}
 
-        var firstTime = !this._visibleView;
-        if (this._visibleView)
-            this._visibleView.hide();
+var firstTime = !this._visibleView;
+if (this._visibleView)
+this._visibleView.hide();
 
-        this._visibleView = x;
+this._visibleView = x;
 
-        if (x && !firstTime) {
-            this._safelyRemoveChildren();
-            this.viewStatusBar.removeChildren(); // optimize this? call old.detach()
-            x.attach(this.element, this.viewStatusBar);
-            x.show();
-            this.visible = true;
-        }
-    },
+if (x && !firstTime) {
+this._safelyRemoveChildren();
+this.viewStatusBar.removeChildren(); 
+x.attach(this.element, this.viewStatusBar);
+x.show();
+this.visible = true;
+}
+},
 
-    get savedHeight()
-    {
-        var height = this._savedHeight || this.element.offsetHeight;
-        return Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - this.mainElement.totalOffsetTop - Preferences.minConsoleHeight);
-    },
+get savedHeight()
+{
+var height = this._savedHeight || this.element.offsetHeight;
+return Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - this.mainElement.totalOffsetTop - Preferences.minConsoleHeight);
+},
 
-    showView: function(view)
-    {
-        if (!this.visible || this.visibleView !== view)
-            this.visibleView = view;
-    },
+showView: function(view)
+{
+if (!this.visible || this.visibleView !== view)
+this.visibleView = view;
+},
 
-    show: function()
-    {
-        if (this._animating || this.visible)
-            return;
+show: function()
+{
+if (this._animating || this.visible)
+return;
 
-        if (this.visibleView)
-            this.visibleView.show();
+if (this.visibleView)
+this.visibleView.show();
 
-        WebInspector.View.prototype.show.call(this);
+WebInspector.View.prototype.show.call(this);
 
-        this._animating = true;
+this._animating = true;
 
-        document.body.addStyleClass("drawer-visible");
+document.body.addStyleClass("drawer-visible");
 
-        var anchoredItems = document.getElementById("anchored-status-bar-items");
-        var height = (this.fullPanel ? window.innerHeight - this.toolbarElement.offsetHeight : this.savedHeight);
-        var animations = [
-            {element: this.element, end: {height: height}},
-            {element: document.getElementById("main"), end: {bottom: height}},
-            {element: document.getElementById("main-status-bar"), start: {"padding-left": anchoredItems.offsetWidth - 1}, end: {"padding-left": 0}},
-            {element: document.getElementById("other-drawer-status-bar-items"), start: {opacity: 0}, end: {opacity: 1}}
-        ];
+var anchoredItems = document.getElementById("anchored-status-bar-items");
+var height = (this.fullPanel ? window.innerHeight - this.toolbarElement.offsetHeight : this.savedHeight);
+var animations = [
+{element: this.element, end: {height: height}},
+{element: document.getElementById("main"), end: {bottom: height}},
+{element: document.getElementById("main-status-bar"), start: {"padding-left": anchoredItems.offsetWidth - 1}, end: {"padding-left": 0}},
+{element: document.getElementById("other-drawer-status-bar-items"), start: {opacity: 0}, end: {opacity: 1}}
+];
 
-        var drawerStatusBar = document.getElementById("drawer-status-bar");
-        drawerStatusBar.insertBefore(anchoredItems, drawerStatusBar.firstChild);
+var drawerStatusBar = document.getElementById("drawer-status-bar");
+drawerStatusBar.insertBefore(anchoredItems, drawerStatusBar.firstChild);
 
-        function animationFinished()
-        {
-            if ("updateStatusBarItems" in WebInspector.currentPanel)
-                WebInspector.currentPanel.updateStatusBarItems();
-            if (this.visibleView.afterShow)
-                this.visibleView.afterShow();
-            delete this._animating;
-            delete this._currentAnimationInterval;
-            this.state = (this.fullPanel ? WebInspector.Drawer.State.Full : WebInspector.Drawer.State.Variable);
-        }
+if (this._currentPanelCounters) {
+var oldRight = this._drawerStatusBar.clientWidth - (this._counters.offsetLeft + this._currentPanelCounters.offsetWidth);
+var newRight = WebInspector.Panel.counterRightMargin;
+var rightPadding = (oldRight - newRight);
+animations.push({element: this._currentPanelCounters, start: {"padding-right": rightPadding}, end: {"padding-right": 0}});
+this._currentPanelCounters.parentNode.removeChild(this._currentPanelCounters);
+this.mainStatusBar.appendChild(this._currentPanelCounters);
+}
 
-        this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this));
-    },
+function animationFinished()
+{
+if ("updateStatusBarItems" in WebInspector.currentPanel)
+WebInspector.currentPanel.updateStatusBarItems();
+if (this.visibleView.afterShow)
+this.visibleView.afterShow();
+delete this._animating;
+delete this._currentAnimationInterval;
+this.state = (this.fullPanel ? WebInspector.Drawer.State.Full : WebInspector.Drawer.State.Variable);
+if (this._currentPanelCounters)
+this._currentPanelCounters.removeAttribute("style");
+}
 
-    hide: function()
-    {
-        if (this._animating || !this.visible)
-            return;
+this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this));
+},
 
-        WebInspector.View.prototype.hide.call(this);
+hide: function()
+{
+if (this._animating || !this.visible)
+return;
 
-        if (this.visibleView)
-            this.visibleView.hide();
+WebInspector.View.prototype.hide.call(this);
 
-        this._animating = true;
+if (this.visibleView)
+this.visibleView.hide();
 
-        if (!this.fullPanel)
-            this._savedHeight = this.element.offsetHeight;
+this._animating = true;
 
-        if (this.element === WebInspector.currentFocusElement || this.element.isAncestor(WebInspector.currentFocusElement))
-            WebInspector.currentFocusElement = WebInspector.previousFocusElement;
+if (!this.fullPanel)
+this._savedHeight = this.element.offsetHeight;
 
-        var anchoredItems = document.getElementById("anchored-status-bar-items");
+if (this.element === WebInspector.currentFocusElement || this.element.isAncestor(WebInspector.currentFocusElement))
+WebInspector.currentFocusElement = WebInspector.previousFocusElement;
 
-        // Temporarily set properties and classes to mimic the post-animation values so panels
-        // like Elements in their updateStatusBarItems call will size things to fit the final location.
-        this.mainStatusBar.style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px");
-        document.body.removeStyleClass("drawer-visible");
-        if ("updateStatusBarItems" in WebInspector.currentPanel)
-            WebInspector.currentPanel.updateStatusBarItems();
-        document.body.addStyleClass("drawer-visible");
+var anchoredItems = document.getElementById("anchored-status-bar-items");
 
-        var animations = [
-            {element: document.getElementById("main"), end: {bottom: 0}},
-            {element: document.getElementById("main-status-bar"), start: {"padding-left": 0}, end: {"padding-left": anchoredItems.offsetWidth - 1}},
-            {element: document.getElementById("other-drawer-status-bar-items"), start: {opacity: 1}, end: {opacity: 0}}
-        ];
 
-        function animationFinished()
-        {
-            WebInspector.currentPanel.resize();
-            var mainStatusBar = document.getElementById("main-status-bar");
-            mainStatusBar.insertBefore(anchoredItems, mainStatusBar.firstChild);
-            mainStatusBar.style.removeProperty("padding-left");
-            document.body.removeStyleClass("drawer-visible");
-            delete this._animating;
-            delete this._currentAnimationInterval;
-            this.state = WebInspector.Drawer.State.Hidden;
-        }
 
-        this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this));
-    },
+this.mainStatusBar.style.setProperty("padding-left", (anchoredItems.offsetWidth - 1) + "px");
+document.body.removeStyleClass("drawer-visible");
+if ("updateStatusBarItems" in WebInspector.currentPanel)
+WebInspector.currentPanel.updateStatusBarItems();
+document.body.addStyleClass("drawer-visible");
 
-    resize: function()
-    {
-        if (this.state === WebInspector.Drawer.State.Hidden)
-            return;
+var animations = [
+{element: document.getElementById("main"), end: {bottom: 0}},
+{element: document.getElementById("main-status-bar"), start: {"padding-left": 0}, end: {"padding-left": anchoredItems.offsetWidth - 1}},
+{element: document.getElementById("other-drawer-status-bar-items"), start: {opacity: 1}, end: {opacity: 0}}
+];
 
-        var height;
-        var mainElement = document.getElementById("main");
-        if (this.state === WebInspector.Drawer.State.Variable) {
-            height = parseInt(this.element.style.height);
-            height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - mainElement.totalOffsetTop - Preferences.minConsoleHeight);
-        } else
-            height = window.innerHeight - this.toolbarElement.offsetHeight;
+if (this._currentPanelCounters) {
+var newRight = this._drawerStatusBar.clientWidth - this._counters.offsetLeft;
+var oldRight = this.mainStatusBar.clientWidth - (this._currentPanelCounters.offsetLeft + this._currentPanelCounters.offsetWidth);
+var rightPadding = (newRight - oldRight);
+animations.push({element: this._currentPanelCounters, start: {"padding-right": 0}, end: {"padding-right": rightPadding}});
+}
 
-        mainElement.style.bottom = height + "px";
-        this.element.style.height = height + "px";
-    },
+function animationFinished()
+{
+WebInspector.currentPanel.resize();
+var mainStatusBar = document.getElementById("main-status-bar");
+mainStatusBar.insertBefore(anchoredItems, mainStatusBar.firstChild);
+mainStatusBar.style.removeProperty("padding-left");
 
-    enterPanelMode: function()
-    {
-        this._cancelAnimationIfNeeded();
-        this.fullPanel = true;
-        
-        if (this.visible) {
-            this._savedHeight = this.element.offsetHeight;
-            var height = window.innerHeight - this.toolbarElement.offsetHeight;
-            this._animateDrawerHeight(height, WebInspector.Drawer.State.Full);
-        }
-    },
+if (this._currentPanelCounters) {
+this._currentPanelCounters.setAttribute("style", null);
+this._currentPanelCounters.parentNode.removeChild(this._currentPanelCounters);
+this._counters.insertBefore(this._currentPanelCounters, this._counters.firstChild);
+}
 
-    exitPanelMode: function()
-    {
-        this._cancelAnimationIfNeeded();
-        this.fullPanel = false;
+document.body.removeStyleClass("drawer-visible");
+delete this._animating;
+delete this._currentAnimationInterval;
+this.state = WebInspector.Drawer.State.Hidden;
+}
 
-        if (this.visible) {
-            // If this animation gets cancelled, we want the state of the drawer to be Variable,
-            // so that the new animation can't do an immediate transition between Hidden/Full states.
-            this.state = WebInspector.Drawer.State.Variable;
-            var height = this.savedHeight;
-            this._animateDrawerHeight(height, WebInspector.Drawer.State.Variable);
-        }
-    },
+this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this));
+},
 
-    immediatelyExitPanelMode: function()
-    {
-        this.visible = false;
-        this.fullPanel = false;
-    },
+resize: function()
+{
+if (this.state === WebInspector.Drawer.State.Hidden)
+return;
 
-    _cancelAnimationIfNeeded: function()
-    {
-        if (this._animating) {
-            clearInterval(this._currentAnimationInterval);
-            delete this._animating;
-            delete this._currentAnimationInterval;
-        }
-    },
+var height;
+var mainElement = document.getElementById("main");
+if (this.state === WebInspector.Drawer.State.Variable) {
+height = parseInt(this.element.style.height);
+height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - mainElement.totalOffsetTop - Preferences.minConsoleHeight);
+} else
+height = window.innerHeight - this.toolbarElement.offsetHeight;
 
-    _animateDrawerHeight: function(height, finalState)
-    {
-        this._animating = true;
-        var animations = [
-            {element: this.element, end: {height: height}},
-            {element: document.getElementById("main"), end: {bottom: height}}
-        ];
+mainElement.style.bottom = height + "px";
+this.element.style.height = height + "px";
+},
 
-        function animationFinished()
-        {
-            delete this._animating;
-            delete this._currentAnimationInterval;
-            this.state = finalState;
-        }
+enterPanelMode: function()
+{
+this._cancelAnimationIfNeeded();
+this.fullPanel = true;
 
-        this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this));
-    },
+if (this.visible) {
+this._savedHeight = this.element.offsetHeight;
+var height = window.innerHeight - this.toolbarElement.offsetHeight;
+this._animateDrawerHeight(height, WebInspector.Drawer.State.Full);
+}
+},
 
-    _animationDuration: function()
-    {
-        // Immediate if going between Hidden and Full in full panel mode
-        if (this.fullPanel && (this.state === WebInspector.Drawer.State.Hidden || this.state === WebInspector.Drawer.State.Full))
-            return 0;
+exitPanelMode: function()
+{
+this._cancelAnimationIfNeeded();
+this.fullPanel = false;
 
-        return (window.event && window.event.shiftKey ? 2000 : 250);
-    },
+if (this.visible) {
 
-    _safelyRemoveChildren: function()
-    {
-        var child = this.element.firstChild;
-        while (child) {
-            if (child.id !== "drawer-status-bar") {
-                var moveTo = child.nextSibling;
-                this.element.removeChild(child);
-                child = moveTo;
-            } else
-                child = child.nextSibling;
-        }
-    },
 
-    _startStatusBarDragging: function(event)
-    {
-        if (!this.visible || event.target !== this.mainStatusBar)
-            return;
+this.state = WebInspector.Drawer.State.Variable;
+var height = this.savedHeight;
+this._animateDrawerHeight(height, WebInspector.Drawer.State.Variable);
+}
+},
 
-        WebInspector.elementDragStart(this.mainStatusBar, this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), event, "row-resize");
+immediatelyExitPanelMode: function()
+{
+this.visible = false;
+this.fullPanel = false;
+},
 
-        this._statusBarDragOffset = event.pageY - this.element.totalOffsetTop;
+set currentPanelCounters(x)
+{
+if (!x) {
+if (this._currentPanelCounters)
+this._currentPanelCounters.parentElement.removeChild(this._currentPanelCounters);
+delete this._currentPanelCounters;
+return;
+}
 
-        event.stopPropagation();
-    },
+this._currentPanelCounters = x;
+if (this.visible)
+this.mainStatusBar.appendChild(x);
+else
+this._counters.insertBefore(x, this._counters.firstChild);
+},
 
-    _statusBarDragging: function(event)
-    {
-        var mainElement = document.getElementById("main");
-        var height = window.innerHeight - event.pageY + this._statusBarDragOffset;
-        height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - mainElement.totalOffsetTop - Preferences.minConsoleHeight);
+_cancelAnimationIfNeeded: function()
+{
+if (this._animating) {
+clearInterval(this._currentAnimationInterval);
+delete this._animating;
+delete this._currentAnimationInterval;
+}
+},
 
-        mainElement.style.bottom = height + "px";
-        this.element.style.height = height + "px";
+_animateDrawerHeight: function(height, finalState)
+{
+this._animating = true;
+var animations = [
+{element: this.element, end: {height: height}},
+{element: document.getElementById("main"), end: {bottom: height}}
+];
 
-        event.preventDefault();
-        event.stopPropagation();
-    },
+function animationFinished()
+{
+delete this._animating;
+delete this._currentAnimationInterval;
+this.state = finalState;
+}
 
-    _endStatusBarDragging: function(event)
-    {
-        WebInspector.elementDragEnd(event);
+this._currentAnimationInterval = WebInspector.animateStyle(animations, this._animationDuration(), animationFinished.bind(this));
+},
 
-        this._savedHeight = this.element.offsetHeight;
-        delete this._statusBarDragOffset;
+_animationDuration: function()
+{
 
-        event.stopPropagation();
-    }
+if (this.fullPanel && (this.state === WebInspector.Drawer.State.Hidden || this.state === WebInspector.Drawer.State.Full))
+return 0;
+
+return (window.event && window.event.shiftKey ? 2000 : 250);
+},
+
+_safelyRemoveChildren: function()
+{
+var child = this.element.firstChild;
+while (child) {
+if (child.id !== "drawer-status-bar") {
+var moveTo = child.nextSibling;
+this.element.removeChild(child);
+child = moveTo;
+} else
+child = child.nextSibling;
+}
+},
+
+_startStatusBarDragging: function(event)
+{
+if (!this.visible || event.target !== this.mainStatusBar)
+return;
+
+WebInspector.elementDragStart(this.mainStatusBar, this._statusBarDragging.bind(this), this._endStatusBarDragging.bind(this), event, "row-resize");
+
+this._statusBarDragOffset = event.pageY - this.element.totalOffsetTop;
+
+event.stopPropagation();
+},
+
+_statusBarDragging: function(event)
+{
+var mainElement = document.getElementById("main");
+var height = window.innerHeight - event.pageY + this._statusBarDragOffset;
+height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - mainElement.totalOffsetTop - Preferences.minConsoleHeight);
+
+mainElement.style.bottom = height + "px";
+this.element.style.height = height + "px";
+
+event.preventDefault();
+event.stopPropagation();
+},
+
+_endStatusBarDragging: function(event)
+{
+WebInspector.elementDragEnd(event);
+
+this._savedHeight = this.element.offsetHeight;
+delete this._statusBarDragOffset;
+
+event.stopPropagation();
+}
 }
 
 WebInspector.Drawer.prototype.__proto__ = WebInspector.View.prototype;
 
 WebInspector.Drawer.State = {
-    Hidden: 0,
-    Variable: 1,
-    Full: 2
+Hidden: 0,
+Variable: 1,
+Full: 2
 };
 
-/* ChangesView.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ChangesView = function(drawer)
 {
-    WebInspector.View.call(this);
-    this.element.innerHTML = "<div style=\"bottom:25%;color:rgb(192,192,192);font-size:12px;height:65px;left:0px;margin:auto;position:absolute;right:0px;text-align:center;top:0px;\"><h1>Not Implemented Yet</h1></div>";
+WebInspector.View.call(this);
+this.element.innerHTML = "<div style=\"bottom:25%;color:rgb(192,192,192);font-size:12px;height:65px;left:0px;margin:auto;position:absolute;right:0px;text-align:center;top:0px;\"><h1>Not Implemented Yet</h1></div>";
 
-    this.drawer = drawer;
+this.drawer = drawer;
 
-    this.clearButton = document.createElement("button");
-    this.clearButton.id = "clear-changes-status-bar-item";
-    this.clearButton.title = WebInspector.UIString("Clear changes log.");
-    this.clearButton.className = "status-bar-item";
-    this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
+this.clearButton = document.createElement("button");
+this.clearButton.id = "clear-changes-status-bar-item";
+this.clearButton.title = WebInspector.UIString("Clear changes log.");
+this.clearButton.className = "status-bar-item clear-status-bar-item";
+this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
 
-    this.toggleChangesButton = document.getElementById("changes-status-bar-item");
-    this.toggleChangesButton.title = WebInspector.UIString("Show changes view.");
-    this.toggleChangesButton.addEventListener("click", this._toggleChangesButtonClicked.bind(this), false);
-    var anchoredStatusBar = document.getElementById("anchored-status-bar-items");
-    anchoredStatusBar.appendChild(this.toggleChangesButton);
+this.toggleChangesButton = document.getElementById("changes-status-bar-item");
+this.toggleChangesButton.title = WebInspector.UIString("Show changes view.");
+this.toggleChangesButton.addEventListener("click", this._toggleChangesButtonClicked.bind(this), false);
+var anchoredStatusBar = document.getElementById("anchored-status-bar-items");
+anchoredStatusBar.appendChild(this.toggleChangesButton);
 }
 
 WebInspector.ChangesView.prototype = {
-    _clearButtonClicked: function()
-    {
-        // Not Implemented Yet
-    },
+_clearButtonClicked: function()
+{
 
-    _toggleChangesButtonClicked: function()
-    {
-        this.drawer.visibleView = this;
-    },
+},
 
-    attach: function(mainElement, statusBarElement)
-    {
-        mainElement.appendChild(this.element);
-        statusBarElement.appendChild(this.clearButton);
-    },
+_toggleChangesButtonClicked: function()
+{
+this.drawer.visibleView = this;
+},
 
-    show: function()
-    {
-        this.toggleChangesButton.addStyleClass("toggled-on");
-        this.toggleChangesButton.title = WebInspector.UIString("Hide changes view.");
-    },
+attach: function(mainElement, statusBarElement)
+{
+mainElement.appendChild(this.element);
+statusBarElement.appendChild(this.clearButton);
+},
 
-    hide: function()
-    {
-        this.toggleChangesButton.removeStyleClass("toggled-on");
-        this.toggleChangesButton.title = WebInspector.UIString("Show changes view.");
-    }
+show: function()
+{
+this.toggleChangesButton.addStyleClass("toggled-on");
+this.toggleChangesButton.title = WebInspector.UIString("Hide changes view.");
+},
+
+hide: function()
+{
+this.toggleChangesButton.removeStyleClass("toggled-on");
+this.toggleChangesButton.title = WebInspector.UIString("Show changes view.");
+}
 }
 
 WebInspector.ChangesView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* ConsoleView.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 const ExpressionStopCharacters = " =:[({;,!+-*/&|^<>";
 
 WebInspector.ConsoleView = function(drawer)
 {
-    WebInspector.View.call(this, document.getElementById("console-view"));
+WebInspector.View.call(this, document.getElementById("console-view"));
 
-    this.messages = [];
-    this.drawer = drawer;
+this.messages = [];
+this.drawer = drawer;
 
-    this.clearButton = document.getElementById("clear-console-status-bar-item");
-    this.clearButton.title = WebInspector.UIString("Clear console log.");
-    this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
+this.clearButton = document.getElementById("clear-console-status-bar-item");
+this.clearButton.title = WebInspector.UIString("Clear console log.");
+this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
 
-    this.messagesElement = document.getElementById("console-messages");
-    this.messagesElement.addEventListener("selectstart", this._messagesSelectStart.bind(this), false);
-    this.messagesElement.addEventListener("click", this._messagesClicked.bind(this), true);
+this.messagesElement = document.getElementById("console-messages");
+this.messagesElement.addEventListener("selectstart", this._messagesSelectStart.bind(this), false);
+this.messagesElement.addEventListener("click", this._messagesClicked.bind(this), true);
 
-    this.promptElement = document.getElementById("console-prompt");
-    this.promptElement.className = "source-code";
-    this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
-    this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + ".");
+this.promptElement = document.getElementById("console-prompt");
+this.promptElement.className = "source-code";
+this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
+this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + ".");
+this.prompt.history = WebInspector.settings.consoleHistory;
 
-    this.topGroup = new WebInspector.ConsoleGroup(null, 0);
-    this.messagesElement.insertBefore(this.topGroup.element, this.promptElement);
-    this.groupLevel = 0;
-    this.currentGroup = this.topGroup;
+this.topGroup = new WebInspector.ConsoleGroup(null);
+this.messagesElement.insertBefore(this.topGroup.element, this.promptElement);
+this.currentGroup = this.topGroup;
 
-    this.toggleConsoleButton = document.getElementById("console-status-bar-item");
-    this.toggleConsoleButton.title = WebInspector.UIString("Show console.");
-    this.toggleConsoleButton.addEventListener("click", this._toggleConsoleButtonClicked.bind(this), false);
+this.toggleConsoleButton = document.getElementById("console-status-bar-item");
+this.toggleConsoleButton.title = WebInspector.UIString("Show console.");
+this.toggleConsoleButton.addEventListener("click", this._toggleConsoleButtonClicked.bind(this), false);
 
-    // Will hold the list of filter elements
-    this.filterBarElement = document.getElementById("console-filter");
 
-    function createDividerElement() {
-        var dividerElement = document.createElement("div");
-        dividerElement.addStyleClass("divider");
-        this.filterBarElement.appendChild(dividerElement);
-    }
+this.filterBarElement = document.getElementById("console-filter");
 
-    var updateFilterHandler = this._updateFilter.bind(this);
-    function createFilterElement(category) {
-        var categoryElement = document.createElement("li");
-        categoryElement.category = category;
-        categoryElement.addStyleClass(categoryElement.category);            
-        categoryElement.addEventListener("click", updateFilterHandler, false);
+function createDividerElement() {
+var dividerElement = document.createElement("div");
+dividerElement.addStyleClass("scope-bar-divider");
+this.filterBarElement.appendChild(dividerElement);
+}
 
-        var label = category.toString();
-        categoryElement.appendChild(document.createTextNode(label));
+var updateFilterHandler = this._updateFilter.bind(this);
+function createFilterElement(category) {
+var categoryElement = document.createElement("li");
+categoryElement.category = category;
+categoryElement.addStyleClass(categoryElement.category);
+categoryElement.addEventListener("click", updateFilterHandler, false);
 
-        this.filterBarElement.appendChild(categoryElement);
-        return categoryElement;
-    }
-    
-    this.allElement = createFilterElement.call(this, "All");
-    createDividerElement.call(this);
-    this.errorElement = createFilterElement.call(this, "Errors");
-    this.warningElement = createFilterElement.call(this, "Warnings");
-    this.logElement = createFilterElement.call(this, "Logs");
+var label = category.toString();
+categoryElement.appendChild(document.createTextNode(label));
 
-    this.filter(this.allElement, false);
+this.filterBarElement.appendChild(categoryElement);
+return categoryElement;
+}
 
-    this._shortcuts = {};
+this.allElement = createFilterElement.call(this, WebInspector.UIString("All"));
+createDividerElement.call(this);
+this.errorElement = createFilterElement.call(this, WebInspector.UIString("Errors"));
+this.warningElement = createFilterElement.call(this, WebInspector.UIString("Warnings"));
+this.logElement = createFilterElement.call(this, WebInspector.UIString("Logs"));
 
-    var shortcut;
-    var clearConsoleHandler = this.requestClearMessages.bind(this);
+this.filter(this.allElement, false);
+this._registerShortcuts();
 
-    shortcut = WebInspector.KeyboardShortcut.makeKey("k", WebInspector.KeyboardShortcut.Modifiers.Meta);
-    this._shortcuts[shortcut] = clearConsoleHandler;
-    this._shortcuts[shortcut].isMacOnly = true;
-    shortcut = WebInspector.KeyboardShortcut.makeKey("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-    this._shortcuts[shortcut] = clearConsoleHandler;
+this.messagesElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
 
-    // Since the Context Menu for the Console View will always be the same, we can create it in
-    // the constructor.
-    this._contextMenu = new WebInspector.ContextMenu();
-    this._contextMenu.appendItem(WebInspector.UIString("Clear Console"), clearConsoleHandler);
-    this.messagesElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
-    
-    this._customFormatters = {
-        "object": this._formatobject,
-        "array":  this._formatarray,
-        "node":   this._formatnode,
-        "string": this._formatstring
-    };
+this._customFormatters = {
+"object": this._formatobject,
+"array":  this._formatarray,
+"node":   this._formatnode,
+"string": this._formatstring
+};
 }
 
 WebInspector.ConsoleView.prototype = {
-    
-    _updateFilter: function(e)
-    {
-        var isMac = WebInspector.isMac();
-        var selectMultiple = false;
-        if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
-            selectMultiple = true;
-        if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
-            selectMultiple = true;
+_updateFilter: function(e)
+{
+var isMac = WebInspector.isMac();
+var selectMultiple = false;
+if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
+selectMultiple = true;
+if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
+selectMultiple = true;
 
-        this.filter(e.target, selectMultiple);
-    },
-    
-    filter: function(target, selectMultiple)
-    {
-        function unselectAll()
-        {
-            this.allElement.removeStyleClass("selected");
-            this.errorElement.removeStyleClass("selected");
-            this.warningElement.removeStyleClass("selected");
-            this.logElement.removeStyleClass("selected");
-            
-            this.messagesElement.removeStyleClass("filter-all");
-            this.messagesElement.removeStyleClass("filter-errors");
-            this.messagesElement.removeStyleClass("filter-warnings");
-            this.messagesElement.removeStyleClass("filter-logs");
-        }
-        
-        var targetFilterClass = "filter-" + target.category.toLowerCase();
+this.filter(e.target, selectMultiple);
+},
 
-        if (target.category == "All") {
-            if (target.hasStyleClass("selected")) {
-                // We can't unselect all, so we break early here
-                return;
-            }
+filter: function(target, selectMultiple)
+{
+function unselectAll()
+{
+this.allElement.removeStyleClass("selected");
+this.errorElement.removeStyleClass("selected");
+this.warningElement.removeStyleClass("selected");
+this.logElement.removeStyleClass("selected");
 
-            unselectAll.call(this);
-        } else {
-            // Something other than all is being selected, so we want to unselect all
-            if (this.allElement.hasStyleClass("selected")) {
-                this.allElement.removeStyleClass("selected");
-                this.messagesElement.removeStyleClass("filter-all");
-            }
-        }
-        
-        if (!selectMultiple) {
-            // If multiple selection is off, we want to unselect everything else
-            // and just select ourselves.
-            unselectAll.call(this);
-            
-            target.addStyleClass("selected");
-            this.messagesElement.addStyleClass(targetFilterClass);
-            
-            return;
-        }
-        
-        if (target.hasStyleClass("selected")) {
-            // If selectMultiple is turned on, and we were selected, we just
-            // want to unselect ourselves.
-            target.removeStyleClass("selected");
-            this.messagesElement.removeStyleClass(targetFilterClass);
-        } else {
-            // If selectMultiple is turned on, and we weren't selected, we just
-            // want to select ourselves.
-            target.addStyleClass("selected");
-            this.messagesElement.addStyleClass(targetFilterClass);
-        }
-    },
-    
-    _toggleConsoleButtonClicked: function()
-    {
-        this.drawer.visibleView = this;
-    },
+this.messagesElement.removeStyleClass("filter-all");
+this.messagesElement.removeStyleClass("filter-errors");
+this.messagesElement.removeStyleClass("filter-warnings");
+this.messagesElement.removeStyleClass("filter-logs");
+}
 
-    attach: function(mainElement, statusBarElement)
-    {
-        mainElement.appendChild(this.element);
-        statusBarElement.appendChild(this.clearButton);
-        statusBarElement.appendChild(this.filterBarElement);
-    },
+var targetFilterClass = "filter-" + target.category.toLowerCase();
 
-    show: function()
-    {
-        this.toggleConsoleButton.addStyleClass("toggled-on");
-        this.toggleConsoleButton.title = WebInspector.UIString("Hide console.");
-        if (!this.prompt.isCaretInsidePrompt())
-            this.prompt.moveCaretToEndOfPrompt();
-    },
+if (target.category == "All") {
+if (target.hasStyleClass("selected")) {
 
-    afterShow: function()
-    {
-        WebInspector.currentFocusElement = this.promptElement;  
-    },
+return;
+}
 
-    hide: function()
-    {
-        this.toggleConsoleButton.removeStyleClass("toggled-on");
-        this.toggleConsoleButton.title = WebInspector.UIString("Show console.");
-    },
+unselectAll.call(this);
+} else {
 
-    _scheduleScrollIntoView: function()
-    {
-        if (this._scrollIntoViewTimer)
-            return;
+if (this.allElement.hasStyleClass("selected")) {
+this.allElement.removeStyleClass("selected");
+this.messagesElement.removeStyleClass("filter-all");
+}
+}
 
-        function scrollIntoView()
-        {
-            this.promptElement.scrollIntoView(false);
-            delete this._scrollIntoViewTimer;
-        }
-        this._scrollIntoViewTimer = setTimeout(scrollIntoView.bind(this), 20);
-    },
+if (!selectMultiple) {
 
-    addMessage: function(msg)
-    {
-        if (msg instanceof WebInspector.ConsoleMessage && !(msg instanceof WebInspector.ConsoleCommandResult)) {
-            this._incrementErrorWarningCount(msg);
 
-            // Add message to the resource panel
-            if (msg.url in WebInspector.resourceURLMap) {
-                msg.resource = WebInspector.resourceURLMap[msg.url];
-                if (WebInspector.panels.resources)
-                    WebInspector.panels.resources.addMessageToResource(msg.resource, msg);
-            }
+unselectAll.call(this);
 
-            this.commandSincePreviousMessage = false;
-            this.previousMessage = msg;
-        } else if (msg instanceof WebInspector.ConsoleCommand) {
-            if (this.previousMessage) {
-                this.commandSincePreviousMessage = true;
-            }
-        }
+target.addStyleClass("selected");
+this.messagesElement.addStyleClass(targetFilterClass);
 
-        this.messages.push(msg);
+return;
+}
 
-        if (msg.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
-            if (this.groupLevel < 1)
-                return;
+if (target.hasStyleClass("selected")) {
 
-            this.groupLevel--;
 
-            this.currentGroup = this.currentGroup.parentGroup;
-        } else {
-            if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
-                this.groupLevel++;
+target.removeStyleClass("selected");
+this.messagesElement.removeStyleClass(targetFilterClass);
+} else {
 
-                var group = new WebInspector.ConsoleGroup(this.currentGroup, this.groupLevel);
-                this.currentGroup.messagesElement.appendChild(group.element);
-                this.currentGroup = group;
-            }
 
-            this.currentGroup.addMessage(msg);
-        }
+target.addStyleClass("selected");
+this.messagesElement.addStyleClass(targetFilterClass);
+}
+},
 
-        this._scheduleScrollIntoView();
-    },
+_toggleConsoleButtonClicked: function()
+{
+this.drawer.visibleView = this;
+},
 
-    updateMessageRepeatCount: function(count)
-    {
-        var msg = this.previousMessage;
-        var prevRepeatCount = msg.totalRepeatCount;
-        
-        if (!this.commandSincePreviousMessage) {
-            msg.repeatDelta = count - prevRepeatCount;
-            msg.repeatCount = msg.repeatCount + msg.repeatDelta;
-            msg.totalRepeatCount = count;
-            msg._updateRepeatCount();
-            this._incrementErrorWarningCount(msg);
-        } else {
-            msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, msg.groupLevel, count - prevRepeatCount);
-            msgCopy.totalRepeatCount = count;
-            msgCopy.setMessageBody(msg.args);
-            this.addMessage(msgCopy);
-        }
-    },
+attach: function(mainElement, statusBarElement)
+{
+mainElement.appendChild(this.element);
+statusBarElement.appendChild(this.clearButton);
+statusBarElement.appendChild(this.filterBarElement);
+},
 
-    _incrementErrorWarningCount: function(msg)
-    {
-        switch (msg.level) {
-            case WebInspector.ConsoleMessage.MessageLevel.Warning:
-                WebInspector.warnings += msg.repeatDelta;
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Error:
-                WebInspector.errors += msg.repeatDelta;
-                break;
-        }
-    },
+show: function()
+{
+this.toggleConsoleButton.addStyleClass("toggled-on");
+this.toggleConsoleButton.title = WebInspector.UIString("Hide console.");
+if (!this.prompt.isCaretInsidePrompt())
+this.prompt.moveCaretToEndOfPrompt();
+},
 
-    requestClearMessages: function()
-    {
-        InjectedScriptAccess.getDefault().clearConsoleMessages(function() {});
-    },
+afterShow: function()
+{
+WebInspector.currentFocusElement = this.promptElement;
+},
 
-    clearMessages: function()
-    {
-        if (WebInspector.panels.resources)
-            WebInspector.panels.resources.clearMessages();
+hide: function()
+{
+this.toggleConsoleButton.removeStyleClass("toggled-on");
+this.toggleConsoleButton.title = WebInspector.UIString("Show console.");
+},
 
-        this.messages = [];
+_scheduleScrollIntoView: function()
+{
+if (this._scrollIntoViewTimer)
+return;
 
-        this.groupLevel = 0;
-        this.currentGroup = this.topGroup;
-        this.topGroup.messagesElement.removeChildren();
+function scrollIntoView()
+{
+this.promptElement.scrollIntoView(false);
+delete this._scrollIntoViewTimer;
+}
+this._scrollIntoViewTimer = setTimeout(scrollIntoView.bind(this), 20);
+},
 
-        WebInspector.errors = 0;
-        WebInspector.warnings = 0;
+addMessage: function(msg)
+{
+if (msg instanceof WebInspector.ConsoleMessage && !(msg instanceof WebInspector.ConsoleCommandResult)) {
+this._incrementErrorWarningCount(msg);
+WebInspector.resourceManager.addConsoleMessage(msg);
+this.commandSincePreviousMessage = false;
+this.previousMessage = msg;
+} else if (msg instanceof WebInspector.ConsoleCommand) {
+if (this.previousMessage) {
+this.commandSincePreviousMessage = true;
+}
+}
 
-        delete this.commandSincePreviousMessage;
-        delete this.previousMessage;
-    },
+this.messages.push(msg);
 
-    completions: function(wordRange, bestMatchOnly, completionsReadyCallback)
-    {
-        // Pass less stop characters to rangeOfWord so the range will be a more complete expression.
-        var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, this.promptElement, "backward");
-        var expressionString = expressionRange.toString();
-        var lastIndex = expressionString.length - 1;
+if (msg.type === WebInspector.ConsoleMessage.MessageType.EndGroup) {
+var parentGroup = this.currentGroup.parentGroup
+if (parentGroup)
+this.currentGroup = parentGroup;
+} else {
+if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup || msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
+var group = new WebInspector.ConsoleGroup(this.currentGroup);
+this.currentGroup.messagesElement.appendChild(group.element);
+this.currentGroup = group;
+}
+
+this.currentGroup.addMessage(msg);
+}
+
+this._scheduleScrollIntoView();
+},
+
+updateMessageRepeatCount: function(count)
+{
+var msg = this.previousMessage;
+var prevRepeatCount = msg.totalRepeatCount;
+
+if (!this.commandSincePreviousMessage) {
+msg.repeatDelta = count - prevRepeatCount;
+msg.repeatCount = msg.repeatCount + msg.repeatDelta;
+msg.totalRepeatCount = count;
+msg._updateRepeatCount();
+this._incrementErrorWarningCount(msg);
+} else {
+var msgCopy = new WebInspector.ConsoleMessage(msg.source, msg.type, msg.level, msg.line, msg.url, count - prevRepeatCount, msg._messageText, msg._parameters, msg._stackTrace);
+msgCopy.totalRepeatCount = count;
+msgCopy._formatMessage();
+this.addMessage(msgCopy);
+}
+},
+
+_incrementErrorWarningCount: function(msg)
+{
+switch (msg.level) {
+case WebInspector.ConsoleMessage.MessageLevel.Warning:
+WebInspector.warnings += msg.repeatDelta;
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Error:
+WebInspector.errors += msg.repeatDelta;
+break;
+}
+},
+
+requestClearMessages: function()
+{
+InspectorBackend.clearConsoleMessages();
+},
+
+clearMessages: function()
+{
+WebInspector.resourceManager.clearConsoleMessages();
+
+this.messages = [];
+
+this.currentGroup = this.topGroup;
+this.topGroup.messagesElement.removeChildren();
+
+WebInspector.errors = 0;
+WebInspector.warnings = 0;
+
+delete this.commandSincePreviousMessage;
+delete this.previousMessage;
+},
+
+completions: function(wordRange, bestMatchOnly, completionsReadyCallback)
+{
+
+var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOffset, ExpressionStopCharacters, this.promptElement, "backward");
+var expressionString = expressionRange.toString();
+var lastIndex = expressionString.length - 1;
+
+var dotNotation = (expressionString[lastIndex] === ".");
+var bracketNotation = (expressionString[lastIndex] === "[");
+
+if (dotNotation || bracketNotation)
+expressionString = expressionString.substr(0, lastIndex);
+
+var prefix = wordRange.toString();
+if (!expressionString && !prefix)
+return;
+
+var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix);
+
+
+var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation);
+var callFrameId = WebInspector.panels.scripts.selectedCallFrameId();
+var injectedScriptAccess;
+if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
+var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame;
+injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.worldId);
+} else
+injectedScriptAccess = InjectedScriptAccess.getDefault();
+injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions);
+},
+
+_reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) {
+if (isException)
+return;
+
+if (bracketNotation) {
+if (prefix.length && prefix[0] === "'")
+var quoteUsed = "'";
+else
+var quoteUsed = "\"";
+}
+
+var results = [];
+var properties = Object.keys(result).sort();
+
+for (var i = 0; i < properties.length; ++i) {
+var property = properties[i];
+
+if (dotNotation && !/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(property))
+continue;
+
+if (bracketNotation) {
+if (!/^[0-9]+$/.test(property))
+property = quoteUsed + property.escapeCharacters(quoteUsed + "\\") + quoteUsed;
+property += "]";
+}
+
+if (property.length < prefix.length)
+continue;
+if (property.indexOf(prefix) !== 0)
+continue;
+
+results.push(property);
+if (bestMatchOnly)
+break;
+}
+completionsReadyCallback(results);
+},
+
+_clearButtonClicked: function()
+{
+this.requestClearMessages();
+},
+
+_handleContextMenuEvent: function(event)
+{
+if (!window.getSelection().isCollapsed) {
 
-        var dotNotation = (expressionString[lastIndex] === ".");
-        var bracketNotation = (expressionString[lastIndex] === "[");
 
-        if (dotNotation || bracketNotation)
-            expressionString = expressionString.substr(0, lastIndex);
+return;
+}
 
-        var prefix = wordRange.toString();
-        if (!expressionString && !prefix)
-            return;
+var contextMenu = new WebInspector.ContextMenu();
 
-        var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix);
-        // Collect comma separated object properties for the completion.
+function monitoringXHRWasChanged(newState)
+{
+WebInspector.monitoringXHREnabled = newState;
+}
+var itemAction = InspectorBackend.setMonitoringXHREnabled.bind(InspectorBackend, !WebInspector.monitoringXHREnabled, monitoringXHRWasChanged);
+contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), itemAction, WebInspector.monitoringXHREnabled);
+contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this));
+contextMenu.show(event);
+},
 
-        var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation);
-        var callFrameId = WebInspector.panels.scripts.selectedCallFrameId();
-        var injectedScriptAccess;
-        if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
-            var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame;
-            injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.injectedScriptId);
-        } else
-            injectedScriptAccess = InjectedScriptAccess.getDefault();
-        injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions);
-    },
+_messagesSelectStart: function(event)
+{
+if (this._selectionTimeout)
+clearTimeout(this._selectionTimeout);
 
-    _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) {
-        if (isException)
-            return;
+this.prompt.clearAutoComplete();
 
-        if (bracketNotation) {
-            if (prefix.length && prefix[0] === "'")
-                var quoteUsed = "'";
-            else
-                var quoteUsed = "\"";
-        }
+function moveBackIfOutside()
+{
+delete this._selectionTimeout;
+if (!this.prompt.isCaretInsidePrompt() && window.getSelection().isCollapsed)
+this.prompt.moveCaretToEndOfPrompt();
+this.prompt.autoCompleteSoon();
+}
 
-        var results = [];
-        var properties = Object.sortedProperties(result);
+this._selectionTimeout = setTimeout(moveBackIfOutside.bind(this), 100);
+},
 
-        for (var i = 0; i < properties.length; ++i) {
-            var property = properties[i];
+_messagesClicked: function(event)
+{
+var link = event.target.enclosingNodeOrSelfWithNodeName("a");
+if (!link || !link.representedNode)
+return;
 
-            if (dotNotation && !/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(property))
-                continue;
+WebInspector.updateFocusedNode(link.representedNode.id);
+event.stopPropagation();
+event.preventDefault();
+},
 
-            if (bracketNotation) {
-                if (!/^[0-9]+$/.test(property))
-                    property = quoteUsed + property.escapeCharacters(quoteUsed + "\\") + quoteUsed;
-                property += "]";
-            }
+_registerShortcuts: function()
+{
+this._shortcuts = {};
 
-            if (property.length < prefix.length)
-                continue;
-            if (property.indexOf(prefix) !== 0)
-                continue;
+var shortcut = WebInspector.KeyboardShortcut;
+var shortcutK = shortcut.makeDescriptor("k", WebInspector.KeyboardShortcut.Modifiers.Meta);
 
-            results.push(property);
-            if (bestMatchOnly)
-                break;
-        }
-        completionsReadyCallback(results);
-    },
+this._shortcuts[shortcutK.key] = this.requestClearMessages.bind(this);
+this._shortcuts[shortcutK.key].isMacOnly = true;
 
-    _clearButtonClicked: function()
-    {
-        this.requestClearMessages();
-    },
+var clearConsoleHandler = this.requestClearMessages.bind(this);
+var shortcutL = shortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
+this._shortcuts[shortcutL.key] = clearConsoleHandler;
 
-    _handleContextMenuEvent: function(event)
-    {
-        if (!window.getSelection().isCollapsed) {
-            // If there is a selection, we want to show our normal context menu
-            // (with Copy, etc.), and not Clear Console.
-            return;
-        }
+var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("Console"));
+var keys = WebInspector.isMac() ? [ shortcutK.name, shortcutL.name ] : [ shortcutL.name ];
+section.addAlternateKeys(keys, WebInspector.UIString("Clear Console"));
 
-        this._contextMenu.show(event);
-    },
+keys = [
+shortcut.shortcutToString(shortcut.Keys.Tab),
+shortcut.shortcutToString(shortcut.Keys.Tab, shortcut.Modifiers.Shift)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Next/previous suggestion"));
+section.addKey(shortcut.shortcutToString(shortcut.Keys.Right), WebInspector.UIString("Accept suggestion"));
+keys = [
+shortcut.shortcutToString(shortcut.Keys.Down),
+shortcut.shortcutToString(shortcut.Keys.Up)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Next/previous line"));
+keys = [
+shortcut.shortcutToString("N", shortcut.Modifiers.Alt),
+shortcut.shortcutToString("P", shortcut.Modifiers.Alt)
+];
+if (WebInspector.isMac())
+section.addRelatedKeys(keys, WebInspector.UIString("Next/previous command"));
+section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Execute command"));
+},
 
-    _messagesSelectStart: function(event)
-    {
-        if (this._selectionTimeout)
-            clearTimeout(this._selectionTimeout);
+_promptKeyDown: function(event)
+{
+if (isEnterKey(event)) {
+this._enterKeyPressed(event);
+return;
+}
 
-        this.prompt.clearAutoComplete();
+var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+var handler = this._shortcuts[shortcut];
+if (handler) {
+if (!this._shortcuts[shortcut].isMacOnly || WebInspector.isMac()) {
+handler();
+event.preventDefault();
+return;
+}
+}
+},
 
-        function moveBackIfOutside()
-        {
-            delete this._selectionTimeout;
-            if (!this.prompt.isCaretInsidePrompt() && window.getSelection().isCollapsed)
-                this.prompt.moveCaretToEndOfPrompt();
-            this.prompt.autoCompleteSoon();
-        }
+evalInInspectedWindow: function(expression, objectGroup, callback)
+{
+if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
+WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, objectGroup, callback);
+return;
+}
+this.doEvalInWindow(expression, objectGroup, callback);
+},
 
-        this._selectionTimeout = setTimeout(moveBackIfOutside.bind(this), 100);
-    },
+doEvalInWindow: function(expression, objectGroup, callback)
+{
+if (!expression) {
 
-    _messagesClicked: function(event)
-    {
-        var link = event.target.enclosingNodeOrSelfWithNodeName("a");
-        if (!link || !link.representedNode)
-            return;
+expression = "this";
+}
 
-        WebInspector.updateFocusedNode(link.representedNode.id);
-        event.stopPropagation();
-        event.preventDefault();
-    },
+function evalCallback(result)
+{
+callback(WebInspector.RemoteObject.fromPayload(result));
+};
+InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback);
+},
 
-    _promptKeyDown: function(event)
-    {
-        if (isEnterKey(event)) {
-            this._enterKeyPressed(event);
-            return;
-        }
+_enterKeyPressed: function(event)
+{
+if (event.altKey || event.ctrlKey || event.shiftKey)
+return;
 
-        var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
-        var handler = this._shortcuts[shortcut];
-        if (handler) {
-            if (!this._shortcuts[shortcut].isMacOnly || WebInspector.isMac()) {
-                handler();
-                event.preventDefault();
-                return;
-            }
-        }
-    },
+event.preventDefault();
+event.stopPropagation();
 
-    evalInInspectedWindow: function(expression, objectGroup, callback)
-    {
-        if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) {
-            WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, objectGroup, callback);
-            return;
-        }
-        this.doEvalInWindow(expression, objectGroup, callback);
-    },
+this.prompt.clearAutoComplete(true);
 
-    doEvalInWindow: function(expression, objectGroup, callback)
-    {
-        if (!expression) {
-            // There is no expression, so the completion should happen against global properties.
-            expression = "this";
-        }
+var str = this.prompt.text;
+if (!str.length)
+return;
 
-        function evalCallback(result)
-        {
-            callback(result.value, result.isException);
-        };
-        InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback);
-    },
+var commandMessage = new WebInspector.ConsoleCommand(str);
+this.addMessage(commandMessage);
 
-    _enterKeyPressed: function(event)
-    {
-        if (event.altKey)
-            return;
+var self = this;
+function printResult(result)
+{
+self.prompt.history.push(str);
+self.prompt.historyOffset = 0;
+self.prompt.text = "";
 
-        event.preventDefault();
-        event.stopPropagation();
+WebInspector.settings.consoleHistory = self.prompt.history.slice(-30);
 
-        this.prompt.clearAutoComplete(true);
+self.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
+}
+this.evalInInspectedWindow(str, "console", printResult);
+},
 
-        var str = this.prompt.text;
-        if (!str.length)
-            return;
+_format: function(output, forceObjectFormat)
+{
+var isProxy = (output != null && typeof output === "object");
+var type = (forceObjectFormat ? "object" : WebInspector.RemoteObject.type(output));
 
-        var commandMessage = new WebInspector.ConsoleCommand(str);
-        this.addMessage(commandMessage);
+var formatter = this._customFormatters[type];
+if (!formatter || !isProxy) {
+formatter = this._formatvalue;
+output = output.description;
+}
 
-        var self = this;
-        function printResult(result, exception)
-        {
-            self.prompt.history.push(str);
-            self.prompt.historyOffset = 0;
-            self.prompt.text = "";
-            self.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
-        }
-        this.evalInInspectedWindow(str, "console", printResult);
-    },
+var span = document.createElement("span");
+span.className = "console-formatted-" + type + " source-code";
+formatter.call(this, output, span);
+return span;
+},
 
-    _format: function(output, forceObjectFormat)
-    {
-        var isProxy = (output != null && typeof output === "object");
-        var type = (forceObjectFormat ? "object" : Object.proxyType(output));
+_formatvalue: function(val, elem)
+{
+elem.appendChild(document.createTextNode(val));
+},
 
-        var formatter = this._customFormatters[type];
-        if (!formatter || !isProxy) {
-            formatter = this._formatvalue;
-            output = output.description;
-        }
+_formatobject: function(obj, elem)
+{
+elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element);
+},
 
-        var span = document.createElement("span");
-        span.className = "console-formatted-" + type + " source-code";
-        formatter.call(this, output, span);
-        return span;
-    },
+_formatnode: function(object, elem)
+{
+function printNode(nodeId)
+{
+if (!nodeId)
+return;
+var treeOutline = new WebInspector.ElementsTreeOutline();
+treeOutline.showInElementsPanelEnabled = true;
+treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId);
+treeOutline.element.addStyleClass("outline-disclosure");
+if (!treeOutline.children[0].hasChildren)
+treeOutline.element.addStyleClass("single-node");
+elem.appendChild(treeOutline.element);
+}
 
-    _formatvalue: function(val, elem)
-    {
-        elem.appendChild(document.createTextNode(val));
-    },
+object.pushNodeToFrontend(printNode);
+},
 
-    _formatobject: function(obj, elem)
-    {
-        elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element);
-    },
+_formatarray: function(arr, elem)
+{
+arr.getOwnProperties(false, this._printArray.bind(this, elem));
+},
 
-    _formatnode: function(object, elem)
-    {
-        function printNode(nodeId)
-        {
-            if (!nodeId)
-                return;
-            var treeOutline = new WebInspector.ElementsTreeOutline();
-            treeOutline.showInElementsPanelEnabled = true;
-            treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId);
-            treeOutline.element.addStyleClass("outline-disclosure");
-            if (!treeOutline.children[0].hasChildren)
-                treeOutline.element.addStyleClass("single-node");
-            elem.appendChild(treeOutline.element);
-        }
+_formatstring: function(output, elem)
+{
+var span = document.createElement("span");
+span.className = "console-formatted-string source-code";
+span.appendChild(WebInspector.linkifyStringAsFragment(output.description));
 
-        InjectedScriptAccess.get(object.injectedScriptId).pushNodeToFrontend(object, printNode);
-    },
 
-    _formatarray: function(arr, elem)
-    {
-        InjectedScriptAccess.get(arr.injectedScriptId).getProperties(arr, false, false, this._printArray.bind(this, elem));
-    },
+elem.removeStyleClass("console-formatted-string");
+elem.appendChild(document.createTextNode("\""));
+elem.appendChild(span);
+elem.appendChild(document.createTextNode("\""));
+},
 
-    _formatstring: function(output, elem)
-    {
-        var span = document.createElement("span");
-        span.className = "console-formatted-string source-code";
-        span.appendChild(WebInspector.linkifyStringAsFragment(output.description));
+_printArray: function(elem, properties)
+{
+if (!properties)
+return;
 
-        // Make black quotes.
-        elem.removeStyleClass("console-formatted-string");
-        elem.appendChild(document.createTextNode("\""));
-        elem.appendChild(span);
-        elem.appendChild(document.createTextNode("\""));
-    },
+var elements = [];
+for (var i = 0; i < properties.length; ++i) {
+var name = properties[i].name;
+if (name == parseInt(name))
+elements[name] = this._formatAsArrayEntry(properties[i].value);
+}
 
-    _printArray: function(elem, properties)
-    {
-        if (!properties)
-            return;
+elem.appendChild(document.createTextNode("["));
+for (var i = 0; i < elements.length; ++i) {
+var element = elements[i];
+if (element)
+elem.appendChild(element);
+else
+elem.appendChild(document.createTextNode("undefined"))
+if (i < elements.length - 1)
+elem.appendChild(document.createTextNode(", "));
+}
+elem.appendChild(document.createTextNode("]"));
+},
 
-        var elements = [];
-        for (var i = 0; i < properties.length; ++i) {
-            var name = properties[i].name;
-            if (name == parseInt(name))
-                elements[name] = this._format(properties[i].value);
-        }
+_formatAsArrayEntry: function(output)
+{
 
-        elem.appendChild(document.createTextNode("["));
-        for (var i = 0; i < elements.length; ++i) {
-            var element = elements[i];
-            if (element)
-                elem.appendChild(element);
-            else
-                elem.appendChild(document.createTextNode("undefined"))
-            if (i < elements.length - 1)
-                elem.appendChild(document.createTextNode(", "));
-        }
-        elem.appendChild(document.createTextNode("]"));
-    }
+return this._format(output, WebInspector.RemoteObject.type(output) === "array");
+}
 }
 
 WebInspector.ConsoleView.prototype.__proto__ = WebInspector.View.prototype;
 
-WebInspector.ConsoleMessage = function(source, type, level, line, url, groupLevel, repeatCount)
+WebInspector.ConsoleMessage = function(source, type, level, line, url, repeatCount, message, parameters, stackTrace)
 {
-    this.source = source;
-    this.type = type;
-    this.level = level;
-    this.line = line;
-    this.url = url;
-    this.groupLevel = groupLevel;
-    this.repeatCount = repeatCount;
-    this.repeatDelta = repeatCount;
-    this.totalRepeatCount = repeatCount;
-    if (arguments.length > 7)
-        this.setMessageBody(Array.prototype.slice.call(arguments, 7));
+this.source = source;
+this.type = type;
+this.level = level;
+this.line = line;
+this.url = url;
+this.repeatCount = repeatCount;
+this.repeatDelta = repeatCount;
+this.totalRepeatCount = repeatCount;
+this._messageText = message;
+this._parameters = parameters;
+this._stackTrace = stackTrace;
+this._formatMessage();
+}
+
+WebInspector.ConsoleMessage.createTextMessage = function(text, level)
+{
+level = level || WebInspector.ConsoleMessage.MessageLevel.Log;
+return new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, 0, null, 1, null, [text], null);
 }
 
 WebInspector.ConsoleMessage.prototype = {
-    setMessageBody: function(args)
-    {
-        this.args = args;
-        switch (this.type) {
-            case WebInspector.ConsoleMessage.MessageType.Trace:
-                var span = document.createElement("span");
-                span.className = "console-formatted-trace source-code";
-                var stack = Array.prototype.slice.call(args);
-                var funcNames = stack.map(function(f) {
-                    return f || WebInspector.UIString("(anonymous function)");
-                });
-                span.appendChild(document.createTextNode(funcNames.join("\n")));
-                this.formattedMessage = span;
-                break;
-            case WebInspector.ConsoleMessage.MessageType.Object:
-                this.formattedMessage = this._format(["%O", args[0]]);
-                break;
-            default:
-                this.formattedMessage = this._format(args);
-                break;
-        }
+_formatMessage: function()
+{
+switch (this.type) {
+case WebInspector.ConsoleMessage.MessageType.Assert:
+case WebInspector.ConsoleMessage.MessageType.Trace:
+case WebInspector.ConsoleMessage.MessageType.UncaughtException:
+var ol = document.createElement("ol");
+ol.className = "outline-disclosure";
+var treeOutline = new TreeOutline(ol);
+var messageText;
+if (this.type === WebInspector.ConsoleMessage.MessageType.Assert)
+messageText = this._format(this._parameters);
+else if (this.type === WebInspector.ConsoleMessage.MessageType.Trace)
+messageText = document.createTextNode("console.trace()");
+else
+messageText = document.createTextNode(this._messageText);
 
-        // This is used for inline message bubbles in SourceFrames, or other plain-text representations.
-        this.message = this.formattedMessage.textContent;
-    },
+var content = document.createElement("div");
+this._addMessageHeader(content, messageText);
+var root = new TreeElement(content, null, true);
+content.treeElementForTest = root;
+treeOutline.appendChild(root);
+if (this.type === WebInspector.ConsoleMessage.MessageType.Trace)
+root.expand();
 
-    isErrorOrWarning: function()
-    {
-        return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error);
-    },
-
-    _format: function(parameters)
-    {
-        // This node is used like a Builder. Values are continually appended onto it.
-        var formattedResult = document.createElement("span");
-        if (!parameters.length)
-            return formattedResult;
-
-        // Formatting code below assumes that parameters are all wrappers whereas frontend console
-        // API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here.
-        for (var i = 0; i < parameters.length; ++i)
-            if (typeof parameters[i] !== "object" && typeof parameters[i] !== "function")
-                parameters[i] = WebInspector.ObjectProxy.wrapPrimitiveValue(parameters[i]);
-
-        // There can be string log and string eval result. We distinguish between them based on message type.
-        var shouldFormatMessage = Object.proxyType(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
-
-        // Multiple parameters with the first being a format string. Save unused substitutions.
-        if (shouldFormatMessage) {
-            // Multiple parameters with the first being a format string. Save unused substitutions.
-            var result = this._formatWithSubstitutionString(parameters, formattedResult);
-            parameters = result.unusedSubstitutions;
-            if (parameters.length)
-                formattedResult.appendChild(document.createTextNode(" "));
-        }
-
-        // Single parameter, or unused substitutions from above.
-        for (var i = 0; i < parameters.length; ++i) {
-            // Inline strings when formatting.
-            if (shouldFormatMessage && parameters[i].type === "string")
-                formattedResult.appendChild(document.createTextNode(parameters[i].description));
-            else
-                formattedResult.appendChild(WebInspector.console._format(parameters[i]));
-            if (i < parameters.length - 1)
-                formattedResult.appendChild(document.createTextNode(" "));
-        }
-        return formattedResult;
-    },
-
-    _formatWithSubstitutionString: function(parameters, formattedResult)
-    {
-        var formatters = {}
-        for (var i in String.standardFormatters)
-            formatters[i] = String.standardFormatters[i];
-
-        function consoleFormatWrapper(force)
-        {
-            return function(obj) {
-                return WebInspector.console._format(obj, force);
-            };
-        }
-
-        // Firebug uses %o for formatting objects.
-        formatters.o = consoleFormatWrapper();
-        // Firebug allows both %i and %d for formatting integers.
-        formatters.i = formatters.d;
-        // Support %O to force object formatting, instead of the type-based %o formatting.
-        formatters.O = consoleFormatWrapper(true);
-
-        function append(a, b)
-        {
-            if (!(b instanceof Node))
-                a.appendChild(WebInspector.linkifyStringAsFragment(b.toString()));
-            else
-                a.appendChild(b);
-            return a;
-        }
-
-        // String.format does treat formattedResult like a Builder, result is an object.
-        return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append);
-    },
-
-    toMessageElement: function()
-    {
-        if (this._element)
-            return this._element;
-
-        var element = document.createElement("div");
-        element.message = this;
-        element.className = "console-message";
-
-        this._element = element;
-
-        switch (this.source) {
-            case WebInspector.ConsoleMessage.MessageSource.HTML:
-                element.addStyleClass("console-html-source");
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.WML:
-                element.addStyleClass("console-wml-source");
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.XML:
-                element.addStyleClass("console-xml-source");
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.JS:
-                element.addStyleClass("console-js-source");
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.CSS:
-                element.addStyleClass("console-css-source");
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.Other:
-                element.addStyleClass("console-other-source");
-                break;
-        }
-
-        switch (this.level) {
-            case WebInspector.ConsoleMessage.MessageLevel.Tip:
-                element.addStyleClass("console-tip-level");
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Log:
-                element.addStyleClass("console-log-level");
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Debug:
-                element.addStyleClass("console-debug-level");
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Warning:
-                element.addStyleClass("console-warning-level");
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Error:
-                element.addStyleClass("console-error-level");
-                break;
-        }
-        
-        if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup)
-            element.addStyleClass("console-group-title");
-
-        if (this.elementsTreeOutline) {
-            element.addStyleClass("outline-disclosure");
-            element.appendChild(this.elementsTreeOutline.element);
-            return element;
-        }
-
-        if (this.url && this.url !== "undefined") {
-            var urlElement = document.createElement("a");
-            urlElement.className = "console-message-url webkit-html-resource-link";
-            urlElement.href = this.url;
-            urlElement.lineNumber = this.line;
-
-            if (this.source === WebInspector.ConsoleMessage.MessageSource.JS)
-                urlElement.preferredPanel = "scripts";
-
-            if (this.line > 0)
-                urlElement.textContent = WebInspector.displayNameForURL(this.url) + ":" + this.line;
-            else
-                urlElement.textContent = WebInspector.displayNameForURL(this.url);
-
-            element.appendChild(urlElement);
-        }
-
-        var messageTextElement = document.createElement("span");
-        messageTextElement.className = "console-message-text source-code";
-        if (this.type === WebInspector.ConsoleMessage.MessageType.Assert)
-            messageTextElement.appendChild(document.createTextNode(WebInspector.UIString("Assertion failed: ")));
-        messageTextElement.appendChild(this.formattedMessage);
-        element.appendChild(messageTextElement);
-
-        if (this.repeatCount > 1)
-            this._updateRepeatCount();
-
-        return element;
-    },
-
-    _updateRepeatCount: function() {
-        if (!this.repeatCountElement) {
-            this.repeatCountElement = document.createElement("span");
-            this.repeatCountElement.className = "bubble";
-    
-            this._element.insertBefore(this.repeatCountElement, this._element.firstChild);
-            this._element.addStyleClass("repeated-message");
-        }
-        this.repeatCountElement.textContent = this.repeatCount;
-    },
-
-    toString: function()
-    {
-        var sourceString;
-        switch (this.source) {
-            case WebInspector.ConsoleMessage.MessageSource.HTML:
-                sourceString = "HTML";
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.WML:
-                sourceString = "WML";
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.XML:
-                sourceString = "XML";
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.JS:
-                sourceString = "JS";
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.CSS:
-                sourceString = "CSS";
-                break;
-            case WebInspector.ConsoleMessage.MessageSource.Other:
-                sourceString = "Other";
-                break;
-        }
-
-        var typeString;
-        switch (this.type) {
-            case WebInspector.ConsoleMessage.MessageType.Log:
-                typeString = "Log";
-                break;
-            case WebInspector.ConsoleMessage.MessageType.Object:
-                typeString = "Object";
-                break;
-            case WebInspector.ConsoleMessage.MessageType.Trace:
-                typeString = "Trace";
-                break;
-            case WebInspector.ConsoleMessage.MessageType.StartGroup:
-                typeString = "Start Group";
-                break;
-            case WebInspector.ConsoleMessage.MessageType.EndGroup:
-                typeString = "End Group";
-                break;
-            case WebInspector.ConsoleMessage.MessageType.Assert:
-                typeString = "Assert";
-                break;
-            case WebInspector.ConsoleMessage.MessageType.Result:
-                typeString = "Result";
-                break;
-        }
-        
-        var levelString;
-        switch (this.level) {
-            case WebInspector.ConsoleMessage.MessageLevel.Tip:
-                levelString = "Tip";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Log:
-                levelString = "Log";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Warning:
-                levelString = "Warning";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Debug:
-                levelString = "Debug";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Error:
-                levelString = "Error";
-                break;
-        }
-
-        return sourceString + " " + typeString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
-    },
-
-    isEqual: function(msg, disreguardGroup)
-    {
-        if (!msg)
-            return false;
-
-        var ret = (this.source == msg.source)
-            && (this.type == msg.type)
-            && (this.level == msg.level)
-            && (this.line == msg.line)
-            && (this.url == msg.url)
-            && (this.message == msg.message);
-
-        return (disreguardGroup ? ret : (ret && (this.groupLevel == msg.groupLevel)));
-    }
+this._populateStackTraceTreeElement(root);
+this.formattedMessage = ol;
+break;
+case WebInspector.ConsoleMessage.MessageType.Object:
+var obj = this._parameters ? this._parameters[0] : undefined;
+this.formattedMessage = this._format(["%O", obj]);
+break;
+default:
+var args = this._parameters || [this._messageText];
+this.formattedMessage = this._format(args);
+break;
 }
 
-// Note: Keep these constants in sync with the ones in Console.h
+
+this.message = this.formattedMessage.textContent;
+},
+
+isErrorOrWarning: function()
+{
+return (this.level === WebInspector.ConsoleMessage.MessageLevel.Warning || this.level === WebInspector.ConsoleMessage.MessageLevel.Error);
+},
+
+_format: function(parameters)
+{
+
+var formattedResult = document.createElement("span");
+if (!parameters.length)
+return formattedResult;
+
+
+
+for (var i = 0; i < parameters.length; ++i) {
+if (typeof parameters[i] === "object")
+parameters[i] = WebInspector.RemoteObject.fromPayload(parameters[i]);
+else
+parameters[i] = WebInspector.RemoteObject.fromPrimitiveValue(parameters[i]);
+}
+
+
+var shouldFormatMessage = WebInspector.RemoteObject.type(parameters[0]) === "string" && this.type !== WebInspector.ConsoleMessage.MessageType.Result;
+
+
+if (shouldFormatMessage) {
+
+var result = this._formatWithSubstitutionString(parameters, formattedResult);
+parameters = result.unusedSubstitutions;
+if (parameters.length)
+formattedResult.appendChild(document.createTextNode(" "));
+}
+
+
+for (var i = 0; i < parameters.length; ++i) {
+
+if (shouldFormatMessage && parameters[i].type === "string")
+formattedResult.appendChild(document.createTextNode(parameters[i].description));
+else
+formattedResult.appendChild(WebInspector.console._format(parameters[i]));
+if (i < parameters.length - 1)
+formattedResult.appendChild(document.createTextNode(" "));
+}
+return formattedResult;
+},
+
+_formatWithSubstitutionString: function(parameters, formattedResult)
+{
+var formatters = {}
+for (var i in String.standardFormatters)
+formatters[i] = String.standardFormatters[i];
+
+function consoleFormatWrapper(force)
+{
+return function(obj) {
+return WebInspector.console._format(obj, force);
+};
+}
+
+
+formatters.o = consoleFormatWrapper();
+
+formatters.i = formatters.d;
+
+formatters.O = consoleFormatWrapper(true);
+
+function append(a, b)
+{
+if (!(b instanceof Node))
+a.appendChild(WebInspector.linkifyStringAsFragment(b.toString()));
+else
+a.appendChild(b);
+return a;
+}
+
+
+return String.format(parameters[0].description, parameters.slice(1), formatters, formattedResult, append);
+},
+
+toMessageElement: function()
+{
+if (this._element)
+return this._element;
+
+var element = document.createElement("div");
+element.message = this;
+element.className = "console-message";
+
+this._element = element;
+
+switch (this.level) {
+case WebInspector.ConsoleMessage.MessageLevel.Tip:
+element.addStyleClass("console-tip-level");
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Log:
+element.addStyleClass("console-log-level");
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Debug:
+element.addStyleClass("console-debug-level");
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Warning:
+element.addStyleClass("console-warning-level");
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Error:
+element.addStyleClass("console-error-level");
+break;
+}
+
+if (this.type === WebInspector.ConsoleMessage.MessageType.StartGroup || this.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
+element.addStyleClass("console-group-title");
+
+if (this.elementsTreeOutline) {
+element.addStyleClass("outline-disclosure");
+element.appendChild(this.elementsTreeOutline.element);
+return element;
+}
+
+if (this.type === WebInspector.ConsoleMessage.MessageType.Trace ||
+this.type === WebInspector.ConsoleMessage.MessageType.Assert ||
+this.type === WebInspector.ConsoleMessage.MessageType.UncaughtException)
+element.appendChild(this.formattedMessage);
+else
+this._addMessageHeader(element, this.formattedMessage);
+
+if (this.repeatCount > 1)
+this._updateRepeatCount();
+
+return element;
+},
+
+_populateStackTraceTreeElement: function(parentTreeElement)
+{
+for (var i = 0; i < this._stackTrace.length; i++) {
+var frame = this._stackTrace[i];
+
+var content = document.createElement("div");
+var messageTextElement = document.createElement("span");
+messageTextElement.className = "console-message-text source-code";
+var functionName = frame.functionName || WebInspector.UIString("(anonymous function)");
+messageTextElement.appendChild(document.createTextNode(functionName));
+content.appendChild(messageTextElement);
+
+var urlElement = WebInspector.linkifyResourceAsNode(frame.scriptName, "scripts", frame.lineNumber, "console-message-url");
+content.appendChild(urlElement);
+
+var treeElement = new TreeElement(content);
+parentTreeElement.appendChild(treeElement);
+}
+},
+
+_addMessageHeader: function(parentElement, formattedMessage)
+{
+if (this.url && this.url !== "undefined") {
+var urlElement = WebInspector.linkifyResourceAsNode(this.url, "scripts", this.line, "console-message-url");
+parentElement.appendChild(urlElement);
+}
+
+var messageTextElement = document.createElement("span");
+messageTextElement.className = "console-message-text source-code";
+if (this.type === WebInspector.ConsoleMessage.MessageType.Assert)
+messageTextElement.appendChild(document.createTextNode(WebInspector.UIString("Assertion failed: ")));
+messageTextElement.appendChild(formattedMessage);
+parentElement.appendChild(messageTextElement);
+},
+
+_updateRepeatCount: function() {
+if (!this.repeatCountElement) {
+this.repeatCountElement = document.createElement("span");
+this.repeatCountElement.className = "bubble";
+
+this._element.insertBefore(this.repeatCountElement, this._element.firstChild);
+this._element.addStyleClass("repeated-message");
+}
+this.repeatCountElement.textContent = this.repeatCount;
+},
+
+toString: function()
+{
+var sourceString;
+switch (this.source) {
+case WebInspector.ConsoleMessage.MessageSource.HTML:
+sourceString = "HTML";
+break;
+case WebInspector.ConsoleMessage.MessageSource.WML:
+sourceString = "WML";
+break;
+case WebInspector.ConsoleMessage.MessageSource.XML:
+sourceString = "XML";
+break;
+case WebInspector.ConsoleMessage.MessageSource.JS:
+sourceString = "JS";
+break;
+case WebInspector.ConsoleMessage.MessageSource.CSS:
+sourceString = "CSS";
+break;
+case WebInspector.ConsoleMessage.MessageSource.Other:
+sourceString = "Other";
+break;
+}
+
+var typeString;
+switch (this.type) {
+case WebInspector.ConsoleMessage.MessageType.Log:
+case WebInspector.ConsoleMessage.MessageType.UncaughtException:
+typeString = "Log";
+break;
+case WebInspector.ConsoleMessage.MessageType.Object:
+typeString = "Object";
+break;
+case WebInspector.ConsoleMessage.MessageType.Trace:
+typeString = "Trace";
+break;
+case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:
+case WebInspector.ConsoleMessage.MessageType.StartGroup:
+typeString = "Start Group";
+break;
+case WebInspector.ConsoleMessage.MessageType.EndGroup:
+typeString = "End Group";
+break;
+case WebInspector.ConsoleMessage.MessageType.Assert:
+typeString = "Assert";
+break;
+case WebInspector.ConsoleMessage.MessageType.Result:
+typeString = "Result";
+break;
+}
+
+var levelString;
+switch (this.level) {
+case WebInspector.ConsoleMessage.MessageLevel.Tip:
+levelString = "Tip";
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Log:
+levelString = "Log";
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Warning:
+levelString = "Warning";
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Debug:
+levelString = "Debug";
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Error:
+levelString = "Error";
+break;
+}
+
+return sourceString + " " + typeString + " " + levelString + ": " + this.formattedMessage.textContent + "\n" + this.url + " line " + this.line;
+},
+
+isEqual: function(msg, disreguardGroup)
+{
+if (!msg)
+return false;
+
+return (this.source === msg.source)
+&& (this.type === msg.type)
+&& (this.level === msg.level)
+&& (this.line === msg.line)
+&& (this.url === msg.url)
+&& (this.message === msg.message);
+}
+}
+
+
 WebInspector.ConsoleMessage.MessageSource = {
-    HTML: 0,
-    WML: 1,
-    XML: 2,
-    JS: 3,
-    CSS: 4,
-    Other: 5
+HTML: 0,
+WML: 1,
+XML: 2,
+JS: 3,
+CSS: 4,
+Other: 5
 }
 
 WebInspector.ConsoleMessage.MessageType = {
-    Log: 0,
-    Object: 1,
-    Trace: 2,
-    StartGroup: 3,
-    EndGroup: 4,
-    Assert: 5,
-    Result: 6
+Log: 0,
+Object: 1,
+Trace: 2,
+StartGroup: 3,
+StartGroupCollapsed: 4,
+EndGroup: 5,
+Assert: 6,
+UncaughtException: 7,
+Result: 8
 }
 
 WebInspector.ConsoleMessage.MessageLevel = {
-    Tip: 0,
-    Log: 1,
-    Warning: 2,
-    Error: 3,
-    Debug: 4
+Tip: 0,
+Log: 1,
+Warning: 2,
+Error: 3,
+Debug: 4
 }
 
 WebInspector.ConsoleCommand = function(command)
 {
-    this.command = command;
+this.command = command;
 }
 
 WebInspector.ConsoleCommand.prototype = {
-    toMessageElement: function()
-    {
-        var element = document.createElement("div");
-        element.command = this;
-        element.className = "console-user-command";
+toMessageElement: function()
+{
+var element = document.createElement("div");
+element.command = this;
+element.className = "console-user-command";
 
-        var commandTextElement = document.createElement("span");
-        commandTextElement.className = "console-message-text source-code";
-        commandTextElement.textContent = this.command;
-        element.appendChild(commandTextElement);
+var commandTextElement = document.createElement("span");
+commandTextElement.className = "console-message-text source-code";
+commandTextElement.textContent = this.command;
+element.appendChild(commandTextElement);
 
-        return element;
-    }
+return element;
+}
 }
 
-WebInspector.ConsoleTextMessage = function(text, level)
+WebInspector.ConsoleCommandResult = function(result, originatingCommand)
 {
-    level = level || WebInspector.ConsoleMessage.MessageLevel.Log;
-    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Log, level, 0, null, null, 1, text);
-}
-
-WebInspector.ConsoleTextMessage.prototype.__proto__ = WebInspector.ConsoleMessage.prototype;
-
-WebInspector.ConsoleCommandResult = function(result, exception, originatingCommand)
-{
-    var level = (exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
-    var message = result;
-    if (exception) {
-        // Distinguish between strings and errors (no need to quote latter).
-        message = WebInspector.ObjectProxy.wrapPrimitiveValue(result);
-        message.type = "error";
-    }
-    var line = (exception ? result.line : -1);
-    var url = (exception ? result.sourceURL : null);
-
-    this.originatingCommand = originatingCommand;
-
-    WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, line, url, null, 1, message);
+var level = (result.isError() ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log);
+this.originatingCommand = originatingCommand;
+WebInspector.ConsoleMessage.call(this, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.ConsoleMessage.MessageType.Result, level, -1, null, 1, null, [result]);
 }
 
 WebInspector.ConsoleCommandResult.prototype = {
-    toMessageElement: function()
-    {
-        var element = WebInspector.ConsoleMessage.prototype.toMessageElement.call(this);
-        element.addStyleClass("console-user-command-result");
-        return element;
-    }
+toMessageElement: function()
+{
+var element = WebInspector.ConsoleMessage.prototype.toMessageElement.call(this);
+element.addStyleClass("console-user-command-result");
+return element;
+}
 }
 
 WebInspector.ConsoleCommandResult.prototype.__proto__ = WebInspector.ConsoleMessage.prototype;
 
-WebInspector.ConsoleGroup = function(parentGroup, level)
+WebInspector.ConsoleGroup = function(parentGroup)
 {
-    this.parentGroup = parentGroup;
-    this.level = level;
+this.parentGroup = parentGroup;
 
-    var element = document.createElement("div");
-    element.className = "console-group";
-    element.group = this;
-    this.element = element;
+var element = document.createElement("div");
+element.className = "console-group";
+element.group = this;
+this.element = element;
 
-    var messagesElement = document.createElement("div");
-    messagesElement.className = "console-group-messages";
-    element.appendChild(messagesElement);
-    this.messagesElement = messagesElement;
+var messagesElement = document.createElement("div");
+messagesElement.className = "console-group-messages";
+element.appendChild(messagesElement);
+this.messagesElement = messagesElement;
 }
 
 WebInspector.ConsoleGroup.prototype = {
-    addMessage: function(msg)
-    {
-        var element = msg.toMessageElement();
-        
-        if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup) {
-            this.messagesElement.parentNode.insertBefore(element, this.messagesElement);
-            element.addEventListener("click", this._titleClicked.bind(this), true);
-        } else
-            this.messagesElement.appendChild(element);
-
-        if (element.previousSibling && msg.originatingCommand && element.previousSibling.command === msg.originatingCommand)
-            element.previousSibling.addStyleClass("console-adjacent-user-command-result");
-    },
-
-    _titleClicked: function(event)
-    {
-        var groupTitleElement = event.target.enclosingNodeOrSelfWithClass("console-group-title");
-        if (groupTitleElement) {
-            var groupElement = groupTitleElement.enclosingNodeOrSelfWithClass("console-group");
-            if (groupElement)
-                if (groupElement.hasStyleClass("collapsed"))
-                    groupElement.removeStyleClass("collapsed");
-                else
-                    groupElement.addStyleClass("collapsed");
-            groupTitleElement.scrollIntoViewIfNeeded(true);
-        }
-
-        event.stopPropagation();
-        event.preventDefault();
-    }
-}
-
-/* Panel.js */
-
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.Panel = function()
+addMessage: function(msg)
 {
-    WebInspector.View.call(this);
+var element = msg.toMessageElement();
 
-    this.element.addStyleClass("panel");
+if (msg.type === WebInspector.ConsoleMessage.MessageType.StartGroup || msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed) {
+this.messagesElement.parentNode.insertBefore(element, this.messagesElement);
+element.addEventListener("click", this._titleClicked.bind(this), false);
+var groupElement = element.enclosingNodeOrSelfWithClass("console-group");
+if (groupElement && msg.type === WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
+groupElement.addStyleClass("collapsed");
+} else
+this.messagesElement.appendChild(element);
+
+if (element.previousSibling && msg.originatingCommand && element.previousSibling.command === msg.originatingCommand)
+element.previousSibling.addStyleClass("console-adjacent-user-command-result");
+},
+
+_titleClicked: function(event)
+{
+var groupTitleElement = event.target.enclosingNodeOrSelfWithClass("console-group-title");
+if (groupTitleElement) {
+var groupElement = groupTitleElement.enclosingNodeOrSelfWithClass("console-group");
+if (groupElement)
+if (groupElement.hasStyleClass("collapsed"))
+groupElement.removeStyleClass("collapsed");
+else
+groupElement.addStyleClass("collapsed");
+groupTitleElement.scrollIntoViewIfNeeded(true);
 }
 
+event.stopPropagation();
+event.preventDefault();
+}
+}
+
+
+
+
+
+
+WebInspector.Panel = function(name)
+{
+WebInspector.View.call(this);
+
+this.element.addStyleClass("panel");
+this.element.addStyleClass(name);
+this._panelName = name;
+
+WebInspector.settings.installApplicationSetting(this._sidebarWidthSettingName(), undefined);
+}
+
+
+WebInspector.Panel.counterRightMargin = 25;
+
 WebInspector.Panel.prototype = {
-    get toolbarItem()
-    {
-        if (this._toolbarItem)
-            return this._toolbarItem;
+get toolbarItem()
+{
+if (this._toolbarItem)
+return this._toolbarItem;
 
-        // Sample toolbar item as markup:
-        // <button class="toolbar-item resources toggleable">
-        // <div class="toolbar-icon"></div>
-        // <div class="toolbar-label">Resources</div>
-        // </button>
 
-        this._toolbarItem = document.createElement("button");
-        this._toolbarItem.className = "toolbar-item toggleable";
-        this._toolbarItem.panel = this;
 
-        if ("toolbarItemClass" in this)
-            this._toolbarItem.addStyleClass(this.toolbarItemClass);
 
-        var iconElement = document.createElement("div");
-        iconElement.className = "toolbar-icon";
-        this._toolbarItem.appendChild(iconElement);
 
-        if ("toolbarItemLabel" in this) {
-            var labelElement = document.createElement("div");
-            labelElement.className = "toolbar-label";
-            labelElement.textContent = this.toolbarItemLabel;
-            this._toolbarItem.appendChild(labelElement);
-        }
 
-        return this._toolbarItem;
-    },
 
-    show: function()
-    {
-        WebInspector.View.prototype.show.call(this);
+this._toolbarItem = document.createElement("button");
+this._toolbarItem.className = "toolbar-item toggleable";
+this._toolbarItem.panel = this;
 
-        var statusBarItems = this.statusBarItems;
-        if (statusBarItems) {
-            this._statusBarItemContainer = document.createElement("div");
-            for (var i = 0; i < statusBarItems.length; ++i)
-                this._statusBarItemContainer.appendChild(statusBarItems[i]);
-            document.getElementById("main-status-bar").appendChild(this._statusBarItemContainer);
-        }
+this._toolbarItem.addStyleClass(this._panelName);
 
-        if ("_toolbarItem" in this)
-            this._toolbarItem.addStyleClass("toggled-on");
+var iconElement = document.createElement("div");
+iconElement.className = "toolbar-icon";
+this._toolbarItem.appendChild(iconElement);
 
-        WebInspector.currentFocusElement = this.defaultFocusedElement;
+if ("toolbarItemLabel" in this) {
+var labelElement = document.createElement("div");
+labelElement.className = "toolbar-label";
+labelElement.textContent = this.toolbarItemLabel;
+this._toolbarItem.appendChild(labelElement);
+}
 
-        this.updateSidebarWidth();
-    },
+return this._toolbarItem;
+},
 
-    hide: function()
-    {
-        WebInspector.View.prototype.hide.call(this);
+get name()
+{
+return this._panelName;
+},
 
-        if (this._statusBarItemContainer && this._statusBarItemContainer.parentNode)
-            this._statusBarItemContainer.parentNode.removeChild(this._statusBarItemContainer);
-        delete this._statusBarItemContainer;
-        if ("_toolbarItem" in this)
-            this._toolbarItem.removeStyleClass("toggled-on");
-    },
+show: function()
+{
+WebInspector.View.prototype.show.call(this);
 
-    get defaultFocusedElement()
-    {
-        return this.sidebarTreeElement || this.element;
-    },
+var statusBarItems = this.statusBarItems;
+if (statusBarItems) {
+this._statusBarItemContainer = document.createElement("div");
+for (var i = 0; i < statusBarItems.length; ++i)
+this._statusBarItemContainer.appendChild(statusBarItems[i]);
+document.getElementById("main-status-bar").appendChild(this._statusBarItemContainer);
+}
 
-    attach: function()
-    {
-        if (!this.element.parentNode)
-            document.getElementById("main-panels").appendChild(this.element);
-    },
+if ("_toolbarItem" in this)
+this._toolbarItem.addStyleClass("toggled-on");
 
-    searchCanceled: function(startingNewSearch)
-    {
-        if (this._searchResults) {
-            for (var i = 0; i < this._searchResults.length; ++i) {
-                var view = this._searchResults[i];
-                if (view.searchCanceled)
-                    view.searchCanceled();
-                delete view.currentQuery;
-            }
-        }
+WebInspector.currentFocusElement = this.defaultFocusedElement;
 
-        WebInspector.updateSearchMatchesCount(0, this);
+this.restoreSidebarWidth();
+this._restoreScrollPositions();
+},
 
-        if (this._currentSearchChunkIntervalIdentifier) {
-            clearInterval(this._currentSearchChunkIntervalIdentifier);
-            delete this._currentSearchChunkIntervalIdentifier;
-        }
+hide: function()
+{
+this._storeScrollPositions();
+WebInspector.View.prototype.hide.call(this);
 
-        this._totalSearchMatches = 0;
-        this._currentSearchResultIndex = 0;
-        this._searchResults = [];
-    },
+if (this._statusBarItemContainer && this._statusBarItemContainer.parentNode)
+this._statusBarItemContainer.parentNode.removeChild(this._statusBarItemContainer);
+delete this._statusBarItemContainer;
+if ("_toolbarItem" in this)
+this._toolbarItem.removeStyleClass("toggled-on");
+},
 
-    performSearch: function(query)
-    {
-        // Call searchCanceled since it will reset everything we need before doing a new search.
-        this.searchCanceled(true);
+get defaultFocusedElement()
+{
+return this.sidebarTreeElement || this.element;
+},
 
-        var searchableViews = this.searchableViews;
-        if (!searchableViews || !searchableViews.length)
-            return;
+attach: function()
+{
+if (!this.element.parentNode)
+document.getElementById("main-panels").appendChild(this.element);
+},
 
-        var parentElement = this.viewsContainerElement;
-        var visibleView = this.visibleView;
-        var sortFuction = this.searchResultsSortFunction;
+searchCanceled: function()
+{
+if (this._searchResults) {
+for (var i = 0; i < this._searchResults.length; ++i) {
+var view = this._searchResults[i];
+if (view.searchCanceled)
+view.searchCanceled();
+delete view.currentQuery;
+}
+}
 
-        var matchesCountUpdateTimeout = null;
+WebInspector.updateSearchMatchesCount(0, this);
 
-        function updateMatchesCount()
-        {
-            WebInspector.updateSearchMatchesCount(this._totalSearchMatches, this);
-            matchesCountUpdateTimeout = null;
-        }
+if (this._currentSearchChunkIntervalIdentifier) {
+clearInterval(this._currentSearchChunkIntervalIdentifier);
+delete this._currentSearchChunkIntervalIdentifier;
+}
 
-        function updateMatchesCountSoon()
-        {
-            if (matchesCountUpdateTimeout)
-                return;
-            // Update the matches count every half-second so it doesn't feel twitchy.
-            matchesCountUpdateTimeout = setTimeout(updateMatchesCount.bind(this), 500);
-        }
+this._totalSearchMatches = 0;
+this._currentSearchResultIndex = 0;
+this._searchResults = [];
+},
 
-        function finishedCallback(view, searchMatches)
-        {
-            if (!searchMatches)
-                return;
+performSearch: function(query)
+{
 
-            this._totalSearchMatches += searchMatches;
-            this._searchResults.push(view);
+this.searchCanceled(true);
 
-            if (sortFuction)
-                this._searchResults.sort(sortFuction);
+var searchableViews = this.searchableViews;
+if (!searchableViews || !searchableViews.length)
+return;
 
-            if (this.searchMatchFound)
-                this.searchMatchFound(view, searchMatches);
+var parentElement = this.viewsContainerElement;
+var visibleView = this.visibleView;
+var sortFuction = this.searchResultsSortFunction;
 
-            updateMatchesCountSoon.call(this);
+var matchesCountUpdateTimeout = null;
 
-            if (view === visibleView)
-                view.jumpToFirstSearchResult();
-        }
+function updateMatchesCount()
+{
+WebInspector.updateSearchMatchesCount(this._totalSearchMatches, this);
+matchesCountUpdateTimeout = null;
+}
 
-        var i = 0;
-        var panel = this;
-        var boundFinishedCallback = finishedCallback.bind(this);
-        var chunkIntervalIdentifier = null;
+function updateMatchesCountSoon()
+{
+if (matchesCountUpdateTimeout)
+return;
 
-        // Split up the work into chunks so we don't block the
-        // UI thread while processing.
+matchesCountUpdateTimeout = setTimeout(updateMatchesCount.bind(this), 500);
+}
 
-        function processChunk()
-        {
-            var view = searchableViews[i];
+function finishedCallback(view, searchMatches)
+{
+if (!searchMatches)
+return;
 
-            if (++i >= searchableViews.length) {
-                if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier)
-                    delete panel._currentSearchChunkIntervalIdentifier;
-                clearInterval(chunkIntervalIdentifier);
-            }
+this._totalSearchMatches += searchMatches;
+this._searchResults.push(view);
 
-            if (!view)
-                return;
+if (sortFuction)
+this._searchResults.sort(sortFuction);
 
-            if (view.element.parentNode !== parentElement && view.element.parentNode && parentElement)
-                view.detach();
+if (this.searchMatchFound)
+this.searchMatchFound(view, searchMatches);
+
+updateMatchesCountSoon.call(this);
+
+if (view === visibleView)
+view.jumpToFirstSearchResult();
+}
+
+var i = 0;
+var panel = this;
+var boundFinishedCallback = finishedCallback.bind(this);
+var chunkIntervalIdentifier = null;
+
+
+
+
+function processChunk()
+{
+var view = searchableViews[i];
+
+if (++i >= searchableViews.length) {
+if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier)
+delete panel._currentSearchChunkIntervalIdentifier;
+clearInterval(chunkIntervalIdentifier);
+}
+
+if (!view)
+return;
+
+if (view.element.parentNode !== parentElement && view.element.parentNode && parentElement)
+view.detach();
+
+view.currentQuery = query;
+view.performSearch(query, boundFinishedCallback);
+}
+
+processChunk();
+
+chunkIntervalIdentifier = setInterval(processChunk, 25);
+this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier;
+},
+
+jumpToNextSearchResult: function()
+{
+if (!this.showView || !this._searchResults || !this._searchResults.length)
+return;
+
+var showFirstResult = false;
+
+this._currentSearchResultIndex = this._searchResults.indexOf(this.visibleView);
+if (this._currentSearchResultIndex === -1) {
+this._currentSearchResultIndex = 0;
+showFirstResult = true;
+}
+
+var currentView = this._searchResults[this._currentSearchResultIndex];
 
-            view.currentQuery = query;
-            view.performSearch(query, boundFinishedCallback);
-        }
+if (currentView.showingLastSearchResult()) {
+if (++this._currentSearchResultIndex >= this._searchResults.length)
+this._currentSearchResultIndex = 0;
+currentView = this._searchResults[this._currentSearchResultIndex];
+showFirstResult = true;
+}
 
-        processChunk();
+if (currentView !== this.visibleView) {
+this.showView(currentView);
+WebInspector.focusSearchField();
+}
 
-        chunkIntervalIdentifier = setInterval(processChunk, 25);
-        this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier;
-    },
+if (showFirstResult)
+currentView.jumpToFirstSearchResult();
+else
+currentView.jumpToNextSearchResult();
+},
 
-    jumpToNextSearchResult: function()
-    {
-        if (!this.showView || !this._searchResults || !this._searchResults.length)
-            return;
+jumpToPreviousSearchResult: function()
+{
+if (!this.showView || !this._searchResults || !this._searchResults.length)
+return;
 
-        var showFirstResult = false;
+var showLastResult = false;
 
-        this._currentSearchResultIndex = this._searchResults.indexOf(this.visibleView);
-        if (this._currentSearchResultIndex === -1) {
-            this._currentSearchResultIndex = 0;
-            showFirstResult = true;
-        }
+this._currentSearchResultIndex = this._searchResults.indexOf(this.visibleView);
+if (this._currentSearchResultIndex === -1) {
+this._currentSearchResultIndex = 0;
+showLastResult = true;
+}
 
-        var currentView = this._searchResults[this._currentSearchResultIndex];
+var currentView = this._searchResults[this._currentSearchResultIndex];
 
-        if (currentView.showingLastSearchResult()) {
-            if (this.searchIteratesOverViews()) {
-                if (++this._currentSearchResultIndex >= this._searchResults.length)
-                    this._currentSearchResultIndex = 0;
-                currentView = this._searchResults[this._currentSearchResultIndex];
-            }
-            showFirstResult = true;
-        }
+if (currentView.showingFirstSearchResult()) {
+if (--this._currentSearchResultIndex < 0)
+this._currentSearchResultIndex = (this._searchResults.length - 1);
+currentView = this._searchResults[this._currentSearchResultIndex];
+showLastResult = true;
+}
 
-        if (currentView !== this.visibleView) {
-            this.showView(currentView);
-            WebInspector.focusSearchField();
-        }
+if (currentView !== this.visibleView) {
+this.showView(currentView);
+WebInspector.focusSearchField();
+}
 
-        if (showFirstResult)
-            currentView.jumpToFirstSearchResult();
-        else
-            currentView.jumpToNextSearchResult();
-    },
+if (showLastResult)
+currentView.jumpToLastSearchResult();
+else
+currentView.jumpToPreviousSearchResult();
+},
 
-    jumpToPreviousSearchResult: function()
-    {
-        if (!this.showView || !this._searchResults || !this._searchResults.length)
-            return;
+createSidebar: function(parentElement, resizerParentElement)
+{
+if (this.sidebarElement)
+return;
 
-        var showLastResult = false;
+if (!parentElement)
+parentElement = this.element;
 
-        this._currentSearchResultIndex = this._searchResults.indexOf(this.visibleView);
-        if (this._currentSearchResultIndex === -1) {
-            this._currentSearchResultIndex = 0;
-            showLastResult = true;
-        }
+if (!resizerParentElement)
+resizerParentElement = parentElement;
 
-        var currentView = this._searchResults[this._currentSearchResultIndex];
+this.sidebarElement = document.createElement("div");
+this.sidebarElement.className = "sidebar";
+parentElement.appendChild(this.sidebarElement);
 
-        if (currentView.showingFirstSearchResult()) {
-            if (this.searchIteratesOverViews()) {
-                if (--this._currentSearchResultIndex < 0)
-                    this._currentSearchResultIndex = (this._searchResults.length - 1);
-                currentView = this._searchResults[this._currentSearchResultIndex];
-            }
-            showLastResult = true;
-        }
+this.sidebarResizeElement = document.createElement("div");
+this.sidebarResizeElement.className = "sidebar-resizer-vertical";
+this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false);
+resizerParentElement.appendChild(this.sidebarResizeElement);
 
-        if (currentView !== this.visibleView) {
-            this.showView(currentView);
-            WebInspector.focusSearchField();
-        }
+this.sidebarTreeElement = document.createElement("ol");
+this.sidebarTreeElement.className = "sidebar-tree";
+this.sidebarElement.appendChild(this.sidebarTreeElement);
 
-        if (showLastResult)
-            currentView.jumpToLastSearchResult();
-        else
-            currentView.jumpToPreviousSearchResult();
-    },
+this.sidebarTree = new TreeOutline(this.sidebarTreeElement);
+this.sidebarTree.panel = this;
+},
 
-    createSidebar: function(parentElement, resizerParentElement)
-    {
-        if (this.hasSidebar)
-            return;
+_sidebarWidthSettingName: function()
+{
+return this._panelName + "SidebarWidth";
+},
 
-        if (!parentElement)
-            parentElement = this.element;
+_startSidebarDragging: function(event)
+{
+WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize");
+},
 
-        if (!resizerParentElement)
-            resizerParentElement = parentElement;
+_sidebarDragging: function(event)
+{
+this.updateSidebarWidth(event.pageX);
 
-        this.hasSidebar = true;
+event.preventDefault();
+},
 
-        this.sidebarElement = document.createElement("div");
-        this.sidebarElement.className = "sidebar";
-        parentElement.appendChild(this.sidebarElement);
+_endSidebarDragging: function(event)
+{
+WebInspector.elementDragEnd(event);
+this.saveSidebarWidth();
+},
 
-        this.sidebarResizeElement = document.createElement("div");
-        this.sidebarResizeElement.className = "sidebar-resizer-vertical";
-        this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarDragging.bind(this), false);
-        resizerParentElement.appendChild(this.sidebarResizeElement);
+updateSidebarWidth: function(width)
+{
+if (!this.sidebarElement)
+return;
 
-        this.sidebarTreeElement = document.createElement("ol");
-        this.sidebarTreeElement.className = "sidebar-tree";
-        this.sidebarElement.appendChild(this.sidebarTreeElement);
+if (this.sidebarElement.offsetWidth <= 0) {
 
-        this.sidebarTree = new TreeOutline(this.sidebarTreeElement);
-    },
 
-    _startSidebarDragging: function(event)
-    {
-        WebInspector.elementDragStart(this.sidebarResizeElement, this._sidebarDragging.bind(this), this._endSidebarDragging.bind(this), event, "col-resize");
-    },
+return;
+}
 
-    _sidebarDragging: function(event)
-    {
-        this.updateSidebarWidth(event.pageX);
+if (!("_currentSidebarWidth" in this))
+this._currentSidebarWidth = this.sidebarElement.offsetWidth;
 
-        event.preventDefault();
-    },
+if (typeof width === "undefined")
+width = this._currentSidebarWidth;
 
-    _endSidebarDragging: function(event)
-    {
-        WebInspector.elementDragEnd(event);
-    },
+width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2);
 
-    updateSidebarWidth: function(width)
-    {
-        if (!this.hasSidebar)
-            return;
+this._currentSidebarWidth = width;
+this.setSidebarWidth(width);
 
-        if (this.sidebarElement.offsetWidth <= 0) {
-            // The stylesheet hasn't loaded yet or the window is closed,
-            // so we can't calculate what is need. Return early.
-            return;
-        }
+this.updateMainViewWidth(width);
+},
 
-        if (!("_currentSidebarWidth" in this))
-            this._currentSidebarWidth = this.sidebarElement.offsetWidth;
+setSidebarWidth: function(width)
+{
+this.sidebarElement.style.width = width + "px";
+this.sidebarResizeElement.style.left = (width - 3) + "px";
+},
 
-        if (typeof width === "undefined")
-            width = this._currentSidebarWidth;
+restoreSidebarWidth: function()
+{
+var sidebarWidth = WebInspector.settings[this._sidebarWidthSettingName()];
+this.updateSidebarWidth(sidebarWidth);
+},
 
-        width = Number.constrain(width, Preferences.minSidebarWidth, window.innerWidth / 2);
+saveSidebarWidth: function()
+{
+if (!this.sidebarElement)
+return;
+WebInspector.settings[this._sidebarWidthSettingName()] = this.sidebarElement.offsetWidth;
+},
 
-        this._currentSidebarWidth = width;
-        this.setSidebarWidth(width);
+updateMainViewWidth: function(width)
+{
 
-        this.updateMainViewWidth(width);
-    },
+},
 
-    setSidebarWidth: function(width)
-    {
-        this.sidebarElement.style.width = width + "px";
-        this.sidebarResizeElement.style.left = (width - 3) + "px";
-    },
+resize: function()
+{
+var visibleView = this.visibleView;
+if (visibleView && "resize" in visibleView)
+visibleView.resize();
+},
 
-    updateMainViewWidth: function(width)
-    {
-        // Should be implemented by ancestors.
-    },
+canShowSourceLine: function(url, line)
+{
+return false;
+},
 
-    resize: function()
-    {
-        var visibleView = this.visibleView;
-        if (visibleView && "resize" in visibleView)
-            visibleView.resize();
-    },
+showSourceLine: function(url, line)
+{
+return false;
+},
 
-    canShowSourceLine: function(url, line)
-    {
-        return false;
-    },
+elementsToRestoreScrollPositionsFor: function()
+{
+return [];
+},
 
-    showSourceLine: function(url, line)
-    {
-        return false;
-    },
+_storeScrollPositions: function()
+{
+var elements = this.elementsToRestoreScrollPositionsFor();
+for (var i = 0; i < elements.length; ++i) {
+var container = elements[i];
+container._scrollTop = container.scrollTop;
+}
+},
 
-    searchIteratesOverViews: function()
-    {
-        return false;
-    }
+_restoreScrollPositions: function()
+{
+var elements = this.elementsToRestoreScrollPositionsFor();
+for (var i = 0; i < elements.length; ++i) {
+var container = elements[i];
+if (container._scrollTop)
+container.scrollTop = container._scrollTop;
+}
+}
 }
 
 WebInspector.Panel.prototype.__proto__ = WebInspector.View.prototype;
 
-/* TimelineGrid.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.TimelineGrid = function()
 {
-    this.element = document.createElement("div");
+this.element = document.createElement("div");
 
-    this._itemsGraphsElement = document.createElement("div");
-    this._itemsGraphsElement.id = "resources-graphs";
-    this.element.appendChild(this._itemsGraphsElement);
+this._itemsGraphsElement = document.createElement("div");
+this._itemsGraphsElement.id = "resources-graphs";
+this.element.appendChild(this._itemsGraphsElement);
 
-    this._dividersElement = document.createElement("div");
-    this._dividersElement.id = "resources-dividers";
-    this.element.appendChild(this._dividersElement);
+this._dividersElement = document.createElement("div");
+this._dividersElement.className = "resources-dividers";
+this.element.appendChild(this._dividersElement);
 
-    this._eventDividersElement = document.createElement("div");
-    this._eventDividersElement.id = "resources-event-dividers";
-    this.element.appendChild(this._eventDividersElement);
+this._eventDividersElement = document.createElement("div");
+this._eventDividersElement.className = "resources-event-dividers";
+this.element.appendChild(this._eventDividersElement);
 
-    this._dividersLabelBarElement = document.createElement("div");
-    this._dividersLabelBarElement.id = "resources-dividers-label-bar";
-    this.element.appendChild(this._dividersLabelBarElement);
+this._dividersLabelBarElement = document.createElement("div");
+this._dividersLabelBarElement.className = "resources-dividers-label-bar";
+this.element.appendChild(this._dividersLabelBarElement);
 }
 
 WebInspector.TimelineGrid.prototype = {
-    get itemsGraphsElement()
-    {
-        return this._itemsGraphsElement;
-    },
-
-    updateDividers: function(force, calculator, paddingLeft)
-    {
-        var dividerCount = Math.round(this._dividersElement.offsetWidth / 64);
-        var slice = calculator.boundarySpan / dividerCount;
-        if (!force && this._currentDividerSlice === slice)
-            return false;
-
-        if (typeof paddingLeft !== "number")
-            paddingLeft = 0;
-        this._currentDividerSlice = slice;
-
-        this._eventDividersElement.removeChildren();
-        // Reuse divider elements and labels.
-        var divider = this._dividersElement.firstChild;
-        var dividerLabelBar = this._dividersLabelBarElement.firstChild;
-
-        var dividersLabelBarElementClientWidth = this._dividersLabelBarElement.clientWidth;
-        var clientWidth = dividersLabelBarElementClientWidth - paddingLeft;
-        for (var i = paddingLeft ? 0 : 1; i <= dividerCount; ++i) {
-            if (!divider) {
-                divider = document.createElement("div");
-                divider.className = "resources-divider";
-                this._dividersElement.appendChild(divider);
-
-                dividerLabelBar = document.createElement("div");
-                dividerLabelBar.className = "resources-divider";
-                var label = document.createElement("div");
-                label.className = "resources-divider-label";
-                dividerLabelBar._labelElement = label;
-                dividerLabelBar.appendChild(label);
-                this._dividersLabelBarElement.appendChild(dividerLabelBar);
-                dividersLabelBarElementClientWidth = this._dividersLabelBarElement.clientWidth;
-            }
-
-            if (i === dividerCount)
-                divider.addStyleClass("last");
-            else
-                divider.removeStyleClass("last");
-
-            var left = paddingLeft + clientWidth * (i / dividerCount);
-            var percentLeft = 100 * left / dividersLabelBarElementClientWidth;
-            this._setDividerAndBarLeft(divider, dividerLabelBar, percentLeft);
-
-            if (!isNaN(slice))
-                dividerLabelBar._labelElement.textContent = calculator.formatValue(slice * i);
-            else
-                dividerLabelBar._labelElement.textContent = "";
-
-            divider = divider.nextSibling;
-            dividerLabelBar = dividerLabelBar.nextSibling;
-        }
-
-        // Remove extras.
-        while (divider) {
-            var nextDivider = divider.nextSibling;
-            this._dividersElement.removeChild(divider);
-            divider = nextDivider;
-        }
-        while (dividerLabelBar) {
-            var nextDivider = dividerLabelBar.nextSibling;
-            this._dividersLabelBarElement.removeChild(dividerLabelBar);
-            dividerLabelBar = nextDivider;
-        }
-        return true;
-    },
-
-    _setDividerAndBarLeft: function(divider, dividerLabelBar, percentLeft)
-    {
-        var percentStyleLeft = parseFloat(divider.style.left);
-        if (!isNaN(percentStyleLeft) && Math.abs(percentStyleLeft - percentLeft) < 0.1)
-            return;
-        divider.style.left = percentLeft + "%";
-        dividerLabelBar.style.left = percentLeft + "%";
-    },
-
-    addEventDivider: function(divider)
-    {
-        this._eventDividersElement.appendChild(divider);
-    },
-
-    setScrollAndDividerTop: function(scrollTop, dividersTop)
-    {
-        this._dividersElement.style.top = scrollTop + "px";
-        this._eventDividersElement.style.top = scrollTop + "px";
-        this._dividersLabelBarElement.style.top = dividersTop + "px";
-    }
-}
-
-/* AbstractTimelinePanel.js */
-
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.AbstractTimelinePanel = function()
+get itemsGraphsElement()
 {
-    WebInspector.Panel.call(this);
-    this._items = [];
-    this._staleItems = [];
-}
+return this._itemsGraphsElement;
+},
 
-WebInspector.AbstractTimelinePanel.prototype = {
-    get categories()
-    {
-        // Should be implemented by the concrete subclasses.
-        return {};
-    },
 
-    populateSidebar: function()
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    createItemTreeElement: function(item)
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    createItemGraph: function(item)
-    {
-        // Should be implemented by the concrete subclasses.
-    },
-
-    get items()
-    {
-        return this._items;
-    },
-
-    createInterface: function()
-    {
-        this.containerElement = document.createElement("div");
-        this.containerElement.id = "resources-container";
-        this.containerElement.addEventListener("scroll", this._updateDividersLabelBarPosition.bind(this), false);
-        this.element.appendChild(this.containerElement);
-
-        this.createSidebar(this.containerElement, this.element);
-        this.sidebarElement.id = "resources-sidebar";
-        this.populateSidebar();
-
-        this._containerContentElement = document.createElement("div");
-        this._containerContentElement.id = "resources-container-content";
-        this.containerElement.appendChild(this._containerContentElement);
-
-        this.summaryBar = new WebInspector.SummaryBar(this.categories);
-        this.summaryBar.element.id = "resources-summary";
-        this._containerContentElement.appendChild(this.summaryBar.element);
-
-        this._timelineGrid = new WebInspector.TimelineGrid();
-        this._containerContentElement.appendChild(this._timelineGrid.element);
-        this.itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
-    },
-
-    createFilterPanel: function()
-    {
-        this.filterBarElement = document.createElement("div");
-        this.filterBarElement.id = "resources-filter";
-        this.filterBarElement.className = "scope-bar";
-        this.element.appendChild(this.filterBarElement);
-
-        function createFilterElement(category)
-        {
-            if (category === "all")
-                var label = WebInspector.UIString("All");
-            else if (this.categories[category])
-                var label = this.categories[category].title;
-
-            var categoryElement = document.createElement("li");
-            categoryElement.category = category;
-            categoryElement.addStyleClass(category);
-            categoryElement.appendChild(document.createTextNode(label));
-            categoryElement.addEventListener("click", this._updateFilter.bind(this), false);
-            this.filterBarElement.appendChild(categoryElement);
-
-            return categoryElement;
-        }
-
-        this.filterAllElement = createFilterElement.call(this, "all");
-
-        // Add a divider
-        var dividerElement = document.createElement("div");
-        dividerElement.addStyleClass("divider");
-        this.filterBarElement.appendChild(dividerElement);
-
-        for (var category in this.categories)
-            createFilterElement.call(this, category);
-    },
-
-    showCategory: function(category)
-    {
-        var filterClass = "filter-" + category.toLowerCase();
-        this.itemsGraphsElement.addStyleClass(filterClass);
-        this.itemsTreeElement.childrenListElement.addStyleClass(filterClass);
-    },
-
-    hideCategory: function(category)
-    {
-        var filterClass = "filter-" + category.toLowerCase();
-        this.itemsGraphsElement.removeStyleClass(filterClass);
-        this.itemsTreeElement.childrenListElement.removeStyleClass(filterClass);
-    },
-
-    filter: function(target, selectMultiple)
-    {
-        function unselectAll()
-        {
-            for (var i = 0; i < this.filterBarElement.childNodes.length; ++i) {
-                var child = this.filterBarElement.childNodes[i];
-                if (!child.category)
-                    continue;
-
-                child.removeStyleClass("selected");
-                this.hideCategory(child.category);
-            }
-        }
-
-        if (target === this.filterAllElement) {
-            if (target.hasStyleClass("selected")) {
-                // We can't unselect All, so we break early here
-                return;
-            }
-
-            // If All wasn't selected, and now is, unselect everything else.
-            unselectAll.call(this);
-        } else {
-            // Something other than All is being selected, so we want to unselect All.
-            if (this.filterAllElement.hasStyleClass("selected")) {
-                this.filterAllElement.removeStyleClass("selected");
-                this.hideCategory("all");
-            }
-        }
-
-        if (!selectMultiple) {
-            // If multiple selection is off, we want to unselect everything else
-            // and just select ourselves.
-            unselectAll.call(this);
-
-            target.addStyleClass("selected");
-            this.showCategory(target.category);
-            return;
-        }
-
-        if (target.hasStyleClass("selected")) {
-            // If selectMultiple is turned on, and we were selected, we just
-            // want to unselect ourselves.
-            target.removeStyleClass("selected");
-            this.hideCategory(target.category);
-        } else {
-            // If selectMultiple is turned on, and we weren't selected, we just
-            // want to select ourselves.
-            target.addStyleClass("selected");
-            this.showCategory(target.category);
-        }
-    },
-
-    _updateFilter: function(e)
-    {
-        var isMac = WebInspector.isMac();
-        var selectMultiple = false;
-        if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
-            selectMultiple = true;
-        if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
-            selectMultiple = true;
-
-        this.filter(e.target, selectMultiple);
-
-        // When we are updating our filtering, scroll to the top so we don't end up
-        // in blank graph under all the resources.
-        this.containerElement.scrollTop = 0;
-    },
-
-    updateGraphDividersIfNeeded: function(force)
-    {
-        if (!this.visible) {
-            this.needsRefresh = true;
-            return false;
-        }
-        return this._timelineGrid.updateDividers(force, this.calculator);
-    },
-
-    _updateDividersLabelBarPosition: function()
-    {
-        const scrollTop = this.containerElement.scrollTop;
-        const offsetHeight = this.summaryBar.element.offsetHeight;
-        const dividersTop = (scrollTop < offsetHeight ? offsetHeight : scrollTop);
-        this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
-    },
-
-    get needsRefresh()
-    {
-        return this._needsRefresh;
-    },
-
-    set needsRefresh(x)
-    {
-        if (this._needsRefresh === x)
-            return;
-
-        this._needsRefresh = x;
-
-        if (x) {
-            if (this.visible && !("_refreshTimeout" in this))
-                this._refreshTimeout = setTimeout(this.refresh.bind(this), 500);
-        } else {
-            if ("_refreshTimeout" in this) {
-                clearTimeout(this._refreshTimeout);
-                delete this._refreshTimeout;
-            }
-        }
-    },
-
-    refreshIfNeeded: function()
-    {
-        if (this.needsRefresh)
-            this.refresh();
-    },
-
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-
-        this._updateDividersLabelBarPosition();
-        this.refreshIfNeeded();
-    },
-
-    resize: function()
-    {
-        WebInspector.Panel.prototype.resize.call(this);
-
-        this.updateGraphDividersIfNeeded();
-    },
-
-    updateMainViewWidth: function(width)
-    {
-        this._containerContentElement.style.left = width + "px";
-        this.resize();
-    },
-
-    invalidateAllItems: function()
-    {
-        this._staleItems = this._items.slice();
-    },
-
-    refresh: function()
-    {
-        this.needsRefresh = false;
-
-        var staleItemsLength = this._staleItems.length;
-
-        var boundariesChanged = false;
-
-        for (var i = 0; i < staleItemsLength; ++i) {
-            var item = this._staleItems[i];
-            if (!item._itemsTreeElement) {
-                // Create the timeline tree element and graph.
-                item._itemsTreeElement = this.createItemTreeElement(item);
-                item._itemsTreeElement._itemGraph = this.createItemGraph(item);
-
-                this.itemsTreeElement.appendChild(item._itemsTreeElement);
-                this.itemsGraphsElement.appendChild(item._itemsTreeElement._itemGraph.graphElement);
-            }
-
-            if (item._itemsTreeElement.refresh)
-                item._itemsTreeElement.refresh();
-
-            if (this.calculator.updateBoundaries(item))
-                boundariesChanged = true;
-        }
-
-        if (boundariesChanged) {
-            // The boundaries changed, so all item graphs are stale.
-            this._staleItems = this._items.slice();
-            staleItemsLength = this._staleItems.length;
-        }
-
-
-        const isBarOpaqueAtLeft = this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.isBarOpaqueAtLeft;
-        for (var i = 0; i < staleItemsLength; ++i)
-            this._staleItems[i]._itemsTreeElement._itemGraph.refresh(this.calculator, isBarOpaqueAtLeft);
-
-        this._staleItems = [];
-
-        this.updateGraphDividersIfNeeded();
-    },
-
-    reset: function()
-    {
-        this.containerElement.scrollTop = 0;
-
-        if (this._calculator)
-            this._calculator.reset();
-
-        if (this._items) {
-            var itemsLength = this._items.length;
-            for (var i = 0; i < itemsLength; ++i) {
-                var item = this._items[i];
-                delete item._itemsTreeElement;
-            }
-        }
-
-        this._items = [];
-        this._staleItems = [];
-
-        this.itemsTreeElement.removeChildren();
-        this.itemsGraphsElement.removeChildren();
-
-        this.updateGraphDividersIfNeeded(true);
-    },
-
-    get calculator()
-    {
-        return this._calculator;
-    },
-
-    set calculator(x)
-    {
-        if (!x || this._calculator === x)
-            return;
-
-        this._calculator = x;
-        this._calculator.reset();
-
-        this._staleItems = this._items.slice();
-        this.refresh();
-    },
-
-    addItem: function(item)
-    {
-        this._items.push(item);
-        this.refreshItem(item);
-    },
-
-    removeItem: function(item)
-    {
-        this._items.remove(item, true);
-
-        if (item._itemsTreeElement) {
-            this.itemsTreeElement.removeChild(item._itemsTreeElement);
-            this.itemsGraphsElement.removeChild(item._itemsTreeElement._itemGraph.graphElement);
-        }
-
-        delete item._itemsTreeElement;
-        this.adjustScrollPosition();
-    },
-
-    refreshItem: function(item)
-    {
-        this._staleItems.push(item);
-        this.needsRefresh = true;
-    },
-
-    revealAndSelectItem: function(item)
-    {
-        if (item._itemsTreeElement) {
-            item._itemsTreeElement.reveal();
-            item._itemsTreeElement.select(true);
-        }
-    },
-
-    sortItems: function(sortingFunction)
-    {
-        var sortedElements = [].concat(this.itemsTreeElement.children);
-        sortedElements.sort(sortingFunction);
-
-        var sortedElementsLength = sortedElements.length;
-        for (var i = 0; i < sortedElementsLength; ++i) {
-            var treeElement = sortedElements[i];
-            if (treeElement === this.itemsTreeElement.children[i])
-                continue;
-
-            var wasSelected = treeElement.selected;
-            this.itemsTreeElement.removeChild(treeElement);
-            this.itemsTreeElement.insertChild(treeElement, i);
-            if (wasSelected)
-                treeElement.select(true);
-
-            var graphElement = treeElement._itemGraph.graphElement;
-            this.itemsGraphsElement.insertBefore(graphElement, this.itemsGraphsElement.children[i]);
-        }
-    },
-
-    adjustScrollPosition: function()
-    {
-        // Prevent the container from being scrolled off the end.
-        if ((this.containerElement.scrollTop + this.containerElement.offsetHeight) > this.sidebarElement.offsetHeight)
-            this.containerElement.scrollTop = (this.sidebarElement.offsetHeight - this.containerElement.offsetHeight);
-    },
-
-    addEventDivider: function(divider)
-    {
-        this._timelineGrid.addEventDivider(divider);
-    }
-}
-
-WebInspector.AbstractTimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-WebInspector.AbstractTimelineCalculator = function()
+updateDividers: function(force, calculator, paddingLeft)
 {
+var dividerCount = Math.round(this._dividersElement.offsetWidth / 64);
+var slice = calculator.boundarySpan / dividerCount;
+if (!force && this._currentDividerSlice === slice)
+return false;
+
+if (typeof paddingLeft !== "number")
+paddingLeft = 0;
+this._currentDividerSlice = slice;
+
+
+var divider = this._dividersElement.firstChild;
+var dividerLabelBar = this._dividersLabelBarElement.firstChild;
+
+var dividersLabelBarElementClientWidth = this._dividersLabelBarElement.clientWidth;
+var clientWidth = dividersLabelBarElementClientWidth - paddingLeft;
+for (var i = paddingLeft ? 0 : 1; i <= dividerCount; ++i) {
+if (!divider) {
+divider = document.createElement("div");
+divider.className = "resources-divider";
+this._dividersElement.appendChild(divider);
+
+dividerLabelBar = document.createElement("div");
+dividerLabelBar.className = "resources-divider";
+var label = document.createElement("div");
+label.className = "resources-divider-label";
+dividerLabelBar._labelElement = label;
+dividerLabelBar.appendChild(label);
+this._dividersLabelBarElement.appendChild(dividerLabelBar);
+dividersLabelBarElementClientWidth = this._dividersLabelBarElement.clientWidth;
 }
 
-WebInspector.AbstractTimelineCalculator.prototype = {
-    computeSummaryValues: function(items)
-    {
-        var total = 0;
-        var categoryValues = {};
-
-        var itemsLength = items.length;
-        for (var i = 0; i < itemsLength; ++i) {
-            var item = items[i];
-            var value = this._value(item);
-            if (typeof value === "undefined")
-                continue;
-            if (!(item.category.name in categoryValues))
-                categoryValues[item.category.name] = 0;
-            categoryValues[item.category.name] += value;
-            total += value;
-        }
-
-        return {categoryValues: categoryValues, total: total};
-    },
-
-    computeBarGraphPercentages: function(item)
-    {
-        return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100};
-    },
-
-    computeBarGraphLabels: function(item)
-    {
-        const label = this.formatValue(this._value(item));
-        return {left: label, right: label, tooltip: label};
-    },
-
-    get boundarySpan()
-    {
-        return this.maximumBoundary - this.minimumBoundary;
-    },
-
-    updateBoundaries: function(item)
-    {
-        this.minimumBoundary = 0;
-
-        var value = this._value(item);
-        if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) {
-            this.maximumBoundary = value;
-            return true;
-        }
-        return false;
-    },
-
-    reset: function()
-    {
-        delete this.minimumBoundary;
-        delete this.maximumBoundary;
-    },
-
-    _value: function(item)
-    {
-        return 0;
-    },
-
-    formatValue: function(value)
-    {
-        return value.toString();
-    }
+if (i === (paddingLeft ? 0 : 1)) {
+divider.addStyleClass("first");
+dividerLabelBar.addStyleClass("first");
+} else {
+divider.removeStyleClass("first");
+dividerLabelBar.removeStyleClass("first");
 }
 
-WebInspector.AbstractTimelineCategory = function(name, title, color)
+if (i === dividerCount) {
+divider.addStyleClass("last");
+dividerLabelBar.addStyleClass("last");
+} else {
+divider.removeStyleClass("last");
+dividerLabelBar.removeStyleClass("last");
+}
+
+var left = paddingLeft + clientWidth * (i / dividerCount);
+var percentLeft = 100 * left / dividersLabelBarElementClientWidth;
+this._setDividerAndBarLeft(divider, dividerLabelBar, percentLeft);
+
+if (!isNaN(slice))
+dividerLabelBar._labelElement.textContent = calculator.formatValue(slice * i);
+else
+dividerLabelBar._labelElement.textContent = "";
+
+divider = divider.nextSibling;
+dividerLabelBar = dividerLabelBar.nextSibling;
+}
+
+
+while (divider) {
+var nextDivider = divider.nextSibling;
+this._dividersElement.removeChild(divider);
+divider = nextDivider;
+}
+while (dividerLabelBar) {
+var nextDivider = dividerLabelBar.nextSibling;
+this._dividersLabelBarElement.removeChild(dividerLabelBar);
+dividerLabelBar = nextDivider;
+}
+return true;
+},
+
+_setDividerAndBarLeft: function(divider, dividerLabelBar, percentLeft)
 {
-    this.name = name;
-    this.title = title;
-    this.color = color;
+var percentStyleLeft = parseFloat(divider.style.left);
+if (!isNaN(percentStyleLeft) && Math.abs(percentStyleLeft - percentLeft) < 0.1)
+return;
+divider.style.left = percentLeft + "%";
+dividerLabelBar.style.left = percentLeft + "%";
+},
+
+addEventDivider: function(divider)
+{
+this._eventDividersElement.appendChild(divider);
+},
+
+addEventDividers: function(dividers)
+{
+this.element.removeChild(this._eventDividersElement);
+for (var i = 0; i < dividers.length; ++i)
+if (dividers[i])
+this._eventDividersElement.appendChild(dividers[i]);
+this.element.appendChild(this._eventDividersElement);
+},
+
+removeEventDividers: function()
+{
+this._eventDividersElement.removeChildren();
+},
+
+hideEventDividers: function()
+{
+this._eventDividersElement.addStyleClass("hidden");
+},
+
+showEventDividers: function()
+{
+this._eventDividersElement.removeStyleClass("hidden");
+},
+
+setScrollAndDividerTop: function(scrollTop, dividersTop)
+{
+this._dividersElement.style.top = scrollTop + "px";
+this._eventDividersElement.style.top = scrollTop + "px";
+this._dividersLabelBarElement.style.top = dividersTop + "px";
+}
 }
 
-WebInspector.AbstractTimelineCategory.prototype = {
-    toString: function()
-    {
-        return this.title;
-    }
-}
 
-/* Resource.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
 WebInspector.Resource = function(identifier, url)
 {
-    this.identifier = identifier;
-    this._url = url;
-    this._startTime = -1;
-    this._endTime = -1;
-    this._requestMethod = "";
-    this._requestFormData = "";
-    this._category = WebInspector.resourceCategories.other;
+this.identifier = identifier;
+this.url = url;
+this._startTime = -1;
+this._endTime = -1;
+this._requestMethod = "";
+this._category = WebInspector.resourceCategories.other;
+this._pendingContentCallbacks = [];
 }
 
-WebInspector.Resource.StatusText = {
-    100: "Continue",
-    101: "Switching Protocols",
-    102: "Processing (WebDav)",
-    200: "OK",
-    201: "Created",
-    202: "Accepted",
-    203: "Non-Authoritative Information",
-    204: "No Content",
-    205: "Reset Content",
-    206: "Partial Content",
-    207: "Multi-Status (WebDav)",
-    300: "Multiple Choices",
-    301: "Moved Permanently",
-    302: "Found",
-    303: "See Other",
-    304: "Not Modified",
-    305: "Use Proxy",
-    306: "Switch Proxy",
-    307: "Temporary",
-    400: "Bad Request",
-    401: "Unauthorized",
-    402: "Payment Required",
-    403: "Forbidden",
-    404: "Not Found",
-    405: "Method Not Allowed",
-    406: "Not Acceptable",
-    407: "Proxy Authentication Required",
-    408: "Request Timeout",
-    409: "Conflict",
-    410: "Gone",
-    411: "Length Required",
-    412: "Precondition Failed",
-    413: "Request Entity Too Large",
-    414: "Request-URI Too Long",
-    415: "Unsupported Media Type",
-    416: "Requested Range Not Satisfiable",
-    417: "Expectation Failed",
-    418: "I'm a teapot",
-    422: "Unprocessable Entity (WebDav)",
-    423: "Locked (WebDav)",
-    424: "Failed Dependency (WebDav)",
-    425: "Unordered Collection",
-    426: "Upgrade Required",
-    449: "Retry With",
-    500: "Internal Server Error",
-    501: "Not Implemented",
-    502: "Bad Gateway",
-    503: "Service Unavailable",
-    504: "Gateway Timeout",
-    505: "HTTP Version Not Supported",
-    506: "Variant Also Negotiates",
-    507: "Insufficient Storage (WebDav)",
-    509: "Bandwidth Limit Exceeded",
-    510: "Not Extended"
-};
 
-// Keep these in sync with WebCore::InspectorResource::Type
 WebInspector.Resource.Type = {
-    Document:   0,
-    Stylesheet: 1,
-    Image:      2,
-    Font:       3,
-    Script:     4,
-    XHR:        5,
-    Media:      6,
-    Other:      7,
+Document:   0,
+Stylesheet: 1,
+Image:      2,
+Font:       3,
+Script:     4,
+XHR:        5,
+Media:      6,
+WebSocket:  7,
+Other:      8,
 
-    isTextType: function(type)
-    {
-        return (type === this.Document) || (type === this.Stylesheet) || (type === this.Script) || (type === this.XHR);
-    },
+isTextType: function(type)
+{
+return (type === this.Document) || (type === this.Stylesheet) || (type === this.Script) || (type === this.XHR);
+},
 
-    toString: function(type)
-    {
-        switch (type) {
-            case this.Document:
-                return WebInspector.UIString("document");
-            case this.Stylesheet:
-                return WebInspector.UIString("stylesheet");
-            case this.Image:
-                return WebInspector.UIString("image");
-            case this.Font:
-                return WebInspector.UIString("font");
-            case this.Script:
-                return WebInspector.UIString("script");
-            case this.XHR:
-                return WebInspector.UIString("XHR");
-            case this.Other:
-            default:
-                return WebInspector.UIString("other");
-        }
-    }
+toUIString: function(type)
+{
+return WebInspector.UIString(WebInspector.Resource.Type.toString(type));
+},
+
+
+
+toString: function(type)
+{
+switch (type) {
+case this.Document:
+return "document";
+case this.Stylesheet:
+return "stylesheet";
+case this.Image:
+return "image";
+case this.Font:
+return "font";
+case this.Script:
+return "script";
+case this.XHR:
+return "xhr";
+case this.Media:
+return "media";
+case this.WebSocket:
+return "websocket";
+case this.Other:
+default:
+return "other";
+}
+}
 }
 
 WebInspector.Resource.prototype = {
-    get url()
-    {
-        return this._url;
-    },
+get url()
+{
+return this._url;
+},
 
-    set url(x)
-    {
-        if (this._url === x)
-            return;
+set url(x)
+{
+if (this._url === x)
+return;
 
-        var oldURL = this._url;
-        this._url = x;
+this._url = x;
+delete this._parsedQueryParameters;
 
-        // FIXME: We should make the WebInspector object listen for the "url changed" event.
-        // Then resourceURLChanged can be removed.
-        WebInspector.resourceURLChanged(this, oldURL);
+var parsedURL = x.asParsedURL();
+this.domain = parsedURL ? parsedURL.host : "";
+this.path = parsedURL ? parsedURL.path : "";
+this.lastPathComponent = "";
+if (parsedURL && parsedURL.path) {
 
-        this.dispatchEventToListeners("url changed");
-    },
+var path = parsedURL.path;
+var indexOfQuery = path.indexOf("?");
+if (indexOfQuery !== -1)
+path = path.substring(0, indexOfQuery);
 
-    get documentURL()
-    {
-        return this._documentURL;
-    },
 
-    set documentURL(x)
-    {
-        if (this._documentURL === x)
-            return;
-        this._documentURL = x;
-    },
+var lastSlashIndex = path.lastIndexOf("/");
+if (lastSlashIndex !== -1)
+this.lastPathComponent = path.substring(lastSlashIndex + 1);
+}
+this.lastPathComponentLowerCase = this.lastPathComponent.toLowerCase();
+},
 
-    get domain()
-    {
-        return this._domain;
-    },
+get documentURL()
+{
+return this._documentURL;
+},
 
-    set domain(x)
-    {
-        if (this._domain === x)
-            return;
-        this._domain = x;
-    },
+set documentURL(x)
+{
+this._documentURL = x;
+},
 
-    get lastPathComponent()
-    {
-        return this._lastPathComponent;
-    },
+get displayName()
+{
+if (this._displayName)
+return this._displayName;
+this._displayName = this.lastPathComponent;
+if (!this._displayName)
+this._displayName = this.displayDomain;
+if (!this._displayName && this.url)
+this._displayName = this.url.trimURL(WebInspector.mainResource ? WebInspector.mainResource.domain : "");
+if (this._displayName === "/")
+this._displayName = this.url;
+return this._displayName;
+},
 
-    set lastPathComponent(x)
-    {
-        if (this._lastPathComponent === x)
-            return;
-        this._lastPathComponent = x;
-        this._lastPathComponentLowerCase = x ? x.toLowerCase() : null;
-    },
+get displayDomain()
+{
 
-    get displayName()
-    {
-        var title = this.lastPathComponent;
-        if (!title)
-            title = this.displayDomain;
-        if (!title && this.url)
-            title = this.url.trimURL(WebInspector.mainResource ? WebInspector.mainResource.domain : "");
-        if (title === "/")
-            title = this.url;
-        return title;
-    },
+if (this.domain && (!WebInspector.mainResource || (WebInspector.mainResource && this.domain !== WebInspector.mainResource.domain)))
+return this.domain;
+return "";
+},
 
-    get displayDomain()
-    {
-        // WebInspector.Database calls this, so don't access more than this.domain.
-        if (this.domain && (!WebInspector.mainResource || (WebInspector.mainResource && this.domain !== WebInspector.mainResource.domain)))
-            return this.domain;
-        return "";
-    },
+get startTime()
+{
+return this._startTime || -1;
+},
 
-    get startTime()
-    {
-        return this._startTime || -1;
-    },
+set startTime(x)
+{
+this._startTime = x;
+},
 
-    set startTime(x)
-    {
-        if (this._startTime === x)
-            return;
+get responseReceivedTime()
+{
+return this._responseReceivedTime || -1;
+},
 
-        this._startTime = x;
+set responseReceivedTime(x)
+{
+this._responseReceivedTime = x;
+},
 
-        if (WebInspector.panels.resources)
-            WebInspector.panels.resources.refreshResource(this);
-    },
+get endTime()
+{
+return this._endTime || -1;
+},
 
-    get responseReceivedTime()
-    {
-        return this._responseReceivedTime || -1;
-    },
+set endTime(x)
+{
+if (this.timing && this.timing.requestTime) {
 
-    set responseReceivedTime(x)
-    {
-        if (this._responseReceivedTime === x)
-            return;
+this._endTime = Math.max(x, this.responseReceivedTime);
+} else {
 
-        this._responseReceivedTime = x;
+this._endTime = x;
+if (this._responseReceivedTime > x)
+this._responseReceivedTime = x;
+}
+},
 
-        if (WebInspector.panels.resources)
-            WebInspector.panels.resources.refreshResource(this);
-    },
+get duration()
+{
+if (this._endTime === -1 || this._startTime === -1)
+return -1;
+return this._endTime - this._startTime;
+},
 
-    get endTime()
-    {
-        return this._endTime || -1;
-    },
+get latency()
+{
+if (this._responseReceivedTime === -1 || this._startTime === -1)
+return -1;
+return this._responseReceivedTime - this._startTime;
+},
 
-    set endTime(x)
-    {
-        if (this._endTime === x)
-            return;
+get receiveDuration()
+{
+if (this._endTime === -1 || this._responseReceivedTime === -1)
+return -1;
+return this._endTime - this._responseReceivedTime;
+},
 
-        this._endTime = x;
+get resourceSize()
+{
+return this._resourceSize || 0;
+},
 
-        if (WebInspector.panels.resources)
-            WebInspector.panels.resources.refreshResource(this);
-    },
+set resourceSize(x)
+{
+this._resourceSize = x;
+},
 
-    get duration()
-    {
-        if (this._endTime === -1 || this._startTime === -1)
-            return -1;
-        return this._endTime - this._startTime;
-    },
+get transferSize()
+{
 
-    get latency()
-    {
-        if (this._responseReceivedTime === -1 || this._startTime === -1)
-            return -1;
-        return this._responseReceivedTime - this._startTime;
-    },
+return this.cached ? 0 : Number(this.responseHeaders["Content-Length"] || this.resourceSize || 0);
+},
 
-    get resourceSize()
-    {
-        return this._resourceSize || 0;
-    },
+get expectedContentLength()
+{
+return this._expectedContentLength || 0;
+},
 
-    set resourceSize(x)
-    {
-        if (this._resourceSize === x)
-            return;
+set expectedContentLength(x)
+{
+this._expectedContentLength = x;
+},
 
-        this._resourceSize = x;
+get finished()
+{
+return this._finished;
+},
 
-        if (WebInspector.panels.resources)
-            WebInspector.panels.resources.refreshResource(this);
-    },
+set finished(x)
+{
+if (this._finished === x)
+return;
 
-    get transferSize()
-    {
-        // FIXME: this is wrong for chunked-encoding resources.
-        return this.cached ? 0 : Number(this.responseHeaders["Content-Length"] || this.resourceSize || 0);
-    },
+this._finished = x;
 
-    get expectedContentLength()
-    {
-        return this._expectedContentLength || 0;
-    },
+if (x) {
+this._checkWarnings();
+this.dispatchEventToListeners("finished");
+if (this._pendingContentCallbacks.length)
+this._innerRequestContent();
+}
+},
 
-    set expectedContentLength(x)
-    {
-        if (this._expectedContentLength === x)
-            return;
-        this._expectedContentLength = x;
-    },
+get failed()
+{
+return this._failed;
+},
 
-    get finished()
-    {
-        return this._finished;
-    },
+set failed(x)
+{
+this._failed = x;
+},
 
-    set finished(x)
-    {
-        if (this._finished === x)
-            return;
+get category()
+{
+return this._category;
+},
+
+set category(x)
+{
+this._category = x;
+},
+
+get cached()
+{
+return this._cached;
+},
+
+set cached(x)
+{
+this._cached = x;
+if (x)
+delete this._timing;
+},
+
+
+get timing()
+{
+return this._timing;
+},
+
+set timing(x)
+{
+if (x && !this._cached) {
+
+
+this._startTime = x.requestTime;
+this._responseReceivedTime = x.requestTime + x.receiveHeadersEnd / 1000.0;
+
+this._timing = x;
+this.dispatchEventToListeners("timing changed");
+}
+},
+
+get mimeType()
+{
+return this._mimeType;
+},
+
+set mimeType(x)
+{
+this._mimeType = x;
+},
+
+get type()
+{
+return this._type;
+},
+
+set type(x)
+{
+if (this._type === x)
+return;
+
+this._type = x;
+
+switch (x) {
+case WebInspector.Resource.Type.Document:
+this.category = WebInspector.resourceCategories.documents;
+break;
+case WebInspector.Resource.Type.Stylesheet:
+this.category = WebInspector.resourceCategories.stylesheets;
+break;
+case WebInspector.Resource.Type.Script:
+this.category = WebInspector.resourceCategories.scripts;
+break;
+case WebInspector.Resource.Type.Image:
+this.category = WebInspector.resourceCategories.images;
+break;
+case WebInspector.Resource.Type.Font:
+this.category = WebInspector.resourceCategories.fonts;
+break;
+case WebInspector.Resource.Type.XHR:
+this.category = WebInspector.resourceCategories.xhr;
+break;
+case WebInspector.Resource.Type.WebSocket:
+this.category = WebInspector.resourceCategories.websockets;
+break;
+case WebInspector.Resource.Type.Other:
+default:
+this.category = WebInspector.resourceCategories.other;
+break;
+}
+},
+
+get requestHeaders()
+{
+return this._requestHeaders || {};
+},
+
+set requestHeaders(x)
+{
+this._requestHeaders = x;
+delete this._sortedRequestHeaders;
+delete this._requestCookies;
+
+this.dispatchEventToListeners("requestHeaders changed");
+},
+
+get sortedRequestHeaders()
+{
+if (this._sortedRequestHeaders !== undefined)
+return this._sortedRequestHeaders;
+
+this._sortedRequestHeaders = [];
+for (var key in this.requestHeaders)
+this._sortedRequestHeaders.push({header: key, value: this.requestHeaders[key]});
+this._sortedRequestHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) });
+
+return this._sortedRequestHeaders;
+},
+
+requestHeaderValue: function(headerName)
+{
+return this._headerValue(this.requestHeaders, headerName);
+},
+
+get requestCookies()
+{
+if (!this._requestCookies)
+this._requestCookies = WebInspector.CookieParser.parseCookie(this.requestHeaderValue("Cookie"));
+return this._requestCookies;
+},
+
+get requestFormData()
+{
+return this._requestFormData;
+},
+
+set requestFormData(x)
+{
+this._requestFormData = x;
+delete this._parsedFormParameters;
+},
+
+get responseHeaders()
+{
+return this._responseHeaders || {};
+},
+
+set responseHeaders(x)
+{
+this._responseHeaders = x;
+delete this._sortedResponseHeaders;
+delete this._responseCookies;
+
+this.dispatchEventToListeners("responseHeaders changed");
+},
+
+get sortedResponseHeaders()
+{
+if (this._sortedResponseHeaders !== undefined)
+return this._sortedResponseHeaders;
+
+this._sortedResponseHeaders = [];
+for (var key in this.responseHeaders)
+this._sortedResponseHeaders.push({header: key, value: this.responseHeaders[key]});
+this._sortedResponseHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) });
 
-        this._finished = x;
+return this._sortedResponseHeaders;
+},
 
-        if (x) {
-            this._checkWarnings();
-            this.dispatchEventToListeners("finished");
-        }
-    },
+responseHeaderValue: function(headerName)
+{
+return this._headerValue(this.responseHeaders, headerName);
+},
 
-    get failed()
-    {
-        return this._failed;
-    },
+get responseCookies()
+{
+if (!this._responseCookies)
+this._responseCookies = WebInspector.CookieParser.parseSetCookie(this.responseHeaderValue("Set-Cookie"));
+return this._responseCookies;
+},
 
-    set failed(x)
-    {
-        this._failed = x;
-    },
+get queryParameters()
+{
+if (this._parsedQueryParameters)
+return this._parsedQueryParameters;
+var queryString = this.url.split("?", 2)[1];
+if (!queryString)
+return;
+this._parsedQueryParameters = this._parseParameters(queryString);
+return this._parsedQueryParameters;
+},
 
-    get category()
-    {
-        return this._category;
-    },
+get formParameters()
+{
+if (this._parsedFormParameters)
+return this._parsedFormParameters;
+if (!this.requestFormData)
+return;
+var requestContentType = this.requestHeaderValue("Content-Type");
+if (!requestContentType || !requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
+return;
+this._parsedFormParameters = this._parseParameters(this.requestFormData);
+return this._parsedFormParameters;
+},
 
-    set category(x)
-    {
-        if (this._category === x)
-            return;
+_parseParameters: function(queryString)
+{
+function parseNameValue(pair)
+{
+var parameter = {};
+var splitPair = pair.split("=", 2);
 
-        var oldCategory = this._category;
-        if (oldCategory)
-            oldCategory.removeResource(this);
+parameter.name = splitPair[0];
+if (splitPair.length === 1)
+parameter.value = "";
+else
+parameter.value = splitPair[1];
+return parameter;
+}
+return queryString.split("&").map(parseNameValue);
+},
 
-        this._category = x;
+_headerValue: function(headers, headerName)
+{
+headerName = headerName.toLowerCase();
+for (var header in headers) {
+if (header.toLowerCase() === headerName)
+return headers[header];
+}
+},
 
-        if (this._category)
-            this._category.addResource(this);
+get scripts()
+{
+if (!("_scripts" in this))
+this._scripts = [];
+return this._scripts;
+},
 
-        if (WebInspector.panels.resources) {
-            WebInspector.panels.resources.refreshResource(this);
-            WebInspector.panels.resources.recreateViewForResourceIfNeeded(this);
-        }
-    },
+addScript: function(script)
+{
+if (!script)
+return;
+this.scripts.unshift(script);
+script.resource = this;
+},
 
-    get mimeType()
-    {
-        return this._mimeType;
-    },
+removeAllScripts: function()
+{
+if (!this._scripts)
+return;
 
-    set mimeType(x)
-    {
-        if (this._mimeType === x)
-            return;
+for (var i = 0; i < this._scripts.length; ++i) {
+if (this._scripts[i].resource === this)
+delete this._scripts[i].resource;
+}
 
-        this._mimeType = x;
-    },
+delete this._scripts;
+},
 
-    get type()
-    {
-        return this._type;
-    },
+removeScript: function(script)
+{
+if (!script)
+return;
 
-    set type(x)
-    {
-        if (this._type === x)
-            return;
+if (script.resource === this)
+delete script.resource;
 
-        this._type = x;
+if (!this._scripts)
+return;
 
-        switch (x) {
-            case WebInspector.Resource.Type.Document:
-                this.category = WebInspector.resourceCategories.documents;
-                break;
-            case WebInspector.Resource.Type.Stylesheet:
-                this.category = WebInspector.resourceCategories.stylesheets;
-                break;
-            case WebInspector.Resource.Type.Script:
-                this.category = WebInspector.resourceCategories.scripts;
-                break;
-            case WebInspector.Resource.Type.Image:
-                this.category = WebInspector.resourceCategories.images;
-                break;
-            case WebInspector.Resource.Type.Font:
-                this.category = WebInspector.resourceCategories.fonts;
-                break;
-            case WebInspector.Resource.Type.XHR:
-                this.category = WebInspector.resourceCategories.xhr;
-                break;
-            case WebInspector.Resource.Type.Other:
-            default:
-                this.category = WebInspector.resourceCategories.other;
-                break;
-        }
-    },
+this._scripts.remove(script);
+},
 
-    get requestHeaders()
-    {
-        if (this._requestHeaders === undefined)
-            this._requestHeaders = {};
-        return this._requestHeaders;
-    },
+get errors()
+{
+return this._errors || 0;
+},
 
-    set requestHeaders(x)
-    {
-        if (this._requestHeaders === x)
-            return;
+set errors(x)
+{
+this._errors = x;
+this.dispatchEventToListeners("errors-warnings-updated");
+},
 
-        this._requestHeaders = x;
-        delete this._sortedRequestHeaders;
+get warnings()
+{
+return this._warnings || 0;
+},
 
-        this.dispatchEventToListeners("requestHeaders changed");
-    },
+set warnings(x)
+{
+this._warnings = x;
+this.dispatchEventToListeners("errors-warnings-updated");
+},
 
-    get sortedRequestHeaders()
-    {
-        if (this._sortedRequestHeaders !== undefined)
-            return this._sortedRequestHeaders;
+clearErrorsAndWarnings: function()
+{
+this._warnings = 0;
+this._errors = 0;
+this.dispatchEventToListeners("errors-warnings-updated");
+},
 
-        this._sortedRequestHeaders = [];
-        for (var key in this.requestHeaders)
-            this._sortedRequestHeaders.push({header: key, value: this.requestHeaders[key]});
-        this._sortedRequestHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) });
+_mimeTypeIsConsistentWithType: function()
+{
 
-        return this._sortedRequestHeaders;
-    },
 
-    get responseHeaders()
-    {
-        if (this._responseHeaders === undefined)
-            this._responseHeaders = {};
-        return this._responseHeaders;
-    },
 
-    set responseHeaders(x)
-    {
-        if (this._responseHeaders === x)
-            return;
+if (this.statusCode >= 400)
+return true;
 
-        this._responseHeaders = x;
-        delete this._sortedResponseHeaders;
+if (typeof this.type === "undefined"
+|| this.type === WebInspector.Resource.Type.Other
+|| this.type === WebInspector.Resource.Type.XHR
+|| this.type === WebInspector.Resource.Type.WebSocket)
+return true;
 
-        this.dispatchEventToListeners("responseHeaders changed");
-    },
+if (!this.mimeType)
+return true; 
 
-    get sortedResponseHeaders()
-    {
-        if (this._sortedResponseHeaders !== undefined)
-            return this._sortedResponseHeaders;
+if (this.mimeType in WebInspector.MIMETypes)
+return this.type in WebInspector.MIMETypes[this.mimeType];
 
-        this._sortedResponseHeaders = [];
-        for (var key in this.responseHeaders)
-            this._sortedResponseHeaders.push({header: key, value: this.responseHeaders[key]});
-        this._sortedResponseHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) });
+return false;
+},
 
-        return this._sortedResponseHeaders;
-    },
+_checkWarnings: function()
+{
+for (var warning in WebInspector.Warnings)
+this._checkWarning(WebInspector.Warnings[warning]);
+},
 
-    get scripts()
-    {
-        if (!("_scripts" in this))
-            this._scripts = [];
-        return this._scripts;
-    },
+_checkWarning: function(warning)
+{
+var msg;
+switch (warning.id) {
+case WebInspector.Warnings.IncorrectMIMEType.id:
+if (!this._mimeTypeIsConsistentWithType())
+msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
+WebInspector.ConsoleMessage.MessageType.Log,
+WebInspector.ConsoleMessage.MessageLevel.Warning,
+-1,
+this.url,
+1,
+String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message, WebInspector.Resource.Type.toUIString(this.type), this.mimeType),
+null,
+null);
+break;
+}
 
-    addScript: function(script)
-    {
-        if (!script)
-            return;
-        this.scripts.unshift(script);
-        script.resource = this;
-    },
+if (msg)
+WebInspector.console.addMessage(msg);
+},
 
-    removeAllScripts: function()
-    {
-        if (!this._scripts)
-            return;
+get content()
+{
+return this._content;
+},
 
-        for (var i = 0; i < this._scripts.length; ++i) {
-            if (this._scripts[i].resource === this)
-                delete this._scripts[i].resource;
-        }
+get contentTimestamp()
+{
+return this._contentTimestamp;
+},
 
-        delete this._scripts;
-    },
+setInitialContent: function(content)
+{
+this._content = content;
+},
 
-    removeScript: function(script)
-    {
-        if (!script)
-            return;
+isLocallyModified: function()
+{
+return !!this._baseRevision;
+},
 
-        if (script.resource === this)
-            delete script.resource;
+setContent: function(newContent, onRevert)
+{
+var revisionResource = new WebInspector.Resource(null, this.url);
+revisionResource.type = this.type;
+revisionResource.loader = this.loader;
+revisionResource.timestamp = this.timestamp;
+revisionResource._content = this._content;
+revisionResource._actualResource = this;
+revisionResource._fireOnRevert = onRevert;
 
-        if (!this._scripts)
-            return;
+if (this.finished)
+revisionResource.finished = true;
+else {
+function finished()
+{
+this.removeEventListener("finished", finished);
+revisionResource.finished = true;
+}
+this.addEventListener("finished", finished.bind(this));
+}
 
-        this._scripts.remove(script);
-    },
+if (!this._baseRevision)
+this._baseRevision = revisionResource;
+else
+revisionResource._baseRevision = this._baseRevision;
 
-    get errors()
-    {
-        return this._errors || 0;
-    },
+var data = { revision: revisionResource };
+this._content = newContent;
+this.timestamp = new Date();
+this.dispatchEventToListeners("content-changed", data);
+},
 
-    set errors(x)
-    {
-        this._errors = x;
-    },
+revertToThis: function()
+{
+if (!this._actualResource || !this._fireOnRevert)
+return;
 
-    get warnings()
-    {
-        return this._warnings || 0;
-    },
+function callback(content)
+{
+if (content)
+this._fireOnRevert(content);
+}
+this.requestContent(callback.bind(this));
+},
 
-    set warnings(x)
-    {
-        this._warnings = x;
-    },
+get baseRevision()
+{
+return this._baseRevision;
+},
 
-    _mimeTypeIsConsistentWithType: function()
-    {
-        if (typeof this.type === "undefined"
-         || this.type === WebInspector.Resource.Type.Other
-         || this.type === WebInspector.Resource.Type.XHR)
-            return true;
+requestContent: function(callback)
+{
+if (this._content) {
+callback(this._content, this._contentEncoded);
+return;
+}
+this._pendingContentCallbacks.push(callback);
+if (this.finished)
+this._innerRequestContent();
+},
 
-        if (this.mimeType in WebInspector.MIMETypes)
-            return this.type in WebInspector.MIMETypes[this.mimeType];
+get contentURL()
+{
+const maxDataUrlSize = 1024 * 1024;
 
-        return false;
-    },
+if (!this._content || this._content.length > maxDataUrlSize)
+return this.url;
 
-    _checkWarnings: function()
-    {
-        for (var warning in WebInspector.Warnings)
-            this._checkWarning(WebInspector.Warnings[warning]);
-    },
+return "data:" + this.mimeType + (this._contentEncoded ? ";base64," : ",") + this._content;
+},
 
-    _checkWarning: function(warning)
-    {
-        var msg;
-        switch (warning.id) {
-            case WebInspector.Warnings.IncorrectMIMEType.id:
-                if (!this._mimeTypeIsConsistentWithType())
-                    msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other,
-                        WebInspector.ConsoleMessage.MessageType.Log, 
-                        WebInspector.ConsoleMessage.MessageLevel.Warning, -1, this.url, null, 1,
-                        String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message,
-                        WebInspector.Resource.Type.toString(this.type), this.mimeType));
-                break;
-        }
+_innerRequestContent: function()
+{
+if (this._contentRequested)
+return;
+this._contentRequested = true;
+this._contentEncoded = !WebInspector.Resource.Type.isTextType(this.type);
 
-        if (msg)
-            WebInspector.console.addMessage(msg);
-    }
+function onResourceContent(data)
+{
+this._content = data;
+var callbacks = this._pendingContentCallbacks.slice();
+for (var i = 0; i < callbacks.length; ++i)
+callbacks[i](this._content, this._contentEncoded);
+this._pendingContentCallbacks.length = 0;
+delete this._contentRequested;
+}
+WebInspector.ResourceManager.requestContent(this, this._contentEncoded, onResourceContent.bind(this));
+}
 }
 
 WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype;
 
-WebInspector.Resource.CompareByStartTime = function(a, b)
+
+
+
+
+WebInspector.ResourceManager = function()
 {
-    return a.startTime - b.startTime;
+this._registerNotifyHandlers(
+"identifierForInitialRequest",
+"willSendRequest",
+"markResourceAsCached",
+"didReceiveResponse",
+"didReceiveContentLength",
+"didFinishLoading",
+"didFailLoading",
+"didLoadResourceFromMemoryCache",
+"setInitialContent",
+"didCommitLoadForFrame",
+"frameDetachedFromParent",
+"didCreateWebSocket",
+"willSendWebSocketHandshakeRequest",
+"didReceiveWebSocketHandshakeResponse",
+"didCloseWebSocket");
+
+this._resourcesById = {};
+this._resourcesByURL = {};
+this._resourceTreeModel = new WebInspector.ResourceTreeModel();
+InspectorBackend.cachedResources(this._processCachedResources.bind(this));
 }
 
-WebInspector.Resource.CompareByResponseReceivedTime = function(a, b)
+WebInspector.ResourceManager.prototype = {
+_registerNotifyHandlers: function()
 {
-    var aVal = a.responseReceivedTime;
-    var bVal = b.responseReceivedTime;
-    if (aVal === -1 ^ bVal === -1)
-        return bVal - aVal;
-    return aVal - bVal;
+for (var i = 0; i < arguments.length; ++i)
+WebInspector[arguments[i]] = this[arguments[i]].bind(this);
+},
+
+identifierForInitialRequest: function(identifier, url, loader)
+{
+var resource = this._createResource(identifier, url, loader);
+
+
+this._bindResourceURL(resource);
+
+WebInspector.panels.network.refreshResource(resource);
+WebInspector.panels.audits.resourceStarted(resource);
+},
+
+_createResource: function(identifier, url, loader)
+{
+var resource = new WebInspector.Resource(identifier, url);
+resource.loader = loader;
+if (loader)
+resource.documentURL = loader.url;
+
+this._resourcesById[identifier] = resource;
+return resource;
+},
+
+willSendRequest: function(identifier, time, request, redirectResponse)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+
+
+var isRedirect = !redirectResponse.isNull && request.url.length;
+if (isRedirect) {
+resource.endTime = time;
+this.didReceiveResponse(identifier, time, "Other", redirectResponse);
+resource = this._appendRedirect(resource.identifier, request.url);
 }
 
-WebInspector.Resource.CompareByEndTime = function(a, b)
+this._updateResourceWithRequest(resource, request);
+resource.startTime = time;
+
+if (isRedirect) {
+WebInspector.panels.network.refreshResource(resource);
+WebInspector.panels.audits.resourceStarted(resource);
+} else 
+WebInspector.panels.network.refreshResource(resource);
+},
+
+_updateResourceWithRequest: function(resource, request)
 {
-    var aVal = a.endTime;
-    var bVal = b.endTime;
-    if (aVal === -1 ^ bVal === -1)
-        return bVal - aVal;
-    return aVal - bVal;
+resource.requestMethod = request.httpMethod;
+resource.requestHeaders = request.httpHeaderFields;
+resource.requestFormData = request.requestFormData;
+},
+
+_appendRedirect: function(identifier, redirectURL)
+{
+var originalResource = this._resourcesById[identifier];
+originalResource.identifier = null;
+
+var newResource = this._createResource(identifier, redirectURL, originalResource.loader);
+newResource.redirects = originalResource.redirects || [];
+delete originalResource.redirects;
+newResource.redirects.push(originalResource);
+return newResource;
+},
+
+markResourceAsCached: function(identifier)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.cached = true;
+WebInspector.panels.network.refreshResource(resource);
+},
+
+didReceiveResponse: function(identifier, time, resourceType, response)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.responseReceivedTime = time;
+resource.type = WebInspector.Resource.Type[resourceType];
+
+this._updateResourceWithResponse(resource, response);
+
+WebInspector.panels.network.refreshResource(resource);
+this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
+},
+
+_updateResourceWithResponse: function(resource, response)
+{
+if (resource.isNull)
+return;
+
+resource.mimeType = response.mimeType;
+resource.expectedContentLength = response.expectedContentLength;
+resource.textEncodingName = response.textEncodingName;
+resource.suggestedFilename = response.suggestedFilename;
+resource.statusCode = response.httpStatusCode;
+resource.statusText = response.httpStatusText;
+
+resource.responseHeaders = response.httpHeaderFields;
+resource.connectionReused = response.connectionReused;
+resource.connectionID = response.connectionID;
+
+if (response.wasCached)
+resource.cached = true;
+else
+resource.timing = response.timing;
+
+if (response.loadInfo) {
+if (response.loadInfo.httpStatusCode)
+resource.statusCode = response.loadInfo.httpStatusCode;
+if (response.loadInfo.httpStatusText)
+resource.statusText = response.loadInfo.httpStatusText;
+resource.requestHeaders = response.loadInfo.requestHeaders;
+resource.responseHeaders = response.loadInfo.responseHeaders;
+}
+},
+
+didReceiveContentLength: function(identifier, time, lengthReceived)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.resourceSize += lengthReceived;
+resource.endTime = time;
+
+WebInspector.panels.network.refreshResource(resource);
+},
+
+didFinishLoading: function(identifier, finishTime)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.endTime = finishTime;
+resource.finished = true;
+
+WebInspector.panels.network.refreshResource(resource);
+WebInspector.panels.audits.resourceFinished(resource);
+WebInspector.extensionServer.notifyResourceFinished(resource);
+delete this._resourcesById[identifier];
+},
+
+didFailLoading: function(identifier, time, localizedDescription)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.failed = true;
+resource.localizedFailDescription = localizedDescription;
+resource.finished = true;
+resource.endTime = time;
+
+WebInspector.panels.network.refreshResource(resource);
+WebInspector.panels.audits.resourceFinished(resource);
+WebInspector.extensionServer.notifyResourceFinished(resource);
+delete this._resourcesById[identifier];
+},
+
+didLoadResourceFromMemoryCache: function(time, cachedResource)
+{
+var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
+this._updateResourceWithCachedResource(resource, cachedResource);
+resource.cached = true;
+resource.requestMethod = "GET";
+resource.startTime = resource.responseReceivedTime = resource.endTime = time;
+resource.finished = true;
+
+WebInspector.panels.network.refreshResource(resource);
+WebInspector.panels.audits.resourceStarted(resource);
+WebInspector.panels.audits.resourceFinished(resource);
+this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource);
+},
+
+_updateResourceWithCachedResource: function(resource, cachedResource)
+{
+resource.type = WebInspector.Resource.Type[cachedResource.type];
+resource.resourceSize = cachedResource.encodedSize;
+this._updateResourceWithResponse(resource, cachedResource.response);
+},
+
+setInitialContent: function(identifier, sourceString, type)
+{
+var resource = WebInspector.panels.network.resources[identifier];
+if (!resource)
+return;
+
+resource.type = WebInspector.Resource.Type[type];
+resource.setInitialContent(sourceString);
+WebInspector.panels.resources.refreshResource(resource);
+WebInspector.panels.network.refreshResource(resource);
+},
+
+didCommitLoadForFrame: function(frame, loader)
+{
+this._resourceTreeModel.didCommitLoadForFrame(frame, loader);
+if (!frame.parentId) {
+var mainResource = this.resourceForURL(frame.url);
+if (mainResource) {
+WebInspector.mainResource = mainResource;
+mainResource.isMainResource = true;
+}
+}
+},
+
+frameDetachedFromParent: function(frameId)
+{
+this._resourceTreeModel.frameDetachedFromParent(frameId);
+},
+
+didCreateWebSocket: function(identifier, requestURL)
+{
+var resource = this._createResource(identifier, requestURL);
+resource.type = WebInspector.Resource.Type.WebSocket;
+WebInspector.panels.network.refreshResource(resource);
+},
+
+willSendWebSocketHandshakeRequest: function(identifier, time, request)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.requestMethod = "GET";
+resource.requestHeaders = request.webSocketHeaderFields;
+resource.webSocketRequestKey3 = request.webSocketRequestKey3;
+resource.startTime = time;
+
+WebInspector.panels.network.refreshResource(resource);
+},
+
+didReceiveWebSocketHandshakeResponse: function(identifier, time, response)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+
+resource.statusCode = response.statusCode;
+resource.statusText = response.statusText;
+resource.responseHeaders = response.webSocketHeaderFields;
+resource.webSocketChallengeResponse = response.webSocketChallengeResponse;
+resource.responseReceivedTime = time;
+
+WebInspector.panels.network.refreshResource(resource);
+},
+
+didCloseWebSocket: function(identifier, time)
+{
+var resource = this._resourcesById[identifier];
+if (!resource)
+return;
+resource.endTime = time;
+
+WebInspector.panels.network.refreshResource(resource);
+},
+
+_processCachedResources: function(mainFramePayload)
+{
+var mainResource = this._addFramesRecursively(mainFramePayload);
+WebInspector.mainResource = mainResource;
+mainResource.isMainResource = true;
+},
+
+_addFramesRecursively: function(framePayload)
+{
+var frameResource = this._createResource(null, framePayload.resource.url, framePayload.resource.loader);
+this._updateResourceWithRequest(frameResource, framePayload.resource.request);
+this._updateResourceWithResponse(frameResource, framePayload.resource.response);
+frameResource.type = WebInspector.Resource.Type["Document"];
+frameResource.finished = true;
+this._bindResourceURL(frameResource);
+
+this._resourceTreeModel.addOrUpdateFrame(framePayload);
+this._resourceTreeModel.addResourceToFrame(framePayload.id, frameResource);
+
+for (var i = 0; framePayload.children && i < framePayload.children.length; ++i)
+this._addFramesRecursively(framePayload.children[i]);
+
+if (!framePayload.subresources)
+return;
+
+for (var i = 0; i < framePayload.subresources.length; ++i) {
+var cachedResource = framePayload.subresources[i];
+var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
+this._updateResourceWithCachedResource(resource, cachedResource);
+resource.finished = true;
+this._bindResourceURL(resource);
+this._resourceTreeModel.addResourceToFrame(framePayload.id, resource);
+}
+return frameResource;
+},
+
+resourceForURL: function(url)
+{
+
+var entry = this._resourcesByURL[url];
+if (entry instanceof Array)
+return entry[0];
+return entry;
+},
+
+addConsoleMessage: function(msg)
+{
+var resource = this.resourceForURL(msg.url);
+if (!resource)
+return;
+
+switch (msg.level) {
+case WebInspector.ConsoleMessage.MessageLevel.Warning:
+resource.warnings += msg.repeatDelta;
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Error:
+resource.errors += msg.repeatDelta;
+break;
 }
 
-WebInspector.Resource.CompareByDuration = function(a, b)
+var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+if (view.addMessage)
+view.addMessage(msg);
+},
+
+clearConsoleMessages: function()
 {
-    return a.duration - b.duration;
+function callback(resource)
+{
+resource.clearErrorsAndWarnings();
+}
+this._resourceTreeModel.forAllResources(callback);
+},
+
+forAllResources: function(callback)
+{
+this._resourceTreeModel.forAllResources(callback);
+},
+
+_bindResourceURL: function(resource)
+{
+var resourceForURL = this._resourcesByURL[resource.url];
+if (!resourceForURL)
+this._resourcesByURL[resource.url] = resource;
+else if (resourceForURL instanceof Array)
+resourceForURL.push(resource);
+else
+this._resourcesByURL[resource.url] = [resourceForURL, resource];
+},
+
+_unbindResourceURL: function(resource)
+{
+var resourceForURL = this._resourcesByURL[resource.url];
+if (!resourceForURL)
+return;
+
+if (resourceForURL instanceof Array) {
+resourceForURL.remove(resource, true);
+if (resourceForURL.length === 1)
+this._resourcesByURL[resource.url] = resourceForURL[0];
+return;
 }
 
-WebInspector.Resource.CompareByLatency = function(a, b)
-{
-    return a.latency - b.latency;
+delete this._resourcesByURL[resource.url];
+}
 }
 
-WebInspector.Resource.CompareBySize = function(a, b)
+WebInspector.ResourceManager.createResourceView = function(resource)
 {
-    return a.resourceSize - b.resourceSize;
+switch (resource.category) {
+case WebInspector.resourceCategories.documents:
+case WebInspector.resourceCategories.stylesheets:
+case WebInspector.resourceCategories.scripts:
+case WebInspector.resourceCategories.xhr:
+return new WebInspector.SourceView(resource);
+case WebInspector.resourceCategories.images:
+return new WebInspector.ImageView(resource);
+case WebInspector.resourceCategories.fonts:
+return new WebInspector.FontView(resource);
+default:
+return new WebInspector.ResourceView(resource);
+}
 }
 
-WebInspector.Resource.CompareByTransferSize = function(a, b)
+WebInspector.ResourceManager.resourceViewTypeMatchesResource = function(resource)
 {
-    return a.transferSize - b.transferSize;
+var resourceView = resource._resourcesView;
+switch (resource.category) {
+case WebInspector.resourceCategories.documents:
+case WebInspector.resourceCategories.stylesheets:
+case WebInspector.resourceCategories.scripts:
+case WebInspector.resourceCategories.xhr:
+return resourceView.__proto__ === WebInspector.SourceView.prototype;
+case WebInspector.resourceCategories.images:
+return resourceView.__proto__ === WebInspector.ImageView.prototype;
+case WebInspector.resourceCategories.fonts:
+return resourceView.__proto__ === WebInspector.FontView.prototype;
+default:
+return resourceView.__proto__ === WebInspector.ResourceView.prototype;
+}
+}
+
+WebInspector.ResourceManager.resourceViewForResource = function(resource)
+{
+if (!resource)
+return null;
+if (!resource._resourcesView)
+resource._resourcesView = WebInspector.ResourceManager.createResourceView(resource);
+return resource._resourcesView;
+}
+
+WebInspector.ResourceManager.recreateResourceView = function(resource)
+{
+var newView = WebInspector.ResourceManager.createResourceView(resource);
+
+var oldView = resource._resourcesView;
+var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null;
+var scrollTop = oldView.scrollTop;
+
+resource._resourcesView.detach();
+delete resource._resourcesView;
+
+resource._resourcesView = newView;
+
+if (oldViewParentNode)
+newView.show(oldViewParentNode);
+if (scrollTop)
+newView.scrollTop = scrollTop;
+
+WebInspector.panels.scripts.viewRecreated(oldView, newView);
+return newView;
+}
+
+WebInspector.ResourceManager.existingResourceViewForResource = function(resource)
+{
+if (!resource)
+return null;
+return resource._resourcesView;
+}
+
+WebInspector.ResourceManager.requestContent = function(resource, base64Encode, callback)
+{
+InspectorBackend.resourceContent(resource.loader.frameId, resource.url, base64Encode, callback);
+}
+
+WebInspector.ResourceTreeModel = function()
+{
+this._resourcesByFrameId = {};
+this._subframes = {};
+}
+
+WebInspector.ResourceTreeModel.prototype = {
+addOrUpdateFrame: function(frame)
+{
+var tmpResource = new WebInspector.Resource(null, frame.url);
+WebInspector.panels.resources.addOrUpdateFrame(frame.parentId, frame.id, frame.name, tmpResource.displayName);
+var subframes = this._subframes[frame.parentId];
+if (!subframes) {
+subframes = {};
+this._subframes[frame.parentId || 0] = subframes;
+}
+subframes[frame.id] = true;
+},
+
+didCommitLoadForFrame: function(frame, loader)
+{
+
+this._clearChildFramesAndResources(frame.parentId ? frame.id : 0, loader.loaderId);
+
+this.addOrUpdateFrame(frame);
+
+var resourcesForFrame = this._resourcesByFrameId[frame.id];
+for (var i = 0; resourcesForFrame && i < resourcesForFrame.length; ++i) {
+WebInspector.resourceManager._bindResourceURL(resourcesForFrame[i]);
+WebInspector.panels.resources.addResourceToFrame(frame.id, resourcesForFrame[i]);
+}
+},
+
+frameDetachedFromParent: function(frameId)
+{
+this._clearChildFramesAndResources(frameId, 0);
+WebInspector.panels.resources.removeFrame(frameId);
+},
+
+_clearChildFramesAndResources: function(frameId, loaderId)
+{
+WebInspector.panels.resources.removeResourcesFromFrame(frameId);
+
+this._clearResources(frameId, loaderId);
+var subframes = this._subframes[frameId];
+if (!subframes)
+return;
+
+for (var childFrameId in subframes) {
+WebInspector.panels.resources.removeFrame(childFrameId);
+this._clearChildFramesAndResources(childFrameId, loaderId);
+}
+delete this._subframes[frameId];
+},
+
+addResourceToFrame: function(frameId, resource)
+{
+var resourcesForFrame = this._resourcesByFrameId[frameId];
+if (!resourcesForFrame) {
+resourcesForFrame = [];
+this._resourcesByFrameId[frameId] = resourcesForFrame;
+}
+resourcesForFrame.push(resource);
+
+WebInspector.panels.resources.addResourceToFrame(frameId, resource);
+},
+
+_clearResources: function(frameId, loaderToPreserveId)
+{
+var resourcesForFrame = this._resourcesByFrameId[frameId];
+if (!resourcesForFrame)
+return;
+
+var preservedResourcesForFrame = [];
+for (var i = 0; i < resourcesForFrame.length; ++i) {
+var resource = resourcesForFrame[i];
+if (resource.loader.loaderId === loaderToPreserveId) {
+preservedResourcesForFrame.push(resource);
+continue;
+}
+WebInspector.resourceManager._unbindResourceURL(resource);
+}
+
+delete this._resourcesByFrameId[frameId];
+if (preservedResourcesForFrame.length)
+this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
+},
+
+forAllResources: function(callback)
+{
+this._callForFrameResources(0, callback);
+},
+
+_callForFrameResources: function(frameId, callback)
+{
+var resources = this._resourcesByFrameId[frameId];
+for (var i = 0; resources && i < resources.length; ++i) {
+if (callback(resources[i]))
+return true;
+}
+
+var frames = this._subframes[frameId];
+if (frames) {
+for (var id in frames) {
+if (this._callForFrameResources(id, callback))
+return true;
+}
+}
+return false;
+}
 }
 
 
-WebInspector.Resource.StatusTextForCode = function(code)
-{
-    return code ? code + " " + WebInspector.Resource.StatusText[code] : "";
-}
 
-/* ResourceCategory.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
 WebInspector.ResourceCategory = function(name, title, color)
 {
-    WebInspector.AbstractTimelineCategory.call(this, name, title, color);
-    this.resources = [];
+this.name = name;
+this.title = title;
+this.color = color;
 }
 
 WebInspector.ResourceCategory.prototype = {
-
-    addResource: function(resource)
-    {
-        var a = resource;
-        var resourcesLength = this.resources.length;
-        for (var i = 0; i < resourcesLength; ++i) {
-            var b = this.resources[i];
-            if (a._lastPathComponentLowerCase && b._lastPathComponentLowerCase)
-                if (a._lastPathComponentLowerCase < b._lastPathComponentLowerCase)
-                    break;
-            else if (a.name && b.name)
-                if (a.name < b.name)
-                    break;
-        }
-
-        this.resources.splice(i, 0, resource);
-    },
-
-    removeResource: function(resource)
-    {
-        this.resources.remove(resource, true);
-    },
-
-    removeAllResources: function(resource)
-    {
-        this.resources = [];
-    }
+toString: function()
+{
+return this.title;
+}
 }
 
-WebInspector.ResourceCategory.prototype.__proto__ = WebInspector.AbstractTimelineCategory.prototype;
 
-/* Database.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
 
 WebInspector.Database = function(id, domain, name, version)
 {
-    this._id = id;
-    this._domain = domain;
-    this._name = name;
-    this._version = version;
+this._id = id;
+this._domain = domain;
+this._name = name;
+this._version = version;
 }
 
+WebInspector.Database.successCallbacks = {};
+WebInspector.Database.errorCallbacks = {};
+
 WebInspector.Database.prototype = {
-    get id()
-    {
-        return this._id;
-    },
+get id()
+{
+return this._id;
+},
 
-    get name()
-    {
-        return this._name;
-    },
+get name()
+{
+return this._name;
+},
 
-    set name(x)
-    {
-        this._name = x;
-    },
+set name(x)
+{
+this._name = x;
+},
 
-    get version()
-    {
-        return this._version;
-    },
+get version()
+{
+return this._version;
+},
 
-    set version(x)
-    {
-        this._version = x;
-    },
+set version(x)
+{
+this._version = x;
+},
 
-    get domain()
-    {
-        return this._domain;
-    },
+get domain()
+{
+return this._domain;
+},
 
-    set domain(x)
-    {
-        this._domain = x;
-    },
+set domain(x)
+{
+this._domain = x;
+},
 
-    get displayDomain()
-    {
-        return WebInspector.Resource.prototype.__lookupGetter__("displayDomain").call(this);
-    },
+get displayDomain()
+{
+return WebInspector.Resource.prototype.__lookupGetter__("displayDomain").call(this);
+},
 
-    getTableNames: function(callback)
-    {
-        function sortingCallback(names)
-        {
-            callback(names.sort());
-        }
-        var callId = WebInspector.Callback.wrap(sortingCallback);
-        InspectorBackend.getDatabaseTableNames(callId, this._id);
-    },
-    
-    executeSql: function(query, onSuccess, onError)
-    {
-        function callback(result)
-        {
-            if (!(result instanceof Array)) {
-                onError(result);
-                return;
-            }
-            onSuccess(result);
-        }
-        // FIXME: execute the query in the frame the DB comes from.
-        InjectedScriptAccess.getDefault().executeSql(this._id, query, callback);
-    }
+getTableNames: function(callback)
+{
+function sortingCallback(names)
+{
+callback(names.sort());
+}
+InspectorBackend.getDatabaseTableNames(this._id, sortingCallback);
+},
+
+executeSql: function(query, onSuccess, onError)
+{
+function callback(success, transactionId)
+{
+if (!success) {
+onError(WebInspector.UIString("Database not found."));
+return;
+}
+WebInspector.Database.successCallbacks[transactionId] = onSuccess;
+WebInspector.Database.errorCallbacks[transactionId] = onError;
+}
+InspectorBackend.executeSQL(this._id, query, callback);
+}
 }
 
-WebInspector.didGetDatabaseTableNames = WebInspector.Callback.processCallback;
+WebInspector.sqlTransactionSucceeded = function(transactionId, columnNames, values)
+{
+var callback = WebInspector.Database.successCallbacks[transactionId];
+if (!callback)
+return;
+delete WebInspector.Database.successCallbacks[transactionId];
+callback(columnNames, values);
+}
 
-/* DOMStorage.js */
+WebInspector.sqlTransactionFailed = function(transactionId, errorObj)
+{
+var callback = WebInspector.Database.errorCallbacks[transactionId];
+if (!callback)
+return;
+delete WebInspector.Database.errorCallbacks[transactionId];
+callback(errorObj);
+}
 
-/*
- * Copyright (C) 2008 Nokia Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
 
 WebInspector.DOMStorage = function(id, domain, isLocalStorage)
 {
-    this._id = id;
-    this._domain = domain;
-    this._isLocalStorage = isLocalStorage;
+this._id = id;
+this._domain = domain;
+this._isLocalStorage = isLocalStorage;
 }
 
 WebInspector.DOMStorage.prototype = {
-    get id()
-    {
-        return this._id;
-    },
+get id()
+{
+return this._id;
+},
 
-    get domStorage()
-    {
-        return this._domStorage;
-    },
+get domStorage()
+{
+return this._domStorage;
+},
 
-    get domain()
-    {
-        return this._domain;
-    },
+get domain()
+{
+return this._domain;
+},
 
-    get isLocalStorage()
-    {
-        return this._isLocalStorage;
-    },
+get isLocalStorage()
+{
+return this._isLocalStorage;
+},
 
-    getEntries: function(callback)
-    {
-        var callId = WebInspector.Callback.wrap(callback);
-        InspectorBackend.getDOMStorageEntries(callId, this._id);
-    },
-    
-    setItem: function(key, value, callback)
-    {
-        var callId = WebInspector.Callback.wrap(callback);
-        InspectorBackend.setDOMStorageItem(callId, this._id, key, value);
-    },
-    
-    removeItem: function(key, callback)
-    {
-        var callId = WebInspector.Callback.wrap(callback);
-        InspectorBackend.removeDOMStorageItem(callId, this._id, key);
-    }
+getEntries: function(callback)
+{
+InspectorBackend.getDOMStorageEntries(this._id, callback);
+},
+
+setItem: function(key, value, callback)
+{
+InspectorBackend.setDOMStorageItem(this._id, key, value, callback);
+},
+
+removeItem: function(key, callback)
+{
+InspectorBackend.removeDOMStorageItem(this._id, key, callback);
+}
 }
 
-WebInspector.didGetDOMStorageEntries = WebInspector.Callback.processCallback;
-WebInspector.didSetDOMStorageItem = WebInspector.Callback.processCallback;
-WebInspector.didRemoveDOMStorageItem = WebInspector.Callback.processCallback;
 
-/* DOMStorageItemsView.js */
 
-/*
- * Copyright (C) 2008 Nokia Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.DOMStorageItemsView = function(domStorage)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.domStorage = domStorage;
+this.domStorage = domStorage;
 
-    this.element.addStyleClass("storage-view");
-    this.element.addStyleClass("table");
+this.element.addStyleClass("storage-view");
+this.element.addStyleClass("table");
 
-    this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
-    this.deleteButton.visible = false;
-    this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
+this.deleteButton.visible = false;
+this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
 
-    this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
+this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
 }
 
 WebInspector.DOMStorageItemsView.prototype = {
-    get statusBarItems()
-    {
-        return [this.refreshButton.element, this.deleteButton.element];
-    },
+get statusBarItems()
+{
+return [this.refreshButton.element, this.deleteButton.element];
+},
 
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this.update();
-    },
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this.update();
+},
 
-    hide: function()
-    {
-        WebInspector.View.prototype.hide.call(this);
-        this.deleteButton.visible = false;
-    },
+hide: function()
+{
+WebInspector.View.prototype.hide.call(this);
+this.deleteButton.visible = false;
+},
 
-    update: function()
-    {
-        this.element.removeChildren();
-        var callback = this._showDOMStorageEntries.bind(this);
-        this.domStorage.getEntries(callback);
-    },
+update: function()
+{
+this.element.removeChildren();
+var callback = this._showDOMStorageEntries.bind(this);
+this.domStorage.getEntries(callback);
+},
 
-    _showDOMStorageEntries: function(entries)
-    {
-        this._dataGrid = this._dataGridForDOMStorageEntries(entries);
-        this.element.appendChild(this._dataGrid.element);
-        this._dataGrid.autoSizeColumns(10);
-        this.deleteButton.visible = true;
-    },
+_showDOMStorageEntries: function(entries)
+{
+this._dataGrid = this._dataGridForDOMStorageEntries(entries);
+this.element.appendChild(this._dataGrid.element);
+this._dataGrid.autoSizeColumns(10);
+this.deleteButton.visible = true;
+},
 
-    resize: function()
-    {
-        if (this._dataGrid)
-            this._dataGrid.updateWidths();
-    },
+resize: function()
+{
+if (this._dataGrid)
+this._dataGrid.updateWidths();
+},
 
-    _dataGridForDOMStorageEntries: function(entries)
-    {
-        var columns = {};
-        columns[0] = {};
-        columns[1] = {};
-        columns[0].title = WebInspector.UIString("Key");
-        columns[1].title = WebInspector.UIString("Value");
+_dataGridForDOMStorageEntries: function(entries)
+{
+var columns = {};
+columns[0] = {};
+columns[1] = {};
+columns[0].title = WebInspector.UIString("Key");
+columns[1].title = WebInspector.UIString("Value");
 
-        var nodes = [];
+var nodes = [];
 
-        var keys = [];
-        var length = entries.length;
-        for (var i = 0; i < entries.length; i++) {
-            var data = {};
+var keys = [];
+var length = entries.length;
+for (var i = 0; i < entries.length; i++) {
+var data = {};
 
-            var key = entries[i][0];
-            data[0] = key;
-            var value = entries[i][1];
-            data[1] = value;
-            var node = new WebInspector.DataGridNode(data, false);
-            node.selectable = true;
-            nodes.push(node);
-            keys.push(key);
-        }
+var key = entries[i][0];
+data[0] = key;
+var value = entries[i][1];
+data[1] = value;
+var node = new WebInspector.DataGridNode(data, false);
+node.selectable = true;
+nodes.push(node);
+keys.push(key);
+}
 
-        var dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
-        var length = nodes.length;
-        for (var i = 0; i < length; ++i)
-            dataGrid.appendChild(nodes[i]);
-        dataGrid.addCreationNode(false);
-        if (length > 0)
-            nodes[0].selected = true;
-        return dataGrid;
-    },
+var dataGrid = new WebInspector.DataGrid(columns, this._editingCallback.bind(this), this._deleteCallback.bind(this));
+var length = nodes.length;
+for (var i = 0; i < length; ++i)
+dataGrid.appendChild(nodes[i]);
+dataGrid.addCreationNode(false);
+if (length > 0)
+nodes[0].selected = true;
+return dataGrid;
+},
 
-    _deleteButtonClicked: function(event)
-    {
-        if (!this._dataGrid || !this._dataGrid.selectedNode)
-            return;
+_deleteButtonClicked: function(event)
+{
+if (!this._dataGrid || !this._dataGrid.selectedNode)
+return;
 
-        this._deleteCallback(this._dataGrid.selectedNode);
-    },
+this._deleteCallback(this._dataGrid.selectedNode);
+},
 
-    _refreshButtonClicked: function(event)
-    {
-        this.update();
-    },
-    
-    _editingCallback: function(editingNode, columnIdentifier, oldText, newText)
-    {
-        var domStorage = this.domStorage;
-        if (columnIdentifier === 0) {
-            if (oldText)
-                domStorage.removeItem(oldText);
+_refreshButtonClicked: function(event)
+{
+this.update();
+},
 
-            domStorage.setItem(newText, editingNode.data[1]);
-        } else {
-            domStorage.setItem(editingNode.data[0], newText);
-        }
-        
-        this.update();
-    },
-    
-    _deleteCallback: function(node)
-    {
-        if (!node || node.isCreationNode)
-            return;
+_editingCallback: function(editingNode, columnIdentifier, oldText, newText)
+{
+var domStorage = this.domStorage;
+if (columnIdentifier === 0) {
+if (oldText)
+domStorage.removeItem(oldText);
 
-        if (this.domStorage)
-            this.domStorage.removeItem(node.data[0]);
-            
-        this.update();
-    }
+domStorage.setItem(newText, editingNode.data[1]);
+} else {
+domStorage.setItem(editingNode.data[0], newText);
+}
+
+this.update();
+},
+
+_deleteCallback: function(node)
+{
+if (!node || node.isCreationNode)
+return;
+
+if (this.domStorage)
+this.domStorage.removeItem(node.data[0]);
+
+this.update();
+}
 }
 
 WebInspector.DOMStorageItemsView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* DataGrid.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *        notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *        notice, this list of conditions and the following disclaimer in the
- *        documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.         IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.DataGrid = function(columns, editCallback, deleteCallback)
 {
-    this.element = document.createElement("div");
-    this.element.className = "data-grid";
-    this.element.tabIndex = 0;
-    this.element.addEventListener("keydown", this._keyDown.bind(this), false);
+this.element = document.createElement("div");
+this.element.className = "data-grid";
+this.element.tabIndex = 0;
+this.element.addEventListener("keydown", this._keyDown.bind(this), false);
 
-    this._headerTable = document.createElement("table");
-    this._headerTable.className = "header";
+this._headerTable = document.createElement("table");
+this._headerTable.className = "header";
+this._headerTableHeaders = {};
 
-    this._dataTable = document.createElement("table");
-    this._dataTable.className = "data";
+this._dataTable = document.createElement("table");
+this._dataTable.className = "data";
 
-    this._dataTable.addEventListener("mousedown", this._mouseDownInDataTable.bind(this), true);
-    this._dataTable.addEventListener("click", this._clickInDataTable.bind(this), true);
-    
-    this._dataTable.addEventListener("contextmenu", this._contextMenuInDataTable.bind(this), true);
-    
-    // FIXME: Add a createCallback which is different from editCallback and has different
-    // behavior when creating a new node.
-    if (editCallback) {
-        this._dataTable.addEventListener("dblclick", this._ondblclick.bind(this), false);
-        this._editCallback = editCallback;
-    }
-    if (deleteCallback)
-        this._deleteCallback = deleteCallback;
-    
-    this.aligned = {};
+this._dataTable.addEventListener("mousedown", this._mouseDownInDataTable.bind(this), true);
+this._dataTable.addEventListener("click", this._clickInDataTable.bind(this), true);
 
-    var scrollContainer = document.createElement("div");
-    scrollContainer.className = "data-container";
-    scrollContainer.appendChild(this._dataTable);
+this._dataTable.addEventListener("contextmenu", this._contextMenuInDataTable.bind(this), true);
 
-    this.element.appendChild(this._headerTable);
-    this.element.appendChild(scrollContainer);
 
-    var headerRow = document.createElement("tr");
-    var columnGroup = document.createElement("colgroup");
-    this._columnCount = 0;
 
-    for (var columnIdentifier in columns) {
-        var column = columns[columnIdentifier];
-        if (column.disclosure)
-            this.disclosureColumnIdentifier = columnIdentifier;
+if (editCallback) {
+this._dataTable.addEventListener("dblclick", this._ondblclick.bind(this), false);
+this._editCallback = editCallback;
+}
+if (deleteCallback)
+this._deleteCallback = deleteCallback;
 
-        var col = document.createElement("col");
-        if (column.width)
-            col.style.width = column.width;
-        column.element = col;
-        columnGroup.appendChild(col);
+this.aligned = {};
 
-        var cell = document.createElement("th");
-        cell.className = columnIdentifier + "-column";
-        cell.columnIdentifier = columnIdentifier;
+this._scrollContainer = document.createElement("div");
+this._scrollContainer.className = "data-container";
+this._scrollContainer.appendChild(this._dataTable);
 
-        var div = document.createElement("div");
-        div.textContent = column.title;
-        cell.appendChild(div);
+this.element.appendChild(this._headerTable);
+this.element.appendChild(this._scrollContainer);
 
-        if (column.sort) {
-            cell.addStyleClass("sort-" + column.sort);
-            this._sortColumnCell = cell;
-        }
+var headerRow = document.createElement("tr");
+var columnGroup = document.createElement("colgroup");
+this._columnCount = 0;
 
-        if (column.sortable) {
-            cell.addEventListener("click", this._clickInHeaderCell.bind(this), false);
-            cell.addStyleClass("sortable");
-        }
+for (var columnIdentifier in columns) {
+var column = columns[columnIdentifier];
+if (column.disclosure)
+this.disclosureColumnIdentifier = columnIdentifier;
 
-        if (column.aligned) {
-            cell.addStyleClass(column.aligned);
-            this.aligned[columnIdentifier] = column.aligned;
-        }
+var col = document.createElement("col");
+if (column.width)
+col.style.width = column.width;
+column.element = col;
+columnGroup.appendChild(col);
 
-        headerRow.appendChild(cell);
+var cell = document.createElement("th");
+cell.className = columnIdentifier + "-column";
+cell.columnIdentifier = columnIdentifier;
+this._headerTableHeaders[columnIdentifier] = cell;
 
-        ++this._columnCount;
-    }
+var div = document.createElement("div");
+if (column.titleDOMFragment)
+div.appendChild(column.titleDOMFragment);
+else
+div.textContent = column.title;
+cell.appendChild(div);
 
-    columnGroup.span = this._columnCount;
+if (column.sort) {
+cell.addStyleClass("sort-" + column.sort);
+this._sortColumnCell = cell;
+}
 
-    var cell = document.createElement("th");
-    cell.className = "corner";
-    headerRow.appendChild(cell);
+if (column.sortable) {
+cell.addEventListener("click", this._clickInHeaderCell.bind(this), false);
+cell.addStyleClass("sortable");
+}
 
-    this._headerTableColumnGroup = columnGroup;
-    this._headerTable.appendChild(this._headerTableColumnGroup);
-    this.headerTableBody.appendChild(headerRow);
+if (column.aligned)
+this.aligned[columnIdentifier] = column.aligned;
 
-    var fillerRow = document.createElement("tr");
-    fillerRow.className = "filler";
+headerRow.appendChild(cell);
 
-    for (var i = 0; i < this._columnCount; ++i) {
-        var cell = document.createElement("td");
-        fillerRow.appendChild(cell);
-    }
-    
-    this._dataTableColumnGroup = columnGroup.cloneNode(true);
-    this._dataTable.appendChild(this._dataTableColumnGroup);
-    this.dataTableBody.appendChild(fillerRow);
+++this._columnCount;
+}
 
-    this.columns = columns || {};
-    this.children = [];
-    this.selectedNode = null;
-    this.expandNodesWhenArrowing = false;
-    this.root = true;
-    this.hasChildren = false;
-    this.expanded = true;
-    this.revealed = true;
-    this.selected = false;
-    this.dataGrid = this;
-    this.indentWidth = 15;
-    this.resizers = [];
-    this.columnWidthsInitialized = false;
+columnGroup.span = this._columnCount;
+
+var cell = document.createElement("th");
+cell.className = "corner";
+headerRow.appendChild(cell);
+
+this._headerTableColumnGroup = columnGroup;
+this._headerTable.appendChild(this._headerTableColumnGroup);
+this.headerTableBody.appendChild(headerRow);
+
+var fillerRow = document.createElement("tr");
+fillerRow.className = "filler";
+
+for (var columnIdentifier in columns) {
+var column = columns[columnIdentifier];
+var cell = document.createElement("td");
+cell.className = columnIdentifier + "-column";
+fillerRow.appendChild(cell);
+}
+
+this._dataTableColumnGroup = columnGroup.cloneNode(true);
+this._dataTable.appendChild(this._dataTableColumnGroup);
+this.dataTableBody.appendChild(fillerRow);
+
+this.columns = columns || {};
+this._columnsArray = [];
+for (var columnIdentifier in columns) {
+columns[columnIdentifier].ordinal = this._columnsArray.length;
+this._columnsArray.push(columns[columnIdentifier]);
+}
+
+for (var i = 0; i < this._columnsArray.length; ++i)
+this._columnsArray[i].bodyElement = this._dataTableColumnGroup.children[i];
+
+this.children = [];
+this.selectedNode = null;
+this.expandNodesWhenArrowing = false;
+this.root = true;
+this.hasChildren = false;
+this.expanded = true;
+this.revealed = true;
+this.selected = false;
+this.dataGrid = this;
+this.indentWidth = 15;
+this.resizers = [];
+this._columnWidthsInitialized = false;
 }
 
 WebInspector.DataGrid.prototype = {
-    _ondblclick: function(event)
-    {
-        if (this._editing || this._editingNode)
-            return;
+_ondblclick: function(event)
+{
+if (this._editing || this._editingNode)
+return;
 
-        this._startEditing(event.target);
-    },
+this._startEditing(event.target);
+},
 
-    _startEditingColumnOfDataGridNode: function(node, column)
-    {
-        this._editing = true;
-        this._editingNode = node;
-        this._editingNode.select();
+_startEditingColumnOfDataGridNode: function(node, column)
+{
+this._editing = true;
+this._editingNode = node;
+this._editingNode.select();
 
-        var element = this._editingNode._element.children[column];
-        WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
-        window.getSelection().setBaseAndExtent(element, 0, element, 1);
-    },
+var element = this._editingNode._element.children[column];
+WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
+window.getSelection().setBaseAndExtent(element, 0, element, 1);
+},
 
-    _startEditing: function(target)
-    {
-        var element = target.enclosingNodeOrSelfWithNodeName("td");
-        if (!element)
-            return;
+_startEditing: function(target)
+{
+var element = target.enclosingNodeOrSelfWithNodeName("td");
+if (!element)
+return;
 
-        this._editingNode = this.dataGridNodeFromNode(target);
-        if (!this._editingNode) {
-            if (!this.creationNode)
-                return;
-            this._editingNode = this.creationNode;
-        }
+this._editingNode = this.dataGridNodeFromNode(target);
+if (!this._editingNode) {
+if (!this.creationNode)
+return;
+this._editingNode = this.creationNode;
+}
 
-        // Force editing the 1st column when editing the creation node
-        if (this._editingNode.isCreationNode)
-            return this._startEditingColumnOfDataGridNode(this._editingNode, 0);
 
-        this._editing = true;
-        WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
-        window.getSelection().setBaseAndExtent(element, 0, element, 1);
-    },
+if (this._editingNode.isCreationNode)
+return this._startEditingColumnOfDataGridNode(this._editingNode, 0);
 
-    _editingCommitted: function(element, newText, oldText, context, moveDirection)
-    {
-        // FIXME: We need more column identifiers here throughout this function.
-        // Not needed yet since only editable DataGrid is DOM Storage, which is Key - Value.
-        
-        // FIXME: Better way to do this than regular expressions?
-        var columnIdentifier = parseInt(element.className.match(/\b(\d+)-column\b/)[1]);
+this._editing = true;
+WebInspector.startEditing(element, this._editingCommitted.bind(this), this._editingCancelled.bind(this), element.textContent);
+window.getSelection().setBaseAndExtent(element, 0, element, 1);
+},
 
-        var textBeforeEditing = this._editingNode.data[columnIdentifier];
-        var currentEditingNode = this._editingNode;
+_editingCommitted: function(element, newText, oldText, context, moveDirection)
+{
 
-        function moveToNextIfNeeded(wasChange) {
-            if (!moveDirection)
-                return;
 
-            if (moveDirection === "forward") {
-                if (currentEditingNode.isCreationNode && columnIdentifier === 0 && !wasChange)
-                    return;
 
-                if (columnIdentifier === 0)
-                    return this._startEditingColumnOfDataGridNode(currentEditingNode, 1);
 
-                var nextDataGridNode = currentEditingNode.traverseNextNode(true, null, true);
-                if (nextDataGridNode)
-                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, 0);
-                if (currentEditingNode.isCreationNode && wasChange) {
-                    addCreationNode(false);
-                    return this._startEditingColumnOfDataGridNode(this.creationNode, 0);
-                }
-                return;
-            }
+var columnIdentifier = parseInt(element.className.match(/\b(\d+)-column\b/)[1]);
 
-            if (moveDirection === "backward") {
-                if (columnIdentifier === 1)
-                    return this._startEditingColumnOfDataGridNode(currentEditingNode, 0);
-                    var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null, true);
+var textBeforeEditing = this._editingNode.data[columnIdentifier];
+var currentEditingNode = this._editingNode;
 
-                if (nextDataGridNode)
-                    return this._startEditingColumnOfDataGridNode(nextDataGridNode, 1);
-                return;
-            }
-        }
+function moveToNextIfNeeded(wasChange) {
+if (!moveDirection)
+return;
 
-        if (textBeforeEditing == newText) {
-            this._editingCancelled(element);
-            moveToNextIfNeeded.call(this, false);
-            return;
-        }
+if (moveDirection === "forward") {
+if (currentEditingNode.isCreationNode && columnIdentifier === 0 && !wasChange)
+return;
 
-        // Update the text in the datagrid that we typed
-        this._editingNode.data[columnIdentifier] = newText;
-        
-        // Make the callback - expects an editing node (table row), the column number that is being edited,
-        // the text that used to be there, and the new text.
-        this._editCallback(this._editingNode, columnIdentifier, textBeforeEditing, newText);
+if (columnIdentifier === 0)
+return this._startEditingColumnOfDataGridNode(currentEditingNode, 1);
 
-        if (this._editingNode.isCreationNode)
-            this.addCreationNode(false);
+var nextDataGridNode = currentEditingNode.traverseNextNode(true, null, true);
+if (nextDataGridNode)
+return this._startEditingColumnOfDataGridNode(nextDataGridNode, 0);
+if (currentEditingNode.isCreationNode && wasChange) {
+addCreationNode(false);
+return this._startEditingColumnOfDataGridNode(this.creationNode, 0);
+}
+return;
+}
 
-        this._editingCancelled(element);
-        moveToNextIfNeeded.call(this, true);
-    },
+if (moveDirection === "backward") {
+if (columnIdentifier === 1)
+return this._startEditingColumnOfDataGridNode(currentEditingNode, 0);
+var nextDataGridNode = currentEditingNode.traversePreviousNode(true, null, true);
 
-    _editingCancelled: function(element, context)
-    {
-        delete this._editing;
-        this._editingNode = null;
-    },
-    
-    get sortColumnIdentifier()
-    {
-        if (!this._sortColumnCell)
-            return null;
-        return this._sortColumnCell.columnIdentifier;
-    },
+if (nextDataGridNode)
+return this._startEditingColumnOfDataGridNode(nextDataGridNode, 1);
+return;
+}
+}
 
-    get sortOrder()
-    {
-        if (!this._sortColumnCell || this._sortColumnCell.hasStyleClass("sort-ascending"))
-            return "ascending";
-        if (this._sortColumnCell.hasStyleClass("sort-descending"))
-            return "descending";
-        return null;
-    },
+if (textBeforeEditing == newText) {
+this._editingCancelled(element);
+moveToNextIfNeeded.call(this, false);
+return;
+}
 
-    get headerTableBody()
-    {
-        if ("_headerTableBody" in this)
-            return this._headerTableBody;
 
-        this._headerTableBody = this._headerTable.getElementsByTagName("tbody")[0];
-        if (!this._headerTableBody) {
-            this._headerTableBody = this.element.ownerDocument.createElement("tbody");
-            this._headerTable.insertBefore(this._headerTableBody, this._headerTable.tFoot);
-        }
+this._editingNode.data[columnIdentifier] = newText;
 
-        return this._headerTableBody;
-    },
 
-    get dataTableBody()
-    {
-        if ("_dataTableBody" in this)
-            return this._dataTableBody;
 
-        this._dataTableBody = this._dataTable.getElementsByTagName("tbody")[0];
-        if (!this._dataTableBody) {
-            this._dataTableBody = this.element.ownerDocument.createElement("tbody");
-            this._dataTable.insertBefore(this._dataTableBody, this._dataTable.tFoot);
-        }
+this._editCallback(this._editingNode, columnIdentifier, textBeforeEditing, newText);
 
-        return this._dataTableBody;
-    },
+if (this._editingNode.isCreationNode)
+this.addCreationNode(false);
 
-    autoSizeColumns: function(minPercent, maxPercent)
-    {
-        if (minPercent)
-            minPercent = Math.min(minPercent, Math.floor(100 / this._columnCount));
-        var widths = {};
-        var columns = this.columns;
-        for (var columnIdentifier in columns)
-            widths[columnIdentifier] = (columns[columnIdentifier].title || "").length;
+this._editingCancelled(element);
+moveToNextIfNeeded.call(this, true);
+},
 
-        for (var i = 0; i < this.children.length; ++i) {
-            var node = this.children[i];
-            for (var columnIdentifier in columns) {
-                var text = node.data[columnIdentifier] || "";
-                if (text.length > widths[columnIdentifier])
-                    widths[columnIdentifier] = text.length;
-            }
-        }
+_editingCancelled: function(element, context)
+{
+delete this._editing;
+this._editingNode = null;
+},
+
+get sortColumnIdentifier()
+{
+if (!this._sortColumnCell)
+return null;
+return this._sortColumnCell.columnIdentifier;
+},
+
+get sortOrder()
+{
+if (!this._sortColumnCell || this._sortColumnCell.hasStyleClass("sort-ascending"))
+return "ascending";
+if (this._sortColumnCell.hasStyleClass("sort-descending"))
+return "descending";
+return null;
+},
+
+get headerTableBody()
+{
+if ("_headerTableBody" in this)
+return this._headerTableBody;
+
+this._headerTableBody = this._headerTable.getElementsByTagName("tbody")[0];
+if (!this._headerTableBody) {
+this._headerTableBody = this.element.ownerDocument.createElement("tbody");
+this._headerTable.insertBefore(this._headerTableBody, this._headerTable.tFoot);
+}
+
+return this._headerTableBody;
+},
+
+get dataTableBody()
+{
+if ("_dataTableBody" in this)
+return this._dataTableBody;
+
+this._dataTableBody = this._dataTable.getElementsByTagName("tbody")[0];
+if (!this._dataTableBody) {
+this._dataTableBody = this.element.ownerDocument.createElement("tbody");
+this._dataTable.insertBefore(this._dataTableBody, this._dataTable.tFoot);
+}
+
+return this._dataTableBody;
+},
+
+autoSizeColumns: function(minPercent, maxPercent, maxDescentLevel)
+{
+if (minPercent)
+minPercent = Math.min(minPercent, Math.floor(100 / this._columnCount));
+var widths = {};
+var columns = this.columns;
+for (var columnIdentifier in columns)
+widths[columnIdentifier] = (columns[columnIdentifier].title || "").length;
+
+var children = maxDescentLevel ? this._enumerateChildren(this, [], maxDescentLevel + 1) : this.children;
+for (var i = 0; i < children.length; ++i) {
+var node = children[i];
+for (var columnIdentifier in columns) {
+var text = node.data[columnIdentifier] || "";
+if (text.length > widths[columnIdentifier])
+widths[columnIdentifier] = text.length;
+}
+}
+
+var totalColumnWidths = 0;
+for (var columnIdentifier in columns)
+totalColumnWidths += widths[columnIdentifier];
+
+var recoupPercent = 0;
+for (var columnIdentifier in columns) {
+var width = Math.round(100 * widths[columnIdentifier] / totalColumnWidths);
+if (minPercent && width < minPercent) {
+recoupPercent += (minPercent - width);
+width = minPercent;
+} else if (maxPercent && width > maxPercent) {
+recoupPercent -= (width - maxPercent);
+width = maxPercent;
+}
+widths[columnIdentifier] = width;
+}
+
+while (minPercent && recoupPercent > 0) {
+for (var columnIdentifier in columns) {
+if (widths[columnIdentifier] > minPercent) {
+--widths[columnIdentifier];
+--recoupPercent;
+if (!recoupPercent)
+break;
+}
+}
+}
+
+while (maxPercent && recoupPercent < 0) {
+for (var columnIdentifier in columns) {
+if (widths[columnIdentifier] < maxPercent) {
+++widths[columnIdentifier];
+++recoupPercent;
+if (!recoupPercent)
+break;
+}
+}
+}
+
+for (var columnIdentifier in columns)
+columns[columnIdentifier].element.style.width = widths[columnIdentifier] + "%";
+this._columnWidthsInitialized = false;
+this.updateWidths();
+},
+
+_enumerateChildren: function(rootNode, result, maxLevel)
+{
+if (!rootNode.root)
+result.push(rootNode);
+if (!maxLevel)
+return;
+for (var i = 0; i < rootNode.children.length; ++i)
+this._enumerateChildren(rootNode.children[i], result, maxLevel - 1);
+return result;
+},
+
+
+
+
+
+
+
+
+
+
+
+updateWidths: function()
+{
+var headerTableColumns = this._headerTableColumnGroup.children;
+
+var tableWidth = this._dataTable.offsetWidth;
+var numColumns = headerTableColumns.length;
+
+
+if (!this._columnWidthsInitialized && this.element.offsetWidth) {
+
+
+
+
+for (var i = 0; i < numColumns; i++) {
+var columnWidth = this.headerTableBody.rows[0].cells[i].offsetWidth;
+var percentWidth = ((columnWidth / tableWidth) * 100) + "%";
+this._headerTableColumnGroup.children[i].style.width = percentWidth;
+this._dataTableColumnGroup.children[i].style.width = percentWidth;
+}
+this._columnWidthsInitialized = true;
+}
+this._positionResizers();
+this.dispatchEventToListeners("width changed");
+},
+
+columnWidthsMap: function()
+{
+var result = {};
+for (var i = 0; i < this._columnsArray.length; ++i) {
+var width = this._headerTableColumnGroup.children[i].style.width;
+result[this._columnsArray[i].columnIdentifier] = parseFloat(width);
+}
+return result;
+},
+
+applyColumnWidthsMap: function(columnWidthsMap)
+{
+for (var columnIdentifier in this.columns) {
+var column = this.columns[columnIdentifier];
+var width = (columnWidthsMap[columnIdentifier] || 0) + "%";
+this._headerTableColumnGroup.children[column.ordinal].style.width = width;
+this._dataTableColumnGroup.children[column.ordinal].style.width = width;
+}
+
+
+delete this._columnWidthsInitialized;
+this.updateWidths();
+},
+
+isColumnVisible: function(columnIdentifier)
+{
+var column = this.columns[columnIdentifier];
+var columnElement = column.element;
+return !columnElement.hidden;
+},
+
+showColumn: function(columnIdentifier)
+{
+var column = this.columns[columnIdentifier];
+var columnElement = column.element;
+if (!columnElement.hidden)
+return;
+
+columnElement.hidden = false;
+columnElement.removeStyleClass("hidden");
+
+var columnBodyElement = column.bodyElement;
+columnBodyElement.hidden = false;
+columnBodyElement.removeStyleClass("hidden");
+},
+
+hideColumn: function(columnIdentifier)
+{
+var column = this.columns[columnIdentifier];
+var columnElement = column.element;
+if (columnElement.hidden)
+return;
+
+var oldWidth = parseFloat(columnElement.style.width);
+
+columnElement.hidden = true;
+columnElement.addStyleClass("hidden");
+columnElement.style.width = 0;
+
+var columnBodyElement = column.bodyElement;
+columnBodyElement.hidden = true;
+columnBodyElement.addStyleClass("hidden");
+columnBodyElement.style.width = 0;
+
+this._columnWidthsInitialized = false;
+},
+
+isScrolledToLastRow: function()
+{
+return this._scrollContainer.scrollTop === this._scrollContainer.scrollHeight - this._scrollContainer.offsetHeight;
+},
+
+scrollToLastRow: function()
+{
+this._scrollContainer.scrollTop = this._scrollContainer.scrollHeight - this._scrollContainer.offsetHeight;
+},
+
+_positionResizers: function()
+{
+var headerTableColumns = this._headerTableColumnGroup.children;
+var numColumns = headerTableColumns.length;
+var left = 0;
+var previousResizer = null;
+
+
+for (var i = 0; i < numColumns - 1; i++) {
+var resizer = this.resizers[i];
+
+if (!resizer) {
+
+
+resizer = document.createElement("div");
+resizer.addStyleClass("data-grid-resizer");
+
+resizer.addEventListener("mousedown", this._startResizerDragging.bind(this), false);
+this.element.appendChild(resizer);
+this.resizers[i] = resizer;
+}
+
+
+
+
+left += this.headerTableBody.rows[0].cells[i].offsetWidth;
+
+var columnIsVisible = !this._headerTableColumnGroup.children[i].hidden;
+if (columnIsVisible) {
+resizer.style.removeProperty("display");
+resizer.style.left = left + "px";
+resizer.leftNeighboringColumnID = i;
+if (previousResizer)
+previousResizer.rightNeighboringColumnID = i;
+previousResizer = resizer;
+} else {
+resizer.style.setProperty("display", "none");
+resizer.leftNeighboringColumnID = 0;
+resizer.rightNeighboringColumnID = 0;
+}
+}
+if (previousResizer)
+previousResizer.rightNeighboringColumnID = numColumns - 1;
+},
+
+addCreationNode: function(hasChildren)
+{
+if (this.creationNode)
+this.creationNode.makeNormal();
+
+var emptyData = {};
+for (var column in this.columns)
+emptyData[column] = '';
+this.creationNode = new WebInspector.CreationDataGridNode(emptyData, hasChildren);
+this.appendChild(this.creationNode);
+},
+
+appendChild: function(child)
+{
+this.insertChild(child, this.children.length);
+},
+
+insertChild: function(child, index)
+{
+if (!child)
+throw("insertChild: Node can't be undefined or null.");
+if (child.parent === this)
+throw("insertChild: Node is already a child of this node.");
+
+if (child.parent)
+child.parent.removeChild(child);
+
+this.children.splice(index, 0, child);
+this.hasChildren = true;
+
+child.parent = this;
+child.dataGrid = this.dataGrid;
+child._recalculateSiblings(index);
+
+delete child._depth;
+delete child._revealed;
+delete child._attached;
+child._shouldRefreshChildren = true;
+
+var current = child.children[0];
+while (current) {
+current.dataGrid = this.dataGrid;
+delete current._depth;
+delete current._revealed;
+delete current._attached;
+current._shouldRefreshChildren = true;
+current = current.traverseNextNode(false, child, true);
+}
+
+if (this.expanded)
+child._attach();
+},
+
+removeChild: function(child)
+{
+if (!child)
+throw("removeChild: Node can't be undefined or null.");
+if (child.parent !== this)
+throw("removeChild: Node is not a child of this node.");
+
+child.deselect();
+child._detach();
+
+this.children.remove(child, true);
+
+if (child.previousSibling)
+child.previousSibling.nextSibling = child.nextSibling;
+if (child.nextSibling)
+child.nextSibling.previousSibling = child.previousSibling;
+
+child.dataGrid = null;
+child.parent = null;
+child.nextSibling = null;
+child.previousSibling = null;
+
+if (this.children.length <= 0)
+this.hasChildren = false;
+},
+
+removeChildren: function()
+{
+for (var i = 0; i < this.children.length; ++i) {
+var child = this.children[i];
+child.deselect();
+child._detach();
+
+child.dataGrid = null;
+child.parent = null;
+child.nextSibling = null;
+child.previousSibling = null;
+}
+
+this.children = [];
+this.hasChildren = false;
+},
+
+removeChildrenRecursive: function()
+{
+var childrenToRemove = this.children;
+
+var child = this.children[0];
+while (child) {
+if (child.children.length)
+childrenToRemove = childrenToRemove.concat(child.children);
+child = child.traverseNextNode(false, this, true);
+}
+
+for (var i = 0; i < childrenToRemove.length; ++i) {
+var child = childrenToRemove[i];
+child.deselect();
+child._detach();
+
+child.children = [];
+child.dataGrid = null;
+child.parent = null;
+child.nextSibling = null;
+child.previousSibling = null;
+}
+
+this.children = [];
+},
+
+sortNodes: function(comparator, reverseMode)
+{
+function comparatorWrapper(a, b)
+{
+if (a._dataGridNode._data.summaryRow)
+return 1;
+if (b._dataGridNode._data.summaryRow)
+return -1;
+
+var aDataGirdNode = a._dataGridNode;
+var bDataGirdNode = b._dataGridNode;
+return reverseMode ? comparator(bDataGirdNode, aDataGirdNode) : comparator(aDataGirdNode, bDataGirdNode);
+}
+
+var tbody = this.dataTableBody;
+var tbodyParent = tbody.parentElement;
+tbodyParent.removeChild(tbody);
+
+var childNodes = tbody.childNodes;
+var fillerRow = childNodes[childNodes.length - 1];
+
+var sortedRows = Array.prototype.slice.call(childNodes, 0, childNodes.length - 1);
+sortedRows.sort(comparatorWrapper);
+var sortedRowsLength = sortedRows.length;
 
-        var totalColumnWidths = 0;
-        for (var columnIdentifier in columns)
-            totalColumnWidths += widths[columnIdentifier];
+tbody.removeChildren();
+var previousSiblingNode = null;
+for (var i = 0; i < sortedRowsLength; ++i) {
+var row = sortedRows[i];
+var node = row._dataGridNode;
+node.previousSibling = previousSiblingNode;
+if (previousSiblingNode)
+previousSiblingNode.nextSibling = node;
+tbody.appendChild(row);
+previousSiblingNode = node;
+}
+if (previousSiblingNode)
+previousSiblingNode.nextSibling = null;
 
-        var recoupPercent = 0;
-        for (var columnIdentifier in columns) {
-            var width = Math.round(100 * widths[columnIdentifier] / totalColumnWidths);
-            if (minPercent && width < minPercent) {
-                recoupPercent += (minPercent - width);
-                width = minPercent;
-            } else if (maxPercent && width > maxPercent) {
-                recoupPercent -= (width - maxPercent);
-                width = maxPercent;
-            }
-            widths[columnIdentifier] = width;
-        }
+tbody.appendChild(fillerRow);
+tbodyParent.appendChild(tbody);
+},
 
-        while (minPercent && recoupPercent > 0) {
-            for (var columnIdentifier in columns) {
-                if (widths[columnIdentifier] > minPercent) {
-                    --widths[columnIdentifier];
-                    --recoupPercent;
-                    if (!recoupPercent)
-                        break;
-                }
-            }
-        }
+_keyDown: function(event)
+{
+if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey || this._editing)
+return;
 
-        while (maxPercent && recoupPercent < 0) {
-            for (var columnIdentifier in columns) {
-                if (widths[columnIdentifier] < maxPercent) {
-                    ++widths[columnIdentifier];
-                    ++recoupPercent;
-                    if (!recoupPercent)
-                        break;
-                }
-            }
-        }
+var handled = false;
+var nextSelectedNode;
+if (event.keyIdentifier === "Up" && !event.altKey) {
+nextSelectedNode = this.selectedNode.traversePreviousNode(true);
+while (nextSelectedNode && !nextSelectedNode.selectable)
+nextSelectedNode = nextSelectedNode.traversePreviousNode(!this.expandTreeNodesWhenArrowing);
+handled = nextSelectedNode ? true : false;
+} else if (event.keyIdentifier === "Down" && !event.altKey) {
+nextSelectedNode = this.selectedNode.traverseNextNode(true);
+while (nextSelectedNode && !nextSelectedNode.selectable)
+nextSelectedNode = nextSelectedNode.traverseNextNode(!this.expandTreeNodesWhenArrowing);
+handled = nextSelectedNode ? true : false;
+} else if (event.keyIdentifier === "Left") {
+if (this.selectedNode.expanded) {
+if (event.altKey)
+this.selectedNode.collapseRecursively();
+else
+this.selectedNode.collapse();
+handled = true;
+} else if (this.selectedNode.parent && !this.selectedNode.parent.root) {
+handled = true;
+if (this.selectedNode.parent.selectable) {
+nextSelectedNode = this.selectedNode.parent;
+handled = nextSelectedNode ? true : false;
+} else if (this.selectedNode.parent)
+this.selectedNode.parent.collapse();
+}
+} else if (event.keyIdentifier === "Right") {
+if (!this.selectedNode.revealed) {
+this.selectedNode.reveal();
+handled = true;
+} else if (this.selectedNode.hasChildren) {
+handled = true;
+if (this.selectedNode.expanded) {
+nextSelectedNode = this.selectedNode.children[0];
+handled = nextSelectedNode ? true : false;
+} else {
+if (event.altKey)
+this.selectedNode.expandRecursively();
+else
+this.selectedNode.expand();
+}
+}
+} else if (event.keyCode === 8 || event.keyCode === 46) {
+if (this._deleteCallback) {
+handled = true;
+this._deleteCallback(this.selectedNode);
+}
+} else if (isEnterKey(event)) {
+if (this._editCallback) {
+handled = true;
 
-        for (var columnIdentifier in columns)
-            columns[columnIdentifier].element.style.width = widths[columnIdentifier] + "%";
-        this.columnWidthsInitialized = false;
-        this.updateWidths();
-    },
 
-    // Updates the widths of the table, including the positions of the column
-    // resizers.
-    //
-    // IMPORTANT: This function MUST be called once after the element of the
-    // DataGrid is attached to its parent element and every subsequent time the
-    // width of the parent element is changed in order to make it possible to
-    // resize the columns.
-    //
-    // If this function is not called after the DataGrid is attached to its
-    // parent element, then the DataGrid's columns will not be resizable.
-    updateWidths: function()
-    {
-        var headerTableColumns = this._headerTableColumnGroup.children;
-        
-        var left = 0;
-        var tableWidth = this._dataTable.offsetWidth;
-        var numColumns = headerTableColumns.length;
-        
-        if (!this.columnWidthsInitialized) {
-            // Give all the columns initial widths now so that during a resize,
-            // when the two columns that get resized get a percent value for
-            // their widths, all the other columns already have percent values
-            // for their widths.
-            for (var i = 0; i < numColumns; i++) {
-                var columnWidth = this.headerTableBody.rows[0].cells[i].offsetWidth;
-                var percentWidth = ((columnWidth / tableWidth) * 100) + "%";
-                this._headerTableColumnGroup.children[i].style.width = percentWidth;
-                this._dataTableColumnGroup.children[i].style.width = percentWidth;
-            }
-            this.columnWidthsInitialized = true;
-        }
-        
-        // Make n - 1 resizers for n columns. 
-        for (var i = 0; i < numColumns - 1; i++) {
-            var resizer = this.resizers[i];
+this._startEditing(this.selectedNode._element.children[0]);
+}
+}
 
-            if (!resizer) {
-                // This is the first call to updateWidth, so the resizers need
-                // to be created.
-                resizer = document.createElement("div");
-                resizer.addStyleClass("data-grid-resizer");
-                // This resizer is associated with the column to its right.
-                resizer.rightNeighboringColumnID = i + 1;
-                resizer.addEventListener("mousedown", this._startResizerDragging.bind(this), false);
-                this.element.appendChild(resizer);
-                this.resizers[i] = resizer;
-            }
+if (nextSelectedNode) {
+nextSelectedNode.reveal();
+nextSelectedNode.select();
+}
 
-            // Get the width of the cell in the first (and only) row of the
-            // header table in order to determine the width of the column, since
-            // it is not possible to query a column for its width.
-            left += this.headerTableBody.rows[0].cells[i].offsetWidth;
-            
-            resizer.style.left = left + "px";
-        }
-    },
+if (handled) {
+event.preventDefault();
+event.stopPropagation();
+}
+},
 
-    addCreationNode: function(hasChildren)
-    {
-        if (this.creationNode)
-            this.creationNode.makeNormal();
+expand: function()
+{
 
-        var emptyData = {};
-        for (var column in this.columns)
-            emptyData[column] = '';
-        this.creationNode = new WebInspector.CreationDataGridNode(emptyData, hasChildren);
-        this.appendChild(this.creationNode);
-    },
+},
 
-    appendChild: function(child)
-    {
-        this.insertChild(child, this.children.length);
-    },
+collapse: function()
+{
 
-    insertChild: function(child, index)
-    {
-        if (!child)
-            throw("insertChild: Node can't be undefined or null.");
-        if (child.parent === this)
-            throw("insertChild: Node is already a child of this node.");
+},
 
-        if (child.parent)
-            child.parent.removeChild(child);
+reveal: function()
+{
 
-        this.children.splice(index, 0, child);
-        this.hasChildren = true;
+},
 
-        child.parent = this;
-        child.dataGrid = this.dataGrid;
-        child._recalculateSiblings(index);
+dataGridNodeFromNode: function(target)
+{
+var rowElement = target.enclosingNodeOrSelfWithNodeName("tr");
+return rowElement._dataGridNode;
+},
 
-        delete child._depth;
-        delete child._revealed;
-        delete child._attached;
-        child._shouldRefreshChildren = true;
+dataGridNodeFromPoint: function(x, y)
+{
+var node = this._dataTable.ownerDocument.elementFromPoint(x, y);
+var rowElement = node.enclosingNodeOrSelfWithNodeName("tr");
+return rowElement._dataGridNode;
+},
 
-        var current = child.children[0];
-        while (current) {
-            current.dataGrid = this.dataGrid;
-            delete current._depth;
-            delete current._revealed;
-            delete current._attached;
-            current._shouldRefreshChildren = true;
-            current = current.traverseNextNode(false, child, true);
-        }
+_clickInHeaderCell: function(event)
+{
+var cell = event.target.enclosingNodeOrSelfWithNodeName("th");
+if (!cell || !cell.columnIdentifier || !cell.hasStyleClass("sortable"))
+return;
 
-        if (this.expanded)
-            child._attach();
-    },
+var sortOrder = this.sortOrder;
 
-    removeChild: function(child)
-    {
-        if (!child)
-            throw("removeChild: Node can't be undefined or null.");
-        if (child.parent !== this)
-            throw("removeChild: Node is not a child of this node.");
+if (this._sortColumnCell)
+this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");
 
-        child.deselect();
+if (cell == this._sortColumnCell) {
+if (sortOrder === "ascending")
+sortOrder = "descending";
+else
+sortOrder = "ascending";
+}
 
-        this.children.remove(child, true);
+this._sortColumnCell = cell;
 
-        if (child.previousSibling)
-            child.previousSibling.nextSibling = child.nextSibling;
-        if (child.nextSibling)
-            child.nextSibling.previousSibling = child.previousSibling;
+cell.addStyleClass("sort-" + sortOrder);
 
-        child.dataGrid = null;
-        child.parent = null;
-        child.nextSibling = null;
-        child.previousSibling = null;
+this.dispatchEventToListeners("sorting changed");
+},
 
-        if (this.children.length <= 0)
-            this.hasChildren = false;
-    },
+markColumnAsSortedBy: function(columnIdentifier, sortOrder)
+{
+if (this._sortColumnCell)
+this._sortColumnCell.removeMatchingStyleClasses("sort-\\w+");
+this._sortColumnCell = this._headerTableHeaders[columnIdentifier];
+this._sortColumnCell.addStyleClass("sort-" + sortOrder);
+},
 
-    removeChildren: function()
-    {
-        for (var i = 0; i < this.children.length; ++i) {
-            var child = this.children[i];
-            child.deselect();
-            child._detach();
+headerTableHeader: function(columnIdentifier)
+{
+return this._headerTableHeaders[columnIdentifier];
+},
 
-            child.dataGrid = null;
-            child.parent = null;
-            child.nextSibling = null;
-            child.previousSibling = null;
-        }
+_mouseDownInDataTable: function(event)
+{
+var gridNode = this.dataGridNodeFromNode(event.target);
+if (!gridNode || !gridNode.selectable)
+return;
 
-        this.children = [];
-        this.hasChildren = false;
-    },
+if (gridNode.isEventWithinDisclosureTriangle(event))
+return;
 
-    removeChildrenRecursive: function()
-    {
-        var childrenToRemove = this.children;
+if (event.metaKey) {
+if (gridNode.selected)
+gridNode.deselect();
+else
+gridNode.select();
+} else
+gridNode.select();
+},
 
-        var child = this.children[0];
-        while (child) {
-            if (child.children.length)
-                childrenToRemove = childrenToRemove.concat(child.children);
-            child = child.traverseNextNode(false, this, true);
-        }
+_contextMenuInDataTable: function(event)
+{
+var gridNode = this.dataGridNodeFromNode(event.target);
+if (!gridNode || !gridNode.selectable)
+return;
 
-        for (var i = 0; i < childrenToRemove.length; ++i) {
-            var child = childrenToRemove[i];
-            child.deselect();
-            child._detach();
+if (gridNode.isEventWithinDisclosureTriangle(event))
+return;
 
-            child.children = [];
-            child.dataGrid = null;
-            child.parent = null;
-            child.nextSibling = null;
-            child.previousSibling = null;
-        }
+var contextMenu = new WebInspector.ContextMenu();
 
-        this.children = [];
-    },
 
+if (this.dataGrid._editCallback) {
+if (gridNode === this.creationNode)
+contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
+else
+contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
+}
+if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
+contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
 
-    _keyDown: function(event)
-    {
-        if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey || this._editing)
-            return;
+contextMenu.show(event);
+},
 
-        var handled = false;
-        var nextSelectedNode;
-        if (event.keyIdentifier === "Up" && !event.altKey) {
-            nextSelectedNode = this.selectedNode.traversePreviousNode(true);
-            while (nextSelectedNode && !nextSelectedNode.selectable)
-                nextSelectedNode = nextSelectedNode.traversePreviousNode(!this.expandTreeNodesWhenArrowing);
-            handled = nextSelectedNode ? true : false;
-        } else if (event.keyIdentifier === "Down" && !event.altKey) {
-            nextSelectedNode = this.selectedNode.traverseNextNode(true);
-            while (nextSelectedNode && !nextSelectedNode.selectable)
-                nextSelectedNode = nextSelectedNode.traverseNextNode(!this.expandTreeNodesWhenArrowing);
-            handled = nextSelectedNode ? true : false;
-        } else if (event.keyIdentifier === "Left") {
-            if (this.selectedNode.expanded) {
-                if (event.altKey)
-                    this.selectedNode.collapseRecursively();
-                else
-                    this.selectedNode.collapse();
-                handled = true;
-            } else if (this.selectedNode.parent && !this.selectedNode.parent.root) {
-                handled = true;
-                if (this.selectedNode.parent.selectable) {
-                    nextSelectedNode = this.selectedNode.parent;
-                    handled = nextSelectedNode ? true : false;
-                } else if (this.selectedNode.parent)
-                    this.selectedNode.parent.collapse();
-            }
-        } else if (event.keyIdentifier === "Right") {
-            if (!this.selectedNode.revealed) {
-                this.selectedNode.reveal();
-                handled = true;
-            } else if (this.selectedNode.hasChildren) {
-                handled = true;
-                if (this.selectedNode.expanded) {
-                    nextSelectedNode = this.selectedNode.children[0];
-                    handled = nextSelectedNode ? true : false;
-                } else {
-                    if (event.altKey)
-                        this.selectedNode.expandRecursively();
-                    else
-                        this.selectedNode.expand();
-                }
-            }
-        } else if (event.keyCode === 8 || event.keyCode === 46) {
-            if (this._deleteCallback) {
-                handled = true;
-                this._deleteCallback(this.selectedNode);
-            }
-        } else if (isEnterKey(event)) {
-            if (this._editCallback) {
-                handled = true;
-                // The first child of the selected element is the <td class="0-column">,
-                // and that's what we want to edit.
-                this._startEditing(this.selectedNode._element.children[0]);
-            }
-        }
+_clickInDataTable: function(event)
+{
+var gridNode = this.dataGridNodeFromNode(event.target);
+if (!gridNode || !gridNode.hasChildren)
+return;
 
-        if (nextSelectedNode) {
-            nextSelectedNode.reveal();
-            nextSelectedNode.select();
-        }
+if (!gridNode.isEventWithinDisclosureTriangle(event))
+return;
 
-        if (handled) {
-            event.preventDefault();
-            event.stopPropagation();
-        }
-    },
+if (gridNode.expanded) {
+if (event.altKey)
+gridNode.collapseRecursively();
+else
+gridNode.collapse();
+} else {
+if (event.altKey)
+gridNode.expandRecursively();
+else
+gridNode.expand();
+}
+},
 
-    expand: function()
-    {
-        // This is the root, do nothing.
-    },
+_startResizerDragging: function(event)
+{
+this.currentResizer = event.target;
+if (!this.currentResizer.rightNeighboringColumnID)
+return;
+WebInspector.elementDragStart(this.lastResizer, this._resizerDragging.bind(this),
+this._endResizerDragging.bind(this), event, "col-resize");
+},
 
-    collapse: function()
-    {
-        // This is the root, do nothing.
-    },
+_resizerDragging: function(event)
+{
+var resizer = this.currentResizer;
+if (!resizer)
+return;
 
-    reveal: function()
-    {
-        // This is the root, do nothing.
-    },
 
-    dataGridNodeFromNode: function(target)
-    {
-        var rowElement = target.enclosingNodeOrSelfWithNodeName("tr");
-        return rowElement._dataGridNode;
-    },
 
-    dataGridNodeFromPoint: function(x, y)
-    {
-        var node = this._dataTable.ownerDocument.elementFromPoint(x, y);
-        var rowElement = node.enclosingNodeOrSelfWithNodeName("tr");
-        return rowElement._dataGridNode;
-    },
+var dragPoint = event.clientX - this.element.totalOffsetLeft;
 
-    _clickInHeaderCell: function(event)
-    {
-        var cell = event.target.enclosingNodeOrSelfWithNodeName("th");
-        if (!cell || !cell.columnIdentifier || !cell.hasStyleClass("sortable"))
-            return;
 
-        var sortOrder = this.sortOrder;
+var leftEdgeOfPreviousColumn = 0;
+var firstRowCells = this.headerTableBody.rows[0].cells;
+for (var i = 0; i < resizer.leftNeighboringColumnID; i++)
+leftEdgeOfPreviousColumn += firstRowCells[i].offsetWidth;
 
-        if (this._sortColumnCell) {
-            this._sortColumnCell.removeStyleClass("sort-ascending");
-            this._sortColumnCell.removeStyleClass("sort-descending");
-        }
+var rightEdgeOfNextColumn = leftEdgeOfPreviousColumn + firstRowCells[resizer.leftNeighboringColumnID].offsetWidth + firstRowCells[resizer.rightNeighboringColumnID].offsetWidth;
 
-        if (cell == this._sortColumnCell) {
-            if (sortOrder == "ascending")
-                sortOrder = "descending";
-            else
-                sortOrder = "ascending";
-        }
 
-        this._sortColumnCell = cell;
+var leftMinimum = leftEdgeOfPreviousColumn + this.ColumnResizePadding;
+var rightMaximum = rightEdgeOfNextColumn - this.ColumnResizePadding;
 
-        cell.addStyleClass("sort-" + sortOrder);
+dragPoint = Number.constrain(dragPoint, leftMinimum, rightMaximum);
 
-        this.dispatchEventToListeners("sorting changed");
-    },
+resizer.style.left = (dragPoint - this.CenterResizerOverBorderAdjustment) + "px";
 
-    _mouseDownInDataTable: function(event)
-    {
-        var gridNode = this.dataGridNodeFromNode(event.target);
-        if (!gridNode || !gridNode.selectable)
-            return;
+var percentLeftColumn = (((dragPoint - leftEdgeOfPreviousColumn) / this._dataTable.offsetWidth) * 100) + "%";
+this._headerTableColumnGroup.children[resizer.leftNeighboringColumnID].style.width = percentLeftColumn;
+this._dataTableColumnGroup.children[resizer.leftNeighboringColumnID].style.width = percentLeftColumn;
 
-        if (gridNode.isEventWithinDisclosureTriangle(event))
-            return;
+var percentRightColumn = (((rightEdgeOfNextColumn - dragPoint) / this._dataTable.offsetWidth) * 100) + "%";
+this._headerTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width =  percentRightColumn;
+this._dataTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width = percentRightColumn;
 
-        if (event.metaKey) {
-            if (gridNode.selected)
-                gridNode.deselect();
-            else
-                gridNode.select();
-        } else
-            gridNode.select();
-    },
-    
-    _contextMenuInDataTable: function(event)
-    {
-        var gridNode = this.dataGridNodeFromNode(event.target);
-        if (!gridNode || !gridNode.selectable)
-            return;
-        
-        if (gridNode.isEventWithinDisclosureTriangle(event))
-            return;
-      
-        var contextMenu = new WebInspector.ContextMenu();
-        
-        // FIXME: Use the column names for Editing, instead of just "Edit".
-        if (this.dataGrid._editCallback) {
-            if (gridNode === this.creationNode)
-                contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
-            else
-                contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
-        }
-        if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
-            contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
-        
-        contextMenu.show(event);
-    },
+this._positionResizers();
+event.preventDefault();
+this.dispatchEventToListeners("width changed");
+},
 
-    _clickInDataTable: function(event)
-    {
-        var gridNode = this.dataGridNodeFromNode(event.target);
-        if (!gridNode || !gridNode.hasChildren)
-            return;
+_endResizerDragging: function(event)
+{
+WebInspector.elementDragEnd(event);
+this.currentResizer = null;
+this.dispatchEventToListeners("width changed");
+},
 
-        if (!gridNode.isEventWithinDisclosureTriangle(event))
-            return;
+ColumnResizePadding: 10,
 
-        if (gridNode.expanded) {
-            if (event.altKey)
-                gridNode.collapseRecursively();
-            else
-                gridNode.collapse();
-        } else {
-            if (event.altKey)
-                gridNode.expandRecursively();
-            else
-                gridNode.expand();
-        }
-    },
-    
-    _startResizerDragging: function(event)
-    {
-        this.currentResizer = event.target;
-        if (!this.currentResizer.rightNeighboringColumnID)
-            return;
-        WebInspector.elementDragStart(this.lastResizer, this._resizerDragging.bind(this),
-            this._endResizerDragging.bind(this), event, "col-resize");
-    },
-    
-    _resizerDragging: function(event)
-    {
-        var resizer = this.currentResizer;
-        if (!resizer)
-            return;
-        
-        // Constrain the dragpoint to be within the containing div of the
-        // datagrid.
-        var dragPoint = event.clientX - this.element.totalOffsetLeft;
-        // Constrain the dragpoint to be within the space made up by the
-        // column directly to the left and the column directly to the right.
-        var leftEdgeOfPreviousColumn = 0;
-        var firstRowCells = this.headerTableBody.rows[0].cells;
-        for (var i = 0; i < resizer.rightNeighboringColumnID - 1; i++)
-            leftEdgeOfPreviousColumn += firstRowCells[i].offsetWidth;
-            
-        var rightEdgeOfNextColumn = leftEdgeOfPreviousColumn + firstRowCells[resizer.rightNeighboringColumnID - 1].offsetWidth + firstRowCells[resizer.rightNeighboringColumnID].offsetWidth;
-        
-        // Give each column some padding so that they don't disappear.               
-        var leftMinimum = leftEdgeOfPreviousColumn + this.ColumnResizePadding;
-        var rightMaximum = rightEdgeOfNextColumn - this.ColumnResizePadding;
-        
-        dragPoint = Number.constrain(dragPoint, leftMinimum, rightMaximum);
-        
-        resizer.style.left = (dragPoint - this.CenterResizerOverBorderAdjustment) + "px";
-        
-        var percentLeftColumn = (((dragPoint - leftEdgeOfPreviousColumn) / this._dataTable.offsetWidth) * 100) + "%";
-        this._headerTableColumnGroup.children[resizer.rightNeighboringColumnID - 1].style.width = percentLeftColumn;
-        this._dataTableColumnGroup.children[resizer.rightNeighboringColumnID - 1].style.width = percentLeftColumn;
-        
-        var percentRightColumn = (((rightEdgeOfNextColumn - dragPoint) / this._dataTable.offsetWidth) * 100) + "%";
-        this._headerTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width =  percentRightColumn;
-        this._dataTableColumnGroup.children[resizer.rightNeighboringColumnID].style.width = percentRightColumn;
-        
-        event.preventDefault();
-    },
-    
-    _endResizerDragging: function(event)
-    {
-        WebInspector.elementDragEnd(event);
-        this.currentResizer = null;
-    },
-    
-    ColumnResizePadding: 10,
-    
-    CenterResizerOverBorderAdjustment: 3,
+CenterResizerOverBorderAdjustment: 3,
 }
 
 WebInspector.DataGrid.prototype.__proto__ = WebInspector.Object.prototype;
 
 WebInspector.DataGridNode = function(data, hasChildren)
 {
-    this._expanded = false;
-    this._selected = false;
-    this._shouldRefreshChildren = true;
-    this._data = data || {};
-    this.hasChildren = hasChildren || false;
-    this.children = [];
-    this.dataGrid = null;
-    this.parent = null;
-    this.previousSibling = null;
-    this.nextSibling = null;
-    this.disclosureToggleWidth = 10;
+this._expanded = false;
+this._selected = false;
+this._shouldRefreshChildren = true;
+this._data = data || {};
+this.hasChildren = hasChildren || false;
+this.children = [];
+this.dataGrid = null;
+this.parent = null;
+this.previousSibling = null;
+this.nextSibling = null;
+this.disclosureToggleWidth = 10;
 }
 
 WebInspector.DataGridNode.prototype = {
-    selectable: true,
+selectable: true,
 
-    get element()
-    {
-        if (this._element)
-            return this._element;
+get element()
+{
+if (this._element)
+return this._element;
 
-        if (!this.dataGrid)
-            return null;
+if (!this.dataGrid)
+return null;
 
-        this._element = document.createElement("tr");
-        this._element._dataGridNode = this;
+this._element = document.createElement("tr");
+this._element._dataGridNode = this;
 
-        if (this.hasChildren)
-            this._element.addStyleClass("parent");
-        if (this.expanded)
-            this._element.addStyleClass("expanded");
-        if (this.selected)
-            this._element.addStyleClass("selected");
-        if (this.revealed)
-            this._element.addStyleClass("revealed");
+if (this.hasChildren)
+this._element.addStyleClass("parent");
+if (this.expanded)
+this._element.addStyleClass("expanded");
+if (this.selected)
+this._element.addStyleClass("selected");
+if (this.revealed)
+this._element.addStyleClass("revealed");
 
-        for (var columnIdentifier in this.dataGrid.columns) {
-            var cell = this.createCell(columnIdentifier);
-            this._element.appendChild(cell);
-        }
+this.createCells();
+return this._element;
+},
 
-        return this._element;
-    },
+createCells: function()
+{
+for (var columnIdentifier in this.dataGrid.columns) {
+var cell = this.createCell(columnIdentifier);
+this._element.appendChild(cell);
+}
+},
 
-    get data()
-    {
-        return this._data;
-    },
+get data()
+{
+return this._data;
+},
 
-    set data(x)
-    {
-        this._data = x || {};
-        this.refresh();
-    },
+set data(x)
+{
+this._data = x || {};
+this.refresh();
+},
 
-    get revealed()
-    {
-        if ("_revealed" in this)
-            return this._revealed;
+get revealed()
+{
+if ("_revealed" in this)
+return this._revealed;
 
-        var currentAncestor = this.parent;
-        while (currentAncestor && !currentAncestor.root) {
-            if (!currentAncestor.expanded) {
-                this._revealed = false;
-                return false;
-            }
+var currentAncestor = this.parent;
+while (currentAncestor && !currentAncestor.root) {
+if (!currentAncestor.expanded) {
+this._revealed = false;
+return false;
+}
 
-            currentAncestor = currentAncestor.parent;
-        }
+currentAncestor = currentAncestor.parent;
+}
 
-        this._revealed = true;
-        return true;
-    },
+this._revealed = true;
+return true;
+},
 
-    set hasChildren(x)
-    {
-        if (this._hasChildren === x)
-            return;
+set hasChildren(x)
+{
+if (this._hasChildren === x)
+return;
 
-        this._hasChildren = x;
+this._hasChildren = x;
 
-        if (!this._element)
-            return;
+if (!this._element)
+return;
 
-        if (this._hasChildren)
-        {
-            this._element.addStyleClass("parent");
-            if (this.expanded)
-                this._element.addStyleClass("expanded");
-        }
-        else
-        {
-            this._element.removeStyleClass("parent");
-            this._element.removeStyleClass("expanded");
-        }
-    },
+if (this._hasChildren)
+{
+this._element.addStyleClass("parent");
+if (this.expanded)
+this._element.addStyleClass("expanded");
+}
+else
+{
+this._element.removeStyleClass("parent");
+this._element.removeStyleClass("expanded");
+}
+},
 
-    get hasChildren()
-    {
-        return this._hasChildren;
-    },
+get hasChildren()
+{
+return this._hasChildren;
+},
 
-    set revealed(x)
-    {
-        if (this._revealed === x)
-            return;
+set revealed(x)
+{
+if (this._revealed === x)
+return;
 
-        this._revealed = x;
+this._revealed = x;
 
-        if (this._element) {
-            if (this._revealed)
-                this._element.addStyleClass("revealed");
-            else
-                this._element.removeStyleClass("revealed");
-        }
+if (this._element) {
+if (this._revealed)
+this._element.addStyleClass("revealed");
+else
+this._element.removeStyleClass("revealed");
+}
 
-        for (var i = 0; i < this.children.length; ++i)
-            this.children[i].revealed = x && this.expanded;
-    },
+for (var i = 0; i < this.children.length; ++i)
+this.children[i].revealed = x && this.expanded;
+},
 
-    get depth()
-    {
-        if ("_depth" in this)
-            return this._depth;
-        if (this.parent && !this.parent.root)
-            this._depth = this.parent.depth + 1;
-        else
-            this._depth = 0;
-        return this._depth;
-    },
+get depth()
+{
+if ("_depth" in this)
+return this._depth;
+if (this.parent && !this.parent.root)
+this._depth = this.parent.depth + 1;
+else
+this._depth = 0;
+return this._depth;
+},
 
-    get shouldRefreshChildren()
-    {
-        return this._shouldRefreshChildren;
-    },
+get shouldRefreshChildren()
+{
+return this._shouldRefreshChildren;
+},
 
-    set shouldRefreshChildren(x)
-    {
-        this._shouldRefreshChildren = x;
-        if (x && this.expanded)
-            this.expand();
-    },
+set shouldRefreshChildren(x)
+{
+this._shouldRefreshChildren = x;
+if (x && this.expanded)
+this.expand();
+},
 
-    get selected()
-    {
-        return this._selected;
-    },
+get selected()
+{
+return this._selected;
+},
 
-    set selected(x)
-    {
-        if (x)
-            this.select();
-        else
-            this.deselect();
-    },
+set selected(x)
+{
+if (x)
+this.select();
+else
+this.deselect();
+},
 
-    get expanded()
-    {
-        return this._expanded;
-    },
+get expanded()
+{
+return this._expanded;
+},
 
-    set expanded(x)
-    {
-        if (x)
-            this.expand();
-        else
-            this.collapse();
-    },
+set expanded(x)
+{
+if (x)
+this.expand();
+else
+this.collapse();
+},
 
-    refresh: function()
-    {
-        if (!this._element || !this.dataGrid)
-            return;
+refresh: function()
+{
+if (!this._element || !this.dataGrid)
+return;
 
-        this._element.removeChildren();
+this._element.removeChildren();
+this.createCells();
+},
 
-        for (var columnIdentifier in this.dataGrid.columns) {
-            var cell = this.createCell(columnIdentifier);
-            this._element.appendChild(cell);
-        }
-    },
+createCell: function(columnIdentifier)
+{
+var cell = document.createElement("td");
+cell.className = columnIdentifier + "-column";
 
-    createCell: function(columnIdentifier)
-    {
-        var cell = document.createElement("td");
-        cell.className = columnIdentifier + "-column";
+var alignment = this.dataGrid.aligned[columnIdentifier];
+if (alignment)
+cell.addStyleClass(alignment);
 
-        var alignment = this.dataGrid.aligned[columnIdentifier];
-        if (alignment)
-            cell.addStyleClass(alignment);
+var div = document.createElement("div");
+div.textContent = this.data[columnIdentifier];
+cell.appendChild(div);
 
-        var div = document.createElement("div");
-        div.textContent = this.data[columnIdentifier];
-        cell.appendChild(div);
+if (columnIdentifier === this.dataGrid.disclosureColumnIdentifier) {
+cell.addStyleClass("disclosure");
+if (this.depth)
+cell.style.setProperty("padding-left", (this.depth * this.dataGrid.indentWidth) + "px");
+}
 
-        if (columnIdentifier === this.dataGrid.disclosureColumnIdentifier) {
-            cell.addStyleClass("disclosure");
-            if (this.depth)
-                cell.style.setProperty("padding-left", (this.depth * this.dataGrid.indentWidth) + "px");
-        }
+return cell;
+},
 
-        return cell;
-    },
 
-    // Share these functions with DataGrid. They are written to work with a DataGridNode this object.
-    appendChild: WebInspector.DataGrid.prototype.appendChild,
-    insertChild: WebInspector.DataGrid.prototype.insertChild,
-    removeChild: WebInspector.DataGrid.prototype.removeChild,
-    removeChildren: WebInspector.DataGrid.prototype.removeChildren,
-    removeChildrenRecursive: WebInspector.DataGrid.prototype.removeChildrenRecursive,
+appendChild: WebInspector.DataGrid.prototype.appendChild,
+insertChild: WebInspector.DataGrid.prototype.insertChild,
+removeChild: WebInspector.DataGrid.prototype.removeChild,
+removeChildren: WebInspector.DataGrid.prototype.removeChildren,
+removeChildrenRecursive: WebInspector.DataGrid.prototype.removeChildrenRecursive,
 
-    _recalculateSiblings: function(myIndex)
-    {
-        if (!this.parent)
-            return;
+_recalculateSiblings: function(myIndex)
+{
+if (!this.parent)
+return;
 
-        var previousChild = (myIndex > 0 ? this.parent.children[myIndex - 1] : null);
+var previousChild = (myIndex > 0 ? this.parent.children[myIndex - 1] : null);
 
-        if (previousChild) {
-            previousChild.nextSibling = this;
-            this.previousSibling = previousChild;
-        } else
-            this.previousSibling = null;
+if (previousChild) {
+previousChild.nextSibling = this;
+this.previousSibling = previousChild;
+} else
+this.previousSibling = null;
 
-        var nextChild = this.parent.children[myIndex + 1];
+var nextChild = this.parent.children[myIndex + 1];
 
-        if (nextChild) {
-            nextChild.previousSibling = this;
-            this.nextSibling = nextChild;
-        } else
-            this.nextSibling = null;
-    },
+if (nextChild) {
+nextChild.previousSibling = this;
+this.nextSibling = nextChild;
+} else
+this.nextSibling = null;
+},
 
-    collapse: function()
-    {
-        if (this._element)
-            this._element.removeStyleClass("expanded");
+collapse: function()
+{
+if (this._element)
+this._element.removeStyleClass("expanded");
 
-        this._expanded = false;
+this._expanded = false;
 
-        for (var i = 0; i < this.children.length; ++i)
-            this.children[i].revealed = false;
+for (var i = 0; i < this.children.length; ++i)
+this.children[i].revealed = false;
 
-        this.dispatchEventToListeners("collapsed");
-    },
+this.dispatchEventToListeners("collapsed");
+},
 
-    collapseRecursively: function()
-    {
-        var item = this;
-        while (item) {
-            if (item.expanded)
-                item.collapse();
-            item = item.traverseNextNode(false, this, true);
-        }
-    },
+collapseRecursively: function()
+{
+var item = this;
+while (item) {
+if (item.expanded)
+item.collapse();
+item = item.traverseNextNode(false, this, true);
+}
+},
 
-    expand: function()
-    {
-        if (!this.hasChildren || this.expanded)
-            return;
+expand: function()
+{
+if (!this.hasChildren || this.expanded)
+return;
 
-        if (this.revealed && !this._shouldRefreshChildren)
-            for (var i = 0; i < this.children.length; ++i)
-                this.children[i].revealed = true;
+if (this.revealed && !this._shouldRefreshChildren)
+for (var i = 0; i < this.children.length; ++i)
+this.children[i].revealed = true;
 
-        if (this._shouldRefreshChildren) {
-            for (var i = 0; i < this.children.length; ++i)
-                this.children[i]._detach();
+if (this._shouldRefreshChildren) {
+for (var i = 0; i < this.children.length; ++i)
+this.children[i]._detach();
 
-            this.dispatchEventToListeners("populate");
+this.dispatchEventToListeners("populate");
 
-            if (this._attached) {
-                for (var i = 0; i < this.children.length; ++i) {
-                    var child = this.children[i];
-                    if (this.revealed)
-                        child.revealed = true;
-                    child._attach();
-                }
-            }
+if (this._attached) {
+for (var i = 0; i < this.children.length; ++i) {
+var child = this.children[i];
+if (this.revealed)
+child.revealed = true;
+child._attach();
+}
+}
 
-            delete this._shouldRefreshChildren;
-        }
+delete this._shouldRefreshChildren;
+}
 
-        if (this._element)
-            this._element.addStyleClass("expanded");
+if (this._element)
+this._element.addStyleClass("expanded");
 
-        this._expanded = true;
+this._expanded = true;
 
-        this.dispatchEventToListeners("expanded");
-    },
+this.dispatchEventToListeners("expanded");
+},
 
-    expandRecursively: function()
-    {
-        var item = this;
-        while (item) {
-            item.expand();
-            item = item.traverseNextNode(false, this);
-        }
-    },
+expandRecursively: function()
+{
+var item = this;
+while (item) {
+item.expand();
+item = item.traverseNextNode(false, this);
+}
+},
 
-    reveal: function()
-    {
-        var currentAncestor = this.parent;
-        while (currentAncestor && !currentAncestor.root) {
-            if (!currentAncestor.expanded)
-                currentAncestor.expand();
-            currentAncestor = currentAncestor.parent;
-        }
+reveal: function()
+{
+var currentAncestor = this.parent;
+while (currentAncestor && !currentAncestor.root) {
+if (!currentAncestor.expanded)
+currentAncestor.expand();
+currentAncestor = currentAncestor.parent;
+}
 
-        this.element.scrollIntoViewIfNeeded(false);
+this.element.scrollIntoViewIfNeeded(false);
 
-        this.dispatchEventToListeners("revealed");
-    },
+this.dispatchEventToListeners("revealed");
+},
 
-    select: function(supressSelectedEvent)
-    {
-        if (!this.dataGrid || !this.selectable || this.selected)
-            return;
+select: function(supressSelectedEvent)
+{
+if (!this.dataGrid || !this.selectable || this.selected)
+return;
 
-        if (this.dataGrid.selectedNode)
-            this.dataGrid.selectedNode.deselect();
+if (this.dataGrid.selectedNode)
+this.dataGrid.selectedNode.deselect();
 
-        this._selected = true;
-        this.dataGrid.selectedNode = this;
+this._selected = true;
+this.dataGrid.selectedNode = this;
 
-        if (this._element)
-            this._element.addStyleClass("selected");
+if (this._element)
+this._element.addStyleClass("selected");
 
-        if (!supressSelectedEvent)
-            this.dispatchEventToListeners("selected");
-    },
+if (!supressSelectedEvent)
+this.dispatchEventToListeners("selected");
+},
 
-    deselect: function(supressDeselectedEvent)
-    {
-        if (!this.dataGrid || this.dataGrid.selectedNode !== this || !this.selected)
-            return;
+deselect: function(supressDeselectedEvent)
+{
+if (!this.dataGrid || this.dataGrid.selectedNode !== this || !this.selected)
+return;
 
-        this._selected = false;
-        this.dataGrid.selectedNode = null;
+this._selected = false;
+this.dataGrid.selectedNode = null;
 
-        if (this._element)
-            this._element.removeStyleClass("selected");
+if (this._element)
+this._element.removeStyleClass("selected");
 
-        if (!supressDeselectedEvent)
-            this.dispatchEventToListeners("deselected");
-    },
+if (!supressDeselectedEvent)
+this.dispatchEventToListeners("deselected");
+},
 
-    traverseNextNode: function(skipHidden, stayWithin, dontPopulate, info)
-    {
-        if (!dontPopulate && this.hasChildren)
-            this.dispatchEventToListeners("populate");
+traverseNextNode: function(skipHidden, stayWithin, dontPopulate, info)
+{
+if (!dontPopulate && this.hasChildren)
+this.dispatchEventToListeners("populate");
 
-        if (info)
-            info.depthChange = 0;
+if (info)
+info.depthChange = 0;
 
-        var node = (!skipHidden || this.revealed) ? this.children[0] : null;
-        if (node && (!skipHidden || this.expanded)) {
-            if (info)
-                info.depthChange = 1;
-            return node;
-        }
+var node = (!skipHidden || this.revealed) ? this.children[0] : null;
+if (node && (!skipHidden || this.expanded)) {
+if (info)
+info.depthChange = 1;
+return node;
+}
 
-        if (this === stayWithin)
-            return null;
+if (this === stayWithin)
+return null;
 
-        node = (!skipHidden || this.revealed) ? this.nextSibling : null;
-        if (node)
-            return node;
+node = (!skipHidden || this.revealed) ? this.nextSibling : null;
+if (node)
+return node;
 
-        node = this;
-        while (node && !node.root && !((!skipHidden || node.revealed) ? node.nextSibling : null) && node.parent !== stayWithin) {
-            if (info)
-                info.depthChange -= 1;
-            node = node.parent;
-        }
+node = this;
+while (node && !node.root && !((!skipHidden || node.revealed) ? node.nextSibling : null) && node.parent !== stayWithin) {
+if (info)
+info.depthChange -= 1;
+node = node.parent;
+}
 
-        if (!node)
-            return null;
+if (!node)
+return null;
 
-        return (!skipHidden || node.revealed) ? node.nextSibling : null;
-    },
+return (!skipHidden || node.revealed) ? node.nextSibling : null;
+},
 
-    traversePreviousNode: function(skipHidden, dontPopulate)
-    {
-        var node = (!skipHidden || this.revealed) ? this.previousSibling : null;
-        if (!dontPopulate && node && node.hasChildren)
-            node.dispatchEventToListeners("populate");
+traversePreviousNode: function(skipHidden, dontPopulate)
+{
+var node = (!skipHidden || this.revealed) ? this.previousSibling : null;
+if (!dontPopulate && node && node.hasChildren)
+node.dispatchEventToListeners("populate");
 
-        while (node && ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null)) {
-            if (!dontPopulate && node.hasChildren)
-                node.dispatchEventToListeners("populate");
-            node = ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null);
-        }
+while (node && ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null)) {
+if (!dontPopulate && node.hasChildren)
+node.dispatchEventToListeners("populate");
+node = ((!skipHidden || (node.revealed && node.expanded)) ? node.children[node.children.length - 1] : null);
+}
 
-        if (node)
-            return node;
+if (node)
+return node;
 
-        if (!this.parent || this.parent.root)
-            return null;
+if (!this.parent || this.parent.root)
+return null;
 
-        return this.parent;
-    },
+return this.parent;
+},
 
-    isEventWithinDisclosureTriangle: function(event)
-    {
-        if (!this.hasChildren)
-            return false;
-        var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
-        if (!cell.hasStyleClass("disclosure"))
-            return false;
-        var computedLeftPadding = window.getComputedStyle(cell).getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);
-        var left = cell.totalOffsetLeft + computedLeftPadding;
-        return event.pageX >= left && event.pageX <= left + this.disclosureToggleWidth;
-    },
+isEventWithinDisclosureTriangle: function(event)
+{
+if (!this.hasChildren)
+return false;
+var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
+if (!cell.hasStyleClass("disclosure"))
+return false;
+var computedLeftPadding = window.getComputedStyle(cell).getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);
+var left = cell.totalOffsetLeft + computedLeftPadding;
+return event.pageX >= left && event.pageX <= left + this.disclosureToggleWidth;
+},
 
-    _attach: function()
-    {
-        if (!this.dataGrid || this._attached)
-            return;
+_attach: function()
+{
+if (!this.dataGrid || this._attached)
+return;
 
-        this._attached = true;
+this._attached = true;
 
-        var nextNode = null;
-        var previousNode = this.traversePreviousNode(true, true);
-        if (previousNode && previousNode.element.parentNode && previousNode.element.nextSibling)
-            var nextNode = previousNode.element.nextSibling;
-        if (!nextNode)
-            nextNode = this.dataGrid.dataTableBody.lastChild;
-        this.dataGrid.dataTableBody.insertBefore(this.element, nextNode);
+var nextNode = null;
+var previousNode = this.traversePreviousNode(true, true);
+if (previousNode && previousNode.element.parentNode && previousNode.element.nextSibling)
+var nextNode = previousNode.element.nextSibling;
+if (!nextNode)
+nextNode = this.dataGrid.dataTableBody.lastChild;
+this.dataGrid.dataTableBody.insertBefore(this.element, nextNode);
 
-        if (this.expanded)
-            for (var i = 0; i < this.children.length; ++i)
-                this.children[i]._attach();
-    },
+if (this.expanded)
+for (var i = 0; i < this.children.length; ++i)
+this.children[i]._attach();
+},
 
-    _detach: function()
-    {
-        if (!this._attached)
-            return;
+_detach: function()
+{
+if (!this._attached)
+return;
 
-        this._attached = false;
+this._attached = false;
 
-        if (this._element && this._element.parentNode)
-            this._element.parentNode.removeChild(this._element);
+if (this._element && this._element.parentNode)
+this._element.parentNode.removeChild(this._element);
 
-        for (var i = 0; i < this.children.length; ++i)
-            this.children[i]._detach();
-    },
+for (var i = 0; i < this.children.length; ++i)
+this.children[i]._detach();
+},
 
-    savePosition: function()
-    {
-        if (this._savedPosition)
-            return;
+savePosition: function()
+{
+if (this._savedPosition)
+return;
 
-        if (!this.parent)
-            throw("savePosition: Node must have a parent.");
-        this._savedPosition = {
-            parent: this.parent,
-            index: this.parent.children.indexOf(this)
-        };
-    },
+if (!this.parent)
+throw("savePosition: Node must have a parent.");
+this._savedPosition = {
+parent: this.parent,
+index: this.parent.children.indexOf(this)
+};
+},
 
-    restorePosition: function()
-    {
-        if (!this._savedPosition)
-            return;
+restorePosition: function()
+{
+if (!this._savedPosition)
+return;
 
-        if (this.parent !== this._savedPosition.parent)
-            this._savedPosition.parent.insertChild(this, this._savedPosition.index);
+if (this.parent !== this._savedPosition.parent)
+this._savedPosition.parent.insertChild(this, this._savedPosition.index);
 
-        delete this._savedPosition;
-    }
+delete this._savedPosition;
+}
 }
 
 WebInspector.DataGridNode.prototype.__proto__ = WebInspector.Object.prototype;
 
 WebInspector.CreationDataGridNode = function(data, hasChildren)
 {
-    WebInspector.DataGridNode.call(this, data, hasChildren);
-    this.isCreationNode = true;
+WebInspector.DataGridNode.call(this, data, hasChildren);
+this.isCreationNode = true;
 }
 
 WebInspector.CreationDataGridNode.prototype = {
-    makeNormal: function()
-    {
-        delete this.isCreationNode;
-        delete this.makeNormal;
-    }
+makeNormal: function()
+{
+delete this.isCreationNode;
+delete this.makeNormal;
+}
 }
 
 WebInspector.CreationDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
 
-/* CookieItemsView.js */
 
-/*
- * Copyright (C) 2009 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+WebInspector.CookiesTable = function(cookieDomain, expandable, deleteCallback)
+{
+this._cookieDomain = cookieDomain;
+
+var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
+columns[0].title = WebInspector.UIString("Name");
+columns[0].sortable = true;
+columns[0].disclosure = expandable;
+columns[0].width = "24%";
+columns[1].title = WebInspector.UIString("Value");
+columns[1].sortable = true;
+columns[1].width = "34%";
+columns[2].title = WebInspector.UIString("Domain");
+columns[2].sortable = true;
+columns[2].width = "7%";
+columns[3].title = WebInspector.UIString("Path");
+columns[3].sortable = true;
+columns[3].width = "7%";
+columns[4].title = WebInspector.UIString("Expires");
+columns[4].sortable = true;
+columns[4].width = "7%";
+columns[5].title = WebInspector.UIString("Size");
+columns[5].aligned = "right";
+columns[5].sortable = true;
+columns[5].width = "7%";
+columns[6].title = WebInspector.UIString("HTTP");
+columns[6].aligned = "centered";
+columns[6].sortable = true;
+columns[6].width = "7%";
+columns[7].title = WebInspector.UIString("Secure");
+columns[7].aligned = "centered";
+columns[7].sortable = true;
+columns[7].width = "7%";
+
+this._dataGrid = new WebInspector.DataGrid(columns, null, deleteCallback ? this._onDeleteFromGrid.bind(this) : null);
+this._dataGrid.addEventListener("sorting changed", this._rebuildTable, this);
+
+this.element = this._dataGrid.element;
+this._data = [];
+this._deleteCallback = deleteCallback;
+}
+
+WebInspector.CookiesTable.prototype = {
+updateWidths: function()
+{
+if (this._dataGrid)
+this._dataGrid.updateWidths();
+},
+
+setCookies: function(cookies)
+{
+this._data = [{cookies: cookies}];
+this._rebuildTable();
+},
+
+addCookiesFolder: function(folderName, cookies)
+{
+this._data.push({cookies: cookies, folderName: folderName});
+this._rebuildTable();
+},
+
+get selectedCookie()
+{
+var node = this._dataGrid.selectedNode;
+return node ? node.cookie : null;
+},
+
+_rebuildTable: function()
+{
+this._dataGrid.removeChildren();
+for (var i = 0; i < this._data.length; ++i) {
+var item = this._data[i];
+if (item.folderName) {
+var groupData = [ item.folderName, "", "", "", "", this._totalSize(item.cookies), "", "" ];
+var groupNode = new WebInspector.DataGridNode(groupData);
+groupNode.selectable = true;
+this._dataGrid.appendChild(groupNode);
+groupNode.element.addStyleClass("row-group");
+this._populateNode(groupNode, item.cookies);
+groupNode.expand();
+} else
+this._populateNode(this._dataGrid, item.cookies);
+}
+},
+
+_populateNode: function(parentNode, cookies)
+{
+var selectedCookie = this.selectedCookie;
+parentNode.removeChildren();
+if (!cookies)
+return;
+
+this._sortCookies(cookies);
+for (var i = 0; i < cookies.length; ++i) {
+var cookieNode = this._createGridNode(cookies[i]);
+parentNode.appendChild(cookieNode);
+if (selectedCookie === cookies[i])
+cookieNode.selected = true;
+}
+},
+
+_totalSize: function(cookies)
+{
+var totalSize = 0;
+for (var i = 0; cookies && i < cookies.length; ++i)
+totalSize += cookies[i].size;
+return totalSize;
+},
+
+_sortCookies: function(cookies)
+{
+var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
+
+function localeCompare(field, cookie1, cookie2)
+{
+return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")
+}
+
+function numberCompare(field, cookie1, cookie2)
+{
+return sortDirection * (cookie1[field] - cookie2[field]);
+}
+
+function expiresCompare(cookie1, cookie2)
+{
+if (cookie1.session !== cookie2.session)
+return sortDirection * (cookie1.session ? 1 : -1);
+
+if (cookie1.session)
+return 0;
+
+return sortDirection * (cookie1.expires - cookie2.expires);
+}
+
+var comparator;
+switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
+case 0: comparator = localeCompare.bind(this, "name"); break;
+case 1: comparator = localeCompare.bind(this, "value"); break;
+case 2: comparator = localeCompare.bind(this, "domain"); break;
+case 3: comparator = localeCompare.bind(this, "path"); break;
+case 4: comparator = expiresCompare; break;
+case 5: comparator = numberCompare.bind(this, "size"); break;
+case 6: comparator = localeCompare.bind(this, "httpOnly"); break;
+case 7: comparator = localeCompare.bind(this, "secure"); break;
+default: localeCompare.bind(this, "name");
+}
+
+cookies.sort(comparator);
+},
+
+_createGridNode: function(cookie)
+{
+var data = {};
+data[0] = cookie.name;
+data[1] = cookie.value;
+data[2] = cookie.domain || "";
+data[3] = cookie.path || "";
+data[4] = cookie.type === WebInspector.Cookie.Type.Request ? "" :
+(cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());
+data[5] = cookie.size;
+const checkmark = "\u2713";
+data[6] = (cookie.httpOnly ? checkmark : "");
+data[7] = (cookie.secure ? checkmark : "");
+
+var node = new WebInspector.DataGridNode(data);
+node.cookie = cookie;
+node.selectable = true;
+return node;
+},
+
+_onDeleteFromGrid: function(node)
+{
+this._deleteCallback(node.cookie);
+}
+}
+
+
+
+
 
 WebInspector.CookieItemsView = function(treeElement, cookieDomain)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.element.addStyleClass("storage-view");
-    this.element.addStyleClass("table");
+this.element.addStyleClass("storage-view");
 
-    this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
-    this.deleteButton.visible = false;
-    this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+this._deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
+this._deleteButton.visible = false;
+this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
 
-    this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
-    
-    this._treeElement = treeElement;
-    this._cookieDomain = cookieDomain;
+this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
+this._refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
 
-    this._emptyMsgElement = document.createElement("div");
-    this._emptyMsgElement.className = "storage-table-empty";
-    this._emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies.");
-    this.element.appendChild(this._emptyMsgElement);
+this._treeElement = treeElement;
+this._cookieDomain = cookieDomain;
+
+this._emptyMsgElement = document.createElement("div");
+this._emptyMsgElement.className = "storage-empty-view";
+this._emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies.");
+this.element.appendChild(this._emptyMsgElement);
 }
 
 WebInspector.CookieItemsView.prototype = {
-    get statusBarItems()
-    {
-        return [this.refreshButton.element, this.deleteButton.element];
-    },
+get statusBarItems()
+{
+return [this._refreshButton.element, this._deleteButton.element];
+},
 
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this._update();
-    },
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this._update();
+},
 
-    hide: function()
-    {
-        WebInspector.View.prototype.hide.call(this);
-        this.deleteButton.visible = false;
-    },
+hide: function()
+{
+WebInspector.View.prototype.hide.call(this);
+this._deleteButton.visible = false;
+},
 
-    _update: function()
-    {
-        WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this));
-    },
+resize: function()
+{
+if (this._cookiesTable)
+this._cookiesTable.updateWidths();
+},
 
-    _updateWithCookies: function(allCookies, isAdvanced)
-    {
-        if (isAdvanced)
-            this._filterCookiesForDomain(allCookies);
-        else
-            this._cookies = allCookies;
+_update: function()
+{
+WebInspector.Cookies.getCookiesAsync(this._updateWithCookies.bind(this));
+},
 
-        if (!this._cookies.length) {
-            // Nothing to show.
-            this._emptyMsgElement.removeStyleClass("hidden");
-            this.deleteButton.visible = false;
-            if (this._dataGrid)
-                this._dataGrid.element.addStyleClass("hidden");
-            return;
-        }
+_updateWithCookies: function(allCookies, isAdvanced)
+{
+this._cookies = isAdvanced ? this._filterCookiesForDomain(allCookies) : allCookies;
 
-        if (!this._dataGrid) {
-            if (isAdvanced) {
-                this._createDataGrid();
-                this._populateDataGrid();
-                this._dataGrid.autoSizeColumns(6, 33);
-                this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
-                    Number.bytesToString(this._totalSize, WebInspector.UIString));
-            } else {
-                this._createSimpleDataGrid();
-                this._populateSimpleDataGrid();
-                this._dataGrid.autoSizeColumns(20, 80);
-            }
-        } else {
-            if (isAdvanced)
-                this._populateDataGrid();
-            else
-                this._populateSimpleDataGrid();
-        }
+if (!this._cookies.length) {
 
-        this._dataGrid.element.removeStyleClass("hidden");
-        this._emptyMsgElement.addStyleClass("hidden");
-        if (isAdvanced)
-            this.deleteButton.visible = true;
-    },
+this._emptyMsgElement.removeStyleClass("hidden");
+this._deleteButton.visible = false;
+if (this._cookiesTable)
+this._cookiesTable.element.addStyleClass("hidden");
+return;
+}
 
-    _filterCookiesForDomain: function(allCookies)
-    {
-        this._cookies = [];
-        var resourceURLsForDocumentURL = [];
-        this._totalSize = 0;
+if (!this._cookiesTable) {
+this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this)) : new WebInspector.SimpleCookiesTable();
+this.element.appendChild(this._cookiesTable.element);
+}
 
-        for (var id in WebInspector.resources) {
-            var resource = WebInspector.resources[id];
-            var match = resource.documentURL.match(WebInspector.URLRegExp);
-            if (match && match[2] === this._cookieDomain)
-                resourceURLsForDocumentURL.push(resource.url);
-        }
+this._cookiesTable.setCookies(this._cookies);
+this._cookiesTable.element.removeStyleClass("hidden");
+this._emptyMsgElement.addStyleClass("hidden");
+if (isAdvanced) {
+this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length,
+Number.bytesToString(this._totalSize, WebInspector.UIString));
+this._deleteButton.visible = true;
+}
+},
 
-        for (var i = 0; i < allCookies.length; ++i) {
-            var pushed = false;
-            var size = allCookies[i].size;
-            for (var j = 0; j < resourceURLsForDocumentURL.length; ++j) {
-                var resourceURL = resourceURLsForDocumentURL[j];
-                if (WebInspector.Cookies.cookieMatchesResourceURL(allCookies[i], resourceURL)) {
-                    this._totalSize += size;
-                    if (!pushed) {
-                        pushed = true;
-                        this._cookies.push(allCookies[i]);
-                    }
-                }
-            }
-        }
-    },
+_filterCookiesForDomain: function(allCookies)
+{
+var cookies = [];
+var resourceURLsForDocumentURL = [];
+this._totalSize = 0;
 
-    _createDataGrid: function()
-    {
-        var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };
-        columns[0].title = WebInspector.UIString("Name");
-        columns[0].sortable = true;
-        columns[1].title = WebInspector.UIString("Value");
-        columns[1].sortable = true;
-        columns[2].title = WebInspector.UIString("Domain");
-        columns[2].sortable = true;
-        columns[3].title = WebInspector.UIString("Path");
-        columns[3].sortable = true;
-        columns[4].title = WebInspector.UIString("Expires");
-        columns[4].sortable = true;
-        columns[5].title = WebInspector.UIString("Size");
-        columns[5].aligned = "right";
-        columns[5].sortable = true;
-        columns[6].title = WebInspector.UIString("HTTP");
-        columns[6].aligned = "centered";
-        columns[6].sortable = true;
-        columns[7].title = WebInspector.UIString("Secure");
-        columns[7].aligned = "centered";
-        columns[7].sortable = true;
+function populateResourcesForDocuments(resource)
+{
+var url = resource.documentURL.asParsedURL();
+if (url && url.host == this._cookieDomain)
+resourceURLsForDocumentURL.push(resource.url);
+}
+WebInspector.forAllResources(populateResourcesForDocuments.bind(this));
 
-        this._dataGrid = new WebInspector.DataGrid(columns, null, this._deleteCookieCallback.bind(this));
-        this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
-        this.element.appendChild(this._dataGrid.element);
-        this._dataGrid.updateWidths();
-    },
+for (var i = 0; i < allCookies.length; ++i) {
+var pushed = false;
+var size = allCookies[i].size;
+for (var j = 0; j < resourceURLsForDocumentURL.length; ++j) {
+var resourceURL = resourceURLsForDocumentURL[j];
+if (WebInspector.Cookies.cookieMatchesResourceURL(allCookies[i], resourceURL)) {
+this._totalSize += size;
+if (!pushed) {
+pushed = true;
+cookies.push(allCookies[i]);
+}
+}
+}
+}
+return cookies;
+},
 
-    _populateDataGrid: function()
-    {
-        var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null;
-        var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
+_deleteCookie: function(cookie)
+{
+InspectorBackend.deleteCookie(cookie.name, this._cookieDomain);
+this._update();
+},
 
-        function localeCompare(field, cookie1, cookie2)
-        {
-            return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")
-        }
+_deleteButtonClicked: function()
+{
+if (this._cookiesTable.selectedCookie)
+this._deleteCookie(this._cookiesTable.selectedCookie);
+},
 
-        function numberCompare(field, cookie1, cookie2)
-        {
-            return sortDirection * (cookie1[field] - cookie2[field]);
-        }
-
-        function expiresCompare(cookie1, cookie2)
-        {
-            if (cookie1.session !== cookie2.session)
-                return sortDirection * (cookie1.session ? 1 : -1);
-
-            if (cookie1.session)
-                return 0;
-
-            return sortDirection * (cookie1.expires - cookie2.expires);
-        }
-
-        var comparator;
-        switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
-            case 0: comparator = localeCompare.bind(this, "name"); break;
-            case 1: comparator = localeCompare.bind(this, "value"); break;
-            case 2: comparator = localeCompare.bind(this, "domain"); break;
-            case 3: comparator = localeCompare.bind(this, "path"); break;
-            case 4: comparator = expiresCompare; break;
-            case 5: comparator = numberCompare.bind(this, "size"); break;
-            case 6: comparator = localeCompare.bind(this, "httpOnly"); break;
-            case 7: comparator = localeCompare.bind(this, "secure"); break;
-            default: localeCompare.bind(this, "name");
-        }
-
-        this._cookies.sort(comparator);
-
-        this._dataGrid.removeChildren();
-        var nodeToSelect;
-        for (var i = 0; i < this._cookies.length; ++i) {
-            var data = {};
-            var cookie = this._cookies[i];
-            data[0] = cookie.name;
-            data[1] = cookie.value;
-            data[2] = cookie.domain;
-            data[3] = cookie.path;
-            data[4] = (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());
-            data[5] = Number.bytesToString(cookie.size, WebInspector.UIString);
-            data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark
-            data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark
-
-            var node = new WebInspector.DataGridNode(data);
-            node.cookie = cookie;
-            node.selectable = true;
-            this._dataGrid.appendChild(node);
-            if (cookie === selectedCookie)
-                nodeToSelect = node;
-        }
-        if (nodeToSelect)
-            nodeToSelect.selected = true;
-        else
-            this._dataGrid.children[0].selected = true;
-    },
-
-    _createSimpleDataGrid: function()
-    {
-        var columns = {};
-        columns[0] = {};
-        columns[1] = {};
-        columns[0].title = WebInspector.UIString("Name");
-        columns[1].title = WebInspector.UIString("Value");
-
-        this._dataGrid = new WebInspector.DataGrid(columns);
-        this.element.appendChild(this._dataGrid.element);
-        this._dataGrid.updateWidths();
-    },
-
-    _populateSimpleDataGrid: function()
-    {
-        var cookies = this._cookies;
-        this._dataGrid.removeChildren();
-        var addedCookies = {};
-        for (var i = 0; i < cookies.length; ++i) {
-            if (addedCookies[cookies[i].name])
-                continue;
-            addedCookies[cookies[i].name] = true;
-            var data = {};
-            data[0] = cookies[i].name;
-            data[1] = cookies[i].value;
-
-            var node = new WebInspector.DataGridNode(data, false);
-            node.selectable = true;
-            this._dataGrid.appendChild(node);
-        }
-        this._dataGrid.children[0].selected = true;
-    },
-
-    resize: function()
-    {
-        if (this._dataGrid)
-            this._dataGrid.updateWidths();
-    },
-
-    _deleteButtonClicked: function(event)
-    {
-        if (!this._dataGrid || !this._dataGrid.selectedNode)
-            return;
-
-        this._deleteCookieCallback(this._dataGrid.selectedNode);
-    },
-
-    _deleteCookieCallback: function(node)
-    {
-        var cookie = node.cookie;
-        InspectorBackend.deleteCookie(cookie.name, this._cookieDomain);
-        this._update();
-    },
-
-    _refreshButtonClicked: function(event)
-    {
-        this._update();
-    }
+_refreshButtonClicked: function(event)
+{
+this._update();
+}
 }
 
 WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* Script.js */
-
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage)
+WebInspector.SimpleCookiesTable = function()
 {
-    this.sourceID = sourceID;
-    this.sourceURL = sourceURL;
-    this.source = source;
-    this.startingLine = startingLine;
-    this.errorLine = errorLine;
-    this.errorMessage = errorMessage;
+this.element = document.createElement("div");
+var columns = {};
+columns[0] = {};
+columns[1] = {};
+columns[0].title = WebInspector.UIString("Name");
+columns[1].title = WebInspector.UIString("Value");
 
-    // if no URL, look for "//@ sourceURL=" decorator
-    // note that this sourceURL comment decorator is behavior that FireBug added
-    // in it's 1.1 release as noted in the release notes:
-    // http://fbug.googlecode.com/svn/branches/firebug1.1/docs/ReleaseNotes_1.1.txt
-    if (!sourceURL) {
-        // use of [ \t] rather than \s is to prevent \n from matching
-        var pattern = /^\s*\/\/[ \t]*@[ \t]*sourceURL[ \t]*=[ \t]*(\S+).*$/m;
-        var match = pattern.exec(source);
+this._dataGrid = new WebInspector.DataGrid(columns);
+this._dataGrid.autoSizeColumns(20, 80);
+this.element.appendChild(this._dataGrid.element);
+this._dataGrid.updateWidths();
+}
 
-        if (match)
-            this.sourceURL = match[1];
-    }
+WebInspector.SimpleCookiesTable.prototype = {
+setCookies: function(cookies)
+{
+this._dataGrid.removeChildren();
+var addedCookies = {};
+for (var i = 0; i < cookies.length; ++i) {
+if (addedCookies[cookies[i].name])
+continue;
+addedCookies[cookies[i].name] = true;
+var data = {};
+data[0] = cookies[i].name;
+data[1] = cookies[i].value;
+
+var node = new WebInspector.DataGridNode(data, false);
+node.selectable = true;
+this._dataGrid.appendChild(node);
+}
+this._dataGrid.children[0].selected = true;
+},
+
+resize: function()
+{
+if (this._dataGrid)
+this._dataGrid.updateWidths();
+}
+}
+
+
+
+
+
+WebInspector.ApplicationCacheItemsView = function(treeElement, appcacheDomain)
+{
+WebInspector.View.call(this);
+
+this.element.addStyleClass("storage-view");
+this.element.addStyleClass("table");
+
+
+
+this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
+this.deleteButton.visible = false;
+this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+
+
+
+this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
+this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+
+if (Preferences.onlineDetectionEnabled) {
+this.connectivityIcon = document.createElement("img");
+this.connectivityIcon.className = "storage-application-cache-connectivity-icon";
+this.connectivityIcon.src = "";
+this.connectivityMessage = document.createElement("span");
+this.connectivityMessage.className = "storage-application-cache-connectivity";
+this.connectivityMessage.textContent = "";
+}
+
+this.divider = document.createElement("span");
+this.divider.className = "status-bar-item status-bar-divider";
+
+this.statusIcon = document.createElement("img");
+this.statusIcon.className = "storage-application-cache-status-icon";
+this.statusIcon.src = "";
+this.statusMessage = document.createElement("span");
+this.statusMessage.className = "storage-application-cache-status";
+this.statusMessage.textContent = "";
+
+this._treeElement = treeElement;
+this._appcacheDomain = appcacheDomain;
+
+this._emptyMsgElement = document.createElement("div");
+this._emptyMsgElement.className = "storage-empty-view";
+this._emptyMsgElement.textContent = WebInspector.UIString("No Application Cache information available.");
+this.element.appendChild(this._emptyMsgElement);
+
+this.updateStatus(applicationCache.UNCACHED);
+}
+
+WebInspector.ApplicationCacheItemsView.prototype = {
+get statusBarItems()
+{
+if (Preferences.onlineDetectionEnabled) {
+return [
+this.refreshButton.element, this.deleteButton.element,
+this.connectivityIcon, this.connectivityMessage, this.divider,
+this.statusIcon, this.statusMessage
+];
+} else {
+return [
+this.refreshButton.element, this.deleteButton.element, this.divider,
+this.statusIcon, this.statusMessage
+];
+}
+},
+
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this.updateNetworkState(navigator.onLine);
+this._update();
+},
+
+hide: function()
+{
+WebInspector.View.prototype.hide.call(this);
+this.deleteButton.visible = false;
+},
+
+updateStatus: function(status)
+{
+var statusInformation = {};
+statusInformation[applicationCache.UNCACHED]    = { src: "Images/warningOrangeDot.png", text: "UNCACHED"    };
+statusInformation[applicationCache.IDLE]        = { src: "Images/warningOrangeDot.png", text: "IDLE"        };
+statusInformation[applicationCache.CHECKING]    = { src: "Images/successGreenDot.png",  text: "CHECKING"    };
+statusInformation[applicationCache.DOWNLOADING] = { src: "Images/successGreenDot.png",  text: "DOWNLOADING" };
+statusInformation[applicationCache.UPDATEREADY] = { src: "Images/successGreenDot.png",  text: "UPDATEREADY" };
+statusInformation[applicationCache.OBSOLETE]    = { src: "Images/errorRedDot.png",      text: "OBSOLETE"    };
+
+var info = statusInformation[status];
+if (!info) {
+console.error("Unknown Application Cache Status was Not Handled: %d", status);
+return;
+}
+
+this.statusIcon.src = info.src;
+this.statusMessage.textContent = info.text;
+},
+
+updateNetworkState: function(isNowOnline)
+{
+if (Preferences.onlineDetectionEnabled) {
+if (isNowOnline) {
+this.connectivityIcon.src = "Images/successGreenDot.png";
+this.connectivityMessage.textContent = WebInspector.UIString("Online");
+} else {
+this.connectivityIcon.src = "Images/errorRedDot.png";
+this.connectivityMessage.textContent = WebInspector.UIString("Offline");
+}
+}
+},
+
+_update: function()
+{
+WebInspector.ApplicationCache.getApplicationCachesAsync(this._updateCallback.bind(this));
+},
+
+_updateCallback: function(applicationCaches)
+{
+
+
+this._manifest = applicationCaches.manifest;
+this._creationTime = applicationCaches.creationTime;
+this._updateTime = applicationCaches.updateTime;
+this._size = applicationCaches.size;
+this._resources = applicationCaches.resources;
+var lastPathComponent = applicationCaches.lastPathComponent;
+
+if (!this._manifest) {
+this._emptyMsgElement.removeStyleClass("hidden");
+this.deleteButton.visible = false;
+if (this._dataGrid)
+this._dataGrid.element.addStyleClass("hidden");
+return;
+}
+
+if (!this._dataGrid)
+this._createDataGrid();
+
+this._populateDataGrid();
+this._dataGrid.autoSizeColumns(20, 80);
+this._dataGrid.element.removeStyleClass("hidden");
+this._emptyMsgElement.addStyleClass("hidden");
+this.deleteButton.visible = true;
+
+var totalSizeString = Number.bytesToString(this._size, WebInspector.UIString);
+this._treeElement.subtitle = WebInspector.UIString("%s (%s)", lastPathComponent, totalSizeString);
+
+
+
+
+},
+
+_createDataGrid: function()
+{
+var columns = { 0: {}, 1: {}, 2: {} };
+columns[0].title = WebInspector.UIString("Resource");
+columns[0].sort = "ascending";
+columns[0].sortable = true;
+columns[1].title = WebInspector.UIString("Type");
+columns[1].sortable = true;
+columns[2].title = WebInspector.UIString("Size");
+columns[2].aligned = "right";
+columns[2].sortable = true;
+this._dataGrid = new WebInspector.DataGrid(columns);
+this.element.appendChild(this._dataGrid.element);
+this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);
+this._dataGrid.updateWidths();
+},
+
+_populateDataGrid: function()
+{
+var selectedResource = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.resource : null;
+var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;
+
+function numberCompare(field, resource1, resource2)
+{
+return sortDirection * (resource1[field] - resource2[field]);
+}
+function localeCompare(field, resource1, resource2)
+{
+return sortDirection * (resource1[field] + "").localeCompare(resource2[field] + "")
+}
+
+var comparator;
+switch (parseInt(this._dataGrid.sortColumnIdentifier)) {
+case 0: comparator = localeCompare.bind(this, "name"); break;
+case 1: comparator = localeCompare.bind(this, "type"); break;
+case 2: comparator = numberCompare.bind(this, "size"); break;
+default: localeCompare.bind(this, "resource"); 
+}
+
+this._resources.sort(comparator);
+this._dataGrid.removeChildren();
+
+var nodeToSelect;
+for (var i = 0; i < this._resources.length; ++i) {
+var data = {};
+var resource = this._resources[i];
+data[0] = resource.name;
+data[1] = resource.type;
+data[2] = Number.bytesToString(resource.size, WebInspector.UIString);
+var node = new WebInspector.DataGridNode(data);
+node.resource = resource;
+node.selectable = true;
+this._dataGrid.appendChild(node);
+if (resource === selectedResource) {
+nodeToSelect = node;
+nodeToSelect.selected = true;
+}
+}
+
+if (!nodeToSelect)
+this._dataGrid.children[0].selected = true;
+},
+
+resize: function()
+{
+if (this._dataGrid)
+this._dataGrid.updateWidths();
+},
+
+_deleteButtonClicked: function(event)
+{
+if (!this._dataGrid || !this._dataGrid.selectedNode)
+return;
+
+
+this._deleteCallback(this._dataGrid.selectedNode);
+},
+
+_deleteCallback: function(node)
+{
+
+
+
+},
+
+_refreshButtonClicked: function(event)
+{
+
+
+}
+}
+
+WebInspector.ApplicationCacheItemsView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
+
+WebInspector.FileSystem = {}
+
+
+WebInspector.FileSystem.TEMPORARY = 0;
+WebInspector.FileSystem.PERSISTENT = 1;
+
+WebInspector.FileSystem.getFileSystemPathsAsync = function(origin)
+{
+InspectorBackend.getFileSystemPathAsync(WebInspector.FileSystem.PERSISTENT, origin);
+InspectorBackend.getFileSystemPathAsync(WebInspector.FileSystem.TEMPORARY, origin);
+}
+
+WebInspector.FileSystemView = function(treeElement, fileSystemOrigin)
+{
+WebInspector.View.call(this);
+
+this.element.addStyleClass("resource-view");
+this._treeElement = treeElement;
+this._origin = fileSystemOrigin;
+this._tabbedPane = new WebInspector.TabbedPane(this.element);
+
+this._persistentFileSystemElement = document.createElement("div");
+this._persistentFileSystemElement.className = "resource-view-headers";
+this._tabbedPane.appendTab("persistent", WebInspector.UIString("Persistent File System"), this._persistentFileSystemElement, this._selectFileSystemTab.bind(this, true));
+
+this._tempFileSystemElement = document.createElement("div");
+this._tempFileSystemElement.className = "resource-view-headers";
+this._tabbedPane.appendTab("temp", WebInspector.UIString("Temporary File System"), this._tempFileSystemElement, this.selectTemporaryFileSystemTab.bind(this, true));
+
+this._temporaryRoot = "";
+this._persistentRoot = "";
+this._isFileSystemDisabled = false;
+this._persistentRootError = false;
+this._temporaryRootError = false;
+this.fileSystemVisible = true;
+this._selectFileSystemTab();
+this.refreshFileSystem();
+}
+
+WebInspector.FileSystemView.prototype = {
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this._update();
+},
+
+set fileSystemVisible(x)
+{
+if (x === this._fileSystemVisible)
+return;
+this._fileSystemVisible = x;
+if (x)
+this.element.addStyleClass("headers-visible");
+else
+this.element.removeStyleClass("headers-visible"); 
+this._selectFileSystemTab();
+},
+
+_update: function()
+{
+this._selectFileSystemTab();
+WebInspector.FileSystem.getFileSystemPathsAsync(this._origin);
+},
+
+updateFileSystemPath: function(root, type, origin)
+{
+if (origin == this._origin && type == WebInspector.FileSystem.PERSISTENT) {
+this._persistentRoot = root;
+this._persistentRootError = false;
+}
+
+if (origin == this._origin && type == WebInspector.FileSystem.TEMPORARY) {
+this._temporaryRoot = root;
+this._temporaryRootErrorError = false;
+}
+
+this.refreshFileSystem();
+},
+
+updateFileSystemError: function(type, origin)
+{
+if (type == WebInspector.FileSystem.PERSISTENT)
+this._persistentRootError = true;
+
+if (type == WebInspector.FileSystem.TEMPORARY)
+this._temporaryRootError = true;
+
+this.refreshFileSystem();
+},
+
+setFileSystemDisabled: function()
+{
+this._isFileSystemDisabled = true;
+this.refreshFileSystem();
+},
+_selectFileSystemTab: function()
+{
+this._tabbedPane.selectTab("persistent");
+},
+
+selectTemporaryFileSystemTab: function()
+{
+this._tabbedPane.selectTab("temp");
+},
+
+_revealPersistentFolderInOS: function()
+{
+InspectorBackend.revealFolderInOS(this._persistentRoot);
+},
+
+_revealTemporaryFolderInOS: function()
+{
+InspectorBackend.revealFolderInOS(this._temporaryRoot);
+},
+
+_createTextAndButton: function(fileSystemElement, rootPathText, type, isError)
+{
+fileSystemElement.removeChildren();
+var rootPath = WebInspector.UIString("File System root path not available.");
+if (this._isFileSystemDisabled)
+rootPath = WebInspector.UIString("File System is disabled.");
+else if (isError)
+rootPath = WebInspector.UIString("Error in fetching root path for file system.");
+else if (rootPathText)
+rootPath = rootPathText;
+
+var rootTextNode = document.createTextNode("Root: " + rootPath.escapeHTML());
+var rootSystemElement = document.createElement("div");
+rootSystemElement.className = "header-value source-code";
+rootSystemElement.appendChild(rootTextNode);
+fileSystemElement.appendChild(rootSystemElement);
+
+if (!isError && rootPathText) {
+
+var contentElement = document.createElement("div");
+contentElement.className = "panel-enabler-view-content";
+fileSystemElement.appendChild(contentElement);
+var choicesForm = document.createElement("form");
+contentElement.appendChild(choicesForm);
+var enableButton = document.createElement("button");
+enableButton.setAttribute("type", "button");
+enableButton.textContent = WebInspector.UIString("Reveal folder in OS");
+
+if (type == WebInspector.FileSystem.PERSISTENT)
+enableButton.addEventListener("click", this._revealPersistentFolderInOS.bind(this), false);
+if (type == WebInspector.FileSystem.TEMPORARY)
+enableButton.addEventListener("click", this._revealTemporaryFolderInOS.bind(this), false);
+choicesForm.appendChild(enableButton);
+fileSystemElement.appendChild(contentElement);
+}
+},
+
+refreshFileSystem: function()
+{
+this._createTextAndButton(this._persistentFileSystemElement, this._persistentRoot, WebInspector.FileSystem.PERSISTENT, this._persistentRootError);
+this._createTextAndButton(this._tempFileSystemElement, this._temporaryRoot, WebInspector.FileSystem.TEMPORARY, this._temporaryRootError);
+}, 
+}
+
+WebInspector.FileSystemView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
+
+WebInspector.Script = function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, worldType)
+{
+this.sourceID = sourceID;
+this.sourceURL = sourceURL;
+this._source = source;
+this.startingLine = startingLine;
+this.errorLine = errorLine;
+this.errorMessage = errorMessage;
+this.worldType = worldType;
+
+
+
+
+
+if (!sourceURL) {
+
+var pattern = /^\s*\/\/[ \t]*@[ \t]*sourceURL[ \t]*=[ \t]*(\S+).*$/m;
+var match = pattern.exec(source);
+
+if (match)
+this.sourceURL = match[1];
+}
+}
+
+WebInspector.Script.WorldType = {
+MAIN_WORLD: 0,
+EXTENSIONS_WORLD: 1
+}
+
+WebInspector.Script.WorldType = {
+MAIN_WORLD: 0,
+EXTENSIONS_WORLD: 1
+}
+
+WebInspector.Script.Events = {
+SourceChanged: "source-changed"
 }
 
 WebInspector.Script.prototype = {
-    get linesCount()
-    {
-        if (!this.source)
-            return 0;
-        this._linesCount = 0;
-        var lastIndex = this.source.indexOf("\n");
-        while (lastIndex !== -1) {
-            lastIndex = this.source.indexOf("\n", lastIndex + 1)
-            this._linesCount++;
-        }
-    }
+get linesCount()
+{
+if (!this.source)
+return 0;
+if (this._linesCount)
+return this._linesCount;
+this._linesCount = 0;
+var lastIndex = this.source.indexOf("\n");
+while (lastIndex !== -1) {
+lastIndex = this.source.indexOf("\n", lastIndex + 1)
+this._linesCount++;
+}
+return this._linesCount;
+},
+
+get source()
+{
+return this._source;
+},
+
+set source(source)
+{
+this._source = source;
+this.dispatchEventToListeners(WebInspector.Script.Events.SourceChanged);
+}
 }
 
-/* Breakpoint.js */
+WebInspector.Script.prototype.__proto__ = WebInspector.Object.prototype;
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.Breakpoint = function(url, line, sourceID, condition)
+
+
+
+
+WebInspector.Breakpoint = function(debuggerModel, sourceID, url, line, enabled, condition)
 {
-    this.url = url;
-    this.line = line;
-    this.sourceID = sourceID;
-    this._enabled = true;
-    this._sourceText = "";
-    this._condition = condition || "";
+this.url = url;
+this.line = line;
+this.sourceID = sourceID;
+this._enabled = enabled;
+this._condition = condition || "";
+this._sourceText = "";
+this._hit = false;
+this._debuggerModel = debuggerModel;
+}
+
+WebInspector.Breakpoint.jsBreakpointId = function(sourceID, line)
+{
+return sourceID + ":" + line;
 }
 
 WebInspector.Breakpoint.prototype = {
-    get enabled()
-    {
-        return this._enabled;
-    },
+get enabled()
+{
+return this._enabled;
+},
 
-    set enabled(x)
-    {
-        if (this._enabled === x)
-            return;
+set enabled(x)
+{
+if (this._enabled === x)
+return;
 
-        this._enabled = x;
+this._enabled = x;
+this._debuggerModel._setBreakpointOnBackend(this);
+this.dispatchEventToListeners("enable-changed");
+},
 
-        if (this._enabled)
-            this.dispatchEventToListeners("enabled");
-        else
-            this.dispatchEventToListeners("disabled");
-    },
+get sourceText()
+{
+return this._sourceText;
+},
 
-    get sourceText()
-    {
-        return this._sourceText;
-    },
+set sourceText(text)
+{
+this._sourceText = text;
+this.dispatchEventToListeners("label-changed");
+},
 
-    set sourceText(text)
-    {
-        this._sourceText = text;
-        this.dispatchEventToListeners("text-changed");
-    },
+get id()
+{
+return WebInspector.Breakpoint.jsBreakpointId(this.sourceID, this.line);
+},
 
-    get label()
-    {
-        var displayName = (this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"));
-        return displayName + ":" + this.line;
-    },
+get condition()
+{
+return this._condition;
+},
 
-    get id()
-    {
-        return this.sourceID + ":" + this.line;
-    },
+set condition(c)
+{
+c = c || "";
+if (this._condition === c)
+return;
 
-    get condition()
-    {
-        return this._condition;
-    },
+this._condition = c;
+if (this.enabled)
+this._debuggerModel._setBreakpointOnBackend(this);
+this.dispatchEventToListeners("condition-changed");
+},
 
-    set condition(c)
-    {
-        c = c || "";
-        if (this._condition === c)
-            return;
+get hit()
+{
+return this._hit;
+},
 
-        this._condition = c;
-        this.dispatchEventToListeners("condition-changed");
+set hit(hit)
+{
+this._hit = hit;
+this.dispatchEventToListeners("hit-state-changed");
+},
 
-        if (this.enabled)
-            InspectorBackend.setBreakpoint(this.sourceID, this.line, this.enabled, this.condition);
-    }
+click: function(event)
+{
+WebInspector.panels.scripts.showSourceLine(this.url, this.line);
+},
+
+compareTo: function(other)
+{
+if (this.url != other.url)
+return this.url < other.url ? -1 : 1;
+if (this.line != other.line)
+return this.line < other.line ? -1 : 1;
+return 0;
+},
+
+populateLabelElement: function(element)
+{
+var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)");
+var labelElement = document.createTextNode(displayName + ":" + this.line);
+element.appendChild(labelElement);
+
+var sourceTextElement = document.createElement("div");
+sourceTextElement.textContent = this.sourceText;
+sourceTextElement.className = "source-text monospace";
+element.appendChild(sourceTextElement);
+},
+
+remove: function()
+{
+InspectorBackend.removeBreakpoint(this.sourceID, this.line);
+this.dispatchEventToListeners("removed");
+this.removeAllListeners();
+delete this._debuggerModel;
+}
 }
 
 WebInspector.Breakpoint.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* SidebarPane.js */
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+WebInspector.BreakpointManager = function()
+{
+this._nativeBreakpoints = {};
+this._backendIdToBreakpoint = {};
+
+WebInspector.debuggerModel.addEventListener("native-breakpoint-hit", this._nativeBreakpointHit, this);
+WebInspector.debuggerModel.addEventListener("debugger-resumed", this._debuggerResumed, this);
+}
+
+WebInspector.BreakpointManager.prototype = {
+createDOMBreakpoint: function(nodeId, domEventType, disabled)
+{
+var frontendId = "dom:" + nodeId + ":" + domEventType;
+if (frontendId in this._nativeBreakpoints)
+return;
+
+var breakpoint = new WebInspector.DOMBreakpoint(this, frontendId, nodeId, domEventType);
+this._nativeBreakpoints[frontendId] = breakpoint;
+this.dispatchEventToListeners("dom-breakpoint-added", breakpoint);
+breakpoint.enabled = !disabled;
+return breakpoint;
+},
+
+createEventListenerBreakpoint: function(eventName)
+{
+var frontendId = eventName;
+if (frontendId in this._nativeBreakpoints)
+return;
+
+var breakpoint = new WebInspector.EventListenerBreakpoint(this, frontendId, eventName);
+this._nativeBreakpoints[frontendId] = breakpoint;
+this.dispatchEventToListeners("event-listener-breakpoint-added", { breakpoint: breakpoint, eventName: eventName });
+breakpoint.enabled = true;
+return breakpoint;
+},
+
+createXHRBreakpoint: function(url, disabled)
+{
+var frontendId = url;
+if (frontendId in this._nativeBreakpoints)
+return;
+
+var breakpoint = new WebInspector.XHRBreakpoint(this, frontendId, url);
+this._nativeBreakpoints[frontendId] = breakpoint;
+this.dispatchEventToListeners("xhr-breakpoint-added", breakpoint);
+breakpoint.enabled = !disabled
+return breakpoint;
+},
+
+findBreakpoint: function(backendBreakpointId)
+{
+return this._backendIdToBreakpoint[backendBreakpointId];
+},
+
+_removeNativeBreakpoint: function(breakpoint)
+{
+if (breakpoint._beingSetOnBackend)
+return;
+if (breakpoint.enabled)
+this._removeNativeBreakpointFromBackend(breakpoint);
+delete this._nativeBreakpoints[breakpoint._frontendId];
+this._updateNativeBreakpointsInSettings();
+breakpoint.dispatchEventToListeners("removed");
+},
+
+_setNativeBreakpointEnabled: function(breakpoint, enabled)
+{
+if (breakpoint._beingSetOnBackend)
+return;
+if (breakpoint.enabled === enabled)
+return;
+if (enabled)
+this._setNativeBreakpointOnBackend(breakpoint);
+else
+this._removeNativeBreakpointFromBackend(breakpoint);
+},
+
+_setNativeBreakpointOnBackend: function(breakpoint)
+{
+breakpoint._beingSetOnBackend = true;
+var data = { type: breakpoint._type, condition: breakpoint._condition };
+InspectorBackend.setNativeBreakpoint(data, didSetNativeBreakpoint.bind(this));
+
+function didSetNativeBreakpoint(backendBreakpointId)
+{
+breakpoint._beingSetOnBackend = false;
+if (backendBreakpointId !== "") {
+breakpoint._backendId = backendBreakpointId;
+this._backendIdToBreakpoint[backendBreakpointId] = breakpoint;
+}
+breakpoint.dispatchEventToListeners("enable-changed");
+this._updateNativeBreakpointsInSettings();
+}
+},
+
+_removeNativeBreakpointFromBackend: function(breakpoint)
+{
+InspectorBackend.removeNativeBreakpoint(breakpoint._backendId);
+delete this._backendIdToBreakpoint[breakpoint._backendId]
+delete breakpoint._backendId;
+breakpoint.dispatchEventToListeners("enable-changed");
+this._updateNativeBreakpointsInSettings();
+},
+
+_updateNativeBreakpointsInSettings: function()
+{
+var persistentBreakpoints = [];
+for (var id in this._nativeBreakpoints) {
+var breakpoint = this._nativeBreakpoints[id];
+if (breakpoint._persistentCondition)
+persistentBreakpoints.push({ type: breakpoint._type, enabled: breakpoint.enabled, condition: breakpoint._persistentCondition });
+}
+WebInspector.settings.nativeBreakpoints = persistentBreakpoints;
+},
+
+_nativeBreakpointHit: function(event)
+{
+var breakpointId = event.data.breakpointId;
+
+var breakpoint = this._backendIdToBreakpoint[breakpointId];
+if (!breakpoint)
+return;
+
+breakpoint.hit = true;
+breakpoint.dispatchEventToListeners("hit-state-changed");
+this._lastHitBreakpoint = breakpoint;
+},
+
+_debuggerResumed: function(event)
+{
+if (!this._lastHitBreakpoint)
+return;
+this._lastHitBreakpoint.hit = false;
+this._lastHitBreakpoint.dispatchEventToListeners("hit-state-changed");
+delete this._lastHitBreakpoint;
+},
+
+restoreBreakpoints: function()
+{
+var breakpoints = this._persistentBreakpoints();
+for (var i = 0; i < breakpoints.length; ++i) {
+if (breakpoints[i].type === "EventListener")
+this.createEventListenerBreakpoint(breakpoints[i].condition.eventName);
+else if (breakpoints[i].type === "XHR")
+this.createXHRBreakpoint(breakpoints[i].condition.url, !breakpoints[i].enabled);
+}
+},
+
+restoreDOMBreakpoints: function()
+{
+function didPushNodeByPathToFrontend(path, nodeId)
+{
+pathToNodeId[path] = nodeId;
+pendingCalls -= 1;
+if (pendingCalls)
+return;
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+var nodeId = pathToNodeId[breakpoint.condition.path];
+if (nodeId)
+this.createDOMBreakpoint(nodeId, breakpoint.condition.type, !breakpoint.enabled);
+}
+}
+
+var breakpoints = this._persistentBreakpoints();
+var pathToNodeId = {};
+var pendingCalls = 0;
+for (var i = 0; i < breakpoints.length; ++i) {
+if (breakpoints[i].type !== "DOM")
+continue;
+var path = breakpoints[i].condition.path;
+if (path in pathToNodeId)
+continue;
+pathToNodeId[path] = 0;
+pendingCalls += 1;
+InspectorBackend.pushNodeByPathToFrontend(path, didPushNodeByPathToFrontend.bind(this, path));
+}
+},
+
+_persistentBreakpoints: function()
+{
+var result = [];
+var breakpoints = WebInspector.settings.nativeBreakpoints;
+if (breakpoints instanceof Array) {
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+if ("type" in breakpoint && "condition" in breakpoint)
+result.push(breakpoint)
+}
+}
+return result;
+},
+
+reset: function()
+{
+this._nativeBreakpoints = {};
+this._backendIdToBreakpoint = {};
+}
+}
+
+WebInspector.BreakpointManager.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.NativeBreakpoint = function(manager, frontendId, type)
+{
+this._manager = manager;
+this.__frontendId = frontendId;
+this.__type = type;
+}
+
+WebInspector.NativeBreakpoint.prototype = {
+get enabled()
+{
+return "_backendId" in this;
+},
+
+set enabled(enabled)
+{
+this._manager._setNativeBreakpointEnabled(this, enabled);
+},
+
+remove: function()
+{
+this._manager._removeNativeBreakpoint(this);
+this._onRemove();
+},
+
+get _frontendId()
+{
+return this.__frontendId;
+},
+
+get _type()
+{
+return this.__type;
+},
+
+_compare: function(x, y)
+{
+if (x !== y)
+return x < y ? -1 : 1;
+return 0;
+},
+
+_onRemove: function()
+{
+}
+}
+
+WebInspector.NativeBreakpoint.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.DOMBreakpoint = function(manager, frontendId, nodeId, domEventType)
+{
+WebInspector.NativeBreakpoint.call(this, manager, frontendId, "DOM");
+this._nodeId = nodeId;
+this._domEventType = domEventType;
+this._condition = { nodeId: this._nodeId, type: this._domEventType };
+
+var node = WebInspector.domAgent.nodeForId(this._nodeId);
+if (node) {
+node.breakpoints[this._domEventType] = this;
+this._persistentCondition = { path: node.path(), type: this._domEventType };
+}
+}
+
+WebInspector.DOMBreakpoint.prototype = {
+compareTo: function(other)
+{
+return this._compare(this._domEventType, other._domEventType);
+},
+
+populateLabelElement: function(element)
+{
+
+var linkifiedNode = WebInspector.panels.elements.linkifyNodeById(this._nodeId);
+linkifiedNode.addStyleClass("monospace");
+element.appendChild(linkifiedNode);
+var description = document.createElement("div");
+description.className = "source-text";
+description.textContent = WebInspector.domBreakpointTypeLabel(this._domEventType);
+element.appendChild(description);
+},
+
+populateStatusMessageElement: function(element, eventData)
+{
+var substitutions = [WebInspector.domBreakpointTypeLabel(this._domEventType), WebInspector.panels.elements.linkifyNodeById(this._nodeId)];
+var formatters = {
+s: function(substitution)
+{
+return substitution;
+}
+};
+function append(a, b)
+{
+if (typeof b === "string")
+b = document.createTextNode(b);
+element.appendChild(b);
+}
+if (this._domEventType === WebInspector.DOMBreakpointTypes.SubtreeModified) {
+var targetNode = WebInspector.panels.elements.linkifyNodeById(eventData.targetNodeId);
+if (eventData.insertion) {
+if (eventData.targetNodeId !== this._nodeId)
+WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to its descendant %s.", substitutions.concat(targetNode), formatters, "", append);
+else
+WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because a new child was added to that node.", substitutions, formatters, "", append);
+} else
+WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s, because its descendant %s was removed.", substitutions.concat(targetNode), formatters, "", append);
+} else
+WebInspector.formatLocalized("Paused on a \"%s\" breakpoint set on %s.", substitutions, formatters, "", append);
+},
+
+_onRemove: function()
+{
+var node = WebInspector.domAgent.nodeForId(this._nodeId);
+if (node)
+delete node.breakpoints[this._domEventType];
+}
+}
+
+WebInspector.DOMBreakpoint.prototype.__proto__ = WebInspector.NativeBreakpoint.prototype;
+
+WebInspector.EventListenerBreakpoint = function(manager, frontendId, eventName)
+{
+WebInspector.NativeBreakpoint.call(this, manager, frontendId, "EventListener");
+this._eventName = eventName;
+this._condition = { eventName: this._eventName };
+this._persistentCondition = this._condition;
+}
+
+WebInspector.EventListenerBreakpoint.eventNameForUI = function(eventName)
+{
+if (!WebInspector.EventListenerBreakpoint._eventNamesForUI) {
+WebInspector.EventListenerBreakpoint._eventNamesForUI = {
+"instrumentation:setTimer": WebInspector.UIString("Set Timer"),
+"instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
+"instrumentation:timerFired": WebInspector.UIString("Timer Fired")
+};
+}
+return WebInspector.EventListenerBreakpoint._eventNamesForUI[eventName] || eventName.substring(eventName.indexOf(":") + 1);
+}
+
+WebInspector.EventListenerBreakpoint.prototype = {
+compareTo: function(other)
+{
+return this._compare(this._eventName, other._eventName);
+},
+
+populateLabelElement: function(element)
+{
+element.appendChild(document.createTextNode(this._uiEventName()));
+},
+
+populateStatusMessageElement: function(element, eventData)
+{
+var status = WebInspector.UIString("Paused on a \"%s\" Event Listener.", this._uiEventName());
+element.appendChild(document.createTextNode(status));
+},
+
+_uiEventName: function()
+{
+return WebInspector.EventListenerBreakpoint.eventNameForUI(this._eventName);
+}
+}
+
+WebInspector.EventListenerBreakpoint.prototype.__proto__ = WebInspector.NativeBreakpoint.prototype;
+
+WebInspector.XHRBreakpoint = function(manager, frontendId, url)
+{
+WebInspector.NativeBreakpoint.call(this, manager, frontendId, "XHR");
+this._url = url;
+this._condition = { url: this._url };
+this._persistentCondition = this._condition;
+}
+
+WebInspector.XHRBreakpoint.prototype = {
+compareTo: function(other)
+{
+return this._compare(this._url, other._url);
+},
+
+populateEditElement: function(element)
+{
+element.textContent = this._url;
+},
+
+populateLabelElement: function(element)
+{
+var label;
+if (!this._url.length)
+label = WebInspector.UIString("Any XHR");
+else
+label = WebInspector.UIString("URL contains \"%s\"", this._url);
+element.appendChild(document.createTextNode(label));
+element.addStyleClass("cursor-auto");
+},
+
+populateStatusMessageElement: function(element)
+{
+var status = WebInspector.UIString("Paused on a XMLHttpRequest.");
+element.appendChild(document.createTextNode(status));
+}
+}
+
+WebInspector.XHRBreakpoint.prototype.__proto__ = WebInspector.NativeBreakpoint.prototype;
+
+WebInspector.DOMBreakpointTypes = {
+SubtreeModified: 0,
+AttributeModified: 1,
+NodeRemoved: 2
+};
+
+WebInspector.domBreakpointTypeLabel = function(type)
+{
+if (!WebInspector._DOMBreakpointTypeLabels) {
+WebInspector._DOMBreakpointTypeLabels = {};
+WebInspector._DOMBreakpointTypeLabels[WebInspector.DOMBreakpointTypes.SubtreeModified] = WebInspector.UIString("Subtree Modified");
+WebInspector._DOMBreakpointTypeLabels[WebInspector.DOMBreakpointTypes.AttributeModified] = WebInspector.UIString("Attribute Modified");
+WebInspector._DOMBreakpointTypeLabels[WebInspector.DOMBreakpointTypes.NodeRemoved] = WebInspector.UIString("Node Removed");
+}
+return WebInspector._DOMBreakpointTypeLabels[type];
+}
+
+WebInspector.domBreakpointTypeContextMenuLabel = function(type)
+{
+if (!WebInspector._DOMBreakpointTypeContextMenuLabels) {
+WebInspector._DOMBreakpointTypeContextMenuLabels = {};
+WebInspector._DOMBreakpointTypeContextMenuLabels[WebInspector.DOMBreakpointTypes.SubtreeModified] = WebInspector.UIString("Break on Subtree Modifications");
+WebInspector._DOMBreakpointTypeContextMenuLabels[WebInspector.DOMBreakpointTypes.AttributeModified] = WebInspector.UIString("Break on Attributes Modifications");
+WebInspector._DOMBreakpointTypeContextMenuLabels[WebInspector.DOMBreakpointTypes.NodeRemoved] = WebInspector.UIString("Break on Node Removal");
+}
+return WebInspector._DOMBreakpointTypeContextMenuLabels[type];
+}
+
+
+
+
 
 WebInspector.SidebarPane = function(title)
 {
-    this.element = document.createElement("div");
-    this.element.className = "pane";
+this.element = document.createElement("div");
+this.element.className = "pane";
 
-    this.titleElement = document.createElement("div");
-    this.titleElement.className = "title";
-    this.titleElement.tabIndex = 0;
-    this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false);
-    this.titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(this), false);
+this.titleElement = document.createElement("div");
+this.titleElement.className = "title";
+this.titleElement.tabIndex = 0;
+this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false);
+this.titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(this), false);
 
-    this.bodyElement = document.createElement("div");
-    this.bodyElement.className = "body";
+this.bodyElement = document.createElement("div");
+this.bodyElement.className = "body";
 
-    this.element.appendChild(this.titleElement);
-    this.element.appendChild(this.bodyElement);
+this.element.appendChild(this.titleElement);
+this.element.appendChild(this.bodyElement);
 
-    this.title = title;
-    this.growbarVisible = false;
-    this.expanded = false;
+this.title = title;
+this.growbarVisible = false;
+this.expanded = false;
 }
 
 WebInspector.SidebarPane.prototype = {
-    get title()
-    {
-        return this._title;
-    },
+get title()
+{
+return this._title;
+},
 
-    set title(x)
-    {
-        if (this._title === x)
-            return;
-        this._title = x;
-        this.titleElement.textContent = x;
-    },
+set title(x)
+{
+if (this._title === x)
+return;
+this._title = x;
+this.titleElement.textContent = x;
+},
 
-    get growbarVisible()
-    {
-        return this._growbarVisible;
-    },
+get growbarVisible()
+{
+return this._growbarVisible;
+},
 
-    set growbarVisible(x)
-    {
-        if (this._growbarVisible === x)
-            return;
+set growbarVisible(x)
+{
+if (this._growbarVisible === x)
+return;
 
-        this._growbarVisible = x;
+this._growbarVisible = x;
 
-        if (x && !this._growbarElement) {
-            this._growbarElement = document.createElement("div");
-            this._growbarElement.className = "growbar";
-            this.element.appendChild(this._growbarElement);
-        } else if (!x && this._growbarElement) {
-            if (this._growbarElement.parentNode)
-                this._growbarElement.parentNode(this._growbarElement);
-            delete this._growbarElement;
-        }
-    },
+if (x && !this._growbarElement) {
+this._growbarElement = document.createElement("div");
+this._growbarElement.className = "growbar";
+this.element.appendChild(this._growbarElement);
+} else if (!x && this._growbarElement) {
+if (this._growbarElement.parentNode)
+this._growbarElement.parentNode(this._growbarElement);
+delete this._growbarElement;
+}
+},
 
-    get expanded()
-    {
-        return this._expanded;
-    },
+get expanded()
+{
+return this._expanded;
+},
 
-    set expanded(x)
-    {
-        if (x)
-            this.expand();
-        else
-            this.collapse();
-    },
+set expanded(x)
+{
+if (x)
+this.expand();
+else
+this.collapse();
+},
 
-    expand: function()
-    {
-        if (this._expanded)
-            return;
-        this._expanded = true;
-        this.element.addStyleClass("expanded");
-        if (this.onexpand)
-            this.onexpand(this);
-    },
+expand: function()
+{
+if (this._expanded)
+return;
+this._expanded = true;
+this.element.addStyleClass("expanded");
+if (this.onexpand)
+this.onexpand(this);
+},
 
-    collapse: function()
-    {
-        if (!this._expanded)
-            return;
-        this._expanded = false;
-        this.element.removeStyleClass("expanded");
-        if (this.oncollapse)
-            this.oncollapse(this);
-    },
+collapse: function()
+{
+if (!this._expanded)
+return;
+this._expanded = false;
+this.element.removeStyleClass("expanded");
+if (this.oncollapse)
+this.oncollapse(this);
+},
 
-    toggleExpanded: function()
-    {
-        this.expanded = !this.expanded;
-    },
+toggleExpanded: function()
+{
+this.expanded = !this.expanded;
+},
 
-    _onTitleKeyDown: function(event)
-    {
-        if (isEnterKey(event) || event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Space)
-            this.toggleExpanded();
-    }
+_onTitleKeyDown: function(event)
+{
+if (isEnterKey(event) || event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code)
+this.toggleExpanded();
+}
 }
 
 WebInspector.SidebarPane.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* ElementsTreeOutline.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ElementsTreeOutline = function() {
-    this.element = document.createElement("ol");
-    this.element.addEventListener("mousedown", this._onmousedown.bind(this), false);
-    this.element.addEventListener("mousemove", this._onmousemove.bind(this), false);
-    this.element.addEventListener("mouseout", this._onmouseout.bind(this), false);
+this.element = document.createElement("ol");
+this.element.addEventListener("mousedown", this._onmousedown.bind(this), false);
+this.element.addEventListener("mousemove", this._onmousemove.bind(this), false);
+this.element.addEventListener("mouseout", this._onmouseout.bind(this), false);
 
-    TreeOutline.call(this, this.element);
+TreeOutline.call(this, this.element);
 
-    this.includeRootDOMNode = true;
-    this.selectEnabled = false;
-    this.showInElementsPanelEnabled = false;
-    this.rootDOMNode = null;
-    this.focusedDOMNode = null;
+this.includeRootDOMNode = true;
+this.selectEnabled = false;
+this.showInElementsPanelEnabled = false;
+this.rootDOMNode = null;
+this.focusedDOMNode = null;
 
-    this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
-    this.element.addEventListener("keydown", this._keyDown.bind(this), true);
+this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
 }
 
 WebInspector.ElementsTreeOutline.prototype = {
-    get rootDOMNode()
-    {
-        return this._rootDOMNode;
-    },
+get rootDOMNode()
+{
+return this._rootDOMNode;
+},
 
-    set rootDOMNode(x)
-    {
-        if (this._rootDOMNode === x)
-            return;
+set rootDOMNode(x)
+{
+if (this._rootDOMNode === x)
+return;
 
-        this._rootDOMNode = x;
+this._rootDOMNode = x;
 
-        this._isXMLMimeType = !!(WebInspector.mainResource && WebInspector.mainResource.mimeType && WebInspector.mainResource.mimeType.match(/x(?:ht)?ml/i));
+this._isXMLMimeType = !!(WebInspector.mainResource && WebInspector.mainResource.mimeType && WebInspector.mainResource.mimeType.match(/x(?:ht)?ml/i));
 
-        this.update();
-    },
+this.update();
+},
 
-    get isXMLMimeType()
-    {
-        return this._isXMLMimeType;
-    },
+get isXMLMimeType()
+{
+return this._isXMLMimeType;
+},
 
-    get focusedDOMNode()
-    {
-        return this._focusedDOMNode;
-    },
+nodeNameToCorrectCase: function(nodeName)
+{
+return this.isXMLMimeType ? nodeName : nodeName.toLowerCase();
+},
 
-    set focusedDOMNode(x)
-    {
-        if (this._focusedDOMNode === x) {
-            this.revealAndSelectNode(x);
-            return;
-        }
+get focusedDOMNode()
+{
+return this._focusedDOMNode;
+},
 
-        this._focusedDOMNode = x;
+set focusedDOMNode(x)
+{
+if (this._focusedDOMNode === x) {
+this.revealAndSelectNode(x);
+return;
+}
 
-        this.revealAndSelectNode(x);
+this._focusedDOMNode = x;
 
-        // The revealAndSelectNode() method might find a different element if there is inlined text,
-        // and the select() call would change the focusedDOMNode and reenter this setter. So to
-        // avoid calling focusedNodeChanged() twice, first check if _focusedDOMNode is the same
-        // node as the one passed in.
-        if (this._focusedDOMNode === x) {
-            this.focusedNodeChanged();
+this.revealAndSelectNode(x);
 
-            if (x && !this.suppressSelectHighlight) {
-                InspectorBackend.highlightDOMNode(x.id);
 
-                if ("_restorePreviousHighlightNodeTimeout" in this)
-                    clearTimeout(this._restorePreviousHighlightNodeTimeout);
 
-                function restoreHighlightToHoveredNode()
-                {
-                    var hoveredNode = WebInspector.hoveredDOMNode;
-                    if (hoveredNode)
-                        InspectorBackend.highlightDOMNode(hoveredNode.id);
-                    else
-                        InspectorBackend.hideDOMNodeHighlight();
-                }
 
-                this._restorePreviousHighlightNodeTimeout = setTimeout(restoreHighlightToHoveredNode, 2000);
-            }
-        }
-    },
 
-    update: function()
-    {
-        var selectedNode = this.selectedTreeElement ? this.selectedTreeElement.representedObject : null;
+if (this._focusedDOMNode === x)
+this.focusedNodeChanged();
+},
 
-        this.removeChildren();
+get editing()
+{
+return this._editing;
+},
 
-        if (!this.rootDOMNode)
-            return;
+update: function()
+{
+var selectedNode = this.selectedTreeElement ? this.selectedTreeElement.representedObject : null;
 
-        var treeElement;
-        if (this.includeRootDOMNode) {
-            treeElement = new WebInspector.ElementsTreeElement(this.rootDOMNode);
-            treeElement.selectable = this.selectEnabled;
-            this.appendChild(treeElement);
-        } else {
-            // FIXME: this could use findTreeElement to reuse a tree element if it already exists
-            var node = this.rootDOMNode.firstChild;
-            while (node) {
-                treeElement = new WebInspector.ElementsTreeElement(node);
-                treeElement.selectable = this.selectEnabled;
-                this.appendChild(treeElement);
-                node = node.nextSibling;
-            }
-        }
+this.removeChildren();
 
-        if (selectedNode)
-            this.revealAndSelectNode(selectedNode);
-    },
+if (!this.rootDOMNode)
+return;
 
-    updateSelection: function()
-    {
-        if (!this.selectedTreeElement)
-            return;
-        var element = this.treeOutline.selectedTreeElement;
-        element.updateSelection();
-    },
+var treeElement;
+if (this.includeRootDOMNode) {
+treeElement = new WebInspector.ElementsTreeElement(this.rootDOMNode);
+treeElement.selectable = this.selectEnabled;
+this.appendChild(treeElement);
+} else {
 
-    focusedNodeChanged: function(forceUpdate) {},
+var node = this.rootDOMNode.firstChild;
+while (node) {
+treeElement = new WebInspector.ElementsTreeElement(node);
+treeElement.selectable = this.selectEnabled;
+this.appendChild(treeElement);
+node = node.nextSibling;
+}
+}
 
-    findTreeElement: function(node)
-    {
-        var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestorNode, parentNode);
-        if (!treeElement && node.nodeType === Node.TEXT_NODE) {
-            // The text node might have been inlined if it was short, so try to find the parent element.
-            treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestorNode, parentNode);
-        }
+if (selectedNode)
+this.revealAndSelectNode(selectedNode);
+},
 
-        return treeElement;
-    },
+updateSelection: function()
+{
+if (!this.selectedTreeElement)
+return;
+var element = this.treeOutline.selectedTreeElement;
+element.updateSelection();
+},
 
-    createTreeElementFor: function(node)
-    {
-        var treeElement = this.findTreeElement(node);
-        if (treeElement)
-            return treeElement;
-        if (!node.parentNode)
-            return null;
+focusedNodeChanged: function(forceUpdate) {},
 
-        var treeElement = this.createTreeElementFor(node.parentNode);
-        if (treeElement && treeElement.showChild(node.index))
-            return treeElement.children[node.index];
+findTreeElement: function(node)
+{
+var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestorNode, parentNode);
+if (!treeElement && node.nodeType === Node.TEXT_NODE) {
 
-        return null;
-    },
+treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestorNode, parentNode);
+}
 
-    revealAndSelectNode: function(node)
-    {
-        if (!node)
-            return;
+return treeElement;
+},
 
-        var treeElement = this.createTreeElementFor(node);
-        if (!treeElement)
-            return;
+createTreeElementFor: function(node)
+{
+var treeElement = this.findTreeElement(node);
+if (treeElement)
+return treeElement;
+if (!node.parentNode)
+return null;
 
-        treeElement.reveal();
-        treeElement.select();
-    },
+var treeElement = this.createTreeElementFor(node.parentNode);
+if (treeElement && treeElement.showChild(node.index))
+return treeElement.children[node.index];
 
-    _treeElementFromEvent: function(event)
-    {
-        var root = this.element;
+return null;
+},
 
-        // We choose this X coordinate based on the knowledge that our list
-        // items extend nearly to the right edge of the outer <ol>.
-        var x = root.totalOffsetLeft + root.offsetWidth - 20;
+set suppressRevealAndSelect(x)
+{
+if (this._suppressRevealAndSelect === x)
+return;
+this._suppressRevealAndSelect = x;
+},
 
-        var y = event.pageY;
+revealAndSelectNode: function(node)
+{
+if (!node || this._suppressRevealAndSelect)
+return;
 
-        // Our list items have 1-pixel cracks between them vertically. We avoid
-        // the cracks by checking slightly above and slightly below the mouse
-        // and seeing if we hit the same element each time.
-        var elementUnderMouse = this.treeElementFromPoint(x, y);
-        var elementAboveMouse = this.treeElementFromPoint(x, y - 2);
-        var element;
-        if (elementUnderMouse === elementAboveMouse)
-            element = elementUnderMouse;
-        else
-            element = this.treeElementFromPoint(x, y + 2);
+var treeElement = this.createTreeElementFor(node);
+if (!treeElement)
+return;
 
-        return element;
-    },
-    
-    _keyDown: function(event)
-    {
-        if (event.target !== this.treeOutline.element)
-            return;
+treeElement.reveal();
+treeElement.select();
+},
 
-        var selectedElement = this.selectedTreeElement;
-        if (!selectedElement)
-            return;
+_treeElementFromEvent: function(event)
+{
+var root = this.element;
 
-        if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Backspace ||
-                event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Delete) {
-            selectedElement.remove();
-            event.preventDefault();
-            event.stopPropagation();
-            return;
-        }
 
-        // On Enter or Return start editing the first attribute
-        // or create a new attribute on the selected element.
-        if (isEnterKey(event)) {
-            if (this._editing)
-                return;
 
-            selectedElement._startEditing();
+var x = root.totalOffsetLeft + root.offsetWidth - 20;
 
-            // prevent a newline from being immediately inserted
-            event.preventDefault();
-            event.stopPropagation();
-            return;
-        }
-    },
+var y = event.pageY;
 
-    _onmousedown: function(event)
-    {
-        var element = this._treeElementFromEvent(event);
 
-        if (!element || element.isEventWithinDisclosureTriangle(event))
-            return;
 
-        element.select();
-    },
 
-    _onmousemove: function(event)
-    {
-        var element = this._treeElementFromEvent(event);
-        if (element && this._previousHoveredElement === element)
-            return;
+var elementUnderMouse = this.treeElementFromPoint(x, y);
+var elementAboveMouse = this.treeElementFromPoint(x, y - 2);
+var element;
+if (elementUnderMouse === elementAboveMouse)
+element = elementUnderMouse;
+else
+element = this.treeElementFromPoint(x, y + 2);
 
-        if (this._previousHoveredElement) {
-            this._previousHoveredElement.hovered = false;
-            delete this._previousHoveredElement;
-        }
+return element;
+},
 
-        if (element && !element.elementCloseTag) {
-            element.hovered = true;
-            this._previousHoveredElement = element;
-        }
+_onmousedown: function(event)
+{
+var element = this._treeElementFromEvent(event);
 
-        WebInspector.hoveredDOMNode = (element && !element.elementCloseTag ? element.representedObject : null);
-    },
+if (!element || element.isEventWithinDisclosureTriangle(event))
+return;
 
-    _onmouseout: function(event)
-    {
-        var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
-        if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.element))
-            return;
+element.select();
+},
 
-        if (this._previousHoveredElement) {
-            this._previousHoveredElement.hovered = false;
-            delete this._previousHoveredElement;
-        }
+_onmousemove: function(event)
+{
+var element = this._treeElementFromEvent(event);
+if (element && this._previousHoveredElement === element)
+return;
 
-        WebInspector.hoveredDOMNode = null;
-    },
+if (this._previousHoveredElement) {
+this._previousHoveredElement.hovered = false;
+delete this._previousHoveredElement;
+}
 
-    _contextMenuEventFired: function(event)
-    {
-        var listItem = event.target.enclosingNodeOrSelfWithNodeName("LI");
-        if (!listItem || !listItem.treeElement)
-            return;
+if (element) {
+element.hovered = true;
+this._previousHoveredElement = element;
 
-        var contextMenu = new WebInspector.ContextMenu();
 
-        var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
-        var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
-        if (tag && listItem.treeElement._populateTagContextMenu)
-            listItem.treeElement._populateTagContextMenu(contextMenu, event);
-        else if (textNode && listItem.treeElement._populateTextContextMenu)
-            listItem.treeElement._populateTextContextMenu(contextMenu, textNode);
-        contextMenu.show(event);
-    }
+if (element.representedObject && !element.tooltip)
+element._createTooltipForNode();
+}
+
+WebInspector.highlightDOMNode(element ? element.representedObject.id : 0);
+},
+
+_onmouseout: function(event)
+{
+var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
+if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.element))
+return;
+
+if (this._previousHoveredElement) {
+this._previousHoveredElement.hovered = false;
+delete this._previousHoveredElement;
+}
+
+WebInspector.highlightDOMNode(0);
+},
+
+_contextMenuEventFired: function(event)
+{
+var listItem = event.target.enclosingNodeOrSelfWithNodeName("LI");
+if (!listItem || !listItem.treeElement)
+return;
+
+var contextMenu = new WebInspector.ContextMenu();
+if (this.showInElementsPanelEnabled) {
+function focusElement()
+{
+WebInspector.currentPanel = WebInspector.panels.elements;
+WebInspector.panels.elements.focusedDOMNode = listItem.treeElement.representedObject;
+}
+contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), focusElement.bind(this));
+} else {
+var href = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
+var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
+var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
+var needSeparator;
+if (href)
+needSeparator = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
+if (tag && listItem.treeElement._populateTagContextMenu) {
+if (needSeparator)
+contextMenu.appendSeparator();
+listItem.treeElement._populateTagContextMenu(contextMenu, event);
+} else if (textNode && listItem.treeElement._populateTextContextMenu) {
+if (needSeparator)
+contextMenu.appendSeparator();
+listItem.treeElement._populateTextContextMenu(contextMenu, textNode);
+}
+}
+contextMenu.show(event);
+}
 }
 
 WebInspector.ElementsTreeOutline.prototype.__proto__ = TreeOutline.prototype;
 
-WebInspector.ElementsTreeElement = function(node)
+WebInspector.ElementsTreeElement = function(node, elementCloseTag)
 {
-    var hasChildrenOverride = node.hasChildNodes() && !this._showInlineText(node);
+this._elementCloseTag = elementCloseTag;
+var hasChildrenOverride = !elementCloseTag && node.hasChildNodes() && !this._showInlineText(node);
 
-    // The title will be updated in onattach.
-    TreeElement.call(this, "", node, hasChildrenOverride);
 
-    if (this.representedObject.nodeType == Node.ELEMENT_NODE)
-        this._canAddAttributes = true;
-    this._searchQuery = null;
-    this._expandedChildrenLimit = WebInspector.ElementsTreeElement.InitialChildrenLimit;
+TreeElement.call(this, "", node, hasChildrenOverride);
+
+if (this.representedObject.nodeType == Node.ELEMENT_NODE && !elementCloseTag)
+this._canAddAttributes = true;
+this._searchQuery = null;
+this._expandedChildrenLimit = WebInspector.ElementsTreeElement.InitialChildrenLimit;
 }
 
 WebInspector.ElementsTreeElement.InitialChildrenLimit = 500;
 
-// A union of HTML4 and HTML5-Draft elements that explicitly
-// or implicitly (for HTML5) forbid the closing tag.
-// FIXME: Revise once HTML5 Final is published.
+
+
+
 WebInspector.ElementsTreeElement.ForbiddenClosingTagElements = [
-    "area", "base", "basefont", "br", "canvas", "col", "command", "embed", "frame",
-    "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source"
+"area", "base", "basefont", "br", "canvas", "col", "command", "embed", "frame",
+"hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source"
+].keySet();
+
+
+WebInspector.ElementsTreeElement.EditTagBlacklist = [
+"html", "head", "body"
 ].keySet();
 
 WebInspector.ElementsTreeElement.prototype = {
-    highlightSearchResults: function(searchQuery)
-    {
-        if (this._searchQuery === searchQuery)
-            return;
+highlightSearchResults: function(searchQuery)
+{
+if (this._searchQuery === searchQuery)
+return;
 
-        this._searchQuery = searchQuery;
-        this.updateTitle();
-    },
+this._searchQuery = searchQuery;
+this.updateTitle();
+},
 
-    get hovered()
-    {
-        return this._hovered;
-    },
+get hovered()
+{
+return this._hovered;
+},
 
-    set hovered(x)
-    {
-        if (this._hovered === x)
-            return;
+set hovered(x)
+{
+if (this._hovered === x)
+return;
 
-        this._hovered = x;
+this._hovered = x;
 
-        if (this.listItemElement) {
-            if (x) {
-                this.updateSelection();
-                this.listItemElement.addStyleClass("hovered");
-            } else {
-                this.listItemElement.removeStyleClass("hovered");
-            }
-        }
-    },
+if (this.listItemElement) {
+if (x) {
+this.updateSelection();
+this.listItemElement.addStyleClass("hovered");
+} else {
+this.listItemElement.removeStyleClass("hovered");
+}
+}
+},
 
-    get expandedChildrenLimit()
-    {
-        return this._expandedChildrenLimit;
-    },
+get expandedChildrenLimit()
+{
+return this._expandedChildrenLimit;
+},
 
-    set expandedChildrenLimit(x)
-    {
-        if (this._expandedChildrenLimit === x)
-            return;
+set expandedChildrenLimit(x)
+{
+if (this._expandedChildrenLimit === x)
+return;
 
-        this._expandedChildrenLimit = x;
-        if (this.treeOutline && !this._updateChildrenInProgress)
-            this._updateChildren(true);
-    },
+this._expandedChildrenLimit = x;
+if (this.treeOutline && !this._updateChildrenInProgress)
+this._updateChildren(true);
+},
 
-    get expandedChildCount()
-    {
-        var count = this.children.length;
-        if (count && this.children[count - 1].elementCloseTag)
-            count--;
-        if (count && this.children[count - 1].expandAllButton)
-            count--;
-        return count;
-    },
+get expandedChildCount()
+{
+var count = this.children.length;
+if (count && this.children[count - 1]._elementCloseTag)
+count--;
+if (count && this.children[count - 1].expandAllButton)
+count--;
+return count;
+},
 
-    showChild: function(index)
-    {
-        if (index >= this.expandedChildrenLimit) {
-            this._expandedChildrenLimit = index + 1;
-            this._updateChildren(true);
-        }
+showChild: function(index)
+{
+if (this._elementCloseTag)
+return;
 
-        // Whether index-th child is visible in the children tree
-        return this.expandedChildCount > index;
-    },
+if (index >= this.expandedChildrenLimit) {
+this._expandedChildrenLimit = index + 1;
+this._updateChildren(true);
+}
 
-    createTooltipForImageNode: function(node, callback)
-    {
-        function createTooltipThenCallback(properties)
-        {
-            if (!properties) {
-                callback();
-                return;
-            }
 
-            var tooltipText = null;
-            if (properties.offsetHeight === properties.naturalHeight && properties.offsetWidth === properties.naturalWidth)
-                tooltipText = WebInspector.UIString("%d × %d pixels", properties.offsetWidth, properties.offsetHeight);
-            else
-                tooltipText = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight);
-            callback(tooltipText);
-        }
-        var objectProxy = new WebInspector.ObjectProxy(node.injectedScriptId, node.id);
-        WebInspector.ObjectProxy.getPropertiesAsync(objectProxy, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], createTooltipThenCallback);
-    },
+return this.expandedChildCount > index;
+},
 
-    updateSelection: function()
-    {
-        var listItemElement = this.listItemElement;
-        if (!listItemElement)
-            return;
+_createTooltipForNode: function()
+{
+var node = this.representedObject;
+if (!node.nodeName || node.nodeName.toLowerCase() !== "img")
+return;
 
-        if (document.body.offsetWidth <= 0) {
-            // The stylesheet hasn't loaded yet or the window is closed,
-            // so we can't calculate what is need. Return early.
-            return;
-        }
+function setTooltip(properties)
+{
+if (!properties)
+return;
 
-        if (!this.selectionElement) {
-            this.selectionElement = document.createElement("div");
-            this.selectionElement.className = "selection selected";
-            listItemElement.insertBefore(this.selectionElement, listItemElement.firstChild);
-        }
+if (properties.offsetHeight === properties.naturalHeight && properties.offsetWidth === properties.naturalWidth)
+this.tooltip = WebInspector.UIString("%d × %d pixels", properties.offsetWidth, properties.offsetHeight);
+else
+this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight);
+}
 
-        this.selectionElement.style.height = listItemElement.offsetHeight + "px";
-    },
+InjectedScriptAccess.getForNode(node).getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this));
+},
 
-    onattach: function()
-    {
-        this.listItemElement.addEventListener("mousedown", this.onmousedown.bind(this), false);
+updateSelection: function()
+{
+var listItemElement = this.listItemElement;
+if (!listItemElement)
+return;
 
-        if (this._hovered) {
-            this.updateSelection();
-            this.listItemElement.addStyleClass("hovered");
-        }
+if (document.body.offsetWidth <= 0) {
 
-        this.updateTitle();
 
-        this._preventFollowingLinksOnDoubleClick();
-    },
+return;
+}
 
-    _preventFollowingLinksOnDoubleClick: function()
-    {
-        var links = this.listItemElement.querySelectorAll("li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-external-link, li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-resource-link");
-        if (!links)
-            return;
+if (!this.selectionElement) {
+this.selectionElement = document.createElement("div");
+this.selectionElement.className = "selection selected";
+listItemElement.insertBefore(this.selectionElement, listItemElement.firstChild);
+}
 
-        for (var i = 0; i < links.length; ++i)
-            links[i].preventFollowOnDoubleClick = true;
-    },
+this.selectionElement.style.height = listItemElement.offsetHeight + "px";
+},
 
-    onpopulate: function()
-    {
-        if (this.children.length || this._showInlineText(this.representedObject))
-            return;
+onattach: function()
+{
+if (this._hovered) {
+this.updateSelection();
+this.listItemElement.addStyleClass("hovered");
+}
 
-        this.updateChildren();
-    },
-    
-    updateChildren: function(fullRefresh)
-    {
-        WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh));
-    },
+this.updateTitle();
 
-    insertChildElement: function(child, index)
-    {
-        var newElement = new WebInspector.ElementsTreeElement(child);
-        newElement.selectable = this.treeOutline.selectEnabled;
-        this.insertChild(newElement, index);
-        return newElement;
-    },
+this._preventFollowingLinksOnDoubleClick();
+},
 
-    moveChild: function(child, targetIndex)
-    {
-        var wasSelected = child.selected;
-        treeElement.removeChild(child);
-        treeElement.insertChild(child, targetIndex);
-        if (wasSelected)
-            existingTreeElement.select();
-    },
+_preventFollowingLinksOnDoubleClick: function()
+{
+var links = this.listItemElement.querySelectorAll("li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-external-link, li > .webkit-html-tag > .webkit-html-attribute > .webkit-html-resource-link");
+if (!links)
+return;
 
-    _updateChildren: function(fullRefresh)
-    {
-        if (this._updateChildrenInProgress)
-            return;
+for (var i = 0; i < links.length; ++i)
+links[i].preventFollowOnDoubleClick = true;
+},
 
-        this._updateChildrenInProgress = true;
-        var focusedNode = this.treeOutline.focusedDOMNode;
-        var originalScrollTop;
-        if (fullRefresh) {
-            var treeOutlineContainerElement = this.treeOutline.element.parentNode;
-            originalScrollTop = treeOutlineContainerElement.scrollTop;
-            var selectedTreeElement = this.treeOutline.selectedTreeElement;
-            if (selectedTreeElement && selectedTreeElement.hasAncestor(this))
-                this.select();
-            this.removeChildren();
-        }
+onpopulate: function()
+{
+if (this.children.length || this._showInlineText(this.representedObject) || this._elementCloseTag)
+return;
 
-        var treeElement = this;
-        var treeChildIndex = 0;
-        var elementToSelect;
+this.updateChildren();
+},
 
-        function updateChildrenOfNode(node)
-        {
-            var treeOutline = treeElement.treeOutline;
-            var child = node.firstChild;
-            while (child) {
-                var currentTreeElement = treeElement.children[treeChildIndex];
-                if (!currentTreeElement || currentTreeElement.representedObject !== child) {
-                    // Find any existing element that is later in the children list.
-                    var existingTreeElement = null;
-                    for (var i = (treeChildIndex + 1), size = treeElement.expandedChildCount; i < size; ++i) {
-                        if (treeElement.children[i].representedObject === child) {
-                            existingTreeElement = treeElement.children[i];
-                            break;
-                        }
-                    }
+updateChildren: function(fullRefresh)
+{
+if (this._elementCloseTag)
+return;
 
-                    if (existingTreeElement && existingTreeElement.parent === treeElement) {
-                        // If an existing element was found and it has the same parent, just move it.
-                        treeElement.moveChild(existingTreeElement, treeChildIndex);
-                    } else {
-                        // No existing element found, insert a new element.
-                        if (treeChildIndex < treeElement.expandedChildrenLimit) {
-                            var newElement = treeElement.insertChildElement(child, treeChildIndex);
-                            if (child === focusedNode)
-                                elementToSelect = newElement;
-                            if (treeElement.expandedChildCount > treeElement.expandedChildrenLimit)
-                                treeElement.expandedChildrenLimit++;
-                        }
-                    }
-                }
+WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh));
+},
 
-                child = child.nextSibling;
-                ++treeChildIndex;
-            }
-        }
+insertChildElement: function(child, index, closingTag)
+{
+var newElement = new WebInspector.ElementsTreeElement(child, closingTag);
+newElement.selectable = this.treeOutline.selectEnabled;
+this.insertChild(newElement, index);
+return newElement;
+},
 
-        // Remove any tree elements that no longer have this node (or this node's contentDocument) as their parent.
-        for (var i = (this.children.length - 1); i >= 0; --i) {
-            if ("elementCloseTag" in this.children[i])
-                continue;
+moveChild: function(child, targetIndex)
+{
+var wasSelected = child.selected;
+this.removeChild(child);
+this.insertChild(child, targetIndex);
+if (wasSelected)
+child.select();
+},
 
-            var currentChild = this.children[i];
-            var currentNode = currentChild.representedObject;
-            var currentParentNode = currentNode.parentNode;
+_updateChildren: function(fullRefresh)
+{
+if (this._updateChildrenInProgress)
+return;
 
-            if (currentParentNode === this.representedObject)
-                continue;
+this._updateChildrenInProgress = true;
+var focusedNode = this.treeOutline.focusedDOMNode;
+var originalScrollTop;
+if (fullRefresh) {
+var treeOutlineContainerElement = this.treeOutline.element.parentNode;
+originalScrollTop = treeOutlineContainerElement.scrollTop;
+var selectedTreeElement = this.treeOutline.selectedTreeElement;
+if (selectedTreeElement && selectedTreeElement.hasAncestor(this))
+this.select();
+this.removeChildren();
+}
 
-            var selectedTreeElement = this.treeOutline.selectedTreeElement;
-            if (selectedTreeElement && (selectedTreeElement === currentChild || selectedTreeElement.hasAncestor(currentChild)))
-                this.select();
+var treeElement = this;
+var treeChildIndex = 0;
+var elementToSelect;
 
-            this.removeChildAtIndex(i);
-        }
+function updateChildrenOfNode(node)
+{
+var treeOutline = treeElement.treeOutline;
+var child = node.firstChild;
+while (child) {
+var currentTreeElement = treeElement.children[treeChildIndex];
+if (!currentTreeElement || currentTreeElement.representedObject !== child) {
 
-        updateChildrenOfNode(this.representedObject);
-        this.adjustCollapsedRange(false);
+var existingTreeElement = null;
+for (var i = (treeChildIndex + 1), size = treeElement.expandedChildCount; i < size; ++i) {
+if (treeElement.children[i].representedObject === child) {
+existingTreeElement = treeElement.children[i];
+break;
+}
+}
 
-        var lastChild = this.children[this.children.length - 1];
-        if (this.representedObject.nodeType == Node.ELEMENT_NODE && (!lastChild || !lastChild.elementCloseTag)) {
-            var title = "<span class=\"webkit-html-tag close\">&lt;/" + this.representedObject.nodeName.toLowerCase().escapeHTML() + "&gt;</span>";
-            var item = new TreeElement(title, null, false);
-            item.selectable = false;
-            item.elementCloseTag = true;
-            this.appendChild(item);
-        }
+if (existingTreeElement && existingTreeElement.parent === treeElement) {
 
-        // We want to restore the original selection and tree scroll position after a full refresh, if possible.
-        if (fullRefresh && elementToSelect) {
-            elementToSelect.select();
-            if (treeOutlineContainerElement && originalScrollTop <= treeOutlineContainerElement.scrollHeight)
-                treeOutlineContainerElement.scrollTop = originalScrollTop;
-        }
+treeElement.moveChild(existingTreeElement, treeChildIndex);
+} else {
 
-        delete this._updateChildrenInProgress;
-    },
+if (treeChildIndex < treeElement.expandedChildrenLimit) {
+var newElement = treeElement.insertChildElement(child, treeChildIndex);
+if (child === focusedNode)
+elementToSelect = newElement;
+if (treeElement.expandedChildCount > treeElement.expandedChildrenLimit)
+treeElement.expandedChildrenLimit++;
+}
+}
+}
 
-    adjustCollapsedRange: function()
-    {
-        // Ensure precondition: only the tree elements for node children are found in the tree
-        // (not the Expand All button or the closing tag).
-        if (this.expandAllButtonElement && this.expandAllButtonElement.__treeElement.parent)
-            this.removeChild(this.expandAllButtonElement.__treeElement);
+child = child.nextSibling;
+++treeChildIndex;
+}
+}
 
-        const node = this.representedObject;
-        if (!node.children)
-            return;
-        const childNodeCount = node.children.length;
 
-        // In case some nodes from the expanded range were removed, pull some nodes from the collapsed range into the expanded range at the bottom.
-        for (var i = this.expandedChildCount, limit = Math.min(this.expandedChildrenLimit, childNodeCount); i < limit; ++i)
-            this.insertChildElement(node.children[i], i);
+for (var i = (this.children.length - 1); i >= 0; --i) {
+var currentChild = this.children[i];
+var currentNode = currentChild.representedObject;
+var currentParentNode = currentNode.parentNode;
 
-        const expandedChildCount = this.expandedChildCount;
-        if (childNodeCount > this.expandedChildCount) {
-            var targetButtonIndex = expandedChildCount;
-            if (!this.expandAllButtonElement) {
-                var title = "<button class=\"show-all-nodes\" value=\"\" />";
-                var item = new TreeElement(title, null, false);
-                item.selectable = false;
-                item.expandAllButton = true;
-                this.insertChild(item, targetButtonIndex);
-                this.expandAllButtonElement = item.listItemElement.firstChild;
-                this.expandAllButtonElement.__treeElement = item;
-                this.expandAllButtonElement.addEventListener("click", this.handleLoadAllChildren.bind(this), false);
-            } else if (!this.expandAllButtonElement.__treeElement.parent)
-                this.insertChild(this.expandAllButtonElement.__treeElement, targetButtonIndex);
-            this.expandAllButtonElement.textContent = WebInspector.UIString("Show All Nodes (%d More)", childNodeCount - expandedChildCount);
-        } else if (this.expandAllButtonElement)
-            delete this.expandAllButtonElement;
-    },
+if (currentParentNode === this.representedObject)
+continue;
+
+var selectedTreeElement = this.treeOutline.selectedTreeElement;
+if (selectedTreeElement && (selectedTreeElement === currentChild || selectedTreeElement.hasAncestor(currentChild)))
+this.select();
+
+this.removeChildAtIndex(i);
+}
+
+updateChildrenOfNode(this.representedObject);
+this.adjustCollapsedRange(false);
+
+var lastChild = this.children[this.children.length - 1];
+if (this.representedObject.nodeType == Node.ELEMENT_NODE && (!lastChild || !lastChild._elementCloseTag))
+this.insertChildElement(this.representedObject, this.children.length, true);
+
+
+if (fullRefresh && elementToSelect) {
+elementToSelect.select();
+if (treeOutlineContainerElement && originalScrollTop <= treeOutlineContainerElement.scrollHeight)
+treeOutlineContainerElement.scrollTop = originalScrollTop;
+}
+
+delete this._updateChildrenInProgress;
+},
+
+adjustCollapsedRange: function()
+{
+
+
+if (this.expandAllButtonElement && this.expandAllButtonElement.__treeElement.parent)
+this.removeChild(this.expandAllButtonElement.__treeElement);
+
+const node = this.representedObject;
+if (!node.children)
+return;
+const childNodeCount = node.children.length;
+
+
+for (var i = this.expandedChildCount, limit = Math.min(this.expandedChildrenLimit, childNodeCount); i < limit; ++i)
+this.insertChildElement(node.children[i], i);
+
+const expandedChildCount = this.expandedChildCount;
+if (childNodeCount > this.expandedChildCount) {
+var targetButtonIndex = expandedChildCount;
+if (!this.expandAllButtonElement) {
+var item = new TreeElement(null, null, false);
+item.titleHTML = "<button class=\"show-all-nodes\" value=\"\" />";
+item.selectable = false;
+item.expandAllButton = true;
+this.insertChild(item, targetButtonIndex);
+this.expandAllButtonElement = item.listItemElement.firstChild;
+this.expandAllButtonElement.__treeElement = item;
+this.expandAllButtonElement.addEventListener("click", this.handleLoadAllChildren.bind(this), false);
+} else if (!this.expandAllButtonElement.__treeElement.parent)
+this.insertChild(this.expandAllButtonElement.__treeElement, targetButtonIndex);
+this.expandAllButtonElement.textContent = WebInspector.UIString("Show All Nodes (%d More)", childNodeCount - expandedChildCount);
+} else if (this.expandAllButtonElement)
+delete this.expandAllButtonElement;
+},
+
+handleLoadAllChildren: function()
+{
+this.expandedChildrenLimit = Math.max(this.representedObject._childNodeCount, this.expandedChildrenLimit + WebInspector.ElementsTreeElement.InitialChildrenLimit);
+},
+
+onexpand: function()
+{
+if (this._elementCloseTag)
+return;
+
+this.updateTitle();
+this.treeOutline.updateSelection();
+},
+
+oncollapse: function()
+{
+if (this._elementCloseTag)
+return;
+
+this.updateTitle();
+this.treeOutline.updateSelection();
+},
+
+onreveal: function()
+{
+if (this.listItemElement)
+this.listItemElement.scrollIntoViewIfNeeded(false);
+},
+
+onselect: function(treeElement, selectedByUser)
+{
+this.treeOutline.suppressRevealAndSelect = true;
+this.treeOutline.focusedDOMNode = this.representedObject;
+if (selectedByUser)
+WebInspector.highlightDOMNode(this.representedObject.id);
+this.updateSelection();
+this.treeOutline.suppressRevealAndSelect = false;
+},
+
+ondelete: function()
+{
+var startTagTreeElement = this.treeOutline.findTreeElement(this.representedObject);
+startTagTreeElement ? startTagTreeElement.remove() : this.remove();
+return true;
+},
+
+onenter: function()
+{
+
+
+if (this.treeOutline.editing)
+return false;
+
+this._startEditing();
+
+
+return true;
+},
+
+selectOnMouseDown: function(event)
+{
+TreeElement.prototype.selectOnMouseDown.call(this, event);
+
+if (this._editing)
+return;
+
+if (this.treeOutline.showInElementsPanelEnabled) {
+WebInspector.showPanel("elements");
+WebInspector.panels.elements.focusedDOMNode = this.representedObject;
+}
+
+
+if (event.detail >= 2)
+event.preventDefault();
+},
+
+ondblclick: function(event)
+{
+if (this._editing || this._elementCloseTag)
+return;
+
+if (this._startEditingTarget(event.target))
+return;
+
+if (this.hasChildren && !this.expanded)
+this.expand();
+},
+
+_insertInLastAttributePosition: function(tag, node)
+{
+if (tag.getElementsByClassName("webkit-html-attribute").length > 0)
+tag.insertBefore(node, tag.lastChild);
+else {
+var nodeName = tag.textContent.match(/^<(.*?)>$/)[1];
+tag.textContent = '';
+tag.appendChild(document.createTextNode('<'+nodeName));
+tag.appendChild(node);
+tag.appendChild(document.createTextNode('>'));
+}
+
+this.updateSelection();
+},
+
+_startEditingTarget: function(eventTarget)
+{
+if (this.treeOutline.focusedDOMNode != this.representedObject)
+return;
+
+if (this.representedObject.nodeType != Node.ELEMENT_NODE && this.representedObject.nodeType != Node.TEXT_NODE)
+return false;
+
+var textNode = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-text-node");
+if (textNode)
+return this._startEditingTextNode(textNode);
+
+var attribute = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-attribute");
+if (attribute)
+return this._startEditingAttribute(attribute, eventTarget);
+
+var tagName = eventTarget.enclosingNodeOrSelfWithClass("webkit-html-tag-name");
+if (tagName)
+return this._startEditingTagName(tagName);
+
+var newAttribute = eventTarget.enclosingNodeOrSelfWithClass("add-attribute");
+if (newAttribute)
+return this._addNewAttribute();
+
+return false;
+},
+
+_populateTagContextMenu: function(contextMenu, event)
+{
+var attribute = event.target.enclosingNodeOrSelfWithClass("webkit-html-attribute");
+var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attribute");
+
+
+contextMenu.appendItem(WebInspector.UIString("Add Attribute"), this._addNewAttribute.bind(this));
+if (attribute && !newAttribute)
+contextMenu.appendItem(WebInspector.UIString("Edit Attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
+contextMenu.appendSeparator();
+
+
+contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._editAsHTML.bind(this));
+contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
+contextMenu.appendItem(WebInspector.UIString("Delete Node"), this.remove.bind(this));
+
+if (Preferences.nativeInstrumentationEnabled) {
+
+contextMenu.appendSeparator();
+
+function handlerFunction(nodeId, breakType)
+{
+WebInspector.breakpointManager.createDOMBreakpoint(nodeId, breakType);
+WebInspector.panels.elements.sidebarPanes.domBreakpoints.expand();
+}
+var node = this.representedObject;
+for (var key in WebInspector.DOMBreakpointTypes) {
+var type = WebInspector.DOMBreakpointTypes[key];
+var label = WebInspector.domBreakpointTypeContextMenuLabel(type);
+var breakpoint = node.breakpoints[type];
+if (!breakpoint)
+var handler = handlerFunction.bind(this, node.id, type);
+else
+var handler = breakpoint.remove.bind(breakpoint);
+contextMenu.appendCheckboxItem(label, handler, !!breakpoint);
+}
+}
+},
+
+_populateTextContextMenu: function(contextMenu, textNode)
+{
+contextMenu.appendItem(WebInspector.UIString("Edit Text"), this._startEditingTextNode.bind(this, textNode));
+},
+
+_startEditing: function()
+{
+if (this.treeOutline.focusedDOMNode !== this.representedObject)
+return;
+
+var listItem = this._listItemNode;
+
+if (this._canAddAttributes) {
+var attribute = listItem.getElementsByClassName("webkit-html-attribute")[0];
+if (attribute)
+return this._startEditingAttribute(attribute, attribute.getElementsByClassName("webkit-html-attribute-value")[0]);
+
+return this._addNewAttribute();
+}
+
+if (this.representedObject.nodeType === Node.TEXT_NODE) {
+var textNode = listItem.getElementsByClassName("webkit-html-text-node")[0];
+if (textNode)
+return this._startEditingTextNode(textNode);
+return;
+}
+},
+
+_addNewAttribute: function()
+{
+
+
+var container = document.createElement("span");
+container.innerHTML = this._attributeHTML(" ", "");
+var attr = container.firstChild;
+attr.style.marginLeft = "2px"; 
+attr.style.marginRight = "2px"; 
+
+var tag = this.listItemElement.getElementsByClassName("webkit-html-tag")[0];
+this._insertInLastAttributePosition(tag, attr);
+return this._startEditingAttribute(attr, attr);
+},
+
+_triggerEditAttribute: function(attributeName)
+{
+var attributeElements = this.listItemElement.getElementsByClassName("webkit-html-attribute-name");
+for (var i = 0, len = attributeElements.length; i < len; ++i) {
+if (attributeElements[i].textContent === attributeName) {
+for (var elem = attributeElements[i].nextSibling; elem; elem = elem.nextSibling) {
+if (elem.nodeType !== Node.ELEMENT_NODE)
+continue;
+
+if (elem.hasStyleClass("webkit-html-attribute-value"))
+return this._startEditingAttribute(elem.parentNode, elem);
+}
+}
+}
+},
+
+_startEditingAttribute: function(attribute, elementForSelection)
+{
+if (WebInspector.isBeingEdited(attribute))
+return true;
+
+var attributeNameElement = attribute.getElementsByClassName("webkit-html-attribute-name")[0];
+if (!attributeNameElement)
+return false;
+
+var attributeName = attributeNameElement.innerText;
+
+function removeZeroWidthSpaceRecursive(node)
+{
+if (node.nodeType === Node.TEXT_NODE) {
+node.nodeValue = node.nodeValue.replace(/\u200B/g, "");
+return;
+}
+
+if (node.nodeType !== Node.ELEMENT_NODE)
+return;
+
+for (var child = node.firstChild; child; child = child.nextSibling)
+removeZeroWidthSpaceRecursive(child);
+}
+
+
+removeZeroWidthSpaceRecursive(attribute);
+
+this._editing = WebInspector.startEditing(attribute, this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName);
+window.getSelection().setBaseAndExtent(elementForSelection, 0, elementForSelection, 1);
+
+return true;
+},
+
+_startEditingTextNode: function(textNode)
+{
+if (WebInspector.isBeingEdited(textNode))
+return true;
+
+this._editing = WebInspector.startEditing(textNode, this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this));
+window.getSelection().setBaseAndExtent(textNode, 0, textNode, 1);
+
+return true;
+},
+
+_startEditingTagName: function(tagNameElement)
+{
+if (!tagNameElement) {
+tagNameElement = this.listItemElement.getElementsByClassName("webkit-html-tag-name")[0];
+if (!tagNameElement)
+return false;
+}
+
+var tagName = tagNameElement.textContent;
+if (WebInspector.ElementsTreeElement.EditTagBlacklist[tagName.toLowerCase()])
+return false;
+
+if (WebInspector.isBeingEdited(tagNameElement))
+return true;
+
+var closingTagElement = this._distinctClosingTagElement();
+
+function keyupListener(event)
+{
+if (closingTagElement)
+closingTagElement.textContent = "</" + tagNameElement.textContent + ">";
+}
+
+function editingComitted(element, newTagName)
+{
+tagNameElement.removeEventListener('keyup', keyupListener, false);
+this._tagNameEditingCommitted.apply(this, arguments);
+}
+
+function editingCancelled()
+{
+tagNameElement.removeEventListener('keyup', keyupListener, false);
+this._editingCancelled.apply(this, arguments);
+}
+
+tagNameElement.addEventListener('keyup', keyupListener, false);
+
+this._editing = WebInspector.startEditing(tagNameElement, editingComitted.bind(this), editingCancelled.bind(this), tagName);
+window.getSelection().setBaseAndExtent(tagNameElement, 0, tagNameElement, 1);
+return true;
+},
+
+_startEditingAsHTML: function(commitCallback, initialValue)
+{
+if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement))
+return true;
+
+this._htmlEditElement = document.createElement("div");
+this._htmlEditElement.className = "source-code elements-tree-editor";
+this._htmlEditElement.textContent = initialValue;
+
+
+var child = this.listItemElement.firstChild;
+while (child) {
+child.style.display = "none";
+child = child.nextSibling;
+}
+
+if (this._childrenListNode)
+this._childrenListNode.style.display = "none";
+
+this.listItemElement.appendChild(this._htmlEditElement);
+
+this.updateSelection();
+
+function commit()
+{
+commitCallback(this._htmlEditElement.textContent);
+dispose.call(this);
+}
+
+function dispose()
+{
+delete this._editing;
+
+
+this.listItemElement.removeChild(this._htmlEditElement);
+delete this._htmlEditElement;
+
+if (this._childrenListNode)
+this._childrenListNode.style.removeProperty("display");
+
+var child = this.listItemElement.firstChild;
+while (child) {
+child.style.removeProperty("display");
+child = child.nextSibling;
+}
+
+this.updateSelection();
+}
+
+this._editing = WebInspector.startEditing(this._htmlEditElement, commit.bind(this), dispose.bind(this), null, true);
+},
+
+_attributeEditingCommitted: function(element, newText, oldText, attributeName, moveDirection)
+{
+delete this._editing;
 
-    handleLoadAllChildren: function()
-    {
-        this.expandedChildrenLimit = Math.max(this.representedObject._childNodeCount, this.expandedChildrenLimit + WebInspector.ElementsTreeElement.InitialChildrenLimit);
-    },
 
-    onexpand: function()
-    {
-        this.updateTitle();
-        this.treeOutline.updateSelection();
-    },
 
-    oncollapse: function()
-    {
-        this.updateTitle();
-        this.treeOutline.updateSelection();
-    },
+var moveToAttribute, moveToTagName, moveToNewAttribute;
+if (moveDirection) {
+var found = false;
 
-    onreveal: function()
-    {
-        if (this.listItemElement)
-            this.listItemElement.scrollIntoViewIfNeeded(false);
-    },
 
-    onselect: function()
-    {
-        this.treeOutline.focusedDOMNode = this.representedObject;
-        this.updateSelection();
-    },
+var attributes = this.representedObject.attributes;
+for (var i = 0; i < attributes.length; ++i) {
+if (attributes[i].name === attributeName) {
+found = true;
+if (moveDirection === "backward") {
+if (i === 0)
+moveToTagName = true;
+else
+moveToAttribute = attributes[i - 1].name;
+} else if (moveDirection === "forward") {
+if (i === attributes.length - 1)
+moveToNewAttribute = true;
+else
+moveToAttribute = attributes[i + 1].name;
+}
+}
+}
 
-    onmousedown: function(event)
-    {
-        if (this._editing)
-            return;
 
-        if (this.isEventWithinDisclosureTriangle(event))
-            return;
+if (!found) {
+if (moveDirection === "backward" && attributes.length > 0)
+moveToAttribute = attributes[attributes.length - 1].name;
+else if (moveDirection === "forward" && !/^\s*$/.test(newText))
+moveToNewAttribute = true;
+}
+}
 
-        if (this.treeOutline.showInElementsPanelEnabled) {    
-            WebInspector.showElementsPanel();
-            WebInspector.panels.elements.focusedDOMNode = this.representedObject;
-        }
+function moveToNextAttributeIfNeeded()
+{
 
-        // Prevent selecting the nearest word on double click.
-        if (event.detail >= 2)
-            event.preventDefault();
-    },
+if (element.textContent.trim().length === 0)
+element.parentNode.removeChild(element);
 
-    ondblclick: function(event)
-    {
-        if (this._editing)
-            return;
 
-        if (this._startEditingFromEvent(event))
-            return;
+if (moveToAttribute)
+this._triggerEditAttribute(moveToAttribute);
+else if (moveToNewAttribute)
+this._addNewAttribute();
+else if (moveToTagName)
+this._startEditingTagName();
+}
 
-        if (this.hasChildren && !this.expanded)
-            this.expand();
-    },
+function regenerateStyledAttribute(name, value)
+{
+var previous = element.previousSibling;
+if (!previous || previous.nodeType !== Node.TEXT_NODE)
+element.parentNode.insertBefore(document.createTextNode(" "), element);
+element.outerHTML = this._attributeHTML(name, value);
+}
 
-    _insertInLastAttributePosition: function(tag, node)
-    {
-        if (tag.getElementsByClassName("webkit-html-attribute").length > 0)
-            tag.insertBefore(node, tag.lastChild);
-        else {
-            var nodeName = tag.textContent.match(/^<(.*?)>$/)[1];
-            tag.textContent = '';
-            tag.appendChild(document.createTextNode('<'+nodeName));
-            tag.appendChild(node);
-            tag.appendChild(document.createTextNode('>'));
-        }
+var parseContainerElement = document.createElement("span");
+parseContainerElement.innerHTML = "<span " + newText + "></span>";
+var parseElement = parseContainerElement.firstChild;
 
-        this.updateSelection();
-    },
+if (!parseElement) {
+this._editingCancelled(element, attributeName);
+moveToNextAttributeIfNeeded.call(this);
+return;
+}
 
-    _startEditingFromEvent: function(event)
-    {
-        if (this.treeOutline.focusedDOMNode != this.representedObject)
-            return;
+if (!parseElement.hasAttributes()) {
+this.representedObject.removeAttribute(attributeName);
+moveToNextAttributeIfNeeded.call(this);
+return;
+}
 
-        if (this.representedObject.nodeType != Node.ELEMENT_NODE && this.representedObject.nodeType != Node.TEXT_NODE)
-            return false;
+var foundOriginalAttribute = false;
+for (var i = 0; i < parseElement.attributes.length; ++i) {
+var attr = parseElement.attributes[i];
+foundOriginalAttribute = foundOriginalAttribute || attr.name === attributeName;
+try {
+this.representedObject.setAttribute(attr.name, attr.value);
+regenerateStyledAttribute.call(this, attr.name, attr.value);
+} catch(e) {} 
+}
 
-        var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
-        if (textNode)
-            return this._startEditingTextNode(textNode);
+if (!foundOriginalAttribute)
+this.representedObject.removeAttribute(attributeName);
 
-        var attribute = event.target.enclosingNodeOrSelfWithClass("webkit-html-attribute");
-        if (attribute)
-            return this._startEditingAttribute(attribute, event.target);
+this.treeOutline.focusedNodeChanged(true);
 
-        var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attribute");
-        if (newAttribute)
-            return this._addNewAttribute();
+moveToNextAttributeIfNeeded.call(this);
+},
 
-        return false;
-    },
+_tagNameEditingCommitted: function(element, newText, oldText, tagName, moveDirection)
+{
+delete this._editing;
+var self = this;
 
-    _populateTagContextMenu: function(contextMenu, event)
-    {
-        var attribute = event.target.enclosingNodeOrSelfWithClass("webkit-html-attribute");
-        var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attribute");
+function cancel()
+{
+var closingTagElement = self._distinctClosingTagElement();
+if (closingTagElement)
+closingTagElement.textContent = "</" + tagName + ">";
 
-        // Add attribute-related actions.
-        contextMenu.appendItem(WebInspector.UIString("Add Attribute"), this._addNewAttribute.bind(this));
-        if (attribute && !newAttribute)
-            contextMenu.appendItem(WebInspector.UIString("Edit Attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
-        contextMenu.appendSeparator();
+self._editingCancelled(element, tagName);
+moveToNextAttributeIfNeeded.call(self);
+}
 
-        // Add node-related actions.
-        contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._editAsHTML.bind(this));
-        contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
-        contextMenu.appendItem(WebInspector.UIString("Delete Node"), this.remove.bind(this));
-    },
+function moveToNextAttributeIfNeeded()
+{
+if (moveDirection !== "forward")
+return;
 
-    _populateTextContextMenu: function(contextMenu, textNode)
-    {
-        contextMenu.appendItem(WebInspector.UIString("Edit Text"), this._startEditingTextNode.bind(this, textNode));
-    },
+var attributes = this.representedObject.attributes;
+if (attributes.length > 0)
+this._triggerEditAttribute(attributes[0].name);
+else
+this._addNewAttribute();
+}
 
-    _startEditing: function()
-    {
-        if (this.treeOutline.focusedDOMNode !== this.representedObject)
-            return;
+newText = newText.trim();
+if (newText === oldText) {
+cancel();
+return;
+}
 
-        var listItem = this._listItemNode;
+var treeOutline = this.treeOutline;
+var wasExpanded = this.expanded;
 
-        if (this._canAddAttributes) {
-            var attribute = listItem.getElementsByClassName("webkit-html-attribute")[0];
-            if (attribute)
-                return this._startEditingAttribute(attribute, attribute.getElementsByClassName("webkit-html-attribute-value")[0]);
+function changeTagNameCallback(nodeId)
+{
+if (!nodeId) {
+cancel();
+return;
+}
 
-            return this._addNewAttribute();
-        }
 
-        if (this.representedObject.nodeType === Node.TEXT_NODE) {
-            var textNode = listItem.getElementsByClassName("webkit-html-text-node")[0];
-            if (textNode)
-                return this._startEditingTextNode(textNode);
-            return;
-        }
-    },
+WebInspector.panels.elements.updateModifiedNodes();
 
-    _addNewAttribute: function()
-    {
-        var attr = document.createElement("span");
-        attr.className = "webkit-html-attribute";
-        attr.style.marginLeft = "2px"; // overrides the .editing margin rule
-        attr.style.marginRight = "2px"; // overrides the .editing margin rule
-        var name = document.createElement("span");
-        name.className = "webkit-html-attribute-name new-attribute";
-        name.textContent = " ";
-        var value = document.createElement("span");
-        value.className = "webkit-html-attribute-value";
-        attr.appendChild(name);
-        attr.appendChild(value);
+WebInspector.updateFocusedNode(nodeId);
+var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
+if (wasExpanded)
+newTreeItem.expand();
 
-        var tag = this.listItemElement.getElementsByClassName("webkit-html-tag")[0];
-        this._insertInLastAttributePosition(tag, attr);
-        return this._startEditingAttribute(attr, attr);
-    },
+moveToNextAttributeIfNeeded.call(newTreeItem);
+}
 
-    _triggerEditAttribute: function(attributeName)
-    {
-        var attributeElements = this.listItemElement.getElementsByClassName("webkit-html-attribute-name");
-        for (var i = 0, len = attributeElements.length; i < len; ++i) {
-            if (attributeElements[i].textContent === attributeName) {
-                for (var elem = attributeElements[i].nextSibling; elem; elem = elem.nextSibling) {
-                    if (elem.nodeType !== Node.ELEMENT_NODE)
-                        continue;
+InspectorBackend.changeTagName(this.representedObject.id, newText, changeTagNameCallback);
+},
 
-                    if (elem.hasStyleClass("webkit-html-attribute-value"))
-                        return this._startEditingAttribute(attributeElements[i].parentNode, elem);
-                }
-            }
-        }
-    },
+_textNodeEditingCommitted: function(element, newText)
+{
+delete this._editing;
 
-    _startEditingAttribute: function(attribute, elementForSelection)
-    {
-        if (WebInspector.isBeingEdited(attribute))
-            return true;
+var textNode;
+if (this.representedObject.nodeType === Node.ELEMENT_NODE) {
 
-        var attributeNameElement = attribute.getElementsByClassName("webkit-html-attribute-name")[0];
-        if (!attributeNameElement)
-            return false;
 
-        var attributeName = attributeNameElement.innerText;
+textNode = this.representedObject.firstChild;
+} else if (this.representedObject.nodeType == Node.TEXT_NODE)
+textNode = this.representedObject;
 
-        function removeZeroWidthSpaceRecursive(node)
-        {
-            if (node.nodeType === Node.TEXT_NODE) {
-                node.nodeValue = node.nodeValue.replace(/\u200B/g, "");
-                return;
-            }
+textNode.nodeValue = newText;
+},
 
-            if (node.nodeType !== Node.ELEMENT_NODE)
-                return;
+_editingCancelled: function(element, context)
+{
+delete this._editing;
 
-            for (var child = node.firstChild; child; child = child.nextSibling)
-                removeZeroWidthSpaceRecursive(child);
-        }
 
-        // Remove zero-width spaces that were added by nodeTitleInfo.
-        removeZeroWidthSpaceRecursive(attribute);
+this.updateTitle();
+},
 
-        this._editing = true;
+_distinctClosingTagElement: function()
+{
 
-        WebInspector.startEditing(attribute, this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName);
-        window.getSelection().setBaseAndExtent(elementForSelection, 0, elementForSelection, 1);
 
-        return true;
-    },
 
-    _startEditingTextNode: function(textNode)
-    {
-        if (WebInspector.isBeingEdited(textNode))
-            return true;
 
-        this._editing = true;
+if (this.expanded) {
+var closers = this._childrenListNode.querySelectorAll(".close");
+return closers[closers.length-1];
+}
 
-        WebInspector.startEditing(textNode, this._textNodeEditingCommitted.bind(this), this._editingCancelled.bind(this));
-        window.getSelection().setBaseAndExtent(textNode, 0, textNode, 1);
 
-        return true;
-    },
 
-    _startEditingAsHTML: function(commitCallback, initialValue)
-    {
-        if (this._htmlEditElement && WebInspector.isBeingEdited(this._htmlEditElement))
-            return true;
 
-        this._editing = true;
+var tags = this.listItemElement.getElementsByClassName("webkit-html-tag");
+return (tags.length === 1 ? null : tags[tags.length-1]);
+},
 
-        this._htmlEditElement = document.createElement("div");
-        this._htmlEditElement.className = "source-code elements-tree-editor";
-        this._htmlEditElement.textContent = initialValue;
+updateTitle: function()
+{
 
-        // Hide header items.
-        var child = this.listItemElement.firstChild;
-        while (child) {
-            child.style.display = "none";
-            child = child.nextSibling;
-        }
-        // Hide children item.
-        if (this._childrenListNode)
-            this._childrenListNode.style.display = "none";
-        // Append editor.
-        this.listItemElement.appendChild(this._htmlEditElement);
 
-        this.updateSelection();
+if (this._editing)
+return;
 
-        function commit()
-        {
-            commitCallback(this._htmlEditElement.textContent);
-            dispose.call(this);
-        }
+this.titleHTML = "<span class=\"highlight\">" + this._nodeTitleInfo(WebInspector.linkifyURL).titleHTML + "</span>";
+delete this.selectionElement;
+this.updateSelection();
+this._preventFollowingLinksOnDoubleClick();
+this._highlightSearchResults();
+},
 
-        function dispose()
-        {
-            delete this._editing;
+_attributeHTML: function(name, value, node, linkify)
+{
+var hasText = (value.length > 0);
+var html = "<span class=\"webkit-html-attribute\"><span class=\"webkit-html-attribute-name\">" + name.escapeHTML() + "</span>";
 
-            // Remove editor.
-            this.listItemElement.removeChild(this._htmlEditElement);
-            delete this._htmlEditElement;
-            // Unhide children item.
-            if (this._childrenListNode)
-                this._childrenListNode.style.removeProperty("display");
-            // Unhide header items.
-            var child = this.listItemElement.firstChild;
-            while (child) {
-                child.style.removeProperty("display");
-                child = child.nextSibling;
-            }
+if (hasText)
+html += "=&#8203;\"";
 
-            this.updateSelection();
-        }
+if (linkify && (name === "src" || name === "href")) {
+var rewrittenHref = WebInspector.resourceURLForRelatedNode(node, value);
+value = value.replace(/([\/;:\)\]\}])/g, "$1\u200B");
+html += linkify(rewrittenHref, value, "webkit-html-attribute-value", node.nodeName.toLowerCase() === "a");
+} else {
+value = value.escapeHTML().replace(/([\/;:\)\]\}])/g, "$1&#8203;");
+html += "<span class=\"webkit-html-attribute-value\">" + value + "</span>";
+}
 
-        WebInspector.startEditing(this._htmlEditElement, commit.bind(this), dispose.bind(this), null, true);
-    },
+if (hasText)
+html += "\"";
 
-    _attributeEditingCommitted: function(element, newText, oldText, attributeName, moveDirection)
-    {
-        delete this._editing;
+html += "</span>";
+return html;
+},
 
-        // Before we do anything, determine where we should move
-        // next based on the current element's settings
-        var moveToAttribute;
-        var newAttribute;
-        if (moveDirection) {
-            var found = false;
-            var attributes = this.representedObject.attributes;
-            for (var i = 0, len = attributes.length; i < len; ++i) {
-                if (attributes[i].name === attributeName) {
-                    found = true;
-                    if (moveDirection === "backward" && i > 0)
-                        moveToAttribute = attributes[i - 1].name;
-                    else if (moveDirection === "forward" && i < attributes.length - 1)
-                        moveToAttribute = attributes[i + 1].name;
-                    else if (moveDirection === "forward" && i === attributes.length - 1)
-                        newAttribute = true;
-                }
-            }
+_tagHTML: function(tagName, isClosingTag, isDistinctTreeElement, linkify)
+{
+var node = this.representedObject;
+var result = "<span class=\"webkit-html-tag" + (isClosingTag && isDistinctTreeElement ? " close" : "")  + "\">&lt;";
+result += "<span " + (isClosingTag ? "" : "class=\"webkit-html-tag-name\"") + ">" + (isClosingTag ? "/" : "") + tagName + "</span>";
+if (!isClosingTag && node.hasAttributes()) {
+for (var i = 0; i < node.attributes.length; ++i) {
+var attr = node.attributes[i];
+result += " " + this._attributeHTML(attr.name, attr.value, node, linkify);
+}
+}
+result += "&gt;</span>&#8203;";
 
-            if (!found && moveDirection === "backward" && attributes.length > 0)
-                moveToAttribute = attributes[attributes.length - 1].name;
-            else if (!found && moveDirection === "forward" && !/^\s*$/.test(newText))
-                newAttribute = true;
-        }
+return result;
+},
 
-        function moveToNextAttributeIfNeeded() {
-            if (moveToAttribute)
-                this._triggerEditAttribute(moveToAttribute);
-            else if (newAttribute)
-                this._addNewAttribute(this.listItemElement);
-        }
+_nodeTitleInfo: function(linkify)
+{
+var node = this.representedObject;
+var info = {titleHTML: "", hasChildren: this.hasChildren};
 
-        var parseContainerElement = document.createElement("span");
-        parseContainerElement.innerHTML = "<span " + newText + "></span>";
-        var parseElement = parseContainerElement.firstChild;
+switch (node.nodeType) {
+case Node.DOCUMENT_NODE:
+info.titleHTML = "Document";
+break;
 
-        if (!parseElement) {
-            this._editingCancelled(element, attributeName);
-            moveToNextAttributeIfNeeded.call(this);
-            return;
-        }
+case Node.DOCUMENT_FRAGMENT_NODE:
+info.titleHTML = "Document Fragment";
+break;
 
-        if (!parseElement.hasAttributes()) {
-            this.representedObject.removeAttribute(attributeName);
-            moveToNextAttributeIfNeeded.call(this);
-            return;
-        }
+case Node.ATTRIBUTE_NODE:
+var value = node.value || "\u200B"; 
+info.titleHTML = this._attributeHTML(node.name, value);
+break;
 
-        var foundOriginalAttribute = false;
-        for (var i = 0; i < parseElement.attributes.length; ++i) {
-            var attr = parseElement.attributes[i];
-            foundOriginalAttribute = foundOriginalAttribute || attr.name === attributeName;
-            try {
-                this.representedObject.setAttribute(attr.name, attr.value);
-            } catch(e) {} // ignore invalid attribute (innerHTML doesn't throw errors, but this can)
-        }
+case Node.ELEMENT_NODE:
+var tagName = this.treeOutline.nodeNameToCorrectCase(node.nodeName).escapeHTML();
+if (this._elementCloseTag) {
+info.titleHTML = this._tagHTML(tagName, true, true);
+info.hasChildren = false;
+break;
+}
 
-        if (!foundOriginalAttribute)
-            this.representedObject.removeAttribute(attributeName);
+var titleHTML = this._tagHTML(tagName, false, false, linkify);
 
-        this.treeOutline.focusedNodeChanged(true);
+var textChild = onlyTextChild.call(node);
+var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength;
 
-        moveToNextAttributeIfNeeded.call(this);
-    },
+if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElement.ForbiddenClosingTagElements[tagName]))) {
+if (this.hasChildren)
+titleHTML += "<span class=\"webkit-html-text-node\">&#8230;</span>&#8203;";
+titleHTML += this._tagHTML(tagName, true, false);
+}
 
-    _textNodeEditingCommitted: function(element, newText)
-    {
-        delete this._editing;
 
-        var textNode;
-        if (this.representedObject.nodeType == Node.ELEMENT_NODE) {
-            // We only show text nodes inline in elements if the element only
-            // has a single child, and that child is a text node.
-            textNode = this.representedObject.firstChild;
-        } else if (this.representedObject.nodeType == Node.TEXT_NODE)
-            textNode = this.representedObject;
 
-        textNode.nodeValue = newText;
 
-        // Need to restore attributes / node structure.
-        this.updateTitle();
-    },
+if (showInlineText) {
+titleHTML += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;" + this._tagHTML(tagName, true, false);
+info.hasChildren = false;
+}
+info.titleHTML = titleHTML;
+break;
 
-    _editingCancelled: function(element, context)
-    {
-        delete this._editing;
+case Node.TEXT_NODE:
+if (isNodeWhitespace.call(node))
+info.titleHTML = "(whitespace)";
+else {
+if (node.parentNode && node.parentNode.nodeName.toLowerCase() === "script") {
+var newNode = document.createElement("span");
+newNode.textContent = node.textContent;
 
-        // Need to restore attributes structure.
-        this.updateTitle();
-    },
+var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript");
+javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
 
-    updateTitle: function()
-    {
-        // If we are editing, return early to prevent canceling the edit.
-        // After editing is committed updateTitle will be called.
-        if (this._editing)
-            return;
+info.titleHTML = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
+} else if (node.parentNode && node.parentNode.nodeName.toLowerCase() === "style") {
+var newNode = document.createElement("span");
+newNode.textContent = node.textContent;
 
-        var self = this;
-        function callback(tooltipText)
-        {
-            var title = self._nodeTitleInfo(WebInspector.linkifyURL, tooltipText).title;
-            self.title = "<span class=\"highlight\">" + title + "</span>";
-            delete self.selectionElement;
-            self.updateSelection();
-            self._preventFollowingLinksOnDoubleClick();
-            self._highlightSearchResults();
-        };
+var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css");
+cssSyntaxHighlighter.syntaxHighlightNode(newNode);
 
-        // TODO: Replace with InjectedScriptAccess.getBasicProperties(obj, [names]).
-        if (this.representedObject.nodeName.toLowerCase() !== "img")
-            callback();
-        else
-            this.createTooltipForImageNode(this.representedObject, callback);
-    },
+info.titleHTML = "<span class=\"webkit-html-text-node webkit-html-css-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
+} else
+info.titleHTML = "\"<span class=\"webkit-html-text-node\">" + node.nodeValue.escapeHTML() + "</span>\"";
+}
+break;
 
-    _rewriteAttrHref: function(node, hrefValue)
-    {
-        if (!hrefValue || hrefValue.indexOf("://") > 0)
-            return hrefValue;
+case Node.COMMENT_NODE:
+info.titleHTML = "<span class=\"webkit-html-comment\">&lt;!--" + node.nodeValue.escapeHTML() + "--&gt;</span>";
+break;
 
-        for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
-            if (frameOwnerCandidate.documentURL) {
-                var result = WebInspector.completeURL(frameOwnerCandidate.documentURL, hrefValue);
-                if (result)
-                    return result;
-                break;
-            }
-        }
+case Node.DOCUMENT_TYPE_NODE:
+var titleHTML = "<span class=\"webkit-html-doctype\">&lt;!DOCTYPE " + node.nodeName;
+if (node.publicId) {
+titleHTML += " PUBLIC \"" + node.publicId + "\"";
+if (node.systemId)
+titleHTML += " \"" + node.systemId + "\"";
+} else if (node.systemId)
+titleHTML += " SYSTEM \"" + node.systemId + "\"";
+if (node.internalSubset)
+titleHTML += " [" + node.internalSubset + "]";
+titleHTML += "&gt;</span>";
+info.titleHTML = titleHTML;
+break;
 
-        // documentURL not found or has bad value
-        for (var url in WebInspector.resourceURLMap) {
-            var match = url.match(WebInspector.URLRegExp);
-            if (match && match[4] === hrefValue)
-                return url;
-        }
-        return hrefValue;
-    },
+case Node.CDATA_SECTION_NODE:
+info.titleHTML = "<span class=\"webkit-html-text-node\">&lt;![CDATA[" + node.nodeValue.escapeHTML() + "]]&gt;</span>";
+break;
+default:
+info.titleHTML = this.treeOutline.nodeNameToCorrectCase(node.nodeName).collapseWhitespace().escapeHTML();
+}
 
-    _nodeTitleInfo: function(linkify, tooltipText)
-    {
-        var node = this.representedObject;
-        var info = {title: "", hasChildren: this.hasChildren};
-        
-        switch (node.nodeType) {
-            case Node.DOCUMENT_NODE:
-                info.title = "Document";
-                break;
-                
-            case Node.DOCUMENT_FRAGMENT_NODE:
-                info.title = "Document Fragment";
-                break;
+return info;
+},
 
-            case Node.ELEMENT_NODE:
-                var tagName = node.nodeName.toLowerCase().escapeHTML();
-                info.title = "<span class=\"webkit-html-tag\">&lt;" + tagName;
-                
-                if (node.hasAttributes()) {
-                    for (var i = 0; i < node.attributes.length; ++i) {
-                        var attr = node.attributes[i];
-                        info.title += " <span class=\"webkit-html-attribute\"><span class=\"webkit-html-attribute-name\">" + attr.name.escapeHTML() + "</span>=&#8203;\"";
-                        
-                        var value = attr.value;
-                        if (linkify && (attr.name === "src" || attr.name === "href")) {
-                            var value = value.replace(/([\/;:\)\]\}])/g, "$1\u200B");
-                            info.title += linkify(this._rewriteAttrHref(node, attr.value), value, "webkit-html-attribute-value", node.nodeName.toLowerCase() == "a", tooltipText);
-                        } else {
-                            var value = value.escapeHTML();
-                            value = value.replace(/([\/;:\)\]\}])/g, "$1&#8203;");
-                            info.title += "<span class=\"webkit-html-attribute-value\">" + value + "</span>";
-                        }
-                        info.title += "\"</span>";
-                    }
-                }
-                info.title += "&gt;</span>&#8203;";
-                
-                const closingTagHTML = "<span class=\"webkit-html-tag\">&lt;/" + tagName + "&gt;</span>&#8203;";
-                var textChild = onlyTextChild.call(node);
-                var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength;
+_showInlineText: function(node)
+{
+if (node.nodeType === Node.ELEMENT_NODE) {
+var textChild = onlyTextChild.call(node);
+if (textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength)
+return true;
+}
+return false;
+},
 
-                if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElement.ForbiddenClosingTagElements[tagName]))) {
-                    if (this.hasChildren)
-                        info.title += "<span class=\"webkit-html-text-node\">&#8230;</span>&#8203;";
-                    info.title += closingTagHTML;
-                }
+remove: function()
+{
+var parentElement = this.parent;
+if (!parentElement)
+return;
 
-                // If this element only has a single child that is a text node,
-                // just show that text and the closing tag inline rather than
-                // create a subtree for them
-                if (showInlineText) {
-                    info.title += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;" + closingTagHTML;
-                    info.hasChildren = false;
-                }
-                break;
-                
-            case Node.TEXT_NODE:
-                if (isNodeWhitespace.call(node))
-                    info.title = "(whitespace)";
-                else {
-                    if (node.parentNode && node.parentNode.nodeName.toLowerCase() == "script") {
-                        var newNode = document.createElement("span");
-                        newNode.textContent = node.textContent;
+var self = this;
+function removeNodeCallback(removedNodeId)
+{
 
-                        var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript");
-                        javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
-                        
-                        info.title = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
-                    } else if (node.parentNode && node.parentNode.nodeName.toLowerCase() == "style") {
-                        var newNode = document.createElement("span");
-                        newNode.textContent = node.textContent;
-                        
-                        var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css");
-                        cssSyntaxHighlighter.syntaxHighlightNode(newNode);
-                        
-                        info.title = "<span class=\"webkit-html-text-node webkit-html-css-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
-                    } else {
-                        info.title = "\"<span class=\"webkit-html-text-node\">" + node.nodeValue.escapeHTML() + "</span>\""; 
-                    }
-                } 
-                break;
-                
-            case Node.COMMENT_NODE:
-                info.title = "<span class=\"webkit-html-comment\">&lt;!--" + node.nodeValue.escapeHTML() + "--&gt;</span>";
-                break;
-                
-            case Node.DOCUMENT_TYPE_NODE:
-                info.title = "<span class=\"webkit-html-doctype\">&lt;!DOCTYPE " + node.nodeName;
-                if (node.publicId) {
-                    info.title += " PUBLIC \"" + node.publicId + "\"";
-                    if (node.systemId)
-                        info.title += " \"" + node.systemId + "\"";
-                } else if (node.systemId)
-                    info.title += " SYSTEM \"" + node.systemId + "\"";
-                if (node.internalSubset)
-                    info.title += " [" + node.internalSubset + "]";
-                info.title += "&gt;</span>";
-                break;
-            default:
-                info.title = node.nodeName.toLowerCase().collapseWhitespace().escapeHTML();
-        }
-        
-        return info;
-    },
 
-    _showInlineText: function(node)
-    {
-        if (node.nodeType === Node.ELEMENT_NODE) {
-            var textChild = onlyTextChild.call(node);
-            if (textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength)
-                return true;
-        }
-        return false;
-    },
-    
-    remove: function()
-    {
-        var parentElement = this.parent;
-        if (!parentElement)
-            return;
+if (removedNodeId === -1)
+return;
 
-        var self = this;
-        function removeNodeCallback(removedNodeId)
-        {
-            // -1 is an error code, which means removing the node from the DOM failed,
-            // so we shouldn't remove it from the tree.
-            if (removedNodeId === -1)
-                return;
+parentElement.removeChild(self);
+parentElement.adjustCollapsedRange(true);
+}
 
-            parentElement.removeChild(self);
-            parentElement.adjustCollapsedRange(true);
-        }
+InspectorBackend.removeNode(this.representedObject.id, removeNodeCallback);
+},
 
-        var callId = WebInspector.Callback.wrap(removeNodeCallback);
-        InspectorBackend.removeNode(callId, this.representedObject.id);
-    },
+_editAsHTML: function()
+{
+var treeOutline = this.treeOutline;
+var node = this.representedObject;
+var wasExpanded = this.expanded;
 
-    _editAsHTML: function()
-    {
-        var treeOutline = this.treeOutline;
-        var node = this.representedObject;
-        var wasExpanded = this.expanded;
+function selectNode(nodeId)
+{
+if (!nodeId)
+return;
 
-        function selectNode(nodeId)
-        {
-            if (!nodeId)
-                return;
 
-            // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date.
-            WebInspector.panels.elements.updateModifiedNodes();
+WebInspector.panels.elements.updateModifiedNodes();
 
-            WebInspector.updateFocusedNode(nodeId);
-            if (wasExpanded) {
-                var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
-                if (newTreeItem)
-                    newTreeItem.expand();
-            }
-        }
+WebInspector.updateFocusedNode(nodeId);
+if (wasExpanded) {
+var newTreeItem = treeOutline.findTreeElement(WebInspector.domAgent.nodeForId(nodeId));
+if (newTreeItem)
+newTreeItem.expand();
+}
+}
 
-        function commitChange(value)
-        {
-            InjectedScriptAccess.get(node.injectedScriptId).setOuterHTML(node.id, value, wasExpanded, selectNode.bind(this));
-        }
+function commitChange(value)
+{
+InspectorBackend.setOuterHTML(node.id, value, selectNode);
+}
 
-        InjectedScriptAccess.get(node.injectedScriptId).getNodePropertyValue(node.id, "outerHTML", this._startEditingAsHTML.bind(this, commitChange));
-    },
+InspectorBackend.getOuterHTML(node.id, this._startEditingAsHTML.bind(this, commitChange));
+},
 
-    _copyHTML: function()
-    {
-        InspectorBackend.copyNode(this.representedObject.id);
-    },
+_copyHTML: function()
+{
+InspectorBackend.copyNode(this.representedObject.id);
+},
 
-    _highlightSearchResults: function()
-    {
-        if (!this._searchQuery)
-            return;
-        var text = this.listItemElement.textContent;
-        var regexObject = createSearchRegex(this._searchQuery);
+_highlightSearchResults: function()
+{
+if (!this._searchQuery)
+return;
+var text = this.listItemElement.textContent;
+var regexObject = createSearchRegex(this._searchQuery);
 
-        var offset = 0;
-        var match = regexObject.exec(text);
-        while (match) {
-            highlightSearchResult(this.listItemElement, offset + match.index, match[0].length);
-            offset += match.index + 1;
-            text = text.substring(match.index + 1);
-            match = regexObject.exec(text);
-        }
-    }
+var offset = 0;
+var match = regexObject.exec(text);
+while (match) {
+highlightSearchResult(this.listItemElement, offset + match.index, match[0].length);
+offset += match.index + 1;
+text = text.substring(match.index + 1);
+match = regexObject.exec(text);
+}
+}
 }
 
 WebInspector.ElementsTreeElement.prototype.__proto__ = TreeElement.prototype;
 
-WebInspector.didRemoveNode = WebInspector.Callback.processCallback;
 
-/* SidebarTreeElement.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
 
 WebInspector.SidebarSectionTreeElement = function(title, representedObject, hasChildren)
 {
-    TreeElement.call(this, title.escapeHTML(), representedObject || {}, hasChildren);
+TreeElement.call(this, title.escapeHTML(), representedObject || {}, hasChildren);
 }
 
 WebInspector.SidebarSectionTreeElement.prototype = {
-    selectable: false,
+selectable: false,
 
-    get smallChildren()
-    {
-        return this._smallChildren;
-    },
+get smallChildren()
+{
+return this._smallChildren;
+},
 
-    set smallChildren(x)
-    {
-        if (this._smallChildren === x)
-            return;
+set smallChildren(x)
+{
+if (this._smallChildren === x)
+return;
 
-        this._smallChildren = x;
+this._smallChildren = x;
 
-        if (this._smallChildren)
-            this._childrenListNode.addStyleClass("small");
-        else
-            this._childrenListNode.removeStyleClass("small");
-    },
+if (this._smallChildren)
+this._childrenListNode.addStyleClass("small");
+else
+this._childrenListNode.removeStyleClass("small");
+},
 
-    onattach: function()
-    {
-        this._listItemNode.addStyleClass("sidebar-tree-section");
-    },
+onattach: function()
+{
+this._listItemNode.addStyleClass("sidebar-tree-section");
+},
 
-    onreveal: function()
-    {
-        if (this.listItemElement)
-            this.listItemElement.scrollIntoViewIfNeeded(false);
-    }
+onreveal: function()
+{
+if (this.listItemElement)
+this.listItemElement.scrollIntoViewIfNeeded(false);
+}
 }
 
 WebInspector.SidebarSectionTreeElement.prototype.__proto__ = TreeElement.prototype;
 
 WebInspector.SidebarTreeElement = function(className, title, subtitle, representedObject, hasChildren)
 {
-    TreeElement.call(this, "", representedObject || {}, hasChildren);
+TreeElement.call(this, "", representedObject || {}, hasChildren);
 
-    if (hasChildren) {
-        this.disclosureButton = document.createElement("button");
-        this.disclosureButton.className = "disclosure-button";
-    }
+if (hasChildren) {
+this.disclosureButton = document.createElement("button");
+this.disclosureButton.className = "disclosure-button";
+}
 
-    if (!this.iconElement) {
-        this.iconElement = document.createElement("img");
-        this.iconElement.className = "icon";
-    }
+if (!this.iconElement) {
+this.iconElement = document.createElement("img");
+this.iconElement.className = "icon";
+}
 
-    this.statusElement = document.createElement("div");
-    this.statusElement.className = "status";
+this.statusElement = document.createElement("div");
+this.statusElement.className = "status";
 
-    this.titlesElement = document.createElement("div");
-    this.titlesElement.className = "titles";
+this.titlesElement = document.createElement("div");
+this.titlesElement.className = "titles";
 
-    this.titleElement = document.createElement("span");
-    this.titleElement.className = "title";
-    this.titlesElement.appendChild(this.titleElement);
+this.titleElement = document.createElement("span");
+this.titleElement.className = "title";
+this.titlesElement.appendChild(this.titleElement);
 
-    this.subtitleElement = document.createElement("span");
-    this.subtitleElement.className = "subtitle";
-    this.titlesElement.appendChild(this.subtitleElement);
+this.subtitleElement = document.createElement("span");
+this.subtitleElement.className = "subtitle";
+this.titlesElement.appendChild(this.subtitleElement);
 
-    this.className = className;
-    this.mainTitle = title;
-    this.subtitle = subtitle;
+this.className = className;
+this.mainTitle = title;
+this.subtitle = subtitle;
 }
 
 WebInspector.SidebarTreeElement.prototype = {
-    get small()
-    {
-        return this._small;
-    },
+get small()
+{
+return this._small;
+},
 
-    set small(x)
-    {
-        this._small = x;
+set small(x)
+{
+this._small = x;
 
-        if (this._listItemNode) {
-            if (this._small)
-                this._listItemNode.addStyleClass("small");
-            else
-                this._listItemNode.removeStyleClass("small");
-        }
-    },
+if (this._listItemNode) {
+if (this._small)
+this._listItemNode.addStyleClass("small");
+else
+this._listItemNode.removeStyleClass("small");
+}
+},
 
-    get mainTitle()
-    {
-        return this._mainTitle;
-    },
+get mainTitle()
+{
+return this._mainTitle;
+},
 
-    set mainTitle(x)
-    {
-        this._mainTitle = x;
-        this.refreshTitles();
-    },
+set mainTitle(x)
+{
+this._mainTitle = x;
+this.refreshTitles();
+},
 
-    get subtitle()
-    {
-        return this._subtitle;
-    },
+get subtitle()
+{
+return this._subtitle;
+},
 
-    set subtitle(x)
-    {
-        this._subtitle = x;
-        this.refreshTitles();
-    },
+set subtitle(x)
+{
+this._subtitle = x;
+this.refreshTitles();
+},
 
-    get bubbleText()
-    {
-        return this._bubbleText;
-    },
+get bubbleText()
+{
+return this._bubbleText;
+},
 
-    set bubbleText(x)
-    {
-        if (!this.bubbleElement) {
-            this.bubbleElement = document.createElement("div");
-            this.bubbleElement.className = "bubble";
-            this.statusElement.appendChild(this.bubbleElement);
-        }
+set bubbleText(x)
+{
+if (!this.bubbleElement) {
+this.bubbleElement = document.createElement("div");
+this.bubbleElement.className = "bubble";
+this.statusElement.appendChild(this.bubbleElement);
+}
 
-        this._bubbleText = x;
-        this.bubbleElement.textContent = x;
-    },
+this._bubbleText = x;
+this.bubbleElement.textContent = x;
+},
 
-    refreshTitles: function()
-    {
-        var mainTitle = this.mainTitle;
-        if (this.titleElement.textContent !== mainTitle)
-            this.titleElement.textContent = mainTitle;
+refreshTitles: function()
+{
+var mainTitle = this.mainTitle;
+if (this.titleElement.textContent !== mainTitle)
+this.titleElement.textContent = mainTitle;
 
-        var subtitle = this.subtitle;
-        if (subtitle) {
-            if (this.subtitleElement.textContent !== subtitle)
-                this.subtitleElement.textContent = subtitle;
-            this.titlesElement.removeStyleClass("no-subtitle");
-        } else
-            this.titlesElement.addStyleClass("no-subtitle");
-    },
+var subtitle = this.subtitle;
+if (subtitle) {
+if (this.subtitleElement.textContent !== subtitle)
+this.subtitleElement.textContent = subtitle;
+this.titlesElement.removeStyleClass("no-subtitle");
+} else
+this.titlesElement.addStyleClass("no-subtitle");
+},
 
-    isEventWithinDisclosureTriangle: function(event)
-    {
-        return event.target === this.disclosureButton;
-    },
+isEventWithinDisclosureTriangle: function(event)
+{
+return event.target === this.disclosureButton;
+},
 
-    onattach: function()
-    {
-        this._listItemNode.addStyleClass("sidebar-tree-item");
+onattach: function()
+{
+this._listItemNode.addStyleClass("sidebar-tree-item");
 
-        if (this.className)
-            this._listItemNode.addStyleClass(this.className);
+if (this.className)
+this._listItemNode.addStyleClass(this.className);
 
-        if (this.small)
-            this._listItemNode.addStyleClass("small");
+if (this.small)
+this._listItemNode.addStyleClass("small");
 
-        if (this.hasChildren && this.disclosureButton)
-            this._listItemNode.appendChild(this.disclosureButton);
+if (this.hasChildren && this.disclosureButton)
+this._listItemNode.appendChild(this.disclosureButton);
 
-        this._listItemNode.appendChild(this.iconElement);
-        this._listItemNode.appendChild(this.statusElement);
-        this._listItemNode.appendChild(this.titlesElement);
-    },
+this._listItemNode.appendChild(this.iconElement);
+this._listItemNode.appendChild(this.statusElement);
+this._listItemNode.appendChild(this.titlesElement);
+},
 
-    onreveal: function()
-    {
-        if (this._listItemNode)
-            this._listItemNode.scrollIntoViewIfNeeded(false);
-    }
+onreveal: function()
+{
+if (this._listItemNode)
+this._listItemNode.scrollIntoViewIfNeeded(false);
+}
 }
 
 WebInspector.SidebarTreeElement.prototype.__proto__ = TreeElement.prototype;
 
-/* Section.js */
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.Section = function(title, subtitle)
 {
-    this.element = document.createElement("div");
-    this.element.className = "section";
-    this.element.sectionForTest = this;
+this.element = document.createElement("div");
+this.element.className = "section";
+this.element.sectionForTest = this;
 
-    this.headerElement = document.createElement("div");
-    this.headerElement.className = "header";
+this.headerElement = document.createElement("div");
+this.headerElement.className = "header";
 
-    this.titleElement = document.createElement("div");
-    this.titleElement.className = "title";
+this.titleElement = document.createElement("div");
+this.titleElement.className = "title";
 
-    this.subtitleElement = document.createElement("div");
-    this.subtitleElement.className = "subtitle";
+this.subtitleElement = document.createElement("div");
+this.subtitleElement.className = "subtitle";
 
-    this.headerElement.appendChild(this.subtitleElement);
-    this.headerElement.appendChild(this.titleElement);
+this.headerElement.appendChild(this.subtitleElement);
+this.headerElement.appendChild(this.titleElement);
 
-    this.headerElement.addEventListener("click", this.toggleExpanded.bind(this), false);
-    this.element.appendChild(this.headerElement);
+this.headerElement.addEventListener("click", this.toggleExpanded.bind(this), false);
+this.element.appendChild(this.headerElement);
 
-    this.title = title;
-    this.subtitle = subtitle;
-    this._expanded = false;
+this.title = title;
+this.subtitle = subtitle;
+this._expanded = false;
 }
 
 WebInspector.Section.prototype = {
-    get title()
-    {
-        return this._title;
-    },
+get title()
+{
+return this._title;
+},
 
-    set title(x)
-    {
-        if (this._title === x)
-            return;
-        this._title = x;
+set title(x)
+{
+if (this._title === x)
+return;
+this._title = x;
 
-        if (x instanceof Node) {
-            this.titleElement.removeChildren();
-            this.titleElement.appendChild(x);
-        } else
-          this.titleElement.textContent = x;
-    },
+if (x instanceof Node) {
+this.titleElement.removeChildren();
+this.titleElement.appendChild(x);
+} else
+this.titleElement.textContent = x;
+},
 
-    get subtitle()
-    {
-        return this._subtitle;
-    },
+get subtitle()
+{
+return this._subtitle;
+},
 
-    set subtitle(x)
-    {
-        if (this._subtitle === x)
-            return;
-        this._subtitle = x;
-        this.subtitleElement.innerHTML = x;
-    },
+set subtitle(x)
+{
+if (this._subtitle === x)
+return;
+this._subtitle = x;
+this.subtitleElement.textContent = x;
+},
 
-    get expanded()
-    {
-        return this._expanded;
-    },
+get subtitleAsTextForTest()
 
-    set expanded(x)
-    {
-        if (x)
-            this.expand();
-        else
-            this.collapse();
-    },
+{
 
-    get populated()
-    {
-        return this._populated;
-    },
+var result = this.subtitleElement.textContent;
 
-    set populated(x)
-    {
-        this._populated = x;
-        if (!x && this.onpopulate && this._expanded) {
-            this.onpopulate(this);
-            this._populated = true;
-        }
-    },
+var child = this.subtitleElement.querySelector("[data-uncopyable]");
 
-    expand: function()
-    {
-        if (this._expanded)
-            return;
-        this._expanded = true;
-        this.element.addStyleClass("expanded");
+if (child) {
 
-        if (!this._populated && this.onpopulate) {
-            this.onpopulate(this);
-            this._populated = true;
-        }
-    },
+var linkData = child.getAttribute("data-uncopyable");
 
-    collapse: function()
-    {
-        if (!this._expanded)
-            return;
-        this._expanded = false;
-        this.element.removeStyleClass("expanded");
-    },
+if (linkData)
 
-    toggleExpanded: function()
-    {
-        this.expanded = !this.expanded;
-    }
+result += linkData;
+
 }
 
-/* PropertiesSection.js */
+return result;
+},
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Google Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+get expanded()
+{
+return this._expanded;
+},
+
+set expanded(x)
+{
+if (x)
+this.expand();
+else
+this.collapse();
+},
+
+get populated()
+{
+return this._populated;
+},
+
+set populated(x)
+{
+this._populated = x;
+if (!x && this.onpopulate && this._expanded) {
+this.onpopulate(this);
+this._populated = true;
+}
+},
+
+expand: function()
+{
+if (this._expanded)
+return;
+this._expanded = true;
+this.element.addStyleClass("expanded");
+
+if (!this._populated && this.onpopulate) {
+this.onpopulate(this);
+this._populated = true;
+}
+},
+
+collapse: function()
+{
+if (!this._expanded)
+return;
+this._expanded = false;
+this.element.removeStyleClass("expanded");
+},
+
+toggleExpanded: function()
+{
+this.expanded = !this.expanded;
+}
+}
+
+
+
+
 
 WebInspector.PropertiesSection = function(title, subtitle)
 {
-    WebInspector.Section.call(this, title, subtitle);
+WebInspector.Section.call(this, title, subtitle);
 
-    this.propertiesElement = document.createElement("ol");
-    this.propertiesElement.className = "properties source-code";
-    this.propertiesElement.tabIndex = 0;
-    this.propertiesTreeOutline = new TreeOutline(this.propertiesElement);
-    this.propertiesTreeOutline.section = this;
+this.headerElement.addStyleClass("monospace");
+this.propertiesElement = document.createElement("ol");
+this.propertiesElement.className = "properties properties-tree monospace";
+this.propertiesElement.tabIndex = 0;
+this.propertiesTreeOutline = new TreeOutline(this.propertiesElement);
+this.propertiesTreeOutline.section = this;
 
-    this.element.appendChild(this.propertiesElement);
+this.element.appendChild(this.propertiesElement);
 }
 
 WebInspector.PropertiesSection.prototype.__proto__ = WebInspector.Section.prototype;
 
-/* ObjectProxy.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.ObjectProxy = function(injectedScriptId, objectId, path, description, hasChildren)
+
+
+WebInspector.RemoteObject = function(objectId, type, description, hasChildren)
 {
-    this.objectId = objectId;
-    this.injectedScriptId = injectedScriptId;
-    this.path = path || [];
-    this.description = description;
-    this.hasChildren = hasChildren;
+this._objectId = objectId;
+this._type = type;
+this._description = description;
+this._hasChildren = hasChildren;
 }
 
-WebInspector.ObjectProxy.wrapPrimitiveValue = function(value)
+WebInspector.RemoteObject.fromPrimitiveValue = function(value)
 {
-    var proxy = new WebInspector.ObjectProxy();
-    proxy.type = typeof value;
-    proxy.description = value;
-    return proxy;
+return new WebInspector.RemoteObject(null, typeof value, value);
 }
 
-WebInspector.ObjectProxy.getPropertiesAsync = function(objectProxy, propertiesToQueryFor, callback)
+WebInspector.RemoteObject.fromLocalObject = function(value)
 {
-    function createPropertiesMapThenCallback(propertiesPayload)
-    {
-        if (!propertiesPayload) {
-            callback();
-            return;
-        }
-
-        var result = [];
-        for (var i = 0; i < propertiesPayload.length; ++i)
-            if (propertiesToQueryFor.indexOf(propertiesPayload[i].name) !== -1)
-                result[propertiesPayload[i].name] = propertiesPayload[i].value.description;
-        callback(result);
-    };
-    InjectedScriptAccess.get(objectProxy.injectedScriptId).getProperties(objectProxy, true, false, createPropertiesMapThenCallback);
+return new WebInspector.LocalJSONObject(value);
 }
 
-WebInspector.ObjectPropertyProxy = function(name, value)
+WebInspector.RemoteObject.resolveNode = function(node, callback)
 {
-    this.name = name;
-    this.value = value;
+function mycallback(object)
+{
+callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
+}
+InjectedScriptAccess.getForNode(node).resolveNode(node.id, mycallback);
 }
 
-/* ObjectPropertiesSection.js */
+WebInspector.RemoteObject.fromPayload = function(payload)
+{
+if (typeof payload === "object")
+return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.description, payload.hasChildren);
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+return payload;
+}
+
+WebInspector.RemoteObject.type = function(remoteObject)
+{
+if (remoteObject === null)
+return "null";
+
+var type = typeof remoteObject;
+if (type !== "object" && type !== "function")
+return type;
+
+return remoteObject.type;
+}
+
+WebInspector.RemoteObject.prototype = {
+get objectId()
+{
+return this._objectId;
+},
+
+get type()
+{
+return this._type;
+},
+
+get description()
+{
+return this._description;
+},
+
+get hasChildren()
+{
+return this._hasChildren;
+},
+
+isError: function()
+{
+return this._type === "error";
+},
+
+getOwnProperties: function(abbreviate, callback)
+{
+this.getProperties(false, abbreviate, callback);
+},
+
+getProperties: function(ignoreHasOwnProperty, abbreviate, callback)
+{
+if (!this._objectId) {
+callback([]);
+return;
+}
+function remoteObjectBinder(properties)
+{
+for (var i = 0; properties && i < properties.length; ++i)
+properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
+callback(properties);
+}
+InjectedScriptAccess.getForObjectId(this._objectId).getProperties(this._objectId, ignoreHasOwnProperty, abbreviate, remoteObjectBinder);
+},
+
+setPropertyValue: function(name, value, callback)
+{
+if (!this._objectId) {
+callback(false);
+return;
+}
+InjectedScriptAccess.getForObjectId(this._objectId).setPropertyValue(this._objectId, name, value, callback);
+},
+
+pushNodeToFrontend: function(callback)
+{
+InjectedScriptAccess.getForObjectId(this._objectId).pushNodeToFrontend(this._objectId, callback);
+}
+}
+
+WebInspector.RemoteObjectProperty = function(name, value)
+{
+this.name = name;
+this.value = value;
+}
+
+
+
+
+
+
+
+WebInspector.LocalJSONObject = function(value)
+{
+this._value = value;
+}
+
+WebInspector.LocalJSONObject.prototype = {
+get description()
+{
+var type = this.type;
+switch (type) {
+case "array":
+return "[" + this._value.length + "]";
+case "object":
+return this.hasChildren ? "{...}" : "{ }";
+default:
+return JSON.stringify(this._value);
+}
+},
+
+get type()
+{
+if (this._value === null)
+return "null";
+if (this._value instanceof Array)
+return "array";
+return typeof this._value;
+},
+
+get hasChildren()
+{
+return typeof this._value === "object" && this._value !== null && Object.keys(this._value).length;
+},
+
+getOwnProperties: function(abbreviate, callback)
+{
+return this.getProperties(false, abbreviate, callback);
+},
+
+getProperties: function(ignoreHasOwnProperty, abbreviate, callback)
+{
+function buildProperty(propName)
+{
+return new WebInspector.RemoteObjectProperty(propName, new WebInspector.LocalJSONObject(this._value[propName]));
+}
+callback(Object.keys(this._value).map(buildProperty.bind(this)));
+},
+
+isError: function()
+{
+return false;
+}
+}
+
+
+
+
 
 WebInspector.ObjectPropertiesSection = function(object, title, subtitle, emptyPlaceholder, ignoreHasOwnProperty, extraProperties, treeElementConstructor)
 {
-    this.emptyPlaceholder = (emptyPlaceholder || WebInspector.UIString("No Properties"));
-    this.object = object;
-    this.ignoreHasOwnProperty = ignoreHasOwnProperty;
-    this.extraProperties = extraProperties;
-    this.treeElementConstructor = treeElementConstructor || WebInspector.ObjectPropertyTreeElement;
-    this.editable = true;
+this.emptyPlaceholder = (emptyPlaceholder || WebInspector.UIString("No Properties"));
+this.object = object;
+this.ignoreHasOwnProperty = ignoreHasOwnProperty;
+this.extraProperties = extraProperties;
+this.treeElementConstructor = treeElementConstructor || WebInspector.ObjectPropertyTreeElement;
+this.editable = true;
 
-    WebInspector.PropertiesSection.call(this, title, subtitle);
+WebInspector.PropertiesSection.call(this, title, subtitle);
 }
 
 WebInspector.ObjectPropertiesSection.prototype = {
-    onpopulate: function()
-    {
-        this.update();
-    },
+onpopulate: function()
+{
+this.update();
+},
 
-    update: function()
-    {
-        var self = this;
-        var callback = function(properties) {
-            if (!properties)
-                return;
-            self.updateProperties(properties);
-        };
-        InjectedScriptAccess.get(this.object.injectedScriptId).getProperties(this.object, this.ignoreHasOwnProperty, true, callback);
-    },
+update: function()
+{
+var self = this;
+var callback = function(properties) {
+if (!properties)
+return;
+self.updateProperties(properties);
+};
+this.object.getProperties(this.ignoreHasOwnProperty, true, callback);
+},
 
-    updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer)
-    {
-        if (!rootTreeElementConstructor)
-            rootTreeElementConstructor = this.treeElementConstructor;
-            
-        if (!rootPropertyComparer)
-            rootPropertyComparer = WebInspector.ObjectPropertiesSection.CompareProperties;
-            
-        if (this.extraProperties)
-            for (var i = 0; i < this.extraProperties.length; ++i)
-                properties.push(this.extraProperties[i]);
-                
-        properties.sort(rootPropertyComparer);
+updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer)
+{
+if (!rootTreeElementConstructor)
+rootTreeElementConstructor = this.treeElementConstructor;
 
-        this.propertiesTreeOutline.removeChildren();
+if (!rootPropertyComparer)
+rootPropertyComparer = WebInspector.ObjectPropertiesSection.CompareProperties;
 
-        for (var i = 0; i < properties.length; ++i)
-            this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i]));
+if (this.extraProperties)
+for (var i = 0; i < this.extraProperties.length; ++i)
+properties.push(this.extraProperties[i]);
 
-        if (!this.propertiesTreeOutline.children.length) {
-            var title = "<div class=\"info\">" + this.emptyPlaceholder + "</div>";
-            var infoElement = new TreeElement(title, null, false);
-            this.propertiesTreeOutline.appendChild(infoElement);
-        }
-        this.propertiesForTest = properties;
-    }
+properties.sort(rootPropertyComparer);
+
+this.propertiesTreeOutline.removeChildren();
+
+for (var i = 0; i < properties.length; ++i) {
+properties[i].parentObject = this.object;
+this.propertiesTreeOutline.appendChild(new rootTreeElementConstructor(properties[i]));
+}
+
+if (!this.propertiesTreeOutline.children.length) {
+var title = "<div class=\"info\">" + this.emptyPlaceholder + "</div>";
+var infoElement = new TreeElement(null, null, false);
+infoElement.titleHTML = title;
+this.propertiesTreeOutline.appendChild(infoElement);
+}
+this.propertiesForTest = properties;
+}
 }
 
 WebInspector.ObjectPropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
 
 WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, propertyB) 
 {
-    var a = propertyA.name;
-    var b = propertyB.name;
-    if (a === "__proto__")
-        return 1;
-    if (b === "__proto__")
-        return -1;
+var a = propertyA.name;
+var b = propertyB.name;
+if (a === "__proto__")
+return 1;
+if (b === "__proto__")
+return -1;
 
-    // if used elsewhere make sure to
-    //  - convert a and b to strings (not needed here, properties are all strings)
-    //  - check if a == b (not needed here, no two properties can be the same)
 
-    var diff = 0;
-    var chunk = /^\d+|^\D+/;
-    var chunka, chunkb, anum, bnum;
-    while (diff === 0) {
-        if (!a && b)
-            return -1;
-        if (!b && a)
-            return 1;
-        chunka = a.match(chunk)[0];
-        chunkb = b.match(chunk)[0];
-        anum = !isNaN(chunka);
-        bnum = !isNaN(chunkb);
-        if (anum && !bnum)
-            return -1;
-        if (bnum && !anum)
-            return 1;
-        if (anum && bnum) {
-            diff = chunka - chunkb;
-            if (diff === 0 && chunka.length !== chunkb.length) {
-                if (!+chunka && !+chunkb) // chunks are strings of all 0s (special case)
-                    return chunka.length - chunkb.length;
-                else
-                    return chunkb.length - chunka.length;
-            }
-        } else if (chunka !== chunkb)
-            return (chunka < chunkb) ? -1 : 1;
-        a = a.substring(chunka.length);
-        b = b.substring(chunkb.length);
-    }
-    return diff;
+
+
+
+var diff = 0;
+var chunk = /^\d+|^\D+/;
+var chunka, chunkb, anum, bnum;
+while (diff === 0) {
+if (!a && b)
+return -1;
+if (!b && a)
+return 1;
+chunka = a.match(chunk)[0];
+chunkb = b.match(chunk)[0];
+anum = !isNaN(chunka);
+bnum = !isNaN(chunkb);
+if (anum && !bnum)
+return -1;
+if (bnum && !anum)
+return 1;
+if (anum && bnum) {
+diff = chunka - chunkb;
+if (diff === 0 && chunka.length !== chunkb.length) {
+if (!+chunka && !+chunkb) 
+return chunka.length - chunkb.length;
+else
+return chunkb.length - chunka.length;
+}
+} else if (chunka !== chunkb)
+return (chunka < chunkb) ? -1 : 1;
+a = a.substring(chunka.length);
+b = b.substring(chunkb.length);
+}
+return diff;
 }
 
 WebInspector.ObjectPropertyTreeElement = function(property)
 {
-    this.property = property;
+this.property = property;
 
-    // Pass an empty title, the title gets made later in onattach.
-    TreeElement.call(this, "", null, false);
+
+TreeElement.call(this, "", null, false);
 }
 
 WebInspector.ObjectPropertyTreeElement.prototype = {
-    onpopulate: function()
-    {
-        if (this.children.length && !this.shouldRefreshChildren)
-            return;
+onpopulate: function()
+{
+if (this.children.length && !this.shouldRefreshChildren)
+return;
 
-        var callback = function(properties) {
-            this.removeChildren();
-            if (!properties)
-                return;
+var callback = function(properties) {
+this.removeChildren();
+if (!properties)
+return;
 
-            properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
-            for (var i = 0; i < properties.length; ++i) {
-                this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i]));
-            }
-        };
-        InjectedScriptAccess.get(this.property.value.injectedScriptId).getProperties(this.property.value, false, true, callback.bind(this));
-    },
+properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
+for (var i = 0; i < properties.length; ++i) {
+this.appendChild(new this.treeOutline.section.treeElementConstructor(properties[i]));
+}
+};
+this.property.value.getOwnProperties(true, callback.bind(this));
+},
 
-    ondblclick: function(event)
-    {
-        this.startEditing();
-    },
+ondblclick: function(event)
+{
+this.startEditing();
+},
 
-    onattach: function()
-    {
-        this.update();
-    },
+onattach: function()
+{
+this.update();
+},
 
-    update: function()
-    {
-        this.nameElement = document.createElement("span");
-        this.nameElement.className = "name";
-        this.nameElement.textContent = this.property.name;
+update: function()
+{
+this.nameElement = document.createElement("span");
+this.nameElement.className = "name";
+this.nameElement.textContent = this.property.name;
 
-        var separatorElement = document.createElement("span");
-        separatorElement.className = "separator";
-        separatorElement.textContent = ": ";
-        
-        this.valueElement = document.createElement("span");
-        this.valueElement.className = "value";
-        this.valueElement.textContent = this.property.value.description;
-        if (typeof this.property.value.propertyLength !== "undefined")
-            this.valueElement.textContent += " (" + this.property.value.propertyLength + ")";
-        if (this.property.isGetter)
-            this.valueElement.addStyleClass("dimmed");
-        if (this.property.isError)
-            this.valueElement.addStyleClass("error");
+var separatorElement = document.createElement("span");
+separatorElement.className = "separator";
+separatorElement.textContent = ": ";
 
-        this.listItemElement.removeChildren();
+this.valueElement = document.createElement("span");
+this.valueElement.className = "value";
+this.valueElement.textContent = this.property.value.description;
+if (this.property.isGetter)
+this.valueElement.addStyleClass("dimmed");
+if (this.property.value.isError())
+this.valueElement.addStyleClass("error");
+if (this.property.value.type)
+this.valueElement.addStyleClass("console-formatted-" + this.property.value.type);
+if (this.property.value.type === "node")
+this.valueElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
 
-        this.listItemElement.appendChild(this.nameElement);
-        this.listItemElement.appendChild(separatorElement);
-        this.listItemElement.appendChild(this.valueElement);
-        this.hasChildren = this.property.value.hasChildren;
-    },
+this.listItemElement.removeChildren();
 
-    updateSiblings: function()
-    {
-        if (this.parent.root)
-            this.treeOutline.section.update();
-        else
-            this.parent.shouldRefreshChildren = true;
-    },
+this.listItemElement.appendChild(this.nameElement);
+this.listItemElement.appendChild(separatorElement);
+this.listItemElement.appendChild(this.valueElement);
+this.hasChildren = this.property.value.hasChildren;
+},
 
-    startEditing: function()
-    {
-        if (WebInspector.isBeingEdited(this.valueElement) || !this.treeOutline.section.editable)
-            return;
+_contextMenuEventFired: function()
+{
+function selectNode(nodeId)
+{
+if (nodeId) {
+WebInspector.currentPanel = WebInspector.panels.elements;
+WebInspector.panels.elements.focusedDOMNode = WebInspector.domAgent.nodeForId(nodeId);
+}
+}
 
-        var context = { expanded: this.expanded };
+function revealElement()
+{
+this.property.value.pushNodeToFrontend(selectNode);
+}
 
-        // Lie about our children to prevent expanding on double click and to collapse subproperties.
-        this.hasChildren = false;
+var contextMenu = new WebInspector.ContextMenu();
+contextMenu.appendItem(WebInspector.UIString("Reveal in Elements Panel"), revealElement.bind(this));
+contextMenu.show(event);
+},
 
-        this.listItemElement.addStyleClass("editing-sub-part");
+updateSiblings: function()
+{
+if (this.parent.root)
+this.treeOutline.section.update();
+else
+this.parent.shouldRefreshChildren = true;
+},
 
-        WebInspector.startEditing(this.valueElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
-    },
+startEditing: function()
+{
+if (WebInspector.isBeingEdited(this.valueElement) || !this.treeOutline.section.editable)
+return;
 
-    editingEnded: function(context)
-    {
-        this.listItemElement.scrollLeft = 0;
-        this.listItemElement.removeStyleClass("editing-sub-part");
-        if (context.expanded)
-            this.expand();
-    },
+var context = { expanded: this.expanded };
 
-    editingCancelled: function(element, context)
-    {
-        this.update();
-        this.editingEnded(context);
-    },
 
-    editingCommitted: function(element, userInput, previousContent, context)
-    {
-        if (userInput === previousContent)
-            return this.editingCancelled(element, context); // nothing changed, so cancel
+this.hasChildren = false;
 
-        this.applyExpression(userInput, true);
+this.listItemElement.addStyleClass("editing-sub-part");
 
-        this.editingEnded(context);
-    },
+WebInspector.startEditing(this.valueElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
+},
 
-    applyExpression: function(expression, updateInterface)
-    {
-        expression = expression.trim();
-        var expressionLength = expression.length;
-        var self = this;
-        var callback = function(success) {
-            if (!updateInterface)
-                return;
+editingEnded: function(context)
+{
+this.listItemElement.scrollLeft = 0;
+this.listItemElement.removeStyleClass("editing-sub-part");
+if (context.expanded)
+this.expand();
+},
 
-            if (!success)
-                self.update();
+editingCancelled: function(element, context)
+{
+this.update();
+this.editingEnded(context);
+},
 
-            if (!expressionLength) {
-                // The property was deleted, so remove this tree element.
-                self.parent.removeChild(this);
-            } else {
-                // Call updateSiblings since their value might be based on the value that just changed.
-                self.updateSiblings();
-            }
-        };
-        InjectedScriptAccess.get(this.property.parentObjectProxy.injectedScriptId).setPropertyValue(this.property.parentObjectProxy, this.property.name, expression.trim(), callback);
-    }
+editingCommitted: function(element, userInput, previousContent, context)
+{
+if (userInput === previousContent)
+return this.editingCancelled(element, context); 
+
+this.applyExpression(userInput, true);
+
+this.editingEnded(context);
+},
+
+applyExpression: function(expression, updateInterface)
+{
+expression = expression.trim();
+var expressionLength = expression.length;
+var self = this;
+var callback = function(success) {
+if (!updateInterface)
+return;
+
+if (!success)
+self.update();
+
+if (!expressionLength) {
+
+self.parent.removeChild(this);
+} else {
+
+self.updateSiblings();
+}
+};
+this.property.parentObject.setPropertyValue(this.property.name, expression.trim(), callback);
+}
 }
 
 WebInspector.ObjectPropertyTreeElement.prototype.__proto__ = TreeElement.prototype;
 
-/* BreakpointsSidebarPane.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.BreakpointsSidebarPane = function()
+
+
+WebInspector.BreakpointsSidebarPane = function(title)
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
+WebInspector.SidebarPane.call(this, title);
 
-    this.breakpoints = {};
+this.listElement = document.createElement("ol");
+this.listElement.className = "breakpoint-list";
 
-    this.listElement = document.createElement("ol");
-    this.listElement.className = "breakpoint-list";
+this.emptyElement = document.createElement("div");
+this.emptyElement.className = "info";
+this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");
 
-    this.emptyElement = document.createElement("div");
-    this.emptyElement.className = "info";
-    this.emptyElement.textContent = WebInspector.UIString("No Breakpoints");
-
-    this.bodyElement.appendChild(this.emptyElement);
+this.bodyElement.appendChild(this.emptyElement);
 }
 
 WebInspector.BreakpointsSidebarPane.prototype = {
-    reset: function()
-    {
-        this.breakpoints = {};
-        this.listElement.removeChildren();
-        if (this.listElement.parentElement) {
-            this.bodyElement.removeChild(this.listElement);
-            this.bodyElement.appendChild(this.emptyElement);
-        }
-    },
+reset: function()
+{
+this.listElement.removeChildren();
+if (this.listElement.parentElement) {
+this.bodyElement.removeChild(this.listElement);
+this.bodyElement.appendChild(this.emptyElement);
+}
+},
 
-    addBreakpoint: function(breakpoint)
-    {
-        if (this.breakpoints[breakpoint.id])
-            return;
+addBreakpointItem: function(breakpointItem)
+{
+var element = breakpointItem.element;
+element._breakpointItem = breakpointItem;
 
-        this.breakpoints[breakpoint.id] = breakpoint;
+breakpointItem.addEventListener("breakpoint-hit", this.expand, this);
+breakpointItem.addEventListener("removed", this._removeListElement.bind(this, element), this);
 
-        breakpoint.addEventListener("enabled", this._breakpointEnableChanged, this);
-        breakpoint.addEventListener("disabled", this._breakpointEnableChanged, this);
-        breakpoint.addEventListener("text-changed", this._breakpointTextChanged, this);
+var currentElement = this.listElement.firstChild;
+while (currentElement) {
+if (currentElement._breakpointItem && currentElement._breakpointItem.compareTo(element._breakpointItem) > 0)
+break;
+currentElement = currentElement.nextSibling;
+}
+this._addListElement(element, currentElement);
 
-        this._appendBreakpointElement(breakpoint);
+if (breakpointItem.click) {
+element.addStyleClass("cursor-pointer");
+element.addEventListener("click", breakpointItem.click.bind(breakpointItem), false);
+}
+element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointItem), true);
+},
 
-        if (this.emptyElement.parentElement) {
-            this.bodyElement.removeChild(this.emptyElement);
-            this.bodyElement.appendChild(this.listElement);
-        }
+_contextMenuEventFired: function(breakpointItem, event)
+{
+var contextMenu = new WebInspector.ContextMenu();
+contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpointItem.remove.bind(breakpointItem));
+contextMenu.show(event);
+},
 
-        InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
-    },
+_addListElement: function(element, beforeElement)
+{
+if (beforeElement)
+this.listElement.insertBefore(element, beforeElement);
+else {
+if (!this.listElement.firstChild) {
+this.bodyElement.removeChild(this.emptyElement);
+this.bodyElement.appendChild(this.listElement);
+}
+this.listElement.appendChild(element);
+}
+},
 
-    _appendBreakpointElement: function(breakpoint)
-    {
-        function checkboxClicked(event)
-        {
-            breakpoint.enabled = !breakpoint.enabled;
-
-            // without this, we'd switch to the source of the clicked breakpoint
-            event.stopPropagation();
-        }
-
-        function breakpointClicked()
-        {
-            var script = WebInspector.panels.scripts.scriptOrResourceForID(breakpoint.sourceID);
-            if (script)
-                WebInspector.panels.scripts.showScript(script, breakpoint.line);
-        }
-
-        var breakpointElement = document.createElement("li");
-        breakpoint._breakpointListElement = breakpointElement;
-        breakpointElement._breakpointObject = breakpoint;
-        breakpointElement.addEventListener("click", breakpointClicked, false);
-
-        var checkboxElement = document.createElement("input");
-        checkboxElement.className = "checkbox-elem";
-        checkboxElement.type = "checkbox";
-        checkboxElement.checked = breakpoint.enabled;
-        checkboxElement.addEventListener("click", checkboxClicked, false);
-        breakpointElement.appendChild(checkboxElement);
-
-        var labelElement = document.createTextNode(breakpoint.label);
-        breakpointElement.appendChild(labelElement);
-
-        var sourceTextElement = document.createElement("div");
-        sourceTextElement.textContent = breakpoint.sourceText;
-        sourceTextElement.className = "source-text monospace";
-        breakpointElement.appendChild(sourceTextElement);
-
-        var currentElement = this.listElement.firstChild;
-        while (currentElement) {
-            var currentBreak = currentElement._breakpointObject;
-            if (currentBreak.url > breakpoint.url) {
-                this.listElement.insertBefore(breakpointElement, currentElement);
-                return;
-            } else if (currentBreak.url == breakpoint.url && currentBreak.line > breakpoint.line) {
-                this.listElement.insertBefore(breakpointElement, currentElement);
-                return;
-            }
-            currentElement = currentElement.nextSibling;
-        }
-        this.listElement.appendChild(breakpointElement);
-    },
-
-    removeBreakpoint: function(breakpoint)
-    {
-        if (!this.breakpoints[breakpoint.id])
-            return;
-        delete this.breakpoints[breakpoint.id];
-
-        breakpoint.removeEventListener("enabled", null, this);
-        breakpoint.removeEventListener("disabled", null, this);
-        breakpoint.removeEventListener("text-changed", null, this);
-
-        var element = breakpoint._breakpointListElement;
-        element.parentElement.removeChild(element);
-
-        if (!this.listElement.firstChild) {
-            this.bodyElement.removeChild(this.listElement);
-            this.bodyElement.appendChild(this.emptyElement);
-        }
-
-        InspectorBackend.removeBreakpoint(breakpoint.sourceID, breakpoint.line);
-    },
-
-    _breakpointEnableChanged: function(event)
-    {
-        var breakpoint = event.target;
-
-        var checkbox = breakpoint._breakpointListElement.firstChild;
-        checkbox.checked = breakpoint.enabled;
-        InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition);
-    },
-
-    _breakpointTextChanged: function(event)
-    {
-        var breakpoint = event.target;
-
-        var sourceTextElement = breakpoint._breakpointListElement.firstChild.nextSibling.nextSibling;
-        sourceTextElement.textContent = breakpoint.sourceText;
-    }
+_removeListElement: function(element)
+{
+this.listElement.removeChild(element);
+if (!this.listElement.firstChild) {
+this.bodyElement.removeChild(this.listElement);
+this.bodyElement.appendChild(this.emptyElement);
+}
+}
 }
 
 WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-/* CallStackSidebarPane.js */
+WebInspector.XHRBreakpointsSidebarPane = function()
+{
+WebInspector.BreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+function addButtonClicked(event)
+{
+event.stopPropagation();
+this._startEditingBreakpoint(null);
+}
+
+var addButton = document.createElement("button");
+addButton.className = "add";
+addButton.addEventListener("click", addButtonClicked.bind(this), false);
+this.titleElement.appendChild(addButton);
+}
+
+WebInspector.XHRBreakpointsSidebarPane.prototype = {
+addBreakpointItem: function(breakpointItem)
+{
+WebInspector.BreakpointsSidebarPane.prototype.addBreakpointItem.call(this, breakpointItem);
+breakpointItem._labelElement.addEventListener("dblclick", this._startEditingBreakpoint.bind(this, breakpointItem), false);
+},
+
+_startEditingBreakpoint: function(breakpointItem)
+{
+if (this._editingBreakpoint)
+return;
+this._editingBreakpoint = true;
+
+if (!this.expanded)
+this.expanded = true;
+
+var inputElement = document.createElement("span");
+inputElement.className = "breakpoint-condition editing";
+if (breakpointItem) {
+breakpointItem.populateEditElement(inputElement);
+this.listElement.insertBefore(inputElement, breakpointItem.element);
+breakpointItem.element.addStyleClass("hidden");
+} else
+this._addListElement(inputElement, this.listElement.firstChild);
+
+var commitHandler = this._hideEditBreakpointDialog.bind(this, inputElement, true, breakpointItem);
+var cancelHandler = this._hideEditBreakpointDialog.bind(this, inputElement, false, breakpointItem);
+WebInspector.startEditing(inputElement, commitHandler, cancelHandler);
+},
+
+_hideEditBreakpointDialog: function(inputElement, accept, breakpointItem)
+{
+this._removeListElement(inputElement);
+this._editingBreakpoint = false;
+if (accept) {
+if (breakpointItem)
+breakpointItem.remove();
+WebInspector.breakpointManager.createXHRBreakpoint(inputElement.textContent.toLowerCase());
+} else if (breakpointItem)
+breakpointItem.element.removeStyleClass("hidden");
+}
+}
+
+WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.BreakpointsSidebarPane.prototype;
+
+WebInspector.BreakpointItem = function(breakpoint)
+{
+this._breakpoint = breakpoint;
+
+this._element = document.createElement("li");
+
+var checkboxElement = document.createElement("input");
+checkboxElement.className = "checkbox-elem";
+checkboxElement.type = "checkbox";
+checkboxElement.checked = this._breakpoint.enabled;
+checkboxElement.addEventListener("click", this._checkboxClicked.bind(this), false);
+this._element.appendChild(checkboxElement);
+
+this._createLabelElement();
+
+this._breakpoint.addEventListener("enable-changed", this._enableChanged, this);
+this._breakpoint.addEventListener("hit-state-changed", this._hitStateChanged, this);
+this._breakpoint.addEventListener("label-changed", this._labelChanged, this);
+this._breakpoint.addEventListener("removed", this.dispatchEventToListeners.bind(this, "removed"));
+if (breakpoint.click)
+this.click = breakpoint.click.bind(breakpoint);
+}
+
+WebInspector.BreakpointItem.prototype = {
+get element()
+{
+return this._element;
+},
+
+compareTo: function(other)
+{
+return this._breakpoint.compareTo(other._breakpoint);
+},
+
+populateEditElement: function(element)
+{
+this._breakpoint.populateEditElement(element);
+},
+
+remove: function()
+{
+this._breakpoint.remove();
+},
+
+_checkboxClicked: function(event)
+{
+this._breakpoint.enabled = !this._breakpoint.enabled;
+
+
+event.stopPropagation();
+},
+
+_enableChanged: function(event)
+{
+var checkbox = this._element.firstChild;
+checkbox.checked = this._breakpoint.enabled;
+},
+
+_hitStateChanged: function(event)
+{
+if (event.target.hit) {
+this._element.addStyleClass("breakpoint-hit");
+this.dispatchEventToListeners("breakpoint-hit");
+} else
+this._element.removeStyleClass("breakpoint-hit");
+},
+
+_labelChanged: function(event)
+{
+this._element.removeChild(this._labelElement);
+this._createLabelElement();
+},
+
+_createLabelElement: function()
+{
+this._labelElement = document.createElement("span");
+this._breakpoint.populateLabelElement(this._labelElement);
+this._element.appendChild(this._labelElement);
+}
+}
+
+WebInspector.BreakpointItem.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.EventListenerBreakpointsSidebarPane = function()
+{
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listener Breakpoints"));
+
+this.categoriesElement = document.createElement("ol");
+this.categoriesElement.tabIndex = 0;
+this.categoriesElement.addStyleClass("properties-tree event-listener-breakpoints");
+this.categoriesTreeOutline = new TreeOutline(this.categoriesElement);
+this.bodyElement.appendChild(this.categoriesElement);
+
+WebInspector.breakpointManager.addEventListener("event-listener-breakpoint-added", this._breakpointAdded, this);
+
+this._breakpointItems = {};
+this._createCategory("Keyboard", "listener", ["keydown", "keyup", "keypress", "textInput"]);
+this._createCategory("Mouse", "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
+
+
+
+this._createCategory("Control", "listener", ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
+this._createCategory("Clipboard", "listener", ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
+this._createCategory("Load", "listener", ["load", "unload", "abort", "error"]);
+this._createCategory("DOM Mutation", "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
+this._createCategory("Device", "listener", ["deviceorientation", "devicemotion"]);
+this._createCategory("Timer", "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
+}
+
+WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
+_createCategory: function(name, type, eventNames)
+{
+var categoryItem = {};
+categoryItem.element = new TreeElement(WebInspector.UIString(name));
+this.categoriesTreeOutline.appendChild(categoryItem.element);
+categoryItem.element.listItemElement.addStyleClass("event-category");
+categoryItem.element.selectable = true;
+
+categoryItem.checkbox = this._createCheckbox(categoryItem.element);
+categoryItem.checkbox.addEventListener("click", this._categoryCheckboxClicked.bind(this, categoryItem), true);
+
+categoryItem.children = {};
+for (var i = 0; i < eventNames.length; ++i) {
+var eventName = type + ":" + eventNames[i];
+
+var breakpointItem = {};
+var title = WebInspector.EventListenerBreakpoint.eventNameForUI(eventName);
+breakpointItem.element = new TreeElement(title);
+categoryItem.element.appendChild(breakpointItem.element);
+var hitMarker = document.createElement("div");
+hitMarker.className = "breakpoint-hit-marker";
+breakpointItem.element.listItemElement.appendChild(hitMarker);
+breakpointItem.element.listItemElement.addStyleClass("source-code");
+breakpointItem.element.selectable = true;
+
+breakpointItem.checkbox = this._createCheckbox(breakpointItem.element);
+breakpointItem.checkbox.addEventListener("click", this._breakpointCheckboxClicked.bind(this, breakpointItem), true);
+breakpointItem.parent = categoryItem;
+breakpointItem.eventName = eventName;
+
+this._breakpointItems[eventName] = breakpointItem;
+categoryItem.children[eventName] = breakpointItem;
+}
+},
+
+_createCheckbox: function(treeElement)
+{
+var checkbox = document.createElement("input");
+checkbox.className = "checkbox-elem";
+checkbox.type = "checkbox";
+treeElement.listItemElement.insertBefore(checkbox, treeElement.listItemElement.firstChild);
+return checkbox;
+},
+
+_categoryCheckboxClicked: function(categoryItem)
+{
+var checked = categoryItem.checkbox.checked;
+for (var eventName in categoryItem.children) {
+var breakpointItem = categoryItem.children[eventName];
+if (breakpointItem.checkbox.checked !== checked) {
+breakpointItem.checkbox.checked = checked;
+this._breakpointCheckboxClicked(breakpointItem);
+}
+}
+},
+
+_breakpointCheckboxClicked: function(breakpointItem)
+{
+if (breakpointItem.checkbox.checked)
+WebInspector.breakpointManager.createEventListenerBreakpoint(breakpointItem.eventName);
+else
+breakpointItem.breakpoint.remove();
+},
+
+_breakpointAdded: function(event)
+{
+var breakpoint = event.data.breakpoint;
+var eventName = event.data.eventName;
+
+var breakpointItem = this._breakpointItems[eventName];
+breakpointItem.breakpoint = breakpoint;
+breakpoint.addEventListener("hit-state-changed", this._breakpointHitStateChanged.bind(this, breakpointItem));
+breakpoint.addEventListener("removed", this._breakpointRemoved.bind(this, breakpointItem));
+breakpointItem.checkbox.checked = true;
+this._updateCategoryCheckbox(breakpointItem);
+},
+
+_breakpointHitStateChanged: function(breakpointItem, event)
+{
+if (event.target.hit) {
+this.expanded = true;
+var categoryItem = breakpointItem.parent;
+categoryItem.element.expand();
+breakpointItem.element.listItemElement.addStyleClass("breakpoint-hit");
+} else
+breakpointItem.element.listItemElement.removeStyleClass("breakpoint-hit");
+},
+
+_breakpointRemoved: function(breakpointItem)
+{
+breakpointItem.breakpoint = null;
+breakpointItem.checkbox.checked = false;
+this._updateCategoryCheckbox(breakpointItem);
+},
+
+_updateCategoryCheckbox: function(breakpointItem)
+{
+var categoryItem = breakpointItem.parent;
+var hasEnabled = false, hasDisabled = false;
+for (var eventName in categoryItem.children) {
+var breakpointItem = categoryItem.children[eventName];
+if (breakpointItem.checkbox.checked)
+hasEnabled = true;
+else
+hasDisabled = true;
+}
+categoryItem.checkbox.checked = hasEnabled;
+categoryItem.checkbox.indeterminate = hasEnabled && hasDisabled;
+},
+
+reset: function()
+{
+for (var eventName in this._breakpointItems) {
+var breakpointItem = this._breakpointItems[eventName];
+breakpointItem.breakpoint = null;
+breakpointItem.checkbox.checked = false;
+this._updateCategoryCheckbox(breakpointItem);
+}
+}
+}
+
+WebInspector.EventListenerBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+
+
+
+
 
 WebInspector.CallStackSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
-    
-    this._shortcuts = {};
-
-    var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Period,
-                                                         WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-    this._shortcuts[shortcut] = this._selectNextCallFrameOnStack.bind(this);
-
-    var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Comma,
-                                                         WebInspector.KeyboardShortcut.Modifiers.Ctrl);
-    this._shortcuts[shortcut] = this._selectPreviousCallFrameOnStack.bind(this);
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
+WebInspector.debuggerModel.addEventListener("native-breakpoint-hit", this._nativeBreakpointHit, this);
+WebInspector.debuggerModel.addEventListener("script-breakpoint-hit", this._scriptBreakpointHit, this);
 }
 
 WebInspector.CallStackSidebarPane.prototype = {
-    update: function(callFrames, sourceIDMap)
-    {
-        this.bodyElement.removeChildren();
+update: function(callFrames, sourceIDMap)
+{
+this.bodyElement.removeChildren();
 
-        this.placards = [];
-        delete this._selectedCallFrame;
+this.placards = [];
+delete this._selectedCallFrame;
 
-        if (!callFrames) {
-            var infoElement = document.createElement("div");
-            infoElement.className = "info";
-            infoElement.textContent = WebInspector.UIString("Not Paused");
-            this.bodyElement.appendChild(infoElement);
-            return;
-        }
+if (!callFrames) {
+var infoElement = document.createElement("div");
+infoElement.className = "info";
+infoElement.textContent = WebInspector.UIString("Not Paused");
+this.bodyElement.appendChild(infoElement);
+return;
+}
 
-        var title;
-        var subtitle;
-        var scriptOrResource;
+var title;
+var subtitle;
+var scriptOrResource;
 
-        for (var i = 0; i < callFrames.length; ++i) {
-            var callFrame = callFrames[i];
-            switch (callFrame.type) {
-            case "function":
-                title = callFrame.functionName || WebInspector.UIString("(anonymous function)");
-                break;
-            case "program":
-                title = WebInspector.UIString("(program)");
-                break;
-            }
+for (var i = 0; i < callFrames.length; ++i) {
+var callFrame = callFrames[i];
+switch (callFrame.type) {
+case "function":
+title = callFrame.functionName || WebInspector.UIString("(anonymous function)");
+break;
+case "program":
+title = WebInspector.UIString("(program)");
+break;
+}
 
-            scriptOrResource = sourceIDMap[callFrame.sourceID];
-            subtitle = WebInspector.displayNameForURL(scriptOrResource.sourceURL || scriptOrResource.url);
+scriptOrResource = sourceIDMap[callFrame.sourceID];
+if (scriptOrResource)
+subtitle = WebInspector.displayNameForURL(scriptOrResource.sourceURL || scriptOrResource.url);
+else
+subtitle = WebInspector.UIString("(internal script)");
 
-            if (callFrame.line > 0) {
-                if (subtitle)
-                    subtitle += ":" + callFrame.line;
-                else
-                    subtitle = WebInspector.UIString("line %d", callFrame.line);
-            }
+if (callFrame.line > 0) {
+if (subtitle)
+subtitle += ":" + callFrame.line;
+else
+subtitle = WebInspector.UIString("line %d", callFrame.line);
+}
 
-            var placard = new WebInspector.Placard(title, subtitle);
-            placard.callFrame = callFrame;
+var placard = new WebInspector.Placard(title, subtitle);
+placard.callFrame = callFrame;
 
-            placard.element.addEventListener("click", this._placardSelected.bind(this), false);
+placard.element.addEventListener("click", this._placardSelected.bind(this), false);
 
-            this.placards.push(placard);
-            this.bodyElement.appendChild(placard.element);
-        }
-    },
+this.placards.push(placard);
+this.bodyElement.appendChild(placard.element);
+}
+},
 
-    get selectedCallFrame()
-    {
-        return this._selectedCallFrame;
-    },
+get selectedCallFrame()
+{
+return this._selectedCallFrame;
+},
 
-    set selectedCallFrame(x)
-    {
-        if (this._selectedCallFrame === x)
-            return;
+set selectedCallFrame(x)
+{
+if (this._selectedCallFrame === x)
+return;
 
-        this._selectedCallFrame = x;
+this._selectedCallFrame = x;
 
-        for (var i = 0; i < this.placards.length; ++i) {
-            var placard = this.placards[i];
-            placard.selected = (placard.callFrame === this._selectedCallFrame);
-        }
+for (var i = 0; i < this.placards.length; ++i) {
+var placard = this.placards[i];
+placard.selected = (placard.callFrame === this._selectedCallFrame);
+}
 
-        this.dispatchEventToListeners("call frame selected");
-    },
+this.dispatchEventToListeners("call frame selected");
+},
 
-    handleShortcut: function(event)
-    {
-        var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
-        var handler = this._shortcuts[shortcut];
-        if (handler) {
-            handler(event);
-            event.handled = true;
-        }
-    },
+handleShortcut: function(event)
+{
+var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+var handler = this._shortcuts[shortcut];
+if (handler) {
+handler(event);
+event.handled = true;
+}
+},
 
-    _selectNextCallFrameOnStack: function()
-    {
-        var index = this._selectedCallFrameIndex();
-        if (index == -1)
-            return;
-        this._selectedPlacardByIndex(index + 1);
-    },
+_selectNextCallFrameOnStack: function()
+{
+var index = this._selectedCallFrameIndex();
+if (index == -1)
+return;
+this._selectedPlacardByIndex(index + 1);
+},
 
-    _selectPreviousCallFrameOnStack: function()
-    {
-        var index = this._selectedCallFrameIndex();
-        if (index == -1)
-            return;
-        this._selectedPlacardByIndex(index - 1);
-    },
+_selectPreviousCallFrameOnStack: function()
+{
+var index = this._selectedCallFrameIndex();
+if (index == -1)
+return;
+this._selectedPlacardByIndex(index - 1);
+},
 
-    _selectedPlacardByIndex: function(index)
-    {
-        if (index < 0 || index >= this.placards.length)
-            return;
-        var placard = this.placards[index];
-        this.selectedCallFrame = placard.callFrame
-    },
+_selectedPlacardByIndex: function(index)
+{
+if (index < 0 || index >= this.placards.length)
+return;
+var placard = this.placards[index];
+this.selectedCallFrame = placard.callFrame
+},
 
-    _selectedCallFrameIndex: function()
-    {
-        if (!this._selectedCallFrame)
-            return -1;
-        for (var i = 0; i < this.placards.length; ++i) {
-            var placard = this.placards[i];
-            if (placard.callFrame === this._selectedCallFrame)
-                return i;
-        }
-        return -1;
-    },
+_selectedCallFrameIndex: function()
+{
+if (!this._selectedCallFrame)
+return -1;
+for (var i = 0; i < this.placards.length; ++i) {
+var placard = this.placards[i];
+if (placard.callFrame === this._selectedCallFrame)
+return i;
+}
+return -1;
+},
 
-    _placardSelected: function(event)
-    {
-        var placardElement = event.target.enclosingNodeOrSelfWithClass("placard");
-        this.selectedCallFrame = placardElement.placard.callFrame;
-    }
+_placardSelected: function(event)
+{
+var placardElement = event.target.enclosingNodeOrSelfWithClass("placard");
+this.selectedCallFrame = placardElement.placard.callFrame;
+},
+
+registerShortcuts: function(section)
+{
+this._shortcuts = {};
+
+var nextCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period,
+WebInspector.KeyboardShortcut.Modifiers.Ctrl);
+this._shortcuts[nextCallFrame.key] = this._selectNextCallFrameOnStack.bind(this);
+
+var prevCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma,
+WebInspector.KeyboardShortcut.Modifiers.Ctrl);
+this._shortcuts[prevCallFrame.key] = this._selectPreviousCallFrameOnStack.bind(this);
+
+section.addRelatedKeys([ nextCallFrame.name, prevCallFrame.name ], WebInspector.UIString("Next/previous call frame"));
+},
+
+_nativeBreakpointHit:  function(event)
+{
+var breakpoint = WebInspector.breakpointManager.findBreakpoint(event.data.breakpointId);
+if (!breakpoint)
+return;
+var statusMessageElement = document.createElement("div");
+statusMessageElement.className = "info";
+breakpoint.populateStatusMessageElement(statusMessageElement, event.data.eventData);
+this.bodyElement.appendChild(statusMessageElement);
+},
+
+_scriptBreakpointHit:  function(event)
+{
+var statusMessageElement = document.createElement("div");
+statusMessageElement.className = "info";
+statusMessageElement.appendChild(document.createTextNode(WebInspector.UIString("Paused on a JavaScript breakpoint.")));
+this.bodyElement.appendChild(statusMessageElement);
+}
 }
 
 WebInspector.CallStackSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-/* ScopeChainSidebarPane.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ScopeChainSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope Variables"));
-    this._expandedProperties = [];
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope Variables"));
+this._expandedProperties = [];
 }
 
 WebInspector.ScopeChainSidebarPane.prototype = {
-    update: function(callFrame)
-    {
-        this.bodyElement.removeChildren();
+update: function(callFrame)
+{
+this.bodyElement.removeChildren();
 
-        this.sections = [];
-        this.callFrame = callFrame;
+this.sections = [];
+this.callFrame = callFrame;
 
-        if (!callFrame) {
-            var infoElement = document.createElement("div");
-            infoElement.className = "info";
-            infoElement.textContent = WebInspector.UIString("Not Paused");
-            this.bodyElement.appendChild(infoElement);
-            return;
-        }
+if (!callFrame) {
+var infoElement = document.createElement("div");
+infoElement.className = "info";
+infoElement.textContent = WebInspector.UIString("Not Paused");
+this.bodyElement.appendChild(infoElement);
+return;
+}
 
-        var foundLocalScope = false;
-        var scopeChain = callFrame.scopeChain;
-        for (var i = 0; i < scopeChain.length; ++i) {
-            var scopeObjectProxy = scopeChain[i];
-            var title = null;
-            var subtitle = scopeObjectProxy.description;
-            var emptyPlaceholder = null;
-            var extraProperties = null;
+var foundLocalScope = false;
+var scopeChain = callFrame.scopeChain;
+for (var i = 0; i < scopeChain.length; ++i) {
+var scopeObjectProxy = scopeChain[i];
+var title = null;
+var subtitle = scopeObjectProxy.description;
+var emptyPlaceholder = null;
+var extraProperties = null;
 
-            if (scopeObjectProxy.isLocal) {
-                foundLocalScope = true;
-                title = WebInspector.UIString("Local");
-                emptyPlaceholder = WebInspector.UIString("No Variables");
-                subtitle = null;
-                if (scopeObjectProxy.thisObject)
-                    extraProperties = [ new WebInspector.ObjectPropertyProxy("this", scopeObjectProxy.thisObject) ];
-            } else if (scopeObjectProxy.isClosure) {
-                title = WebInspector.UIString("Closure");
-                emptyPlaceholder = WebInspector.UIString("No Variables");
-                subtitle = null;
-            } else if (i === (scopeChain.length - 1))
-                title = WebInspector.UIString("Global");
-            else if (scopeObjectProxy.isElement)
-                title = WebInspector.UIString("Event Target");
-            else if (scopeObjectProxy.isDocument)
-                title = WebInspector.UIString("Event Document");
-            else if (scopeObjectProxy.isWithBlock)
-                title = WebInspector.UIString("With Block");
+if (scopeObjectProxy.isLocal) {
+foundLocalScope = true;
+title = WebInspector.UIString("Local");
+emptyPlaceholder = WebInspector.UIString("No Variables");
+subtitle = null;
+if (scopeObjectProxy.thisObject)
+extraProperties = [ new WebInspector.RemoteObjectProperty("this", WebInspector.RemoteObject.fromPayload(scopeObjectProxy.thisObject)) ];
+} else if (scopeObjectProxy.isClosure) {
+title = WebInspector.UIString("Closure");
+emptyPlaceholder = WebInspector.UIString("No Variables");
+subtitle = null;
+} else if (i === (scopeChain.length - 1))
+title = WebInspector.UIString("Global");
+else if (scopeObjectProxy.isElement)
+title = WebInspector.UIString("Event Target");
+else if (scopeObjectProxy.isDocument)
+title = WebInspector.UIString("Event Document");
+else if (scopeObjectProxy.isWithBlock)
+title = WebInspector.UIString("With Block");
 
-            if (!title || title === subtitle)
-                subtitle = null;
+if (!title || title === subtitle)
+subtitle = null;
 
-            var section = new WebInspector.ObjectPropertiesSection(scopeObjectProxy, title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
-            section.editInSelectedCallFrameWhenPaused = true;
-            section.pane = this;
+var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVariableTreeElement);
+section.editInSelectedCallFrameWhenPaused = true;
+section.pane = this;
 
-            if (!foundLocalScope || scopeObjectProxy.isLocal)
-                section.expanded = true;
+if (!foundLocalScope || scopeObjectProxy.isLocal)
+section.expanded = true;
 
-            this.sections.push(section);
-            this.bodyElement.appendChild(section.element);
-        }
-    }
+this.sections.push(section);
+this.bodyElement.appendChild(section.element);
+}
+}
 }
 
 WebInspector.ScopeChainSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
 WebInspector.ScopeVariableTreeElement = function(property)
 {
-    WebInspector.ObjectPropertyTreeElement.call(this, property);
+WebInspector.ObjectPropertyTreeElement.call(this, property);
 }
 
 WebInspector.ScopeVariableTreeElement.prototype = {
-    onattach: function()
-    {
-        WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);
-        if (this.hasChildren && this.propertyIdentifier in this.treeOutline.section.pane._expandedProperties)
-            this.expand();
-    },
+onattach: function()
+{
+WebInspector.ObjectPropertyTreeElement.prototype.onattach.call(this);
+if (this.hasChildren && this.propertyIdentifier in this.treeOutline.section.pane._expandedProperties)
+this.expand();
+},
 
-    onexpand: function()
-    {
-        this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier] = true;
-    },
+onexpand: function()
+{
+this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier] = true;
+},
 
-    oncollapse: function()
-    {
-        delete this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier];
-    },
+oncollapse: function()
+{
+delete this.treeOutline.section.pane._expandedProperties[this.propertyIdentifier];
+},
 
-    get propertyIdentifier()
-    {
-        if ("_propertyIdentifier" in this)
-            return this._propertyIdentifier;
-        var section = this.treeOutline.section;
-        this._propertyIdentifier = section.title + ":" + (section.subtitle ? section.subtitle + ":" : "") + this.propertyPath;
-        return this._propertyIdentifier;
-    },
+get propertyIdentifier()
+{
+if ("_propertyIdentifier" in this)
+return this._propertyIdentifier;
+var section = this.treeOutline.section;
+this._propertyIdentifier = section.title + ":" + (section.subtitle ? section.subtitle + ":" : "") + this.propertyPath;
+return this._propertyIdentifier;
+},
 
-    get propertyPath()
-    {
-        if ("_propertyPath" in this)
-            return this._propertyPath;
+get propertyPath()
+{
+if ("_propertyPath" in this)
+return this._propertyPath;
 
-        var current = this;
-        var result;
+var current = this;
+var result;
 
-        do {
-            if (result)
-                result = current.property.name + "." + result;
-            else
-                result = current.property.name;
-            current = current.parent;
-        } while (current && !current.root);
+do {
+if (result)
+result = current.property.name + "." + result;
+else
+result = current.property.name;
+current = current.parent;
+} while (current && !current.root);
 
-        this._propertyPath = result;
-        return result;
-    }
+this._propertyPath = result;
+return result;
+}
 }
 
 WebInspector.ScopeVariableTreeElement.prototype.__proto__ = WebInspector.ObjectPropertyTreeElement.prototype;
 
-/* WatchExpressionsSidebarPane.js */
 
-/*
- * Copyright (C) IBM Corp. 2009  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of IBM Corp. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.WatchExpressionsSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions"));
-    WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Watch Expressions"));
+this.reset();
 }
 
 WebInspector.WatchExpressionsSidebarPane.prototype = {
-    _settingsLoaded: function()
-    {
-        this.bodyElement.removeChildren();
+reset: function()
+{
+this.bodyElement.removeChildren();
 
-        this.expanded = WebInspector.settings.watchExpressions.length > 0;
-        this.section = new WebInspector.WatchExpressionsSection();
-        this.bodyElement.appendChild(this.section.element);
+this.expanded = WebInspector.settings.watchExpressions.length > 0;
+this.section = new WebInspector.WatchExpressionsSection();
+this.bodyElement.appendChild(this.section.element);
 
-        var addElement = document.createElement("button");
-        addElement.setAttribute("type", "button");
-        addElement.textContent = WebInspector.UIString("Add");
-        addElement.addEventListener("click", this.section.addExpression.bind(this.section), false);
+var addElement = document.createElement("button");
+addElement.setAttribute("type", "button");
+addElement.textContent = WebInspector.UIString("Add");
+addElement.addEventListener("click", this.section.addExpression.bind(this.section), false);
 
-        var refreshElement = document.createElement("button");
-        refreshElement.setAttribute("type", "button");
-        refreshElement.textContent = WebInspector.UIString("Refresh");
-        refreshElement.addEventListener("click", this.section.update.bind(this.section), false);
+var refreshElement = document.createElement("button");
+refreshElement.setAttribute("type", "button");
+refreshElement.textContent = WebInspector.UIString("Refresh");
+refreshElement.addEventListener("click", this.section.update.bind(this.section), false);
 
-        var centerElement = document.createElement("div");
-        centerElement.addStyleClass("watch-expressions-buttons-container");
-        centerElement.appendChild(addElement);
-        centerElement.appendChild(refreshElement);
-        this.bodyElement.appendChild(centerElement);
+var centerElement = document.createElement("div");
+centerElement.addStyleClass("watch-expressions-buttons-container");
+centerElement.appendChild(addElement);
+centerElement.appendChild(refreshElement);
+this.bodyElement.appendChild(centerElement);
 
-        this.onexpand = this.refreshExpressions.bind(this);
-    },
+this.onexpand = this.refreshExpressions.bind(this);
+},
 
-    refreshExpressions: function()
-    {
-        if (this.section)
-            this.section.update();
-    }
+refreshExpressions: function()
+{
+if (this.section)
+this.section.update();
+}
 }
 
 WebInspector.WatchExpressionsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
 WebInspector.WatchExpressionsSection = function()
 {
-    this._watchObjectGroupId = "watch-group";
+this._watchObjectGroupId = "watch-group";
 
-    WebInspector.ObjectPropertiesSection.call(this);
+WebInspector.ObjectPropertiesSection.call(this);
 
-    this.watchExpressions = WebInspector.settings.watchExpressions;
+this.watchExpressions = WebInspector.settings.watchExpressions;
 
-    this.headerElement.className = "hidden";
-    this.editable = true;
-    this.expanded = true;
-    this.propertiesElement.addStyleClass("watch-expressions");
+this.headerElement.className = "hidden";
+this.editable = true;
+this.expanded = true;
+this.propertiesElement.addStyleClass("watch-expressions");
 }
 
 WebInspector.WatchExpressionsSection.NewWatchExpression = "\xA0";
 
 WebInspector.WatchExpressionsSection.prototype = {
-    update: function()
-    {
-        function appendResult(expression, watchIndex, result, exception)
-        {
-            if (exception) {
-                // Exception results are not wrappers, but text messages.
-                result = WebInspector.ObjectProxy.wrapPrimitiveValue(result);
-            } else if (result.type === "string") {
-                // Evaluation result is intentionally not abbreviated. However, we'd like to distinguish between null and "null"
-                result.description = "\"" + result.description + "\"";
-            }
+update: function()
+{
+function appendResult(expression, watchIndex, result)
+{
+var property = new WebInspector.RemoteObjectProperty(expression, result);
+property.watchIndex = watchIndex;
 
-            var property = new WebInspector.ObjectPropertyProxy(expression, result);
-            property.watchIndex = watchIndex;
-            property.isException = exception;
 
-            // For newly added, empty expressions, set description to "",
-            // since otherwise you get DOMWindow
-            if (property.name === WebInspector.WatchExpressionsSection.NewWatchExpression) 
-                property.value.description = "";
 
-            // To clarify what's going on here: 
-            // In the outer function, we calculate the number of properties
-            // that we're going to be updating, and set that in the
-            // propertyCount variable.  
-            // In this function, we test to see when we are processing the 
-            // last property, and then call the superclass's updateProperties() 
-            // method to get all the properties refreshed at once.
-            properties.push(property);
-            
-            if (properties.length == propertyCount) {
-                this.updateProperties(properties, WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressionsSection.CompareProperties);
 
-                // check to see if we just added a new watch expression,
-                // which will always be the last property
-                if (this._newExpressionAdded) {
-                    delete this._newExpressionAdded;
 
-                    treeElement = this.findAddedTreeElement();
-                    if (treeElement)
-                        treeElement.startEditing();
-                }
-            }
-        }
 
-        // TODO: pass exact injected script id.
-        InspectorBackend.releaseWrapperObjectGroup(0, this._watchObjectGroupId)
-        var properties = [];
 
-        // Count the properties, so we known when to call this.updateProperties()
-        // in appendResult()
-        var propertyCount = 0;
-        for (var i = 0; i < this.watchExpressions.length; ++i) {
-            if (!this.watchExpressions[i]) 
-                continue;
-            ++propertyCount;
-        }
 
-        // Now process all the expressions, since we have the actual count,
-        // which is checked in the appendResult inner function.
-        for (var i = 0; i < this.watchExpressions.length; ++i) {
-            var expression = this.watchExpressions[i];
-            if (!expression)
-                continue;
+properties.push(property);
 
-            WebInspector.console.evalInInspectedWindow("(" + expression + ")", this._watchObjectGroupId, appendResult.bind(this, expression, i));
-        }
+if (properties.length == propertyCount) {
+this.updateProperties(properties, WebInspector.WatchExpressionTreeElement, WebInspector.WatchExpressionsSection.CompareProperties);
 
-        // note this is setting the expansion of the tree, not the section;
-        // with no expressions, and expanded tree, we get some extra vertical
-        // white space
-        // FIXME: should change to use header buttons instead of the buttons
-        // at the bottom of the section, then we can add a "No Watch Expressions
-        // element when there are no watch expressions, and this issue should
-        // go away.
-        this.expanded = (propertyCount != 0);
-    },
 
-    addExpression: function()
-    {
-        this._newExpressionAdded = true;
-        this.watchExpressions.push(WebInspector.WatchExpressionsSection.NewWatchExpression);
-        this.update();
-    },
 
-    updateExpression: function(element, value)
-    {
-        this.watchExpressions[element.property.watchIndex] = value;
-        this.saveExpressions();
-        this.update();
-    },
+if (this._newExpressionAdded) {
+delete this._newExpressionAdded;
 
-    findAddedTreeElement: function()
-    {
-        var children = this.propertiesTreeOutline.children;
-        for (var i = 0; i < children.length; ++i)
-            if (children[i].property.name === WebInspector.WatchExpressionsSection.NewWatchExpression)
-                return children[i];
-    },
+treeElement = this.findAddedTreeElement();
+if (treeElement)
+treeElement.startEditing();
+}
+}
+}
 
-    saveExpressions: function()
-    {
-        var toSave = [];
-        for (var i = 0; i < this.watchExpressions.length; i++)
-            if (this.watchExpressions[i])
-                toSave.push(this.watchExpressions[i]);
 
-        WebInspector.settings.watchExpressions = toSave;
-        return toSave.length;
-    }
+InspectorBackend.releaseWrapperObjectGroup(0, this._watchObjectGroupId)
+var properties = [];
+
+
+
+var propertyCount = 0;
+for (var i = 0; i < this.watchExpressions.length; ++i) {
+if (!this.watchExpressions[i]) 
+continue;
+++propertyCount;
+}
+
+
+
+for (var i = 0; i < this.watchExpressions.length; ++i) {
+var expression = this.watchExpressions[i];
+if (!expression)
+continue;
+
+WebInspector.console.evalInInspectedWindow("(" + expression + ")", this._watchObjectGroupId, appendResult.bind(this, expression, i));
+}
+
+
+
+
+
+
+
+
+this.expanded = (propertyCount != 0);
+},
+
+addExpression: function()
+{
+this._newExpressionAdded = true;
+this.watchExpressions.push(WebInspector.WatchExpressionsSection.NewWatchExpression);
+this.update();
+},
+
+updateExpression: function(element, value)
+{
+this.watchExpressions[element.property.watchIndex] = value;
+this.saveExpressions();
+this.update();
+},
+
+findAddedTreeElement: function()
+{
+var children = this.propertiesTreeOutline.children;
+for (var i = 0; i < children.length; ++i)
+if (children[i].property.name === WebInspector.WatchExpressionsSection.NewWatchExpression)
+return children[i];
+},
+
+saveExpressions: function()
+{
+var toSave = [];
+for (var i = 0; i < this.watchExpressions.length; i++)
+if (this.watchExpressions[i])
+toSave.push(this.watchExpressions[i]);
+
+WebInspector.settings.watchExpressions = toSave;
+return toSave.length;
+}
 }
 
 WebInspector.WatchExpressionsSection.prototype.__proto__ = WebInspector.ObjectPropertiesSection.prototype;
 
 WebInspector.WatchExpressionsSection.CompareProperties = function(propertyA, propertyB) 
 {
-    if (propertyA.watchIndex == propertyB.watchIndex)
-        return 0;
-    else if (propertyA.watchIndex < propertyB.watchIndex)
-        return -1;
-    else
-        return 1;
+if (propertyA.watchIndex == propertyB.watchIndex)
+return 0;
+else if (propertyA.watchIndex < propertyB.watchIndex)
+return -1;
+else
+return 1;
 }
 
 WebInspector.WatchExpressionTreeElement = function(property)
 {
-    WebInspector.ObjectPropertyTreeElement.call(this, property);
+WebInspector.ObjectPropertyTreeElement.call(this, property);
 }
 
 WebInspector.WatchExpressionTreeElement.prototype = {
-    update: function()
-    {
-        WebInspector.ObjectPropertyTreeElement.prototype.update.call(this);
+update: function()
+{
+WebInspector.ObjectPropertyTreeElement.prototype.update.call(this);
 
-        if (this.property.isException)
-            this.valueElement.addStyleClass("watch-expressions-error-level");
+if (this.property.value.isError())
+this.valueElement.addStyleClass("watch-expressions-error-level");
 
-        var deleteButton = document.createElement("input");
-        deleteButton.type = "button";
-        deleteButton.title = WebInspector.UIString("Delete watch expression.");
-        deleteButton.addStyleClass("enabled-button");
-        deleteButton.addStyleClass("delete-button");
-        deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+var deleteButton = document.createElement("input");
+deleteButton.type = "button";
+deleteButton.title = WebInspector.UIString("Delete watch expression.");
+deleteButton.addStyleClass("enabled-button");
+deleteButton.addStyleClass("delete-button");
+deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
 
-        this.listItemElement.insertBefore(deleteButton, this.listItemElement.firstChild);
-    },
+this.listItemElement.insertBefore(deleteButton, this.listItemElement.firstChild);
+},
 
-    _deleteButtonClicked: function()
-    {
-        this.treeOutline.section.updateExpression(this, null);
-    },
+_deleteButtonClicked: function()
+{
+this.treeOutline.section.updateExpression(this, null);
+},
 
-    startEditing: function()
-    {
-        if (WebInspector.isBeingEdited(this.nameElement) || !this.treeOutline.section.editable)
-            return;
+startEditing: function()
+{
+if (WebInspector.isBeingEdited(this.nameElement) || !this.treeOutline.section.editable)
+return;
 
-        this.nameElement.textContent = this.property.name.trim();
+this.nameElement.textContent = this.property.name.trim();
 
-        var context = { expanded: this.expanded };
+var context = { expanded: this.expanded };
 
-        // collapse temporarily, if required
-        this.hasChildren = false;
 
-        this.listItemElement.addStyleClass("editing-sub-part");
+this.hasChildren = false;
 
-        WebInspector.startEditing(this.nameElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
-    },
+this.listItemElement.addStyleClass("editing-sub-part");
 
-    editingCancelled: function(element, context)
-    {
-        if (!this.nameElement.textContent)
-            this.treeOutline.section.updateExpression(this, null);
-            
-        this.update();
-        this.editingEnded(context);
-    },
+WebInspector.startEditing(this.nameElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
+},
 
-    applyExpression: function(expression, updateInterface)
-    {
-        expression = expression.trim();
+editingCancelled: function(element, context)
+{
+if (!this.nameElement.textContent)
+this.treeOutline.section.updateExpression(this, null);
 
-        if (!expression)
-            expression = null;
+this.update();
+this.editingEnded(context);
+},
 
-        this.property.name = expression;
-        this.treeOutline.section.updateExpression(this, expression);
-    }
+applyExpression: function(expression, updateInterface)
+{
+expression = expression.trim();
+
+if (!expression)
+expression = null;
+
+this.property.name = expression;
+this.treeOutline.section.updateExpression(this, expression);
+}
 }
 
 WebInspector.WatchExpressionTreeElement.prototype.__proto__ = WebInspector.ObjectPropertyTreeElement.prototype;
 
-/* MetricsSidebarPane.js */
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+WebInspector.WorkersSidebarPane = function()
+{
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Workers"));
+
+this._workers = {};
+
+this._enableWorkersCheckbox = new WebInspector.Checkbox(
+WebInspector.UIString("Debug"),
+"sidebar-pane-subtitle",
+WebInspector.UIString("Allow debugging workers. Enabling this option will replace native workers with the iframe-based JavaScript implementation"));
+this.titleElement.insertBefore(this._enableWorkersCheckbox.element, this.titleElement.firstChild);
+
+this._enableWorkersCheckbox.addEventListener(this._onTriggerInstrument.bind(this));
+this._enableWorkersCheckbox.checked = false;
+
+this._listElement = document.createElement("ol");
+this._listElement.className = "workers-list";
+
+this.bodyElement.appendChild(this._listElement);
+this._treeOutline = new TreeOutline(this._listElement);
+}
+
+WebInspector.WorkersSidebarPane.prototype = {
+addWorker: function(id, url, isShared)
+{
+if (id in this._workers) 
+return;
+var worker = new WebInspector.Worker(id, url, isShared);
+this._workers[id] = worker;
+
+var title = WebInspector.linkifyURL(url, WebInspector.displayNameForURL(url), "worker-item", true, url);
+var treeElement = new TreeElement(null, worker, false);
+treeElement.titleHTML = title;
+this._treeOutline.appendChild(treeElement);
+},
+
+removeWorker: function(id)
+{
+if (id in this._workers) {
+this._treeOutline.removeChild(this._treeOutline.findTreeElement(this._workers[id]));
+delete this._workers[id];
+}
+},
+
+setInstrumentation: function(enabled)
+{
+InspectorBackend.removeAllScriptsToEvaluateOnLoad();
+if (enabled)
+InspectorBackend.addScriptToEvaluateOnLoad("(" + InjectedFakeWorker + ")");
+},
+
+reset: function()
+{
+this.setInstrumentation(this._enableWorkersCheckbox.checked);
+this._treeOutline.removeChildren();
+this._workers = {};
+},
+
+_onTriggerInstrument: function(event)
+{
+this.setInstrumentation(this._enableWorkersCheckbox.checked);
+}
+};
+
+WebInspector.WorkersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+
+WebInspector.Worker = function(id, url, shared)
+{
+this.id = id;
+this.url = url;
+this.shared = shared;
+}
+
+WebInspector.didCreateWorker = function()
+{
+var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
+workersPane.addWorker.apply(workersPane, arguments);
+}
+
+WebInspector.didDestroyWorker = function()
+{
+var workersPane = WebInspector.panels.scripts.sidebarPanes.workers;
+workersPane.removeWorker.apply(workersPane, arguments);
+}
+
+
+
+
 
 WebInspector.MetricsSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics"));
-    this._inlineStyleId = null;
-    this._inlineStyleInjectedScriptId = null;
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics"));
+this._inlineStyleId = null;
 }
 
 WebInspector.MetricsSidebarPane.prototype = {
-    update: function(node)
-    {
-        if (node)
-            this.node = node;
-        else
-            node = this.node;
+update: function(node)
+{
+if (node)
+this.node = node;
+else
+node = this.node;
 
-        if (!node || !node.ownerDocument.defaultView || node.nodeType !== Node.ELEMENT_NODE) {
-            this.bodyElement.removeChildren();
-            return;
-        }
+if (!node || !node.ownerDocument.defaultView || node.nodeType !== Node.ELEMENT_NODE) {
+this.bodyElement.removeChildren();
+return;
+}
 
-        var self = this;
-        var callback = function(stylePayload) {
-            if (!stylePayload)
-                return;
-            var style = WebInspector.CSSStyleDeclaration.parseStyle(stylePayload);
-            self._update(style);
-        };
-        InjectedScriptAccess.get(node.injectedScriptId).getComputedStyle(node.id, callback);
+var self = this;
+var callback = function(style) {
+if (!style)
+return;
+self._update(style);
+};
+WebInspector.cssModel.getComputedStyleAsync(node.id, callback);
 
-        var inlineStyleCallback = function(stylePayload) {
-            if (!stylePayload)
-                return;
-            self._inlineStyleId = stylePayload.id;
-            self._inlineStyleInjectedScriptId = stylePayload.injectedScriptId;
-        };
-        InjectedScriptAccess.get(node.injectedScriptId).getInlineStyle(node.id, inlineStyleCallback);
-    },
+var inlineStyleCallback = function(style) {
+if (!style)
+return;
+self.inlineStyle = style;
+};
+WebInspector.cssModel.getInlineStyleAsync(node.id, inlineStyleCallback);
+},
 
-    _update: function(style)
-    {
-        var metricsElement = document.createElement("div");
-        metricsElement.className = "metrics";
+_update: function(style)
+{
 
-        function createBoxPartElement(style, name, side, suffix)
-        {
-            var propertyName = (name !== "position" ? name + "-" : "") + side + suffix;
-            var value = style.getPropertyValue(propertyName);
-            if (value === "" || (name !== "position" && value === "0px"))
-                value = "\u2012";
-            else if (name === "position" && value === "auto")
-                value = "\u2012";
-            value = value.replace(/px$/, "");
+var metricsElement = document.createElement("div");
+metricsElement.className = "metrics";
 
-            var element = document.createElement("div");
-            element.className = side;
-            element.textContent = value;
-            element.addEventListener("dblclick", this.startEditing.bind(this, element, name, propertyName), false);
-            return element;
-        }
+function createBoxPartElement(style, name, side, suffix)
+{
+var propertyName = (name !== "position" ? name + "-" : "") + side + suffix;
+var value = style.getPropertyValue(propertyName);
+if (value === "" || (name !== "position" && value === "0px"))
+value = "\u2012";
+else if (name === "position" && value === "auto")
+value = "\u2012";
+value = value.replace(/px$/, "");
 
-        // Display types for which margin is ignored.
-        var noMarginDisplayType = {
-            "table-cell": true,
-            "table-column": true,
-            "table-column-group": true,
-            "table-footer-group": true,
-            "table-header-group": true,
-            "table-row": true,
-            "table-row-group": true
-        };
+var element = document.createElement("div");
+element.className = side;
+element.textContent = value;
+element.addEventListener("dblclick", this.startEditing.bind(this, element, name, propertyName), false);
+return element;
+}
 
-        // Display types for which padding is ignored.
-        var noPaddingDisplayType = {
-            "table-column": true,
-            "table-column-group": true,
-            "table-footer-group": true,
-            "table-header-group": true,
-            "table-row": true,
-            "table-row-group": true
-        };
 
-        // Position types for which top, left, bottom and right are ignored.
-        var noPositionType = {
-            "static": true
-        };
+var noMarginDisplayType = {
+"table-cell": true,
+"table-column": true,
+"table-column-group": true,
+"table-footer-group": true,
+"table-header-group": true,
+"table-row": true,
+"table-row-group": true
+};
 
-        var boxes = ["content", "padding", "border", "margin", "position"];
-        var boxLabels = [WebInspector.UIString("content"), WebInspector.UIString("padding"), WebInspector.UIString("border"), WebInspector.UIString("margin"), WebInspector.UIString("position")];
-        var previousBox;
-        for (var i = 0; i < boxes.length; ++i) {
-            var name = boxes[i];
 
-            if (name === "margin" && noMarginDisplayType[style.display])
-                continue;
-            if (name === "padding" && noPaddingDisplayType[style.display])
-                continue;
-            if (name === "position" && noPositionType[style.position])
-                continue;
+var noPaddingDisplayType = {
+"table-column": true,
+"table-column-group": true,
+"table-footer-group": true,
+"table-header-group": true,
+"table-row": true,
+"table-row-group": true
+};
 
-            var boxElement = document.createElement("div");
-            boxElement.className = name;
 
-            if (name === "content") {
-                var width = style.width.replace(/px$/, "");
-                var widthElement = document.createElement("span");
-                widthElement.textContent = width;
-                widthElement.addEventListener("dblclick", this.startEditing.bind(this, widthElement, "width", "width"), false);
+var noPositionType = {
+"static": true
+};
 
-                var height = style.height.replace(/px$/, "");
-                var heightElement = document.createElement("span");
-                heightElement.textContent = height;
-                heightElement.addEventListener("dblclick", this.startEditing.bind(this, heightElement, "height", "height"), false);
+var boxes = ["content", "padding", "border", "margin", "position"];
+var boxLabels = [WebInspector.UIString("content"), WebInspector.UIString("padding"), WebInspector.UIString("border"), WebInspector.UIString("margin"), WebInspector.UIString("position")];
+var previousBox;
+for (var i = 0; i < boxes.length; ++i) {
+var name = boxes[i];
 
-                boxElement.appendChild(widthElement);
-                boxElement.appendChild(document.createTextNode(" \u00D7 "));
-                boxElement.appendChild(heightElement);
-            } else {
-                var suffix = (name === "border" ? "-width" : "");
+if (name === "margin" && noMarginDisplayType[style.getPropertyValue("display")])
+continue;
+if (name === "padding" && noPaddingDisplayType[style.getPropertyValue("display")])
+continue;
+if (name === "position" && noPositionType[style.getPropertyValue("position")])
+continue;
 
-                var labelElement = document.createElement("div");
-                labelElement.className = "label";
-                labelElement.textContent = boxLabels[i];
-                boxElement.appendChild(labelElement);
+var boxElement = document.createElement("div");
+boxElement.className = name;
 
-                boxElement.appendChild(createBoxPartElement.call(this, style, name, "top", suffix));
-                boxElement.appendChild(document.createElement("br"));
-                boxElement.appendChild(createBoxPartElement.call(this, style, name, "left", suffix));
+if (name === "content") {
+var width = style.getPropertyValue("width").replace(/px$/, "");
+var widthElement = document.createElement("span");
+widthElement.textContent = width;
+widthElement.addEventListener("dblclick", this.startEditing.bind(this, widthElement, "width", "width"), false);
 
-                if (previousBox)
-                    boxElement.appendChild(previousBox);
+var height = style.getPropertyValue("height").replace(/px$/, "");
+var heightElement = document.createElement("span");
+heightElement.textContent = height;
+heightElement.addEventListener("dblclick", this.startEditing.bind(this, heightElement, "height", "height"), false);
 
-                boxElement.appendChild(createBoxPartElement.call(this, style, name, "right", suffix));
-                boxElement.appendChild(document.createElement("br"));
-                boxElement.appendChild(createBoxPartElement.call(this, style, name, "bottom", suffix));
-            }
+boxElement.appendChild(widthElement);
+boxElement.appendChild(document.createTextNode(" \u00D7 "));
+boxElement.appendChild(heightElement);
+} else {
+var suffix = (name === "border" ? "-width" : "");
 
-            previousBox = boxElement;
-        }
+var labelElement = document.createElement("div");
+labelElement.className = "label";
+labelElement.textContent = boxLabels[i];
+boxElement.appendChild(labelElement);
 
-        metricsElement.appendChild(previousBox);
-        this.bodyElement.removeChildren();
-        this.bodyElement.appendChild(metricsElement);
-    },
+boxElement.appendChild(createBoxPartElement.call(this, style, name, "top", suffix));
+boxElement.appendChild(document.createElement("br"));
+boxElement.appendChild(createBoxPartElement.call(this, style, name, "left", suffix));
 
-    startEditing: function(targetElement, box, styleProperty)
-    {
-        if (WebInspector.isBeingEdited(targetElement))
-            return;
+if (previousBox)
+boxElement.appendChild(previousBox);
 
-        var context = { box: box, styleProperty: styleProperty };
+boxElement.appendChild(createBoxPartElement.call(this, style, name, "right", suffix));
+boxElement.appendChild(document.createElement("br"));
+boxElement.appendChild(createBoxPartElement.call(this, style, name, "bottom", suffix));
+}
 
-        WebInspector.startEditing(targetElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
-    },
+previousBox = boxElement;
+}
 
-    editingCancelled: function(element, context)
-    {
-        this.update();
-    },
+metricsElement.appendChild(previousBox);
+this.bodyElement.removeChildren();
+this.bodyElement.appendChild(metricsElement);
+},
 
-    editingCommitted: function(element, userInput, previousContent, context)
-    {
-        if (userInput === previousContent)
-            return this.editingCancelled(element, context); // nothing changed, so cancel
+startEditing: function(targetElement, box, styleProperty)
+{
+if (WebInspector.isBeingEdited(targetElement))
+return;
 
-        if (context.box !== "position" && (!userInput || userInput === "\u2012"))
-            userInput = "0px";
-        else if (context.box === "position" && (!userInput || userInput === "\u2012"))
-            userInput = "auto";
+var context = { box: box, styleProperty: styleProperty };
 
-        // Append a "px" unit if the user input was just a number.
-        if (/^\d+$/.test(userInput))
-            userInput += "px";
+WebInspector.startEditing(targetElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
+},
 
-        var self = this;
-        var callback = function(success) {
-            if (!success)
-                return;
-            self.dispatchEventToListeners("metrics edited");
-            self.update();
-        };
-        InjectedScriptAccess.get(this._inlineStyleInjectedScriptId).setStyleProperty(this._inlineStyleId, context.styleProperty, userInput, callback);
-    }
+editingCancelled: function(element, context)
+{
+this.update();
+},
+
+editingCommitted: function(element, userInput, previousContent, context)
+{
+if (!this.inlineStyle) {
+
+return this.editingCancelled(element, context); 
+}
+
+if (userInput === previousContent)
+return this.editingCancelled(element, context); 
+
+if (context.box !== "position" && (!userInput || userInput === "\u2012"))
+userInput = "0px";
+else if (context.box === "position" && (!userInput || userInput === "\u2012"))
+userInput = "auto";
+
+
+if (/^\d+$/.test(userInput))
+userInput += "px";
+
+var self = this;
+var callback = function(style) {
+if (!style)
+return;
+self.inlineStyle = style;
+self.dispatchEventToListeners("metrics edited");
+self.update();
+};
+
+function setEnabledValueCallback(context, style)
+{
+var property = style.getLiveProperty(context.styleProperty);
+if (!property)
+style.appendProperty(context.styleProperty, userInput, callback);
+else
+property.setValue(userInput, callback);
+}
+
+var allProperties = this.inlineStyle.allProperties;
+for (var i = 0; i < allProperties.length; ++i) {
+var property = allProperties[i];
+if (property.name !== context.styleProperty || property.inactive)
+continue;
+if (property.disabled)
+property.setDisabled(false, setEnabledValueCallback.bind(null, context));
+else
+property.setValue(userInput, callback);
+return;
+}
+
+this.inlineStyle.appendProperty(context.styleProperty, userInput, callback);
+}
 }
 
 WebInspector.MetricsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-/* PropertiesSidebarPane.js */
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.PropertiesSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Properties"));
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Properties"));
 }
 
 WebInspector.PropertiesSidebarPane.prototype = {
-    update: function(node)
-    {
-        var body = this.bodyElement;
+update: function(node)
+{
+var body = this.bodyElement;
 
-        if (!node) {
-            body.removeChildren();
-            this.sections = [];
-            return;
-        }
+if (!node) {
+body.removeChildren();
+this.sections = [];
+return;
+}
 
-        var self = this;
-        var callback = function(prototypes) {
-            var body = self.bodyElement;
-            body.removeChildren();
-            self.sections = [];
+var self = this;
+var callback = function(prototypes) {
+var body = self.bodyElement;
+body.removeChildren();
+self.sections = [];
 
-            var path = [];
-            // Get array of prototype user-friendly names.
-            for (var i = 0; i < prototypes.length; ++i) {
-                var prototype = new WebInspector.ObjectProxy(node.injectedScriptId, node.id, path.slice());
-                var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype"));
-                self.sections.push(section);
-                body.appendChild(section.element);
-                path.push("__proto__");
-            }
-        };
-        InjectedScriptAccess.get(node.injectedScriptId).getPrototypes(node.id, callback);
-    }
+
+for (var i = 0; i < prototypes.length; ++i) {
+var prototype = WebInspector.RemoteObject.fromPayload(prototypes[i]);
+var title = prototype.description;
+if (title.match(/Prototype$/))
+title = title.replace(/Prototype$/, "");
+var section = new WebInspector.ObjectPropertiesSection(prototype, title);
+self.sections.push(section);
+body.appendChild(section.element);
+}
+};
+InjectedScriptAccess.getForNode(node).getPrototypes(node.id, callback);
+}
 }
 
 WebInspector.PropertiesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-/* EventListenersSidebarPane.js */
 
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.EventListenersSidebarPane = function()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listeners"));
-    this.bodyElement.addStyleClass("events-pane");
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Event Listeners"));
+this.bodyElement.addStyleClass("events-pane");
 
-    this.sections = [];
+this.sections = [];
 
-    this.settingsSelectElement = document.createElement("select");
+this.settingsSelectElement = document.createElement("select");
 
-    var option = document.createElement("option");
-    option.value = "all";
-    option.label = WebInspector.UIString("All Nodes");
-    this.settingsSelectElement.appendChild(option);
+var option = document.createElement("option");
+option.value = "all";
+option.label = WebInspector.UIString("All Nodes");
+this.settingsSelectElement.appendChild(option);
 
-    option = document.createElement("option");
-    option.value = "selected";
-    option.label = WebInspector.UIString("Selected Node Only");
-    this.settingsSelectElement.appendChild(option);
+option = document.createElement("option");
+option.value = "selected";
+option.label = WebInspector.UIString("Selected Node Only");
+this.settingsSelectElement.appendChild(option);
 
-    WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
-    this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false);
-    this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
+var filter = WebInspector.settings.eventListenersFilter;
+if (filter === "all")
+this.settingsSelectElement[0].selected = true;
+else if (filter === "selected")
+this.settingsSelectElement[1].selected = true;
+this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false);
+this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
 
-    this.titleElement.appendChild(this.settingsSelectElement);
+this.titleElement.appendChild(this.settingsSelectElement);
 }
 
 WebInspector.EventListenersSidebarPane.prototype = {
-    _settingsLoaded: function()
-    {
-        var filter = WebInspector.settings.eventListenersFilter;
-        if (filter === "all")
-            this.settingsSelectElement[0].selected = true;
-        if (filter === "selected")
-            this.settingsSelectElement[1].selected = true;
-    },
+update: function(node)
+{
+var body = this.bodyElement;
+body.removeChildren();
+this.sections = [];
 
-    update: function(node)
-    {
-        var body = this.bodyElement;
-        body.removeChildren();
-        this.sections = [];
+var self = this;
+function callback(nodeId, eventListeners) {
+var sectionNames = [];
+var sectionMap = {};
+for (var i = 0; i < eventListeners.length; ++i) {
+var eventListener = eventListeners[i];
+eventListener.node = WebInspector.domAgent.nodeForId(eventListener.nodeId);
+delete eventListener.nodeId; 
+if (/^function _inspectorCommandLineAPI_logEvent\(/.test(eventListener.listenerBody.toString()))
+continue; 
+var type = eventListener.type;
+var section = sectionMap[type];
+if (!section) {
+section = new WebInspector.EventListenersSection(type, nodeId);
+sectionMap[type] = section;
+sectionNames.push(type);
+self.sections.push(section);
+}
+section.addListener(eventListener);
+}
 
-        var self = this;
-        function callback(nodeId, eventListeners) {
-            var sectionNames = [];
-            var sectionMap = {};
-            for (var i = 0; i < eventListeners.length; ++i) {
-                var eventListener = eventListeners[i];
-                eventListener.node = WebInspector.domAgent.nodeForId(eventListener.nodeId);
-                delete eventListener.nodeId; // no longer needed
-                if (/^function _inspectorCommandLineAPI_logEvent\(/.test(eventListener.listener.toString()))
-                    continue; // ignore event listeners generated by monitorEvent
-                var type = eventListener.type;
-                var section = sectionMap[type];
-                if (!section) {
-                    section = new WebInspector.EventListenersSection(type, nodeId);
-                    sectionMap[type] = section;
-                    sectionNames.push(type);
-                    self.sections.push(section);
-                }
-                section.addListener(eventListener);
-            }
-            
-            if (sectionNames.length === 0) {
-                var div = document.createElement("div");
-                div.className = "info";
-                div.textContent = WebInspector.UIString("No Event Listeners");
-                body.appendChild(div);
-                return;
-            }
+if (sectionNames.length === 0) {
+var div = document.createElement("div");
+div.className = "info";
+div.textContent = WebInspector.UIString("No Event Listeners");
+body.appendChild(div);
+return;
+}
 
-            sectionNames.sort();
-            for (var i = 0; i < sectionNames.length; ++i) {
-                var section = sectionMap[sectionNames[i]];
-                section.update();
-                body.appendChild(section.element);
-            }
-        }
+sectionNames.sort();
+for (var i = 0; i < sectionNames.length; ++i) {
+var section = sectionMap[sectionNames[i]];
+section.update();
+body.appendChild(section.element);
+}
+}
 
-        WebInspector.EventListeners.getEventListenersForNodeAsync(node, callback);
-    },
+WebInspector.EventListeners.getEventListenersForNodeAsync(node, callback);
+},
 
-    _changeSetting: function(event)
-    {
-        var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
-        WebInspector.settings.eventListenersFilter = selectedOption.value;
+_changeSetting: function(event)
+{
+var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
+WebInspector.settings.eventListenersFilter = selectedOption.value;
 
-        for (var i = 0; i < this.sections.length; ++i)
-            this.sections[i].update();
-    }
+for (var i = 0; i < this.sections.length; ++i)
+this.sections[i].update();
+}
 }
 
 WebInspector.EventListenersSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
 WebInspector.EventListenersSection = function(title, nodeId)
 {
-    this.eventListeners = [];
-    this._nodeId = nodeId;
-    WebInspector.PropertiesSection.call(this, title);
+this.eventListeners = [];
+this._nodeId = nodeId;
+WebInspector.PropertiesSection.call(this, title);
 
-    // Changed from a Properties List
-    this.propertiesElement.parentNode.removeChild(this.propertiesElement);
-    delete this.propertiesElement;
-    delete this.propertiesTreeOutline;
 
-    this.eventBars = document.createElement("div");
-    this.eventBars.className = "event-bars";
-    this.element.appendChild(this.eventBars);
+this.propertiesElement.parentNode.removeChild(this.propertiesElement);
+delete this.propertiesElement;
+delete this.propertiesTreeOutline;
+
+this.eventBars = document.createElement("div");
+this.eventBars.className = "event-bars";
+this.element.appendChild(this.eventBars);
 }
 
 WebInspector.EventListenersSection.prototype = {
-    update: function()
-    {
-        // A Filtered Array simplifies when to create connectors
-        var filteredEventListeners = this.eventListeners;
-        if (WebInspector.settings.eventListenersFilter === "selected") {
-            filteredEventListeners = [];
-            for (var i = 0; i < this.eventListeners.length; ++i) {
-                var eventListener = this.eventListeners[i];
-                if (eventListener.node.id === this._nodeId)
-                    filteredEventListeners.push(eventListener);
-            }
-        }
+update: function()
+{
 
-        this.eventBars.removeChildren();
-        var length = filteredEventListeners.length;
-        for (var i = 0; i < length; ++i) {
-            var eventListener = filteredEventListeners[i];
-            var eventListenerBar = new WebInspector.EventListenerBar(eventListener);
-            if (i < length - 1) {
-                var connector = document.createElement("div");
-                connector.className = "event-bar-connector";
-                eventListenerBar.element.appendChild(connector);
-            }
+var filteredEventListeners = this.eventListeners;
+if (WebInspector.settings.eventListenersFilter === "selected") {
+filteredEventListeners = [];
+for (var i = 0; i < this.eventListeners.length; ++i) {
+var eventListener = this.eventListeners[i];
+if (eventListener.node.id === this._nodeId)
+filteredEventListeners.push(eventListener);
+}
+}
 
-            this.eventBars.appendChild(eventListenerBar.element);
-        }
-    },
+this.eventBars.removeChildren();
+var length = filteredEventListeners.length;
+for (var i = 0; i < length; ++i) {
+var eventListener = filteredEventListeners[i];
+var eventListenerBar = new WebInspector.EventListenerBar(eventListener, this._nodeId);
+this.eventBars.appendChild(eventListenerBar.element);
+}
+},
 
-    addListener: function(eventListener)
-    {
-        this.eventListeners.push(eventListener);
-    }
+addListener: function(eventListener)
+{
+this.eventListeners.push(eventListener);
+}
 }
 
 WebInspector.EventListenersSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
 
-WebInspector.EventListenerBar = function(eventListener)
+WebInspector.EventListenerBar = function(eventListener, nodeId)
 {
-    this.eventListener = eventListener;
-    WebInspector.ObjectPropertiesSection.call(this, null, this._getFunctionDisplayName(), this._getNodeDisplayName());
-    this.editable = false;
-    this.element.className = "event-bar"; /* Changed from "section" */
-    this.propertiesElement.className = "event-properties"; /* Changed from "properties" */
+this.eventListener = eventListener;
+this._nodeId = nodeId;
+WebInspector.ObjectPropertiesSection.call(this);
+this._setNodeTitle();
+this._setFunctionSubtitle();
+this.editable = false;
+this.element.className = "event-bar";  
+this.headerElement.addStyleClass("source-code");
+this.propertiesElement.className = "event-properties properties-tree source-code";  
 }
 
 WebInspector.EventListenerBar.prototype = {
-    update: function()
-    {
-        var properties = [];
-        for (var propertyName in this.eventListener) {
-            // Just build properties in place - no need to reach out for injected script.
-            var value = this.eventListener[propertyName];
-            if (value instanceof WebInspector.DOMNode)
-                value = new WebInspector.ObjectProxy(value.injectedScriptId, value.id, [], appropriateSelectorForNode(value), true);
-            else
-                value = WebInspector.ObjectProxy.wrapPrimitiveValue(value);
-            properties.push(new WebInspector.ObjectPropertyProxy(propertyName, value));
-        }
-        this.updateProperties(properties);
-    },
+update: function()
+{
+function updateWithNodeObject(nodeObject)
+{
+var properties = [];
+if (nodeObject)
+properties.push(new WebInspector.RemoteObjectProperty("node", nodeObject));
 
-    _getNodeDisplayName: function()
-    {
-        var node = this.eventListener.node;
-        if (!node)
-            return "";
+for (var propertyName in this.eventListener) {
+var value = WebInspector.RemoteObject.fromPrimitiveValue(this.eventListener[propertyName]);
+properties.push(new WebInspector.RemoteObjectProperty(propertyName, value));
+}
+this.updateProperties(properties);
+}
+var node = this.eventListener.node;
+delete this.eventListener.node;
+WebInspector.RemoteObject.resolveNode(node, updateWithNodeObject.bind(this));
+},
 
-        if (node.nodeType === Node.DOCUMENT_NODE)
-            return "document";
+_setNodeTitle: function()
+{
+var node = this.eventListener.node;
+if (!node)
+return;
 
-        return appropriateSelectorForNode(node);
-    },
+if (node.nodeType === Node.DOCUMENT_NODE) {
+this.titleElement.textContent = "document";
+return;
+}
 
-    _getFunctionDisplayName: function()
-    {
-        // Requires that Function.toString() return at least the function's signature.
-        var match = this.eventListener.listener.toString().match(/function ([^\(]+?)\(/);
-        return (match ? match[1] : WebInspector.UIString("(anonymous function)"));
-    }
+if (node.id === this._nodeId) {
+this.titleElement.textContent = appropriateSelectorForNode(node);
+return;
+}
+
+this.titleElement.removeChildren();
+this.titleElement.appendChild(WebInspector.panels.elements.linkifyNodeReference(this.eventListener.node));
+},
+
+_setFunctionSubtitle: function()
+{
+
+if (this.eventListener.sourceName) {
+this.subtitleElement.removeChildren();
+this.subtitleElement.appendChild(WebInspector.linkifyResourceAsNode(this.eventListener.sourceName, "scripts", this.eventListener.lineNumber));
+} else {
+var match = this.eventListener.listenerBody.match(/function ([^\(]+?)\(/);
+if (match)
+this.subtitleElement.textContent = match[1];
+else
+this.subtitleElement.textContent = WebInspector.UIString("(anonymous function)");
+}
+}
 }
 
 WebInspector.EventListenerBar.prototype.__proto__ = WebInspector.ObjectPropertiesSection.prototype;
 
-/* Color.js */
 
-/*
- * Copyright (C) 2009 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.Color = function(str)
 {
-    this.value = str;
-    this._parse();
+this.value = str;
+this._parse();
 }
 
 WebInspector.Color.prototype = {
-    get shorthex()
-    {
-        if ("_short" in this)
-            return this._short;
-
-        if (!this.simple)
-            return null;
-
-        var hex = this.hex;
-        if (hex.charAt(0) === hex.charAt(1) && hex.charAt(2) === hex.charAt(3) && hex.charAt(4) === hex.charAt(5))
-            this._short = hex.charAt(0) + hex.charAt(2) + hex.charAt(4);
-        else
-            this._short = hex;
-
-        return this._short;
-    },
-
-    get hex()
-    {
-        if (!this.simple)
-            return null;
-
-        return this._hex;
-    },
-
-    set hex(x)
-    {
-        this._hex = x;
-    },
-
-    get rgb()
-    {
-        if ("_rgb" in this)
-            return this._rgb;
-
-        if (this.simple)
-            this._rgb = this._hexToRGB(this.hex);
-        else {
-            var rgba = this.rgba;
-            this._rgb = [rgba[0], rgba[1], rgba[2]];
-        }
-
-        return this._rgb;
-    },
-
-    set rgb(x)
-    {
-        this._rgb = x;
-    },
-
-    get hsl()
-    {
-        if ("_hsl" in this)
-            return this._hsl;
-
-        this._hsl = this._rgbToHSL(this.rgb);
-        return this._hsl;
-    },
-
-    set hsl(x)
-    {
-        this._hsl = x;
-    },
-
-    get nickname()
-    {
-        if (typeof this._nickname !== "undefined") // would be set on parse if there was a nickname
-            return this._nickname;
-        else
-            return null;
-    },
-
-    set nickname(x)
-    {
-        this._nickname = x;
-    },
-
-    get rgba()
-    {
-        return this._rgba;
-    },
-
-    set rgba(x)
-    {
-        this._rgba = x;
-    },
-
-    get hsla()
-    {
-        return this._hsla;
-    },
-
-    set hsla(x)
-    {
-        this._hsla = x;
-    },
-
-    hasShortHex: function()
-    {
-        var shorthex = this.shorthex;
-        return (shorthex && shorthex.length === 3);
-    },
-
-    toString: function(format)
-    {
-        if (!format)
-            format = this.format;
-
-        switch (format) {
-            case "rgb":
-                return "rgb(" + this.rgb.join(", ") + ")";
-            case "rgba":
-                return "rgba(" + this.rgba.join(", ") + ")";
-            case "hsl":
-                var hsl = this.hsl;
-                return "hsl(" + hsl[0] + ", " + hsl[1] + "%, " + hsl[2] + "%)";
-            case "hsla":
-                var hsla = this.hsla;
-                return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
-            case "hex":
-                return "#" + this.hex;
-            case "shorthex":
-                return "#" + this.shorthex;
-            case "nickname":
-                return this.nickname;
-        }
-
-        throw "invalid color format";
-    },
-
-    _rgbToHex: function(rgb)
-    {
-        var r = parseInt(rgb[0]).toString(16);
-        var g = parseInt(rgb[1]).toString(16);
-        var b = parseInt(rgb[2]).toString(16);
-        if (r.length === 1)
-            r = "0" + r;
-        if (g.length === 1)
-            g = "0" + g;
-        if (b.length === 1)
-            b = "0" + b;
-
-        return (r + g + b).toUpperCase();
-    },
-
-    _hexToRGB: function(hex)
-    {
-        var r = parseInt(hex.substring(0,2), 16);
-        var g = parseInt(hex.substring(2,4), 16);
-        var b = parseInt(hex.substring(4,6), 16);
-
-        return [r, g, b];
-    },
-
-    _rgbToHSL: function(rgb)
-    {
-        var r = parseInt(rgb[0]) / 255;
-        var g = parseInt(rgb[1]) / 255;
-        var b = parseInt(rgb[2]) / 255;
-        var max = Math.max(r, g, b);
-        var min = Math.min(r, g, b);
-        var diff = max - min;
-        var add = max + min;
-
-        if (min === max)
-            var h = 0;
-        else if (r === max)
-            var h = ((60 * (g - b) / diff) + 360) % 360;
-        else if (g === max)
-            var h = (60 * (b - r) / diff) + 120;
-        else
-            var h = (60 * (r - g) / diff) + 240;
-
-        var l = 0.5 * add;
-
-        if (l === 0)
-            var s = 0;
-        else if (l === 1)
-            var s = 1;
-        else if (l <= 0.5)
-            var s = diff / add;
-        else
-            var s = diff / (2 - add);
-
-        h = Math.round(h);
-        s = Math.round(s*100);
-        l = Math.round(l*100);
-
-        return [h, s, l];
-    },
-
-    _hslToRGB: function(hsl)
-    {
-        var h = parseFloat(hsl[0]) / 360;
-        var s = parseFloat(hsl[1]) / 100;
-        var l = parseFloat(hsl[2]) / 100;
-
-        if (l <= 0.5)
-            var q = l * (1 + s);
-        else
-            var q = l + s - (l * s);
-
-        var p = 2 * l - q;
-
-        var tr = h + (1 / 3);
-        var tg = h;
-        var tb = h - (1 / 3);
-
-        var r = Math.round(hueToRGB(p, q, tr) * 255);
-        var g = Math.round(hueToRGB(p, q, tg) * 255);
-        var b = Math.round(hueToRGB(p, q, tb) * 255);
-        return [r, g, b];
-
-        function hueToRGB(p, q, h) {
-            if (h < 0)
-                h += 1;
-            else if (h > 1)
-                h -= 1;
-
-            if ((h * 6) < 1)
-                return p + (q - p) * h * 6;
-            else if ((h * 2) < 1)
-                return q;
-            else if ((h * 3) < 2)
-                return p + (q - p) * ((2 / 3) - h) * 6;
-            else
-                return p;
-        }
-    },
-
-    _rgbaToHSLA: function(rgba)
-    {
-        var alpha = rgba[3];
-        var hsl = this._rgbToHSL(rgba)
-        hsl.push(alpha);
-        return hsl;
-    },
-
-    _hslaToRGBA: function(hsla)
-    {
-        var alpha = hsla[3];
-        var rgb = this._hslToRGB(hsla);
-        rgb.push(alpha);
-        return rgb;
-    },
-
-    _parse: function()
-    {
-        // Special Values - Advanced but Must Be Parsed First - transparent
-        var value = this.value.toLowerCase().replace(/%|\s+/g, "");
-        if (value in WebInspector.Color.AdvancedNickNames) {
-            this.format = "nickname";
-            var set = WebInspector.Color.AdvancedNickNames[value];
-            this.simple = false;
-            this.rgba = set[0];
-            this.hsla = set[1];
-            this.nickname = set[2];
-            this.alpha = set[0][3];
-            return;
-        }
-
-        // Simple - #hex, rgb(), nickname, hsl()
-        var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;
-        var match = this.value.match(simple);
-        if (match) {
-            this.simple = true;
-
-            if (match[1]) { // hex
-                var hex = match[1].toUpperCase();
-                if (hex.length === 3) {
-                    this.format = "shorthex";
-                    this.hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
-                } else {
-                    this.format = "hex";
-                    this.hex = hex;
-                }
-            } else if (match[2]) { // rgb
-                this.format = "rgb";
-                var rgb = match[2].split(/\s*,\s*/);
-                this.rgb = rgb;
-                this.hex = this._rgbToHex(rgb);
-            } else if (match[3]) { // nickname
-                var nickname = match[3].toLowerCase();
-                if (nickname in WebInspector.Color.Nicknames) {
-                    this.format = "nickname";
-                    this.hex = WebInspector.Color.Nicknames[nickname];
-                } else // unknown name
-                    throw "unknown color name";
-            } else if (match[4]) { // hsl
-                this.format = "hsl";
-                var hsl = match[4].replace(/%g/, "").split(/\s*,\s*/);
-                this.hsl = hsl;
-                this.rgb = this._hslToRGB(hsl);
-                this.hex = this._rgbToHex(this.rgb);
-            }
-
-            // Fill in the values if this is a known hex color
-            var hex = this.hex;
-            if (hex && hex in WebInspector.Color.HexTable) {
-                var set = WebInspector.Color.HexTable[hex];
-                this.rgb = set[0];
-                this.hsl = set[1];
-                this.nickname = set[2];
-            }
-
-            return;
-        }
-
-        // Advanced - rgba(), hsla()
-        var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;
-        match = this.value.match(advanced);
-        if (match) {
-            this.simple = false;
-            if (match[1]) { // rgba
-                this.format = "rgba";
-                this.rgba = match[1].split(/\s*,\s*/);
-                this.hsla = this._rgbaToHSLA(this.rgba);
-                this.alpha = this.rgba[3];
-            } else if (match[2]) { // hsla
-                this.format = "hsla";
-                this.hsla = match[2].replace(/%/g, "").split(/\s*,\s*/);
-                this.rgba = this._hslaToRGBA(this.hsla);
-                this.alpha = this.hsla[3];
-            }
-
-            return;
-        }
-
-        // Could not parse as a valid color
-        throw "could not parse color";
-    }
-}
-
-// Simple Values: [rgb, hsl, nickname]
-WebInspector.Color.HexTable = {
-    "000000": [[0, 0, 0], [0, 0, 0], "black"],
-    "000080": [[0, 0, 128], [240, 100, 25], "navy"],
-    "00008B": [[0, 0, 139], [240, 100, 27], "darkBlue"],
-    "0000CD": [[0, 0, 205], [240, 100, 40], "mediumBlue"],
-    "0000FF": [[0, 0, 255], [240, 100, 50], "blue"],
-    "006400": [[0, 100, 0], [120, 100, 20], "darkGreen"],
-    "008000": [[0, 128, 0], [120, 100, 25], "green"],
-    "008080": [[0, 128, 128], [180, 100, 25], "teal"],
-    "008B8B": [[0, 139, 139], [180, 100, 27], "darkCyan"],
-    "00BFFF": [[0, 191, 255], [195, 100, 50], "deepSkyBlue"],
-    "00CED1": [[0, 206, 209], [181, 100, 41], "darkTurquoise"],
-    "00FA9A": [[0, 250, 154], [157, 100, 49], "mediumSpringGreen"],
-    "00FF00": [[0, 255, 0], [120, 100, 50], "lime"],
-    "00FF7F": [[0, 255, 127], [150, 100, 50], "springGreen"],
-    "00FFFF": [[0, 255, 255], [180, 100, 50], "cyan"],
-    "191970": [[25, 25, 112], [240, 64, 27], "midnightBlue"],
-    "1E90FF": [[30, 144, 255], [210, 100, 56], "dodgerBlue"],
-    "20B2AA": [[32, 178, 170], [177, 70, 41], "lightSeaGreen"],
-    "228B22": [[34, 139, 34], [120, 61, 34], "forestGreen"],
-    "2E8B57": [[46, 139, 87], [146, 50, 36], "seaGreen"],
-    "2F4F4F": [[47, 79, 79], [180, 25, 25], "darkSlateGray"],
-    "32CD32": [[50, 205, 50], [120, 61, 50], "limeGreen"],
-    "3CB371": [[60, 179, 113], [147, 50, 47], "mediumSeaGreen"],
-    "40E0D0": [[64, 224, 208], [174, 72, 56], "turquoise"],
-    "4169E1": [[65, 105, 225], [225, 73, 57], "royalBlue"],
-    "4682B4": [[70, 130, 180], [207, 44, 49], "steelBlue"],
-    "483D8B": [[72, 61, 139], [248, 39, 39], "darkSlateBlue"],
-    "48D1CC": [[72, 209, 204], [178, 60, 55], "mediumTurquoise"],
-    "4B0082": [[75, 0, 130], [275, 100, 25], "indigo"],
-    "556B2F": [[85, 107, 47], [82, 39, 30], "darkOliveGreen"],
-    "5F9EA0": [[95, 158, 160], [182, 25, 50], "cadetBlue"],
-    "6495ED": [[100, 149, 237], [219, 79, 66], "cornflowerBlue"],
-    "66CDAA": [[102, 205, 170], [160, 51, 60], "mediumAquaMarine"],
-    "696969": [[105, 105, 105], [0, 0, 41], "dimGray"],
-    "6A5ACD": [[106, 90, 205], [248, 53, 58], "slateBlue"],
-    "6B8E23": [[107, 142, 35], [80, 60, 35], "oliveDrab"],
-    "708090": [[112, 128, 144], [210, 13, 50], "slateGray"],
-    "778899": [[119, 136, 153], [210, 14, 53], "lightSlateGray"],
-    "7B68EE": [[123, 104, 238], [249, 80, 67], "mediumSlateBlue"],
-    "7CFC00": [[124, 252, 0], [90, 100, 49], "lawnGreen"],
-    "7FFF00": [[127, 255, 0], [90, 100, 50], "chartreuse"],
-    "7FFFD4": [[127, 255, 212], [160, 100, 75], "aquamarine"],
-    "800000": [[128, 0, 0], [0, 100, 25], "maroon"],
-    "800080": [[128, 0, 128], [300, 100, 25], "purple"],
-    "808000": [[128, 128, 0], [60, 100, 25], "olive"],
-    "808080": [[128, 128, 128], [0, 0, 50], "gray"],
-    "87CEEB": [[135, 206, 235], [197, 71, 73], "skyBlue"],
-    "87CEFA": [[135, 206, 250], [203, 92, 75], "lightSkyBlue"],
-    "8A2BE2": [[138, 43, 226], [271, 76, 53], "blueViolet"],
-    "8B0000": [[139, 0, 0], [0, 100, 27], "darkRed"],
-    "8B008B": [[139, 0, 139], [300, 100, 27], "darkMagenta"],
-    "8B4513": [[139, 69, 19], [25, 76, 31], "saddleBrown"],
-    "8FBC8F": [[143, 188, 143], [120, 25, 65], "darkSeaGreen"],
-    "90EE90": [[144, 238, 144], [120, 73, 75], "lightGreen"],
-    "9370D8": [[147, 112, 219], [260, 60, 65], "mediumPurple"],
-    "9400D3": [[148, 0, 211], [282, 100, 41], "darkViolet"],
-    "98FB98": [[152, 251, 152], [120, 93, 79], "paleGreen"],
-    "9932CC": [[153, 50, 204], [280, 61, 50], "darkOrchid"],
-    "9ACD32": [[154, 205, 50], [80, 61, 50], "yellowGreen"],
-    "A0522D": [[160, 82, 45], [19, 56, 40], "sienna"],
-    "A52A2A": [[165, 42, 42], [0, 59, 41], "brown"],
-    "A9A9A9": [[169, 169, 169], [0, 0, 66], "darkGray"],
-    "ADD8E6": [[173, 216, 230], [195, 53, 79], "lightBlue"],
-    "ADFF2F": [[173, 255, 47], [84, 100, 59], "greenYellow"],
-    "AFEEEE": [[175, 238, 238], [180, 65, 81], "paleTurquoise"],
-    "B0C4DE": [[176, 196, 222], [214, 41, 78], "lightSteelBlue"],
-    "B0E0E6": [[176, 224, 230], [187, 52, 80], "powderBlue"],
-    "B22222": [[178, 34, 34], [0, 68, 42], "fireBrick"],
-    "B8860B": [[184, 134, 11], [43, 89, 38], "darkGoldenrod"],
-    "BA55D3": [[186, 85, 211], [288, 59, 58], "mediumOrchid"],
-    "BC8F8F": [[188, 143, 143], [0, 25, 65], "rosyBrown"],
-    "BDB76B": [[189, 183, 107], [56, 38, 58], "darkKhaki"],
-    "C0C0C0": [[192, 192, 192], [0, 0, 75], "silver"],
-    "C71585": [[199, 21, 133], [322, 81, 43], "mediumVioletRed"],
-    "CD5C5C": [[205, 92, 92], [0, 53, 58], "indianRed"],
-    "CD853F": [[205, 133, 63], [30, 59, 53], "peru"],
-    "D2691E": [[210, 105, 30], [25, 75, 47], "chocolate"],
-    "D2B48C": [[210, 180, 140], [34, 44, 69], "tan"],
-    "D3D3D3": [[211, 211, 211], [0, 0, 83], "lightGrey"],
-    "D87093": [[219, 112, 147], [340, 60, 65], "paleVioletRed"],
-    "D8BFD8": [[216, 191, 216], [300, 24, 80], "thistle"],
-    "DA70D6": [[218, 112, 214], [302, 59, 65], "orchid"],
-    "DAA520": [[218, 165, 32], [43, 74, 49], "goldenrod"],
-    "DC143C": [[237, 164, 61], [35, 83, 58], "crimson"],
-    "DCDCDC": [[220, 220, 220], [0, 0, 86], "gainsboro"],
-    "DDA0DD": [[221, 160, 221], [300, 47, 75], "plum"],
-    "DEB887": [[222, 184, 135], [34, 57, 70], "burlyWood"],
-    "E0FFFF": [[224, 255, 255], [180, 100, 94], "lightCyan"],
-    "E6E6FA": [[230, 230, 250], [240, 67, 94], "lavender"],
-    "E9967A": [[233, 150, 122], [15, 72, 70], "darkSalmon"],
-    "EE82EE": [[238, 130, 238], [300, 76, 72], "violet"],
-    "EEE8AA": [[238, 232, 170], [55, 67, 80], "paleGoldenrod"],
-    "F08080": [[240, 128, 128], [0, 79, 72], "lightCoral"],
-    "F0E68C": [[240, 230, 140], [54, 77, 75], "khaki"],
-    "F0F8FF": [[240, 248, 255], [208, 100, 97], "aliceBlue"],
-    "F0FFF0": [[240, 255, 240], [120, 100, 97], "honeyDew"],
-    "F0FFFF": [[240, 255, 255], [180, 100, 97], "azure"],
-    "F4A460": [[244, 164, 96], [28, 87, 67], "sandyBrown"],
-    "F5DEB3": [[245, 222, 179], [39, 77, 83], "wheat"],
-    "F5F5DC": [[245, 245, 220], [60, 56, 91], "beige"],
-    "F5F5F5": [[245, 245, 245], [0, 0, 96], "whiteSmoke"],
-    "F5FFFA": [[245, 255, 250], [150, 100, 98], "mintCream"],
-    "F8F8FF": [[248, 248, 255], [240, 100, 99], "ghostWhite"],
-    "FA8072": [[250, 128, 114], [6, 93, 71], "salmon"],
-    "FAEBD7": [[250, 235, 215], [34, 78, 91], "antiqueWhite"],
-    "FAF0E6": [[250, 240, 230], [30, 67, 94], "linen"],
-    "FAFAD2": [[250, 250, 210], [60, 80, 90], "lightGoldenrodYellow"],
-    "FDF5E6": [[253, 245, 230], [39, 85, 95], "oldLace"],
-    "FF0000": [[255, 0, 0], [0, 100, 50], "red"],
-    "FF00FF": [[255, 0, 255], [300, 100, 50], "magenta"],
-    "FF1493": [[255, 20, 147], [328, 100, 54], "deepPink"],
-    "FF4500": [[255, 69, 0], [16, 100, 50], "orangeRed"],
-    "FF6347": [[255, 99, 71], [9, 100, 64], "tomato"],
-    "FF69B4": [[255, 105, 180], [330, 100, 71], "hotPink"],
-    "FF7F50": [[255, 127, 80], [16, 100, 66], "coral"],
-    "FF8C00": [[255, 140, 0], [33, 100, 50], "darkOrange"],
-    "FFA07A": [[255, 160, 122], [17, 100, 74], "lightSalmon"],
-    "FFA500": [[255, 165, 0], [39, 100, 50], "orange"],
-    "FFB6C1": [[255, 182, 193], [351, 100, 86], "lightPink"],
-    "FFC0CB": [[255, 192, 203], [350, 100, 88], "pink"],
-    "FFD700": [[255, 215, 0], [51, 100, 50], "gold"],
-    "FFDAB9": [[255, 218, 185], [28, 100, 86], "peachPuff"],
-    "FFDEAD": [[255, 222, 173], [36, 100, 84], "navajoWhite"],
-    "FFE4B5": [[255, 228, 181], [38, 100, 85], "moccasin"],
-    "FFE4C4": [[255, 228, 196], [33, 100, 88], "bisque"],
-    "FFE4E1": [[255, 228, 225], [6, 100, 94], "mistyRose"],
-    "FFEBCD": [[255, 235, 205], [36, 100, 90], "blanchedAlmond"],
-    "FFEFD5": [[255, 239, 213], [37, 100, 92], "papayaWhip"],
-    "FFF0F5": [[255, 240, 245], [340, 100, 97], "lavenderBlush"],
-    "FFF5EE": [[255, 245, 238], [25, 100, 97], "seaShell"],
-    "FFF8DC": [[255, 248, 220], [48, 100, 93], "cornsilk"],
-    "FFFACD": [[255, 250, 205], [54, 100, 90], "lemonChiffon"],
-    "FFFAF0": [[255, 250, 240], [40, 100, 97], "floralWhite"],
-    "FFFAFA": [[255, 250, 250], [0, 100, 99], "snow"],
-    "FFFF00": [[255, 255, 0], [60, 100, 50], "yellow"],
-    "FFFFE0": [[255, 255, 224], [60, 100, 94], "lightYellow"],
-    "FFFFF0": [[255, 255, 240], [60, 100, 97], "ivory"],
-    "FFFFFF": [[255, 255, 255], [0, 100, 100], "white"]
-};
-
-// Simple Values
-WebInspector.Color.Nicknames = {
-    "aliceblue": "F0F8FF",
-    "antiquewhite": "FAEBD7",
-    "aqua": "00FFFF",
-    "aquamarine": "7FFFD4",
-    "azure": "F0FFFF",
-    "beige": "F5F5DC",
-    "bisque": "FFE4C4",
-    "black": "000000",
-    "blanchedalmond": "FFEBCD",
-    "blue": "0000FF",
-    "blueviolet": "8A2BE2",
-    "brown": "A52A2A",
-    "burlywood": "DEB887",
-    "cadetblue": "5F9EA0",
-    "chartreuse": "7FFF00",
-    "chocolate": "D2691E",
-    "coral": "FF7F50",
-    "cornflowerblue": "6495ED",
-    "cornsilk": "FFF8DC",
-    "crimson": "DC143C",
-    "cyan": "00FFFF",
-    "darkblue": "00008B",
-    "darkcyan": "008B8B",
-    "darkgoldenrod": "B8860B",
-    "darkgray": "A9A9A9",
-    "darkgreen": "006400",
-    "darkkhaki": "BDB76B",
-    "darkmagenta": "8B008B",
-    "darkolivegreen": "556B2F",
-    "darkorange": "FF8C00",
-    "darkorchid": "9932CC",
-    "darkred": "8B0000",
-    "darksalmon": "E9967A",
-    "darkseagreen": "8FBC8F",
-    "darkslateblue": "483D8B",
-    "darkslategray": "2F4F4F",
-    "darkturquoise": "00CED1",
-    "darkviolet": "9400D3",
-    "deeppink": "FF1493",
-    "deepskyblue": "00BFFF",
-    "dimgray": "696969",
-    "dodgerblue": "1E90FF",
-    "firebrick": "B22222",
-    "floralwhite": "FFFAF0",
-    "forestgreen": "228B22",
-    "fuchsia": "FF00FF",
-    "gainsboro": "DCDCDC",
-    "ghostwhite": "F8F8FF",
-    "gold": "FFD700",
-    "goldenrod": "DAA520",
-    "gray": "808080",
-    "green": "008000",
-    "greenyellow": "ADFF2F",
-    "honeydew": "F0FFF0",
-    "hotpink": "FF69B4",
-    "indianred": "CD5C5C",
-    "indigo": "4B0082",
-    "ivory": "FFFFF0",
-    "khaki": "F0E68C",
-    "lavender": "E6E6FA",
-    "lavenderblush": "FFF0F5",
-    "lawngreen": "7CFC00",
-    "lemonchiffon": "FFFACD",
-    "lightblue": "ADD8E6",
-    "lightcoral": "F08080",
-    "lightcyan": "E0FFFF",
-    "lightgoldenrodyellow": "FAFAD2",
-    "lightgreen": "90EE90",
-    "lightgrey": "D3D3D3",
-    "lightpink": "FFB6C1",
-    "lightsalmon": "FFA07A",
-    "lightseagreen": "20B2AA",
-    "lightskyblue": "87CEFA",
-    "lightslategray": "778899",
-    "lightsteelblue": "B0C4DE",
-    "lightyellow": "FFFFE0",
-    "lime": "00FF00",
-    "limegreen": "32CD32",
-    "linen": "FAF0E6",
-    "magenta": "FF00FF",
-    "maroon": "800000",
-    "mediumaquamarine": "66CDAA",
-    "mediumblue": "0000CD",
-    "mediumorchid": "BA55D3",
-    "mediumpurple": "9370D8",
-    "mediumseagreen": "3CB371",
-    "mediumslateblue": "7B68EE",
-    "mediumspringgreen": "00FA9A",
-    "mediumturquoise": "48D1CC",
-    "mediumvioletred": "C71585",
-    "midnightblue": "191970",
-    "mintcream": "F5FFFA",
-    "mistyrose": "FFE4E1",
-    "moccasin": "FFE4B5",
-    "navajowhite": "FFDEAD",
-    "navy": "000080",
-    "oldlace": "FDF5E6",
-    "olive": "808000",
-    "olivedrab": "6B8E23",
-    "orange": "FFA500",
-    "orangered": "FF4500",
-    "orchid": "DA70D6",
-    "palegoldenrod": "EEE8AA",
-    "palegreen": "98FB98",
-    "paleturquoise": "AFEEEE",
-    "palevioletred": "D87093",
-    "papayawhip": "FFEFD5",
-    "peachpuff": "FFDAB9",
-    "peru": "CD853F",
-    "pink": "FFC0CB",
-    "plum": "DDA0DD",
-    "powderblue": "B0E0E6",
-    "purple": "800080",
-    "red": "FF0000",
-    "rosybrown": "BC8F8F",
-    "royalblue": "4169E1",
-    "saddlebrown": "8B4513",
-    "salmon": "FA8072",
-    "sandybrown": "F4A460",
-    "seagreen": "2E8B57",
-    "seashell": "FFF5EE",
-    "sienna": "A0522D",
-    "silver": "C0C0C0",
-    "skyblue": "87CEEB",
-    "slateblue": "6A5ACD",
-    "slategray": "708090",
-    "snow": "FFFAFA",
-    "springgreen": "00FF7F",
-    "steelblue": "4682B4",
-    "tan": "D2B48C",
-    "teal": "008080",
-    "thistle": "D8BFD8",
-    "tomato": "FF6347",
-    "turquoise": "40E0D0",
-    "violet": "EE82EE",
-    "wheat": "F5DEB3",
-    "white": "FFFFFF",
-    "whitesmoke": "F5F5F5",
-    "yellow": "FFFF00",
-    "yellowgreen": "9ACD32"
-};
-
-// Advanced Values [rgba, hsla, nickname]
-WebInspector.Color.AdvancedNickNames = {
-    "transparent": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
-    "rgba(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
-    "hsla(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
-};
-
-/* StylesSidebarPane.js */
-
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.StylesSidebarPane = function()
+get shorthex()
 {
-    WebInspector.SidebarPane.call(this, WebInspector.UIString("Styles"));
+if ("_short" in this)
+return this._short;
 
-    this.settingsSelectElement = document.createElement("select");
+if (!this.simple)
+return null;
 
-    var option = document.createElement("option");
-    option.value = "hex";
-    option.action = this._changeColorFormat.bind(this);
-    option.label = WebInspector.UIString("Hex Colors");
-    this.settingsSelectElement.appendChild(option);
+var hex = this.hex;
+if (hex.charAt(0) === hex.charAt(1) && hex.charAt(2) === hex.charAt(3) && hex.charAt(4) === hex.charAt(5))
+this._short = hex.charAt(0) + hex.charAt(2) + hex.charAt(4);
+else
+this._short = hex;
 
-    option = document.createElement("option");
-    option.value = "rgb";
-    option.action = this._changeColorFormat.bind(this);
-    option.label = WebInspector.UIString("RGB Colors");
-    this.settingsSelectElement.appendChild(option);
+return this._short;
+},
 
-    option = document.createElement("option");
-    option.value = "hsl";
-    option.action = this._changeColorFormat.bind(this);
-    option.label = WebInspector.UIString("HSL Colors");
-    this.settingsSelectElement.appendChild(option);
+get hex()
+{
+if (!this.simple)
+return null;
 
-    this.settingsSelectElement.appendChild(document.createElement("hr"));
+return this._hex;
+},
 
-    option = document.createElement("option");
-    option.action = this._createNewRule.bind(this);
-    option.label = WebInspector.UIString("New Style Rule");
-    this.settingsSelectElement.appendChild(option);
+set hex(x)
+{
+this._hex = x;
+},
 
-    this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false);
-    this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
-    WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
+get rgb()
+{
+if ("_rgb" in this)
+return this._rgb;
 
-    this.titleElement.appendChild(this.settingsSelectElement);
+if (this.simple)
+this._rgb = this._hexToRGB(this.hex);
+else {
+var rgba = this.rgba;
+this._rgb = [rgba[0], rgba[1], rgba[2]];
 }
 
+return this._rgb;
+},
+
+set rgb(x)
+{
+this._rgb = x;
+},
+
+get hsl()
+{
+if ("_hsl" in this)
+return this._hsl;
+
+this._hsl = this._rgbToHSL(this.rgb);
+return this._hsl;
+},
+
+set hsl(x)
+{
+this._hsl = x;
+},
+
+get nickname()
+{
+if (typeof this._nickname !== "undefined") 
+return this._nickname;
+else
+return null;
+},
+
+set nickname(x)
+{
+this._nickname = x;
+},
+
+get rgba()
+{
+return this._rgba;
+},
+
+set rgba(x)
+{
+this._rgba = x;
+},
+
+get hsla()
+{
+return this._hsla;
+},
+
+set hsla(x)
+{
+this._hsla = x;
+},
+
+hasShortHex: function()
+{
+var shorthex = this.shorthex;
+return (shorthex && shorthex.length === 3);
+},
+
+toString: function(format)
+{
+if (!format)
+format = this.format;
+
+switch (format) {
+case "original":
+return this.value;
+case "rgb":
+return "rgb(" + this.rgb.join(", ") + ")";
+case "rgba":
+return "rgba(" + this.rgba.join(", ") + ")";
+case "hsl":
+var hsl = this.hsl;
+return "hsl(" + hsl[0] + ", " + hsl[1] + "%, " + hsl[2] + "%)";
+case "hsla":
+var hsla = this.hsla;
+return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")";
+case "hex":
+return "#" + this.hex;
+case "shorthex":
+return "#" + this.shorthex;
+case "nickname":
+return this.nickname;
+}
+
+throw "invalid color format";
+},
+
+_rgbToHex: function(rgb)
+{
+var r = parseInt(rgb[0]).toString(16);
+var g = parseInt(rgb[1]).toString(16);
+var b = parseInt(rgb[2]).toString(16);
+if (r.length === 1)
+r = "0" + r;
+if (g.length === 1)
+g = "0" + g;
+if (b.length === 1)
+b = "0" + b;
+
+return (r + g + b).toUpperCase();
+},
+
+_hexToRGB: function(hex)
+{
+var r = parseInt(hex.substring(0,2), 16);
+var g = parseInt(hex.substring(2,4), 16);
+var b = parseInt(hex.substring(4,6), 16);
+
+return [r, g, b];
+},
+
+_rgbToHSL: function(rgb)
+{
+var r = parseInt(rgb[0]) / 255;
+var g = parseInt(rgb[1]) / 255;
+var b = parseInt(rgb[2]) / 255;
+var max = Math.max(r, g, b);
+var min = Math.min(r, g, b);
+var diff = max - min;
+var add = max + min;
+
+if (min === max)
+var h = 0;
+else if (r === max)
+var h = ((60 * (g - b) / diff) + 360) % 360;
+else if (g === max)
+var h = (60 * (b - r) / diff) + 120;
+else
+var h = (60 * (r - g) / diff) + 240;
+
+var l = 0.5 * add;
+
+if (l === 0)
+var s = 0;
+else if (l === 1)
+var s = 1;
+else if (l <= 0.5)
+var s = diff / add;
+else
+var s = diff / (2 - add);
+
+h = Math.round(h);
+s = Math.round(s*100);
+l = Math.round(l*100);
+
+return [h, s, l];
+},
+
+_hslToRGB: function(hsl)
+{
+var h = parseFloat(hsl[0]) / 360;
+var s = parseFloat(hsl[1]) / 100;
+var l = parseFloat(hsl[2]) / 100;
+
+if (l <= 0.5)
+var q = l * (1 + s);
+else
+var q = l + s - (l * s);
+
+var p = 2 * l - q;
+
+var tr = h + (1 / 3);
+var tg = h;
+var tb = h - (1 / 3);
+
+var r = Math.round(hueToRGB(p, q, tr) * 255);
+var g = Math.round(hueToRGB(p, q, tg) * 255);
+var b = Math.round(hueToRGB(p, q, tb) * 255);
+return [r, g, b];
+
+function hueToRGB(p, q, h) {
+if (h < 0)
+h += 1;
+else if (h > 1)
+h -= 1;
+
+if ((h * 6) < 1)
+return p + (q - p) * h * 6;
+else if ((h * 2) < 1)
+return q;
+else if ((h * 3) < 2)
+return p + (q - p) * ((2 / 3) - h) * 6;
+else
+return p;
+}
+},
+
+_rgbaToHSLA: function(rgba)
+{
+var alpha = rgba[3];
+var hsl = this._rgbToHSL(rgba)
+hsl.push(alpha);
+return hsl;
+},
+
+_hslaToRGBA: function(hsla)
+{
+var alpha = hsla[3];
+var rgb = this._hslToRGB(hsla);
+rgb.push(alpha);
+return rgb;
+},
+
+_parse: function()
+{
+
+var value = this.value.toLowerCase().replace(/%|\s+/g, "");
+if (value in WebInspector.Color.AdvancedNickNames) {
+this.format = "nickname";
+var set = WebInspector.Color.AdvancedNickNames[value];
+this.simple = false;
+this.rgba = set[0];
+this.hsla = set[1];
+this.nickname = set[2];
+this.alpha = set[0][3];
+return;
+}
+
+
+var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;
+var match = this.value.match(simple);
+if (match) {
+this.simple = true;
+
+if (match[1]) { 
+var hex = match[1].toUpperCase();
+if (hex.length === 3) {
+this.format = "shorthex";
+this.hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
+} else {
+this.format = "hex";
+this.hex = hex;
+}
+} else if (match[2]) { 
+this.format = "rgb";
+var rgb = match[2].split(/\s*,\s*/);
+this.rgb = rgb;
+this.hex = this._rgbToHex(rgb);
+} else if (match[3]) { 
+var nickname = match[3].toLowerCase();
+if (nickname in WebInspector.Color.Nicknames) {
+this.format = "nickname";
+this.hex = WebInspector.Color.Nicknames[nickname];
+} else 
+throw "unknown color name";
+} else if (match[4]) { 
+this.format = "hsl";
+var hsl = match[4].replace(/%/g, "").split(/\s*,\s*/);
+this.hsl = hsl;
+this.rgb = this._hslToRGB(hsl);
+this.hex = this._rgbToHex(this.rgb);
+}
+
+
+var hex = this.hex;
+if (hex && hex in WebInspector.Color.HexTable) {
+var set = WebInspector.Color.HexTable[hex];
+this.rgb = set[0];
+this.hsl = set[1];
+this.nickname = set[2];
+}
+
+return;
+}
+
+
+var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/;
+match = this.value.match(advanced);
+if (match) {
+this.simple = false;
+if (match[1]) { 
+this.format = "rgba";
+this.rgba = match[1].split(/\s*,\s*/);
+this.hsla = this._rgbaToHSLA(this.rgba);
+this.alpha = this.rgba[3];
+} else if (match[2]) { 
+this.format = "hsla";
+this.hsla = match[2].replace(/%/g, "").split(/\s*,\s*/);
+this.rgba = this._hslaToRGBA(this.hsla);
+this.alpha = this.hsla[3];
+}
+
+return;
+}
+
+
+throw "could not parse color";
+}
+}
+
+
+WebInspector.Color.HexTable = {
+"000000": [[0, 0, 0], [0, 0, 0], "black"],
+"000080": [[0, 0, 128], [240, 100, 25], "navy"],
+"00008B": [[0, 0, 139], [240, 100, 27], "darkBlue"],
+"0000CD": [[0, 0, 205], [240, 100, 40], "mediumBlue"],
+"0000FF": [[0, 0, 255], [240, 100, 50], "blue"],
+"006400": [[0, 100, 0], [120, 100, 20], "darkGreen"],
+"008000": [[0, 128, 0], [120, 100, 25], "green"],
+"008080": [[0, 128, 128], [180, 100, 25], "teal"],
+"008B8B": [[0, 139, 139], [180, 100, 27], "darkCyan"],
+"00BFFF": [[0, 191, 255], [195, 100, 50], "deepSkyBlue"],
+"00CED1": [[0, 206, 209], [181, 100, 41], "darkTurquoise"],
+"00FA9A": [[0, 250, 154], [157, 100, 49], "mediumSpringGreen"],
+"00FF00": [[0, 255, 0], [120, 100, 50], "lime"],
+"00FF7F": [[0, 255, 127], [150, 100, 50], "springGreen"],
+"00FFFF": [[0, 255, 255], [180, 100, 50], "cyan"],
+"191970": [[25, 25, 112], [240, 64, 27], "midnightBlue"],
+"1E90FF": [[30, 144, 255], [210, 100, 56], "dodgerBlue"],
+"20B2AA": [[32, 178, 170], [177, 70, 41], "lightSeaGreen"],
+"228B22": [[34, 139, 34], [120, 61, 34], "forestGreen"],
+"2E8B57": [[46, 139, 87], [146, 50, 36], "seaGreen"],
+"2F4F4F": [[47, 79, 79], [180, 25, 25], "darkSlateGray"],
+"32CD32": [[50, 205, 50], [120, 61, 50], "limeGreen"],
+"3CB371": [[60, 179, 113], [147, 50, 47], "mediumSeaGreen"],
+"40E0D0": [[64, 224, 208], [174, 72, 56], "turquoise"],
+"4169E1": [[65, 105, 225], [225, 73, 57], "royalBlue"],
+"4682B4": [[70, 130, 180], [207, 44, 49], "steelBlue"],
+"483D8B": [[72, 61, 139], [248, 39, 39], "darkSlateBlue"],
+"48D1CC": [[72, 209, 204], [178, 60, 55], "mediumTurquoise"],
+"4B0082": [[75, 0, 130], [275, 100, 25], "indigo"],
+"556B2F": [[85, 107, 47], [82, 39, 30], "darkOliveGreen"],
+"5F9EA0": [[95, 158, 160], [182, 25, 50], "cadetBlue"],
+"6495ED": [[100, 149, 237], [219, 79, 66], "cornflowerBlue"],
+"66CDAA": [[102, 205, 170], [160, 51, 60], "mediumAquaMarine"],
+"696969": [[105, 105, 105], [0, 0, 41], "dimGray"],
+"6A5ACD": [[106, 90, 205], [248, 53, 58], "slateBlue"],
+"6B8E23": [[107, 142, 35], [80, 60, 35], "oliveDrab"],
+"708090": [[112, 128, 144], [210, 13, 50], "slateGray"],
+"778899": [[119, 136, 153], [210, 14, 53], "lightSlateGray"],
+"7B68EE": [[123, 104, 238], [249, 80, 67], "mediumSlateBlue"],
+"7CFC00": [[124, 252, 0], [90, 100, 49], "lawnGreen"],
+"7FFF00": [[127, 255, 0], [90, 100, 50], "chartreuse"],
+"7FFFD4": [[127, 255, 212], [160, 100, 75], "aquamarine"],
+"800000": [[128, 0, 0], [0, 100, 25], "maroon"],
+"800080": [[128, 0, 128], [300, 100, 25], "purple"],
+"808000": [[128, 128, 0], [60, 100, 25], "olive"],
+"808080": [[128, 128, 128], [0, 0, 50], "gray"],
+"87CEEB": [[135, 206, 235], [197, 71, 73], "skyBlue"],
+"87CEFA": [[135, 206, 250], [203, 92, 75], "lightSkyBlue"],
+"8A2BE2": [[138, 43, 226], [271, 76, 53], "blueViolet"],
+"8B0000": [[139, 0, 0], [0, 100, 27], "darkRed"],
+"8B008B": [[139, 0, 139], [300, 100, 27], "darkMagenta"],
+"8B4513": [[139, 69, 19], [25, 76, 31], "saddleBrown"],
+"8FBC8F": [[143, 188, 143], [120, 25, 65], "darkSeaGreen"],
+"90EE90": [[144, 238, 144], [120, 73, 75], "lightGreen"],
+"9370D8": [[147, 112, 219], [260, 60, 65], "mediumPurple"],
+"9400D3": [[148, 0, 211], [282, 100, 41], "darkViolet"],
+"98FB98": [[152, 251, 152], [120, 93, 79], "paleGreen"],
+"9932CC": [[153, 50, 204], [280, 61, 50], "darkOrchid"],
+"9ACD32": [[154, 205, 50], [80, 61, 50], "yellowGreen"],
+"A0522D": [[160, 82, 45], [19, 56, 40], "sienna"],
+"A52A2A": [[165, 42, 42], [0, 59, 41], "brown"],
+"A9A9A9": [[169, 169, 169], [0, 0, 66], "darkGray"],
+"ADD8E6": [[173, 216, 230], [195, 53, 79], "lightBlue"],
+"ADFF2F": [[173, 255, 47], [84, 100, 59], "greenYellow"],
+"AFEEEE": [[175, 238, 238], [180, 65, 81], "paleTurquoise"],
+"B0C4DE": [[176, 196, 222], [214, 41, 78], "lightSteelBlue"],
+"B0E0E6": [[176, 224, 230], [187, 52, 80], "powderBlue"],
+"B22222": [[178, 34, 34], [0, 68, 42], "fireBrick"],
+"B8860B": [[184, 134, 11], [43, 89, 38], "darkGoldenrod"],
+"BA55D3": [[186, 85, 211], [288, 59, 58], "mediumOrchid"],
+"BC8F8F": [[188, 143, 143], [0, 25, 65], "rosyBrown"],
+"BDB76B": [[189, 183, 107], [56, 38, 58], "darkKhaki"],
+"C0C0C0": [[192, 192, 192], [0, 0, 75], "silver"],
+"C71585": [[199, 21, 133], [322, 81, 43], "mediumVioletRed"],
+"CD5C5C": [[205, 92, 92], [0, 53, 58], "indianRed"],
+"CD853F": [[205, 133, 63], [30, 59, 53], "peru"],
+"D2691E": [[210, 105, 30], [25, 75, 47], "chocolate"],
+"D2B48C": [[210, 180, 140], [34, 44, 69], "tan"],
+"D3D3D3": [[211, 211, 211], [0, 0, 83], "lightGrey"],
+"D87093": [[219, 112, 147], [340, 60, 65], "paleVioletRed"],
+"D8BFD8": [[216, 191, 216], [300, 24, 80], "thistle"],
+"DA70D6": [[218, 112, 214], [302, 59, 65], "orchid"],
+"DAA520": [[218, 165, 32], [43, 74, 49], "goldenrod"],
+"DC143C": [[237, 164, 61], [35, 83, 58], "crimson"],
+"DCDCDC": [[220, 220, 220], [0, 0, 86], "gainsboro"],
+"DDA0DD": [[221, 160, 221], [300, 47, 75], "plum"],
+"DEB887": [[222, 184, 135], [34, 57, 70], "burlyWood"],
+"E0FFFF": [[224, 255, 255], [180, 100, 94], "lightCyan"],
+"E6E6FA": [[230, 230, 250], [240, 67, 94], "lavender"],
+"E9967A": [[233, 150, 122], [15, 72, 70], "darkSalmon"],
+"EE82EE": [[238, 130, 238], [300, 76, 72], "violet"],
+"EEE8AA": [[238, 232, 170], [55, 67, 80], "paleGoldenrod"],
+"F08080": [[240, 128, 128], [0, 79, 72], "lightCoral"],
+"F0E68C": [[240, 230, 140], [54, 77, 75], "khaki"],
+"F0F8FF": [[240, 248, 255], [208, 100, 97], "aliceBlue"],
+"F0FFF0": [[240, 255, 240], [120, 100, 97], "honeyDew"],
+"F0FFFF": [[240, 255, 255], [180, 100, 97], "azure"],
+"F4A460": [[244, 164, 96], [28, 87, 67], "sandyBrown"],
+"F5DEB3": [[245, 222, 179], [39, 77, 83], "wheat"],
+"F5F5DC": [[245, 245, 220], [60, 56, 91], "beige"],
+"F5F5F5": [[245, 245, 245], [0, 0, 96], "whiteSmoke"],
+"F5FFFA": [[245, 255, 250], [150, 100, 98], "mintCream"],
+"F8F8FF": [[248, 248, 255], [240, 100, 99], "ghostWhite"],
+"FA8072": [[250, 128, 114], [6, 93, 71], "salmon"],
+"FAEBD7": [[250, 235, 215], [34, 78, 91], "antiqueWhite"],
+"FAF0E6": [[250, 240, 230], [30, 67, 94], "linen"],
+"FAFAD2": [[250, 250, 210], [60, 80, 90], "lightGoldenrodYellow"],
+"FDF5E6": [[253, 245, 230], [39, 85, 95], "oldLace"],
+"FF0000": [[255, 0, 0], [0, 100, 50], "red"],
+"FF00FF": [[255, 0, 255], [300, 100, 50], "magenta"],
+"FF1493": [[255, 20, 147], [328, 100, 54], "deepPink"],
+"FF4500": [[255, 69, 0], [16, 100, 50], "orangeRed"],
+"FF6347": [[255, 99, 71], [9, 100, 64], "tomato"],
+"FF69B4": [[255, 105, 180], [330, 100, 71], "hotPink"],
+"FF7F50": [[255, 127, 80], [16, 100, 66], "coral"],
+"FF8C00": [[255, 140, 0], [33, 100, 50], "darkOrange"],
+"FFA07A": [[255, 160, 122], [17, 100, 74], "lightSalmon"],
+"FFA500": [[255, 165, 0], [39, 100, 50], "orange"],
+"FFB6C1": [[255, 182, 193], [351, 100, 86], "lightPink"],
+"FFC0CB": [[255, 192, 203], [350, 100, 88], "pink"],
+"FFD700": [[255, 215, 0], [51, 100, 50], "gold"],
+"FFDAB9": [[255, 218, 185], [28, 100, 86], "peachPuff"],
+"FFDEAD": [[255, 222, 173], [36, 100, 84], "navajoWhite"],
+"FFE4B5": [[255, 228, 181], [38, 100, 85], "moccasin"],
+"FFE4C4": [[255, 228, 196], [33, 100, 88], "bisque"],
+"FFE4E1": [[255, 228, 225], [6, 100, 94], "mistyRose"],
+"FFEBCD": [[255, 235, 205], [36, 100, 90], "blanchedAlmond"],
+"FFEFD5": [[255, 239, 213], [37, 100, 92], "papayaWhip"],
+"FFF0F5": [[255, 240, 245], [340, 100, 97], "lavenderBlush"],
+"FFF5EE": [[255, 245, 238], [25, 100, 97], "seaShell"],
+"FFF8DC": [[255, 248, 220], [48, 100, 93], "cornsilk"],
+"FFFACD": [[255, 250, 205], [54, 100, 90], "lemonChiffon"],
+"FFFAF0": [[255, 250, 240], [40, 100, 97], "floralWhite"],
+"FFFAFA": [[255, 250, 250], [0, 100, 99], "snow"],
+"FFFF00": [[255, 255, 0], [60, 100, 50], "yellow"],
+"FFFFE0": [[255, 255, 224], [60, 100, 94], "lightYellow"],
+"FFFFF0": [[255, 255, 240], [60, 100, 97], "ivory"],
+"FFFFFF": [[255, 255, 255], [0, 100, 100], "white"]
+};
+
+
+WebInspector.Color.Nicknames = {
+"aliceblue": "F0F8FF",
+"antiquewhite": "FAEBD7",
+"aqua": "00FFFF",
+"aquamarine": "7FFFD4",
+"azure": "F0FFFF",
+"beige": "F5F5DC",
+"bisque": "FFE4C4",
+"black": "000000",
+"blanchedalmond": "FFEBCD",
+"blue": "0000FF",
+"blueviolet": "8A2BE2",
+"brown": "A52A2A",
+"burlywood": "DEB887",
+"cadetblue": "5F9EA0",
+"chartreuse": "7FFF00",
+"chocolate": "D2691E",
+"coral": "FF7F50",
+"cornflowerblue": "6495ED",
+"cornsilk": "FFF8DC",
+"crimson": "DC143C",
+"cyan": "00FFFF",
+"darkblue": "00008B",
+"darkcyan": "008B8B",
+"darkgoldenrod": "B8860B",
+"darkgray": "A9A9A9",
+"darkgreen": "006400",
+"darkkhaki": "BDB76B",
+"darkmagenta": "8B008B",
+"darkolivegreen": "556B2F",
+"darkorange": "FF8C00",
+"darkorchid": "9932CC",
+"darkred": "8B0000",
+"darksalmon": "E9967A",
+"darkseagreen": "8FBC8F",
+"darkslateblue": "483D8B",
+"darkslategray": "2F4F4F",
+"darkturquoise": "00CED1",
+"darkviolet": "9400D3",
+"deeppink": "FF1493",
+"deepskyblue": "00BFFF",
+"dimgray": "696969",
+"dodgerblue": "1E90FF",
+"firebrick": "B22222",
+"floralwhite": "FFFAF0",
+"forestgreen": "228B22",
+"fuchsia": "FF00FF",
+"gainsboro": "DCDCDC",
+"ghostwhite": "F8F8FF",
+"gold": "FFD700",
+"goldenrod": "DAA520",
+"gray": "808080",
+"green": "008000",
+"greenyellow": "ADFF2F",
+"honeydew": "F0FFF0",
+"hotpink": "FF69B4",
+"indianred": "CD5C5C",
+"indigo": "4B0082",
+"ivory": "FFFFF0",
+"khaki": "F0E68C",
+"lavender": "E6E6FA",
+"lavenderblush": "FFF0F5",
+"lawngreen": "7CFC00",
+"lemonchiffon": "FFFACD",
+"lightblue": "ADD8E6",
+"lightcoral": "F08080",
+"lightcyan": "E0FFFF",
+"lightgoldenrodyellow": "FAFAD2",
+"lightgreen": "90EE90",
+"lightgrey": "D3D3D3",
+"lightpink": "FFB6C1",
+"lightsalmon": "FFA07A",
+"lightseagreen": "20B2AA",
+"lightskyblue": "87CEFA",
+"lightslategray": "778899",
+"lightsteelblue": "B0C4DE",
+"lightyellow": "FFFFE0",
+"lime": "00FF00",
+"limegreen": "32CD32",
+"linen": "FAF0E6",
+"magenta": "FF00FF",
+"maroon": "800000",
+"mediumaquamarine": "66CDAA",
+"mediumblue": "0000CD",
+"mediumorchid": "BA55D3",
+"mediumpurple": "9370D8",
+"mediumseagreen": "3CB371",
+"mediumslateblue": "7B68EE",
+"mediumspringgreen": "00FA9A",
+"mediumturquoise": "48D1CC",
+"mediumvioletred": "C71585",
+"midnightblue": "191970",
+"mintcream": "F5FFFA",
+"mistyrose": "FFE4E1",
+"moccasin": "FFE4B5",
+"navajowhite": "FFDEAD",
+"navy": "000080",
+"oldlace": "FDF5E6",
+"olive": "808000",
+"olivedrab": "6B8E23",
+"orange": "FFA500",
+"orangered": "FF4500",
+"orchid": "DA70D6",
+"palegoldenrod": "EEE8AA",
+"palegreen": "98FB98",
+"paleturquoise": "AFEEEE",
+"palevioletred": "D87093",
+"papayawhip": "FFEFD5",
+"peachpuff": "FFDAB9",
+"peru": "CD853F",
+"pink": "FFC0CB",
+"plum": "DDA0DD",
+"powderblue": "B0E0E6",
+"purple": "800080",
+"red": "FF0000",
+"rosybrown": "BC8F8F",
+"royalblue": "4169E1",
+"saddlebrown": "8B4513",
+"salmon": "FA8072",
+"sandybrown": "F4A460",
+"seagreen": "2E8B57",
+"seashell": "FFF5EE",
+"sienna": "A0522D",
+"silver": "C0C0C0",
+"skyblue": "87CEEB",
+"slateblue": "6A5ACD",
+"slategray": "708090",
+"snow": "FFFAFA",
+"springgreen": "00FF7F",
+"steelblue": "4682B4",
+"tan": "D2B48C",
+"teal": "008080",
+"thistle": "D8BFD8",
+"tomato": "FF6347",
+"turquoise": "40E0D0",
+"violet": "EE82EE",
+"wheat": "F5DEB3",
+"white": "FFFFFF",
+"whitesmoke": "F5F5F5",
+"yellow": "FFFF00",
+"yellowgreen": "9ACD32"
+};
+
+
+WebInspector.Color.AdvancedNickNames = {
+"transparent": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
+"rgba(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
+"hsla(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"],
+};
+
+
+
+WebInspector.CSSCompletions = [];
+
+WebInspector.CSSCompletions.startsWith = function(prefix)
+{
+var firstIndex = this._firstIndexOfPrefix(prefix);
+if (firstIndex === -1)
+return [];
+
+var results = [];
+while (this[firstIndex].indexOf(prefix) === 0)
+results.push(this[firstIndex++]);
+return results;
+}
+
+WebInspector.CSSCompletions.firstStartsWith = function(prefix)
+{
+var foundIndex = this._firstIndexOfPrefix(prefix);
+return (foundIndex === -1 ? "" : this[foundIndex]);
+}
+
+WebInspector.CSSCompletions._firstIndexOfPrefix = function(prefix)
+{
+if (!prefix)
+return -1;
+if (!this.length)
+return -1;
+
+var maxIndex = this.length - 1;
+var minIndex = 0;
+var foundIndex;
+
+do {
+var middleIndex = (maxIndex + minIndex) >> 1;
+if (this[middleIndex].indexOf(prefix) === 0) {
+foundIndex = middleIndex;
+break;
+}
+if (this[middleIndex] < prefix)
+minIndex = middleIndex + 1;
+else
+maxIndex = middleIndex - 1;
+} while (minIndex <= maxIndex);
+
+if (!foundIndex)
+return -1;
+
+while (foundIndex && this[foundIndex - 1].indexOf(prefix) === 0)
+foundIndex--;
+
+return foundIndex;
+}
+
+WebInspector.CSSCompletions.next = function(str, prefix)
+{
+return WebInspector.CSSCompletions._closest(str, prefix, 1);
+}
+
+WebInspector.CSSCompletions.previous = function(str, prefix)
+{
+return WebInspector.CSSCompletions._closest(str, prefix, -1);
+}
+
+WebInspector.CSSCompletions._closest = function(str, prefix, shift)
+{
+if (!str)
+return "";
+
+var index = this.indexOf(str);
+if (index === -1)
+return "";
+
+if (!prefix) {
+index = (index + this.length + shift) % this.length;
+return this[index];
+}
+
+var propertiesWithPrefix = this.startsWith(prefix);
+var j = propertiesWithPrefix.indexOf(str);
+j = (j + propertiesWithPrefix.length + shift) % propertiesWithPrefix.length;
+return propertiesWithPrefix[j];
+}
+
+WebInspector.CSSCompletions._load = function(properties)
+{
+for (var i = 0; i < properties.length; ++i)
+WebInspector.CSSCompletions.push(properties[i]);
+WebInspector.CSSCompletions.sort();
+}
+
+
+
+
+
+WebInspector.StylesSidebarPane = function(computedStylePane)
+{
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Styles"));
+
+this.settingsSelectElement = document.createElement("select");
+
+var option = document.createElement("option");
+option.value = "original";
+option.action = this._changeColorFormat.bind(this);
+option.label = WebInspector.UIString("As Authored");
+this.settingsSelectElement.appendChild(option);
+
+var option = document.createElement("option");
+option.value = "hex";
+option.action = this._changeColorFormat.bind(this);
+option.label = WebInspector.UIString("Hex Colors");
+this.settingsSelectElement.appendChild(option);
+
+option = document.createElement("option");
+option.value = "rgb";
+option.action = this._changeColorFormat.bind(this);
+option.label = WebInspector.UIString("RGB Colors");
+this.settingsSelectElement.appendChild(option);
+
+option = document.createElement("option");
+option.value = "hsl";
+option.action = this._changeColorFormat.bind(this);
+option.label = WebInspector.UIString("HSL Colors");
+this.settingsSelectElement.appendChild(option);
+
+this.settingsSelectElement.appendChild(document.createElement("hr"));
+
+option = document.createElement("option");
+option.action = this._createNewRule.bind(this);
+option.label = WebInspector.UIString("New Style Rule");
+this.settingsSelectElement.appendChild(option);
+
+this.settingsSelectElement.addEventListener("click", function(event) { event.stopPropagation() }, false);
+this.settingsSelectElement.addEventListener("change", this._changeSetting.bind(this), false);
+var format = WebInspector.settings.colorFormat;
+if (format === "original")
+this.settingsSelectElement[0].selected = true;
+else if (format === "hex")
+this.settingsSelectElement[1].selected = true;
+else if (format === "rgb")
+this.settingsSelectElement[2].selected = true;
+else if (format === "hsl")
+this.settingsSelectElement[3].selected = true;
+
+this.titleElement.appendChild(this.settingsSelectElement);
+this._computedStylePane = computedStylePane;
+this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
+}
+
+
+WebInspector.StylesSidebarPane.InheritedProperties = [
+"azimuth", "border-collapse", "border-spacing", "caption-side", "color", "cursor", "direction", "elevation",
+"empty-cells", "font-family", "font-size", "font-style", "font-variant", "font-weight", "font", "letter-spacing",
+"line-height", "list-style-image", "list-style-position", "list-style-type", "list-style", "orphans", "pitch-range",
+"pitch", "quotes", "richness", "speak-header", "speak-numeral", "speak-punctuation", "speak", "speech-rate", "stress",
+"text-align", "text-indent", "text-transform", "text-shadow", "visibility", "voice-family", "volume", "white-space", "widows", "word-spacing"
+].keySet();
+
+
+
+
+
+WebInspector.StylesSidebarPane.PseudoIdNames = [
+"", "first-line", "first-letter", "before", "after", "selection", "", "-webkit-scrollbar", "-webkit-file-upload-button",
+"-webkit-input-placeholder", "-webkit-slider-thumb", "-webkit-search-cancel-button", "-webkit-search-decoration",
+"-webkit-search-results-decoration", "-webkit-search-results-button", "-webkit-media-controls-panel",
+"-webkit-media-controls-play-button", "-webkit-media-controls-mute-button", "-webkit-media-controls-timeline",
+"-webkit-media-controls-timeline-container", "-webkit-media-controls-volume-slider",
+"-webkit-media-controls-volume-slider-container", "-webkit-media-controls-current-time-display",
+"-webkit-media-controls-time-remaining-display", "-webkit-media-controls-seek-back-button", "-webkit-media-controls-seek-forward-button",
+"-webkit-media-controls-fullscreen-button", "-webkit-media-controls-rewind-button", "-webkit-media-controls-return-to-realtime-button",
+"-webkit-media-controls-toggle-closed-captions-button", "-webkit-media-controls-status-display", "-webkit-scrollbar-thumb",
+"-webkit-scrollbar-button", "-webkit-scrollbar-track", "-webkit-scrollbar-track-piece", "-webkit-scrollbar-corner",
+"-webkit-resizer", "-webkit-input-list-button", "-webkit-inner-spin-button", "-webkit-outer-spin-button"
+];
+
 WebInspector.StylesSidebarPane.prototype = {
-    _settingsLoaded: function()
-    {
-        var format = WebInspector.settings.colorFormat;
-        if (format === "hex")
-            this.settingsSelectElement[0].selected = true;
-        if (format === "rgb")
-            this.settingsSelectElement[1].selected = true;
-        if (format === "hsl")
-            this.settingsSelectElement[2].selected = true;
-    },
+_contextMenuEventFired: function(event)
+{
+var href = event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link") || event.target.enclosingNodeOrSelfWithClass("webkit-html-external-link");
+if (href) {
+var contextMenu = new WebInspector.ContextMenu();
+var filled = WebInspector.panels.elements.populateHrefContextMenu(contextMenu, event, href);
+if (filled)
+contextMenu.show(event);
+}
+},
 
-    update: function(node, editedSection, forceUpdate)
-    {
-        var refresh = false;
+update: function(node, editedSection, forceUpdate)
+{
+var refresh = false;
 
-        if (forceUpdate)
-            delete this.node;
+if (forceUpdate)
+delete this.node;
 
-        if (!forceUpdate && (!node || node === this.node))
-            refresh = true;
+if (!forceUpdate && (!node || node === this.node))
+refresh = true;
 
-        if (node && node.nodeType === Node.TEXT_NODE && node.parentNode)
-            node = node.parentNode;
+if (node && node.nodeType === Node.TEXT_NODE && node.parentNode)
+node = node.parentNode;
 
-        if (node && node.nodeType !== Node.ELEMENT_NODE)
-            node = null;
+if (node && node.nodeType !== Node.ELEMENT_NODE)
+node = null;
 
-        if (node)
-            this.node = node;
-        else
-            node = this.node;
+if (node)
+this.node = node;
+else
+node = this.node;
 
-        var body = this.bodyElement;
+if (!node) {
+this.bodyElement.removeChildren();
+this._computedStylePane.bodyElement.removeChildren();
+this.sections = {};
+return;
+}
 
-        if (!node) {
-            body.removeChildren();
-            this.sections = [];
-            return;
-        }
+function stylesCallback(styles)
+{
+if (styles)
+this._rebuildUpdate(node, styles);
+}
 
-        var self = this;
-        function callback(styles)
-        {
-            if (!styles)
-                return;
-            node._setStyles(styles.computedStyle, styles.inlineStyle, styles.styleAttributes, styles.matchedCSSRules);
-            self._update(refresh, body, node, editedSection, forceUpdate);
-        }
+function computedStyleCallback(computedStyle)
+{
+if (computedStyle)
+this._refreshUpdate(node, computedStyle, editedSection);
+}
 
-        InjectedScriptAccess.get(node.injectedScriptId).getStyles(node.id, !WebInspector.settings.showUserAgentStyles, callback);
-    },
+if (refresh)
+WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCallback.bind(this));
+else
+WebInspector.cssModel.getStylesAsync(node.id, stylesCallback.bind(this));
+},
 
-    _update: function(refresh, body, node, editedSection, forceUpdate)
-    {
-        if (!refresh) {
-            body.removeChildren();
-            this.sections = [];
-        }
+_refreshUpdate: function(node, computedStyle, editedSection)
+{
+for (var pseudoId in this.sections) {
+var styleRules = this._refreshStyleRules(this.sections[pseudoId], computedStyle);
+var usedProperties = {};
+var disabledComputedProperties = {};
+this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties);
+this._refreshSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, editedSection);
+}
 
-        var styleRules = [];
+this.sections[0][0].rebuildComputedTrace(this.sections[0]);
+},
 
-        if (refresh) {
-            for (var i = 0; i < this.sections.length; ++i) {
-                var section = this.sections[i];
-                if (section instanceof WebInspector.BlankStylePropertiesSection)
-                    continue;
-                if (section.computedStyle)
-                    section.styleRule.style = node.ownerDocument.defaultView.getComputedStyle(node);
-                var styleRule = { section: section, style: section.styleRule.style, computedStyle: section.computedStyle, rule: section.rule };
-                styleRules.push(styleRule);
-            }
-        } else {
-            var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
-            styleRules.push({ computedStyle: true, selectorText: WebInspector.UIString("Computed Style"), style: computedStyle, editable: false });
+_rebuildUpdate: function(node, styles)
+{
+this.bodyElement.removeChildren();
+this._computedStylePane.bodyElement.removeChildren();
 
-            var nodeName = node.nodeName.toLowerCase();
-            for (var i = 0; i < node.attributes.length; ++i) {
-                var attr = node.attributes[i];
-                if (attr.style) {
-                    var attrStyle = { style: attr.style, editable: false };
-                    attrStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", attr.name);
-                    attrStyle.selectorText = nodeName + "[" + attr.name;
-                    if (attr.value.length)
-                        attrStyle.selectorText += "=" + attr.value;
-                    attrStyle.selectorText += "]";
-                    styleRules.push(attrStyle);
-                }
-            }
+var styleRules = this._rebuildStyleRules(node, styles);
+var usedProperties = {};
+var disabledComputedProperties = {};
+this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties);
+this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0);
+var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement;
 
-            // Always Show element's Style Attributes
-            if (node.nodeType === Node.ELEMENT_NODE) {
-                var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: node.style, isAttribute: true };
-                inlineStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", "style");
-                styleRules.push(inlineStyle);
-            }
+this.sections[0][0].rebuildComputedTrace(this.sections[0]);
 
-            var matchedStyleRules = node.ownerDocument.defaultView.getMatchedCSSRules(node, "", !WebInspector.settings.showUserAgentStyles);
-            if (matchedStyleRules) {
-                // Add rules in reverse order to match the cascade order.
-                for (var i = (matchedStyleRules.length - 1); i >= 0; --i) {
-                    var rule = matchedStyleRules[i];
-                    styleRules.push({ style: rule.style, selectorText: rule.selectorText, parentStyleSheet: rule.parentStyleSheet, rule: rule });
-                }
-            }
-        }
+for (var i = 0; i < styles.pseudoElements.length; ++i) {
+var pseudoElementCSSRules = styles.pseudoElements[i];
 
-        function deleteDisabledProperty(style, name)
-        {
-            if (!style || !name)
-                return;
-            if (style.__disabledPropertyValues)
-                delete style.__disabledPropertyValues[name];
-            if (style.__disabledPropertyPriorities)
-                delete style.__disabledPropertyPriorities[name];
-            if (style.__disabledProperties)
-                delete style.__disabledProperties[name];
-        }
+styleRules = [];
+var pseudoId = pseudoElementCSSRules.pseudoId;
 
-        var usedProperties = {};
-        var disabledComputedProperties = {};
-        var priorityUsed = false;
+var entry = { isStyleSeparator: true, pseudoId: pseudoId };
+styleRules.push(entry);
 
-        // Walk the style rules and make a list of all used and overloaded properties.
-        for (var i = 0; i < styleRules.length; ++i) {
-            var styleRule = styleRules[i];
-            if (styleRule.computedStyle)
-                continue;
-            if (styleRule.section && styleRule.section.noAffect)
-                continue;
 
-            styleRule.usedProperties = {};
+for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) {
+var rule = pseudoElementCSSRules.rules[j];
+styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) });
+}
+usedProperties = {};
+disabledComputedProperties = {};
+this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties);
+this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, pseudoId, anchorElement);
+}
+},
 
-            var style = styleRule.style;
-            for (var j = 0; j < style.length; ++j) {
-                var name = style[j];
+_refreshStyleRules: function(sections, computedStyle)
+{
+var nodeComputedStyle = computedStyle;
+var styleRules = [];
+for (var i = 0; sections && i < sections.length; ++i) {
+var section = sections[i];
+if (section instanceof WebInspector.BlankStylePropertiesSection)
+continue;
+if (section.computedStyle)
+section.styleRule.style = nodeComputedStyle;
+var styleRule = { section: section, style: section.styleRule.style, computedStyle: section.computedStyle, rule: section.rule, editable: !!(section.styleRule.style && section.styleRule.style.id) };
+styleRules.push(styleRule);
+}
+return styleRules;
+},
 
-                if (!priorityUsed && style.getPropertyPriority(name).length)
-                    priorityUsed = true;
+_rebuildStyleRules: function(node, styles)
+{
+var nodeComputedStyle = styles.computedStyle;
+this.sections = {};
 
-                // If the property name is already used by another rule then this rule's
-                // property is overloaded, so don't add it to the rule's usedProperties.
-                if (!(name in usedProperties))
-                    styleRule.usedProperties[name] = true;
+var styleRules = [];
 
-                if (name === "font") {
-                    // The font property is not reported as a shorthand. Report finding the individual
-                    // properties so they are visible in computed style.
-                    // FIXME: remove this when http://bugs.webkit.org/show_bug.cgi?id=15598 is fixed.
-                    styleRule.usedProperties["font-family"] = true;
-                    styleRule.usedProperties["font-size"] = true;
-                    styleRule.usedProperties["font-style"] = true;
-                    styleRule.usedProperties["font-variant"] = true;
-                    styleRule.usedProperties["font-weight"] = true;
-                    styleRule.usedProperties["line-height"] = true;
-                }
+styleRules.push({ computedStyle: true, selectorText: "", style: nodeComputedStyle, editable: false });
 
-                // Delete any disabled properties, since the property does exist.
-                // This prevents it from showing twice.
-                deleteDisabledProperty(style, name);
-                deleteDisabledProperty(style, style.getPropertyShorthand(name));
-            }
+var styleAttributes = {};
+for (var name in styles.styleAttributes) {
+var attrStyle = { style: styles.styleAttributes[name], editable: false };
+attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName) + "[" + name;
+if (node.getAttribute(name))
+attrStyle.selectorText += "=" + node.getAttribute(name);
+attrStyle.selectorText += "]";
+styleRules.push(attrStyle);
+}
 
-            // Add all the properties found in this style to the used properties list.
-            // Do this here so only future rules are affect by properties used in this rule.
-            for (var name in styleRules[i].usedProperties)
-                usedProperties[name] = true;
 
-            // Remember all disabled properties so they show up in computed style.
-            if (style.__disabledProperties)
-                for (var name in style.__disabledProperties)
-                    disabledComputedProperties[name] = true;
-        }
+if (styles.inlineStyle && node.nodeType === Node.ELEMENT_NODE) {
+var inlineStyle = { selectorText: "element.style", style: styles.inlineStyle, isAttribute: true };
+styleRules.push(inlineStyle);
+}
 
-        if (priorityUsed) {
-            // Walk the properties again and account for !important.
-            var foundPriorityProperties = [];
 
-            // Walk in reverse to match the order !important overrides.
-            for (var i = (styleRules.length - 1); i >= 0; --i) {
-                if (styleRules[i].computedStyle)
-                    continue;
+if (styles.matchedCSSRules.length)
+styleRules.push({ isStyleSeparator: true, text: WebInspector.UIString("Matched CSS Rules") });
+for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) {
+var rule = styles.matchedCSSRules[i];
+styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) });
+}
 
-                var style = styleRules[i].style;
-                var uniqueProperties = style.uniqueStyleProperties;
-                for (var j = 0; j < uniqueProperties.length; ++j) {
-                    var name = uniqueProperties[j];
-                    if (style.getPropertyPriority(name).length) {
-                        if (!(name in foundPriorityProperties))
-                            styleRules[i].usedProperties[name] = true;
-                        else
-                            delete styleRules[i].usedProperties[name];
-                        foundPriorityProperties[name] = true;
-                    } else if (name in foundPriorityProperties)
-                        delete styleRules[i].usedProperties[name];
-                }
-            }
-        }
 
-        if (refresh) {
-            // Walk the style rules and update the sections with new overloaded and used properties.
-            for (var i = 0; i < styleRules.length; ++i) {
-                var styleRule = styleRules[i];
-                var section = styleRule.section;
-                if (styleRule.computedStyle)
-                    section.disabledComputedProperties = disabledComputedProperties;
-                section._usedProperties = (styleRule.usedProperties || usedProperties);
-                section.update((section === editedSection) || styleRule.computedStyle);
-            }
-        } else {
-            // Make a property section for each style rule.
-            for (var i = 0; i < styleRules.length; ++i) {
-                var styleRule = styleRules[i];
-                var subtitle = styleRule.subtitle;
-                delete styleRule.subtitle;
+var parentNode = node.parentNode;
+function insertInheritedNodeSeparator(node)
+{
+var entry = {};
+entry.isStyleSeparator = true;
+entry.node = node;
+styleRules.push(entry);
+}
 
-                var computedStyle = styleRule.computedStyle;
-                delete styleRule.computedStyle;
+for (var parentOrdinal = 0; parentOrdinal < styles.inherited.length; ++parentOrdinal) {
+var parentStyles = styles.inherited[parentOrdinal];
+var separatorInserted = false;
+if (parentStyles.inlineStyle) {
+if (this._containsInherited(parentStyles.inlineStyle)) {
+var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: parentStyles.inlineStyle, isAttribute: true, isInherited: true };
+if (!separatorInserted) {
+insertInheritedNodeSeparator(parentNode);
+separatorInserted = true;
+}
+styleRules.push(inlineStyle);
+}
+}
 
-                var ruleUsedProperties = styleRule.usedProperties;
-                delete styleRule.usedProperties;
+for (var i = parentStyles.matchedCSSRules.length - 1; i >= 0; --i) {
+var rulePayload = parentStyles.matchedCSSRules[i];
+if (!this._containsInherited(rulePayload.style))
+continue;
+var rule = rulePayload;
+if (!separatorInserted) {
+insertInheritedNodeSeparator(parentNode);
+separatorInserted = true;
+}
+styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, isInherited: true, editable: !!(rule.style && rule.style.id) });
+}
+parentNode = parentNode.parentNode;
+}
+return styleRules;
+},
 
-                var editable = styleRule.editable;
-                delete styleRule.editable;
+_markUsedProperties: function(styleRules, usedProperties, disabledComputedProperties)
+{
+var priorityUsed = false;
 
-                var isAttribute = styleRule.isAttribute;
-                delete styleRule.isAttribute;
 
-                // Default editable to true if it was omitted.
-                if (typeof editable === "undefined")
-                    editable = true;
+for (var i = 0; i < styleRules.length; ++i) {
+var styleRule = styleRules[i];
+if (styleRule.computedStyle || styleRule.isStyleSeparator)
+continue;
+if (styleRule.section && styleRule.section.noAffect)
+continue;
 
-                var section = new WebInspector.StylePropertiesSection(styleRule, subtitle, computedStyle, (ruleUsedProperties || usedProperties), editable);
-                if (computedStyle)
-                    section.disabledComputedProperties = disabledComputedProperties;
-                section.pane = this;
+styleRule.usedProperties = {};
 
-                if (Preferences.styleRulesExpandedState && section.identifier in Preferences.styleRulesExpandedState)
-                    section.expanded = Preferences.styleRulesExpandedState[section.identifier];
-                else if (computedStyle)
-                    section.collapse(true);
-                else if (isAttribute && styleRule.style.length === 0)
-                    section.collapse(true);
-                else
-                    section.expand(true);
+var style = styleRule.style;
+var allProperties = style.allProperties;
+for (var j = 0; j < allProperties.length; ++j) {
+var property = allProperties[j];
+if (!property.isLive)
+continue;
+var name = property.name;
 
-                body.appendChild(section.element);
-                this.sections.push(section);
-            }
-        }
-    },
+if (!priorityUsed && property.priority.length)
+priorityUsed = true;
 
-    _changeSetting: function(event)
-    {
-        var options = this.settingsSelectElement.options;
-        var selectedOption = options[this.settingsSelectElement.selectedIndex];
-        selectedOption.action(event);
 
-        // Select the correct color format setting again, since it needs to be selected.
-        var selectedIndex = 0;
-        for (var i = 0; i < options.length; ++i) {
-            if (options[i].value === WebInspector.settings.colorFormat) {
-                selectedIndex = i;
-                break;
-            }
-        }
 
-        this.settingsSelectElement.selectedIndex = selectedIndex;
-    },
+if (!(name in usedProperties))
+styleRule.usedProperties[name] = true;
 
-    _changeColorFormat: function(event)
-    {
-        var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
-        WebInspector.settings.colorFormat = selectedOption.value;
+if (name === "font") {
 
-        for (var i = 0; i < this.sections.length; ++i)
-            this.sections[i].update(true);
-    },
 
-    _createNewRule: function(event)
-    {
-        this.addBlankSection().startEditingSelector();
-    },
 
-    addBlankSection: function()
-    {
-        var blankSection = new WebInspector.BlankStylePropertiesSection(appropriateSelectorForNode(this.node, true));
-        blankSection.pane = this;
+styleRule.usedProperties["font-family"] = true;
+styleRule.usedProperties["font-size"] = true;
+styleRule.usedProperties["font-style"] = true;
+styleRule.usedProperties["font-variant"] = true;
+styleRule.usedProperties["font-weight"] = true;
+styleRule.usedProperties["line-height"] = true;
+}
+}
 
-        var elementStyleSection = this.sections[1];
-        this.bodyElement.insertBefore(blankSection.element, elementStyleSection.element.nextSibling);
 
-        this.sections.splice(2, 0, blankSection);
 
-        return blankSection;
-    },
+for (var name in styleRules[i].usedProperties)
+usedProperties[name] = true;
+}
 
-    removeSection: function(section)
-    {
-        var index = this.sections.indexOf(section);
-        if (index === -1)
-            return;
-        this.sections.splice(index, 1);
-        if (section.element.parentNode)
-            section.element.parentNode.removeChild(section.element);
-    }
+if (priorityUsed) {
+
+var foundPriorityProperties = [];
+
+
+for (var i = (styleRules.length - 1); i >= 0; --i) {
+if (styleRules[i].computedStyle || styleRules[i].isStyleSeparator)
+continue;
+
+var style = styleRules[i].style;
+var allProperties = style.allProperties;
+for (var j = 0; j < allProperties.length; ++j) {
+var property = allProperties[j];
+if (!property.isLive)
+continue;
+var name = property.name;
+if (property.priority.length) {
+if (!(name in foundPriorityProperties))
+styleRules[i].usedProperties[name] = true;
+else
+delete styleRules[i].usedProperties[name];
+foundPriorityProperties[name] = true;
+} else if (name in foundPriorityProperties)
+delete styleRules[i].usedProperties[name];
+}
+}
+}
+},
+
+_refreshSectionsForStyleRules: function(styleRules, usedProperties, disabledComputedProperties, editedSection)
+{
+
+for (var i = 0; i < styleRules.length; ++i) {
+var styleRule = styleRules[i];
+var section = styleRule.section;
+if (styleRule.computedStyle) {
+section._disabledComputedProperties = disabledComputedProperties;
+section._usedProperties = usedProperties;
+section.update();
+} else {
+section._usedProperties = styleRule.usedProperties;
+section.update(section === editedSection);
+}
+}
+},
+
+_rebuildSectionsForStyleRules: function(styleRules, usedProperties, disabledComputedProperties, pseudoId, anchorElement)
+{
+
+var sections = [];
+var lastWasSeparator = true;
+for (var i = 0; i < styleRules.length; ++i) {
+var styleRule = styleRules[i];
+if (styleRule.isStyleSeparator) {
+var separatorElement = document.createElement("div");
+separatorElement.className = "styles-sidebar-separator";
+if (styleRule.node) {
+var link = WebInspector.panels.elements.linkifyNodeReference(styleRule.node);
+separatorElement.appendChild(document.createTextNode(WebInspector.UIString("Inherited from") + " "));
+separatorElement.appendChild(link);
+if (!sections.inheritedPropertiesSeparatorElement)
+sections.inheritedPropertiesSeparatorElement = separatorElement;
+} else if ("pseudoId" in styleRule) {
+var pseudoName = WebInspector.StylesSidebarPane.PseudoIdNames[styleRule.pseudoId];
+if (pseudoName)
+separatorElement.textContent = WebInspector.UIString("Pseudo ::%s element", pseudoName);
+else
+separatorElement.textContent = WebInspector.UIString("Pseudo element");
+} else
+separatorElement.textContent = styleRule.text;
+this.bodyElement.insertBefore(separatorElement, anchorElement);
+lastWasSeparator = true;
+continue;
+}
+var computedStyle = styleRule.computedStyle;
+
+
+var editable = styleRule.editable;
+if (typeof editable === "undefined")
+editable = true;
+
+if (computedStyle)
+var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties, disabledComputedProperties, styleRules);
+else
+var section = new WebInspector.StylePropertiesSection(styleRule, editable, styleRule.isInherited, lastWasSeparator);
+section.pane = this;
+section.expanded = true;
+
+if (computedStyle) {
+this._computedStylePane.bodyElement.appendChild(section.element);
+lastWasSeparator = true;
+} else {
+this.bodyElement.insertBefore(section.element, anchorElement);
+lastWasSeparator = false;
+}
+sections.push(section);
+}
+return sections;
+},
+
+_containsInherited: function(style)
+{
+var properties = style.allProperties;
+for (var i = 0; i < properties.length; ++i) {
+var property = properties[i];
+
+if (property.isLive && property.name in WebInspector.StylesSidebarPane.InheritedProperties)
+return true;
+}
+return false;
+},
+
+_changeSetting: function(event)
+{
+var options = this.settingsSelectElement.options;
+var selectedOption = options[this.settingsSelectElement.selectedIndex];
+selectedOption.action(event);
+
+
+var selectedIndex = 0;
+for (var i = 0; i < options.length; ++i) {
+if (options[i].value === WebInspector.settings.colorFormat) {
+selectedIndex = i;
+break;
+}
+}
+
+this.settingsSelectElement.selectedIndex = selectedIndex;
+},
+
+_changeColorFormat: function(event)
+{
+var selectedOption = this.settingsSelectElement[this.settingsSelectElement.selectedIndex];
+WebInspector.settings.colorFormat = selectedOption.value;
+
+for (var pseudoId in this.sections) {
+var sections = this.sections[pseudoId];
+for (var i = 0; i < sections.length; ++i)
+sections[i].update(true);
+}
+},
+
+_createNewRule: function(event)
+{
+this.addBlankSection().startEditingSelector();
+},
+
+addBlankSection: function()
+{
+var blankSection = new WebInspector.BlankStylePropertiesSection(appropriateSelectorForNode(this.node, true));
+blankSection.pane = this;
+
+var elementStyleSection = this.sections[0][1];
+this.bodyElement.insertBefore(blankSection.element, elementStyleSection.element.nextSibling);
+
+this.sections[0].splice(2, 0, blankSection);
+
+return blankSection;
+},
+
+removeSection: function(section)
+{
+for (var pseudoId in this.sections) {
+var sections = this.sections[pseudoId];
+var index = sections.indexOf(section);
+if (index === -1)
+continue;
+sections.splice(index, 1);
+if (section.element.parentNode)
+section.element.parentNode.removeChild(section.element);
+}
+},
+
+registerShortcuts: function()
+{
+var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("Styles Pane"));
+var shortcut = WebInspector.KeyboardShortcut;
+var keys = [
+shortcut.shortcutToString(shortcut.Keys.Tab),
+shortcut.shortcutToString(shortcut.Keys.Tab, shortcut.Modifiers.Shift)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Next/previous property"));
+keys = [
+shortcut.shortcutToString(shortcut.Keys.Up),
+shortcut.shortcutToString(shortcut.Keys.Down)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement value"));
+keys = [
+shortcut.shortcutToString(shortcut.Keys.Up, shortcut.Modifiers.Shift),
+shortcut.shortcutToString(shortcut.Keys.Down, shortcut.Modifiers.Shift)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 10));
+keys = [
+shortcut.shortcutToString(shortcut.Keys.PageUp),
+shortcut.shortcutToString(shortcut.Keys.PageDown)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 10));
+keys = [
+shortcut.shortcutToString(shortcut.Keys.PageUp, shortcut.Modifiers.Shift),
+shortcut.shortcutToString(shortcut.Keys.PageDown, shortcut.Modifiers.Shift)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 100));
+keys = [
+shortcut.shortcutToString(shortcut.Keys.PageUp, shortcut.Modifiers.Alt),
+shortcut.shortcutToString(shortcut.Keys.PageDown, shortcut.Modifiers.Alt)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Increment/decrement by %f", 0.1));
+}
 }
 
 WebInspector.StylesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyle, usedProperties, editable)
+WebInspector.ComputedStyleSidebarPane = function()
 {
-    WebInspector.PropertiesSection.call(this, styleRule.selectorText);
+WebInspector.SidebarPane.call(this, WebInspector.UIString("Computed Style"));
+var showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString("Show inherited"), "sidebar-pane-subtitle");
+this.titleElement.appendChild(showInheritedCheckbox.element);
 
-    this.titleElement.addEventListener("click", this._clickSelector.bind(this), false);
-    this.titleElement.addEventListener("dblclick", this._dblclickSelector.bind(this), false);
-    this.element.addEventListener("dblclick", this._dblclickEmptySpace.bind(this), false);
+if (WebInspector.settings.showInheritedComputedStyleProperties) {
+this.bodyElement.addStyleClass("show-inherited");
+showInheritedCheckbox.checked = true;
+}
 
-    this.styleRule = styleRule;
-    this.rule = this.styleRule.rule;
-    this.computedStyle = computedStyle;
-    this.editable = (editable && !computedStyle);
+function showInheritedToggleFunction(event)
+{
+WebInspector.settings.showInheritedComputedStyleProperties = showInheritedCheckbox.checked;
+if (WebInspector.settings.showInheritedComputedStyleProperties)
+this.bodyElement.addStyleClass("show-inherited");
+else
+this.bodyElement.removeStyleClass("show-inherited");
+}
 
-    // Prevent editing the user agent and user rules.
-    var isUserAgent = this.rule && this.rule.isUserAgent;
-    var isUser = this.rule && this.rule.isUser;
-    var isViaInspector = this.rule && this.rule.isViaInspector;
+showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this));
+}
 
-    if (isUserAgent || isUser)
-        this.editable = false;
+WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-    this._usedProperties = usedProperties;
+WebInspector.StylePropertiesSection = function(styleRule, editable, isInherited, isFirstSection)
+{
+WebInspector.PropertiesSection.call(this, "");
+this.element.className = "styles-section monospace" + (isFirstSection ? " first-styles-section" : "");
 
-    if (computedStyle) {
-        this.element.addStyleClass("computed-style");
+this._selectorElement = document.createElement("span");
+this._selectorElement.textContent = styleRule.selectorText;
+this.titleElement.appendChild(this._selectorElement);
+if (Preferences.debugMode)
+this._selectorElement.addEventListener("click", this._debugShowStyle.bind(this), false);
 
-        if (WebInspector.settings.showInheritedComputedStyleProperties)
-            this.element.addStyleClass("show-inherited");
+var openBrace = document.createElement("span");
+openBrace.textContent = " {";
+this.titleElement.appendChild(openBrace);
 
-        var showInheritedLabel = document.createElement("label");
-        var showInheritedInput = document.createElement("input");
-        showInheritedInput.type = "checkbox";
-        showInheritedInput.checked = WebInspector.settings.showInheritedComputedStyleProperties;
+var closeBrace = document.createElement("div");
+closeBrace.textContent = "}";
+this.element.appendChild(closeBrace);
 
-        var computedStyleSection = this;
-        var showInheritedToggleFunction = function(event) {
-            WebInspector.settings.showInheritedComputedStyleProperties = showInheritedInput.checked;
-            if (WebInspector.settings.showInheritedComputedStyleProperties)
-                computedStyleSection.element.addStyleClass("show-inherited");
-            else
-                computedStyleSection.element.removeStyleClass("show-inherited");
-            event.stopPropagation();
-        };
+this._selectorElement.addEventListener("dblclick", this._handleSelectorDoubleClick.bind(this), false);
+this.element.addEventListener("dblclick", this._handleEmptySpaceDoubleClick.bind(this), false);
 
-        showInheritedLabel.addEventListener("click", showInheritedToggleFunction, false);
+this.styleRule = styleRule;
+this.rule = this.styleRule.rule;
+this.editable = editable;
+this.isInherited = isInherited;
 
-        showInheritedLabel.appendChild(showInheritedInput);
-        showInheritedLabel.appendChild(document.createTextNode(WebInspector.UIString("Show inherited")));
-        this.subtitleElement.appendChild(showInheritedLabel);
-    } else {
-        if (!subtitle) {
-            if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href) {
-                var url = this.styleRule.parentStyleSheet.href;
-                subtitle = WebInspector.linkifyURL(url, WebInspector.displayNameForURL(url));
-                this.subtitleElement.addStyleClass("file");
-            } else if (isUserAgent)
-                subtitle = WebInspector.UIString("user agent stylesheet");
-            else if (isUser)
-                subtitle = WebInspector.UIString("user stylesheet");
-            else if (isViaInspector)
-                subtitle = WebInspector.UIString("via inspector");
-            else
-                subtitle = WebInspector.UIString("inline stylesheet");
-        }
 
-        this.subtitle = subtitle;
-    }
+var isUserAgent = this.rule && this.rule.isUserAgent;
+var isUser = this.rule && this.rule.isUser;
+var isViaInspector = this.rule && this.rule.isViaInspector;
 
-    this.identifier = styleRule.selectorText;
-    if (this.subtitle)
-        this.identifier += ":" + this.subtitleElement.textContent;
+if (isUserAgent || isUser)
+this.editable = false;
+
+this._usedProperties = styleRule.usedProperties;
+
+if (this.rule)
+this.titleElement.addStyleClass("styles-selector");
+
+function linkifyUncopyable(url, line)
+{
+var link = WebInspector.linkifyResourceAsNode(url, "resources", line + 1);
+link.setAttribute("data-uncopyable", link.textContent);
+link.textContent = "";
+return link;
+}
+
+var subtitle = "";
+if (this.styleRule.sourceURL)
+this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.sourceURL, this.rule.sourceLine));
+else if (isUserAgent)
+subtitle = WebInspector.UIString("user agent stylesheet");
+else if (isUser)
+subtitle = WebInspector.UIString("user stylesheet");
+else if (isViaInspector)
+subtitle = WebInspector.UIString("via inspector");
+else if (this.rule && this.rule.sourceURL)
+this.subtitleElement.appendChild(linkifyUncopyable(this.rule.sourceURL, this.rule.sourceLine));
+
+if (isInherited)
+this.element.addStyleClass("show-inherited"); 
+if (subtitle)
+this.subtitle = subtitle;
+
+this.identifier = styleRule.selectorText;
+if (this.subtitle)
+this.identifier += ":" + this.subtitle;
+
+if (!this.editable)
+this.element.addStyleClass("read-only");
 }
 
 WebInspector.StylePropertiesSection.prototype = {
-    get usedProperties()
-    {
-        return this._usedProperties || {};
-    },
+collapse: function(dontRememberState)
+{
 
-    set usedProperties(x)
-    {
-        this._usedProperties = x;
-        this.update();
-    },
+},
 
-    expand: function(dontRememberState)
-    {
-        WebInspector.PropertiesSection.prototype.expand.call(this);
-        if (dontRememberState)
-            return;
+isPropertyInherited: function(propertyName)
+{
+if (this.isInherited) {
 
-        if (!Preferences.styleRulesExpandedState)
-            Preferences.styleRulesExpandedState = {};
-        Preferences.styleRulesExpandedState[this.identifier] = true;
-    },
 
-    collapse: function(dontRememberState)
-    {
-        WebInspector.PropertiesSection.prototype.collapse.call(this);
-        if (dontRememberState)
-            return;
+return !(propertyName in WebInspector.StylesSidebarPane.InheritedProperties);
+}
+return false;
+},
 
-        if (!Preferences.styleRulesExpandedState)
-            Preferences.styleRulesExpandedState = {};
-        Preferences.styleRulesExpandedState[this.identifier] = false;
-    },
+isPropertyOverloaded: function(propertyName, shorthand)
+{
+if (!this._usedProperties || this.noAffect)
+return false;
 
-    isPropertyInherited: function(property)
-    {
-        if (!this.computedStyle || !this._usedProperties || this.noAffect)
-            return false;
-        // These properties should always show for Computed Style.
-        var alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
-        return !(property in this.usedProperties) && !(property in alwaysShowComputedProperties) && !(property in this.disabledComputedProperties);
-    },
+if (this.isInherited && !(propertyName in WebInspector.StylesSidebarPane.InheritedProperties)) {
 
-    isPropertyOverloaded: function(property, shorthand)
-    {
-        if (this.computedStyle || !this._usedProperties || this.noAffect)
-            return false;
+return false;
+}
 
-        var used = (property in this.usedProperties);
-        if (used || !shorthand)
-            return !used;
+var used = (propertyName in this._usedProperties);
+if (used || !shorthand)
+return !used;
 
-        // Find out if any of the individual longhand properties of the shorthand
-        // are used, if none are then the shorthand is overloaded too.
-        var longhandProperties = this.styleRule.style.getLonghandProperties(property);
-        for (var j = 0; j < longhandProperties.length; ++j) {
-            var individualProperty = longhandProperties[j];
-            if (individualProperty in this.usedProperties)
-                return false;
-        }
 
-        return true;
-    },
 
-    isInspectorStylesheet: function()
-    {
-        return (this.styleRule.parentStyleSheet === WebInspector.panels.elements.stylesheet);
-    },
+var longhandProperties = this.styleRule.style.getLonghandProperties(propertyName);
+for (var j = 0; j < longhandProperties.length; ++j) {
+var individualProperty = longhandProperties[j];
+if (individualProperty.name in this._usedProperties)
+return false;
+}
 
-    update: function(full)
-    {
-        if (full || this.computedStyle) {
-            this.propertiesTreeOutline.removeChildren();
-            this.populated = false;
-        } else {
-            var child = this.propertiesTreeOutline.children[0];
-            while (child) {
-                child.overloaded = this.isPropertyOverloaded(child.name, child.shorthand);
-                child = child.traverseNextTreeElement(false, null, true);
-            }
-        }
+return true;
+},
 
-        this.afterUpdate();
-    },
+update: function(full)
+{
+if (full) {
+this.propertiesTreeOutline.removeChildren();
+this.populated = false;
+} else {
+var child = this.propertiesTreeOutline.children[0];
+while (child) {
+child.overloaded = this.isPropertyOverloaded(child.name, child.shorthand);
+child = child.traverseNextTreeElement(false, null, true);
+}
+}
+this.afterUpdate();
+},
 
-    afterUpdate: function()
-    {
-        if (this._afterUpdate) {
-            this._afterUpdate(this);
-            delete this._afterUpdate;
-        }
-    },
+afterUpdate: function()
+{
+if (this._afterUpdate) {
+this._afterUpdate(this);
+delete this._afterUpdate;
+}
+},
 
-    onpopulate: function()
-    {
-        var style = this.styleRule.style;
+onpopulate: function()
+{
+var style = this.styleRule.style;
 
-        var foundShorthands = {};
-        var uniqueProperties = style.uniqueStyleProperties;
-        var disabledProperties = style.__disabledPropertyValues || {};
+var handledProperties = {};
+var shorthandNames = {};
 
-        for (var name in disabledProperties)
-            uniqueProperties.push(name);
+this.uniqueProperties = [];
+var allProperties = style.allProperties;
+for (var i = 0; i < allProperties.length; ++i)
+this.uniqueProperties.push(allProperties[i]);
 
-        uniqueProperties.sort();
 
-        for (var i = 0; i < uniqueProperties.length; ++i) {
-            var name = uniqueProperties[i];
-            var disabled = name in disabledProperties;
-            if (!disabled && this.disabledComputedProperties && !(name in this.usedProperties) && name in this.disabledComputedProperties)
-                disabled = true;
+for (var i = 0; i < this.uniqueProperties.length; ++i) {
+var property = this.uniqueProperties[i];
+if (property.disabled)
+continue;
+if (property.shorthand)
+shorthandNames[property.shorthand] = true;
+}
 
-            var shorthand = !disabled ? style.getPropertyShorthand(name) : null;
 
-            if (shorthand && shorthand in foundShorthands)
-                continue;
+for (var i = 0; i < this.uniqueProperties.length; ++i) {
+var property = this.uniqueProperties[i];
+var disabled = property.disabled;
+if (!disabled && this.disabledComputedProperties && !(property.name in this.usedProperties) && property.name in this.disabledComputedProperties)
+disabled = true;
 
-            if (shorthand) {
-                foundShorthands[shorthand] = true;
-                name = shorthand;
-            }
+var shorthand = !disabled ? property.shorthand : null;
 
-            var isShorthand = (shorthand ? true : false);
-            var inherited = this.isPropertyInherited(name);
-            var overloaded = this.isPropertyOverloaded(name, isShorthand);
+if (shorthand && shorthand in handledProperties)
+continue;
 
-            var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, name, isShorthand, inherited, overloaded, disabled);
-            this.propertiesTreeOutline.appendChild(item);
-        }
-    },
+if (shorthand) {
+property = style.getLiveProperty(shorthand);
+if (!property)
+property = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.getShorthandValue(shorthand), style.getShorthandPriority(shorthand), "style", true, true, "");
+}
 
-    findTreeElementWithName: function(name)
-    {
-        var treeElement = this.propertiesTreeOutline.children[0];
-        while (treeElement) {
-            if (treeElement.name === name)
-                return treeElement;
-            treeElement = treeElement.traverseNextTreeElement(true, null, true);
-        }
-        return null;
-    },
+var isShorthand = !!(property.isLive && (shorthand || shorthandNames[property.name]));
+var inherited = this.isPropertyInherited(property.name);
+var overloaded = this.isPropertyOverloaded(property.name, isShorthand);
 
-    addNewBlankProperty: function()
-    {
-        var item = new WebInspector.StylePropertyTreeElement(this.styleRule, this.styleRule.style, "", false, false, false, false);
-        this.propertiesTreeOutline.appendChild(item);
-        item.listItemElement.textContent = "";
-        item._newProperty = true;
-        return item;
-    },
+var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, property, isShorthand, inherited, overloaded);
+this.propertiesTreeOutline.appendChild(item);
+handledProperties[property.name] = property;
+}
+},
 
-    _clickSelector: function(event)
-    {
-        event.stopPropagation();
+findTreeElementWithName: function(name)
+{
+var treeElement = this.propertiesTreeOutline.children[0];
+while (treeElement) {
+if (treeElement.name === name)
+return treeElement;
+treeElement = treeElement.traverseNextTreeElement(true, null, true);
+}
+return null;
+},
 
-        // Don't search "Computed Styles", "Style Attribute", or Mapped Attributes.
-        if (this.computedStyle || !this.rule || this.rule.isUser)
-            return;
+addNewBlankProperty: function(optionalIndex)
+{
+var style = this.styleRule.style;
+var property = style.newBlankProperty();
+var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, property, false, false, false);
+this.propertiesTreeOutline.appendChild(item);
+item.listItemElement.textContent = "";
+item._newProperty = true;
+return item;
+},
 
-        var searchElement = document.getElementById("search");
-        searchElement.value = this.styleRule.selectorText;
-        WebInspector.performSearch({ target: searchElement });
-    },
+_debugShowStyle: function(anchor)
+{
+var boundHandler;
+function removeStyleBox(element, event)
+{
+if (event.target === element) {
+event.stopPropagation();
+return;
+}
+document.body.removeChild(element);
+document.getElementById("main").removeEventListener("mousedown", boundHandler, true);
+}
 
-    _dblclickEmptySpace: function(event)
-    {
-        this.expand();
-        this.addNewBlankProperty().startEditing();
-    },
+if (!event.shiftKey)
+return;
 
-    _dblclickSelector: function(event)
-    {
-        if (!this.editable)
-            return;
+var container = document.createElement("div");
+var element = document.createElement("span");
+container.appendChild(element);
+element.style.background = "yellow";
+element.style.display = "inline-block";
+container.style.cssText = "z-index: 2000000; position: absolute; top: 50px; left: 50px; white-space: pre; overflow: auto; background: white; font-family: monospace; font-size: 12px; border: 1px solid black; opacity: 0.85; -webkit-user-select: text; padding: 2px;";
+container.style.width = (document.body.offsetWidth - 100) + "px";
+container.style.height = (document.body.offsetHeight - 100) + "px";
+document.body.appendChild(container);
+if (this.rule)
+element.textContent = this.rule.selectorText + " {" + ((this.styleRule.style.cssText !== undefined) ? this.styleRule.style.cssText : "<no cssText>") + "}";
+else
+element.textContent = this.styleRule.style.cssText;
+boundHandler = removeStyleBox.bind(null, container);
+document.getElementById("main").addEventListener("mousedown", boundHandler, true);
+},
 
-        if (!this.rule && this.propertiesTreeOutline.children.length === 0) {
-            this.expand();
-            this.addNewBlankProperty().startEditing();
-            return;
-        }
+_handleEmptySpaceDoubleClick: function(event)
+{
+if (event.target.hasStyleClass("header")) {
+event.stopPropagation();
+return;
+}
+this.expand();
+this.addNewBlankProperty().startEditing();
+},
 
-        if (!this.rule)
-            return;
+_handleSelectorClick: function(event)
+{
+event.stopPropagation();
+},
 
-        this.startEditingSelector();
-        event.stopPropagation();
-    },
+_handleSelectorDoubleClick: function(event)
+{
+this._startEditingOnMouseEvent();
+event.stopPropagation();
+},
 
-    startEditingSelector: function()
-    {
-        var element = this.titleElement;
-        if (WebInspector.isBeingEdited(element))
-            return;
+_startEditingOnMouseEvent: function()
+{
+if (!this.editable)
+return;
 
-        WebInspector.startEditing(this.titleElement, this.editingSelectorCommitted.bind(this), this.editingSelectorCancelled.bind(this), null);
-        window.getSelection().setBaseAndExtent(element, 0, element, 1);
-    },
+if (!this.rule && this.propertiesTreeOutline.children.length === 0) {
+this.expand();
+this.addNewBlankProperty().startEditing();
+return;
+}
 
-    editingSelectorCommitted: function(element, newContent, oldContent, context, moveDirection)
-    {
-        function moveToNextIfNeeded() {
-            if (!moveDirection || moveDirection !== "forward")
-                return;
+if (!this.rule)
+return;
 
-            this.expand();
-            if (this.propertiesTreeOutline.children.length === 0)
-                this.addNewBlankProperty().startEditing();
-            else {
-                var item = this.propertiesTreeOutline.children[0]
-                item.startEditing(item.valueElement);
-            }
-        }
+this.startEditingSelector();
+},
 
-        if (newContent === oldContent)
-            return moveToNextIfNeeded.call(this);
+startEditingSelector: function()
+{
+var element = this._selectorElement;
+if (WebInspector.isBeingEdited(element))
+return;
 
-        var self = this;
-        function callback(result)
-        {
-            if (!result) {
-                // Invalid Syntax for a Selector
-                moveToNextIfNeeded.call(self);
-                return;
-            }
+WebInspector.startEditing(this._selectorElement, this.editingSelectorCommitted.bind(this), this.editingSelectorCancelled.bind(this), null);
+window.getSelection().setBaseAndExtent(element, 0, element, 1);
+},
 
-            var newRulePayload = result[0];
-            var doesAffectSelectedNode = result[1];
-            if (!doesAffectSelectedNode) {
-                self.noAffect = true;
-                self.element.addStyleClass("no-affect");
-            } else {
-                delete self.noAffect;
-                self.element.removeStyleClass("no-affect");
-            }
+editingSelectorCommitted: function(element, newContent, oldContent, context, moveDirection)
+{
+function moveToNextIfNeeded() {
+if (!moveDirection || moveDirection !== "forward")
+return;
 
-            var newRule = WebInspector.CSSStyleDeclaration.parseRule(newRulePayload);
-            self.rule = newRule;
-            self.styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, parentStyleSheet: newRule.parentStyleSheet, rule: newRule };
+this.expand();
+if (this.propertiesTreeOutline.children.length === 0)
+this.addNewBlankProperty().startEditing();
+else {
+var item = this.propertiesTreeOutline.children[0]
+item.startEditing(item.valueElement);
+}
+}
 
-            var oldIdentifier = this.identifier;
-            self.identifier = newRule.selectorText + ":" + self.subtitleElement.textContent;
+if (newContent === oldContent)
+return moveToNextIfNeeded.call(this);
 
-            self.pane.update();
+var self = this;
 
-            WebInspector.panels.elements.renameSelector(oldIdentifier, this.identifier, oldContent, newContent);
+function successCallback(newRule, doesAffectSelectedNode)
+{
+if (!doesAffectSelectedNode) {
+self.noAffect = true;
+self.element.addStyleClass("no-affect");
+} else {
+delete self.noAffect;
+self.element.removeStyleClass("no-affect");
+}
 
-            moveToNextIfNeeded.call(self);
-        }
+self.rule = newRule;
+self.styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule };
 
-        InjectedScriptAccess.get(this.rule.injectedScriptId).applyStyleRuleText(this.rule.id, newContent, this.pane.node.id, callback);
-    },
+var oldIdentifier = this.identifier;
+self.identifier = newRule.selectorText + ":" + self.subtitleElement.textContent;
 
-    editingSelectorCancelled: function()
-    {
-        // Do nothing, this is overridden by BlankStylePropertiesSection.
-    }
+self.pane.update();
+
+WebInspector.panels.elements.renameSelector(oldIdentifier, this.identifier, oldContent, newContent);
+
+moveToNextIfNeeded.call(self);
+}
+
+var focusedNode = WebInspector.panels.elements.focusedDOMNode;
+WebInspector.cssModel.setRuleSelector(this.rule.id, focusedNode ? focusedNode.id : 0, newContent, successCallback, moveToNextIfNeeded.bind(this));
+},
+
+editingSelectorCancelled: function()
+{
+
+}
 }
 
 WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
 
+WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties, disabledComputedProperties)
+{
+WebInspector.PropertiesSection.call(this, "");
+this.headerElement.addStyleClass("hidden");
+this.element.className = "styles-section monospace first-styles-section read-only computed-style";
+this.styleRule = styleRule;
+this._usedProperties = usedProperties;
+this._disabledComputedProperties = disabledComputedProperties;
+this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true };
+this.computedStyle = true;
+this._propertyTreeElements = {};
+this._expandedPropertyNames = {};
+}
+
+WebInspector.ComputedStylePropertiesSection.prototype = {
+collapse: function(dontRememberState)
+{
+
+},
+
+_isPropertyInherited: function(propertyName)
+{
+return !(propertyName in this._usedProperties) && !(propertyName in this._alwaysShowComputedProperties) && !(propertyName in this._disabledComputedProperties);
+},
+
+update: function()
+{
+this._expandedPropertyNames = {};
+for (var name in this._propertyTreeElements) {
+if (this._propertyTreeElements[name].expanded)
+this._expandedPropertyNames[name] = true;
+}
+this._propertyTreeElements = {};
+this.propertiesTreeOutline.removeChildren();
+this.populated = false;
+},
+
+onpopulate: function()
+{
+function sorter(a, b)
+{
+return a.name.localeCompare(b.name);
+}
+
+var style = this.styleRule.style;
+var uniqueProperties = [];
+var allProperties = style.allProperties;
+for (var i = 0; i < allProperties.length; ++i)
+uniqueProperties.push(allProperties[i]);
+uniqueProperties.sort(sorter);
+
+this._propertyTreeElements = {};
+for (var i = 0; i < uniqueProperties.length; ++i) {
+var property = uniqueProperties[i];
+var inherited = this._isPropertyInherited(property.name);
+var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, property, false, inherited, false);
+this.propertiesTreeOutline.appendChild(item);
+this._propertyTreeElements[property.name] = item;
+}
+},
+
+rebuildComputedTrace: function(sections)
+{
+for (var i = 0; i < sections.length; ++i) {
+var section = sections[i];
+if (section.computedStyle || section instanceof WebInspector.BlankStylePropertiesSection)
+continue;
+
+for (var j = 0; j < section.uniqueProperties.length; ++j) {
+var property = section.uniqueProperties[j];
+if (property.disabled)
+continue;
+if (section.isInherited && !(property.name in WebInspector.StylesSidebarPane.InheritedProperties))
+continue;
+
+var treeElement = this._propertyTreeElements[property.name];
+if (treeElement) {
+var selectorText = section.styleRule.selectorText;
+var value = property.value;
+var title = "<span style='color: gray'>" + selectorText + "</span> - " + value;
+var subtitle = " <span style='float:right'>" + section.subtitleElement.innerHTML + "</span>";
+var childElement = new TreeElement(null, null, false);
+childElement.titleHTML = title + subtitle;
+treeElement.appendChild(childElement);
+if (section.isPropertyOverloaded(property.name))
+childElement.listItemElement.addStyleClass("overloaded");
+}
+}
+}
+
+
+for (var name in this._expandedPropertyNames) {
+if (name in this._propertyTreeElements)
+this._propertyTreeElements[name].expand();
+}
+}
+}
+
+WebInspector.ComputedStylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype;
+
 WebInspector.BlankStylePropertiesSection = function(defaultSelectorText)
 {
-    WebInspector.StylePropertiesSection.call(this, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, "", false, {}, false);
-
-    this.element.addStyleClass("blank-section");
+WebInspector.StylePropertiesSection.call(this, {selectorText: defaultSelectorText, rule: {isViaInspector: true}}, true, false, false);
+this.element.addStyleClass("blank-section");
 }
 
 WebInspector.BlankStylePropertiesSection.prototype = {
-    expand: function()
-    {
-        // Do nothing, blank sections are not expandable.
-    },
+expand: function()
+{
 
-    editingSelectorCommitted: function(element, newContent, oldContent, context)
-    {
-        var self = this;
-        function callback(result)
-        {
-            if (!result) {
-                // Invalid Syntax for a Selector
-                self.editingSelectorCancelled();
-                return;
-            }
+},
 
-            var rule = result[0];
-            var doesSelectorAffectSelectedNode = result[1];
+editingSelectorCommitted: function(element, newContent, oldContent, context)
+{
+var self = this;
+function successCallback(newRule, doesSelectorAffectSelectedNode)
+{
+var styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule };
+self.makeNormal(styleRule);
 
-            var styleRule = WebInspector.CSSStyleDeclaration.parseRule(rule);
-            styleRule.rule = rule;
+if (!doesSelectorAffectSelectedNode) {
+self.noAffect = true;
+self.element.addStyleClass("no-affect");
+}
 
-            self.makeNormal(styleRule);
+self.subtitleElement.textContent = WebInspector.UIString("via inspector");
+self.expand();
 
-            if (!doesSelectorAffectSelectedNode) {
-                self.noAffect = true;
-                self.element.addStyleClass("no-affect");
-            }
+self.addNewBlankProperty().startEditing();
+}
 
-            self.subtitleElement.textContent = WebInspector.UIString("via inspector");
-            self.expand();
+WebInspector.cssModel.addRule(this.pane.node.id, newContent, successCallback, this.editingSelectorCancelled.bind(this));
+},
 
-            self.addNewBlankProperty().startEditing();
-        }
+editingSelectorCancelled: function()
+{
+this.pane.removeSection(this);
+},
 
-        InjectedScriptAccess.get(this.pane.node.injectedScriptId).addStyleSelector(newContent, this.pane.node.id, callback);
-    },
-
-    editingSelectorCancelled: function()
-    {
-        this.pane.removeSection(this);
-    },
-
-    makeNormal: function(styleRule)
-    {
-        this.element.removeStyleClass("blank-section");
-
-        this.styleRule = styleRule;
-        this.rule = styleRule.rule;
-        this.computedStyle = false;
-        this.editable = true;
-        this.identifier = styleRule.selectorText + ":via inspector";
-
-        this.__proto__ = WebInspector.StylePropertiesSection.prototype;
-    }
+makeNormal: function(styleRule)
+{
+this.element.removeStyleClass("blank-section");
+this.styleRule = styleRule;
+this.rule = styleRule.rule;
+this.identifier = styleRule.selectorText + ":via inspector";
+this.__proto__ = WebInspector.StylePropertiesSection.prototype;
+}
 }
 
 WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.StylePropertiesSection.prototype;
 
-WebInspector.StylePropertyTreeElement = function(styleRule, style, name, shorthand, inherited, overloaded, disabled)
+WebInspector.StylePropertyTreeElement = function(styleRule, style, property, shorthand, inherited, overloaded)
 {
-    this._styleRule = styleRule;
-    this.style = style;
-    this.name = name;
-    this.shorthand = shorthand;
-    this._inherited = inherited;
-    this._overloaded = overloaded;
-    this._disabled = disabled;
+this._styleRule = styleRule;
+this.style = style;
+this.property = property;
+this.shorthand = shorthand;
+this._inherited = inherited;
+this._overloaded = overloaded;
 
-    // Pass an empty title, the title gets made later in onattach.
-    TreeElement.call(this, "", null, shorthand);
+
+TreeElement.call(this, "", null, shorthand);
 }
 
 WebInspector.StylePropertyTreeElement.prototype = {
-    get inherited()
-    {
-        return this._inherited;
-    },
+get inherited()
+{
+return this._inherited;
+},
 
-    set inherited(x)
-    {
-        if (x === this._inherited)
-            return;
-        this._inherited = x;
-        this.updateState();
-    },
+set inherited(x)
+{
+if (x === this._inherited)
+return;
+this._inherited = x;
+this.updateState();
+},
 
-    get overloaded()
-    {
-        return this._overloaded;
-    },
+get overloaded()
+{
+return this._overloaded;
+},
 
-    set overloaded(x)
-    {
-        if (x === this._overloaded)
-            return;
-        this._overloaded = x;
-        this.updateState();
-    },
+set overloaded(x)
+{
+if (x === this._overloaded)
+return;
+this._overloaded = x;
+this.updateState();
+},
 
-    get disabled()
-    {
-        return this._disabled;
-    },
+get disabled()
+{
+return this.property.disabled;
+},
 
-    set disabled(x)
-    {
-        if (x === this._disabled)
-            return;
-        this._disabled = x;
-        this.updateState();
-    },
+get name()
+{
+if (!this.disabled || !this.property.text)
+return this.property.name;
 
-    get priority()
-    {
-        if (this.disabled && this.style.__disabledPropertyPriorities && this.name in this.style.__disabledPropertyPriorities)
-            return this.style.__disabledPropertyPriorities[this.name];
-        return (this.shorthand ? this.style.getShorthandPriority(this.name) : this.style.getPropertyPriority(this.name));
-    },
+var text = this.property.text;
+var index = text.indexOf(":");
+if (index < 1)
+return this.property.name;
 
-    get value()
-    {
-        if (this.disabled && this.style.__disabledPropertyValues && this.name in this.style.__disabledPropertyValues)
-            return this.style.__disabledPropertyValues[this.name];
-        return (this.shorthand ? this.style.getShorthandValue(this.name) : this.style.getPropertyValue(this.name));
-    },
+return text.substring(0, index).trim();
+},
 
-    onattach: function()
-    {
-        this.updateTitle();
-    },
+get priority()
+{
+if (this.disabled)
+return ""; 
+return this.property.priority;
+},
 
-    updateTitle: function()
-    {
-        var priority = this.priority;
-        var value = this.value;
+get value()
+{
+if (!this.disabled || !this.property.text)
+return this.property.value;
 
-        if (priority && !priority.length)
-            delete priority;
-        if (priority)
-            priority = "!" + priority;
+var match = this.property.text.match(/(.*);\s*/);
+if (!match || !match[1])
+return this.property.value;
 
-        this.updateState();
+var text = match[1];
+var index = text.indexOf(":");
+if (index < 1)
+return this.property.value;
 
-        var enabledCheckboxElement = document.createElement("input");
-        enabledCheckboxElement.className = "enabled-button";
-        enabledCheckboxElement.type = "checkbox";
-        enabledCheckboxElement.checked = !this.disabled;
-        enabledCheckboxElement.addEventListener("change", this.toggleEnabled.bind(this), false);
+return text.substring(index + 1).trim();
+},
 
-        var nameElement = document.createElement("span");
-        nameElement.className = "name";
-        nameElement.textContent = this.name;
-        this.nameElement = nameElement;
+get parsedOk()
+{
+return this.property.parsedOk;
+},
 
-        var valueElement = document.createElement("span");
-        valueElement.className = "value";
-        this.valueElement = valueElement;
+onattach: function()
+{
+this.updateTitle();
+},
 
-        if (value) {
-            function processValue(regex, processor, nextProcessor, valueText)
-            {
-                var container = document.createDocumentFragment();
+updateTitle: function()
+{
+var value = this.value;
 
-                var items = valueText.replace(regex, "\0$1\0").split("\0");
-                for (var i = 0; i < items.length; ++i) {
-                    if ((i % 2) === 0) {
-                        if (nextProcessor)
-                            container.appendChild(nextProcessor(items[i]));
-                        else
-                            container.appendChild(document.createTextNode(items[i]));
-                    } else {
-                        var processedNode = processor(items[i]);
-                        if (processedNode)
-                            container.appendChild(processedNode);
-                    }
-                }
+this.updateState();
 
-                return container;
-            }
+var enabledCheckboxElement;
+if (this.parsedOk) {
+enabledCheckboxElement = document.createElement("input");
+enabledCheckboxElement.className = "enabled-button";
+enabledCheckboxElement.type = "checkbox";
+enabledCheckboxElement.checked = !this.disabled;
+enabledCheckboxElement.addEventListener("change", this.toggleEnabled.bind(this), false);
+}
 
-            function linkifyURL(url)
-            {
-                var container = document.createDocumentFragment();
-                container.appendChild(document.createTextNode("url("));
-                container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, (url in WebInspector.resourceURLMap)));
-                container.appendChild(document.createTextNode(")"));
-                return container;
-            }
+var nameElement = document.createElement("span");
+nameElement.className = "webkit-css-property";
+nameElement.textContent = this.name;
+this.nameElement = nameElement;
 
-            function processColor(text)
-            {
-                try {
-                    var color = new WebInspector.Color(text);
-                } catch (e) {
-                    return document.createTextNode(text);
-                }
+var valueElement = document.createElement("span");
+valueElement.className = "value";
+this.valueElement = valueElement;
 
-                var swatchElement = document.createElement("span");
-                swatchElement.title = WebInspector.UIString("Click to change color format");
-                swatchElement.className = "swatch";
-                swatchElement.style.setProperty("background-color", text);
+if (value) {
+function processValue(regex, processor, nextProcessor, valueText)
+{
+var container = document.createDocumentFragment();
 
-                swatchElement.addEventListener("click", changeColorDisplay, false);
-                swatchElement.addEventListener("dblclick", function(event) { event.stopPropagation() }, false);
+var items = valueText.replace(regex, "\0$1\0").split("\0");
+for (var i = 0; i < items.length; ++i) {
+if ((i % 2) === 0) {
+if (nextProcessor)
+container.appendChild(nextProcessor(items[i]));
+else
+container.appendChild(document.createTextNode(items[i]));
+} else {
+var processedNode = processor(items[i]);
+if (processedNode)
+container.appendChild(processedNode);
+}
+}
 
-                var format;
-                if (Preferences.showColorNicknames && color.nickname)
-                    format = "nickname";
-                else if (WebInspector.settings.colorFormat === "rgb")
-                    format = (color.simple ? "rgb" : "rgba");
-                else if (WebInspector.settings.colorFormat === "hsl")
-                    format = (color.simple ? "hsl" : "hsla");
-                else if (color.simple)
-                    format = (color.hasShortHex() ? "shorthex" : "hex");
-                else
-                    format = "rgba";
+return container;
+}
 
-                var colorValueElement = document.createElement("span");
-                colorValueElement.textContent = color.toString(format);
+function linkifyURL(url)
+{
+var container = document.createDocumentFragment();
+container.appendChild(document.createTextNode("url("));
+var hasResource = !!WebInspector.resourceForURL(url);
+container.appendChild(WebInspector.linkifyURLAsNode(url, url, null, hasResource));
+container.appendChild(document.createTextNode(")"));
+return container;
+}
 
-                function changeColorDisplay(event)
-                {
-                    switch (format) {
-                        case "rgb":
-                            format = "hsl";
-                            break;
+function processColor(text)
+{
+try {
+var color = new WebInspector.Color(text);
+} catch (e) {
+return document.createTextNode(text);
+}
 
-                        case "shorthex":
-                            format = "hex";
-                            break;
+var swatchElement = document.createElement("span");
+swatchElement.title = WebInspector.UIString("Click to change color format");
+swatchElement.className = "swatch";
+swatchElement.style.setProperty("background-color", text);
 
-                        case "hex":
-                            format = "rgb";
-                            break;
+swatchElement.addEventListener("click", changeColorDisplay, false);
+swatchElement.addEventListener("dblclick", function(event) { event.stopPropagation() }, false);
 
-                        case "nickname":
-                            if (color.simple) {
-                                if (color.hasShortHex())
-                                    format = "shorthex";
-                                else
-                                    format = "hex";
-                                break;
-                            }
+var format;
+if (WebInspector.settings.colorFormat === "original")
+format = "original";
+else if (Preferences.showColorNicknames && color.nickname)
+format = "nickname";
+else if (WebInspector.settings.colorFormat === "rgb")
+format = (color.simple ? "rgb" : "rgba");
+else if (WebInspector.settings.colorFormat === "hsl")
+format = (color.simple ? "hsl" : "hsla");
+else if (color.simple)
+format = (color.hasShortHex() ? "shorthex" : "hex");
+else
+format = "rgba";
 
-                            format = "rgba";
-                            break;
+var colorValueElement = document.createElement("span");
+colorValueElement.textContent = color.toString(format);
 
-                        case "hsl":
-                            if (color.nickname)
-                                format = "nickname";
-                            else if (color.hasShortHex())
-                                format = "shorthex";
-                            else
-                                format = "hex";
-                            break;
+function nextFormat(curFormat)
+{
 
-                        case "rgba":
-                            format = "hsla";
-                            break;
 
-                        case "hsla":
-                            if (color.nickname)
-                                format = "nickname";
-                            else
-                                format = "rgba";
-                            break;
-                    }
 
-                    colorValueElement.textContent = color.toString(format);
-                }
 
-                var container = document.createDocumentFragment();
-                container.appendChild(swatchElement);
-                container.appendChild(colorValueElement);
-                return container;
-            }
 
-            var colorRegex = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;
-            var colorProcessor = processValue.bind(window, colorRegex, processColor, null);
 
-            valueElement.appendChild(processValue(/url\(([^)]+)\)/g, linkifyURL, colorProcessor, value));
-        }
 
-        if (priority) {
-            var priorityElement = document.createElement("span");
-            priorityElement.className = "priority";
-            priorityElement.textContent = priority;
-        }
+
+switch (curFormat) {
+case "original":
+return color.simple ? "rgb" : "rgba";
+
+case "rgb":
+case "rgba":
+return color.simple ? "hsl" : "hsla";
+
+case "hsl":
+case "hsla":
+if (color.nickname)
+return "nickname";
+if (color.simple)
+return color.hasShortHex() ? "shorthex" : "hex";
+else
+return "original";
+
+case "shorthex":
+return "hex";
+
+case "hex":
+return "original";
+
+case "nickname":
+if (color.simple)
+return color.hasShortHex() ? "shorthex" : "hex";
+else
+return "original";
+
+default:
+return null;
+}
+}
+
+function changeColorDisplay(event)
+{
+do {
+format = nextFormat(format);
+var currentValue = color.toString(format || "");
+} while (format && currentValue === color.value && format !== "original");
+
+if (format)
+colorValueElement.textContent = currentValue;
+}
+
+var container = document.createDocumentFragment();
+container.appendChild(swatchElement);
+container.appendChild(colorValueElement);
+return container;
+}
+
+var colorRegex = /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;
+var colorProcessor = processValue.bind(window, colorRegex, processColor, null);
+
+valueElement.appendChild(processValue(/url\(([^)]+)\)/g, linkifyURL, colorProcessor, value));
+}
+
+this.listItemElement.removeChildren();
+
+if (!this.treeOutline)
+return;
+
+
+if (enabledCheckboxElement && this.treeOutline.section && this.treeOutline.section.editable && this.parent.root)
+this.listItemElement.appendChild(enabledCheckboxElement);
+this.listItemElement.appendChild(nameElement);
+this.listItemElement.appendChild(document.createTextNode(": "));
+this.listItemElement.appendChild(valueElement);
+this.listItemElement.appendChild(document.createTextNode(";"));
+
+if (!this.parsedOk)
+this.listItemElement.addStyleClass("not-parsed-ok");
+if (this.property.inactive)
+this.listItemElement.addStyleClass("inactive");
+
+this.tooltip = this.property.propertyText;
+},
+
+updateAll: function(updateAllRules)
+{
+if (!this.treeOutline)
+return;
+if (updateAllRules && this.treeOutline.section && this.treeOutline.section.pane)
+this.treeOutline.section.pane.update(null, this.treeOutline.section);
+else if (this.treeOutline.section)
+this.treeOutline.section.update(true);
+else
+this.updateTitle(); 
+},
+
+toggleEnabled: function(event)
+{
+var disabled = !event.target.checked;
+
+function callback(newStyle)
+{
+if (!newStyle)
+return;
+
+this.style = newStyle;
+this._styleRule.style = newStyle;
+
+if (this.treeOutline.section && this.treeOutline.section.pane)
+this.treeOutline.section.pane.dispatchEventToListeners("style property toggled");
+
+this.updateAll(true);
+}
+
+this.property.setDisabled(disabled, callback.bind(this));
+},
+
+updateState: function()
+{
+if (!this.listItemElement)
+return;
+
+if (this.style.isPropertyImplicit(this.name) || this.value === "initial")
+this.listItemElement.addStyleClass("implicit");
+else
+this.listItemElement.removeStyleClass("implicit");
+
+this.selectable = !this.inherited;
+if (this.inherited)
+this.listItemElement.addStyleClass("inherited");
+else
+this.listItemElement.removeStyleClass("inherited");
+
+if (this.overloaded)
+this.listItemElement.addStyleClass("overloaded");
+else
+this.listItemElement.removeStyleClass("overloaded");
+
+if (this.disabled)
+this.listItemElement.addStyleClass("disabled");
+else
+this.listItemElement.removeStyleClass("disabled");
+},
+
+onpopulate: function()
+{
+
+if (this.children.length || !this.shorthand)
+return;
+
+var longhandProperties = this.style.getLonghandProperties(this.name);
+for (var i = 0; i < longhandProperties.length; ++i) {
+var name = longhandProperties[i].name;
+
+
+if (this.treeOutline.section) {
+var inherited = this.treeOutline.section.isPropertyInherited(name);
+var overloaded = this.treeOutline.section.isPropertyOverloaded(name);
+}
+
+var liveProperty = this.style.getLiveProperty(name);
+var item = new WebInspector.StylePropertyTreeElement(this._styleRule, this.style, liveProperty, false, inherited, overloaded);
+this.appendChild(item);
+}
+},
+
+ondblclick: function(event)
+{
+this.startEditing(event.target);
+event.stopPropagation();
+},
+
+restoreNameElement: function()
+{
+
+if (this.nameElement === this.listItemElement.querySelector(".webkit-css-property"))
+return;
+
+this.nameElement = document.createElement("span");
+this.nameElement.className = "webkit-css-property";
+this.nameElement.textContent = "";
+this.listItemElement.insertBefore(this.nameElement, this.listItemElement.firstChild);
+},
+
+startEditing: function(selectElement)
+{
+
+if (this.parent.shorthand)
+return;
+
+if (WebInspector.isBeingEdited(this.listItemElement) || (this.treeOutline.section && !this.treeOutline.section.editable))
+return;
+
+var context = {
+expanded: this.expanded,
+hasChildren: this.hasChildren,
+keyDownListener: this.editingKeyDown.bind(this),
+keyPressListener: this.editingKeyPress.bind(this)
+};
+
+
+this.hasChildren = false;
+
+if (!selectElement)
+selectElement = this.listItemElement;
+
+this.listItemElement.addEventListener("keydown", context.keyDownListener, false);
+this.listItemElement.addEventListener("keypress", context.keyPressListener, false);
+
+WebInspector.startEditing(this.listItemElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
+window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
+},
 
-        this.listItemElement.removeChildren();
+editingKeyPress: function(event)
+{
+var selection = window.getSelection();
+var colonIndex = this.listItemElement.textContent.indexOf(":");
+var selectionLeftOffset = event.target.selectionLeftOffset;
 
-        // Append the checkbox for root elements of an editable section.
-        if (this.treeOutline.section && this.treeOutline.section.editable && this.parent.root)
-            this.listItemElement.appendChild(enabledCheckboxElement);
-        this.listItemElement.appendChild(nameElement);
-        this.listItemElement.appendChild(document.createTextNode(": "));
-        this.listItemElement.appendChild(valueElement);
+if (colonIndex < 0 || selectionLeftOffset <= colonIndex) {
 
-        if (priorityElement) {
-            this.listItemElement.appendChild(document.createTextNode(" "));
-            this.listItemElement.appendChild(priorityElement);
-        }
+var character = event.data.toLowerCase();
+if (character && /[a-z-]/.test(character)) {
+var prefix = selection.anchorNode.textContent.substring(0, selection.anchorOffset);
+var property = WebInspector.CSSCompletions.firstStartsWith(prefix + character);
 
-        this.listItemElement.appendChild(document.createTextNode(";"));
+if (!selection.isCollapsed)
+selection.deleteFromDocument();
 
-        this.tooltip = this.name + ": " + valueElement.textContent + (priority ? " " + priority : "");
-    },
+this.restoreNameElement();
 
-    updateAll: function(updateAllRules)
-    {
-        if (updateAllRules && this.treeOutline.section && this.treeOutline.section.pane)
-            this.treeOutline.section.pane.update(null, this.treeOutline.section);
-        else if (this.treeOutline.section)
-            this.treeOutline.section.update(true);
-        else
-            this.updateTitle(); // FIXME: this will not show new properties. But we don't hit his case yet.
-    },
+if (property) {
+if (property !== this.nameElement.textContent)
+this.nameElement.textContent = property;
+this.nameElement.firstChild.select(prefix.length + 1);
+event.preventDefault();
+}
+}
+} else {
 
-    toggleEnabled: function(event)
-    {
-        var disabled = !event.target.checked;
+}
+},
 
-        var self = this;
-        function callback(newPayload)
-        {
-            if (!newPayload)
-                return;
+editingKeyDown: function(event)
+{
+var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down");
+var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown");
+if (!arrowKeyPressed && !pageKeyPressed)
+return;
 
-            self.style = WebInspector.CSSStyleDeclaration.parseStyle(newPayload);
-            self._styleRule.style = self.style;
+var selection = window.getSelection();
+if (!selection.rangeCount)
+return;
 
-            // Set the disabled property here, since the code above replies on it not changing
-            // until after the value and priority are retrieved.
-            self.disabled = disabled;
+var selectionRange = selection.getRangeAt(0);
+if (selectionRange.commonAncestorContainer !== this.listItemElement && !selectionRange.commonAncestorContainer.isDescendant(this.listItemElement))
+return;
 
-            if (self.treeOutline.section && self.treeOutline.section.pane)
-                self.treeOutline.section.pane.dispatchEventToListeners("style property toggled");
 
-            self.updateAll(true);
-        }
+var text = event.target.textContent.trim();
+var openQuote;
+var wasEscape = false;
 
-        InjectedScriptAccess.get(this.style.injectedScriptId).toggleStyleEnabled(this.style.id, this.name, disabled, callback);
-    },
+for (var i = 0; i < text.length - 1; ++i) {
+var ch = text.charAt(i);
+if (ch === "\\") {
+wasEscape = true;
+continue;
+}
+if (ch === ";" && !openQuote)
+return; 
+if ((ch === "'" || ch === "\"") && !wasEscape) {
+if (!openQuote)
+openQuote = ch;
+else if (ch === openQuote)
+openQuote = null;
+}
+wasEscape = false;
+}
 
-    updateState: function()
-    {
-        if (!this.listItemElement)
-            return;
+const styleValueDelimeters = " \t\n\"':;,/()";
+var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, styleValueDelimeters, this.listItemElement);
+var wordString = wordRange.toString();
+var replacementString = wordString;
 
-        if (this.style.isPropertyImplicit(this.name) || this.value === "initial")
-            this.listItemElement.addStyleClass("implicit");
-        else
-            this.listItemElement.removeStyleClass("implicit");
+var matches = /(.*?)(-?\d+(?:\.\d+)?)(.*)/.exec(wordString);
+if (matches && matches.length) {
+var prefix = matches[1];
+var number = parseFloat(matches[2]);
+var suffix = matches[3];
 
-        if (this.inherited)
-            this.listItemElement.addStyleClass("inherited");
-        else
-            this.listItemElement.removeStyleClass("inherited");
 
-        if (this.overloaded)
-            this.listItemElement.addStyleClass("overloaded");
-        else
-            this.listItemElement.removeStyleClass("overloaded");
+var numberNearZero = (number < 1 && number > -1);
+if (number === 1 && event.keyIdentifier === "Down")
+numberNearZero = true;
+else if (number === -1 && event.keyIdentifier === "Up")
+numberNearZero = true;
 
-        if (this.disabled)
-            this.listItemElement.addStyleClass("disabled");
-        else
-            this.listItemElement.removeStyleClass("disabled");
-    },
+if (numberNearZero && event.altKey && arrowKeyPressed) {
+if (event.keyIdentifier === "Down")
+number = Math.ceil(number - 1);
+else
+number = Math.floor(number + 1);
+} else {
 
-    onpopulate: function()
-    {
-        // Only populate once and if this property is a shorthand.
-        if (this.children.length || !this.shorthand)
-            return;
 
-        var longhandProperties = this.style.getLonghandProperties(this.name);
-        for (var i = 0; i < longhandProperties.length; ++i) {
-            var name = longhandProperties[i];
+var changeAmount = 1;
+if (event.shiftKey && pageKeyPressed)
+changeAmount = 100;
+else if (event.shiftKey || pageKeyPressed)
+changeAmount = 10;
+else if (event.altKey || numberNearZero)
+changeAmount = 0.1;
 
-            if (this.treeOutline.section) {
-                var inherited = this.treeOutline.section.isPropertyInherited(name);
-                var overloaded = this.treeOutline.section.isPropertyOverloaded(name);
-            }
+if (event.keyIdentifier === "Down" || event.keyIdentifier === "PageDown")
+changeAmount *= -1;
 
-            var item = new WebInspector.StylePropertyTreeElement(this._styleRule, this.style, name, false, inherited, overloaded);
-            this.appendChild(item);
-        }
-    },
 
-    ondblclick: function(event)
-    {
-        this.startEditing(event.target);
-        event.stopPropagation();
-    },
 
-    startEditing: function(selectElement)
-    {
-        // FIXME: we don't allow editing of longhand properties under a shorthand right now.
-        if (this.parent.shorthand)
-            return;
+number = Number((number + changeAmount).toFixed(6));
+}
 
-        if (WebInspector.isBeingEdited(this.listItemElement) || (this.treeOutline.section && !this.treeOutline.section.editable))
-            return;
+replacementString = prefix + number + suffix;
+} else if (selection.containsNode(this.nameElement, true)) {
+var prefix = selectionRange.startContainer.textContent.substring(0, selectionRange.startOffset);
+var property;
 
-        var context = { expanded: this.expanded, hasChildren: this.hasChildren };
+if (event.keyIdentifier === "Up")
+property = WebInspector.CSSCompletions.previous(wordString, prefix);
+else if (event.keyIdentifier === "Down")
+property = WebInspector.CSSCompletions.next(wordString, prefix);
 
-        // Lie about our children to prevent expanding on double click and to collapse shorthands.
-        this.hasChildren = false;
+var startOffset = selectionRange.startOffset;
+if (property) {
+this.nameElement.textContent = property;
+this.nameElement.firstChild.select(startOffset);
+}
+event.preventDefault();
+return;
+} else {
 
-        if (!selectElement)
-            selectElement = this.listItemElement;
+}
 
-        this.listItemElement.handleKeyEvent = this.editingKeyDown.bind(this);
+var replacementTextNode = document.createTextNode(replacementString);
 
-        WebInspector.startEditing(this.listItemElement, this.editingCommitted.bind(this), this.editingCancelled.bind(this), context);
-        window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1);
-    },
+wordRange.deleteContents();
+wordRange.insertNode(replacementTextNode);
 
-    editingKeyDown: function(event)
-    {
-        var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down");
-        var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown");
-        if (!arrowKeyPressed && !pageKeyPressed)
-            return;
+var finalSelectionRange = document.createRange();
+finalSelectionRange.setStart(replacementTextNode, 0);
+finalSelectionRange.setEnd(replacementTextNode, replacementString.length);
 
-        var selection = window.getSelection();
-        if (!selection.rangeCount)
-            return;
+selection.removeAllRanges();
+selection.addRange(finalSelectionRange);
 
-        var selectionRange = selection.getRangeAt(0);
-        if (selectionRange.commonAncestorContainer !== this.listItemElement && !selectionRange.commonAncestorContainer.isDescendant(this.listItemElement))
-            return;
+event.preventDefault();
 
-        const styleValueDelimeters = " \t\n\"':;,/()";
-        var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, styleValueDelimeters, this.listItemElement);
-        var wordString = wordRange.toString();
-        var replacementString = wordString;
+if (!("originalPropertyText" in this)) {
 
-        var matches = /(.*?)(-?\d+(?:\.\d+)?)(.*)/.exec(wordString);
-        if (matches && matches.length) {
-            var prefix = matches[1];
-            var number = parseFloat(matches[2]);
-            var suffix = matches[3];
 
-            // If the number is near zero or the number is one and the direction will take it near zero.
-            var numberNearZero = (number < 1 && number > -1);
-            if (number === 1 && event.keyIdentifier === "Down")
-                numberNearZero = true;
-            else if (number === -1 && event.keyIdentifier === "Up")
-                numberNearZero = true;
+this.originalPropertyText = this.property.propertyText;
+}
+this.applyStyleText(this.listItemElement.textContent);
+},
 
-            if (numberNearZero && event.altKey && arrowKeyPressed) {
-                if (event.keyIdentifier === "Down")
-                    number = Math.ceil(number - 1);
-                else
-                    number = Math.floor(number + 1);
-            } else {
-                // Jump by 10 when shift is down or jump by 0.1 when near zero or Alt/Option is down.
-                // Also jump by 10 for page up and down, or by 100 if shift is held with a page key.
-                var changeAmount = 1;
-                if (event.shiftKey && pageKeyPressed)
-                    changeAmount = 100;
-                else if (event.shiftKey || pageKeyPressed)
-                    changeAmount = 10;
-                else if (event.altKey || numberNearZero)
-                    changeAmount = 0.1;
+editingEnded: function(context)
+{
+this.hasChildren = context.hasChildren;
+if (context.expanded)
+this.expand();
+this.listItemElement.removeEventListener("keydown", context.keyDownListener, false);
+this.listItemElement.removeEventListener("keypress", context.keyPressListener, false);
+delete this.originalPropertyText;
+},
 
-                if (event.keyIdentifier === "Down" || event.keyIdentifier === "PageDown")
-                    changeAmount *= -1;
+editingCancelled: function(element, context)
+{
+if ("originalPropertyText" in this)
+this.applyStyleText(this.originalPropertyText, true);
+else {
+if (this._newProperty)
+this.treeOutline.removeChild(this);
+else
+this.updateTitle();
+}
+this.editingEnded(context);
+},
 
-                // Make the new number and constrain it to a precision of 6, this matches numbers the engine returns.
-                // Use the Number constructor to forget the fixed precision, so 1.100000 will print as 1.1.
-                number = Number((number + changeAmount).toFixed(6));
-            }
+editingCommitted: function(element, userInput, previousContent, context, moveDirection)
+{
+this.editingEnded(context);
 
-            replacementString = prefix + number + suffix;
-        } else {
-            // FIXME: this should cycle through known keywords for the current property name.
-            return;
-        }
 
-        var replacementTextNode = document.createTextNode(replacementString);
+var newProperty, moveToPropertyName, moveToSelector;
+var moveTo = this;
+do {
+moveTo = (moveDirection === "forward" ? moveTo.nextSibling : moveTo.previousSibling);
+} while(moveTo && !moveTo.selectable);
 
-        wordRange.deleteContents();
-        wordRange.insertNode(replacementTextNode);
+if (moveTo)
+moveToPropertyName = moveTo.name;
+else if (moveDirection === "forward")
+newProperty = true;
+else if (moveDirection === "backward" && this.treeOutline.section.rule)
+moveToSelector = true;
 
-        var finalSelectionRange = document.createRange();
-        finalSelectionRange.setStart(replacementTextNode, 0);
-        finalSelectionRange.setEnd(replacementTextNode, replacementString.length);
 
-        selection.removeAllRanges();
-        selection.addRange(finalSelectionRange);
+var blankInput = /^\s*$/.test(userInput);
+if (userInput !== previousContent || (this._newProperty && blankInput)) { 
+this.treeOutline.section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !blankInput);
+this.applyStyleText(userInput, true);
+} else
+moveToNextCallback(this._newProperty, false, this.treeOutline.section, false);
 
-        event.preventDefault();
-        event.handled = true;
 
-        if (!this.originalCSSText) {
-            // Remember the rule's original CSS text, so it can be restored
-            // if the editing is canceled and before each apply.
-            this.originalCSSText = this.style.styleTextWithShorthands();
-        } else {
-            // Restore the original CSS text before applying user changes. This is needed to prevent
-            // new properties from sticking around if the user adds one, then removes it.
-            InjectedScriptAccess.get(this.style.injectedScriptId).setStyleText(this.style.id, this.originalCSSText);
-        }
+function moveToNextCallback(alreadyNew, valueChanged, section)
+{
+if (!moveDirection)
+return;
 
-        this.applyStyleText(this.listItemElement.textContent);
-    },
 
-    editingEnded: function(context)
-    {
-        this.hasChildren = context.hasChildren;
-        if (context.expanded)
-            this.expand();
-        delete this.listItemElement.handleKeyEvent;
-        delete this.originalCSSText;
-    },
+if (moveTo && moveTo.parent) {
+moveTo.startEditing(moveTo.valueElement);
+return;
+}
 
-    editingCancelled: function(element, context)
-    {
-        if (this._newProperty)
-            this.treeOutline.removeChild(this);
-        else if (this.originalCSSText) {
-            InjectedScriptAccess.get(this.style.injectedScriptId).setStyleText(this.style.id, this.originalCSSText);
 
-            if (this.treeOutline.section && this.treeOutline.section.pane)
-                this.treeOutline.section.pane.dispatchEventToListeners("style edited");
 
-            this.updateAll();
-        } else
-            this.updateTitle();
 
-        this.editingEnded(context);
-    },
 
-    editingCommitted: function(element, userInput, previousContent, context, moveDirection)
-    {
-        this.editingEnded(context);
+if (moveTo && !moveTo.parent) {
+var treeElement = section.findTreeElementWithName(moveToPropertyName);
+if (treeElement)
+treeElement.startEditing(treeElement.valueElement);
+return;
+}
 
-        // Determine where to move to before making changes
-        var newProperty, moveToPropertyName, moveToSelector;
-        var moveTo = (moveDirection === "forward" ? this.nextSibling : this.previousSibling);
-        if (moveTo)
-            moveToPropertyName = moveTo.name;
-        else if (moveDirection === "forward")
-            newProperty = true;
-        else if (moveDirection === "backward" && this.treeOutline.section.rule)
-            moveToSelector = true;
 
-        // Make the Changes and trigger the moveToNextCallback after updating
-        var blankInput = /^\s*$/.test(userInput);
-        if (userInput !== previousContent || (this._newProperty && blankInput)) { // only if something changed, or adding a new style and it was blank
-            this.treeOutline.section._afterUpdate = moveToNextCallback.bind(this, this._newProperty, !blankInput);
-            this.applyStyleText(userInput, true);
-        } else
-            moveToNextCallback(this._newProperty, false, this.treeOutline.section, false);
+if (newProperty) {
+if (alreadyNew && !valueChanged)
+return;
 
-        // The Callback to start editing the next property
-        function moveToNextCallback(alreadyNew, valueChanged, section)
-        {
-            if (!moveDirection)
-                return;
+section.addNewBlankProperty().startEditing();
+return;
+}
 
-            // User just tabbed through without changes
-            if (moveTo && moveTo.parent) {
-                moveTo.startEditing(moveTo.valueElement);
-                return;
-            }
+if (moveToSelector)
+section.startEditingSelector();
+}
+},
 
-            // User has made a change then tabbed, wiping all the original treeElements,
-            // recalculate the new treeElement for the same property we were going to edit next
-            if (moveTo && !moveTo.parent) {
-                var treeElement = section.findTreeElementWithName(moveToPropertyName);
-                if (treeElement)
-                    treeElement.startEditing(treeElement.valueElement);
-                return;
-            }
+applyStyleText: function(styleText, updateInterface)
+{
+var section = this.treeOutline.section;
+var elementsPanel = WebInspector.panels.elements;
+styleText = styleText.replace(/\s/g, " ").trim(); 
+var styleTextLength = styleText.length;
+if (!styleTextLength && updateInterface) {
+if (this._newProperty) {
 
-            // Create a new attribute in this section
-            if (newProperty) {
-                if (alreadyNew && !valueChanged)
-                    return;
+this.parent.removeChild(this);
+section.afterUpdate();
+return;
+} else
+delete section._afterUpdate;
+}
 
-                section.addNewBlankProperty().startEditing();
-                return;
-            }
+function callback(newStyle)
+{
+if (!newStyle) {
 
-            if (moveToSelector)
-                section.startEditingSelector();
-        }
-    },
 
-    applyStyleText: function(styleText, updateInterface)
-    {
-        var section = this.treeOutline.section;
-        var elementsPanel = WebInspector.panels.elements;
-        var styleTextLength = styleText.trim().length;
-        if (!styleTextLength && updateInterface) {
-            if (this._newProperty) {
-                // The user deleted everything, so remove the tree element and update.
-                this.parent.removeChild(this);
-                section.afterUpdate();
-                return;
-            } else {
-                delete section._afterUpdate;
-            }
-        }
 
-        var self = this;
-        function callback(result)
-        {
-            if (!result) {
-                // The user typed something, but it didn't parse. Just abort and restore
-                // the original title for this property.  If this was a new attribute and
-                // we couldn't parse, then just remove it.
-                if (self._newProperty) {
-                    self.parent.removeChild(self);
-                    return;
-                }
-                if (updateInterface)
-                    self.updateTitle();
-                return;
-            }
+if (this._newProperty) {
+this.parent.removeChild(this);
+return;
+}
+if (updateInterface)
+this.updateTitle();
+return;
+}
 
-            var newPayload = result[0];
-            var changedProperties = result[1];
-            elementsPanel.removeStyleChange(section.identifier, self.style, self.name);
+this.style = newStyle;
+this.property = newStyle.propertyAt(this.property.index);
+this._styleRule.style = this.style;
 
-            if (!styleTextLength) {
-                // Do remove ourselves from UI when the property removal is confirmed.
-                self.parent.removeChild(self);
-            } else {
-                self.style = WebInspector.CSSStyleDeclaration.parseStyle(newPayload);
-                for (var i = 0; i < changedProperties.length; ++i)
-                    elementsPanel.addStyleChange(section.identifier, self.style, changedProperties[i]);
-                self._styleRule.style = self.style;
-            }
+if (section && section.pane)
+section.pane.dispatchEventToListeners("style edited");
 
-            if (section && section.pane)
-                section.pane.dispatchEventToListeners("style edited");
+if (updateInterface)
+this.updateAll(true);
+}
 
-            if (updateInterface)
-                self.updateAll(true);
 
-            if (!section.rule)
-                WebInspector.panels.elements.treeOutline.update();
-        }
 
-        InjectedScriptAccess.get(this.style.injectedScriptId).applyStyleText(this.style.id, styleText.trim(), this.name, callback);
-    }
+if (styleText.length && !/;\s*$/.test(styleText))
+styleText += ";";
+this.property.setText(styleText, updateInterface, callback.bind(this));
+}
 }
 
 WebInspector.StylePropertyTreeElement.prototype.__proto__ = TreeElement.prototype;
 
-/* PanelEnablerView.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.PanelEnablerView = function(identifier, headingText, disclaimerText, buttonTitle)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.element.addStyleClass("panel-enabler-view");
-    this.element.addStyleClass(identifier);
+this.element.addStyleClass("panel-enabler-view");
+this.element.addStyleClass(identifier);
 
-    this.contentElement = document.createElement("div");
-    this.contentElement.className = "panel-enabler-view-content";
-    this.element.appendChild(this.contentElement);
+this.contentElement = document.createElement("div");
+this.contentElement.className = "panel-enabler-view-content";
+this.element.appendChild(this.contentElement);
 
-    this.imageElement = document.createElement("img");
-    this.contentElement.appendChild(this.imageElement);
+this.imageElement = document.createElement("img");
+this.contentElement.appendChild(this.imageElement);
 
-    this.choicesForm = document.createElement("form");
-    this.contentElement.appendChild(this.choicesForm);
+this.choicesForm = document.createElement("form");
+this.contentElement.appendChild(this.choicesForm);
 
-    this.headerElement = document.createElement("h1");
-    this.headerElement.textContent = headingText;
-    this.choicesForm.appendChild(this.headerElement);
+this.headerElement = document.createElement("h1");
+this.headerElement.textContent = headingText;
+this.choicesForm.appendChild(this.headerElement);
 
-    var self = this;
-    function enableOption(text, checked) {
-        var label = document.createElement("label");
-        var option = document.createElement("input");
-        option.type = "radio";
-        option.name = "enable-option";
-        if (checked)
-            option.checked = true;
-        label.appendChild(option);
-        label.appendChild(document.createTextNode(text));
-        self.choicesForm.appendChild(label);
-        return option;
-    };
+var self = this;
+function enableOption(text, checked) {
+var label = document.createElement("label");
+var option = document.createElement("input");
+option.type = "radio";
+option.name = "enable-option";
+if (checked)
+option.checked = true;
+label.appendChild(option);
+label.appendChild(document.createTextNode(text));
+self.choicesForm.appendChild(label);
+return option;
+};
 
-    this.enabledForSession = enableOption(WebInspector.UIString("Only enable for this session"), true);
-    this.enabledAlways = enableOption(WebInspector.UIString("Always enable"));
+this.enabledForSession = enableOption(WebInspector.UIString("Only enable for this session"), true);
+this.enabledAlways = enableOption(WebInspector.UIString("Always enable"));
 
-    this.disclaimerElement = document.createElement("div");
-    this.disclaimerElement.className = "panel-enabler-disclaimer";
-    this.disclaimerElement.textContent = disclaimerText;
-    this.choicesForm.appendChild(this.disclaimerElement);
+this.disclaimerElement = document.createElement("div");
+this.disclaimerElement.className = "panel-enabler-disclaimer";
+this.disclaimerElement.textContent = disclaimerText;
+this.choicesForm.appendChild(this.disclaimerElement);
 
-    this.enableButton = document.createElement("button");
-    this.enableButton.setAttribute("type", "button");
-    this.enableButton.textContent = buttonTitle;
-    this.enableButton.addEventListener("click", this._enableButtonCicked.bind(this), false);
-    this.choicesForm.appendChild(this.enableButton);
+this.enableButton = document.createElement("button");
+this.enableButton.setAttribute("type", "button");
+this.enableButton.textContent = buttonTitle;
+this.enableButton.addEventListener("click", this._enableButtonCicked.bind(this), false);
+this.choicesForm.appendChild(this.enableButton);
 }
 
 WebInspector.PanelEnablerView.prototype = {
-    _enableButtonCicked: function()
-    {
-        this.dispatchEventToListeners("enable clicked");
-    },
+_enableButtonCicked: function()
+{
+this.dispatchEventToListeners("enable clicked");
+},
 
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
 
-        setTimeout(this.resize.bind(this), 0);
-    },
+setTimeout(this.resize.bind(this), 0);
+},
 
-    resize: function()
-    {
-        this.imageElement.removeStyleClass("hidden");
+resize: function()
+{
+this.imageElement.removeStyleClass("hidden");
 
-        if (this.element.offsetWidth < (this.choicesForm.offsetWidth + this.imageElement.offsetWidth))
-            this.imageElement.addStyleClass("hidden");
-    },
+if (this.element.offsetWidth < (this.choicesForm.offsetWidth + this.imageElement.offsetWidth))
+this.imageElement.addStyleClass("hidden");
+},
 
-    get alwaysEnabled() {
-        return this.enabledAlways.checked;
-    }
+get alwaysEnabled() {
+return this.enabledAlways.checked;
+}
 }
 
 WebInspector.PanelEnablerView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* WelcomeView.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.WelcomeView = function(identifier, headingText, instructionsText)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.element.addStyleClass("panel-enabler-view");
-    this.element.addStyleClass(identifier);
-    this.element.addStyleClass("welcome");
+this.element.addStyleClass("panel-enabler-view");
+this.element.addStyleClass(identifier);
+this.element.addStyleClass("welcome");
 
-    this.contentElement = document.createElement("div");
-    this.contentElement.className = "panel-enabler-view-content";
-    this.element.appendChild(this.contentElement);
+this.contentElement = document.createElement("div");
+this.contentElement.className = "panel-enabler-view-content";
+this.element.appendChild(this.contentElement);
 
-    this.alignerElement = document.createElement("div");
-    this.alignerElement.className = "welcome-instructions-aligner";
-    this.contentElement.appendChild(this.alignerElement);
+this.alignerElement = document.createElement("div");
+this.alignerElement.className = "welcome-instructions-aligner";
+this.contentElement.appendChild(this.alignerElement);
 
-    this.instructionsElement = document.createElement("div");
-    this.instructionsElement.className = "instructions";
-    this.contentElement.appendChild(this.instructionsElement);
+this.instructionsElement = document.createElement("div");
+this.instructionsElement.className = "instructions";
+this.contentElement.appendChild(this.instructionsElement);
 
-    this.headerElement = document.createElement("h1");
-    this.headerElement.textContent = headingText;
-    this.instructionsElement.appendChild(this.headerElement);
+this.headerElement = document.createElement("h1");
+this.headerElement.textContent = headingText;
+this.instructionsElement.appendChild(this.headerElement);
 
-    if (instructionsText)
-        this.addMessage(instructionsText);
+if (instructionsText)
+this.addMessage(instructionsText);
 }
 
 WebInspector.WelcomeView.prototype = {
-    addMessage: function(message)
-    {
-        var messageElement = document.createElement("div");
-        messageElement.className = "message";
-        if (typeof message == "string")
-            // Message text can contain <br> tags for better text balancing, so we
-            // put it into elements using 'innerHTML', not 'textContent'.
-            messageElement.innerHTML = message;
-        else
-            messageElement.appendChild(message);
-        this.instructionsElement.appendChild(messageElement);
-    }
+addMessage: function(message)
+{
+var messageElement = document.createElement("div");
+messageElement.className = "message";
+if (typeof message == "string")
+
+
+messageElement.innerHTML = message;
+else
+messageElement.appendChild(message);
+this.instructionsElement.appendChild(messageElement);
+}
 }
 
 WebInspector.WelcomeView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* StatusBarButton.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.StatusBarButton = function(title, className, states)
 {
-    this.element = document.createElement("button");
-    this.element.className = className + " status-bar-item";
-    this.element.addEventListener("click", this._clicked.bind(this), false);
+this.element = document.createElement("button");
+this.element.className = className + " status-bar-item";
+this.element.addEventListener("click", this._clicked.bind(this), false);
 
-    this.glyph = document.createElement("div");
-    this.glyph.className = "glyph";
-    this.element.appendChild(this.glyph);
+this.glyph = document.createElement("div");
+this.glyph.className = "glyph";
+this.element.appendChild(this.glyph);
 
-    this.glyphShadow = document.createElement("div");
-    this.glyphShadow.className = "glyph shadow";
-    this.element.appendChild(this.glyphShadow);
-    
-    this.states = states;
-    if (!states)
-        this.states = 2;
+this.glyphShadow = document.createElement("div");
+this.glyphShadow.className = "glyph shadow";
+this.element.appendChild(this.glyphShadow);
 
-    if (states == 2)
-        this._state = false;
-    else
-        this._state = 0;
-    
-    this.title = title;
-    this.disabled = false;
-    this._visible = true;
+this.states = states;
+if (!states)
+this.states = 2;
+
+if (states == 2)
+this._state = false;
+else
+this._state = 0;
+
+this.title = title;
+this.disabled = false;
+this._visible = true;
 }
 
 WebInspector.StatusBarButton.prototype = {
-    _clicked: function()
-    {
-        this.dispatchEventToListeners("click");
-    },
+_clicked: function()
+{
+this.dispatchEventToListeners("click");
+},
 
-    get disabled()
-    {
-        return this._disabled;
-    },
+get disabled()
+{
+return this._disabled;
+},
 
-    set disabled(x)
-    {
-        if (this._disabled === x)
-            return;
-        this._disabled = x;
-        this.element.disabled = x;
-    },
+set disabled(x)
+{
+if (this._disabled === x)
+return;
+this._disabled = x;
+this.element.disabled = x;
+},
 
-    get title()
-    {
-        return this._title;
-    },
+get title()
+{
+return this._title;
+},
 
-    set title(x)
-    {
-        if (this._title === x)
-            return;
-        this._title = x;
-        this.element.title = x;
-    },
-    
-    get state()
-    {
-        return this._state;
-    },
-    
-    set state(x)
-    {
-        if (this._state === x)
-            return;
-        
-        if (this.states === 2) {
-            if (x)
-                this.element.addStyleClass("toggled-on");
-            else
-                this.element.removeStyleClass("toggled-on");
-        } else {
-            if (x !== 0) {
-                this.element.removeStyleClass("toggled-" + this._state);
-                this.element.addStyleClass("toggled-" + x);
-            } else 
-                this.element.removeStyleClass("toggled-" + this._state);
-        }
-        this._state = x;
-    },
+set title(x)
+{
+if (this._title === x)
+return;
+this._title = x;
+this.element.title = x;
+},
 
-    get toggled()
-    {
-        if (this.states !== 2)
-            throw("Only used toggled when there are 2 states, otherwise, use state");
-        return this.state;
-    },
+get state()
+{
+return this._state;
+},
 
-    set toggled(x)
-    {
-        if (this.states !== 2)
-            throw("Only used toggled when there are 2 states, otherwise, use state");
-        this.state = x;
-    },
+set state(x)
+{
+if (this._state === x)
+return;
 
-    get visible()
-    {
-        return this._visible;
-    },
+if (this.states === 2) {
+if (x)
+this.element.addStyleClass("toggled-on");
+else
+this.element.removeStyleClass("toggled-on");
+} else {
+if (x !== 0) {
+this.element.removeStyleClass("toggled-" + this._state);
+this.element.addStyleClass("toggled-" + x);
+} else 
+this.element.removeStyleClass("toggled-" + this._state);
+}
+this._state = x;
+},
 
-    set visible(x)
-    {
-        if (this._visible === x)
-            return;
+get toggled()
+{
+if (this.states !== 2)
+throw("Only used toggled when there are 2 states, otherwise, use state");
+return this.state;
+},
 
-        if (x)
-            this.element.removeStyleClass("hidden");
-        else
-            this.element.addStyleClass("hidden");
-        this._visible = x;
-    }
+set toggled(x)
+{
+if (this.states !== 2)
+throw("Only used toggled when there are 2 states, otherwise, use state");
+this.state = x;
+},
+
+get visible()
+{
+return this._visible;
+},
+
+set visible(x)
+{
+if (this._visible === x)
+return;
+
+if (x)
+this.element.removeStyleClass("hidden");
+else
+this.element.addStyleClass("hidden");
+this._visible = x;
+}
 }
 
 WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* SummaryBar.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.SummaryBar = function(categories)
 {
-    this.categories = categories;
+this.categories = categories;
 
-    this.element = document.createElement("div");
-    this.element.className = "summary-bar";
+this.element = document.createElement("div");
+this.element.className = "summary-bar";
 
-    this.graphElement = document.createElement("canvas");
-    this.graphElement.setAttribute("width", "450");
-    this.graphElement.setAttribute("height", "38");
-    this.graphElement.className = "summary-graph";
-    this.element.appendChild(this.graphElement);
+this.graphElement = document.createElement("canvas");
+this.graphElement.setAttribute("width", "450");
+this.graphElement.setAttribute("height", "38");
+this.graphElement.className = "summary-graph";
+this.element.appendChild(this.graphElement);
 
-    this.legendElement = document.createElement("div");
-    this.legendElement.className = "summary-graph-legend";
-    this.element.appendChild(this.legendElement);
+this.legendElement = document.createElement("div");
+this.legendElement.className = "summary-graph-legend";
+this.element.appendChild(this.legendElement);
 }
 
 WebInspector.SummaryBar.prototype = {
 
-    get calculator() {
-        return this._calculator;
-    },
+get calculator() {
+return this._calculator;
+},
 
-    set calculator(x) {
-        this._calculator = x;
-    },
+set calculator(x) {
+this._calculator = x;
+},
 
-    reset: function()
-    {
-        this.legendElement.removeChildren();
-        this._drawSummaryGraph();
-    },
+reset: function()
+{
+this.legendElement.removeChildren();
+this._drawSummaryGraph();
+},
 
-    update: function(data)
-    {
-        var graphInfo = this.calculator.computeSummaryValues(data);
+update: function(data)
+{
+var graphInfo = this.calculator.computeSummaryValues(data);
 
-        var fillSegments = [];
+var fillSegments = [];
 
-        this.legendElement.removeChildren();
+this.legendElement.removeChildren();
 
-        for (var category in this.categories) {
-            var size = graphInfo.categoryValues[category];
-            if (!size)
-                continue;
+for (var category in this.categories) {
+var size = graphInfo.categoryValues[category];
+if (!size)
+continue;
 
-            var colorString = this.categories[category].color;
+var colorString = this.categories[category].color;
 
-            var fillSegment = {color: colorString, value: size};
-            fillSegments.push(fillSegment);
+var fillSegment = {color: colorString, value: size};
+fillSegments.push(fillSegment);
 
-            var legendLabel = this._makeLegendElement(this.categories[category].title, this.calculator.formatValue(size), colorString);
-            this.legendElement.appendChild(legendLabel);
-        }
+var legendLabel = this._makeLegendElement(this.categories[category].title, this.calculator.formatValue(size), colorString);
+this.legendElement.appendChild(legendLabel);
+}
 
-        if (graphInfo.total) {
-            var totalLegendLabel = this._makeLegendElement(WebInspector.UIString("Total"), this.calculator.formatValue(graphInfo.total));
-            totalLegendLabel.addStyleClass("total");
-            this.legendElement.appendChild(totalLegendLabel);
-        }
+if (graphInfo.total) {
+var totalLegendLabel = this._makeLegendElement(WebInspector.UIString("Total"), this.calculator.formatValue(graphInfo.total));
+totalLegendLabel.addStyleClass("total");
+this.legendElement.appendChild(totalLegendLabel);
+}
 
-        this._drawSummaryGraph(fillSegments);
-    },
+this._drawSummaryGraph(fillSegments);
+},
 
-    _drawSwatch: function(canvas, color)
-    {
-        var ctx = canvas.getContext("2d");
+_drawSwatch: function(canvas, color)
+{
+var ctx = canvas.getContext("2d");
 
-        function drawSwatchSquare() {
-            ctx.fillStyle = color;
-            ctx.fillRect(0, 0, 13, 13);
+function drawSwatchSquare() {
+ctx.fillStyle = color;
+ctx.fillRect(0, 0, 13, 13);
 
-            var gradient = ctx.createLinearGradient(0, 0, 13, 13);
-            gradient.addColorStop(0.0, "rgba(255, 255, 255, 0.2)");
-            gradient.addColorStop(1.0, "rgba(255, 255, 255, 0.0)");
+var gradient = ctx.createLinearGradient(0, 0, 13, 13);
+gradient.addColorStop(0.0, "rgba(255, 255, 255, 0.2)");
+gradient.addColorStop(1.0, "rgba(255, 255, 255, 0.0)");
 
-            ctx.fillStyle = gradient;
-            ctx.fillRect(0, 0, 13, 13);
+ctx.fillStyle = gradient;
+ctx.fillRect(0, 0, 13, 13);
 
-            gradient = ctx.createLinearGradient(13, 13, 0, 0);
-            gradient.addColorStop(0.0, "rgba(0, 0, 0, 0.2)");
-            gradient.addColorStop(1.0, "rgba(0, 0, 0, 0.0)");
+gradient = ctx.createLinearGradient(13, 13, 0, 0);
+gradient.addColorStop(0.0, "rgba(0, 0, 0, 0.2)");
+gradient.addColorStop(1.0, "rgba(0, 0, 0, 0.0)");
 
-            ctx.fillStyle = gradient;
-            ctx.fillRect(0, 0, 13, 13);
+ctx.fillStyle = gradient;
+ctx.fillRect(0, 0, 13, 13);
 
-            ctx.strokeStyle = "rgba(0, 0, 0, 0.6)";
-            ctx.strokeRect(0.5, 0.5, 12, 12);
-        }
+ctx.strokeStyle = "rgba(0, 0, 0, 0.6)";
+ctx.strokeRect(0.5, 0.5, 12, 12);
+}
 
-        ctx.clearRect(0, 0, 13, 24);
+ctx.clearRect(0, 0, 13, 24);
 
-        drawSwatchSquare();
+drawSwatchSquare();
 
-        ctx.save();
+ctx.save();
 
-        ctx.translate(0, 25);
-        ctx.scale(1, -1);
+ctx.translate(0, 25);
+ctx.scale(1, -1);
 
-        drawSwatchSquare();
+drawSwatchSquare();
 
-        ctx.restore();
+ctx.restore();
 
-        this._fadeOutRect(ctx, 0, 13, 13, 13, 0.5, 0.0);
-    },
+this._fadeOutRect(ctx, 0, 13, 13, 13, 0.5, 0.0);
+},
 
-    _drawSummaryGraph: function(segments)
-    {
-        if (!segments || !segments.length) {
-            segments = [{color: "white", value: 1}];
-            this._showingEmptySummaryGraph = true;
-        } else
-            delete this._showingEmptySummaryGraph;
+_drawSummaryGraph: function(segments)
+{
+if (!segments || !segments.length) {
+segments = [{color: "white", value: 1}];
+this._showingEmptySummaryGraph = true;
+} else
+delete this._showingEmptySummaryGraph;
 
-        // Calculate the total of all segments.
-        var total = 0;
-        for (var i = 0; i < segments.length; ++i)
-            total += segments[i].value;
 
-        // Calculate the percentage of each segment, rounded to the nearest percent.
-        var percents = segments.map(function(s) { return Math.max(Math.round(100 * s.value / total), 1) });
+var total = 0;
+for (var i = 0; i < segments.length; ++i)
+total += segments[i].value;
 
-        // Calculate the total percentage.
-        var percentTotal = 0;
-        for (var i = 0; i < percents.length; ++i)
-            percentTotal += percents[i];
 
-        // Make sure our percentage total is not greater-than 100, it can be greater
-        // if we rounded up for a few segments.
-        while (percentTotal > 100) {
-            for (var i = 0; i < percents.length && percentTotal > 100; ++i) {
-                if (percents[i] > 1) {
-                    --percents[i];
-                    --percentTotal;
-                }
-            }
-        }
+var percents = segments.map(function(s) { return Math.max(Math.round(100 * s.value / total), 1) });
 
-        // Make sure our percentage total is not less-than 100, it can be less
-        // if we rounded down for a few segments.
-        while (percentTotal < 100) {
-            for (var i = 0; i < percents.length && percentTotal < 100; ++i) {
-                ++percents[i];
-                ++percentTotal;
-            }
-        }
 
-        var ctx = this.graphElement.getContext("2d");
+var percentTotal = 0;
+for (var i = 0; i < percents.length; ++i)
+percentTotal += percents[i];
 
-        var x = 0;
-        var y = 0;
-        var w = 450;
-        var h = 19;
-        var r = (h / 2);
 
-        function drawPillShadow()
-        {
-            // This draws a line with a shadow that is offset away from the line. The line is stroked
-            // twice with different X shadow offsets to give more feathered edges. Later we erase the
-            // line with destination-out 100% transparent black, leaving only the shadow. This only
-            // works if nothing has been drawn into the canvas yet.
 
-            ctx.beginPath();
-            ctx.moveTo(x + 4, y + h - 3 - 0.5);
-            ctx.lineTo(x + w - 4, y + h - 3 - 0.5);
-            ctx.closePath();
+while (percentTotal > 100) {
+for (var i = 0; i < percents.length && percentTotal > 100; ++i) {
+if (percents[i] > 1) {
+--percents[i];
+--percentTotal;
+}
+}
+}
+
+
+
+while (percentTotal < 100) {
+for (var i = 0; i < percents.length && percentTotal < 100; ++i) {
+++percents[i];
+++percentTotal;
+}
+}
+
+var ctx = this.graphElement.getContext("2d");
+
+var x = 0;
+var y = 0;
+var w = 450;
+var h = 19;
+var r = (h / 2);
+
+function drawPillShadow()
+{
+
+
+
+
+
+ctx.beginPath();
+ctx.moveTo(x + 4, y + h - 3 - 0.5);
+ctx.lineTo(x + w - 4, y + h - 3 - 0.5);
+ctx.closePath();
+
+ctx.save();
+
+ctx.shadowBlur = 2;
+ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
+ctx.shadowOffsetX = 3;
+ctx.shadowOffsetY = 5;
+
+ctx.strokeStyle = "white";
+ctx.lineWidth = 1;
+
+ctx.stroke();
+
+ctx.shadowOffsetX = -3;
 
-            ctx.save();
+ctx.stroke();
 
-            ctx.shadowBlur = 2;
-            ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
-            ctx.shadowOffsetX = 3;
-            ctx.shadowOffsetY = 5;
+ctx.restore();
 
-            ctx.strokeStyle = "white";
-            ctx.lineWidth = 1;
+ctx.save();
 
-            ctx.stroke();
+ctx.globalCompositeOperation = "destination-out";
+ctx.strokeStyle = "rgba(0, 0, 0, 1)";
+ctx.lineWidth = 1;
 
-            ctx.shadowOffsetX = -3;
+ctx.stroke();
 
-            ctx.stroke();
+ctx.restore();
+}
 
-            ctx.restore();
+function drawPill()
+{
 
-            ctx.save();
+ctx.beginPath();
+ctx.moveTo(x, y + r);
+ctx.lineTo(x, y + h - r);
+ctx.arc(x + r, y + h - r, r, Math.PI, Math.PI / 2, true);
+ctx.lineTo(x + w - r, y + h);
+ctx.arc(x + w - r, y + h - r, r, Math.PI / 2, 0, true);
+ctx.lineTo(x + w, y + r);
+ctx.arc(x + w - r, y + r, r, 0, 3 * Math.PI / 2, true);
+ctx.lineTo(x + r, y);
+ctx.arc(x + r, y + r, r, Math.PI / 2, Math.PI, true);
+ctx.closePath();
 
-            ctx.globalCompositeOperation = "destination-out";
-            ctx.strokeStyle = "rgba(0, 0, 0, 1)";
-            ctx.lineWidth = 1;
 
-            ctx.stroke();
+ctx.save();
+ctx.clip();
 
-            ctx.restore();
-        }
 
-        function drawPill()
-        {
-            // Make a rounded rect path.
-            ctx.beginPath();
-            ctx.moveTo(x, y + r);
-            ctx.lineTo(x, y + h - r);
-            ctx.quadraticCurveTo(x, y + h, x + r, y + h);
-            ctx.lineTo(x + w - r, y + h);
-            ctx.quadraticCurveTo(x + w, y + h, x + w, y + h - r);
-            ctx.lineTo(x + w, y + r);
-            ctx.quadraticCurveTo(x + w, y, x + w - r, y);
-            ctx.lineTo(x + r, y);
-            ctx.quadraticCurveTo(x, y, x, y + r);
-            ctx.closePath();
+var previousSegmentsWidth = 0;
+for (var i = 0; i < segments.length; ++i) {
+var segmentWidth = Math.round(w * percents[i] / 100);
+ctx.fillStyle = segments[i].color;
+ctx.fillRect(x + previousSegmentsWidth, y, segmentWidth, h);
+previousSegmentsWidth += segmentWidth;
+}
 
-            // Clip to the rounded rect path.
-            ctx.save();
-            ctx.clip();
 
-            // Fill the segments with the associated color.
-            var previousSegmentsWidth = 0;
-            for (var i = 0; i < segments.length; ++i) {
-                var segmentWidth = Math.round(w * percents[i] / 100);
-                ctx.fillStyle = segments[i].color;
-                ctx.fillRect(x + previousSegmentsWidth, y, segmentWidth, h);
-                previousSegmentsWidth += segmentWidth;
-            }
+ctx.lineWidth = 1;
+for (var i = 1; i < 20; ++i) {
+ctx.beginPath();
+ctx.moveTo(x + (i * Math.round(w / 20)) + 0.5, y);
+ctx.lineTo(x + (i * Math.round(w / 20)) + 0.5, y + h);
+ctx.closePath();
 
-            // Draw the segment divider lines.
-            ctx.lineWidth = 1;
-            for (var i = 1; i < 20; ++i) {
-                ctx.beginPath();
-                ctx.moveTo(x + (i * Math.round(w / 20)) + 0.5, y);
-                ctx.lineTo(x + (i * Math.round(w / 20)) + 0.5, y + h);
-                ctx.closePath();
+ctx.strokeStyle = "rgba(0, 0, 0, 0.2)";
+ctx.stroke();
 
-                ctx.strokeStyle = "rgba(0, 0, 0, 0.2)";
-                ctx.stroke();
+ctx.beginPath();
+ctx.moveTo(x + (i * Math.round(w / 20)) + 1.5, y);
+ctx.lineTo(x + (i * Math.round(w / 20)) + 1.5, y + h);
+ctx.closePath();
 
-                ctx.beginPath();
-                ctx.moveTo(x + (i * Math.round(w / 20)) + 1.5, y);
-                ctx.lineTo(x + (i * Math.round(w / 20)) + 1.5, y + h);
-                ctx.closePath();
+ctx.strokeStyle = "rgba(255, 255, 255, 0.2)";
+ctx.stroke();
+}
 
-                ctx.strokeStyle = "rgba(255, 255, 255, 0.2)";
-                ctx.stroke();
-            }
 
-            // Draw the pill shading.
-            var lightGradient = ctx.createLinearGradient(x, y, x, y + (h / 1.5));
-            lightGradient.addColorStop(0.0, "rgba(220, 220, 220, 0.6)");
-            lightGradient.addColorStop(0.4, "rgba(220, 220, 220, 0.2)");
-            lightGradient.addColorStop(1.0, "rgba(255, 255, 255, 0.0)");
+var lightGradient = ctx.createLinearGradient(x, y, x, y + (h / 1.5));
+lightGradient.addColorStop(0.0, "rgba(220, 220, 220, 0.6)");
+lightGradient.addColorStop(0.4, "rgba(220, 220, 220, 0.2)");
+lightGradient.addColorStop(1.0, "rgba(255, 255, 255, 0.0)");
 
-            var darkGradient = ctx.createLinearGradient(x, y + (h / 3), x, y + h);
-            darkGradient.addColorStop(0.0, "rgba(0, 0, 0, 0.0)");
-            darkGradient.addColorStop(0.8, "rgba(0, 0, 0, 0.2)");
-            darkGradient.addColorStop(1.0, "rgba(0, 0, 0, 0.5)");
+var darkGradient = ctx.createLinearGradient(x, y + (h / 3), x, y + h);
+darkGradient.addColorStop(0.0, "rgba(0, 0, 0, 0.0)");
+darkGradient.addColorStop(0.8, "rgba(0, 0, 0, 0.2)");
+darkGradient.addColorStop(1.0, "rgba(0, 0, 0, 0.5)");
 
-            ctx.fillStyle = darkGradient;
-            ctx.fillRect(x, y, w, h);
+ctx.fillStyle = darkGradient;
+ctx.fillRect(x, y, w, h);
 
-            ctx.fillStyle = lightGradient;
-            ctx.fillRect(x, y, w, h);
+ctx.fillStyle = lightGradient;
+ctx.fillRect(x, y, w, h);
 
-            ctx.restore();
-        }
+ctx.restore();
+}
 
-        ctx.clearRect(x, y, w, (h * 2));
+ctx.clearRect(x, y, w, (h * 2));
 
-        drawPillShadow();
-        drawPill();
+drawPillShadow();
+drawPill();
 
-        ctx.save();
+ctx.save();
 
-        ctx.translate(0, (h * 2) + 1);
-        ctx.scale(1, -1);
+ctx.translate(0, (h * 2) + 1);
+ctx.scale(1, -1);
 
-        drawPill();
+drawPill();
 
-        ctx.restore();
+ctx.restore();
 
-        this._fadeOutRect(ctx, x, y + h + 1, w, h, 0.5, 0.0);
-    },
+this._fadeOutRect(ctx, x, y + h + 1, w, h, 0.5, 0.0);
+},
 
-    _fadeOutRect: function(ctx, x, y, w, h, a1, a2)
-    {
-        ctx.save();
+_fadeOutRect: function(ctx, x, y, w, h, a1, a2)
+{
+ctx.save();
 
-        var gradient = ctx.createLinearGradient(x, y, x, y + h);
-        gradient.addColorStop(0.0, "rgba(0, 0, 0, " + (1.0 - a1) + ")");
-        gradient.addColorStop(0.8, "rgba(0, 0, 0, " + (1.0 - a2) + ")");
-        gradient.addColorStop(1.0, "rgba(0, 0, 0, 1.0)");
+var gradient = ctx.createLinearGradient(x, y, x, y + h);
+gradient.addColorStop(0.0, "rgba(0, 0, 0, " + (1.0 - a1) + ")");
+gradient.addColorStop(0.8, "rgba(0, 0, 0, " + (1.0 - a2) + ")");
+gradient.addColorStop(1.0, "rgba(0, 0, 0, 1.0)");
 
-        ctx.globalCompositeOperation = "destination-out";
+ctx.globalCompositeOperation = "destination-out";
 
-        ctx.fillStyle = gradient;
-        ctx.fillRect(x, y, w, h);
+ctx.fillStyle = gradient;
+ctx.fillRect(x, y, w, h);
 
-        ctx.restore();
-    },
+ctx.restore();
+},
 
-    _makeLegendElement: function(label, value, color)
-    {
-        var legendElement = document.createElement("label");
-        legendElement.className = "summary-graph-legend-item";
+_makeLegendElement: function(label, value, color)
+{
+var legendElement = document.createElement("label");
+legendElement.className = "summary-graph-legend-item";
 
-        if (color) {
-            var swatch = document.createElement("canvas");
-            swatch.className = "summary-graph-legend-swatch";
-            swatch.setAttribute("width", "13");
-            swatch.setAttribute("height", "24");
+if (color) {
+var swatch = document.createElement("canvas");
+swatch.className = "summary-graph-legend-swatch";
+swatch.setAttribute("width", "13");
+swatch.setAttribute("height", "24");
 
-            legendElement.appendChild(swatch);
+legendElement.appendChild(swatch);
 
-            this._drawSwatch(swatch, color);
-        }
+this._drawSwatch(swatch, color);
+}
 
-        var labelElement = document.createElement("div");
-        labelElement.className = "summary-graph-legend-label";
-        legendElement.appendChild(labelElement);
+var labelElement = document.createElement("div");
+labelElement.className = "summary-graph-legend-label";
+legendElement.appendChild(labelElement);
 
-        var headerElement = document.createElement("div");
-        headerElement.className = "summary-graph-legend-header";
-        headerElement.textContent = label;
-        labelElement.appendChild(headerElement);
+var headerElement = document.createElement("div");
+headerElement.className = "summary-graph-legend-header";
+headerElement.textContent = label;
+labelElement.appendChild(headerElement);
 
-        var valueElement = document.createElement("div");
-        valueElement.className = "summary-graph-legend-value";
-        valueElement.textContent = value;
-        labelElement.appendChild(valueElement);
+var valueElement = document.createElement("div");
+valueElement.className = "summary-graph-legend-value";
+valueElement.textContent = value;
+labelElement.appendChild(valueElement);
 
-        return legendElement;
-    }
+return legendElement;
+}
 }
 
 WebInspector.SummaryBar.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* ElementsPanel.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ElementsPanel = function()
 {
-    WebInspector.Panel.call(this);
+WebInspector.Panel.call(this, "elements");
 
-    this.element.addStyleClass("elements");
+this.contentElement = document.createElement("div");
+this.contentElement.id = "elements-content";
+this.contentElement.className = "outline-disclosure source-code";
 
-    this.contentElement = document.createElement("div");
-    this.contentElement.id = "elements-content";
-    this.contentElement.className = "outline-disclosure source-code";
+this.treeOutline = new WebInspector.ElementsTreeOutline();
+this.treeOutline.panel = this;
+this.treeOutline.includeRootDOMNode = false;
+this.treeOutline.selectEnabled = true;
 
-    this.treeOutline = new WebInspector.ElementsTreeOutline();
-    this.treeOutline.panel = this;
-    this.treeOutline.includeRootDOMNode = false;
-    this.treeOutline.selectEnabled = true;
+this.treeOutline.focusedNodeChanged = function(forceUpdate)
+{
+if (this.panel.visible && WebInspector.currentFocusElement !== document.getElementById("search"))
+WebInspector.currentFocusElement = this.element;
 
-    this.treeOutline.focusedNodeChanged = function(forceUpdate)
-    {
-        if (this.panel.visible && WebInspector.currentFocusElement !== document.getElementById("search"))
-            WebInspector.currentFocusElement = this.element;
+this.panel.updateBreadcrumb(forceUpdate);
 
-        this.panel.updateBreadcrumb(forceUpdate);
+for (var pane in this.panel.sidebarPanes)
+this.panel.sidebarPanes[pane].needsUpdate = true;
 
-        for (var pane in this.panel.sidebarPanes)
-           this.panel.sidebarPanes[pane].needsUpdate = true;
+this.panel.updateStyles(true);
+this.panel.updateMetrics();
+this.panel.updateProperties();
+this.panel.updateEventListeners();
 
-        this.panel.updateStyles(true);
-        this.panel.updateMetrics();
-        this.panel.updateProperties();
-        this.panel.updateEventListeners();
+if (this._focusedDOMNode) {
+InspectorBackend.addInspectedNode(this._focusedDOMNode.id);
+WebInspector.extensionServer.notifyObjectSelected(this.panel.name);
+}
+};
 
-        if (this._focusedDOMNode)
-            InjectedScriptAccess.get(this._focusedDOMNode.injectedScriptId).addInspectedNode(this._focusedDOMNode.id, function() {});
-    };
+this.contentElement.appendChild(this.treeOutline.element);
 
-    this.contentElement.appendChild(this.treeOutline.element);
+this.crumbsElement = document.createElement("div");
+this.crumbsElement.className = "crumbs";
+this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bind(this), false);
+this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs.bind(this), false);
 
-    this.crumbsElement = document.createElement("div");
-    this.crumbsElement.className = "crumbs";
-    this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bind(this), false);
-    this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs.bind(this), false);
+this.sidebarPanes = {};
+this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane();
+this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPanes.computedStyle);
+this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
+this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
+if (Preferences.nativeInstrumentationEnabled)
+this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane();
+this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPane();
 
-    this.sidebarPanes = {};
-    this.sidebarPanes.styles = new WebInspector.StylesSidebarPane();
-    this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane();
-    this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane();
-    this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPane();
+this.sidebarPanes.styles.onexpand = this.updateStyles.bind(this);
+this.sidebarPanes.metrics.onexpand = this.updateMetrics.bind(this);
+this.sidebarPanes.properties.onexpand = this.updateProperties.bind(this);
+this.sidebarPanes.eventListeners.onexpand = this.updateEventListeners.bind(this);
 
-    this.sidebarPanes.styles.onexpand = this.updateStyles.bind(this);
-    this.sidebarPanes.metrics.onexpand = this.updateMetrics.bind(this);
-    this.sidebarPanes.properties.onexpand = this.updateProperties.bind(this);
-    this.sidebarPanes.eventListeners.onexpand = this.updateEventListeners.bind(this);
+this.sidebarPanes.styles.expanded = true;
 
-    this.sidebarPanes.styles.expanded = true;
+this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEdited, this);
+this.sidebarPanes.styles.addEventListener("style property toggled", this._stylesPaneEdited, this);
+this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPaneEdited, this);
 
-    this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEdited, this);
-    this.sidebarPanes.styles.addEventListener("style property toggled", this._stylesPaneEdited, this);
-    this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPaneEdited, this);
+this.sidebarElement = document.createElement("div");
+this.sidebarElement.id = "elements-sidebar";
 
-    this.sidebarElement = document.createElement("div");
-    this.sidebarElement.id = "elements-sidebar";
+for (var pane in this.sidebarPanes)
+this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
 
-    this.sidebarElement.appendChild(this.sidebarPanes.styles.element);
-    this.sidebarElement.appendChild(this.sidebarPanes.metrics.element);
-    this.sidebarElement.appendChild(this.sidebarPanes.properties.element);
-    this.sidebarElement.appendChild(this.sidebarPanes.eventListeners.element);
+this.sidebarResizeElement = document.createElement("div");
+this.sidebarResizeElement.className = "sidebar-resizer-vertical";
+this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false);
 
-    this.sidebarResizeElement = document.createElement("div");
-    this.sidebarResizeElement.className = "sidebar-resizer-vertical";
-    this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false);
+this._nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
+this._nodeSearchButton.addEventListener("click", this.toggleSearchingForNode.bind(this), false);
 
-    this._nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
-    this._nodeSearchButton.addEventListener("click", this._nodeSearchButtonClicked.bind(this), false);
+this.element.appendChild(this.contentElement);
+this.element.appendChild(this.sidebarElement);
+this.element.appendChild(this.sidebarResizeElement);
 
-    this.element.appendChild(this.contentElement);
-    this.element.appendChild(this.sidebarElement);
-    this.element.appendChild(this.sidebarResizeElement);
+this._registerShortcuts();
 
-    this._changedStyles = {};
-
-    this.reset();
+this.reset();
 }
 
 WebInspector.ElementsPanel.prototype = {
-    toolbarItemClass: "elements",
+get toolbarItemLabel()
+{
+return WebInspector.UIString("Elements");
+},
 
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Elements");
-    },
+get statusBarItems()
+{
+return [this._nodeSearchButton.element, this.crumbsElement];
+},
 
-    get statusBarItems()
-    {
-        return [this._nodeSearchButton.element, this.crumbsElement];
-    },
+get defaultFocusedElement()
+{
+return this.treeOutline.element;
+},
 
-    get defaultFocusedElement()
-    {
-        return this.treeOutline.element;
-    },
+updateStatusBarItems: function()
+{
+this.updateBreadcrumbSizes();
+},
 
-    updateStatusBarItems: function()
-    {
-        this.updateBreadcrumbSizes();
-    },
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+this.sidebarResizeElement.style.right = (this.sidebarElement.offsetWidth - 3) + "px";
+this.updateBreadcrumb();
+this.treeOutline.updateSelection();
+if (this.recentlyModifiedNodes.length)
+this.updateModifiedNodes();
+},
 
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-        this.sidebarResizeElement.style.right = (this.sidebarElement.offsetWidth - 3) + "px";
-        this.updateBreadcrumb();
-        this.treeOutline.updateSelection();
-        if (this.recentlyModifiedNodes.length)
-            this.updateModifiedNodes();
-    },
+hide: function()
+{
+WebInspector.Panel.prototype.hide.call(this);
 
-    hide: function()
-    {
-        WebInspector.Panel.prototype.hide.call(this);
+WebInspector.highlightDOMNode(0);
+this.setSearchingForNode(false);
+},
 
-        WebInspector.hoveredDOMNode = null;
-        InspectorBackend.disableSearchingForNode();
-    },
+resize: function()
+{
+this.treeOutline.updateSelection();
+this.updateBreadcrumbSizes();
+},
 
-    resize: function()
-    {
-        this.treeOutline.updateSelection();
-        this.updateBreadcrumbSizes();
-    },
+reset: function()
+{
+if (this.focusedDOMNode)
+this._selectedPathOnReset = this.focusedDOMNode.path();
 
-    reset: function()
-    {
-        if (this.focusedDOMNode) {
-            this._selectedPathOnReset = [];
-            var node = this.focusedDOMNode;
-            while ("index" in node) {
-                this._selectedPathOnReset.push(node.nodeName);
-                this._selectedPathOnReset.push(node.index);
-                node = node.parentNode;
-            }
-            this._selectedPathOnReset.reverse();
-        }
+this.rootDOMNode = null;
+this.focusedDOMNode = null;
 
-        this.rootDOMNode = null;
-        this.focusedDOMNode = null;
+WebInspector.highlightDOMNode(0);
 
-        WebInspector.hoveredDOMNode = null;
+this.recentlyModifiedNodes = [];
 
-        this.recentlyModifiedNodes = [];
+delete this.currentQuery;
 
-        delete this.currentQuery;
-        this.searchCanceled();
-    },
+if (Preferences.nativeInstrumentationEnabled)
+this.sidebarPanes.domBreakpoints.reset();
+},
 
-    setDocument: function(inspectedRootDocument)
-    {
-        this.reset();
+setDocument: function(inspectedRootDocument)
+{
+this.reset();
+this.searchCanceled();
 
-        if (!inspectedRootDocument)
-            return;
+if (!inspectedRootDocument)
+return;
 
-        inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this));
-        inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this));
-        inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this));
+inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this));
+inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this));
+inspectedRootDocument.addEventListener("DOMAttrModified", this._attributesUpdated.bind(this));
+inspectedRootDocument.addEventListener("DOMCharacterDataModified", this._characterDataModified.bind(this));
 
-        this.treeOutline.suppressSelectHighlight = true;
-        this.rootDOMNode = inspectedRootDocument;
-        this.treeOutline.suppressSelectHighlight = false;
+this.rootDOMNode = inspectedRootDocument;
 
-        function selectNode(candidateFocusNode)
-        {
-            if (!candidateFocusNode)
-                candidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement;
+function selectNode(candidateFocusNode)
+{
+if (!candidateFocusNode)
+candidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement;
 
-            if (!candidateFocusNode)
-                return;
+if (!candidateFocusNode)
+return;
 
-            this.treeOutline.suppressSelectHighlight = true;
-            this.focusedDOMNode = candidateFocusNode;
-            if (this.treeOutline.selectedTreeElement)
-                this.treeOutline.selectedTreeElement.expand();
-            this.treeOutline.suppressSelectHighlight = false;
-        }
+this.focusedDOMNode = candidateFocusNode;
+if (this.treeOutline.selectedTreeElement)
+this.treeOutline.selectedTreeElement.expand();
+}
 
-        function selectLastSelectedNode(nodeId)
-        {
-            if (this.focusedDOMNode) {
-                // Focused node has been explicitly set while reaching out for the last selected node.
-                return;
-            }
-            var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : 0;
-            selectNode.call(this, node);
-        }
+function selectLastSelectedNode(nodeId)
+{
+if (this.focusedDOMNode) {
 
-        if (this._selectedPathOnReset)
-            InjectedScriptAccess.getDefault().nodeByPath(this._selectedPathOnReset, selectLastSelectedNode.bind(this));
-        else
-            selectNode.call(this);
-        delete this._selectedPathOnReset;
-    },
+return;
+}
+var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : 0;
+selectNode.call(this, node);
+}
 
-    searchCanceled: function()
-    {
-        delete this._searchQuery;
-        this._hideSearchHighlights();
+if (this._selectedPathOnReset)
+InspectorBackend.pushNodeByPathToFrontend(this._selectedPathOnReset, selectLastSelectedNode.bind(this));
+else
+selectNode.call(this);
+delete this._selectedPathOnReset;
+},
 
-        WebInspector.updateSearchMatchesCount(0, this);
+searchCanceled: function()
+{
+delete this._searchQuery;
+this._hideSearchHighlights();
 
-        this._currentSearchResultIndex = 0;
-        this._searchResults = [];
-        InjectedScriptAccess.getDefault().searchCanceled(function() {});
-    },
+WebInspector.updateSearchMatchesCount(0, this);
 
-    performSearch: function(query)
-    {
-        // Call searchCanceled since it will reset everything we need before doing a new search.
-        this.searchCanceled();
+this._currentSearchResultIndex = 0;
+this._searchResults = [];
+InspectorBackend.searchCanceled();
+},
 
-        const whitespaceTrimmedQuery = query.trim();
-        if (!whitespaceTrimmedQuery.length)
-            return;
+performSearch: function(query)
+{
 
-        this._updatedMatchCountOnce = false;
-        this._matchesCountUpdateTimeout = null;
-        this._searchQuery = query;
+this.searchCanceled();
 
-        InjectedScriptAccess.getDefault().performSearch(whitespaceTrimmedQuery, function() {});
-    },
+const whitespaceTrimmedQuery = query.trim();
+if (!whitespaceTrimmedQuery.length)
+return;
 
-    searchingForNodeWasEnabled: function()
-    {
-        this._nodeSearchButton.toggled = true;
-    },
+this._updatedMatchCountOnce = false;
+this._matchesCountUpdateTimeout = null;
+this._searchQuery = query;
 
-    searchingForNodeWasDisabled: function()
-    {
-        this._nodeSearchButton.toggled = false;
-    },
+InspectorBackend.performSearch(whitespaceTrimmedQuery, false);
+},
 
-    _updateMatchesCount: function()
-    {
-        WebInspector.updateSearchMatchesCount(this._searchResults.length, this);
-        this._matchesCountUpdateTimeout = null;
-        this._updatedMatchCountOnce = true;
-    },
+populateHrefContextMenu: function(contextMenu, event, anchorElement)
+{
+if (!anchorElement.href)
+return false;
 
-    _updateMatchesCountSoon: function()
-    {
-        if (!this._updatedMatchCountOnce)
-            return this._updateMatchesCount();
-        if (this._matchesCountUpdateTimeout)
-            return;
-        // Update the matches count every half-second so it doesn't feel twitchy.
-        this._matchesCountUpdateTimeout = setTimeout(this._updateMatchesCount.bind(this), 500);
-    },
+var resourceURL = WebInspector.resourceURLForRelatedNode(this.focusedDOMNode, anchorElement.href);
+if (!resourceURL)
+return false;
 
-    addNodesToSearchResult: function(nodeIds)
-    {
-        if (!nodeIds)
-            return;
 
-        var nodeIdsArray = nodeIds.split(",");
-        for (var i = 0; i < nodeIdsArray.length; ++i) {
-            var nodeId = nodeIdsArray[i];
-            var node = WebInspector.domAgent.nodeForId(nodeId);
-            if (!node)
-                continue;
 
-            this._currentSearchResultIndex = 0;
-            this._searchResults.push(node);
-        }
-        this._highlightCurrentSearchResult();
-        this._updateMatchesCountSoon();
-    },
+contextMenu.appendItem(WebInspector.UIString("Open Link in New Window"), WebInspector.openResource.bind(null, resourceURL, false));
+if (WebInspector.resourceForURL(resourceURL))
+contextMenu.appendItem(WebInspector.UIString("Open Link in Resources Panel"), WebInspector.openResource.bind(null, resourceURL, true));
+return true;
+},
 
-    jumpToNextSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
+_updateMatchesCount: function()
+{
+WebInspector.updateSearchMatchesCount(this._searchResults.length, this);
+this._matchesCountUpdateTimeout = null;
+this._updatedMatchCountOnce = true;
+},
 
-        if (++this._currentSearchResultIndex >= this._searchResults.length)
-            this._currentSearchResultIndex = 0;
-        this._highlightCurrentSearchResult();
-    },
+_updateMatchesCountSoon: function()
+{
+if (!this._updatedMatchCountOnce)
+return this._updateMatchesCount();
+if (this._matchesCountUpdateTimeout)
+return;
 
-    jumpToPreviousSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
+this._matchesCountUpdateTimeout = setTimeout(this._updateMatchesCount.bind(this), 500);
+},
 
-        if (--this._currentSearchResultIndex < 0)
-            this._currentSearchResultIndex = (this._searchResults.length - 1);
-        this._highlightCurrentSearchResult();
-    },
+addNodesToSearchResult: function(nodeIds)
+{
+if (!nodeIds.length)
+return;
 
-    _highlightCurrentSearchResult: function()
-    {
-        this._hideSearchHighlights();
-        var node = this._searchResults[this._currentSearchResultIndex];
-        var treeElement = this.treeOutline.findTreeElement(node);
-        if (treeElement) {
-            treeElement.highlightSearchResults(this._searchQuery);
-            treeElement.reveal();
-        }
-    },
+for (var i = 0; i < nodeIds.length; ++i) {
+var nodeId = nodeIds[i];
+var node = WebInspector.domAgent.nodeForId(nodeId);
+if (!node)
+continue;
 
-    _hideSearchHighlights: function(node)
-    {
-        for (var i = 0; this._searchResults && i < this._searchResults.length; ++i) {
-            var node = this._searchResults[i];
-            var treeElement = this.treeOutline.findTreeElement(node);
-            if (treeElement)
-                treeElement.highlightSearchResults(null);
-        }
-    },
+this._currentSearchResultIndex = 0;
+this._searchResults.push(node);
+}
+this._highlightCurrentSearchResult();
+this._updateMatchesCountSoon();
+},
 
-    renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector)
-    {
-        // TODO: Implement Shifting the oldSelector, and its contents to a newSelector
-    },
+jumpToNextSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
 
-    addStyleChange: function(identifier, style, property)
-    {
-        if (!style.parentRule)
-            return;
+if (++this._currentSearchResultIndex >= this._searchResults.length)
+this._currentSearchResultIndex = 0;
+this._highlightCurrentSearchResult();
+},
 
-        var selector = style.parentRule.selectorText;
-        if (!this._changedStyles[identifier])
-            this._changedStyles[identifier] = {};
+jumpToPreviousSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
 
-        if (!this._changedStyles[identifier][selector])
-            this._changedStyles[identifier][selector] = {};
+if (--this._currentSearchResultIndex < 0)
+this._currentSearchResultIndex = (this._searchResults.length - 1);
+this._highlightCurrentSearchResult();
+},
 
-        if (!this._changedStyles[identifier][selector][property])
-            WebInspector.styleChanges += 1;
+_highlightCurrentSearchResult: function()
+{
+this._hideSearchHighlights();
+var node = this._searchResults[this._currentSearchResultIndex];
+var treeElement = this.treeOutline.findTreeElement(node);
+if (treeElement) {
+treeElement.highlightSearchResults(this._searchQuery);
+treeElement.reveal();
+}
+},
 
-        this._changedStyles[identifier][selector][property] = style.getPropertyValue(property);
-    },
+_hideSearchHighlights: function(node)
+{
+for (var i = 0; this._searchResults && i < this._searchResults.length; ++i) {
+var node = this._searchResults[i];
+var treeElement = this.treeOutline.findTreeElement(node);
+if (treeElement)
+treeElement.highlightSearchResults(null);
+}
+},
 
-    removeStyleChange: function(identifier, style, property)
-    {
-        if (!style.parentRule)
-            return;
+renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector)
+{
 
-        var selector = style.parentRule.selectorText;
-        if (!this._changedStyles[identifier] || !this._changedStyles[identifier][selector])
-            return;
+},
 
-        if (this._changedStyles[identifier][selector][property]) {
-            delete this._changedStyles[identifier][selector][property];
-            WebInspector.styleChanges -= 1;
-        }
-    },
+get rootDOMNode()
+{
+return this.treeOutline.rootDOMNode;
+},
 
-    generateStylesheet: function()
-    {
-        if (!WebInspector.styleChanges)
-            return;
+set rootDOMNode(x)
+{
+this.treeOutline.rootDOMNode = x;
+},
 
-        // Merge Down to Just Selectors
-        var mergedSelectors = {};
-        for (var identifier in this._changedStyles) {
-            for (var selector in this._changedStyles[identifier]) {
-                if (!mergedSelectors[selector])
-                    mergedSelectors[selector] = this._changedStyles[identifier][selector];
-                else { // merge on selector
-                    var merge = {};
-                    for (var property in mergedSelectors[selector])
-                        merge[property] = mergedSelectors[selector][property];
-                    for (var property in this._changedStyles[identifier][selector]) {
-                        if (!merge[property])
-                            merge[property] = this._changedStyles[identifier][selector][property];
-                        else { // merge on property within a selector, include comment to notify user
-                            var value1 = merge[property];
-                            var value2 = this._changedStyles[identifier][selector][property];
+get focusedDOMNode()
+{
+return this.treeOutline.focusedDOMNode;
+},
 
-                            if (value1 === value2)
-                                merge[property] = [value1];
-                            else if (value1 instanceof Array)
-                                merge[property].push(value2);
-                            else
-                                merge[property] = [value1, value2];
-                        }
-                    }
-                    mergedSelectors[selector] = merge;
-                }
-            }
-        }
+set focusedDOMNode(x)
+{
+this.treeOutline.focusedDOMNode = x;
+},
 
-        var builder = [];
-        builder.push("/**");
-        builder.push(" * Inspector Generated Stylesheet"); // UIString?
-        builder.push(" */\n");
+_attributesUpdated: function(event)
+{
+this.recentlyModifiedNodes.push({node: event.target, updated: true});
+if (this.visible)
+this._updateModifiedNodesSoon();
+},
 
-        var indent = "  ";
-        function displayProperty(property, value, comment) {
-            if (comment)
-                return indent + "/* " + property + ": " + value + "; */";
-            else
-                return indent + property + ": " + value + ";";
-        }
+_characterDataModified: function(event)
+{
+this.recentlyModifiedNodes.push({node: event.target, updated: true});
+if (this.visible)
+this._updateModifiedNodesSoon();
+},
 
-        for (var selector in mergedSelectors) {
-            var psuedoStyle = mergedSelectors[selector];
-            var properties = Object.properties(psuedoStyle);
-            if (properties.length) {
-                builder.push(selector + " {");
-                for (var i = 0; i < properties.length; ++i) {
-                    var property = properties[i];
-                    var value = psuedoStyle[property];
-                    if (!(value instanceof Array))
-                        builder.push(displayProperty(property, value));
-                    else {
-                        if (value.length === 1)
-                            builder.push(displayProperty(property, value) + " /* merged from equivalent edits */"); // UIString?
-                        else {                        
-                            builder.push(indent + "/* There was a Conflict... There were Multiple Edits for '" + property + "' */"); // UIString?
-                            for (var j = 0; j < value.length; ++j)
-                                builder.push(displayProperty(property, value, true));
-                        }
-                    }
-                }
-                builder.push("}\n");
-            }
-        }
+_nodeInserted: function(event)
+{
+this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true});
+if (this.visible)
+this._updateModifiedNodesSoon();
+},
 
-        WebInspector.showConsole();
-        WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(builder.join("\n")));
-    },
+_nodeRemoved: function(event)
+{
+this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, removed: true});
+if (this.visible)
+this._updateModifiedNodesSoon();
+},
 
-    get rootDOMNode()
-    {
-        return this.treeOutline.rootDOMNode;
-    },
+_updateModifiedNodesSoon: function()
+{
+if ("_updateModifiedNodesTimeout" in this)
+return;
+this._updateModifiedNodesTimeout = setTimeout(this.updateModifiedNodes.bind(this), 0);
+},
 
-    set rootDOMNode(x)
-    {
-        this.treeOutline.rootDOMNode = x;
-    },
+updateModifiedNodes: function()
+{
+if ("_updateModifiedNodesTimeout" in this) {
+clearTimeout(this._updateModifiedNodesTimeout);
+delete this._updateModifiedNodesTimeout;
+}
 
-    get focusedDOMNode()
-    {
-        return this.treeOutline.focusedDOMNode;
-    },
+var updatedParentTreeElements = [];
+var updateBreadcrumbs = false;
 
-    set focusedDOMNode(x)
-    {
-        this.treeOutline.focusedDOMNode = x;
-    },
+for (var i = 0; i < this.recentlyModifiedNodes.length; ++i) {
+var replaced = this.recentlyModifiedNodes[i].replaced;
+var parent = this.recentlyModifiedNodes[i].parent;
+var node = this.recentlyModifiedNodes[i].node;
 
-    _attributesUpdated: function(event)
-    {
-        this.recentlyModifiedNodes.push({node: event.target, updated: true});
-        if (this.visible)
-            this._updateModifiedNodesSoon();
-    },
+if (this.recentlyModifiedNodes[i].updated) {
+var nodeItem = this.treeOutline.findTreeElement(node);
+if (nodeItem)
+nodeItem.updateTitle();
+continue;
+}
 
-    _nodeInserted: function(event)
-    {
-        this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true});
-        if (this.visible)
-            this._updateModifiedNodesSoon();
-    },
+if (!parent)
+continue;
 
-    _nodeRemoved: function(event)
-    {
-        this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, removed: true});
-        if (this.visible)
-            this._updateModifiedNodesSoon();
-    },
+var parentNodeItem = this.treeOutline.findTreeElement(parent);
+if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) {
+parentNodeItem.updateChildren(replaced);
+parentNodeItem.alreadyUpdatedChildren = true;
+updatedParentTreeElements.push(parentNodeItem);
+}
 
-    _updateModifiedNodesSoon: function()
-    {
-        if ("_updateModifiedNodesTimeout" in this)
-            return;
-        this._updateModifiedNodesTimeout = setTimeout(this.updateModifiedNodes.bind(this), 0);
-    },
+if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestorNode(this.focusedDOMNode, parent)))
+updateBreadcrumbs = true;
+}
 
-    updateModifiedNodes: function()
-    {
-        if ("_updateModifiedNodesTimeout" in this) {
-            clearTimeout(this._updateModifiedNodesTimeout);
-            delete this._updateModifiedNodesTimeout;
-        }
+for (var i = 0; i < updatedParentTreeElements.length; ++i)
+delete updatedParentTreeElements[i].alreadyUpdatedChildren;
 
-        var updatedParentTreeElements = [];
-        var updateBreadcrumbs = false;
+this.recentlyModifiedNodes = [];
 
-        for (var i = 0; i < this.recentlyModifiedNodes.length; ++i) {
-            var replaced = this.recentlyModifiedNodes[i].replaced;
-            var parent = this.recentlyModifiedNodes[i].parent;
-            var node = this.recentlyModifiedNodes[i].node;
+if (updateBreadcrumbs)
+this.updateBreadcrumb(true);
+},
 
-            if (this.recentlyModifiedNodes[i].updated) {
-                var nodeItem = this.treeOutline.findTreeElement(node);
-                if (nodeItem)
-                    nodeItem.updateTitle();
-                continue;
-            }
-            
-            if (!parent)
-                continue;
+_stylesPaneEdited: function()
+{
+this.sidebarPanes.metrics.needsUpdate = true;
+this.updateMetrics();
+},
 
-            var parentNodeItem = this.treeOutline.findTreeElement(parent);
-            if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) {
-                parentNodeItem.updateChildren(replaced);
-                parentNodeItem.alreadyUpdatedChildren = true;
-                updatedParentTreeElements.push(parentNodeItem);
-            }
+_metricsPaneEdited: function()
+{
+this.sidebarPanes.styles.needsUpdate = true;
+this.updateStyles(true);
+},
 
-            if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestorNode(this.focusedDOMNode, parent)))
-                updateBreadcrumbs = true;
-        }
+_mouseMovedInCrumbs: function(event)
+{
+var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
+var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");
 
-        for (var i = 0; i < updatedParentTreeElements.length; ++i)
-            delete updatedParentTreeElements[i].alreadyUpdatedChildren;
+WebInspector.highlightDOMNode(crumbElement ? crumbElement.representedObject.id : 0);
 
-        this.recentlyModifiedNodes = [];
+if ("_mouseOutOfCrumbsTimeout" in this) {
+clearTimeout(this._mouseOutOfCrumbsTimeout);
+delete this._mouseOutOfCrumbsTimeout;
+}
+},
 
-        if (updateBreadcrumbs)
-            this.updateBreadcrumb(true);
-    },
+_mouseMovedOutOfCrumbs: function(event)
+{
+var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
+if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement))
+return;
 
-    _stylesPaneEdited: function()
-    {
-        this.sidebarPanes.metrics.needsUpdate = true;
-        this.updateMetrics();
-    },
+WebInspector.highlightDOMNode(0);
+
+this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bind(this), 1000);
+},
+
+updateBreadcrumb: function(forceUpdate)
+{
+if (!this.visible)
+return;
+
+var crumbs = this.crumbsElement;
+
+var handled = false;
+var foundRoot = false;
+var crumb = crumbs.firstChild;
+while (crumb) {
+if (crumb.representedObject === this.rootDOMNode)
+foundRoot = true;
+
+if (foundRoot)
+crumb.addStyleClass("dimmed");
+else
+crumb.removeStyleClass("dimmed");
+
+if (crumb.representedObject === this.focusedDOMNode) {
+crumb.addStyleClass("selected");
+handled = true;
+} else {
+crumb.removeStyleClass("selected");
+}
+
+crumb = crumb.nextSibling;
+}
+
+if (handled && !forceUpdate) {
+
+
+this.updateBreadcrumbSizes();
+return;
+}
+
+crumbs.removeChildren();
+
+var panel = this;
+
+function selectCrumbFunction(event)
+{
+var crumb = event.currentTarget;
+if (crumb.hasStyleClass("collapsed")) {
+
+if (crumb === panel.crumbsElement.firstChild) {
+
+
+var currentCrumb = crumb;
+while (currentCrumb) {
+var hidden = currentCrumb.hasStyleClass("hidden");
+var collapsed = currentCrumb.hasStyleClass("collapsed");
+if (!hidden && !collapsed)
+break;
+crumb = currentCrumb;
+currentCrumb = currentCrumb.nextSibling;
+}
+}
+
+panel.updateBreadcrumbSizes(crumb);
+} else {
+
+
+if (event.detail >= 2 || crumb.hasStyleClass("dimmed"))
+panel.rootDOMNode = crumb.representedObject.parentNode;
+panel.focusedDOMNode = crumb.representedObject;
+}
+
+event.preventDefault();
+}
+
+foundRoot = false;
+for (var current = this.focusedDOMNode; current; current = current.parentNode) {
+if (current.nodeType === Node.DOCUMENT_NODE)
+continue;
+
+if (current === this.rootDOMNode)
+foundRoot = true;
+
+var crumb = document.createElement("span");
+crumb.className = "crumb";
+crumb.representedObject = current;
+crumb.addEventListener("mousedown", selectCrumbFunction, false);
+
+var crumbTitle;
+switch (current.nodeType) {
+case Node.ELEMENT_NODE:
+this.decorateNodeLabel(current, crumb);
+break;
+
+case Node.TEXT_NODE:
+if (isNodeWhitespace.call(current))
+crumbTitle = WebInspector.UIString("(whitespace)");
+else
+crumbTitle = WebInspector.UIString("(text)");
+break
+
+case Node.COMMENT_NODE:
+crumbTitle = "<!-->";
+break;
+
+case Node.DOCUMENT_TYPE_NODE:
+crumbTitle = "<!DOCTYPE>";
+break;
+
+default:
+crumbTitle = this.treeOutline.nodeNameToCorrectCase(current.nodeName);
+}
+
+if (!crumb.childNodes.length) {
+var nameElement = document.createElement("span");
+nameElement.textContent = crumbTitle;
+crumb.appendChild(nameElement);
+crumb.title = crumbTitle;
+}
+
+if (foundRoot)
+crumb.addStyleClass("dimmed");
+if (current === this.focusedDOMNode)
+crumb.addStyleClass("selected");
+if (!crumbs.childNodes.length)
+crumb.addStyleClass("end");
+
+crumbs.appendChild(crumb);
+}
+
+if (crumbs.hasChildNodes())
+crumbs.lastChild.addStyleClass("start");
+
+this.updateBreadcrumbSizes();
+},
+
+decorateNodeLabel: function(node, parentElement)
+{
+var title = this.treeOutline.nodeNameToCorrectCase(node.nodeName);
+
+var nameElement = document.createElement("span");
+nameElement.textContent = title;
+parentElement.appendChild(nameElement);
+
+var idAttribute = node.getAttribute("id");
+if (idAttribute) {
+var idElement = document.createElement("span");
+parentElement.appendChild(idElement);
 
-    _metricsPaneEdited: function()
-    {
-        this.sidebarPanes.styles.needsUpdate = true;
-        this.updateStyles(true);
-    },
+var part = "#" + idAttribute;
+title += part;
+idElement.appendChild(document.createTextNode(part));
 
-    _mouseMovedInCrumbs: function(event)
-    {
-        var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
-        var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb");
 
-        WebInspector.hoveredDOMNode = (crumbElement ? crumbElement.representedObject : null);
+nameElement.className = "extra";
+}
 
-        if ("_mouseOutOfCrumbsTimeout" in this) {
-            clearTimeout(this._mouseOutOfCrumbsTimeout);
-            delete this._mouseOutOfCrumbsTimeout;
-        }
-    },
+var classAttribute = node.getAttribute("class");
+if (classAttribute) {
+var classes = classAttribute.split(/\s+/);
+var foundClasses = {};
 
-    _mouseMovedOutOfCrumbs: function(event)
-    {
-        var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
-        if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement))
-            return;
+if (classes.length) {
+var classesElement = document.createElement("span");
+classesElement.className = "extra";
+parentElement.appendChild(classesElement);
 
-        WebInspector.hoveredDOMNode = null;
+for (var i = 0; i < classes.length; ++i) {
+var className = classes[i];
+if (className && !(className in foundClasses)) {
+var part = "." + className;
+title += part;
+classesElement.appendChild(document.createTextNode(part));
+foundClasses[className] = true;
+}
+}
+}
+}
+parentElement.title = title;
+},
 
-        this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bind(this), 1000);
-    },
+linkifyNodeReference: function(node)
+{
+var link = document.createElement("span");
+link.className = "node-link";
+this.decorateNodeLabel(node, link);
+WebInspector.wireElementWithDOMNode(link, node.id);
+return link;
+},
 
-    updateBreadcrumb: function(forceUpdate)
-    {
-        if (!this.visible)
-            return;
+linkifyNodeById: function(nodeId)
+{
+var node = WebInspector.domAgent.nodeForId(nodeId);
+if (!node)
+return document.createTextNode(WebInspector.UIString("<node>"));
+return this.linkifyNodeReference(node);
+},
 
-        var crumbs = this.crumbsElement;
+updateBreadcrumbSizes: function(focusedCrumb)
+{
+if (!this.visible)
+return;
 
-        var handled = false;
-        var foundRoot = false;
-        var crumb = crumbs.firstChild;
-        while (crumb) {
-            if (crumb.representedObject === this.rootDOMNode)
-                foundRoot = true;
+if (document.body.offsetWidth <= 0) {
 
-            if (foundRoot)
-                crumb.addStyleClass("dimmed");
-            else
-                crumb.removeStyleClass("dimmed");
 
-            if (crumb.representedObject === this.focusedDOMNode) {
-                crumb.addStyleClass("selected");
-                handled = true;
-            } else {
-                crumb.removeStyleClass("selected");
-            }
+return;
+}
 
-            crumb = crumb.nextSibling;
-        }
+var crumbs = this.crumbsElement;
+if (!crumbs.childNodes.length || crumbs.offsetWidth <= 0)
+return; 
 
-        if (handled && !forceUpdate) {
-            // We don't need to rebuild the crumbs, but we need to adjust sizes
-            // to reflect the new focused or root node.
-            this.updateBreadcrumbSizes();
-            return;
-        }
 
-        crumbs.removeChildren();
+var selectedIndex = 0;
+var focusedIndex = 0;
+var selectedCrumb;
 
-        var panel = this;
+var i = 0;
+var crumb = crumbs.firstChild;
+while (crumb) {
 
-        function selectCrumbFunction(event)
-        {
-            var crumb = event.currentTarget;
-            if (crumb.hasStyleClass("collapsed")) {
-                // Clicking a collapsed crumb will expose the hidden crumbs.
-                if (crumb === panel.crumbsElement.firstChild) {
-                    // If the focused crumb is the first child, pick the farthest crumb
-                    // that is still hidden. This allows the user to expose every crumb.
-                    var currentCrumb = crumb;
-                    while (currentCrumb) {
-                        var hidden = currentCrumb.hasStyleClass("hidden");
-                        var collapsed = currentCrumb.hasStyleClass("collapsed");
-                        if (!hidden && !collapsed)
-                            break;
-                        crumb = currentCrumb;
-                        currentCrumb = currentCrumb.nextSibling;
-                    }
-                }
+if (!selectedCrumb && crumb.hasStyleClass("selected")) {
+selectedCrumb = crumb;
+selectedIndex = i;
+}
 
-                panel.updateBreadcrumbSizes(crumb);
-            } else {
-                // Clicking a dimmed crumb or double clicking (event.detail >= 2)
-                // will change the root node in addition to the focused node.
-                if (event.detail >= 2 || crumb.hasStyleClass("dimmed"))
-                    panel.rootDOMNode = crumb.representedObject.parentNode;
-                panel.focusedDOMNode = crumb.representedObject;
-            }
 
-            event.preventDefault();
-        }
+if (crumb === focusedCrumb)
+focusedIndex = i;
 
-        foundRoot = false;
-        for (var current = this.focusedDOMNode; current; current = current.parentNode) {
-            if (current.nodeType === Node.DOCUMENT_NODE)
-                continue;
 
-            if (current === this.rootDOMNode)
-                foundRoot = true;
 
-            var crumb = document.createElement("span");
-            crumb.className = "crumb";
-            crumb.representedObject = current;
-            crumb.addEventListener("mousedown", selectCrumbFunction, false);
+if (crumb !== crumbs.lastChild)
+crumb.removeStyleClass("start");
+if (crumb !== crumbs.firstChild)
+crumb.removeStyleClass("end");
 
-            var crumbTitle;
-            switch (current.nodeType) {
-                case Node.ELEMENT_NODE:
-                    crumbTitle = current.nodeName.toLowerCase();
+crumb.removeStyleClass("compact");
+crumb.removeStyleClass("collapsed");
+crumb.removeStyleClass("hidden");
 
-                    var nameElement = document.createElement("span");
-                    nameElement.textContent = crumbTitle;
-                    crumb.appendChild(nameElement);
+crumb = crumb.nextSibling;
+++i;
+}
 
-                    var idAttribute = current.getAttribute("id");
-                    if (idAttribute) {
-                        var idElement = document.createElement("span");
-                        crumb.appendChild(idElement);
 
-                        var part = "#" + idAttribute;
-                        crumbTitle += part;
-                        idElement.appendChild(document.createTextNode(part));
 
-                        // Mark the name as extra, since the ID is more important.
-                        nameElement.className = "extra";
-                    }
+crumbs.firstChild.addStyleClass("end");
+crumbs.lastChild.addStyleClass("start");
 
-                    var classAttribute = current.getAttribute("class");
-                    if (classAttribute) {
-                        var classes = classAttribute.split(/\s+/);
-                        var foundClasses = {};
+function crumbsAreSmallerThanContainer()
+{
+var rightPadding = 20;
+var errorWarningElement = document.getElementById("error-warning-count");
+if (!WebInspector.drawer.visible && errorWarningElement)
+rightPadding += errorWarningElement.offsetWidth;
+return ((crumbs.totalOffsetLeft + crumbs.offsetWidth + rightPadding) < window.innerWidth);
+}
 
-                        if (classes.length) {
-                            var classesElement = document.createElement("span");
-                            classesElement.className = "extra";
-                            crumb.appendChild(classesElement);
+if (crumbsAreSmallerThanContainer())
+return; 
 
-                            for (var i = 0; i < classes.length; ++i) {
-                                var className = classes[i];
-                                if (className && !(className in foundClasses)) {
-                                    var part = "." + className;
-                                    crumbTitle += part;
-                                    classesElement.appendChild(document.createTextNode(part));
-                                    foundClasses[className] = true;
-                                }
-                            }
-                        }
-                    }
+var BothSides = 0;
+var AncestorSide = -1;
+var ChildSide = 1;
 
-                    break;
+function makeCrumbsSmaller(shrinkingFunction, direction, significantCrumb)
+{
+if (!significantCrumb)
+significantCrumb = (focusedCrumb || selectedCrumb);
 
-                case Node.TEXT_NODE:
-                    if (isNodeWhitespace.call(current))
-                        crumbTitle = WebInspector.UIString("(whitespace)");
-                    else
-                        crumbTitle = WebInspector.UIString("(text)");
-                    break
+if (significantCrumb === selectedCrumb)
+var significantIndex = selectedIndex;
+else if (significantCrumb === focusedCrumb)
+var significantIndex = focusedIndex;
+else {
+var significantIndex = 0;
+for (var i = 0; i < crumbs.childNodes.length; ++i) {
+if (crumbs.childNodes[i] === significantCrumb) {
+significantIndex = i;
+break;
+}
+}
+}
 
-                case Node.COMMENT_NODE:
-                    crumbTitle = "<!-->";
-                    break;
+function shrinkCrumbAtIndex(index)
+{
+var shrinkCrumb = crumbs.childNodes[index];
+if (shrinkCrumb && shrinkCrumb !== significantCrumb)
+shrinkingFunction(shrinkCrumb);
+if (crumbsAreSmallerThanContainer())
+return true; 
+return false;
+}
 
-                case Node.DOCUMENT_TYPE_NODE:
-                    crumbTitle = "<!DOCTYPE>";
-                    break;
 
-                default:
-                    crumbTitle = current.nodeName.toLowerCase();
-            }
 
-            if (!crumb.childNodes.length) {
-                var nameElement = document.createElement("span");
-                nameElement.textContent = crumbTitle;
-                crumb.appendChild(nameElement);
-            }
+if (direction) {
 
-            crumb.title = crumbTitle;
+var index = (direction > 0 ? 0 : crumbs.childNodes.length - 1);
+while (index !== significantIndex) {
+if (shrinkCrumbAtIndex(index))
+return true;
+index += (direction > 0 ? 1 : -1);
+}
+} else {
 
-            if (foundRoot)
-                crumb.addStyleClass("dimmed");
-            if (current === this.focusedDOMNode)
-                crumb.addStyleClass("selected");
-            if (!crumbs.childNodes.length)
-                crumb.addStyleClass("end");
 
-            crumbs.appendChild(crumb);
-        }
+var startIndex = 0;
+var endIndex = crumbs.childNodes.length - 1;
+while (startIndex != significantIndex || endIndex != significantIndex) {
+var startDistance = significantIndex - startIndex;
+var endDistance = endIndex - significantIndex;
+if (startDistance >= endDistance)
+var index = startIndex++;
+else
+var index = endIndex--;
+if (shrinkCrumbAtIndex(index))
+return true;
+}
+}
 
-        if (crumbs.hasChildNodes())
-            crumbs.lastChild.addStyleClass("start");
 
-        this.updateBreadcrumbSizes();
-    },
+return false;
+}
 
-    updateBreadcrumbSizes: function(focusedCrumb)
-    {
-        if (!this.visible)
-            return;
+function coalesceCollapsedCrumbs()
+{
+var crumb = crumbs.firstChild;
+var collapsedRun = false;
+var newStartNeeded = false;
+var newEndNeeded = false;
+while (crumb) {
+var hidden = crumb.hasStyleClass("hidden");
+if (!hidden) {
+var collapsed = crumb.hasStyleClass("collapsed"); 
+if (collapsedRun && collapsed) {
+crumb.addStyleClass("hidden");
+crumb.removeStyleClass("compact");
+crumb.removeStyleClass("collapsed");
 
-        if (document.body.offsetWidth <= 0) {
-            // The stylesheet hasn't loaded yet or the window is closed,
-            // so we can't calculate what is need. Return early.
-            return;
-        }
+if (crumb.hasStyleClass("start")) {
+crumb.removeStyleClass("start");
+newStartNeeded = true;
+}
 
-        var crumbs = this.crumbsElement;
-        if (!crumbs.childNodes.length || crumbs.offsetWidth <= 0)
-            return; // No crumbs, do nothing.
+if (crumb.hasStyleClass("end")) {
+crumb.removeStyleClass("end");
+newEndNeeded = true;
+}
 
-        // A Zero index is the right most child crumb in the breadcrumb.
-        var selectedIndex = 0;
-        var focusedIndex = 0;
-        var selectedCrumb;
+continue;
+}
 
-        var i = 0;
-        var crumb = crumbs.firstChild;
-        while (crumb) {
-            // Find the selected crumb and index. 
-            if (!selectedCrumb && crumb.hasStyleClass("selected")) {
-                selectedCrumb = crumb;
-                selectedIndex = i;
-            }
+collapsedRun = collapsed;
 
-            // Find the focused crumb index. 
-            if (crumb === focusedCrumb)
-                focusedIndex = i;
+if (newEndNeeded) {
+newEndNeeded = false;
+crumb.addStyleClass("end");
+}
+} else
+collapsedRun = true;
+crumb = crumb.nextSibling;
+}
 
-            // Remove any styles that affect size before
-            // deciding to shorten any crumbs.
-            if (crumb !== crumbs.lastChild)
-                crumb.removeStyleClass("start");
-            if (crumb !== crumbs.firstChild)
-                crumb.removeStyleClass("end");
+if (newStartNeeded) {
+crumb = crumbs.lastChild;
+while (crumb) {
+if (!crumb.hasStyleClass("hidden")) {
+crumb.addStyleClass("start");
+break;
+}
+crumb = crumb.previousSibling;
+}
+}
+}
 
-            crumb.removeStyleClass("compact");
-            crumb.removeStyleClass("collapsed");
-            crumb.removeStyleClass("hidden");
+function compact(crumb)
+{
+if (crumb.hasStyleClass("hidden"))
+return;
+crumb.addStyleClass("compact");
+}
 
-            crumb = crumb.nextSibling;
-            ++i;
-        }
+function collapse(crumb, dontCoalesce)
+{
+if (crumb.hasStyleClass("hidden"))
+return;
+crumb.addStyleClass("collapsed");
+crumb.removeStyleClass("compact");
+if (!dontCoalesce)
+coalesceCollapsedCrumbs();
+}
 
-        // Restore the start and end crumb classes in case they got removed in coalesceCollapsedCrumbs().
-        // The order of the crumbs in the document is opposite of the visual order.
-        crumbs.firstChild.addStyleClass("end");
-        crumbs.lastChild.addStyleClass("start");
+function compactDimmed(crumb)
+{
+if (crumb.hasStyleClass("dimmed"))
+compact(crumb);
+}
 
-        function crumbsAreSmallerThanContainer()
-        {
-            var rightPadding = 20;
-            var errorWarningElement = document.getElementById("error-warning-count");
-            if (!WebInspector.drawer.visible && errorWarningElement)
-                rightPadding += errorWarningElement.offsetWidth;
-            return ((crumbs.totalOffsetLeft + crumbs.offsetWidth + rightPadding) < window.innerWidth);
-        }
+function collapseDimmed(crumb)
+{
+if (crumb.hasStyleClass("dimmed"))
+collapse(crumb);
+}
 
-        if (crumbsAreSmallerThanContainer())
-            return; // No need to compact the crumbs, they all fit at full size.
+if (!focusedCrumb) {
 
-        var BothSides = 0;
-        var AncestorSide = -1;
-        var ChildSide = 1;
 
-        function makeCrumbsSmaller(shrinkingFunction, direction, significantCrumb)
-        {
-            if (!significantCrumb)
-                significantCrumb = (focusedCrumb || selectedCrumb);
 
-            if (significantCrumb === selectedCrumb)
-                var significantIndex = selectedIndex;
-            else if (significantCrumb === focusedCrumb)
-                var significantIndex = focusedIndex;
-            else {
-                var significantIndex = 0;
-                for (var i = 0; i < crumbs.childNodes.length; ++i) {
-                    if (crumbs.childNodes[i] === significantCrumb) {
-                        significantIndex = i;
-                        break;
-                    }
-                }
-            }
 
-            function shrinkCrumbAtIndex(index)
-            {
-                var shrinkCrumb = crumbs.childNodes[index];
-                if (shrinkCrumb && shrinkCrumb !== significantCrumb)
-                    shrinkingFunction(shrinkCrumb);
-                if (crumbsAreSmallerThanContainer())
-                    return true; // No need to compact the crumbs more.
-                return false;
-            }
+if (makeCrumbsSmaller(compact, ChildSide))
+return;
 
-            // Shrink crumbs one at a time by applying the shrinkingFunction until the crumbs
-            // fit in the container or we run out of crumbs to shrink.
-            if (direction) {
-                // Crumbs are shrunk on only one side (based on direction) of the signifcant crumb.
-                var index = (direction > 0 ? 0 : crumbs.childNodes.length - 1);
-                while (index !== significantIndex) {
-                    if (shrinkCrumbAtIndex(index))
-                        return true;
-                    index += (direction > 0 ? 1 : -1);
-                }
-            } else {
-                // Crumbs are shrunk in order of descending distance from the signifcant crumb,
-                // with a tie going to child crumbs.
-                var startIndex = 0;
-                var endIndex = crumbs.childNodes.length - 1;
-                while (startIndex != significantIndex || endIndex != significantIndex) {
-                    var startDistance = significantIndex - startIndex;
-                    var endDistance = endIndex - significantIndex;
-                    if (startDistance >= endDistance)
-                        var index = startIndex++;
-                    else
-                        var index = endIndex--;
-                    if (shrinkCrumbAtIndex(index))
-                        return true;
-                }
-            }
 
-            // We are not small enough yet, return false so the caller knows.
-            return false;
-        }
+if (makeCrumbsSmaller(collapse, ChildSide))
+return;
 
-        function coalesceCollapsedCrumbs()
-        {
-            var crumb = crumbs.firstChild;
-            var collapsedRun = false;
-            var newStartNeeded = false;
-            var newEndNeeded = false;
-            while (crumb) {
-                var hidden = crumb.hasStyleClass("hidden");
-                if (!hidden) {
-                    var collapsed = crumb.hasStyleClass("collapsed"); 
-                    if (collapsedRun && collapsed) {
-                        crumb.addStyleClass("hidden");
-                        crumb.removeStyleClass("compact");
-                        crumb.removeStyleClass("collapsed");
 
-                        if (crumb.hasStyleClass("start")) {
-                            crumb.removeStyleClass("start");
-                            newStartNeeded = true;
-                        }
+if (makeCrumbsSmaller(compactDimmed, AncestorSide))
+return;
 
-                        if (crumb.hasStyleClass("end")) {
-                            crumb.removeStyleClass("end");
-                            newEndNeeded = true;
-                        }
 
-                        continue;
-                    }
+if (makeCrumbsSmaller(collapseDimmed, AncestorSide))
+return;
+}
 
-                    collapsedRun = collapsed;
 
-                    if (newEndNeeded) {
-                        newEndNeeded = false;
-                        crumb.addStyleClass("end");
-                    }
-                } else
-                    collapsedRun = true;
-                crumb = crumb.nextSibling;
-            }
+if (makeCrumbsSmaller(compact, (focusedCrumb ? BothSides : AncestorSide)))
+return;
 
-            if (newStartNeeded) {
-                crumb = crumbs.lastChild;
-                while (crumb) {
-                    if (!crumb.hasStyleClass("hidden")) {
-                        crumb.addStyleClass("start");
-                        break;
-                    }
-                    crumb = crumb.previousSibling;
-                }
-            }
-        }
 
-        function compact(crumb)
-        {
-            if (crumb.hasStyleClass("hidden"))
-                return;
-            crumb.addStyleClass("compact");
-        }
+if (makeCrumbsSmaller(collapse, (focusedCrumb ? BothSides : AncestorSide)))
+return;
 
-        function collapse(crumb, dontCoalesce)
-        {
-            if (crumb.hasStyleClass("hidden"))
-                return;
-            crumb.addStyleClass("collapsed");
-            crumb.removeStyleClass("compact");
-            if (!dontCoalesce)
-                coalesceCollapsedCrumbs();
-        }
+if (!selectedCrumb)
+return;
 
-        function compactDimmed(crumb)
-        {
-            if (crumb.hasStyleClass("dimmed"))
-                compact(crumb);
-        }
 
-        function collapseDimmed(crumb)
-        {
-            if (crumb.hasStyleClass("dimmed"))
-                collapse(crumb);
-        }
+compact(selectedCrumb);
+if (crumbsAreSmallerThanContainer())
+return;
 
-        if (!focusedCrumb) {
-            // When not focused on a crumb we can be biased and collapse less important
-            // crumbs that the user might not care much about.
 
-            // Compact child crumbs.
-            if (makeCrumbsSmaller(compact, ChildSide))
-                return;
+collapse(selectedCrumb, true);
+},
 
-            // Collapse child crumbs.
-            if (makeCrumbsSmaller(collapse, ChildSide))
-                return;
+updateStyles: function(forceUpdate)
+{
+var stylesSidebarPane = this.sidebarPanes.styles;
+var computedStylePane = this.sidebarPanes.computedStyle;
+if ((!stylesSidebarPane.expanded && !computedStylePane.expanded) || !stylesSidebarPane.needsUpdate)
+return;
 
-            // Compact dimmed ancestor crumbs.
-            if (makeCrumbsSmaller(compactDimmed, AncestorSide))
-                return;
+stylesSidebarPane.update(this.focusedDOMNode, null, forceUpdate);
+stylesSidebarPane.needsUpdate = false;
+},
 
-            // Collapse dimmed ancestor crumbs.
-            if (makeCrumbsSmaller(collapseDimmed, AncestorSide))
-                return;
-        }
+updateMetrics: function()
+{
+var metricsSidebarPane = this.sidebarPanes.metrics;
+if (!metricsSidebarPane.expanded || !metricsSidebarPane.needsUpdate)
+return;
 
-        // Compact ancestor crumbs, or from both sides if focused.
-        if (makeCrumbsSmaller(compact, (focusedCrumb ? BothSides : AncestorSide)))
-            return;
+metricsSidebarPane.update(this.focusedDOMNode);
+metricsSidebarPane.needsUpdate = false;
+},
 
-        // Collapse ancestor crumbs, or from both sides if focused.
-        if (makeCrumbsSmaller(collapse, (focusedCrumb ? BothSides : AncestorSide)))
-            return;
+updateProperties: function()
+{
+var propertiesSidebarPane = this.sidebarPanes.properties;
+if (!propertiesSidebarPane.expanded || !propertiesSidebarPane.needsUpdate)
+return;
 
-        if (!selectedCrumb)
-            return;
+propertiesSidebarPane.update(this.focusedDOMNode);
+propertiesSidebarPane.needsUpdate = false;
+},
 
-        // Compact the selected crumb.
-        compact(selectedCrumb);
-        if (crumbsAreSmallerThanContainer())
-            return;
+updateEventListeners: function()
+{
+var eventListenersSidebarPane = this.sidebarPanes.eventListeners;
+if (!eventListenersSidebarPane.expanded || !eventListenersSidebarPane.needsUpdate)
+return;
 
-        // Collapse the selected crumb as a last resort. Pass true to prevent coalescing.
-        collapse(selectedCrumb, true);
-    },
+eventListenersSidebarPane.update(this.focusedDOMNode);
+eventListenersSidebarPane.needsUpdate = false;
+},
 
-    updateStyles: function(forceUpdate)
-    {
-        var stylesSidebarPane = this.sidebarPanes.styles;
-        if (!stylesSidebarPane.expanded || !stylesSidebarPane.needsUpdate)
-            return;
+_registerShortcuts: function()
+{
+var shortcut = WebInspector.KeyboardShortcut;
+var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("Elements Panel"));
+var keys = [
+shortcut.shortcutToString(shortcut.Keys.Up),
+shortcut.shortcutToString(shortcut.Keys.Down)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Navigate elements"));
+var keys = [
+shortcut.shortcutToString(shortcut.Keys.Right),
+shortcut.shortcutToString(shortcut.Keys.Left)
+];
+section.addRelatedKeys(keys, WebInspector.UIString("Expand/collapse"));
+section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Edit attribute"));
 
-        stylesSidebarPane.update(this.focusedDOMNode, null, forceUpdate);
-        stylesSidebarPane.needsUpdate = false;
-    },
+this.sidebarPanes.styles.registerShortcuts();
+},
 
-    updateMetrics: function()
-    {
-        var metricsSidebarPane = this.sidebarPanes.metrics;
-        if (!metricsSidebarPane.expanded || !metricsSidebarPane.needsUpdate)
-            return;
+handleShortcut: function(event)
+{
 
-        metricsSidebarPane.update(this.focusedDOMNode);
-        metricsSidebarPane.needsUpdate = false;
-    },
 
-    updateProperties: function()
-    {
-        var propertiesSidebarPane = this.sidebarPanes.properties;
-        if (!propertiesSidebarPane.expanded || !propertiesSidebarPane.needsUpdate)
-            return;
+if (event.keyIdentifier === "U+0043") {     
+if (WebInspector.isMac())
+var isNodeSearchKey = event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey;
+else
+var isNodeSearchKey = event.ctrlKey && !event.metaKey && !event.altKey && event.shiftKey;
 
-        propertiesSidebarPane.update(this.focusedDOMNode);
-        propertiesSidebarPane.needsUpdate = false;
-    },
+if (isNodeSearchKey) {
+this.toggleSearchingForNode();
+event.handled = true;
+return;
+}
+}
+},
 
-    updateEventListeners: function()
-    {
-        var eventListenersSidebarPane = this.sidebarPanes.eventListeners;
-        if (!eventListenersSidebarPane.expanded || !eventListenersSidebarPane.needsUpdate)
-            return;
+handleCopyEvent: function(event)
+{
 
-        eventListenersSidebarPane.update(this.focusedDOMNode);
-        eventListenersSidebarPane.needsUpdate = false;
-    },
+if (!window.getSelection().isCollapsed)
+return;
+event.clipboardData.clearData();
+event.preventDefault();
+InspectorBackend.copyNode(this.focusedDOMNode.id);
+},
 
-    handleShortcut: function(event)
-    {
-        // Cmd/Control + Shift + C should be a shortcut to clicking the Node Search Button.
-        // This shortcut matches Firebug.
-        if (event.keyIdentifier === "U+0043") {     // C key
-            if (WebInspector.isMac())
-                var isNodeSearchKey = event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey;
-            else
-                var isNodeSearchKey = event.ctrlKey && !event.metaKey && !event.altKey && event.shiftKey;
+rightSidebarResizerDragStart: function(event)
+{
+WebInspector.elementDragStart(this.sidebarElement, this.rightSidebarResizerDrag.bind(this), this.rightSidebarResizerDragEnd.bind(this), event, "col-resize");
+},
 
-            if (isNodeSearchKey) {
-                this._nodeSearchButtonClicked(event);
-                event.handled = true;
-                return;
-            }
-        }
-    },
+rightSidebarResizerDragEnd: function(event)
+{
+WebInspector.elementDragEnd(event);
+this.saveSidebarWidth();
+},
 
-    handleCopyEvent: function(event)
-    {
-        // Don't prevent the normal copy if the user has a selection.
-        if (!window.getSelection().isCollapsed)
-            return;
-        event.clipboardData.clearData();
-        event.preventDefault();
-        InspectorBackend.copyNode(this.focusedDOMNode.id);
-    },
+rightSidebarResizerDrag: function(event)
+{
+var x = event.pageX;
+var newWidth = Number.constrain(window.innerWidth - x, Preferences.minElementsSidebarWidth, window.innerWidth * 0.66);
+this.setSidebarWidth(newWidth);
+event.preventDefault();
+},
 
-    rightSidebarResizerDragStart: function(event)
-    {
-        WebInspector.elementDragStart(this.sidebarElement, this.rightSidebarResizerDrag.bind(this), this.rightSidebarResizerDragEnd.bind(this), event, "col-resize");
-    },
+setSidebarWidth: function(newWidth)
+{
+this.sidebarElement.style.width = newWidth + "px";
+this.contentElement.style.right = newWidth + "px";
+this.sidebarResizeElement.style.right = (newWidth - 3) + "px";
+this.treeOutline.updateSelection();
+},
 
-    rightSidebarResizerDragEnd: function(event)
-    {
-        WebInspector.elementDragEnd(event);
-    },
+updateFocusedNode: function(nodeId)
+{
+var node = WebInspector.domAgent.nodeForId(nodeId);
+if (!node)
+return;
 
-    rightSidebarResizerDrag: function(event)
-    {
-        var x = event.pageX;
-        var newWidth = Number.constrain(window.innerWidth - x, Preferences.minElementsSidebarWidth, window.innerWidth * 0.66);
+this.focusedDOMNode = node;
+this._nodeSearchButton.toggled = false;
+},
 
-        this.sidebarElement.style.width = newWidth + "px";
-        this.contentElement.style.right = newWidth + "px";
-        this.sidebarResizeElement.style.right = (newWidth - 3) + "px";
+_setSearchingForNode: function(enabled)
+{
+this._nodeSearchButton.toggled = enabled;
+},
 
-        this.treeOutline.updateSelection();
+setSearchingForNode: function(enabled)
+{
+InspectorBackend.setSearchingForNode(enabled, this._setSearchingForNode.bind(this));
+},
 
-        event.preventDefault();
-    },
+toggleSearchingForNode: function()
+{
+this.setSearchingForNode(!this._nodeSearchButton.toggled);
+},
 
-    _nodeSearchButtonClicked: function(event)
-    {
-        if (!this._nodeSearchButton.toggled)
-            InspectorBackend.enableSearchingForNode();
-        else
-            InspectorBackend.disableSearchingForNode();
-    }
+elementsToRestoreScrollPositionsFor: function()
+{
+return [ this.contentElement, this.sidebarElement ];
+}
 }
 
 WebInspector.ElementsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
-/* ResourcesPanel.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.ResourcesPanel = function()
+
+
+WebInspector.NetworkPanel = function()
 {
-    WebInspector.AbstractTimelinePanel.call(this);
+WebInspector.Panel.call(this, "network");
 
-    this.element.addStyleClass("resources");
+this.createSidebar();
+this.sidebarElement.className = "network-sidebar";
 
-    this._createPanelEnabler();
+this._resources = [];
+this._resourcesById = {};
+this._resourcesByURL = {};
+this._lastIdentifier = 0;
+this._staleResources = [];
+this._resourceGridNodes = {};
+this._mainResourceLoadTime = -1;
+this._mainResourceDOMContentTime = -1;
+this._hiddenCategories = {};
 
-    this.viewsContainerElement = document.createElement("div");
-    this.viewsContainerElement.id = "resource-views";
-    this.element.appendChild(this.viewsContainerElement);
+this._categories = WebInspector.resourceCategories;
 
-    this.createFilterPanel();
-    this.createInterface();
+this.containerElement = document.createElement("div");
+this.containerElement.id = "network-container";
+this.sidebarElement.appendChild(this.containerElement);
 
-    this._createStatusbarButtons();
+this._viewsContainerElement = document.createElement("div");
+this._viewsContainerElement.id = "network-views";
+this._viewsContainerElement.className = "hidden";
+this.element.appendChild(this._viewsContainerElement);
 
-    this.reset();
-    this.filter(this.filterAllElement, false);
-    this.graphsTreeElement.children[0].select();
-    this._resourceTrackingEnabled = false;
+this._closeButtonElement = document.createElement("button");
+this._closeButtonElement.id = "network-close-button";
+this._closeButtonElement.addEventListener("click", this._toggleGridMode.bind(this), false);
+this._viewsContainerElement.appendChild(this._closeButtonElement);
+
+this._createSortingFunctions();
+this._createTable();
+this._createTimelineGrid();
+this._createStatusbarButtons();
+this._createFilterStatusBarItems();
+this._createSummaryBar();
+
+if (!WebInspector.settings.resourcesLargeRows)
+this._setLargerResources(WebInspector.settings.resourcesLargeRows);
+
+this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), true);
+
+this._popoverHelper.setTimeout(100);
+
+this.calculator = new WebInspector.NetworkTransferTimeCalculator();
+this._filter(this._filterAllElement, false);
+
+this._toggleGridMode();
 }
 
-WebInspector.ResourcesPanel.prototype = {
-    toolbarItemClass: "resources",
-
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Resources");
-    },
-
-    get statusBarItems()
-    {
-        return [this.enableToggleButton.element, this.largerResourcesButton.element, this.sortingSelectElement];
-    },
-
-    get categories()
-    {
-        return WebInspector.resourceCategories;
-    },
-
-    createItemTreeElement: function(item)
-    {
-        return new WebInspector.ResourceSidebarTreeElement(item);
-    },
-
-    createItemGraph: function(item)
-    {
-        return new WebInspector.ResourceGraph(item);
-    },
-
-    isCategoryVisible: function(categoryName)
-    {
-        return (this.itemsGraphsElement.hasStyleClass("filter-all") || this.itemsGraphsElement.hasStyleClass("filter-" + categoryName.toLowerCase()));
-    },
-
-    populateSidebar: function()
-    {
-        var timeGraphItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Time"));
-        timeGraphItem.onselect = this._graphSelected.bind(this);
-
-        var transferTimeCalculator = new WebInspector.ResourceTransferTimeCalculator();
-        var transferDurationCalculator = new WebInspector.ResourceTransferDurationCalculator();
-
-        timeGraphItem.sortingOptions = [
-            { name: WebInspector.UIString("Sort by Start Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime, calculator: transferTimeCalculator },
-            { name: WebInspector.UIString("Sort by Response Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime, calculator: transferTimeCalculator },
-            { name: WebInspector.UIString("Sort by End Time"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime, calculator: transferTimeCalculator },
-            { name: WebInspector.UIString("Sort by Duration"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration, calculator: transferDurationCalculator },
-            { name: WebInspector.UIString("Sort by Latency"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency, calculator: transferDurationCalculator },
-        ];
-
-        timeGraphItem.isBarOpaqueAtLeft = false;
-        timeGraphItem.selectedSortingOptionIndex = 1;
-
-        var sizeGraphItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Size"));
-        sizeGraphItem.onselect = this._graphSelected.bind(this);
-
-        var transferSizeCalculator = new WebInspector.ResourceTransferSizeCalculator();
-        sizeGraphItem.sortingOptions = [
-            { name: WebInspector.UIString("Sort by Transfer Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize, calculator: transferSizeCalculator },
-            { name: WebInspector.UIString("Sort by Size"), sortingFunction: WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize, calculator: transferSizeCalculator },
-        ];
-
-        sizeGraphItem.isBarOpaqueAtLeft = true;
-        sizeGraphItem.selectedSortingOptionIndex = 0;
-
-        this.graphsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("GRAPHS"), {}, true);
-        this.sidebarTree.appendChild(this.graphsTreeElement);
-
-        this.graphsTreeElement.appendChild(timeGraphItem);
-        this.graphsTreeElement.appendChild(sizeGraphItem);
-        this.graphsTreeElement.expand();
-
-        this.itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESOURCES"), {}, true);
-        this.sidebarTree.appendChild(this.itemsTreeElement);
-
-        this.itemsTreeElement.expand();
-    },
-
-    get resourceTrackingEnabled()
-    {
-        return this._resourceTrackingEnabled;
-    },
-
-    _createPanelEnabler: function()
-    {
-        var panelEnablerHeading = WebInspector.UIString("You need to enable resource tracking to use this panel.");
-        var panelEnablerDisclaimer = WebInspector.UIString("Enabling resource tracking will reload the page and make page loading slower.");
-        var panelEnablerButton = WebInspector.UIString("Enable resource tracking");
-
-        this.panelEnablerView = new WebInspector.PanelEnablerView("resources", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
-        this.panelEnablerView.addEventListener("enable clicked", this._enableResourceTracking, this);
-
-        this.element.appendChild(this.panelEnablerView.element);
-
-        this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
-        this.enableToggleButton.addEventListener("click", this._toggleResourceTracking.bind(this), false);
-    },
-
-    _createStatusbarButtons: function()
-    {
-        this.largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "resources-larger-resources-status-bar-item");
-
-        WebInspector.settings.addEventListener("loaded", this._settingsLoaded, this);
-        this.largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false);
-        this.sortingSelectElement = document.createElement("select");
-        this.sortingSelectElement.className = "status-bar-item";
-        this.sortingSelectElement.addEventListener("change", this._changeSortingFunction.bind(this), false);
-    },
-
-    _settingsLoaded: function()
-    {
-        this.largerResourcesButton.toggled = WebInspector.settings.resourcesLargeRows;
-        if (!WebInspector.settings.resourcesLargeRows)
-            this._setLargerResources(WebInspector.settings.resourcesLargeRows);
-    },
-
-    get mainResourceLoadTime()
-    {
-        return this._mainResourceLoadTime || -1;
-    },
-    
-    set mainResourceLoadTime(x)
-    {
-        if (this._mainResourceLoadTime === x)
-            return;
-        
-        this._mainResourceLoadTime = x;
-        
-        // Update the dividers to draw the new line
-        this.updateGraphDividersIfNeeded(true);
-    },
-    
-    get mainResourceDOMContentTime()
-    {
-        return this._mainResourceDOMContentTime || -1;
-    },
-    
-    set mainResourceDOMContentTime(x)
-    {
-        if (this._mainResourceDOMContentTime === x)
-            return;
-        
-        this._mainResourceDOMContentTime = x;
-        
-        this.updateGraphDividersIfNeeded(true);
-    },
-
-    show: function()
-    {
-        WebInspector.AbstractTimelinePanel.prototype.show.call(this);
-
-        var visibleView = this.visibleView;
-        if (this.visibleResource) {
-            this.visibleView.headersVisible = true;
-            this.visibleView.show(this.viewsContainerElement);
-        } else if (visibleView)
-            visibleView.show();
-
-        // Hide any views that are visible that are not this panel's current visible view.
-        // This can happen when a ResourceView is visible in the Scripts panel then switched
-        // to the this panel.
-        var resourcesLength = this._resources.length;
-        for (var i = 0; i < resourcesLength; ++i) {
-            var resource = this._resources[i];
-            var view = resource._resourcesView;
-            if (!view || view === visibleView)
-                continue;
-            view.visible = false;
-        }
-    },
-
-    get searchableViews()
-    {
-        var views = [];
-
-        const visibleView = this.visibleView;
-        if (visibleView && visibleView.performSearch)
-            views.push(visibleView);
-
-        var resourcesLength = this._resources.length;
-        for (var i = 0; i < resourcesLength; ++i) {
-            var resource = this._resources[i];
-            if (!resource._itemsTreeElement)
-                continue;
-            var resourceView = this.resourceViewForResource(resource);
-            if (!resourceView.performSearch || resourceView === visibleView)
-                continue;
-            views.push(resourceView);
-        }
-
-        return views;
-    },
-
-    get searchResultsSortFunction()
-    {
-        const resourceTreeElementSortFunction = this.sortingFunction;
-
-        function sortFuction(a, b)
-        {
-            return resourceTreeElementSortFunction(a.resource._itemsTreeElement, b.resource._itemsTreeElement);
-        }
-
-        return sortFuction;
-    },
-
-    searchMatchFound: function(view, matches)
-    {
-        view.resource._itemsTreeElement.searchMatches = matches;
-    },
-
-    searchCanceled: function(startingNewSearch)
-    {
-        WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
-
-        if (startingNewSearch || !this._resources)
-            return;
-
-        for (var i = 0; i < this._resources.length; ++i) {
-            var resource = this._resources[i];
-            if (resource._itemsTreeElement)
-                resource._itemsTreeElement.updateErrorsAndWarnings();
-        }
-    },
-
-    performSearch: function(query)
-    {
-        for (var i = 0; i < this._resources.length; ++i) {
-            var resource = this._resources[i];
-            if (resource._itemsTreeElement)
-                resource._itemsTreeElement.resetBubble();
-        }
-
-        WebInspector.Panel.prototype.performSearch.call(this, query);
-    },
-
-    get visibleView()
-    {
-        if (this.visibleResource)
-            return this.visibleResource._resourcesView;
-        return this._resourceTrackingEnabled ? null : this.panelEnablerView;
-    },
-
-    get sortingFunction()
-    {
-        return this._sortingFunction;
-    },
-
-    set sortingFunction(x)
-    {
-        this._sortingFunction = x;
-        this._sortResourcesIfNeeded();
-    },
-
-    refresh: function()
-    {
-        WebInspector.AbstractTimelinePanel.prototype.refresh.call(this);
-
-        this._sortResourcesIfNeeded();
-        this._updateSummaryGraph();
-    },
-
-    _updateSummaryGraph: function()
-    {
-        this.summaryBar.update(this._resources);
-    },
-
-    resourceTrackingWasEnabled: function()
-    {
-        this._resourceTrackingEnabled = true;
-        this.reset();
-    },
-
-    resourceTrackingWasDisabled: function()
-    {
-        this._resourceTrackingEnabled = false;
-        this.reset();
-    },
-
-    reset: function()
-    {
-        this.closeVisibleResource();
-
-        delete this.currentQuery;
-        this.searchCanceled();
-
-        if (this._resources) {
-            var resourcesLength = this._resources.length;
-            for (var i = 0; i < resourcesLength; ++i) {
-                var resource = this._resources[i];
-
-                resource.warnings = 0;
-                resource.errors = 0;
-
-                delete resource._resourcesView;
-            }
-        }
-
-        WebInspector.AbstractTimelinePanel.prototype.reset.call(this);
-        
-        this.mainResourceLoadTime = -1;
-        this.mainResourceDOMContentTime = -1;
- 
-        this.viewsContainerElement.removeChildren();
-
-        this.summaryBar.reset();
-
-        if (this._resourceTrackingEnabled) {
-            this.enableToggleButton.title = WebInspector.UIString("Resource tracking enabled. Click to disable.");
-            this.enableToggleButton.toggled = true;
-            this.largerResourcesButton.visible = true;
-            this.sortingSelectElement.removeStyleClass("hidden");
-            this.panelEnablerView.visible = false;
-        } else {
-            this.enableToggleButton.title = WebInspector.UIString("Resource tracking disabled. Click to enable.");
-            this.enableToggleButton.toggled = false;
-            this.largerResourcesButton.visible = false;
-            this.sortingSelectElement.addStyleClass("hidden");
-            this.panelEnablerView.visible = true;
-        }
-    },
-
-    addResource: function(resource)
-    {
-        this._resources.push(resource);
-        this.refreshResource(resource);
-    },
-
-    removeResource: function(resource)
-    {
-        if (this.visibleView === resource._resourcesView)
-            this.closeVisibleResource();
-
-        this.removeItem(resource);
-
-        resource.warnings = 0;
-        resource.errors = 0;
-
-        delete resource._resourcesView;
-    },
-
-    addMessageToResource: function(resource, msg)
-    {
-        if (!resource)
-            return;
-
-        switch (msg.level) {
-        case WebInspector.ConsoleMessage.MessageLevel.Warning:
-            resource.warnings += msg.repeatDelta;
-            break;
-        case WebInspector.ConsoleMessage.MessageLevel.Error:
-            resource.errors += msg.repeatDelta;
-            break;
-        }
-
-        if (!this.currentQuery && resource._itemsTreeElement)
-            resource._itemsTreeElement.updateErrorsAndWarnings();
-
-        var view = this.resourceViewForResource(resource);
-        if (view.addMessage)
-            view.addMessage(msg);
-    },
-
-    clearMessages: function()
-    {
-        var resourcesLength = this._resources.length;
-        for (var i = 0; i < resourcesLength; ++i) {
-            var resource = this._resources[i];
-            resource.warnings = 0;
-            resource.errors = 0;
-
-            if (!this.currentQuery && resource._itemsTreeElement)
-                resource._itemsTreeElement.updateErrorsAndWarnings();
-
-            var view = resource._resourcesView;
-            if (!view || !view.clearMessages)
-                continue;
-            view.clearMessages();
-        }
-    },
-
-    refreshResource: function(resource)
-    {
-        this.refreshItem(resource);
-    },
-
-    recreateViewForResourceIfNeeded: function(resource)
-    {
-        if (!resource || !resource._resourcesView)
-            return;
-
-        var newView = this._createResourceView(resource);
-        if (newView.__proto__ === resource._resourcesView.__proto__)
-            return;
-
-        resource.warnings = 0;
-        resource.errors = 0;
-
-        if (!this.currentQuery && resource._itemsTreeElement)
-            resource._itemsTreeElement.updateErrorsAndWarnings();
-
-        var oldView = resource._resourcesView;
-        var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null;
-
-        resource._resourcesView.detach();
-        delete resource._resourcesView;
-
-        resource._resourcesView = newView;
-
-        newView.headersVisible = oldView.headersVisible;
-
-        if (oldViewParentNode)
-            newView.show(oldViewParentNode);
-
-        WebInspector.panels.scripts.viewRecreated(oldView, newView);
-    },
-
-    canShowSourceLine: function(url, line)
-    {
-        return this._resourceTrackingEnabled && !!WebInspector.resourceForURL(url);
-    },
-
-    showSourceLine: function(url, line)
-    {
-        this.showResource(WebInspector.resourceForURL(url), line);
-    },
-
-    showResource: function(resource, line)
-    {
-        if (!resource)
-            return;
-
-        this.containerElement.addStyleClass("viewing-resource");
-
-        if (this.visibleResource && this.visibleResource._resourcesView)
-            this.visibleResource._resourcesView.hide();
-
-        var view = this.resourceViewForResource(resource);
-        view.headersVisible = true;
-        view.selectContentTab();
-        view.show(this.viewsContainerElement);
-
-        if (line) {
-            if (view.revealLine)
-                view.revealLine(line);
-            if (view.highlightLine)
-                view.highlightLine(line);
-        }
-
-        this.revealAndSelectItem(resource);
-
-        this.visibleResource = resource;
-
-        this.updateSidebarWidth();
-    },
-
-    showView: function(view)
-    {
-        if (!view)
-            return;
-        this.showResource(view.resource);
-    },
-
-    closeVisibleResource: function()
-    {
-        this.containerElement.removeStyleClass("viewing-resource");
-        this._updateDividersLabelBarPosition();
-
-        if (this.visibleResource && this.visibleResource._resourcesView)
-            this.visibleResource._resourcesView.hide();
-        delete this.visibleResource;
-
-        if (this._lastSelectedGraphTreeElement)
-            this._lastSelectedGraphTreeElement.select(true);
-
-        this.updateSidebarWidth();
-    },
-
-    resourceViewForResource: function(resource)
-    {
-        if (!resource)
-            return null;
-        if (!resource._resourcesView)
-            resource._resourcesView = this._createResourceView(resource);
-        return resource._resourcesView;
-    },
-
-    sourceFrameForResource: function(resource)
-    {
-        var view = this.resourceViewForResource(resource);
-        if (!view)
-            return null;
-
-        if (!view.setupSourceFrameIfNeeded)
-            return null;
-
-        // Setting up the source frame requires that we be attached.
-        if (!this.element.parentNode)
-            this.attach();
-
-        view.setupSourceFrameIfNeeded();
-        return view.sourceFrame;
-    },
-
-    _sortResourcesIfNeeded: function()
-    {
-        this.sortItems(this.sortingFunction);
-    },
-
-    updateGraphDividersIfNeeded: function(force)
-    {
-        var proceed = WebInspector.AbstractTimelinePanel.prototype.updateGraphDividersIfNeeded.call(this, force);
-        
-        if (!proceed)
-            return;
-
-        if (this.calculator.startAtZero || !this.calculator.computePercentageFromEventTime) {
-            // If our current sorting method starts at zero, that means it shows all
-            // resources starting at the same point, and so onLoad event and DOMContent
-            // event lines really wouldn't make much sense here, so don't render them.
-            // Additionally, if the calculator doesn't have the computePercentageFromEventTime
-            // function defined, we are probably sorting by size, and event times aren't relevant
-            // in this case.
-            return;
-        }
-
-        if (this.mainResourceLoadTime !== -1) {
-            var percent = this.calculator.computePercentageFromEventTime(this.mainResourceLoadTime);
-
-            var loadDivider = document.createElement("div");
-            loadDivider.className = "resources-onload-divider";
-
-            var loadDividerPadding = document.createElement("div");
-            loadDividerPadding.className = "resources-event-divider-padding";
-            loadDividerPadding.style.left = percent + "%";
-            loadDividerPadding.title = WebInspector.UIString("Load event fired");
-            loadDividerPadding.appendChild(loadDivider);
-
-            this.addEventDivider(loadDividerPadding);
-        }
-        
-        if (this.mainResourceDOMContentTime !== -1) {
-            var percent = this.calculator.computePercentageFromEventTime(this.mainResourceDOMContentTime);
-
-            var domContentDivider = document.createElement("div");
-            domContentDivider.className = "resources-ondomcontent-divider";
-            
-            var domContentDividerPadding = document.createElement("div");
-            domContentDividerPadding.className = "resources-event-divider-padding";
-            domContentDividerPadding.style.left = percent + "%";
-            domContentDividerPadding.title = WebInspector.UIString("DOMContent event fired");
-            domContentDividerPadding.appendChild(domContentDivider);
-
-            this.addEventDivider(domContentDividerPadding);
-        }
-    },
-
-    _graphSelected: function(treeElement)
-    {
-        if (this._lastSelectedGraphTreeElement)
-            this._lastSelectedGraphTreeElement.selectedSortingOptionIndex = this.sortingSelectElement.selectedIndex;
-
-        this._lastSelectedGraphTreeElement = treeElement;
-
-        this.sortingSelectElement.removeChildren();
-        for (var i = 0; i < treeElement.sortingOptions.length; ++i) {
-            var sortingOption = treeElement.sortingOptions[i];
-            var option = document.createElement("option");
-            option.label = sortingOption.name;
-            option.sortingFunction = sortingOption.sortingFunction;
-            option.calculator = sortingOption.calculator;
-            this.sortingSelectElement.appendChild(option);
-        }
-
-        this.sortingSelectElement.selectedIndex = treeElement.selectedSortingOptionIndex;
-        this._changeSortingFunction();
-
-        this.closeVisibleResource();
-        this.containerElement.scrollTop = 0;
-    },
-
-    _toggleLargerResources: function()
-    {
-        if (!this.itemsTreeElement._childrenListNode)
-            return;
-
-        WebInspector.settings.resourcesLargeRows = !WebInspector.settings.resourcesLargeRows;
-        this._setLargerResources(this.itemsTreeElement.smallChildren);
-    },
-
-    _setLargerResources: function(enabled)
-    {
-        this.largerResourcesButton.toggled = enabled;
-        this.itemsTreeElement.smallChildren = !enabled;
-        if (!enabled) {
-            this.itemsGraphsElement.addStyleClass("small");
-            this.largerResourcesButton.title = WebInspector.UIString("Use large resource rows.");
-            this.adjustScrollPosition();
-        } else {
-            this.itemsGraphsElement.removeStyleClass("small");
-            this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows.");
-        }
-    },
-
-    _changeSortingFunction: function()
-    {
-        var selectedOption = this.sortingSelectElement[this.sortingSelectElement.selectedIndex];
-        this.sortingFunction = selectedOption.sortingFunction;
-        this.calculator = this.summaryBar.calculator = selectedOption.calculator;
-    },
-
-    _createResourceView: function(resource)
-    {
-        switch (resource.category) {
-            case WebInspector.resourceCategories.documents:
-            case WebInspector.resourceCategories.stylesheets:
-            case WebInspector.resourceCategories.scripts:
-            case WebInspector.resourceCategories.xhr:
-                return new WebInspector.SourceView(resource);
-            case WebInspector.resourceCategories.images:
-                return new WebInspector.ImageView(resource);
-            case WebInspector.resourceCategories.fonts:
-                return new WebInspector.FontView(resource);
-            default:
-                return new WebInspector.ResourceView(resource);
-        }
-    },
-
-    setSidebarWidth: function(width)
-    {
-        if (this.visibleResource) {
-            this.containerElement.style.width = width + "px";
-            this.sidebarElement.style.removeProperty("width");
-        } else {
-            this.sidebarElement.style.width = width + "px";
-            this.containerElement.style.removeProperty("width");
-        }
-
-        this.sidebarResizeElement.style.left = (width - 3) + "px";
-    },
-
-    updateMainViewWidth: function(width)
-    {
-        this.viewsContainerElement.style.left = width + "px";
-
-        WebInspector.AbstractTimelinePanel.prototype.updateMainViewWidth.call(this, width);
-        this.resize();
-    },
-
-    _enableResourceTracking: function()
-    {
-        if (this._resourceTrackingEnabled)
-            return;
-        this._toggleResourceTracking(this.panelEnablerView.alwaysEnabled);
-    },
-
-    _toggleResourceTracking: function(optionalAlways)
-    {
-        if (this._resourceTrackingEnabled) {
-            this.largerResourcesButton.visible = false;
-            this.sortingSelectElement.visible = false;
-            WebInspector.resources = {};
-            WebInspector.resourceURLMap = {};
-            InspectorBackend.disableResourceTracking(true);
-        } else {
-            this.largerResourcesButton.visible = true;
-            this.sortingSelectElement.visible = true;
-            InspectorBackend.enableResourceTracking(!!optionalAlways);
-        }
-    },
-
-    get _resources()
-    {
-        return this.items;
-    },
-
-    searchIteratesOverViews: function()
-    {
-        return true;
-    }
-}
-
-WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.AbstractTimelinePanel.prototype;
-
-WebInspector.getResourceContent = function(identifier, callback)
+WebInspector.NetworkPanel.prototype = {
+get toolbarItemLabel()
 {
-    InspectorBackend.getResourceContent(WebInspector.Callback.wrap(callback), identifier);
-}
+return WebInspector.UIString("Network");
+},
 
-WebInspector.didGetResourceContent = WebInspector.Callback.processCallback;
-
-WebInspector.ResourceTimeCalculator = function(startAtZero)
+get statusBarItems()
 {
-    WebInspector.AbstractTimelineCalculator.call(this);
-    this.startAtZero = startAtZero;
-}
+return [this._largerResourcesButton.element, this._preserveLogToggle.element, this._clearButton.element, this._filterBarElement];
+},
 
-WebInspector.ResourceTimeCalculator.prototype = {
-    computeSummaryValues: function(resources)
-    {
-        var resourcesByCategory = {};
-        var resourcesLength = resources.length;
-        for (var i = 0; i < resourcesLength; ++i) {
-            var resource = resources[i];
-            if (!(resource.category.name in resourcesByCategory))
-                resourcesByCategory[resource.category.name] = [];
-            resourcesByCategory[resource.category.name].push(resource);
-        }
-
-        var earliestStart;
-        var latestEnd;
-        var categoryValues = {};
-        for (var category in resourcesByCategory) {
-            resourcesByCategory[category].sort(WebInspector.Resource.CompareByTime);
-            categoryValues[category] = 0;
-
-            var segment = {start: -1, end: -1};
-
-            var categoryResources = resourcesByCategory[category];
-            var resourcesLength = categoryResources.length;
-            for (var i = 0; i < resourcesLength; ++i) {
-                var resource = categoryResources[i];
-                if (resource.startTime === -1 || resource.endTime === -1)
-                    continue;
-
-                if (typeof earliestStart === "undefined")
-                    earliestStart = resource.startTime;
-                else
-                    earliestStart = Math.min(earliestStart, resource.startTime);
-
-                if (typeof latestEnd === "undefined")
-                    latestEnd = resource.endTime;
-                else
-                    latestEnd = Math.max(latestEnd, resource.endTime);
-
-                if (resource.startTime <= segment.end) {
-                    segment.end = Math.max(segment.end, resource.endTime);
-                    continue;
-                }
-
-                categoryValues[category] += segment.end - segment.start;
-
-                segment.start = resource.startTime;
-                segment.end = resource.endTime;
-            }
-
-            // Add the last segment
-            categoryValues[category] += segment.end - segment.start;
-        }
-
-        return {categoryValues: categoryValues, total: latestEnd - earliestStart};
-    },
-
-    computeBarGraphPercentages: function(resource)
-    {
-        if (resource.startTime !== -1)
-            var start = ((resource.startTime - this.minimumBoundary) / this.boundarySpan) * 100;
-        else
-            var start = 0;
-
-        if (resource.responseReceivedTime !== -1)
-            var middle = ((resource.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100;
-        else
-            var middle = (this.startAtZero ? start : 100);
-
-        if (resource.endTime !== -1)
-            var end = ((resource.endTime - this.minimumBoundary) / this.boundarySpan) * 100;
-        else
-            var end = (this.startAtZero ? middle : 100);
-
-        if (this.startAtZero) {
-            end -= start;
-            middle -= start;
-            start = 0;
-        }
-
-        return {start: start, middle: middle, end: end};
-    },
-    
-    computePercentageFromEventTime: function(eventTime)
-    {
-        // This function computes a percentage in terms of the total loading time
-        // of a specific event. If startAtZero is set, then this is useless, and we
-        // want to return 0.
-        if (eventTime !== -1 && !this.startAtZero)
-            return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100;
-
-        return 0;
-    },
-
-    computeBarGraphLabels: function(resource)
-    {
-        var rightLabel = "";
-        if (resource.responseReceivedTime !== -1 && resource.endTime !== -1)
-            rightLabel = this.formatValue(resource.endTime - resource.responseReceivedTime);
-
-        var hasLatency = resource.latency > 0;
-        if (hasLatency)
-            var leftLabel = this.formatValue(resource.latency);
-        else
-            var leftLabel = rightLabel;
-
-        if (hasLatency && rightLabel) {
-            var total = this.formatValue(resource.duration);
-            var tooltip = WebInspector.UIString("%s latency, %s download (%s total)", leftLabel, rightLabel, total);
-        } else if (hasLatency)
-            var tooltip = WebInspector.UIString("%s latency", leftLabel);
-        else if (rightLabel)
-            var tooltip = WebInspector.UIString("%s download", rightLabel);
-
-        if (resource.cached)
-            tooltip = WebInspector.UIString("%s (from cache)", tooltip);
-
-        return {left: leftLabel, right: rightLabel, tooltip: tooltip};
-    },
-
-    updateBoundaries: function(resource)
-    {
-        var didChange = false;
-
-        var lowerBound;
-        if (this.startAtZero)
-            lowerBound = 0;
-        else
-            lowerBound = this._lowerBound(resource);
-
-        if (lowerBound !== -1 && (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary)) {
-            this.minimumBoundary = lowerBound;
-            didChange = true;
-        }
-
-        var upperBound = this._upperBound(resource);
-        if (upperBound !== -1 && (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary)) {
-            this.maximumBoundary = upperBound;
-            didChange = true;
-        }
-
-        return didChange;
-    },
-
-    formatValue: function(value)
-    {
-        return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector));
-    },
-
-    _lowerBound: function(resource)
-    {
-        return 0;
-    },
-
-    _upperBound: function(resource)
-    {
-        return 0;
-    }
-}
-
-WebInspector.ResourceTimeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype;
-
-WebInspector.ResourceTransferTimeCalculator = function()
+isCategoryVisible: function(categoryName)
 {
-    WebInspector.ResourceTimeCalculator.call(this, false);
-}
+return true;
+},
 
-WebInspector.ResourceTransferTimeCalculator.prototype = {
-    formatValue: function(value)
-    {
-        return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector));
-    },
-
-    _lowerBound: function(resource)
-    {
-        return resource.startTime;
-    },
-
-    _upperBound: function(resource)
-    {
-        return resource.endTime;
-    }
-}
-
-WebInspector.ResourceTransferTimeCalculator.prototype.__proto__ = WebInspector.ResourceTimeCalculator.prototype;
-
-WebInspector.ResourceTransferDurationCalculator = function()
+elementsToRestoreScrollPositionsFor: function()
 {
-    WebInspector.ResourceTimeCalculator.call(this, true);
-}
+return [this.containerElement];
+},
 
-WebInspector.ResourceTransferDurationCalculator.prototype = {
-    formatValue: function(value)
-    {
-        return Number.secondsToString(value, WebInspector.UIString.bind(WebInspector));
-    },
-
-    _upperBound: function(resource)
-    {
-        return resource.duration;
-    }
-}
-
-WebInspector.ResourceTransferDurationCalculator.prototype.__proto__ = WebInspector.ResourceTimeCalculator.prototype;
-
-WebInspector.ResourceTransferSizeCalculator = function()
+resize: function()
 {
-    WebInspector.AbstractTimelineCalculator.call(this);
-}
+WebInspector.Panel.prototype.resize.call(this);
+this._dataGrid.updateWidths();
+this._positionSummaryBar();
+},
 
-WebInspector.ResourceTransferSizeCalculator.prototype = {
-    computeBarGraphLabels: function(resource)
-    {
-        var networkBytes = this._networkBytes(resource);
-        var resourceBytes = this._value(resource);
-        if (networkBytes && networkBytes !== resourceBytes) {
-            // Transferred size is not the same as reported resource length.
-            var networkBytesString = this.formatValue(networkBytes);
-            var left = networkBytesString;
-            var right = this.formatValue(resourceBytes);
-            var tooltip = right ? WebInspector.UIString("%s (%s transferred)", right, networkBytesString) : right;
-        } else {
-            var left = this.formatValue(resourceBytes);
-            var right = left;
-            var tooltip = left;
-        }
-        if (resource.cached)
-            tooltip = WebInspector.UIString("%s (from cache)", tooltip);
-        return {left: left, right: right, tooltip: tooltip};
-    },
-
-    computeBarGraphPercentages: function(item)
-    {
-        const resourceBytesAsPercent = (this._value(item) / this.boundarySpan) * 100;
-        const networkBytesAsPercent = this._networkBytes(item) ? (this._networkBytes(item) / this.boundarySpan) * 100 : resourceBytesAsPercent;
-        return {start: 0, middle: networkBytesAsPercent, end: resourceBytesAsPercent};
-    },
-
-    _value: function(resource)
-    {
-        return resource.resourceSize;
-    },
-
-    _networkBytes: function(resource)
-    {
-        return resource.transferSize;
-    },
-
-    formatValue: function(value)
-    {
-        return Number.bytesToString(value, WebInspector.UIString.bind(WebInspector));
-    }
-}
-
-WebInspector.ResourceTransferSizeCalculator.prototype.__proto__ = WebInspector.AbstractTimelineCalculator.prototype;
-
-WebInspector.ResourceSidebarTreeElement = function(resource)
+updateSidebarWidth: function(width)
 {
-    this.resource = resource;
+if (!this._viewingResourceMode)
+return;
+WebInspector.Panel.prototype.updateSidebarWidth.call(this, width);
+if (this._summaryBarElement.parentElement === this.element)
+this._summaryBarElement.style.width = width + "px";
+},
 
-    this.createIconElement();
-
-    WebInspector.SidebarTreeElement.call(this, "resource-sidebar-tree-item", "", "", resource);
-
-    this.refreshTitles();
-}
-
-WebInspector.ResourceSidebarTreeElement.prototype = {
-    onattach: function()
-    {
-        WebInspector.SidebarTreeElement.prototype.onattach.call(this);
-
-        this._listItemNode.addStyleClass("resources-category-" + this.resource.category.name);
-        this._listItemNode.draggable = true;
-        
-        // FIXME: should actually add handler to parent, to be resolved via
-        // https://bugs.webkit.org/show_bug.cgi?id=30227
-        this._listItemNode.addEventListener("dragstart", this.ondragstart.bind(this), false);
-        this.updateErrorsAndWarnings();
-    },
-
-    onselect: function()
-    {
-        WebInspector.panels.resources.showResource(this.resource);
-    },
-    
-    ondblclick: function(event)
-    {
-        InjectedScriptAccess.getDefault().openInInspectedWindow(this.resource.url, function() {});
-    },
-
-    ondragstart: function(event) {
-        event.dataTransfer.setData("text/plain", this.resource.url);
-        event.dataTransfer.setData("text/uri-list", this.resource.url + "\r\n");
-        event.dataTransfer.effectAllowed = "copy";
-        return true;
-    },
-
-    get mainTitle()
-    {
-        return this.resource.displayName;
-    },
-
-    set mainTitle(x)
-    {
-        // Do nothing.
-    },
-
-    get subtitle()
-    {
-        var subtitle = this.resource.displayDomain;
-
-        if (this.resource.path && this.resource.lastPathComponent) {
-            var lastPathComponentIndex = this.resource.path.lastIndexOf("/" + this.resource.lastPathComponent);
-            if (lastPathComponentIndex != -1)
-                subtitle += this.resource.path.substring(0, lastPathComponentIndex);
-        }
-
-        return subtitle;
-    },
-
-    set subtitle(x)
-    {
-        // Do nothing.
-    },
-
-    get selectable()
-    {
-        return WebInspector.panels.resources.isCategoryVisible(this.resource.category.name);
-    },
-
-    createIconElement: function()
-    {
-        var previousIconElement = this.iconElement;
-
-        if (this.resource.category === WebInspector.resourceCategories.images) {
-            var previewImage = document.createElement("img");
-            previewImage.className = "image-resource-icon-preview";
-            previewImage.src = this.resource.url;
-
-            this.iconElement = document.createElement("div");
-            this.iconElement.className = "icon";
-            this.iconElement.appendChild(previewImage);
-        } else {
-            this.iconElement = document.createElement("img");
-            this.iconElement.className = "icon";
-        }
-
-        if (previousIconElement)
-            previousIconElement.parentNode.replaceChild(this.iconElement, previousIconElement);
-    },
-
-    refresh: function()
-    {
-        this.refreshTitles();
-
-        if (!this._listItemNode.hasStyleClass("resources-category-" + this.resource.category.name)) {
-            this._listItemNode.removeMatchingStyleClasses("resources-category-\\w+");
-            this._listItemNode.addStyleClass("resources-category-" + this.resource.category.name);
-
-            this.createIconElement();
-        }
-
-        this.tooltip = this.resource.url;
-    },
-
-    resetBubble: function()
-    {
-        this.bubbleText = "";
-        this.bubbleElement.removeStyleClass("search-matches");
-        this.bubbleElement.removeStyleClass("warning");
-        this.bubbleElement.removeStyleClass("error");
-    },
-
-    set searchMatches(matches)
-    {
-        this.resetBubble();
-
-        if (!matches)
-            return;
-
-        this.bubbleText = matches;
-        this.bubbleElement.addStyleClass("search-matches");
-    },
-
-    updateErrorsAndWarnings: function()
-    {
-        this.resetBubble();
-
-        if (this.resource.warnings || this.resource.errors)
-            this.bubbleText = (this.resource.warnings + this.resource.errors);
-
-        if (this.resource.warnings)
-            this.bubbleElement.addStyleClass("warning");
-
-        if (this.resource.errors)
-            this.bubbleElement.addStyleClass("error");
-    }
-}
-
-WebInspector.ResourceSidebarTreeElement.CompareByAscendingStartTime = function(a, b)
+updateMainViewWidth: function(width)
 {
-    return WebInspector.Resource.CompareByStartTime(a.resource, b.resource)
-        || WebInspector.Resource.CompareByEndTime(a.resource, b.resource)
-        || WebInspector.Resource.CompareByResponseReceivedTime(a.resource, b.resource);
-}
+this._viewsContainerElement.style.left = width + "px";
+},
 
-WebInspector.ResourceSidebarTreeElement.CompareByAscendingResponseReceivedTime = function(a, b)
+handleShortcut: function(event)
 {
-    return WebInspector.Resource.CompareByResponseReceivedTime(a.resource, b.resource)
-        || WebInspector.Resource.CompareByStartTime(a.resource, b.resource)
-        || WebInspector.Resource.CompareByEndTime(a.resource, b.resource);
+if (this._viewingResourceMode && event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code) {
+this._toggleGridMode();
+event.handled = true;
 }
+},
 
-WebInspector.ResourceSidebarTreeElement.CompareByAscendingEndTime = function(a, b)
+_positionSummaryBar: function()
 {
-    return WebInspector.Resource.CompareByEndTime(a.resource, b.resource)
-        || WebInspector.Resource.CompareByStartTime(a.resource, b.resource)
-        || WebInspector.Resource.CompareByResponseReceivedTime(a.resource, b.resource);
+
+
+var fillerRow = this._dataGrid.dataTableBody.lastChild;
+if (this._summaryBarElement.parentElement !== this.element && fillerRow.offsetHeight > 0) {
+
+if (this._summaryBarRowNode) {
+this._dataGrid.removeChild(this._summaryBarRowNode);
+delete this._summaryBarRowNode;
+}
+this._summaryBarElement.addStyleClass("network-summary-bar-bottom");
+this._summaryBarElement.style.setProperty("width", this.sidebarElement.offsetWidth + "px");
+this.element.appendChild(this._summaryBarElement);
+this._dataGrid.element.style.bottom = "20px";
+return;
 }
 
-WebInspector.ResourceSidebarTreeElement.CompareByDescendingDuration = function(a, b)
+if (!this._summaryBarRowNode && !fillerRow.offsetHeight) {
+
+this._summaryBarRowNode = new WebInspector.NetworkTotalGridNode(this._summaryBarElement);
+this._summaryBarElement.removeStyleClass("network-summary-bar-bottom");
+this._summaryBarElement.style.removeProperty("width");
+this._dataGrid.appendChild(this._summaryBarRowNode);
+this._dataGrid.element.style.bottom = 0;
+this._sortItems();
+}
+},
+
+_resetSummaryBar: function()
 {
-    return -1 * WebInspector.Resource.CompareByDuration(a.resource, b.resource);
-}
+delete this._summaryBarRowNode;
+this._summaryBarElement.parentElement.removeChild(this._summaryBarElement);
+this._updateSummaryBar();
+},
 
-WebInspector.ResourceSidebarTreeElement.CompareByDescendingLatency = function(a, b)
+_createTimelineGrid: function()
 {
-    return -1 * WebInspector.Resource.CompareByLatency(a.resource, b.resource);
-}
+this._timelineGrid = new WebInspector.TimelineGrid();
+this._timelineGrid.element.addStyleClass("network-timeline-grid");
+this._dataGrid.element.appendChild(this._timelineGrid.element);
+},
 
-WebInspector.ResourceSidebarTreeElement.CompareByDescendingSize = function(a, b)
+_createTable: function()
 {
-    return -1 * WebInspector.Resource.CompareBySize(a.resource, b.resource);
-}
+var columns = {name: {}, method: {}, status: {}, type: {}, size: {}, time: {}, timeline: {}};
+columns.name.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Name"), WebInspector.UIString("Path"));
+columns.name.sortable = true;
+columns.name.width = "20%";
+columns.name.disclosure = true;
 
-WebInspector.ResourceSidebarTreeElement.CompareByDescendingTransferSize = function(a, b)
+columns.method.title = WebInspector.UIString("Method");
+columns.method.sortable = true;
+columns.method.width = "7%";
+
+columns.status.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Status"), WebInspector.UIString("Text"));
+columns.status.sortable = true;
+columns.status.width = "8%";
+
+columns.type.title = WebInspector.UIString("Type");
+columns.type.sortable = true;
+columns.type.width = "10%";
+
+columns.size.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Size"), WebInspector.UIString("Transfer"));
+columns.size.sortable = true;
+columns.size.width = "10%";
+columns.size.aligned = "right";
+
+columns.time.titleDOMFragment = this._makeHeaderFragment(WebInspector.UIString("Time"), WebInspector.UIString("Latency"));
+columns.time.sortable = true;
+columns.time.width = "10%";
+columns.time.aligned = "right";
+
+columns.timeline.title = "";
+columns.timeline.sortable = false;
+columns.timeline.width = "37%";
+columns.timeline.sort = "ascending";
+
+this._dataGrid = new WebInspector.DataGrid(columns);
+this._dataGrid.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
+this.containerElement.appendChild(this._dataGrid.element);
+this._dataGrid.addEventListener("sorting changed", this._sortItems, this);
+this._dataGrid.addEventListener("width changed", this._updateDividersIfNeeded, this);
+
+this._patchTimelineHeader();
+},
+
+_makeHeaderFragment: function(title, subtitle)
 {
-    return -1 * WebInspector.Resource.CompareByTransferSize(a.resource, b.resource);
-}
+var fragment = document.createDocumentFragment();
+fragment.appendChild(document.createTextNode(title));
+var subtitleDiv = document.createElement("div");
+subtitleDiv.className = "network-header-subtitle";
+subtitleDiv.textContent = subtitle;
+fragment.appendChild(subtitleDiv);
+return fragment;
+},
 
-WebInspector.ResourceSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
-
-WebInspector.ResourceGraph = function(resource)
+_patchTimelineHeader: function()
 {
-    this.resource = resource;
+var timelineSorting = document.createElement("select");
 
-    this._graphElement = document.createElement("div");
-    this._graphElement.className = "resources-graph-side";
-    this._graphElement.addEventListener("mouseover", this.refreshLabelPositions.bind(this), false);
+var option = document.createElement("option");
+option.value = "startTime";
+option.label = WebInspector.UIString("Timeline");
+timelineSorting.appendChild(option);
 
-    if (resource.cached)
-        this._graphElement.addStyleClass("resource-cached");
+option = document.createElement("option");
+option.value = "startTime";
+option.label = WebInspector.UIString("Start Time");
+timelineSorting.appendChild(option);
 
-    this._barAreaElement = document.createElement("div");
-    this._barAreaElement.className = "resources-graph-bar-area hidden";
-    this._graphElement.appendChild(this._barAreaElement);
+option = document.createElement("option");
+option.value = "responseTime";
+option.label = WebInspector.UIString("Response Time");
+timelineSorting.appendChild(option);
 
-    this._barLeftElement = document.createElement("div");
-    this._barLeftElement.className = "resources-graph-bar waiting";
-    this._barAreaElement.appendChild(this._barLeftElement);
+option = document.createElement("option");
+option.value = "endTime";
+option.label = WebInspector.UIString("End Time");
+timelineSorting.appendChild(option);
 
-    this._barRightElement = document.createElement("div");
-    this._barRightElement.className = "resources-graph-bar";
-    this._barAreaElement.appendChild(this._barRightElement);
+option = document.createElement("option");
+option.value = "duration";
+option.label = WebInspector.UIString("Duration");
+timelineSorting.appendChild(option);
 
-    this._labelLeftElement = document.createElement("div");
-    this._labelLeftElement.className = "resources-graph-label waiting";
-    this._barAreaElement.appendChild(this._labelLeftElement);
+option = document.createElement("option");
+option.value = "latency";
+option.label = WebInspector.UIString("Latency");
+timelineSorting.appendChild(option);
 
-    this._labelRightElement = document.createElement("div");
-    this._labelRightElement.className = "resources-graph-label";
-    this._barAreaElement.appendChild(this._labelRightElement);
+var header = this._dataGrid.headerTableHeader("timeline");
+header.replaceChild(timelineSorting, header.firstChild);
 
-    this._graphElement.addStyleClass("resources-category-" + resource.category.name);
+timelineSorting.addEventListener("click", function(event) { event.stopPropagation() }, false);
+timelineSorting.addEventListener("change", this._sortByTimeline.bind(this), false);
+this._timelineSortSelector = timelineSorting;
+},
+
+_createSortingFunctions: function()
+{
+this._sortingFunctions = {};
+this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameComparator;
+this._sortingFunctions.method = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "method", false);
+this._sortingFunctions.status = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "statusCode", false);
+this._sortingFunctions.type = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "mimeType", false);
+this._sortingFunctions.size = WebInspector.NetworkDataGridNode.SizeComparator;
+this._sortingFunctions.time = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "duration", false);
+this._sortingFunctions.timeline = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "startTime", false);
+this._sortingFunctions.startTime = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "startTime", false);
+this._sortingFunctions.endTime = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "endTime", false);
+this._sortingFunctions.responseTime = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "responseReceivedTime", false);
+this._sortingFunctions.duration = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "duration", true);
+this._sortingFunctions.latency = WebInspector.NetworkDataGridNode.ResourcePropertyComparator.bind(null, "latency", true);
+
+var timeCalculator = new WebInspector.NetworkTransferTimeCalculator();
+var durationCalculator = new WebInspector.NetworkTransferDurationCalculator();
+
+this._calculators = {};
+this._calculators.timeline = timeCalculator;
+this._calculators.startTime = timeCalculator;
+this._calculators.endTime = timeCalculator;
+this._calculators.responseTime = timeCalculator;
+this._calculators.duration = durationCalculator;
+this._calculators.latency = durationCalculator;
+},
+
+_sortItems: function()
+{
+var columnIdentifier = this._dataGrid.sortColumnIdentifier;
+if (columnIdentifier === "timeline") {
+this._sortByTimeline();
+return;
+}
+var sortingFunction = this._sortingFunctions[columnIdentifier];
+if (!sortingFunction)
+return;
+
+this._dataGrid.sortNodes(sortingFunction, this._dataGrid.sortOrder === "descending");
+this._timelineSortSelector.selectedIndex = 0;
+},
+
+_sortByTimeline: function()
+{
+var selectedIndex = this._timelineSortSelector.selectedIndex;
+if (!selectedIndex)
+selectedIndex = 1; 
+var selectedOption = this._timelineSortSelector[selectedIndex];
+var value = selectedOption.value;
+
+var sortingFunction = this._sortingFunctions[value];
+this._dataGrid.sortNodes(sortingFunction);
+this.calculator = this._calculators[value];
+if (this.calculator.startAtZero)
+this._timelineGrid.hideEventDividers();
+else
+this._timelineGrid.showEventDividers();
+this._dataGrid.markColumnAsSortedBy("timeline", "ascending");
+},
+
+_createFilterStatusBarItems: function()
+{
+var filterBarElement = document.createElement("div");
+filterBarElement.className = "scope-bar status-bar-item";
+filterBarElement.id = "network-filter";
+
+function createFilterElement(category, label)
+{
+var categoryElement = document.createElement("li");
+categoryElement.category = category;
+categoryElement.className = category;
+categoryElement.appendChild(document.createTextNode(label));
+categoryElement.addEventListener("click", this._updateFilter.bind(this), false);
+filterBarElement.appendChild(categoryElement);
+
+return categoryElement;
 }
 
-WebInspector.ResourceGraph.prototype = {
-    get graphElement()
-    {
-        return this._graphElement;
-    },
+this._filterAllElement = createFilterElement.call(this, "all", WebInspector.UIString("All"));
 
-    refreshLabelPositions: function()
-    {
-        this._labelLeftElement.style.removeProperty("left");
-        this._labelLeftElement.style.removeProperty("right");
-        this._labelLeftElement.removeStyleClass("before");
-        this._labelLeftElement.removeStyleClass("hidden");
 
-        this._labelRightElement.style.removeProperty("left");
-        this._labelRightElement.style.removeProperty("right");
-        this._labelRightElement.removeStyleClass("after");
-        this._labelRightElement.removeStyleClass("hidden");
+var dividerElement = document.createElement("div");
+dividerElement.addStyleClass("scope-bar-divider");
+filterBarElement.appendChild(dividerElement);
 
-        const labelPadding = 10;
-        const barRightElementOffsetWidth = this._barRightElement.offsetWidth;
-        const barLeftElementOffsetWidth = this._barLeftElement.offsetWidth;
+for (var category in this._categories)
+createFilterElement.call(this, category, this._categories[category].title);
+this._filterBarElement = filterBarElement;
+},
 
-        if (this._isBarOpaqueAtLeft) {
-            var leftBarWidth = barLeftElementOffsetWidth - labelPadding;
-            var rightBarWidth = (barRightElementOffsetWidth - barLeftElementOffsetWidth) - labelPadding;
-        } else {
-            var leftBarWidth = (barLeftElementOffsetWidth - barRightElementOffsetWidth) - labelPadding;
-            var rightBarWidth = barRightElementOffsetWidth - labelPadding;
-        }
+_createSummaryBar: function()
+{
+this._summaryBarElement = document.createElement("div");
+this._summaryBarElement.className = "network-summary-bar";
+this.containerElement.appendChild(this._summaryBarElement);
+},
 
-        const labelLeftElementOffsetWidth = this._labelLeftElement.offsetWidth;
-        const labelRightElementOffsetWidth = this._labelRightElement.offsetWidth;
+_updateSummaryBar: function()
+{
+this._positionSummaryBar(); 
+var numRequests = this._resources.length;
 
-        const labelBefore = (labelLeftElementOffsetWidth > leftBarWidth);
-        const labelAfter = (labelRightElementOffsetWidth > rightBarWidth);
-        const graphElementOffsetWidth = this._graphElement.offsetWidth;
+if (!numRequests) {
+if (this._summaryBarElement._isDisplayingWarning)
+return;
+this._summaryBarElement._isDisplayingWarning = true;
 
-        if (labelBefore && (graphElementOffsetWidth * (this._percentages.start / 100)) < (labelLeftElementOffsetWidth + 10))
-            var leftHidden = true;
+var img = document.createElement("img");
+img.src = "Images/warningIcon.png";
+this._summaryBarElement.removeChildren();
+this._summaryBarElement.appendChild(img);
+this._summaryBarElement.appendChild(document.createTextNode(" "));
+this._summaryBarElement.appendChild(document.createTextNode(
+WebInspector.UIString("No requests captured. Reload the page to see detailed information on the network activity.")));
+return;
+}
+delete this._summaryBarElement._isDisplayingWarning;
 
-        if (labelAfter && (graphElementOffsetWidth * ((100 - this._percentages.end) / 100)) < (labelRightElementOffsetWidth + 10))
-            var rightHidden = true;
+var transferSize = 0;
+var baseTime = -1;
+var maxTime = -1;
+for (var i = 0; i < this._resources.length; ++i) {
+var resource = this._resources[i];
+transferSize += (resource.cached || !resource.transferSize) ? 0 : resource.transferSize;
+if (resource.isMainResource)
+baseTime = resource.startTime;
+if (resource.endTime > maxTime)
+maxTime = resource.endTime;
+}
+var text = String.sprintf(WebInspector.UIString("%d requests"), numRequests);
+text += "  \u2758  " + String.sprintf(WebInspector.UIString("%s transferred"), Number.bytesToString(transferSize));
+if (baseTime !== -1 && this._mainResourceLoadTime !== -1 && this._mainResourceDOMContentTime !== -1 && this._mainResourceDOMContentTime > baseTime) {
+text += "  \u2758  " + String.sprintf(WebInspector.UIString("%s (onload: %s, DOMContentLoaded: %s)"),
+Number.secondsToString(maxTime - baseTime),
+Number.secondsToString(this._mainResourceLoadTime - baseTime),
+Number.secondsToString(this._mainResourceDOMContentTime - baseTime));
+}
+this._summaryBarElement.textContent = text;
+},
 
-        if (barLeftElementOffsetWidth == barRightElementOffsetWidth) {
-            // The left/right label data are the same, so a before/after label can be replaced by an on-bar label.
-            if (labelBefore && !labelAfter)
-                leftHidden = true;
-            else if (labelAfter && !labelBefore)
-                rightHidden = true;
-        }
+_showCategory: function(category)
+{
+this._dataGrid.element.addStyleClass("filter-" + category);
+delete this._hiddenCategories[category];
+},
 
-        if (labelBefore) {
-            if (leftHidden)
-                this._labelLeftElement.addStyleClass("hidden");
-            this._labelLeftElement.style.setProperty("right", (100 - this._percentages.start) + "%");
-            this._labelLeftElement.addStyleClass("before");
-        } else {
-            this._labelLeftElement.style.setProperty("left", this._percentages.start + "%");
-            this._labelLeftElement.style.setProperty("right", (100 - this._percentages.middle) + "%");
-        }
+_hideCategory: function(category)
+{
+this._dataGrid.element.removeStyleClass("filter-" + category);
+this._hiddenCategories[category] = true;
+},
 
-        if (labelAfter) {
-            if (rightHidden)
-                this._labelRightElement.addStyleClass("hidden");
-            this._labelRightElement.style.setProperty("left", this._percentages.end + "%");
-            this._labelRightElement.addStyleClass("after");
-        } else {
-            this._labelRightElement.style.setProperty("left", this._percentages.middle + "%");
-            this._labelRightElement.style.setProperty("right", (100 - this._percentages.end) + "%");
-        }
-    },
+_updateFilter: function(e)
+{
+var isMac = WebInspector.isMac();
+var selectMultiple = false;
+if (isMac && e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey)
+selectMultiple = true;
+if (!isMac && e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey)
+selectMultiple = true;
 
-    refresh: function(calculator, isBarOpaqueAtLeft)
-    {
-        var percentages = calculator.computeBarGraphPercentages(this.resource);
-        var labels = calculator.computeBarGraphLabels(this.resource);
+this._filter(e.target, selectMultiple);
+this._positionSummaryBar();
+},
 
-        this._percentages = percentages;
+_filter: function(target, selectMultiple)
+{
+function unselectAll()
+{
+for (var i = 0; i < this._filterBarElement.childNodes.length; ++i) {
+var child = this._filterBarElement.childNodes[i];
+if (!child.category)
+continue;
 
-        this._barAreaElement.removeStyleClass("hidden");
-
-        if (!this._graphElement.hasStyleClass("resources-category-" + this.resource.category.name)) {
-            this._graphElement.removeMatchingStyleClasses("resources-category-\\w+");
-            this._graphElement.addStyleClass("resources-category-" + this.resource.category.name);
-        }
-
-        this._barLeftElement.style.setProperty("left", percentages.start + "%");
-        this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%");
-
-        if (!isBarOpaqueAtLeft) {
-            this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%");
-            this._barRightElement.style.setProperty("left", percentages.middle + "%");
-
-            if (this._isBarOpaqueAtLeft != isBarOpaqueAtLeft) {
-                this._barLeftElement.addStyleClass("waiting");
-                this._barRightElement.removeStyleClass("waiting-right");
-                this._labelLeftElement.addStyleClass("waiting");
-                this._labelRightElement.removeStyleClass("waiting-right");
-            }
-        } else {
-            this._barLeftElement.style.setProperty("right", (100 - percentages.middle) + "%");
-            this._barRightElement.style.setProperty("left", percentages.start + "%");
-
-            if (this._isBarOpaqueAtLeft != isBarOpaqueAtLeft) {
-                this._barLeftElement.removeStyleClass("waiting");
-                this._barRightElement.addStyleClass("waiting-right");
-                this._labelLeftElement.removeStyleClass("waiting");
-                this._labelRightElement.addStyleClass("waiting-right");
-            }
-        }
-
-        this._isBarOpaqueAtLeft = isBarOpaqueAtLeft;
-
-        this._labelLeftElement.textContent = labels.left;
-        this._labelRightElement.textContent = labels.right;
-
-        var tooltip = (labels.tooltip || "");
-        this._barLeftElement.title = tooltip;
-        this._labelLeftElement.title = tooltip;
-        this._labelRightElement.title = tooltip;
-        this._barRightElement.title = tooltip;
-    }
+child.removeStyleClass("selected");
+this._hideCategory(child.category);
+}
 }
 
-/* InjectedFakeWorker.js */
+if (target.category === this._filterAllElement) {
+if (target.hasStyleClass("selected")) {
 
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+return;
+}
 
-var InjectedFakeWorker = function()
+
+unselectAll.call(this);
+} else {
+
+if (this._filterAllElement.hasStyleClass("selected")) {
+this._filterAllElement.removeStyleClass("selected");
+this._hideCategory("all");
+}
+}
+
+if (!selectMultiple) {
+
+
+unselectAll.call(this);
+
+target.addStyleClass("selected");
+this._showCategory(target.category);
+return;
+}
+
+if (target.hasStyleClass("selected")) {
+
+
+target.removeStyleClass("selected");
+this._hideCategory(target.category);
+} else {
+
+
+target.addStyleClass("selected");
+this._showCategory(target.category);
+}
+},
+
+_scheduleRefresh: function()
+{
+if (this._needsRefresh)
+return;
+
+this._needsRefresh = true;
+
+if (this.visible && !("_refreshTimeout" in this))
+this._refreshTimeout = setTimeout(this.refresh.bind(this), 500);
+},
+
+_updateDividersIfNeeded: function(force)
+{
+var timelineColumn = this._dataGrid.columns.timeline;
+for (var i = 0; i < this._dataGrid.resizers.length; ++i) {
+if (timelineColumn.ordinal === this._dataGrid.resizers[i].rightNeighboringColumnID) {
+
+this._timelineGrid.element.style.left = this._dataGrid.resizers[i].style.left;
+this._timelineGrid.element.style.right = "18px";
+}
+}
+
+var proceed = true;
+if (!this.visible) {
+this._scheduleRefresh();
+proceed = false;
+} else
+proceed = this._timelineGrid.updateDividers(force, this.calculator);
+
+if (!proceed)
+return;
+
+if (this.calculator.startAtZero || !this.calculator.computePercentageFromEventTime) {
+
+
+
+
+
+
+return;
+}
+
+this._timelineGrid.removeEventDividers();
+if (this._mainResourceLoadTime !== -1) {
+var percent = this.calculator.computePercentageFromEventTime(this._mainResourceLoadTime);
+
+var loadDivider = document.createElement("div");
+loadDivider.className = "network-event-divider network-red-divider";
+
+var loadDividerPadding = document.createElement("div");
+loadDividerPadding.className = "network-event-divider-padding";
+loadDividerPadding.title = WebInspector.UIString("Load event fired");
+loadDividerPadding.appendChild(loadDivider);
+loadDividerPadding.style.left = percent + "%";
+this._timelineGrid.addEventDivider(loadDividerPadding);
+}
+
+if (this._mainResourceDOMContentTime !== -1) {
+var percent = this.calculator.computePercentageFromEventTime(this._mainResourceDOMContentTime);
+
+var domContentDivider = document.createElement("div");
+domContentDivider.className = "network-event-divider network-blue-divider";
+
+var domContentDividerPadding = document.createElement("div");
+domContentDividerPadding.className = "network-event-divider-padding";
+domContentDividerPadding.title = WebInspector.UIString("DOMContent event fired");
+domContentDividerPadding.appendChild(domContentDivider);
+domContentDividerPadding.style.left = percent + "%";
+this._timelineGrid.addEventDivider(domContentDividerPadding);
+}
+},
+
+_refreshIfNeeded: function()
+{
+if (this._needsRefresh)
+this.refresh();
+},
+
+_invalidateAllItems: function()
+{
+this._staleResources = this._resources.slice();
+},
+
+get calculator()
+{
+return this._calculator;
+},
+
+set calculator(x)
+{
+if (!x || this._calculator === x)
+return;
+
+this._calculator = x;
+this._calculator.reset();
+
+this._invalidateAllItems();
+this.refresh();
+},
+
+_resourceGridNode: function(resource)
+{
+return this._resourceGridNodes[resource.identifier];
+},
+
+revealAndSelectItem: function(resource)
+{
+var node = this._resourceGridNode(resource);
+if (node) {
+node.reveal();
+node.select(true);
+}
+},
+
+addEventDivider: function(divider)
+{
+this._timelineGrid.addEventDivider(divider);
+},
+
+_createStatusbarButtons: function()
+{
+this._preserveLogToggle = new WebInspector.StatusBarButton(WebInspector.UIString("Preserve Log upon Navigation"), "record-profile-status-bar-item");
+this._preserveLogToggle.addEventListener("click", this._onPreserveLogClicked.bind(this), false);
+
+this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-status-bar-item");
+this._clearButton.addEventListener("click", this._reset.bind(this), false);
+
+this._largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "network-larger-resources-status-bar-item");
+this._largerResourcesButton.toggled = WebInspector.settings.resourcesLargeRows;
+this._largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false);
+},
+
+set mainResourceLoadTime(x)
+{
+if (this._mainResourceLoadTime === x)
+return;
+
+this._mainResourceLoadTime = x || -1;
+
+this._updateDividersIfNeeded(true);
+},
+
+set mainResourceDOMContentTime(x)
+{
+if (this._mainResourceDOMContentTime === x)
+return;
+
+this._mainResourceDOMContentTime = x || -1;
+this._updateDividersIfNeeded(true);
+},
+
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+this._refreshIfNeeded();
+
+if (this.visibleView)
+this.visibleView.show(this._viewsContainerElement);
+
+this._dataGrid.updateWidths();
+this._positionSummaryBar();
+},
+
+hide: function()
+{
+WebInspector.Panel.prototype.hide.call(this);
+this._popoverHelper.hidePopup();
+},
+
+get searchableViews()
+{
+var views = [];
+return views;
+},
+
+searchMatchFound: function(view, matches)
+{
+this._resourceGridNode(view.resource).searchMatches = matches;
+},
+
+searchCanceled: function(startingNewSearch)
+{
+WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
+
+if (startingNewSearch || !this._resources)
+return;
+},
+
+performSearch: function(query)
+{
+WebInspector.Panel.prototype.performSearch.call(this, query);
+},
+
+refresh: function()
+{
+this._needsRefresh = false;
+if ("_refreshTimeout" in this) {
+clearTimeout(this._refreshTimeout);
+delete this._refreshTimeout;
+}
+
+var wasScrolledToLastRow = this._dataGrid.isScrolledToLastRow();
+var staleItemsLength = this._staleResources.length;
+var boundariesChanged = false;
+
+for (var i = 0; i < staleItemsLength; ++i) {
+var resource = this._staleResources[i];
+var node = this._resourceGridNode(resource);
+if (!node) {
+
+node = new WebInspector.NetworkDataGridNode(this, resource);
+this._resourceGridNodes[resource.identifier] = node;
+this._dataGrid.appendChild(node);
+}
+node.refreshResource();
+
+if (this.calculator.updateBoundaries(resource))
+boundariesChanged = true;
+}
+
+if (boundariesChanged) {
+
+this._invalidateAllItems();
+staleItemsLength = this._staleResources.length;
+}
+
+for (var i = 0; i < staleItemsLength; ++i)
+this._resourceGridNode(this._staleResources[i]).refreshGraph(this.calculator);
+
+this._staleResources = [];
+this._sortItems();
+this._updateSummaryBar();
+this._dataGrid.updateWidths();
+
+if (wasScrolledToLastRow)
+this._dataGrid.scrollToLastRow();
+},
+
+_onPreserveLogClicked: function(e)
+{
+this._preserveLogToggle.toggled = !this._preserveLogToggle.toggled;
+},
+
+reset: function()
+{
+if (!this._preserveLogToggle.toggled)
+this._reset();
+},
+
+_reset: function()
+{
+this._popoverHelper.hidePopup();
+this._closeVisibleResource();
+
+this._toggleGridMode();
+
+
+if (this._calculator)
+this._calculator.reset();
+
+this._resources = [];
+this._resourcesById = {};
+this._resourcesByURL = {};
+this._staleResources = [];
+this._resourceGridNodes = {};
+
+this._dataGrid.removeChildren();
+delete this._summaryBarRowNode;
+this._updateDividersIfNeeded(true);
+
+
+this._mainResourceLoadTime = -1;
+this._mainResourceDOMContentTime = -1;
+
+this._viewsContainerElement.removeChildren();
+this._viewsContainerElement.appendChild(this._closeButtonElement);
+this._resetSummaryBar();
+},
+
+get resources()
+{
+return this._resourcesById;
+},
+
+refreshResource: function(resource)
+{
+if (!resource.identifier)
+resource.identifier = "network:" + this._lastIdentifier++;
+
+if (!this._resourcesById[resource.identifier]) {
+this._resources.push(resource);
+this._resourcesById[resource.identifier] = resource;
+this._resourcesByURL[resource.url] = resource;
+
+
+if (resource.redirects) {
+for (var i = 0; i < resource.redirects.length; ++i)
+this.refreshResource(resource.redirects[i]);
+}
+}
+
+this._staleResources.push(resource);
+this._scheduleRefresh();
+
+if (!resource)
+return;
+
+var oldView = WebInspector.ResourceManager.existingResourceViewForResource(resource);
+if (!oldView)
+return;
+
+if (WebInspector.ResourceManager.resourceViewTypeMatchesResource(resource))
+return;
+
+var newView = WebInspector.ResourceManager.recreateResourceView(resource);
+if (this.visibleView === oldView)
+this.visibleView = newView;
+},
+
+canShowSourceLine: function(url, line)
+{
+return !!this._resourcesByURL[url];
+},
+
+showSourceLine: function(url, line)
+{
+this._showResource(this._resourcesByURL[url], line);
+},
+
+_showResource: function(resource, line)
+{
+if (!resource)
+return;
+
+this._popoverHelper.hidePopup();
+
+this._toggleViewingResourceMode();
+
+if (this.visibleView) {
+this.visibleView.detach();
+delete this.visibleView;
+}
+
+var view = new WebInspector.NetworkItemView(resource);
+view.show(this._viewsContainerElement);
+this.visibleView = view;
+
+this.updateSidebarWidth();
+},
+
+_closeVisibleResource: function()
+{
+this.element.removeStyleClass("viewing-resource");
+
+if (this.visibleView) {
+this.visibleView.detach();
+delete this.visibleView;
+}
+
+if (this._lastSelectedGraphTreeElement)
+this._lastSelectedGraphTreeElement.select(true);
+
+this.updateSidebarWidth();
+},
+
+_toggleLargerResources: function()
+{
+WebInspector.settings.resourcesLargeRows = !WebInspector.settings.resourcesLargeRows;
+this._setLargerResources(WebInspector.settings.resourcesLargeRows);
+},
+
+_setLargerResources: function(enabled)
+{
+this._largerResourcesButton.toggled = enabled;
+if (!enabled) {
+this._largerResourcesButton.title = WebInspector.UIString("Use large resource rows.");
+this._dataGrid.element.addStyleClass("small");
+this._timelineGrid.element.addStyleClass("small");
+this._viewsContainerElement.addStyleClass("small");
+} else {
+this._largerResourcesButton.title = WebInspector.UIString("Use small resource rows.");
+this._dataGrid.element.removeStyleClass("small");
+this._timelineGrid.element.removeStyleClass("small");
+this._viewsContainerElement.removeStyleClass("small");
+}
+this._positionSummaryBar();
+},
+
+_getPopoverAnchor: function(element)
+{
+var anchor = element.enclosingNodeOrSelfWithClass("network-graph-bar") || element.enclosingNodeOrSelfWithClass("network-graph-label");
+if (!anchor)
+return null;
+var resource = anchor.parentElement.resource;
+return resource && resource.timing ? anchor : null;
+},
+
+_showPopover: function(anchor)
+{
+var resource = anchor.parentElement.resource;
+var tableElement = WebInspector.ResourceTimingView.createTimingTable(resource);
+var popover = new WebInspector.Popover(tableElement);
+popover.show(anchor);
+return popover;
+},
+
+_toggleGridMode: function()
+{
+if (this._viewingResourceMode) {
+this._viewingResourceMode = false;
+this.element.removeStyleClass("viewing-resource");
+this._dataGrid.element.removeStyleClass("viewing-resource-mode");
+this._viewsContainerElement.addStyleClass("hidden");
+this.sidebarElement.style.right = 0;
+this.sidebarElement.style.removeProperty("width");
+this._summaryBarElement.style.removeProperty("width");
+if (this._dataGrid.selectedNode)
+this._dataGrid.selectedNode.selected = false;
+}
+
+if (this._briefGrid) {
+this._dataGrid.element.removeStyleClass("full-grid-mode");
+this._dataGrid.element.addStyleClass("brief-grid-mode");
+
+this._dataGrid.hideColumn("method");
+this._dataGrid.hideColumn("status");
+this._dataGrid.hideColumn("type");
+this._dataGrid.hideColumn("size");
+this._dataGrid.hideColumn("time");
+
+var widths = {};
+widths.name = 20;
+widths.timeline = 80;
+} else {
+this._dataGrid.element.addStyleClass("full-grid-mode");
+this._dataGrid.element.removeStyleClass("brief-grid-mode");
+
+this._dataGrid.showColumn("method");
+this._dataGrid.showColumn("status");
+this._dataGrid.showColumn("type");
+this._dataGrid.showColumn("size");
+this._dataGrid.showColumn("time");
+
+var widths = {};
+widths.name = 20;
+widths.method = 7;
+widths.status = 8;
+widths.type = 10;
+widths.size = 10;
+widths.time = 10;
+widths.timeline = 37;
+}
+
+this._dataGrid.showColumn("timeline");
+this._dataGrid.applyColumnWidthsMap(widths);
+
+},
+
+_toggleViewingResourceMode: function()
+{
+if (this._viewingResourceMode)
+return;
+this._viewingResourceMode = true;
+this._preservedColumnWidths = this._dataGrid.columnWidthsMap();
+
+this.element.addStyleClass("viewing-resource");
+this._dataGrid.element.addStyleClass("viewing-resource-mode");
+this._dataGrid.element.removeStyleClass("full-grid-mode");
+this._dataGrid.element.removeStyleClass("brief-grid-mode");
+
+this._dataGrid.hideColumn("method");
+this._dataGrid.hideColumn("status");
+this._dataGrid.hideColumn("type");
+this._dataGrid.hideColumn("size");
+this._dataGrid.hideColumn("time");
+this._dataGrid.hideColumn("timeline");
+
+this._viewsContainerElement.removeStyleClass("hidden");
+this.updateSidebarWidth(200);
+
+var widths = {};
+widths.name = 100;
+this._dataGrid.applyColumnWidthsMap(widths);
+},
+
+_contextMenu: function(event)
+{
+
+if (typeof window.createObjectURL !== "function" || !Preferences.resourceExportEnabled)
+return;
+
+var contextMenu = new WebInspector.ContextMenu();
+var gridNode = this._dataGrid.dataGridNodeFromNode(event.target);
+var resource = gridNode && gridNode._resource;
+if (resource)
+contextMenu.appendItem(WebInspector.UIString("Export to HAR"), this._exportResource.bind(this, resource));
+contextMenu.appendItem(WebInspector.UIString("Export all to HAR"), this._exportAll.bind(this));
+contextMenu.show(event);
+},
+
+_exportAll: function()
+{
+var harArchive = {
+log: (new WebInspector.HARLog()).build()
+}
+offerFileForDownload(JSON.stringify(harArchive));
+},
+
+_exportResource: function(resource)
+{
+var har = (new WebInspector.HAREntry(resource)).build();
+offerFileForDownload(JSON.stringify(har));
+}
+}
+
+WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.NetworkBaseCalculator = function()
+{
+}
+
+WebInspector.NetworkBaseCalculator.prototype = {
+computeSummaryValues: function(items)
+{
+var total = 0;
+var categoryValues = {};
+
+var itemsLength = items.length;
+for (var i = 0; i < itemsLength; ++i) {
+var item = items[i];
+var value = this._value(item);
+if (typeof value === "undefined")
+continue;
+if (!(item.category.name in categoryValues))
+categoryValues[item.category.name] = 0;
+categoryValues[item.category.name] += value;
+total += value;
+}
+
+return {categoryValues: categoryValues, total: total};
+},
+
+computeBarGraphPercentages: function(item)
+{
+return {start: 0, middle: 0, end: (this._value(item) / this.boundarySpan) * 100};
+},
+
+computeBarGraphLabels: function(item)
+{
+const label = this.formatValue(this._value(item));
+return {left: label, right: label, tooltip: label};
+},
+
+get boundarySpan()
+{
+return this.maximumBoundary - this.minimumBoundary;
+},
+
+updateBoundaries: function(item)
+{
+this.minimumBoundary = 0;
+
+var value = this._value(item);
+if (typeof this.maximumBoundary === "undefined" || value > this.maximumBoundary) {
+this.maximumBoundary = value;
+return true;
+}
+return false;
+},
+
+reset: function()
+{
+delete this.minimumBoundary;
+delete this.maximumBoundary;
+},
+
+_value: function(item)
+{
+return 0;
+},
+
+formatValue: function(value)
+{
+return value.toString();
+}
+}
+
+WebInspector.NetworkTimeCalculator = function(startAtZero)
+{
+WebInspector.NetworkBaseCalculator.call(this);
+this.startAtZero = startAtZero;
+}
+
+WebInspector.NetworkTimeCalculator.prototype = {
+computeSummaryValues: function(resources)
+{
+var resourcesByCategory = {};
+var resourcesLength = resources.length;
+for (var i = 0; i < resourcesLength; ++i) {
+var resource = resources[i];
+if (!(resource.category.name in resourcesByCategory))
+resourcesByCategory[resource.category.name] = [];
+resourcesByCategory[resource.category.name].push(resource);
+}
+
+var earliestStart;
+var latestEnd;
+var categoryValues = {};
+for (var category in resourcesByCategory) {
+resourcesByCategory[category].sort(WebInspector.Resource.CompareByTime);
+categoryValues[category] = 0;
+
+var segment = {start: -1, end: -1};
+
+var categoryResources = resourcesByCategory[category];
+var resourcesLength = categoryResources.length;
+for (var i = 0; i < resourcesLength; ++i) {
+var resource = categoryResources[i];
+if (resource.startTime === -1 || resource.endTime === -1)
+continue;
+
+if (typeof earliestStart === "undefined")
+earliestStart = resource.startTime;
+else
+earliestStart = Math.min(earliestStart, resource.startTime);
+
+if (typeof latestEnd === "undefined")
+latestEnd = resource.endTime;
+else
+latestEnd = Math.max(latestEnd, resource.endTime);
+
+if (resource.startTime <= segment.end) {
+segment.end = Math.max(segment.end, resource.endTime);
+continue;
+}
+
+categoryValues[category] += segment.end - segment.start;
+
+segment.start = resource.startTime;
+segment.end = resource.endTime;
+}
+
+
+categoryValues[category] += segment.end - segment.start;
+}
+
+return {categoryValues: categoryValues, total: latestEnd - earliestStart};
+},
+
+computeBarGraphPercentages: function(resource)
+{
+if (resource.startTime !== -1)
+var start = ((resource.startTime - this.minimumBoundary) / this.boundarySpan) * 100;
+else
+var start = 0;
+
+if (resource.responseReceivedTime !== -1)
+var middle = ((resource.responseReceivedTime - this.minimumBoundary) / this.boundarySpan) * 100;
+else
+var middle = (this.startAtZero ? start : 100);
+
+if (resource.endTime !== -1)
+var end = ((resource.endTime - this.minimumBoundary) / this.boundarySpan) * 100;
+else
+var end = (this.startAtZero ? middle : 100);
+
+if (this.startAtZero) {
+end -= start;
+middle -= start;
+start = 0;
+}
+
+return {start: start, middle: middle, end: end};
+},
+
+computePercentageFromEventTime: function(eventTime)
+{
+
+
+
+if (eventTime !== -1 && !this.startAtZero)
+return ((eventTime - this.minimumBoundary) / this.boundarySpan) * 100;
+
+return 0;
+},
+
+computeBarGraphLabels: function(resource)
+{
+var rightLabel = "";
+if (resource.responseReceivedTime !== -1 && resource.endTime !== -1)
+rightLabel = this.formatValue(resource.endTime - resource.responseReceivedTime);
+
+var hasLatency = resource.latency > 0;
+if (hasLatency)
+var leftLabel = this.formatValue(resource.latency);
+else
+var leftLabel = rightLabel;
+
+if (resource.timing)
+return {left: leftLabel, right: rightLabel};
+
+if (hasLatency && rightLabel) {
+var total = this.formatValue(resource.duration);
+var tooltip = WebInspector.UIString("%s latency, %s download (%s total)", leftLabel, rightLabel, total);
+} else if (hasLatency)
+var tooltip = WebInspector.UIString("%s latency", leftLabel);
+else if (rightLabel)
+var tooltip = WebInspector.UIString("%s download", rightLabel);
+
+if (resource.cached)
+tooltip = WebInspector.UIString("%s (from cache)", tooltip);
+return {left: leftLabel, right: rightLabel, tooltip: tooltip};
+},
+
+updateBoundaries: function(resource)
+{
+var didChange = false;
+
+var lowerBound;
+if (this.startAtZero)
+lowerBound = 0;
+else
+lowerBound = this._lowerBound(resource);
+
+if (lowerBound !== -1 && (typeof this.minimumBoundary === "undefined" || lowerBound < this.minimumBoundary)) {
+this.minimumBoundary = lowerBound;
+didChange = true;
+}
+
+var upperBound = this._upperBound(resource);
+if (upperBound !== -1 && (typeof this.maximumBoundary === "undefined" || upperBound > this.maximumBoundary)) {
+this.maximumBoundary = upperBound;
+didChange = true;
+}
+
+return didChange;
+},
+
+formatValue: function(value)
+{
+return Number.secondsToString(value, WebInspector.UIString);
+},
+
+_lowerBound: function(resource)
+{
+return 0;
+},
+
+_upperBound: function(resource)
+{
+return 0;
+}
+}
+
+WebInspector.NetworkTimeCalculator.prototype.__proto__ = WebInspector.NetworkBaseCalculator.prototype;
+
+WebInspector.NetworkTransferTimeCalculator = function()
+{
+WebInspector.NetworkTimeCalculator.call(this, false);
+}
+
+WebInspector.NetworkTransferTimeCalculator.prototype = {
+formatValue: function(value)
+{
+return Number.secondsToString(value, WebInspector.UIString);
+},
+
+_lowerBound: function(resource)
+{
+return resource.startTime;
+},
+
+_upperBound: function(resource)
+{
+return resource.endTime;
+}
+}
+
+WebInspector.NetworkTransferTimeCalculator.prototype.__proto__ = WebInspector.NetworkTimeCalculator.prototype;
+
+WebInspector.NetworkTransferDurationCalculator = function()
+{
+WebInspector.NetworkTimeCalculator.call(this, true);
+}
+
+WebInspector.NetworkTransferDurationCalculator.prototype = {
+formatValue: function(value)
+{
+return Number.secondsToString(value, WebInspector.UIString);
+},
+
+_upperBound: function(resource)
+{
+return resource.duration;
+}
+}
+
+WebInspector.NetworkTransferDurationCalculator.prototype.__proto__ = WebInspector.NetworkTimeCalculator.prototype;
+
+WebInspector.NetworkDataGridNode = function(panel, resource)
+{
+WebInspector.DataGridNode.call(this, {});
+this._panel = panel;
+this._resource = resource;
+}
+
+WebInspector.NetworkDataGridNode.prototype = {
+createCells: function()
+{
+this._nameCell = this._createDivInTD("name");
+this._methodCell = this._createDivInTD("method");
+this._statusCell = this._createDivInTD("status");
+this._typeCell = this._createDivInTD("type");
+this._sizeCell = this._createDivInTD("size");
+this._timeCell = this._createDivInTD("time");
+this._createTimelineCell();
+this._nameCell.addEventListener("click", this.select.bind(this), false);
+},
+
+select: function()
+{
+this._panel._showResource(this._resource);
+WebInspector.DataGridNode.prototype.select.apply(this, arguments);
+},
+
+get selectable()
+{
+if (!this._panel._viewingResourceMode)
+return false;
+if (!this._panel._hiddenCategories.all)
+return true;
+if (this._panel._hiddenCategories[this._resource.category.name])
+return false;
+return true;
+},
+
+_createDivInTD: function(columnIdentifier)
+{
+var td = document.createElement("td");
+td.className = columnIdentifier + "-column";
+var div = document.createElement("div");
+td.appendChild(div);
+this._element.appendChild(td);
+return div;
+},
+
+_createTimelineCell: function()
+{
+this._graphElement = document.createElement("div");
+this._graphElement.className = "network-graph-side";
+
+this._barAreaElement = document.createElement("div");
+
+this._barAreaElement.className = "network-graph-bar-area";
+this._barAreaElement.resource = this._resource;
+this._graphElement.appendChild(this._barAreaElement);
+
+this._barLeftElement = document.createElement("div");
+this._barLeftElement.className = "network-graph-bar waiting";
+this._barAreaElement.appendChild(this._barLeftElement);
+
+this._barRightElement = document.createElement("div");
+this._barRightElement.className = "network-graph-bar";
+this._barAreaElement.appendChild(this._barRightElement);
+
+
+this._labelLeftElement = document.createElement("div");
+this._labelLeftElement.className = "network-graph-label waiting";
+this._barAreaElement.appendChild(this._labelLeftElement);
+
+this._labelRightElement = document.createElement("div");
+this._labelRightElement.className = "network-graph-label";
+this._barAreaElement.appendChild(this._labelRightElement);
+
+this._graphElement.addEventListener("mouseover", this._refreshLabelPositions.bind(this), false);
+
+this._timelineCell = document.createElement("td");
+this._timelineCell.className = "timeline-column";
+this._element.appendChild(this._timelineCell);
+this._timelineCell.appendChild(this._graphElement);
+},
+
+refreshResource: function()
+{
+this._refreshNameCell();
+
+this._methodCell.textContent = this._resource.requestMethod;
+
+this._refreshStatusCell();
+
+if (this._resource.mimeType) {
+this._typeCell.removeStyleClass("network-dim-cell");
+this._typeCell.textContent = this._resource.mimeType;
+} else {
+this._typeCell.addStyleClass("network-dim-cell");
+this._typeCell.textContent = WebInspector.UIString("Pending");
+}
+
+this._refreshSizeCell();
+this._refreshTimeCell();
+
+if (this._resource.cached)
+this._graphElement.addStyleClass("resource-cached");
+
+this._element.addStyleClass("network-item");
+if (!this._element.hasStyleClass("network-category-" + this._resource.category.name)) {
+this._element.removeMatchingStyleClasses("network-category-\\w+");
+this._element.addStyleClass("network-category-" + this._resource.category.name);
+}
+},
+
+_refreshNameCell: function()
+{
+this._nameCell.removeChildren();
+
+if (this._resource.category === WebInspector.resourceCategories.images) {
+var previewImage = document.createElement("img");
+previewImage.className = "image-network-icon-preview";
+
+function onResourceContent()
+{
+previewImage.src = this._resource.contentURL;
+}
+if (Preferences.useDataURLForResourceImageIcons)
+this._resource.requestContent(onResourceContent.bind(this));
+else
+previewImage.src = this._resource.url;
+
+var iconElement = document.createElement("div");
+iconElement.className = "icon";
+iconElement.appendChild(previewImage);
+} else {
+var iconElement = document.createElement("img");
+iconElement.className = "icon";
+}
+this._nameCell.appendChild(iconElement);
+this._nameCell.appendChild(document.createTextNode(this._fileName()));
+
+
+var subtitle = this._resource.displayDomain;
+
+if (this._resource.path && this._resource.lastPathComponent) {
+var lastPathComponentIndex = this._resource.path.lastIndexOf("/" + this._resource.lastPathComponent);
+if (lastPathComponentIndex != -1)
+subtitle += this._resource.path.substring(0, lastPathComponentIndex);
+}
+
+this._appendSubtitle(this._nameCell, subtitle);
+this._nameCell.title = this._resource.url;
+},
+
+_fileName: function()
+{
+var fileName = this._resource.displayName;
+if (this._resource.queryString)
+fileName += "?" + this._resource.queryString;
+return fileName;
+},
+
+_refreshStatusCell: function()
+{
+this._statusCell.removeChildren();
+
+var fromCache = this._resource.cached;
+if (fromCache) {
+this._statusCell.textContent = WebInspector.UIString("(from cache)");
+this._statusCell.addStyleClass("network-dim-cell");
+return;
+}
+
+this._statusCell.removeStyleClass("network-dim-cell");
+if (this._resource.statusCode) {
+this._statusCell.appendChild(document.createTextNode(this._resource.statusCode));
+this._statusCell.removeStyleClass("network-dim-cell");
+this._appendSubtitle(this._statusCell, this._resource.statusText);
+this._statusCell.title = this._resource.statusCode + " " + this._resource.statusText;
+} else {
+this._statusCell.addStyleClass("network-dim-cell");
+this._statusCell.textContent = WebInspector.UIString("Pending");
+}
+},
+
+_refreshSizeCell: function()
+{
+var resourceSize = typeof this._resource.resourceSize === "number" ? Number.bytesToString(this._resource.resourceSize) : "?";
+var transferSize = typeof this._resource.transferSize === "number" ? Number.bytesToString(this._resource.transferSize) : "?";
+var fromCache = this._resource.cached;
+this._sizeCell.textContent = !fromCache ? resourceSize : WebInspector.UIString("(from cache)");
+if (fromCache)
+this._sizeCell.addStyleClass("network-dim-cell");
+else
+this._sizeCell.removeStyleClass("network-dim-cell");
+if (!fromCache)
+this._appendSubtitle(this._sizeCell, transferSize);
+},
+
+_refreshTimeCell: function()
+{
+if (this._resource.duration > 0) {
+this._timeCell.removeStyleClass("network-dim-cell");
+this._timeCell.textContent = Number.secondsToString(this._resource.duration);
+this._appendSubtitle(this._timeCell, Number.secondsToString(this._resource.latency));
+} else {
+this._timeCell.addStyleClass("network-dim-cell");
+this._timeCell.textContent = WebInspector.UIString("Pending");
+}
+},
+
+_appendSubtitle: function(cellElement, subtitleText)
+{
+var subtitleElement = document.createElement("div");
+subtitleElement.className = "network-cell-subtitle";
+subtitleElement.textContent = subtitleText;
+cellElement.appendChild(subtitleElement);
+},
+
+refreshGraph: function(calculator)
+{
+var percentages = calculator.computeBarGraphPercentages(this._resource);
+this._percentages = percentages;
+
+this._barAreaElement.removeStyleClass("hidden");
+
+if (!this._graphElement.hasStyleClass("network-category-" + this._resource.category.name)) {
+this._graphElement.removeMatchingStyleClasses("network-category-\\w+");
+this._graphElement.addStyleClass("network-category-" + this._resource.category.name);
+}
+
+this._barLeftElement.style.setProperty("left", percentages.start + "%");
+this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%");
+
+this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%");
+this._barRightElement.style.setProperty("left", percentages.middle + "%");
+
+var labels = calculator.computeBarGraphLabels(this._resource);
+this._labelLeftElement.textContent = labels.left;
+this._labelRightElement.textContent = labels.right;
+
+var tooltip = (labels.tooltip || "");
+this._barLeftElement.title = tooltip;
+this._labelLeftElement.title = tooltip;
+this._labelRightElement.title = tooltip;
+this._barRightElement.title = tooltip;
+},
+
+_refreshLabelPositions: function()
+{
+if (!this._percentages)
+return;
+this._labelLeftElement.style.removeProperty("left");
+this._labelLeftElement.style.removeProperty("right");
+this._labelLeftElement.removeStyleClass("before");
+this._labelLeftElement.removeStyleClass("hidden");
+
+this._labelRightElement.style.removeProperty("left");
+this._labelRightElement.style.removeProperty("right");
+this._labelRightElement.removeStyleClass("after");
+this._labelRightElement.removeStyleClass("hidden");
+
+const labelPadding = 10;
+const barRightElementOffsetWidth = this._barRightElement.offsetWidth;
+const barLeftElementOffsetWidth = this._barLeftElement.offsetWidth;
+
+if (this._barLeftElement) {
+var leftBarWidth = barLeftElementOffsetWidth - labelPadding;
+var rightBarWidth = (barRightElementOffsetWidth - barLeftElementOffsetWidth) - labelPadding;
+} else {
+var leftBarWidth = (barLeftElementOffsetWidth - barRightElementOffsetWidth) - labelPadding;
+var rightBarWidth = barRightElementOffsetWidth - labelPadding;
+}
+
+const labelLeftElementOffsetWidth = this._labelLeftElement.offsetWidth;
+const labelRightElementOffsetWidth = this._labelRightElement.offsetWidth;
+
+const labelBefore = (labelLeftElementOffsetWidth > leftBarWidth);
+const labelAfter = (labelRightElementOffsetWidth > rightBarWidth);
+const graphElementOffsetWidth = this._graphElement.offsetWidth;
+
+if (labelBefore && (graphElementOffsetWidth * (this._percentages.start / 100)) < (labelLeftElementOffsetWidth + 10))
+var leftHidden = true;
+
+if (labelAfter && (graphElementOffsetWidth * ((100 - this._percentages.end) / 100)) < (labelRightElementOffsetWidth + 10))
+var rightHidden = true;
+
+if (barLeftElementOffsetWidth == barRightElementOffsetWidth) {
+
+if (labelBefore && !labelAfter)
+leftHidden = true;
+else if (labelAfter && !labelBefore)
+rightHidden = true;
+}
+
+if (labelBefore) {
+if (leftHidden)
+this._labelLeftElement.addStyleClass("hidden");
+this._labelLeftElement.style.setProperty("right", (100 - this._percentages.start) + "%");
+this._labelLeftElement.addStyleClass("before");
+} else {
+this._labelLeftElement.style.setProperty("left", this._percentages.start + "%");
+this._labelLeftElement.style.setProperty("right", (100 - this._percentages.middle) + "%");
+}
+
+if (labelAfter) {
+if (rightHidden)
+this._labelRightElement.addStyleClass("hidden");
+this._labelRightElement.style.setProperty("left", this._percentages.end + "%");
+this._labelRightElement.addStyleClass("after");
+} else {
+this._labelRightElement.style.setProperty("left", this._percentages.middle + "%");
+this._labelRightElement.style.setProperty("right", (100 - this._percentages.end) + "%");
+}
+}
+}
+
+WebInspector.NetworkDataGridNode.NameComparator = function(a, b)
+{
+var aFileName = a._resource.displayName + (a._resource.queryString ? a._resource.queryString : "");
+var bFileName = b._resource.displayName + (b._resource.queryString ? b._resource.queryString : "");
+if (aFileName > bFileName)
+return 1;
+if (bFileName > aFileName)
+return -1;
+return 0;
+}
+
+WebInspector.NetworkDataGridNode.SizeComparator = function(a, b)
+{
+if (b._resource.cached && !a._resource.cached)
+return 1;
+if (a._resource.cached && !b._resource.cached)
+return -1;
+
+if (a._resource.resourceSize === b._resource.resourceSize)
+return 0;
+
+return a._resource.resourceSize - b._resource.resourceSize;
+}
+
+WebInspector.NetworkDataGridNode.ResourcePropertyComparator = function(propertyName, revert, a, b)
+{
+var aValue = a._resource[propertyName];
+var bValue = b._resource[propertyName];
+if (aValue > bValue)
+return revert ? -1 : 1;
+if (bValue > aValue)
+return revert ? 1 : -1;
+return 0;
+}
+
+WebInspector.NetworkDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
+
+WebInspector.NetworkTotalGridNode = function(element)
+{
+this._summaryBarElement = element;
+WebInspector.DataGridNode.call(this, {summaryRow: true});
+}
+
+WebInspector.NetworkTotalGridNode.prototype = {
+createCells: function()
+{
+var td = document.createElement("td");
+td.setAttribute("colspan", 7);
+td.className = "network-summary";
+td.appendChild(this._summaryBarElement);
+this._element.appendChild(td);
+}
+}
+
+WebInspector.NetworkTotalGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
+
+
+
+
+
+var InjectedFakeWorker = function(InjectedScriptHost, inspectedWindow, injectedScriptId)
 {
 
 Worker = function(url)
 {
-    var impl = new FakeWorker(this, url);
-    if (impl === null)
-        return null;
+var impl = new FakeWorker(this, url);
+if (impl === null)
+return null;
 
-    this.isFake = true;
-    this.postMessage = bind(impl.postMessage, impl);
-    this.terminate = bind(impl.terminate, impl);
-    this.onmessage = noop;
+this.isFake = true;
+this.postMessage = bind(impl.postMessage, impl);
+this.terminate = bind(impl.terminate, impl);
+
+function onmessageGetter()
+{
+return impl.channel.port1.onmessage;
+}
+function onmessageSetter(callback)
+{
+impl.channel.port1.onmessage = callback;
+}
+this.__defineGetter__("onmessage", onmessageGetter);
+this.__defineSetter__("onmessage", onmessageSetter);
+this.addEventListener = bind(impl.channel.port1.addEventListener, impl.channel.port1);
+this.removeEventListener = bind(impl.channel.port1.removeEventListener, impl.channel.port1);
+this.dispatchEvent = bind(impl.channel.port1.dispatchEvent, impl.channel.port1);
 }
 
 function FakeWorker(worker, url)
 {
-    var scriptURL = new URL(document.baseURI).completeWith(url);
+var scriptURL = this._expandURLAndCheckOrigin(document.baseURI, location.href, url);
 
-    if (!scriptURL.sameOrigin(location.href))
-        throw new DOMCoreException("SECURITY_ERR",18);
+this._worker = worker;
+this._id = InjectedScriptHost.nextWorkerId();
+this.channel = new MessageChannel();
+this._listeners = [];
+this._buildWorker(scriptURL);
 
-    this._worker = worker;
-    this._buildWorker(scriptURL);
+InjectedScriptHost.didCreateWorker(this._id, scriptURL.url, false);
 }
 
 FakeWorker.prototype = {
-    postMessage: function(msg)
-    {
-        if (this._frame != null)
-            this._dispatchMessage(this._frame, bind(this._onmessageWrapper, this), msg);
-    },
+postMessage: function(msg, opt_ports)
+{
+if (this._frame != null)
+this.channel.port1.postMessage.apply(this.channel.port1, arguments);
+else if (this._pendingMessages)
+this._pendingMessages.push(arguments)
+else
+this._pendingMessages = [ arguments ];
+},
 
-    terminate: function()
-    {
-        if (this._frame != null) {
-            this._frame.onmessage = this._worker.onmessage = noop;
-            this._frame.frameElement.parentNode.removeChild(this._frame.frameElement);
-        }
-        this._frame = null;
-        this._worker = null; // Break reference loop.
-    },
+terminate: function()
+{
+InjectedScriptHost.didDestroyWorker(this._id);
 
-    _onmessageWrapper: function(msg)
-    {
-        // Shortcut -- if no exception handlers installed, avoid try/catch so as not to obscure line number.
-        if (!this._frame.onerror && !this._worker.onerror) {
-            this._frame.onmessage(msg);
-            return;
-        }
+this.channel.port1.close();
+this.channel.port2.close();
+if (this._frame != null)
+this._frame.frameElement.parentNode.removeChild(this._frame.frameElement);
+this._frame = null;
+this._worker = null; 
+},
 
-        try {
-            this._frame.onmessage(msg);
-        } catch (e) {
-            this._handleException(e, this._frame.onerror, this._worker.onerror);
-        }
-    },
+_buildWorker: function(url)
+{
+var code = this._loadScript(url.url);
+var iframeElement = document.createElement("iframe");
+iframeElement.style.display = "none";
 
-    _dispatchMessage: function(targetWindow, handler, msg)
-    {
-        var event = this._document.createEvent("MessageEvent");
-        event.initMessageEvent("MessageEvent", false, false, msg);
-        targetWindow.setTimeout(handler, 0, event);
-    },
+this._document = document;
+iframeElement.onload = bind(this._onWorkerFrameLoaded, this, iframeElement, url, code);
 
-    _handleException: function(e)
-    {
-        // NB: it should be an ErrorEvent, but creating it from script is not
-        // currently supported, to emulate it on top of plain vanilla Event.
-        var errorEvent = this._document.createEvent("Event");
-        errorEvent.initEvent("Event", false, false);
-        errorEvent.message = "Uncaught exception";
+if (document.body)
+this._attachWorkerFrameToDocument(iframeElement, url, code);
+else
+window.addEventListener("load", bind(this._attachWorkerFrameToDocument, this, iframeElement), false);
+},
 
-        for (var i = 1; i < arguments.length; ++i) {
-            if (arguments[i] && arguments[i](errorEvent))
-                return;
-        }
+_attachWorkerFrameToDocument: function(iframeElement)
+{
+document.body.appendChild(iframeElement);
+},
 
-        throw e;
-    },
+_onWorkerFrameLoaded: function(iframeElement, url, code)
+{
+var frame = iframeElement.contentWindow;
+this._frame = frame;
+this._setupWorkerContext(frame, url);
 
-    _buildWorker: function(url)
-    {
-        var code = this._loadScript(url.url);
-        var iframeElement = document.createElement("iframe");
-        iframeElement.style.display = "none";
-        document.body.appendChild(iframeElement);
+var frameContents = '(function() { var location = __devtools.location; var window; ' + code + '})();\n' + '//@ sourceURL=' + url.url;
 
-        var frame = window.frames[window.frames.length - 1];
+frame.eval(frameContents);
+if (this._pendingMessages) {
+for (var msg = 0; msg < this._pendingMessages.length; ++msg)
+this.postMessage.apply(this, this._pendingMessages[msg]);
+delete this._pendingMessages;
+}
+},
 
-        this._document = document;
-        this._frame = frame;
+_setupWorkerContext: function(workerFrame, url)
+{
+workerFrame.__devtools = {
+handleException: bind(this._handleException, this),
+location: url.mockLocation()
+};
 
-        this._setupWorkerContext(frame, url);
+var self = this;
 
-        var frameContents = '(function(location, window) { ' + code + '})(__devtools.location, undefined);\n' + '//@ sourceURL=' + url.url;
+function onmessageGetter()
+{
+return self.channel.port2.onmessage ? self.channel.port2.onmessage.originalCallback : null;
+}
 
-        frame.eval(frameContents);
-    },
+function onmessageSetter(callback)
+{
+var wrappedCallback = bind(self._callbackWrapper, self, callback);
+wrappedCallback.originalCallback = callback;
+self.channel.port2.onmessage = wrappedCallback;
+}
 
-    _setupWorkerContext: function(workerFrame, url)
-    {
-        workerFrame.__devtools = {
-            handleException: bind(this._handleException, this),
-            location: url.mockLocation()
-        };
-        var worker = this._worker;
+workerFrame.__defineGetter__("onmessage", onmessageGetter);
+workerFrame.__defineSetter__("onmessage", onmessageSetter);
+workerFrame.addEventListener = bind(this._addEventListener, this);
+workerFrame.removeEventListener = bind(this._removeEventListener, this);
+workerFrame.dispatchEvent = bind(this.channel.port2.dispatchEvent, this.channel.port2);
+workerFrame.postMessage = bind(this.channel.port2.postMessage, this.channel.port2);
+workerFrame.importScripts = bind(this._importScripts, this, workerFrame);
+workerFrame.close = bind(this.terminate, this);
+},
 
-        function handler(event) // Late binding to onmessage desired, so no bind() here.
-        {
-            worker.onmessage(event);
-        }
+_addEventListener: function(type, callback, useCapture)
+{
+var wrappedCallback = bind(this._callbackWrapper, this, callback);
+wrappedCallback.originalCallback = callback;
+wrappedCallback.type = type;
+wrappedCallback.useCapture = Boolean(useCapture);
 
-        workerFrame.onmessage = noop;
-        workerFrame.postMessage = bind(this._dispatchMessage, this, window, handler);
-        workerFrame.importScripts = bind(this._importScripts, this, workerFrame);
-        workerFrame.close = bind(this.terminate, this);
-    },
+this.channel.port2.addEventListener(type, wrappedCallback, useCapture);
+this._listeners.push(wrappedCallback);
+},
 
-    _importScripts: function(evalTarget)
-    {
-        for (var i = 1; i < arguments.length; ++i)
-            evalTarget.eval(this._loadScript(arguments[i]));
-    },
+_removeEventListener: function(type, callback, useCapture)
+{
+var listeners = this._listeners;
+for (var i = 0; i < listeners.length; ++i) {
+if (listeners[i].originalCallback === callback &&
+listeners[i].type === type && 
+listeners[i].useCapture === Boolean(useCapture)) {
+this.channel.port2.removeEventListener(type, listeners[i], useCapture);
+listeners[i] = listeners[listeners.length - 1];
+listeners.pop();
+break;
+}
+}
+},
 
-    _loadScript: function(url)
-    {
-        var xhr = new XMLHttpRequest();
-        xhr.open("GET", url, false);
-        xhr.send(null);
+_callbackWrapper: function(callback, msg)
+{
 
-        var text = xhr.responseText;
-        if (xhr.status != 0 && xhr.status/100 !== 2) { // We're getting status === 0 when using file://.
-            console.error("Failed to load worker: " + url + "[" + xhr.status + "]");
-            text = ""; // We've got error message, not worker code.
-        }
-        return text;
-    }
+if (!this._frame.onerror && !this._worker.onerror) {
+callback(msg);
+return;
+}
+
+try {
+callback(msg);
+} catch (e) {
+this._handleException(e, this._frame.onerror, this._worker.onerror);
+}
+},
+
+_handleException: function(e)
+{
+
+
+var errorEvent = this._document.createEvent("Event");
+errorEvent.initEvent("Event", false, false);
+errorEvent.message = "Uncaught exception";
+
+for (var i = 1; i < arguments.length; ++i) {
+if (arguments[i] && arguments[i](errorEvent))
+return;
+}
+
+throw e;
+},
+
+_importScripts: function(targetFrame)
+{
+for (var i = 1; i < arguments.length; ++i) {
+var workerOrigin = targetFrame.__devtools.location.href;
+var url = this._expandURLAndCheckOrigin(workerOrigin, workerOrigin, arguments[i]);
+targetFrame.eval(this._loadScript(url.url) + "\n//@ sourceURL= " + url.url);
+}
+},
+
+_loadScript: function(url)
+{
+var xhr = new XMLHttpRequest();
+xhr.open("GET", url, false);
+xhr.send(null);
+
+var text = xhr.responseText;
+if (xhr.status != 0 && xhr.status/100 !== 2) { 
+console.error("Failed to load worker: " + url + "[" + xhr.status + "]");
+text = ""; 
+}
+return text;
+},
+
+_expandURLAndCheckOrigin: function(baseURL, origin, url)
+{
+var scriptURL = new URL(baseURL).completeWith(url);
+
+if (!scriptURL.sameOrigin(origin))
+throw new DOMCoreException("SECURITY_ERR",18);
+return scriptURL;
+}
 };
 
 function URL(url)
 {
-    this.url = url;
-    this.split();
+this.url = url;
+this.split();
 }
 
 URL.prototype = {
-    urlRegEx: (/^(http[s]?|file):\/\/([^\/:]*)(:[\d]+)?(?:(\/[^#?]*)(\?[^#]*)?(?:#(.*))?)?$/i),
+urlRegEx: (/^(http[s]?|file):\/\/([^\/:]*)(:[\d]+)?(?:(\/[^#?]*)(\?[^#]*)?(?:#(.*))?)?$/i),
 
-    split: function()
-    {
-        function emptyIfNull(str)
-        {
-            return str == null ? "" : str;
-        }
-        var parts = this.urlRegEx.exec(this.url);
+split: function()
+{
+function emptyIfNull(str)
+{
+return str == null ? "" : str;
+}
+var parts = this.urlRegEx.exec(this.url);
 
-        this.schema = parts[1];
-        this.host = parts[2];
-        this.port = emptyIfNull(parts[3]);
-        this.path = emptyIfNull(parts[4]);
-        this.query = emptyIfNull(parts[5]);
-        this.fragment = emptyIfNull(parts[6]);
-    },
+this.schema = parts[1];
+this.host = parts[2];
+this.port = emptyIfNull(parts[3]);
+this.path = emptyIfNull(parts[4]);
+this.query = emptyIfNull(parts[5]);
+this.fragment = emptyIfNull(parts[6]);
+},
 
-    mockLocation: function()
-    {
-        var host = this.host.replace(/^[^@]*@/, "");
+mockLocation: function()
+{
+var host = this.host.replace(/^[^@]*@/, "");
 
-        return {
-            href:     this.url,
-            protocol: this.schema + ":",
-            host:     host,
-            hostname: host,
-            port:     this.port,
-            pathname: this.path,
-            search:   this.query,
-            hash:     this.fragment
-        };
-    },
+return {
+href:     this.url,
+protocol: this.schema + ":",
+host:     host,
+hostname: host,
+port:     this.port,
+pathname: this.path,
+search:   this.query,
+hash:     this.fragment
+};
+},
 
-    completeWith: function(url)
-    {
-        if (url === "" || /^[^/]*:/.exec(url)) // If given absolute url, return as is now.
-            return new URL(url);
+completeWith: function(url)
+{
+if (url === "" || /^[^/]*:/.exec(url)) // If given absolute url, return as is now.
+return new URL(url);
 
-        var relParts = /^([^#?]*)(.*)$/.exec(url); // => [ url, path, query-andor-fragment ]
+var relParts = /^([^#?]*)(.*)$/.exec(url); 
 
-        var path = (relParts[1].slice(0, 1) === "/" ? "" : this.path.replace(/[^/]*$/, "")) + relParts[1];
-        path = path.replace(/(\/\.)+(\/|$)/g, "/").replace(/[^/]*\/\.\.(\/|$)/g, "");
+var path = (relParts[1].slice(0, 1) === "/" ? "" : this.path.replace(/[^/]*$/, "")) + relParts[1];
+path = path.replace(/(\/\.)+(\/|$)/g, "/").replace(/[^/]*\/\.\.(\/|$)/g, "");
 
-        return new URL(this.schema + "://" + this.host + this.port + path + relParts[2]);
-    },
+return new URL(this.schema + "://" + this.host + this.port + path + relParts[2]);
+},
 
-    sameOrigin: function(url)
-    {
-        function normalizePort(schema, port)
-        {
-            var portNo = port.slice(1);
-            return (schema === "https" && portNo == 443 || schema === "http" && portNo == 80) ? "" : port;
-        }
+sameOrigin: function(url)
+{
+function normalizePort(schema, port)
+{
+var portNo = port.slice(1);
+return (schema === "https" && portNo == 443 || schema === "http" && portNo == 80) ? "" : port;
+}
 
-        var other = new URL(url);
+var other = new URL(url);
 
-        return this.schema === other.schema &&
-            this.host === other.host &&
-            normalizePort(this.schema, this.port) === normalizePort(other.schema, other.port);
-    }
+return this.schema === other.schema &&
+this.host === other.host &&
+normalizePort(this.schema, this.port) === normalizePort(other.schema, other.port);
+}
 };
 
 function DOMCoreException(name, code)
 {
-    function formatError()
-    {
-        return "Error: " + this.message;
-    }
+function formatError()
+{
+return "Error: " + this.message;
+}
 
-    this.name = name;
-    this.message = name + ": DOM Exception " + code;
-    this.code = code;
-    this.toString = bind(formatError, this);
+this.name = name;
+this.message = name + ": DOM Exception " + code;
+this.code = code;
+this.toString = bind(formatError, this);
 }
 
 function bind(func, thisObject)
 {
-    var args = Array.prototype.slice.call(arguments, 2);
-    return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); };
+var args = Array.prototype.slice.call(arguments, 2);
+return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); };
 }
 
 function noop()
@@ -19555,2431 +22444,4451 @@
 
 }
 
-/* ScriptsPanel.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ScriptsPanel = function()
 {
-    WebInspector.Panel.call(this);
+WebInspector.Panel.call(this, "scripts");
 
-    this.element.addStyleClass("scripts");
+this.topStatusBar = document.createElement("div");
+this.topStatusBar.className = "status-bar";
+this.topStatusBar.id = "scripts-status-bar";
+this.element.appendChild(this.topStatusBar);
 
-    this.topStatusBar = document.createElement("div");
-    this.topStatusBar.className = "status-bar";
-    this.topStatusBar.id = "scripts-status-bar";
-    this.element.appendChild(this.topStatusBar);
+this.backButton = document.createElement("button");
+this.backButton.className = "status-bar-item";
+this.backButton.id = "scripts-back";
+this.backButton.title = WebInspector.UIString("Show the previous script resource.");
+this.backButton.disabled = true;
+this.backButton.appendChild(document.createElement("img"));
+this.backButton.addEventListener("click", this._goBack.bind(this), false);
+this.topStatusBar.appendChild(this.backButton);
 
-    this.backButton = document.createElement("button");
-    this.backButton.className = "status-bar-item";
-    this.backButton.id = "scripts-back";
-    this.backButton.title = WebInspector.UIString("Show the previous script resource.");
-    this.backButton.disabled = true;
-    this.backButton.appendChild(document.createElement("img"));
-    this.backButton.addEventListener("click", this._goBack.bind(this), false);
-    this.topStatusBar.appendChild(this.backButton);
+this.forwardButton = document.createElement("button");
+this.forwardButton.className = "status-bar-item";
+this.forwardButton.id = "scripts-forward";
+this.forwardButton.title = WebInspector.UIString("Show the next script resource.");
+this.forwardButton.disabled = true;
+this.forwardButton.appendChild(document.createElement("img"));
+this.forwardButton.addEventListener("click", this._goForward.bind(this), false);
+this.topStatusBar.appendChild(this.forwardButton);
 
-    this.forwardButton = document.createElement("button");
-    this.forwardButton.className = "status-bar-item";
-    this.forwardButton.id = "scripts-forward";
-    this.forwardButton.title = WebInspector.UIString("Show the next script resource.");
-    this.forwardButton.disabled = true;
-    this.forwardButton.appendChild(document.createElement("img"));
-    this.forwardButton.addEventListener("click", this._goForward.bind(this), false);
-    this.topStatusBar.appendChild(this.forwardButton);
+this.filesSelectElement = document.createElement("select");
+this.filesSelectElement.className = "status-bar-item";
+this.filesSelectElement.id = "scripts-files";
+this.filesSelectElement.addEventListener("change", this._changeVisibleFile.bind(this), false);
+this.topStatusBar.appendChild(this.filesSelectElement);
 
-    this.filesSelectElement = document.createElement("select");
-    this.filesSelectElement.className = "status-bar-item";
-    this.filesSelectElement.id = "scripts-files";
-    this.filesSelectElement.addEventListener("change", this._changeVisibleFile.bind(this), false);
-    this.topStatusBar.appendChild(this.filesSelectElement);
+this.functionsSelectElement = document.createElement("select");
+this.functionsSelectElement.className = "status-bar-item";
+this.functionsSelectElement.id = "scripts-functions";
 
-    this.functionsSelectElement = document.createElement("select");
-    this.functionsSelectElement.className = "status-bar-item";
-    this.functionsSelectElement.id = "scripts-functions";
 
-    // FIXME: append the functions select element to the top status bar when it is implemented.
-    // this.topStatusBar.appendChild(this.functionsSelectElement);
 
-    this.sidebarButtonsElement = document.createElement("div");
-    this.sidebarButtonsElement.id = "scripts-sidebar-buttons";
-    this.topStatusBar.appendChild(this.sidebarButtonsElement);
 
-    this.pauseButton = document.createElement("button");
-    this.pauseButton.className = "status-bar-item";
-    this.pauseButton.id = "scripts-pause";
-    this.pauseButton.title = WebInspector.UIString("Pause script execution.");
-    this.pauseButton.disabled = true;
-    this.pauseButton.appendChild(document.createElement("img"));
-    this.pauseButton.addEventListener("click", this._togglePause.bind(this), false);
-    this.sidebarButtonsElement.appendChild(this.pauseButton);
+this.sidebarButtonsElement = document.createElement("div");
+this.sidebarButtonsElement.id = "scripts-sidebar-buttons";
+this.topStatusBar.appendChild(this.sidebarButtonsElement);
 
-    this.stepOverButton = document.createElement("button");
-    this.stepOverButton.className = "status-bar-item";
-    this.stepOverButton.id = "scripts-step-over";
-    this.stepOverButton.title = WebInspector.UIString("Step over next function call.");
-    this.stepOverButton.disabled = true;
-    this.stepOverButton.addEventListener("click", this._stepOverClicked.bind(this), false);
-    this.stepOverButton.appendChild(document.createElement("img"));
-    this.sidebarButtonsElement.appendChild(this.stepOverButton);
+this.pauseButton = document.createElement("button");
+this.pauseButton.className = "status-bar-item";
+this.pauseButton.id = "scripts-pause";
+this.pauseButton.title = WebInspector.UIString("Pause script execution.");
+this.pauseButton.disabled = true;
+this.pauseButton.appendChild(document.createElement("img"));
+this.pauseButton.addEventListener("click", this._togglePause.bind(this), false);
+this.sidebarButtonsElement.appendChild(this.pauseButton);
 
-    this.stepIntoButton = document.createElement("button");
-    this.stepIntoButton.className = "status-bar-item";
-    this.stepIntoButton.id = "scripts-step-into";
-    this.stepIntoButton.title = WebInspector.UIString("Step into next function call.");
-    this.stepIntoButton.disabled = true;
-    this.stepIntoButton.addEventListener("click", this._stepIntoClicked.bind(this), false);
-    this.stepIntoButton.appendChild(document.createElement("img"));
-    this.sidebarButtonsElement.appendChild(this.stepIntoButton);
+this.stepOverButton = document.createElement("button");
+this.stepOverButton.className = "status-bar-item";
+this.stepOverButton.id = "scripts-step-over";
+this.stepOverButton.title = WebInspector.UIString("Step over next function call.");
+this.stepOverButton.disabled = true;
+this.stepOverButton.addEventListener("click", this._stepOverClicked.bind(this), false);
+this.stepOverButton.appendChild(document.createElement("img"));
+this.sidebarButtonsElement.appendChild(this.stepOverButton);
 
-    this.stepOutButton = document.createElement("button");
-    this.stepOutButton.className = "status-bar-item";
-    this.stepOutButton.id = "scripts-step-out";
-    this.stepOutButton.title = WebInspector.UIString("Step out of current function.");
-    this.stepOutButton.disabled = true;
-    this.stepOutButton.addEventListener("click", this._stepOutClicked.bind(this), false);
-    this.stepOutButton.appendChild(document.createElement("img"));
-    this.sidebarButtonsElement.appendChild(this.stepOutButton);
+this.stepIntoButton = document.createElement("button");
+this.stepIntoButton.className = "status-bar-item";
+this.stepIntoButton.id = "scripts-step-into";
+this.stepIntoButton.title = WebInspector.UIString("Step into next function call.");
+this.stepIntoButton.disabled = true;
+this.stepIntoButton.addEventListener("click", this._stepIntoClicked.bind(this), false);
+this.stepIntoButton.appendChild(document.createElement("img"));
+this.sidebarButtonsElement.appendChild(this.stepIntoButton);
 
-    this.toggleBreakpointsButton = new WebInspector.StatusBarButton("", "toggle-breakpoints");
-    this.toggleBreakpointsButton.addEventListener("click", this._toggleBreakpointsClicked.bind(this), false);
-    this.sidebarButtonsElement.appendChild(this.toggleBreakpointsButton.element);
-    // Breakpoints should be activated by default, so emulate a click to toggle on.
-    this._toggleBreakpointsClicked();
+this.stepOutButton = document.createElement("button");
+this.stepOutButton.className = "status-bar-item";
+this.stepOutButton.id = "scripts-step-out";
+this.stepOutButton.title = WebInspector.UIString("Step out of current function.");
+this.stepOutButton.disabled = true;
+this.stepOutButton.addEventListener("click", this._stepOutClicked.bind(this), false);
+this.stepOutButton.appendChild(document.createElement("img"));
+this.sidebarButtonsElement.appendChild(this.stepOutButton);
 
-    this.debuggerStatusElement = document.createElement("div");
-    this.debuggerStatusElement.id = "scripts-debugger-status";
-    this.sidebarButtonsElement.appendChild(this.debuggerStatusElement);
+this.toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate all breakpoints."), "toggle-breakpoints");
+this.toggleBreakpointsButton.toggled = true;
+this.toggleBreakpointsButton.addEventListener("click", this.toggleBreakpointsClicked.bind(this), false);
+this.sidebarButtonsElement.appendChild(this.toggleBreakpointsButton.element);
 
-    this.viewsContainerElement = document.createElement("div");
-    this.viewsContainerElement.id = "script-resource-views";
+this.debuggerStatusElement = document.createElement("div");
+this.debuggerStatusElement.id = "scripts-debugger-status";
+this.sidebarButtonsElement.appendChild(this.debuggerStatusElement);
 
-    this.sidebarElement = document.createElement("div");
-    this.sidebarElement.id = "scripts-sidebar";
+this.viewsContainerElement = document.createElement("div");
+this.viewsContainerElement.id = "script-resource-views";
 
-    this.sidebarResizeElement = document.createElement("div");
-    this.sidebarResizeElement.className = "sidebar-resizer-vertical";
-    this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarResizeDrag.bind(this), false);
+this.sidebarElement = document.createElement("div");
+this.sidebarElement.id = "scripts-sidebar";
 
-    this.sidebarResizeWidgetElement = document.createElement("div");
-    this.sidebarResizeWidgetElement.id = "scripts-sidebar-resizer-widget";
-    this.sidebarResizeWidgetElement.addEventListener("mousedown", this._startSidebarResizeDrag.bind(this), false);
-    this.topStatusBar.appendChild(this.sidebarResizeWidgetElement);
+this.sidebarResizeElement = document.createElement("div");
+this.sidebarResizeElement.className = "sidebar-resizer-vertical";
+this.sidebarResizeElement.addEventListener("mousedown", this._startSidebarResizeDrag.bind(this), false);
 
-    this.sidebarPanes = {};
-    this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane();
-    this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane();
-    this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
-    this.sidebarPanes.breakpoints = new WebInspector.BreakpointsSidebarPane();
+this.sidebarResizeWidgetElement = document.createElement("div");
+this.sidebarResizeWidgetElement.id = "scripts-sidebar-resizer-widget";
+this.sidebarResizeWidgetElement.addEventListener("mousedown", this._startSidebarResizeDrag.bind(this), false);
+this.topStatusBar.appendChild(this.sidebarResizeWidgetElement);
 
-    for (var pane in this.sidebarPanes)
-        this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
-
-    this.sidebarPanes.callstack.expanded = true;
-    this.sidebarPanes.callstack.addEventListener("call frame selected", this._callFrameSelected, this);
-
-    this.sidebarPanes.scopechain.expanded = true;
-    this.sidebarPanes.breakpoints.expanded = true;
-
-    var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
-    var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
-    var panelEnablerButton = WebInspector.UIString("Enable Debugging");
-
-    this.panelEnablerView = new WebInspector.PanelEnablerView("scripts", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
-    this.panelEnablerView.addEventListener("enable clicked", this._enableDebugging, this);
-
-    this.element.appendChild(this.panelEnablerView.element);
-    this.element.appendChild(this.viewsContainerElement);
-    this.element.appendChild(this.sidebarElement);
-    this.element.appendChild(this.sidebarResizeElement);
-
-    this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
-    this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false);
-
-    this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
-    this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false);
-    this._pauseOnExceptionButton.state = WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions;
-
-    this._shortcuts = {};
-    var handler, shortcut;
-    var platformSpecificModifier = WebInspector.isMac() ? WebInspector.KeyboardShortcut.Modifiers.Meta : WebInspector.KeyboardShortcut.Modifiers.Ctrl;
-
-    // Continue.
-    handler = this.pauseButton.click.bind(this.pauseButton);
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F8);
-    this._shortcuts[shortcut] = handler;
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Slash, platformSpecificModifier);
-    this._shortcuts[shortcut] = handler;
-
-    // Step over.
-    handler = this.stepOverButton.click.bind(this.stepOverButton);
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F10);
-    this._shortcuts[shortcut] = handler;
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.SingleQuote, platformSpecificModifier);
-    this._shortcuts[shortcut] = handler;
-
-    // Step into.
-    handler = this.stepIntoButton.click.bind(this.stepIntoButton);
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F11);
-    this._shortcuts[shortcut] = handler;
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Semicolon, platformSpecificModifier);
-    this._shortcuts[shortcut] = handler;
-
-    // Step out.
-    handler = this.stepOutButton.click.bind(this.stepOutButton);
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.F11, WebInspector.KeyboardShortcut.Modifiers.Shift);
-    this._shortcuts[shortcut] = handler;
-    shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift, platformSpecificModifier);
-    this._shortcuts[shortcut] = handler;
-
-    this._debuggerEnabled = Preferences.debuggerAlwaysEnabled;
-    this.reset();
+this.sidebarPanes = {};
+this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane();
+this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane();
+this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane();
+this.sidebarPanes.jsBreakpoints = WebInspector.createJSBreakpointsSidebarPane();
+if (Preferences.nativeInstrumentationEnabled) {
+this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane();
+this.sidebarPanes.xhrBreakpoints = WebInspector.createXHRBreakpointsSidebarPane();
+this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerBreakpointsSidebarPane();
 }
 
-// Keep these in sync with WebCore::ScriptDebugServer
+this.sidebarPanes.workers = new WebInspector.WorkersSidebarPane();
+
+for (var pane in this.sidebarPanes)
+this.sidebarElement.appendChild(this.sidebarPanes[pane].element);
+
+this.sidebarPanes.callstack.expanded = true;
+this.sidebarPanes.callstack.addEventListener("call frame selected", this._callFrameSelected, this);
+
+this.sidebarPanes.scopechain.expanded = true;
+this.sidebarPanes.jsBreakpoints.expanded = true;
+
+var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
+var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
+var panelEnablerButton = WebInspector.UIString("Enable Debugging");
+
+this.panelEnablerView = new WebInspector.PanelEnablerView("scripts", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
+this.panelEnablerView.addEventListener("enable clicked", this._enableDebugging, this);
+
+this.element.appendChild(this.panelEnablerView.element);
+this.element.appendChild(this.viewsContainerElement);
+this.element.appendChild(this.sidebarElement);
+this.element.appendChild(this.sidebarResizeElement);
+
+this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
+this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false);
+if (Preferences.debuggerAlwaysEnabled)
+this.enableToggleButton.element.addStyleClass("hidden");
+
+this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
+this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false);
+this._pauseOnExceptionButton.state = WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions;
+this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
+
+this._registerShortcuts();
+
+this._debuggerEnabled = Preferences.debuggerAlwaysEnabled;
+
+this.reset();
+
+WebInspector.debuggerModel.addEventListener("debugger-paused", this._debuggerPaused, this);
+WebInspector.debuggerModel.addEventListener("debugger-resumed", this._debuggerResumed, this);
+}
+
+
 WebInspector.ScriptsPanel.PauseOnExceptionsState = {
-    DontPauseOnExceptions : 0,
-    PauseOnAllExceptions : 1,
-    PauseOnUncaughtExceptions: 2
+DontPauseOnExceptions : 0,
+PauseOnAllExceptions : 1,
+PauseOnUncaughtExceptions: 2
 };
 
 WebInspector.ScriptsPanel.prototype = {
-    toolbarItemClass: "scripts",
+get toolbarItemLabel()
+{
+return WebInspector.UIString("Scripts");
+},
 
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Scripts");
-    },
+get statusBarItems()
+{
+return [this.enableToggleButton.element, this._pauseOnExceptionButton.element];
+},
 
-    get statusBarItems()
-    {
-        return [this.enableToggleButton.element, this._pauseOnExceptionButton.element];
-    },
+get defaultFocusedElement()
+{
+return this.filesSelectElement;
+},
 
-    get defaultFocusedElement()
-    {
-        return this.filesSelectElement;
-    },
+get paused()
+{
+return this._paused;
+},
 
-    get paused()
-    {
-        return this._paused;
-    },
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+this.sidebarResizeElement.style.right = (this.sidebarElement.offsetWidth - 3) + "px";
 
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-        this.sidebarResizeElement.style.right = (this.sidebarElement.offsetWidth - 3) + "px";
+if (this.visibleView)
+this.visibleView.show(this.viewsContainerElement);
 
-        if (this.visibleView) {
-            if (this.visibleView instanceof WebInspector.ResourceView)
-                this.visibleView.headersVisible = false;
-            this.visibleView.show(this.viewsContainerElement);
-        }
-        if (this._attachDebuggerWhenShown) {
-            InspectorBackend.enableDebugger(false);
-            delete this._attachDebuggerWhenShown;
-        }
-    },
+if (this._attachDebuggerWhenShown) {
+InspectorBackend.enableDebugger(false);
+delete this._attachDebuggerWhenShown;
+}
+},
 
-    get searchableViews()
-    {
-        return [ this.visibleView ];
-    },
+hide: function()
+{
+if (this.visibleView)
+this.visibleView.hide();
+WebInspector.Panel.prototype.hide.call(this);
+},
 
-    get breakpointsActivated()
-    {
-        return this.toggleBreakpointsButton.toggled;
-    },
+get breakpointsActivated()
+{
+return this.toggleBreakpointsButton.toggled;
+},
 
-    addScript: function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage)
-    {
-        var script = new WebInspector.Script(sourceID, sourceURL, source, startingLine, errorLine, errorMessage);
-        this._sourceIDMap[sourceID] = script;
+addScript: function(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, scriptWorldType)
+{
+var script = new WebInspector.Script(sourceID, sourceURL, source, startingLine, errorLine, errorMessage, scriptWorldType);
+this._sourceIDMap[sourceID] = script;
 
-        var resource = WebInspector.resourceURLMap[sourceURL];
-        if (resource) {
-            if (resource.finished) {
-                // Resource is finished, bind the script right away.
-                resource.addScript(script);
-                this._sourceIDMap[sourceID] = resource;
-            } else {
-                // Resource is not finished, bind the script later.
-                if (!resource._scriptsPendingResourceLoad) {
-                    resource._scriptsPendingResourceLoad = [];
-                    resource.addEventListener("finished", this._resourceLoadingFinished, this);
-                }
-                resource._scriptsPendingResourceLoad.push(script);
-            }
-        }
-        this._addScriptToFilesMenu(script);
-    },
+var resource = WebInspector.resourceForURL(sourceURL);
+if (resource) {
+if (resource.finished) {
 
-    _resourceLoadingFinished: function(e)
-    {
-        var resource = e.target;
-        for (var i = 0; i < resource._scriptsPendingResourceLoad.length; ++i) {
-            // Bind script to resource.
-            var script = resource._scriptsPendingResourceLoad[i];
-            resource.addScript(script);
-            this._sourceIDMap[script.sourceID] = resource;
+resource.addScript(script);
+this._sourceIDMap[sourceID] = resource;
+} else {
 
-            // Remove script from the files list.
-            script.filesSelectOption.parentElement.removeChild(script.filesSelectOption);
-            
-            // Move breakpoints to the resource's frame.
-            if (script._scriptView) {
-                var sourceFrame = script._scriptView.sourceFrame;
-                for (var j = 0; j < sourceFrame.breakpoints; ++j) {
-                    var resourceFrame = this._sourceFrameForScriptOrResource(resource);
-                    resourceFrame.addBreakpoint(sourceFrame.breakpoints[j]);
-                }
-            }
-        }
-        // Adding first script will add resource.
-        this._addScriptToFilesMenu(resource._scriptsPendingResourceLoad[0]);
-        delete resource._scriptsPendingResourceLoad;
-    },
+if (!resource._scriptsPendingResourceLoad) {
+resource._scriptsPendingResourceLoad = [];
+resource.addEventListener("finished", this._resourceLoadingFinished, this);
+}
+resource._scriptsPendingResourceLoad.push(script);
+}
+}
+this._addScriptToFilesMenu(script);
+},
 
-    addBreakpoint: function(breakpoint)
-    {
-        if (!this.breakpointsActivated)
-            this._toggleBreakpointsClicked();
+continueToLine: function(sourceID, line)
+{
+WebInspector.debuggerModel.setOneTimeBreakpoint(sourceID, line);
+if (this.paused)
+this._togglePause();
+},
 
-        this.sidebarPanes.breakpoints.addBreakpoint(breakpoint);
+_resourceLoadingFinished: function(e)
+{
+var resource = e.target;
+for (var i = 0; i < resource._scriptsPendingResourceLoad.length; ++i) {
 
-        var sourceFrame;
-        if (breakpoint.url) {
-            var resource = WebInspector.resourceURLMap[breakpoint.url];
-            if (resource && resource.finished)
-                sourceFrame = this._sourceFrameForScriptOrResource(resource);
-        }
+var script = resource._scriptsPendingResourceLoad[i];
+resource.addScript(script);
+this._sourceIDMap[script.sourceID] = resource;
 
-        if (breakpoint.sourceID && !sourceFrame) {
-            var object = this._sourceIDMap[breakpoint.sourceID]
-            sourceFrame = this._sourceFrameForScriptOrResource(object);
-        }
 
-        if (sourceFrame)
-            sourceFrame.addBreakpoint(breakpoint);
-    },
+script.filesSelectOption.parentElement.removeChild(script.filesSelectOption);
+}
 
-    removeBreakpoint: function(breakpoint)
-    {
-        this.sidebarPanes.breakpoints.removeBreakpoint(breakpoint);
+this._addScriptToFilesMenu(resource._scriptsPendingResourceLoad[0]);
+delete resource._scriptsPendingResourceLoad;
+},
 
-        var sourceFrame;
-        if (breakpoint.url) {
-            var resource = WebInspector.resourceURLMap[breakpoint.url];
-            if (resource && resource.finished)
-                sourceFrame = this._sourceFrameForScriptOrResource(resource);
-        }
+canEditScripts: function()
+{
+return Preferences.canEditScriptSource;
+},
 
-        if (breakpoint.sourceID && !sourceFrame) {
-            var object = this._sourceIDMap[breakpoint.sourceID]
-            sourceFrame = this._sourceFrameForScriptOrResource(object);
-        }
+editScriptSource: function(editData, commitEditingCallback, cancelEditingCallback)
+{
+if (!this.canEditScripts())
+return;
 
-        if (sourceFrame)
-            sourceFrame.removeBreakpoint(breakpoint);
-    },
 
-    selectedCallFrameId: function()
-    {
-        var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
-        if (!selectedCallFrame)
-            return null;
-        return selectedCallFrame.id;
-    },
+var breakpoints = WebInspector.debuggerModel.findBreakpoints(function(b) { return b.sourceID === editData.sourceID });
+for (var i = 0; i < breakpoints.length; ++i)
+breakpoints[i].remove();
 
-    evaluateInSelectedCallFrame: function(code, updateInterface, objectGroup, callback)
-    {
-        var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
-        if (!this._paused || !selectedCallFrame)
-            return;
+function mycallback(success, newBodyOrErrorMessage, callFrames)
+{
+if (success) {
+commitEditingCallback(newBodyOrErrorMessage);
+if (callFrames && callFrames.length)
+this._debuggerPaused({ data: callFrames });
+} else {
+if (cancelEditingCallback)
+cancelEditingCallback();
+WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Warning);
+}
+for (var i = 0; i < breakpoints.length; ++i) {
+var breakpoint = breakpoints[i];
+var newLine = breakpoint.line;
+if (success && breakpoint.line >= editData.line)
+newLine += editData.linesCountToShift;
+WebInspector.debuggerModel.setBreakpoint(editData.sourceID, breakpoint.url, newLine, breakpoint.enabled, breakpoint.condition);
+}
+};
+InspectorBackend.editScriptSource(editData.sourceID, editData.content, mycallback.bind(this));
+},
 
-        if (typeof updateInterface === "undefined")
-            updateInterface = true;
+selectedCallFrameId: function()
+{
+var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
+if (!selectedCallFrame)
+return null;
+return selectedCallFrame.id;
+},
 
-        var self = this;
-        function updatingCallbackWrapper(result, exception)
-        {
-            callback(result, exception);
-            if (updateInterface)
-                self.sidebarPanes.scopechain.update(selectedCallFrame);
-        }
-        this.doEvalInCallFrame(selectedCallFrame, code, objectGroup, updatingCallbackWrapper);
-    },
+evaluateInSelectedCallFrame: function(code, updateInterface, objectGroup, callback)
+{
+var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame;
+if (!this._paused || !selectedCallFrame)
+return;
 
-    doEvalInCallFrame: function(callFrame, code, objectGroup, callback)
-    {
-        function evalCallback(result)
-        {
-            if (result)
-                callback(result.value, result.isException);
-        }
-        InjectedScriptAccess.get(callFrame.injectedScriptId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback);
-    },
+if (typeof updateInterface === "undefined")
+updateInterface = true;
 
-    debuggerPaused: function(callFrames)
-    {
-        this._paused = true;
-        this._waitingToPause = false;
-        this._stepping = false;
+var self = this;
+function updatingCallbackWrapper(result)
+{
+callback(result);
+if (updateInterface)
+self.sidebarPanes.scopechain.update(selectedCallFrame);
+}
+this.doEvalInCallFrame(selectedCallFrame, code, objectGroup, updatingCallbackWrapper);
+},
 
-        this._updateDebuggerButtons();
+doEvalInCallFrame: function(callFrame, code, objectGroup, callback)
+{
+function evalCallback(result)
+{
+if (result)
+callback(WebInspector.RemoteObject.fromPayload(result));
+}
+InjectedScriptAccess.get(callFrame.worldId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback);
+},
 
-        this.sidebarPanes.callstack.update(callFrames, this._sourceIDMap);
-        this.sidebarPanes.callstack.selectedCallFrame = callFrames[0];
+_debuggerPaused: function(event)
+{
+var callFrames = event.data;
 
-        WebInspector.currentPanel = this;
-        window.focus();
-    },
+WebInspector.debuggerModel.removeOneTimeBreakpoint();
+this._paused = true;
+this._waitingToPause = false;
+this._stepping = false;
 
-    debuggerResumed: function()
-    {
-        this._paused = false;
-        this._waitingToPause = false;
-        this._stepping = false;
+this._updateDebuggerButtons();
 
-        this._clearInterface();
-    },
+WebInspector.currentPanel = this;
 
-    attachDebuggerWhenShown: function()
-    {
-        if (this.element.parentElement) {
-            InspectorBackend.enableDebugger(false);
-        } else {
-            this._attachDebuggerWhenShown = true;
-        }
-    },
+this.sidebarPanes.callstack.update(callFrames, this._sourceIDMap);
+this.sidebarPanes.callstack.selectedCallFrame = callFrames[0];
 
-    debuggerWasEnabled: function()
-    {
-        if (this._debuggerEnabled)
-            return;
+window.focus();
+InspectorFrontendHost.bringToFront();
+},
 
-        this._debuggerEnabled = true;
-        this.reset();
-    },
+_debuggerResumed: function()
+{
+this._paused = false;
+this._waitingToPause = false;
+this._stepping = false;
 
-    debuggerWasDisabled: function()
-    {
-        if (!this._debuggerEnabled)
-            return;
+this._clearInterface();
+},
 
-        this._debuggerEnabled = false;
-        this.reset();
-    },
+attachDebuggerWhenShown: function()
+{
+if (this.element.parentElement) {
+InspectorBackend.enableDebugger(false);
+} else {
+this._attachDebuggerWhenShown = true;
+}
+},
 
-    reset: function()
-    {
-        this.visibleView = null;
+debuggerWasEnabled: function()
+{
+if (this._debuggerEnabled)
+return;
 
-        delete this.currentQuery;
-        this.searchCanceled();
+this._debuggerEnabled = true;
+this.reset(true);
+},
 
-        if (!this._debuggerEnabled) {
-            this._paused = false;
-            this._waitingToPause = false;
-            this._stepping = false;
-        }
+debuggerWasDisabled: function()
+{
+if (!this._debuggerEnabled)
+return;
 
-        this._clearInterface();
+this._debuggerEnabled = false;
+this.reset(true);
+},
 
-        this._backForwardList = [];
-        this._currentBackForwardIndex = -1;
-        this._updateBackAndForwardButtons();
+reset: function(preserveItems)
+{
+this.visibleView = null;
 
-        this._resourceForURLInFilesSelect = {};
-        this.filesSelectElement.removeChildren();
-        this.functionsSelectElement.removeChildren();
-        this.viewsContainerElement.removeChildren();
+delete this.currentQuery;
+this.searchCanceled();
 
-        if (this._sourceIDMap) {
-            for (var sourceID in this._sourceIDMap) {
-                var object = this._sourceIDMap[sourceID];
-                if (object instanceof WebInspector.Resource)
-                    object.removeAllScripts();
-            }
-        }
+this._debuggerResumed();
 
-        this._sourceIDMap = {};
-        
-        this.sidebarPanes.watchExpressions.refreshExpressions();
-        this.sidebarPanes.breakpoints.reset();
-    },
+this._backForwardList = [];
+this._currentBackForwardIndex = -1;
+this._updateBackAndForwardButtons();
 
-    get visibleView()
-    {
-        return this._visibleView;
-    },
+this._resourceForURLInFilesSelect = {};
+this.filesSelectElement.removeChildren();
+this.functionsSelectElement.removeChildren();
+this.viewsContainerElement.removeChildren();
 
-    set visibleView(x)
-    {
-        if (this._visibleView === x)
-            return;
+if (this._sourceIDMap) {
+for (var sourceID in this._sourceIDMap) {
+var object = this._sourceIDMap[sourceID];
+if (object instanceof WebInspector.Resource)
+object.removeAllScripts();
+}
+}
 
-        if (this._visibleView)
-            this._visibleView.hide();
+this._sourceIDMap = {};
 
-        this._visibleView = x;
+this.sidebarPanes.watchExpressions.refreshExpressions();
+if (!preserveItems) {
+this.sidebarPanes.jsBreakpoints.reset();
+if (Preferences.nativeInstrumentationEnabled) {
+this.sidebarPanes.domBreakpoints.reset();
+this.sidebarPanes.xhrBreakpoints.reset();
+this.sidebarPanes.eventListenerBreakpoints.reset();
+}
+this.sidebarPanes.workers.reset();
+}
+},
 
-        if (x)
-            x.show(this.viewsContainerElement);
-    },
+get visibleView()
+{
+return this._visibleView;
+},
 
-    viewRecreated: function(oldView, newView)
-    {
-        if (this._visibleView === oldView)
-            this._visibleView = newView;
-    },
+set visibleView(x)
+{
+if (this._visibleView === x)
+return;
 
-    canShowSourceLine: function(url, line)
-    {
-        if (!this._debuggerEnabled)
-            return false;
-        return !!this._scriptOrResourceForURLAndLine(url, line);
-    },
+if (this._visibleView)
+this._visibleView.hide();
+
+this._visibleView = x;
+
+if (x)
+x.show(this.viewsContainerElement);
+},
+
+viewRecreated: function(oldView, newView)
+{
+if (this._visibleView === oldView)
+this._visibleView = newView;
+},
+
+canShowSourceLine: function(url, line)
+{
+if (!this._debuggerEnabled)
+return false;
+return !!this._scriptOrResourceForURLAndLine(url, line);
+},
+
+showSourceLine: function(url, line)
+{
+var scriptOrResource = this._scriptOrResourceForURLAndLine(url, line);
+this._showScriptOrResource(scriptOrResource, {line: line, shouldHighlightLine: true});
+},
+
+_scriptOrResourceForURLAndLine: function(url, line)
+{
+var scriptWithMatchingUrl = null;
+for (var sourceID in this._sourceIDMap) {
+var scriptOrResource = this._sourceIDMap[sourceID];
+if (scriptOrResource instanceof WebInspector.Script) {
+if (scriptOrResource.sourceURL !== url)
+continue;
+scriptWithMatchingUrl = scriptOrResource;
+if (scriptWithMatchingUrl.startingLine <= line && scriptWithMatchingUrl.startingLine + scriptWithMatchingUrl.linesCount > line)
+return scriptWithMatchingUrl;
+} else {
+var resource = scriptOrResource;
+if (resource.url === url)
+return resource;
+}
+}
+return scriptWithMatchingUrl;
+},
+
+showView: function(view)
+{
+if (!view)
+return;
+this._showScriptOrResource(view.resource || view.script);
+},
+
+handleShortcut: function(event)
+{
+var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
+var handler = this._shortcuts[shortcut];
+if (handler) {
+handler(event);
+event.handled = true;
+} else
+this.sidebarPanes.callstack.handleShortcut(event);
+},
+
+scriptViewForScript: function(script)
+{
+if (!script)
+return null;
+if (!script._scriptView)
+script._scriptView = new WebInspector.ScriptView(script);
+return script._scriptView;
+},
+
+sourceFrameForScript: function(script)
+{
+var view = this.scriptViewForScript(script);
+if (!view)
+return null;
+
+
+if (!this.element.parentNode)
+this.attach();
+
+view.setupSourceFrameIfNeeded();
+return view.sourceFrame;
+},
+
+_sourceFrameForScriptOrResource: function(scriptOrResource)
+{
+if (scriptOrResource instanceof WebInspector.Resource)
+return this._sourceFrameForResource(scriptOrResource);
+if (scriptOrResource instanceof WebInspector.Script)
+return this.sourceFrameForScript(scriptOrResource);
+},
+
+_sourceFrameForResource: function(resource)
+{
+var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+if (!view)
+return null;
+
+if (!view.setupSourceFrameIfNeeded)
+return null;
+
+view.setupSourceFrameIfNeeded();
+return view.sourceFrame;
+},
+
+_showScriptOrResource: function(scriptOrResource, options)
+{
+
+options = options || {};
+
+if (!scriptOrResource)
+return;
+
+var view;
+if (scriptOrResource instanceof WebInspector.Resource)
+view = WebInspector.ResourceManager.resourceViewForResource(scriptOrResource);
+else if (scriptOrResource instanceof WebInspector.Script)
+view = this.scriptViewForScript(scriptOrResource);
+
+if (!view)
+return;
+
+var url = scriptOrResource.url || scriptOrResource.sourceURL;
+if (url && !options.initialLoad)
+WebInspector.settings.lastViewedScriptFile = url;
+
+if (!options.fromBackForwardAction) {
+var oldIndex = this._currentBackForwardIndex;
+if (oldIndex >= 0)
+this._backForwardList.splice(oldIndex + 1, this._backForwardList.length - oldIndex);
+
+
+
+var previousEntryIndex = this._backForwardList.indexOf(scriptOrResource);
+if (previousEntryIndex !== -1) {
+this._backForwardList.splice(previousEntryIndex, 1);
+--this._currentBackForwardIndex;
+}
+
+this._backForwardList.push(scriptOrResource);
+++this._currentBackForwardIndex;
+
+this._updateBackAndForwardButtons();
+}
+
+this.visibleView = view;
+
+if (options.line) {
+if (view.revealLine)
+view.revealLine(options.line);
+if (view.highlightLine && options.shouldHighlightLine)
+view.highlightLine(options.line);
+}
+
+var option;
+if (scriptOrResource instanceof WebInspector.Script) {
+option = scriptOrResource.filesSelectOption;
+
+
+
+if (!option) {
+this._addScriptToFilesMenu(scriptOrResource, true);
+option = scriptOrResource.filesSelectOption;
+}
+
+console.assert(option);
+} else
+option = scriptOrResource.filesSelectOption;
+
+if (option)
+this.filesSelectElement.selectedIndex = option.index;
+},
+
+_addScriptToFilesMenu: function(script, force)
+{
+if (!script.sourceURL && !force)
+return;
+
+if (script.resource) {
+if (this._resourceForURLInFilesSelect[script.resource.url])
+return;
+this._resourceForURLInFilesSelect[script.resource.url] = script.resource;
+}
+
+var displayName = script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)");
+
+var select = this.filesSelectElement;
+var option = document.createElement("option");
+option.representedObject = script.resource || script;
+option.url = displayName;
+option.startingLine = script.startingLine;
+option.text = script.resource || script.startingLine === 1 ? displayName : String.sprintf("%s:%d", displayName, script.startingLine);
+
+function optionCompare(a, b)
+{
+if (a.url < b.url)
+return -1;
+else if (a.url > b.url)
+return 1;
+
+if (typeof a.startingLine !== "number")
+return -1;
+if (typeof b.startingLine !== "number")
+return -1;
+return a.startingLine - b.startingLine;
+}
+
+var insertionIndex = insertionIndexForObjectInListSortedByFunction(option, select.childNodes, optionCompare);
+if (insertionIndex < 0)
+select.appendChild(option);
+else
+select.insertBefore(option, select.childNodes.item(insertionIndex));
+
+if (script.resource)
+script.resource.filesSelectOption = option;
+else
+script.filesSelectOption = option;
+
+if (select.options[select.selectedIndex] === option) {
+
+
+this._showScriptOrResource(option.representedObject, {initialLoad: true});
+} else {
+
+var url = option.representedObject.url || option.representedObject.sourceURL;
+var lastURL = WebInspector.settings.lastViewedScriptFile;
+if (url && url === lastURL) {
 
-    showSourceLine: function(url, line)
-    {
-        var scriptOrResource = this._scriptOrResourceForURLAndLine(url, line);
-        this._showScriptOrResource(scriptOrResource, {line: line, shouldHighlightLine: true});
-    },
 
-    _scriptOrResourceForURLAndLine: function(url, line) 
-    {
-        var scriptWithMatchingUrl = null;
-        for (var sourceID in this._sourceIDMap) {
-            var scriptOrResource = this._sourceIDMap[sourceID];
-            if (scriptOrResource instanceof WebInspector.Script) {
-                if (scriptOrResource.sourceURL !== url)
-                    continue;
-                scriptWithMatchingUrl = scriptOrResource;
-                if (scriptWithMatchingUrl.startingLine <= line && scriptWithMatchingUrl.startingLine + scriptWithMatchingUrl.linesCount > line)
-                    return scriptWithMatchingUrl;
-            } else {
-                var resource = scriptOrResource;
-                if (resource.url === url)
-                    return resource;
-            }
-        }
-        return scriptWithMatchingUrl;
-    },
 
-    showView: function(view)
-    {
-        if (!view)
-            return;
-        this._showScriptOrResource(view.resource || view.script);
-    },
+var isResource = !!option.representedObject.url;
+if (isResource || !this.visibleView || !this.visibleView.script || this.visibleView.script.sourceURL !== url)
+this._showScriptOrResource(option.representedObject, {initialLoad: true});
+}
+}
 
-    handleShortcut: function(event)
-    {
-        var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
-        var handler = this._shortcuts[shortcut];
-        if (handler) {
-            handler(event);
-            event.handled = true;
-        } else
-            this.sidebarPanes.callstack.handleShortcut(event);
-    },
+if (script.worldType === WebInspector.Script.WorldType.EXTENSIONS_WORLD)
+script.filesSelectOption.addStyleClass("extension-script");
+},
 
-    scriptViewForScript: function(script)
-    {
-        if (!script)
-            return null;
-        if (!script._scriptView)
-            script._scriptView = new WebInspector.ScriptView(script);
-        return script._scriptView;
-    },
+_clearCurrentExecutionLine: function()
+{
+if (this._executionSourceFrame)
+this._executionSourceFrame.executionLine = 0;
+delete this._executionSourceFrame;
+},
 
-    sourceFrameForScript: function(script)
-    {
-        var view = this.scriptViewForScript(script);
-        if (!view)
-            return null;
+_callFrameSelected: function()
+{
+this._clearCurrentExecutionLine();
 
-        // Setting up the source frame requires that we be attached.
-        if (!this.element.parentNode)
-            this.attach();
+var callStackPane = this.sidebarPanes.callstack;
+var currentFrame = callStackPane.selectedCallFrame;
+if (!currentFrame)
+return;
 
-        view.setupSourceFrameIfNeeded();
-        return view.sourceFrame;
-    },
+this.sidebarPanes.scopechain.update(currentFrame);
+this.sidebarPanes.watchExpressions.refreshExpressions();
 
-    _sourceViewForScriptOrResource: function(scriptOrResource)
-    {
-        if (scriptOrResource instanceof WebInspector.Resource) {
-            if (!WebInspector.panels.resources)
-                return null;
-            return WebInspector.panels.resources.resourceViewForResource(scriptOrResource);
-        }
-        if (scriptOrResource instanceof WebInspector.Script)
-            return this.scriptViewForScript(scriptOrResource);
-    },
+var scriptOrResource = this._sourceIDMap[currentFrame.sourceID];
+this._showScriptOrResource(scriptOrResource, {line: currentFrame.line});
 
-    _sourceFrameForScriptOrResource: function(scriptOrResource)
-    {
-        if (scriptOrResource instanceof WebInspector.Resource)
-            return WebInspector.panels.resources.sourceFrameForResource(scriptOrResource);
-        if (scriptOrResource instanceof WebInspector.Script)
-            return this.sourceFrameForScript(scriptOrResource);
-    },
+this._executionSourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource);
+if (this._executionSourceFrame)
+this._executionSourceFrame.executionLine = currentFrame.line;
+},
 
-    _showScriptOrResource: function(scriptOrResource, options)
-    {
-        // options = {line:, shouldHighlightLine:, fromBackForwardAction:, initialLoad:}
-        if (!options) 
-            options = {};
+_changeVisibleFile: function(event)
+{
+var select = this.filesSelectElement;
+this._showScriptOrResource(select.options[select.selectedIndex].representedObject);
+},
 
-        if (!scriptOrResource)
-            return;
+_startSidebarResizeDrag: function(event)
+{
+WebInspector.elementDragStart(this.sidebarElement, this._sidebarResizeDrag.bind(this), this._endSidebarResizeDrag.bind(this), event, "col-resize");
 
-        var view;
-        if (scriptOrResource instanceof WebInspector.Resource) {
-            if (!WebInspector.panels.resources)
-                return null;
-            view = WebInspector.panels.resources.resourceViewForResource(scriptOrResource);
-            view.headersVisible = false;
-            var breakpoints = this.sidebarPanes.breakpoints.breakpoints;
-            for (var breakpointId in breakpoints) {
-                var breakpoint = breakpoints[breakpointId];
-                if (breakpoint.url === scriptOrResource.url) {
-                    var sourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource);
-                    sourceFrame.addBreakpoint(breakpoint);
-                }
-            }
-        } else if (scriptOrResource instanceof WebInspector.Script)
-            view = this.scriptViewForScript(scriptOrResource);
+if (event.target === this.sidebarResizeWidgetElement)
+this._dragOffset = (event.target.offsetWidth - (event.pageX - event.target.totalOffsetLeft));
+else
+this._dragOffset = 0;
+},
 
-        if (!view)
-            return;
+_endSidebarResizeDrag: function(event)
+{
+WebInspector.elementDragEnd(event);
+delete this._dragOffset;
+this.saveSidebarWidth();
+},
 
-        var url = scriptOrResource.url || scriptOrResource.sourceURL;
-        if (url && !options.initialLoad)
-            WebInspector.settings.lastViewedScriptFile = url;
+_sidebarResizeDrag: function(event)
+{
+var x = event.pageX + this._dragOffset;
+var newWidth = Number.constrain(window.innerWidth - x, Preferences.minScriptsSidebarWidth, window.innerWidth * 0.66);
+this.setSidebarWidth(newWidth);
+event.preventDefault();
+},
 
-        if (!options.fromBackForwardAction) {
-            var oldIndex = this._currentBackForwardIndex;
-            if (oldIndex >= 0)
-                this._backForwardList.splice(oldIndex + 1, this._backForwardList.length - oldIndex);
+setSidebarWidth: function(newWidth)
+{
+this.sidebarElement.style.width = newWidth + "px";
+this.sidebarButtonsElement.style.width = newWidth + "px";
+this.viewsContainerElement.style.right = newWidth + "px";
+this.sidebarResizeWidgetElement.style.right = newWidth + "px";
+this.sidebarResizeElement.style.right = (newWidth - 3) + "px";
 
-            // Check for a previous entry of the same object in _backForwardList.
-            // If one is found, remove it and update _currentBackForwardIndex to match.
-            var previousEntryIndex = this._backForwardList.indexOf(scriptOrResource);
-            if (previousEntryIndex !== -1) {
-                this._backForwardList.splice(previousEntryIndex, 1);
-                --this._currentBackForwardIndex;
-            }
+this.resize();
+},
 
-            this._backForwardList.push(scriptOrResource);
-            ++this._currentBackForwardIndex;
+updatePauseOnExceptionsState: function(pauseOnExceptionsState)
+{
+if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions)
+this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
+else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions)
+this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions.");
+else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions)
+this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions.");
 
-            this._updateBackAndForwardButtons();
-        }
+this._pauseOnExceptionButton.state = pauseOnExceptionsState;
+},
 
-        this.visibleView = view;
+_updateDebuggerButtons: function()
+{
+if (this._debuggerEnabled) {
+this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable.");
+this.enableToggleButton.toggled = true;
+this._pauseOnExceptionButton.visible = true;
+this.panelEnablerView.visible = false;
+} else {
+this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable.");
+this.enableToggleButton.toggled = false;
+this._pauseOnExceptionButton.visible = false;
+this.panelEnablerView.visible = true;
+}
 
-        if (options.line) {
-            if (view.revealLine)
-                view.revealLine(options.line);
-            if (view.highlightLine && options.shouldHighlightLine)
-                view.highlightLine(options.line);
-        }
+if (this._paused) {
+this.pauseButton.addStyleClass("paused");
 
-        var option;
-        if (scriptOrResource instanceof WebInspector.Script) {
-            option = scriptOrResource.filesSelectOption;
+this.pauseButton.disabled = false;
+this.stepOverButton.disabled = false;
+this.stepIntoButton.disabled = false;
+this.stepOutButton.disabled = false;
 
-            // hasn't been added yet - happens for stepping in evals,
-            // so use the force option to force the script into the menu.
-            if (!option) {
-                this._addScriptToFilesMenu(scriptOrResource, true);
-                option = scriptOrResource.filesSelectOption;
-            }
+this.debuggerStatusElement.textContent = WebInspector.UIString("Paused");
+} else {
+this.pauseButton.removeStyleClass("paused");
 
-            console.assert(option);
-        } else
-            option = scriptOrResource.filesSelectOption;
+this.pauseButton.disabled = this._waitingToPause;
+this.stepOverButton.disabled = true;
+this.stepIntoButton.disabled = true;
+this.stepOutButton.disabled = true;
 
-        if (option)
-            this.filesSelectElement.selectedIndex = option.index;
-    },
+if (this._waitingToPause)
+this.debuggerStatusElement.textContent = WebInspector.UIString("Pausing");
+else if (this._stepping)
+this.debuggerStatusElement.textContent = WebInspector.UIString("Stepping");
+else
+this.debuggerStatusElement.textContent = "";
+}
+},
 
-    _addScriptToFilesMenu: function(script, force)
-    {
-        if (!script.sourceURL && !force)
-            return;
+_updateBackAndForwardButtons: function()
+{
+this.backButton.disabled = this._currentBackForwardIndex <= 0;
+this.forwardButton.disabled = this._currentBackForwardIndex >= (this._backForwardList.length - 1);
+},
 
-        if (script.resource) {
-            if (this._resourceForURLInFilesSelect[script.resource.url])
-                return;
-            this._resourceForURLInFilesSelect[script.resource.url] = script.resource;
-        }
- 
-        var displayName = script.sourceURL ? WebInspector.displayNameForURL(script.sourceURL) : WebInspector.UIString("(program)");
+_clearInterface: function()
+{
+this.sidebarPanes.callstack.update(null);
+this.sidebarPanes.scopechain.update(null);
 
-        var select = this.filesSelectElement;
-        var option = document.createElement("option");
-        option.representedObject = script.resource || script;
-        option.url = displayName;
-        option.startingLine = script.startingLine;
-        option.text = script.resource || script.startingLine === 1 ? displayName : String.sprintf("%s:%d", displayName, script.startingLine);
+this._clearCurrentExecutionLine();
+this._updateDebuggerButtons();
+},
 
-        function optionCompare(a, b)
-        {
-            if (a.url < b.url)
-                return -1;
-            else if (a.url > b.url)
-                return 1;
+_goBack: function()
+{
+if (this._currentBackForwardIndex <= 0) {
+console.error("Can't go back from index " + this._currentBackForwardIndex);
+return;
+}
 
-            if (typeof a.startingLine !== "number")
-                return -1;
-            if (typeof b.startingLine !== "number")
-                return -1;
-            return a.startingLine - b.startingLine;
-        }
+this._showScriptOrResource(this._backForwardList[--this._currentBackForwardIndex], {fromBackForwardAction: true});
+this._updateBackAndForwardButtons();
+},
 
-        var insertionIndex = insertionIndexForObjectInListSortedByFunction(option, select.childNodes, optionCompare);
-        if (insertionIndex < 0)
-            select.appendChild(option);
-        else
-            select.insertBefore(option, select.childNodes.item(insertionIndex));
+_goForward: function()
+{
+if (this._currentBackForwardIndex >= this._backForwardList.length - 1) {
+console.error("Can't go forward from index " + this._currentBackForwardIndex);
+return;
+}
 
-        if (script.resource)
-            script.resource.filesSelectOption = option;
-        else
-            script.filesSelectOption = option;
+this._showScriptOrResource(this._backForwardList[++this._currentBackForwardIndex], {fromBackForwardAction: true});
+this._updateBackAndForwardButtons();
+},
 
-        // Call _showScriptOrResource if the option we just appended ended up being selected.
-        // This will happen for the first item added to the menu.
-        if (select.options[select.selectedIndex] === option)
-            this._showScriptOrResource(option.representedObject, {initialLoad: true});
-        else {
-            // if not first item, check to see if this was the last viewed
-            var url = option.representedObject.url || option.representedObject.sourceURL;
-            var lastURL = WebInspector.settings.lastViewedScriptFile;
-            if (url && url === lastURL)
-                this._showScriptOrResource(option.representedObject, {initialLoad: true});
-        }
-    },
+_enableDebugging: function()
+{
+if (this._debuggerEnabled)
+return;
+this._toggleDebugging(this.panelEnablerView.alwaysEnabled);
+},
 
-    _clearCurrentExecutionLine: function()
-    {
-        if (this._executionSourceFrame)
-            this._executionSourceFrame.executionLine = 0;
-        delete this._executionSourceFrame;
-    },
+_toggleDebugging: function(optionalAlways)
+{
+this._paused = false;
+this._waitingToPause = false;
+this._stepping = false;
 
-    _callFrameSelected: function()
-    {
-        this._clearCurrentExecutionLine();
+if (this._debuggerEnabled)
+InspectorBackend.disableDebugger(true);
+else
+InspectorBackend.enableDebugger(!!optionalAlways);
+},
 
-        var callStackPane = this.sidebarPanes.callstack;
-        var currentFrame = callStackPane.selectedCallFrame;
-        if (!currentFrame)
-            return;
+_togglePauseOnExceptions: function()
+{
+InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states, this.updatePauseOnExceptionsState.bind(this));
+},
 
-        this.sidebarPanes.scopechain.update(currentFrame);
-        this.sidebarPanes.watchExpressions.refreshExpressions();
+_togglePause: function()
+{
+if (this._paused) {
+this._paused = false;
+this._waitingToPause = false;
+InspectorBackend.resume();
+} else {
+this._stepping = false;
+this._waitingToPause = true;
+InspectorBackend.pause();
+}
 
-        var scriptOrResource = this._sourceIDMap[currentFrame.sourceID];
-        this._showScriptOrResource(scriptOrResource, {line: currentFrame.line});
+this._clearInterface();
+},
 
-        this._executionSourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource);
-        if (this._executionSourceFrame)
-            this._executionSourceFrame.executionLine = currentFrame.line;
-    },
+_stepOverClicked: function()
+{
+this._paused = false;
+this._stepping = true;
 
-    _changeVisibleFile: function(event)
-    {
-        var select = this.filesSelectElement;
-        this._showScriptOrResource(select.options[select.selectedIndex].representedObject);
-    },
+this._clearInterface();
 
-    _startSidebarResizeDrag: function(event)
-    {
-        WebInspector.elementDragStart(this.sidebarElement, this._sidebarResizeDrag.bind(this), this._endSidebarResizeDrag.bind(this), event, "col-resize");
+InspectorBackend.stepOverStatement();
+},
 
-        if (event.target === this.sidebarResizeWidgetElement)
-            this._dragOffset = (event.target.offsetWidth - (event.pageX - event.target.totalOffsetLeft));
-        else
-            this._dragOffset = 0;
-    },
+_stepIntoClicked: function()
+{
+this._paused = false;
+this._stepping = true;
 
-    _endSidebarResizeDrag: function(event)
-    {
-        WebInspector.elementDragEnd(event);
+this._clearInterface();
 
-        delete this._dragOffset;
-    },
+InspectorBackend.stepIntoStatement();
+},
 
-    _sidebarResizeDrag: function(event)
-    {
-        var x = event.pageX + this._dragOffset;
-        var newWidth = Number.constrain(window.innerWidth - x, Preferences.minScriptsSidebarWidth, window.innerWidth * 0.66);
+_stepOutClicked: function()
+{
+this._paused = false;
+this._stepping = true;
 
-        this.sidebarElement.style.width = newWidth + "px";
-        this.sidebarButtonsElement.style.width = newWidth + "px";
-        this.viewsContainerElement.style.right = newWidth + "px";
-        this.sidebarResizeWidgetElement.style.right = newWidth + "px";
-        this.sidebarResizeElement.style.right = (newWidth - 3) + "px";
+this._clearInterface();
 
-        this.resize();
-        event.preventDefault();
-    },
-    
-    updatePauseOnExceptionsState: function(pauseOnExceptionsState)
-    {
-        if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions)
-            this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions.");
-        else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions)
-            this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions.");
-        else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions)
-            this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions.");
+InspectorBackend.stepOutOfFunction();
+},
 
-        this._pauseOnExceptionButton.state = pauseOnExceptionsState;
-    },
+toggleBreakpointsClicked: function()
+{
+this.toggleBreakpointsButton.toggled = !this.toggleBreakpointsButton.toggled;
+if (this.toggleBreakpointsButton.toggled) {
+InspectorBackend.activateBreakpoints();
+this.toggleBreakpointsButton.title = WebInspector.UIString("Deactivate all breakpoints.");
+document.getElementById("main-panels").removeStyleClass("breakpoints-deactivated");
+} else {
+InspectorBackend.deactivateBreakpoints();
+this.toggleBreakpointsButton.title = WebInspector.UIString("Activate all breakpoints.");
+document.getElementById("main-panels").addStyleClass("breakpoints-deactivated");
+}
+},
 
-    _updateDebuggerButtons: function()
-    {
-        if (this._debuggerEnabled) {
-            this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable.");
-            this.enableToggleButton.toggled = true;
-            this._pauseOnExceptionButton.visible = true;
-            this.panelEnablerView.visible = false;
-        } else {
-            this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable.");
-            this.enableToggleButton.toggled = false;
-            this._pauseOnExceptionButton.visible = false;
-            this.panelEnablerView.visible = true;
-        }
+elementsToRestoreScrollPositionsFor: function()
+{
+return [ this.sidebarElement ];
+},
 
-        if (this._paused) {
-            this.pauseButton.addStyleClass("paused");
+_registerShortcuts: function()
+{
+var section = WebInspector.shortcutsHelp.section(WebInspector.UIString("Scripts Panel"));
+var handler, shortcut1, shortcut2;
+var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
 
-            this.pauseButton.disabled = false;
-            this.stepOverButton.disabled = false;
-            this.stepIntoButton.disabled = false;
-            this.stepOutButton.disabled = false;
+this._shortcuts = {};
 
-            this.debuggerStatusElement.textContent = WebInspector.UIString("Paused");
-        } else {
-            this.pauseButton.removeStyleClass("paused");
 
-            this.pauseButton.disabled = this._waitingToPause;
-            this.stepOverButton.disabled = true;
-            this.stepIntoButton.disabled = true;
-            this.stepOutButton.disabled = true;
+handler = this.pauseButton.click.bind(this.pauseButton);
+shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8);
+this._shortcuts[shortcut1.key] = handler;
+shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier);
+this._shortcuts[shortcut2.key] = handler;
+section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Continue"));
 
-            if (this._waitingToPause)
-                this.debuggerStatusElement.textContent = WebInspector.UIString("Pausing");
-            else if (this._stepping)
-                this.debuggerStatusElement.textContent = WebInspector.UIString("Stepping");
-            else
-                this.debuggerStatusElement.textContent = "";
-        }
-    },
 
-    _updateBackAndForwardButtons: function()
-    {
-        this.backButton.disabled = this._currentBackForwardIndex <= 0;
-        this.forwardButton.disabled = this._currentBackForwardIndex >= (this._backForwardList.length - 1);
-    },
+handler = this.stepOverButton.click.bind(this.stepOverButton);
+shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10);
+this._shortcuts[shortcut1.key] = handler;
+shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, platformSpecificModifier);
+this._shortcuts[shortcut2.key] = handler;
+section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step over"));
 
-    _clearInterface: function()
-    {
-        this.sidebarPanes.callstack.update(null);
-        this.sidebarPanes.scopechain.update(null);
 
-        this._clearCurrentExecutionLine();
-        this._updateDebuggerButtons();
-    },
+handler = this.stepIntoButton.click.bind(this.stepIntoButton);
+shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11);
+this._shortcuts[shortcut1.key] = handler;
+shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, platformSpecificModifier);
+this._shortcuts[shortcut2.key] = handler;
+section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step into"));
 
-    _goBack: function()
-    {
-        if (this._currentBackForwardIndex <= 0) {
-            console.error("Can't go back from index " + this._currentBackForwardIndex);
-            return;
-        }
 
-        this._showScriptOrResource(this._backForwardList[--this._currentBackForwardIndex], {fromBackForwardAction: true});
-        this._updateBackAndForwardButtons();
-    },
+handler = this.stepOutButton.click.bind(this.stepOutButton);
+shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift);
+this._shortcuts[shortcut1.key] = handler;
+shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift, platformSpecificModifier);
+this._shortcuts[shortcut2.key] = handler;
+section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step out"));
 
-    _goForward: function()
-    {
-        if (this._currentBackForwardIndex >= this._backForwardList.length - 1) {
-            console.error("Can't go forward from index " + this._currentBackForwardIndex);
-            return;
-        }
+shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor("g", platformSpecificModifier);
+this._shortcuts[shortcut1.key] = this.showGoToLineDialog.bind(this);
+section.addAlternateKeys([ shortcut1.name ], WebInspector.UIString("Go to Line"));
+this.sidebarPanes.callstack.registerShortcuts(section);
+},
 
-        this._showScriptOrResource(this._backForwardList[++this._currentBackForwardIndex], {fromBackForwardAction: true});
-        this._updateBackAndForwardButtons();
-    },
+searchCanceled: function()
+{
+WebInspector.updateSearchMatchesCount(0, this);
 
-    _enableDebugging: function()
-    {
-        if (this._debuggerEnabled)
-            return;
-        this._toggleDebugging(this.panelEnablerView.alwaysEnabled);
-    },
+if (this._searchView)
+this._searchView.searchCanceled();
 
-    _toggleDebugging: function(optionalAlways)
-    {
-        this._paused = false;
-        this._waitingToPause = false;
-        this._stepping = false;
+delete this._searchView;
+delete this._searchQuery;
+},
 
-        if (this._debuggerEnabled)
-            InspectorBackend.disableDebugger(true);
-        else
-            InspectorBackend.enableDebugger(!!optionalAlways);
-    },
+performSearch: function(query)
+{
+if (!this.visibleView)
+return;
 
-    _togglePauseOnExceptions: function()
-    {
-        InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states);
-    },
 
-    _togglePause: function()
-    {
-        if (this._paused) {
-            this._paused = false;
-            this._waitingToPause = false;
-            InspectorBackend.resumeDebugger();
-        } else {
-            this._stepping = false;
-            this._waitingToPause = true;
-            InspectorBackend.pauseInDebugger();
-        }
+this.searchCanceled();
 
-        this._clearInterface();
-    },
+this._searchView = this.visibleView;
+this._searchQuery = query;
 
-    _stepOverClicked: function()
-    {
-        this._paused = false;
-        this._stepping = true;
+function finishedCallback(view, searchMatches)
+{
+if (!searchMatches)
+return;
 
-        this._clearInterface();
+WebInspector.updateSearchMatchesCount(searchMatches, this);
+view.jumpToFirstSearchResult();
+}
 
-        InspectorBackend.stepOverStatementInDebugger();
-    },
+this._searchView.performSearch(query, finishedCallback.bind(this));
+},
 
-    _stepIntoClicked: function()
-    {
-        this._paused = false;
-        this._stepping = true;
+jumpToNextSearchResult: function()
+{
+if (!this._searchView)
+return;
 
-        this._clearInterface();
+if (this._searchView !== this.visibleView) {
+this.performSearch(this._searchQuery);
+return;
+}
 
-        InspectorBackend.stepIntoStatementInDebugger();
-    },
+if (this._searchView.showingLastSearchResult())
+this._searchView.jumpToFirstSearchResult();
+else
+this._searchView.jumpToNextSearchResult();
+},
 
-    _stepOutClicked: function()
-    {
-        this._paused = false;
-        this._stepping = true;
+jumpToPreviousSearchResult: function()
+{
+if (!this._searchView)
+return;
 
-        this._clearInterface();
+if (this._searchView !== this.visibleView) {
+this.performSearch(this._searchQuery);
+if (this._searchView)
+this._searchView.jumpToLastSearchResult();
+return;
+}
 
-        InspectorBackend.stepOutOfFunctionInDebugger();
-    },
+if (this._searchView.showingFirstSearchResult())
+this._searchView.jumpToLastSearchResult();
+else
+this._searchView.jumpToPreviousSearchResult();
+},
 
-    _toggleBreakpointsClicked: function()
-    {
-        this.toggleBreakpointsButton.toggled = !this.toggleBreakpointsButton.toggled;
-        if (this.toggleBreakpointsButton.toggled) {
-            InspectorBackend.activateBreakpoints();
-            this.toggleBreakpointsButton.title = WebInspector.UIString("Deactivate all breakpoints.");
-            document.getElementById("main-panels").removeStyleClass("breakpoints-deactivated");
-        } else {
-            InspectorBackend.deactivateBreakpoints();
-            this.toggleBreakpointsButton.title = WebInspector.UIString("Activate all breakpoints.");
-            document.getElementById("main-panels").addStyleClass("breakpoints-deactivated");
-        }
-    }
+showGoToLineDialog: function(e)
+{
+var view = this.visibleView;
+if (view)
+WebInspector.GoToLineDialog.show(view);
+}
 }
 
 WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
-/* StoragePanel.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.StoragePanel = function(database)
+
+
+WebInspector.ResourcesPanel = function(database)
 {
-    WebInspector.Panel.call(this);
+WebInspector.Panel.call(this, "resources");
 
-    this.createSidebar();
+WebInspector.settings.installApplicationSetting("resourcesLastSelectedItem", {});
 
-    this.databasesListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("DATABASES"), {}, true);
-    this.sidebarTree.appendChild(this.databasesListTreeElement);
-    this.databasesListTreeElement.expand();
+this.createSidebar();
+this.sidebarElement.addStyleClass("outline-disclosure filter-all children small");
+this.sidebarTreeElement.removeStyleClass("sidebar-tree");
 
-    this.localStorageListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("LOCAL STORAGE"), {}, true);
-    this.sidebarTree.appendChild(this.localStorageListTreeElement);
-    this.localStorageListTreeElement.expand();
+this.resourcesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Frames"), "Frames", "frame-storage-tree-item");
+this.sidebarTree.appendChild(this.resourcesListTreeElement);
+this._treeElementForFrameId = {};
 
-    this.sessionStorageListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("SESSION STORAGE"), {}, true);
-    this.sidebarTree.appendChild(this.sessionStorageListTreeElement);
-    this.sessionStorageListTreeElement.expand();
+this.databasesListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Databases"), "Databases", "database-storage-tree-item");
+this.sidebarTree.appendChild(this.databasesListTreeElement);
 
-    this.cookieListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("COOKIES"), {}, true);
-    this.sidebarTree.appendChild(this.cookieListTreeElement);
-    this.cookieListTreeElement.expand();
+this.localStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Local Storage"), "LocalStorage", "domstorage-storage-tree-item local-storage");
+this.sidebarTree.appendChild(this.localStorageListTreeElement);
 
-    this.storageViews = document.createElement("div");
-    this.storageViews.id = "storage-views";
-    this.element.appendChild(this.storageViews);
+this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Session Storage"), "SessionStorage", "domstorage-storage-tree-item session-storage");
+this.sidebarTree.appendChild(this.sessionStorageListTreeElement);
 
-    this.storageViewStatusBarItemsContainer = document.createElement("div");
-    this.storageViewStatusBarItemsContainer.id = "storage-view-status-bar-items";
+this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Cookies"), "Cookies", "cookie-storage-tree-item");
+this.sidebarTree.appendChild(this.cookieListTreeElement);
 
-    this.reset();
+this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", "application-cache-storage-tree-item");
+this.sidebarTree.appendChild(this.applicationCacheListTreeElement);
+
+if (Preferences.fileSystemEnabled) {
+this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("File System"), "FileSystem", "file-system-storage-tree-item");
+this.sidebarTree.appendChild(this.fileSystemListTreeElement);
+this.fileSystemListTreeElement.expand();
 }
 
-WebInspector.StoragePanel.prototype = {
-    toolbarItemClass: "storage",
+this.storageViews = document.createElement("div");
+this.storageViews.id = "storage-views";
+this.storageViews.className = "diff-container";
+this.element.appendChild(this.storageViews);
 
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Storage");
-    },
+this.storageViewStatusBarItemsContainer = document.createElement("div");
+this.storageViewStatusBarItemsContainer.className = "status-bar-items";
 
-    get statusBarItems()
-    {
-        return [this.storageViewStatusBarItemsContainer];
-    },
+this._databases = [];
+this._domStorage = [];
+this._cookieViews = {};
+this._origins = {};
+this._domains = {};
 
-    reset: function()
-    {
-        if (this._databases) {
-            var databasesLength = this._databases.length;
-            for (var i = 0; i < databasesLength; ++i) {
-                var database = this._databases[i];
-
-                delete database._tableViews;
-                delete database._queryView;
-            }
-        }
-
-        this._databases = [];
-
-        if (this._domStorage) {
-            var domStorageLength = this._domStorage.length;
-            for (var i = 0; i < domStorageLength; ++i) {
-                var domStorage = this._domStorage[i];
-
-                delete domStorage._domStorageView;
-            }
-        }
-
-        this._domStorage = [];
-
-        this._cookieViews = {};
-
-        this.databasesListTreeElement.removeChildren();
-        this.localStorageListTreeElement.removeChildren();
-        this.sessionStorageListTreeElement.removeChildren();
-        this.cookieListTreeElement.removeChildren();
-
-        this.storageViews.removeChildren();        
-
-        this.storageViewStatusBarItemsContainer.removeChildren();
-        
-        if (this.sidebarTree.selectedTreeElement)
-            this.sidebarTree.selectedTreeElement.deselect();
-    },
-
-    addDatabase: function(database)
-    {
-        this._databases.push(database);
-
-        var databaseTreeElement = new WebInspector.DatabaseSidebarTreeElement(database);
-        database._databasesTreeElement = databaseTreeElement;
-        this.databasesListTreeElement.appendChild(databaseTreeElement);
-    },
-    
-    addCookieDomain: function(domain)
-    {
-        var cookieDomainTreeElement = new WebInspector.CookieSidebarTreeElement(domain);
-        this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
-    },
-
-    addDOMStorage: function(domStorage)
-    {
-        this._domStorage.push(domStorage);
-        var domStorageTreeElement = new WebInspector.DOMStorageSidebarTreeElement(domStorage, (domStorage.isLocalStorage ? "local-storage" : "session-storage"));
-        domStorage._domStorageTreeElement = domStorageTreeElement;
-        if (domStorage.isLocalStorage)
-            this.localStorageListTreeElement.appendChild(domStorageTreeElement);
-        else
-            this.sessionStorageListTreeElement.appendChild(domStorageTreeElement);
-    },
-
-    selectDatabase: function(databaseId)
-    {
-        var database;
-        for (var i = 0, len = this._databases.length; i < len; ++i) {
-            database = this._databases[i];
-            if (database.id === databaseId) {
-                this.showDatabase(database);
-                database._databasesTreeElement.select();
-                return;
-            }
-        }
-    },
-
-    selectDOMStorage: function(storageId)
-    {
-        var domStorage = this._domStorageForId(storageId);
-        if (domStorage) {
-            this.showDOMStorage(domStorage);
-            domStorage._domStorageTreeElement.select();
-        }
-    },
-
-    showDatabase: function(database, tableName)
-    {
-        if (!database)
-            return;
-
-        if (this.visibleView)
-            this.visibleView.hide();
-
-        var view;
-        if (tableName) {
-            if (!("_tableViews" in database))
-                database._tableViews = {};
-            view = database._tableViews[tableName];
-            if (!view) {
-                view = new WebInspector.DatabaseTableView(database, tableName);
-                database._tableViews[tableName] = view;
-            }
-        } else {
-            view = database._queryView;
-            if (!view) {
-                view = new WebInspector.DatabaseQueryView(database);
-                database._queryView = view;
-            }
-        }
-
-        view.show(this.storageViews);
-
-        this.visibleView = view;
-
-        this.storageViewStatusBarItemsContainer.removeChildren();
-        var statusBarItems = view.statusBarItems || [];
-        for (var i = 0; i < statusBarItems.length; ++i)
-            this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i].element);
-    },
-
-    showDOMStorage: function(domStorage)
-    {
-        if (!domStorage)
-            return;
-
-        if (this.visibleView)
-            this.visibleView.hide();
-
-        var view;
-        view = domStorage._domStorageView;
-        if (!view) {
-            view = new WebInspector.DOMStorageItemsView(domStorage);
-            domStorage._domStorageView = view;
-        }
-
-        view.show(this.storageViews);
-
-        this.visibleView = view;
-
-        this.storageViewStatusBarItemsContainer.removeChildren();
-        var statusBarItems = view.statusBarItems;
-        for (var i = 0; i < statusBarItems.length; ++i)
-            this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
-    },
-
-    showCookies: function(treeElement, cookieDomain)
-    {
-        if (this.visibleView)
-            this.visibleView.hide();
-
-        var view = this._cookieViews[cookieDomain];
-        if (!view) {
-            view = new WebInspector.CookieItemsView(treeElement, cookieDomain);
-            this._cookieViews[cookieDomain] = view;
-        }
-
-        view.show(this.storageViews);
-
-        this.visibleView = view;
-
-        this.storageViewStatusBarItemsContainer.removeChildren();
-        var statusBarItems = view.statusBarItems;
-        for (var i = 0; i < statusBarItems.length; ++i)
-            this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
-    },
-
-    closeVisibleView: function()
-    {
-        if (this.visibleView)
-            this.visibleView.hide();
-        delete this.visibleView;
-    },
-
-    updateDatabaseTables: function(database)
-    {
-        if (!database || !database._databasesTreeElement)
-            return;
-
-        database._databasesTreeElement.shouldRefreshChildren = true;
-
-        if (!("_tableViews" in database))
-            return;
-
-        var tableNamesHash = {};
-        var self = this;
-        function tableNamesCallback(tableNames)
-        {
-            var tableNamesLength = tableNames.length;
-            for (var i = 0; i < tableNamesLength; ++i)
-                tableNamesHash[tableNames[i]] = true;
-
-            for (var tableName in database._tableViews) {
-                if (!(tableName in tableNamesHash)) {
-                    if (self.visibleView === database._tableViews[tableName])
-                        self.closeVisibleView();
-                    delete database._tableViews[tableName];
-                }
-            }
-        }
-        database.getTableNames(tableNamesCallback);
-    },
-
-    dataGridForResult: function(rows)
-    {
-        if (!rows.length)
-            return null;
-
-        var columns = {};
-        var numColumns = 0;
-
-        for (var columnIdentifier in rows[0]) {
-            var column = {};
-            column.width = columnIdentifier.length;
-            column.title = columnIdentifier;
-
-            columns[columnIdentifier] = column;
-            ++numColumns;
-        }
-
-        var nodes = [];
-        var length = rows.length;
-        for (var i = 0; i < length; ++i) {
-            var data = {};
-
-            var row = rows[i];
-            for (var columnIdentifier in row)
-                data[columnIdentifier] = row[columnIdentifier];
-
-            var node = new WebInspector.DataGridNode(data, false);
-            node.selectable = false;
-            nodes.push(node);
-        }
-
-        var dataGrid = new WebInspector.DataGrid(columns);
-        var length = nodes.length;
-        for (var i = 0; i < length; ++i)
-            dataGrid.appendChild(nodes[i]);
-
-        return dataGrid;
-    },
-
-    updateDOMStorage: function(storageId)
-    {
-        var domStorage = this._domStorageForId(storageId);
-        if (!domStorage)
-            return;
-
-        var view = domStorage._domStorageView;
-        if (this.visibleView && view === this.visibleView)
-            domStorage._domStorageView.update();
-    },
-
-    _domStorageForId: function(storageId)
-    {
-        if (!this._domStorage)
-            return null;
-        var domStorageLength = this._domStorage.length;
-        for (var i = 0; i < domStorageLength; ++i) {
-            var domStorage = this._domStorage[i];
-            if (domStorage.id == storageId)
-                return domStorage;
-        }
-        return null;
-    },
-
-    updateMainViewWidth: function(width)
-    {
-        this.storageViews.style.left = width + "px";
-        this.storageViewStatusBarItemsContainer.style.left = width + "px";
-        this.resize();
-    }
+this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
+this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
 }
 
-WebInspector.StoragePanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-WebInspector.DatabaseSidebarTreeElement = function(database)
+WebInspector.ResourcesPanel.prototype = {
+get toolbarItemLabel()
 {
-    this.database = database;
+return WebInspector.UIString("Resources");
+},
 
-    WebInspector.SidebarTreeElement.call(this, "database-sidebar-tree-item", "", "", database, true);
-
-    this.refreshTitles();
-}
-
-WebInspector.DatabaseSidebarTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.storage.showDatabase(this.database);
-    },
-
-    oncollapse: function()
-    {
-        // Request a refresh after every collapse so the next
-        // expand will have an updated table list.
-        this.shouldRefreshChildren = true;
-    },
-
-    onpopulate: function()
-    {
-        this.removeChildren();
-
-        var self = this;
-        function tableNamesCallback(tableNames)
-        {
-            var tableNamesLength = tableNames.length;
-            for (var i = 0; i < tableNamesLength; ++i)
-                self.appendChild(new WebInspector.SidebarDatabaseTableTreeElement(self.database, tableNames[i]));
-        }
-        this.database.getTableNames(tableNamesCallback);
-    },
-
-    get mainTitle()
-    {
-        return this.database.name;
-    },
-
-    set mainTitle(x)
-    {
-        // Do nothing.
-    },
-
-    get subtitle()
-    {
-        return this.database.displayDomain;
-    },
-
-    set subtitle(x)
-    {
-        // Do nothing.
-    }
-}
-
-WebInspector.DatabaseSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
-
-WebInspector.SidebarDatabaseTableTreeElement = function(database, tableName)
+get statusBarItems()
 {
-    this.database = database;
-    this.tableName = tableName;
+return [this.storageViewStatusBarItemsContainer];
+},
 
-    WebInspector.SidebarTreeElement.call(this, "database-table-sidebar-tree-item small", tableName, "", null, false);
+elementsToRestoreScrollPositionsFor: function()
+{
+return [this.sidebarElement];
+},
+
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+
+if (this.visibleView instanceof WebInspector.ResourceView)
+this._showResourceView(this.visibleView.resource);
+
+if (this._initializedDefaultSelection)
+return;
+
+this._initializedDefaultSelection = true;
+var itemURL = WebInspector.settings.resourcesLastSelectedItem;
+if (itemURL) {
+for (var treeElement = this.sidebarTree.children[0]; treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.sidebarTree, true)) {
+if (treeElement.itemURL === itemURL) {
+treeElement.select();
+treeElement.reveal();
+return;
+}
+}
+}
+this._initDefaultSelection();
+},
+
+_initDefaultSelection: function()
+{
+if (WebInspector.mainResource && this.resourcesListTreeElement && this.resourcesListTreeElement.expanded)
+this.showResource(WebInspector.mainResource);
+},
+
+reset: function()
+{
+this._origins = {};
+this._domains = {};
+for (var i = 0; i < this._databases.length; ++i) {
+var database = this._databases[i];
+delete database._tableViews;
+delete database._queryView;
+}
+this._databases = [];
+
+var domStorageLength = this._domStorage.length;
+for (var i = 0; i < this._domStorage.length; ++i) {
+var domStorage = this._domStorage[i];
+delete domStorage._domStorageView;
+}
+this._domStorage = [];
+
+this._cookieViews = {};
+this._fileSystemView = null;
+
+this._applicationCacheView = null;
+delete this._cachedApplicationCacheViewStatus;
+
+this.databasesListTreeElement.removeChildren();
+this.localStorageListTreeElement.removeChildren();
+this.sessionStorageListTreeElement.removeChildren();
+this.cookieListTreeElement.removeChildren();
+this.applicationCacheListTreeElement.removeChildren();
+if (Preferences.fileSystemEnabled)
+this.fileSystemListTreeElement.removeChildren();
+this.storageViews.removeChildren();
+
+this.storageViewStatusBarItemsContainer.removeChildren();
+
+if (this.sidebarTree.selectedTreeElement)
+this.sidebarTree.selectedTreeElement.deselect();
+},
+
+addOrUpdateFrame: function(parentFrameId, frameId, title, subtitle)
+{
+var frameTreeElement = this._treeElementForFrameId[frameId];
+if (frameTreeElement) {
+frameTreeElement.setTitles(title, subtitle);
+return;
 }
 
-WebInspector.SidebarDatabaseTableTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.storage.showDatabase(this.database, this.tableName);
-    }
+var parentTreeElement = parentFrameId ? this._treeElementForFrameId[parentFrameId] : this.resourcesListTreeElement;
+if (!parentTreeElement) {
+console.warning("No frame with id:" + parentFrameId + " to route " + displayName + " to.")
+return;
 }
 
-WebInspector.SidebarDatabaseTableTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
+var frameTreeElement = new WebInspector.FrameTreeElement(this, frameId, title, subtitle);
+this._treeElementForFrameId[frameId] = frameTreeElement;
 
-WebInspector.DOMStorageSidebarTreeElement = function(domStorage, className)
+
+var children = parentTreeElement.children;
+for (var i = 0; i < children.length; ++i) {
+var child = children[i];
+if (!(child instanceof WebInspector.FrameTreeElement)) {
+parentTreeElement.insertChild(frameTreeElement, i);
+return;
+}
+if (child.displayName.localeCompare(frameTreeElement.displayName) > 0) {
+parentTreeElement.insertChild(frameTreeElement, i);
+return;
+}
+}
+parentTreeElement.appendChild(frameTreeElement);
+},
+
+removeFrame: function(frameId)
+{
+var frameTreeElement = this._treeElementForFrameId[frameId];
+if (!frameTreeElement)
+return;
+delete this._treeElementForFrameId[frameId];
+if (frameTreeElement.parent)
+frameTreeElement.parent.removeChild(frameTreeElement);
+},
+
+addResourceToFrame: function(frameId, resource)
+{
+this.addDocumentURL(resource.documentURL);
+
+if (resource.statusCode >= 301 && resource.statusCode <= 303)
+return;
+
+var frameTreeElement = this._treeElementForFrameId[frameId];
+if (!frameTreeElement) {
+
+
+return;
+}
+
+var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this, resource);
+
+
+var children = frameTreeElement.children;
+for (var i = 0; i < children.length; ++i) {
+var child = children[i];
+if (!(child instanceof WebInspector.FrameResourceTreeElement))
+continue;
+
+if (resource.type === WebInspector.Resource.Type.Document ||
+(child._resource.type !== WebInspector.Resource.Type.Document && child._resource.displayName.localeCompare(resource.displayName) > 0)) {
+frameTreeElement.insertChild(resourceTreeElement, i);
+return;
+}
+}
+frameTreeElement.appendChild(resourceTreeElement);
+},
+
+removeResourcesFromFrame: function(frameId)
+{
+var frameTreeElement = this._treeElementForFrameId[frameId];
+if (frameTreeElement)
+frameTreeElement.removeChildren();
+},
+
+refreshResource: function(resource)
 {
 
-    this.domStorage = domStorage;
-
-    WebInspector.SidebarTreeElement.call(this, "domstorage-sidebar-tree-item " + className, domStorage, "", null, false);
-
-    this.refreshTitles();
+if (resource.type === WebInspector.Resource.Type.XHR) {
+var resourceTreeElement = this._findTreeElementForResource(resource);
+if (resourceTreeElement)
+resourceTreeElement.parent.removeChild(resourceTreeElement);
 }
+},
 
-WebInspector.DOMStorageSidebarTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.storage.showDOMStorage(this.domStorage);
-    },
-
-    get mainTitle()
-    {
-        return this.domStorage.domain ? this.domStorage.domain : WebInspector.UIString("Local Files");
-    },
-
-    set mainTitle(x)
-    {
-        // Do nothing.
-    },
-
-    get subtitle()
-    {
-        return ""; //this.database.displayDomain;
-    },
-
-    set subtitle(x)
-    {
-        // Do nothing.
-    }
-}
-
-WebInspector.DOMStorageSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
-
-WebInspector.CookieSidebarTreeElement = function(cookieDomain)
+addDatabase: function(database)
 {
-    WebInspector.SidebarTreeElement.call(this, "cookie-sidebar-tree-item", cookieDomain, "", null, false);
-    this._cookieDomain = cookieDomain;
-    this._subtitle = "";
+this._databases.push(database);
 
-    this.refreshTitles();
+var databaseTreeElement = new WebInspector.DatabaseTreeElement(this, database);
+database._databasesTreeElement = databaseTreeElement;
+this.databasesListTreeElement.appendChild(databaseTreeElement);
+},
+
+addDocumentURL: function(url)
+{
+var parsedURL = url.asParsedURL();
+if (!parsedURL)
+return;
+
+var domain = parsedURL.host;
+if (!this._domains[domain]) {
+this._domains[domain] = true;
+
+var cookieDomainTreeElement = new WebInspector.CookieTreeElement(this, domain);
+this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
+
+var applicationCacheTreeElement = new WebInspector.ApplicationCacheTreeElement(this, domain);
+this.applicationCacheListTreeElement.appendChild(applicationCacheTreeElement);
 }
 
-WebInspector.CookieSidebarTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.storage.showCookies(this, this._cookieDomain);
-    },
+if (Preferences.fileSystemEnabled) {
 
-    get mainTitle()
-    {
-        return this._cookieDomain ? this._cookieDomain : WebInspector.UIString("Local Files");
-    },
+var securityOrigin = parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "");
+if (!this._origins[securityOrigin]) {
+this._origins[securityOrigin] = true;
+var fileSystemTreeElement = new WebInspector.FileSystemTreeElement(this, securityOrigin);
+this.fileSystemListTreeElement.appendChild(fileSystemTreeElement);
+}
+}
+},
 
-    set mainTitle(x)
-    {
-        // Do nothing.
-    },
+addDOMStorage: function(domStorage)
+{
+this._domStorage.push(domStorage);
+var domStorageTreeElement = new WebInspector.DOMStorageTreeElement(this, domStorage, (domStorage.isLocalStorage ? "local-storage" : "session-storage"));
+domStorage._domStorageTreeElement = domStorageTreeElement;
+if (domStorage.isLocalStorage)
+this.localStorageListTreeElement.appendChild(domStorageTreeElement);
+else
+this.sessionStorageListTreeElement.appendChild(domStorageTreeElement);
+},
 
-    get subtitle()
-    {
-        return this._subtitle;
-    },
+selectDatabase: function(databaseId)
+{
+var database;
+for (var i = 0, len = this._databases.length; i < len; ++i) {
+database = this._databases[i];
+if (database.id === databaseId) {
+this.showDatabase(database);
+database._databasesTreeElement.select();
+return;
+}
+}
+},
 
-    set subtitle(x)
-    {
-        this._subtitle = x;
-        this.refreshTitles();
-    }
+selectDOMStorage: function(storageId)
+{
+var domStorage = this._domStorageForId(storageId);
+if (domStorage) {
+this.showDOMStorage(domStorage);
+domStorage._domStorageTreeElement.select();
+}
+},
+
+canShowSourceLine: function(url, line)
+{
+return !!WebInspector.resourceManager.resourceForURL(url);
+},
+
+showSourceLine: function(url, line)
+{
+var resource = WebInspector.resourceManager.resourceForURL(url);
+if (resource.type === WebInspector.Resource.Type.XHR) {
+
+if (WebInspector.panels.network && WebInspector.panels.network.canShowSourceLine(url, line)) {
+WebInspector.currentPanel = WebInspector.panels.network;
+WebInspector.panels.network.showSourceLine(url, line);
+}
+return;
+}
+this.showResource(WebInspector.resourceManager.resourceForURL(url), line);
+},
+
+showResource: function(resource, line)
+{
+var resourceTreeElement = this._findTreeElementForResource(resource);
+if (resourceTreeElement) {
+resourceTreeElement.reveal();
+resourceTreeElement.select();
 }
 
-WebInspector.CookieSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
+if (line) {
+var view = WebInspector.ResourceManager.resourceViewForResource(resource);
+if (view.revealLine)
+view.revealLine(line);
+if (view.highlightLine)
+view.highlightLine(line);
+}
+return true;
+},
 
-/* ProfilesPanel.js */
+_showResourceView: function(resource)
+{
+var view = WebInspector.ResourceManager.resourceViewForResource(resource);
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+if (resource.baseRevision && view instanceof WebInspector.SourceView) {
+function callback(baseContent)
+{
+if (baseContent)
+this._applyDiffMarkup(view, baseContent, resource.content);
+}
+resource.baseRevision.requestContent(callback.bind(this));
+}
+this._innerShowView(view);
+},
+
+_applyDiffMarkup: function(view, baseContent, newContent) {
+var oldLines = baseContent.split("\n");
+var newLines = newContent.split("\n");
+
+var diff = Array.diff(oldLines, newLines);
+
+var diffData = {};
+diffData.added = [];
+diffData.removed = [];
+diffData.changed = [];
+
+var offset = 0;
+var right = diff.right;
+for (var i = 0; i < right.length; ++i) {
+if (typeof right[i] === "string") {
+if (right.length > i + 1 && right[i + 1].row === i + 1 - offset)
+diffData.changed.push(i);
+else {
+diffData.added.push(i);
+offset++;
+}
+} else
+offset = i - right[i].row;
+}
+view.sourceFrame.markDiff(diffData);
+},
+
+showDatabase: function(database, tableName)
+{
+if (!database)
+return;
+
+var view;
+if (tableName) {
+if (!("_tableViews" in database))
+database._tableViews = {};
+view = database._tableViews[tableName];
+if (!view) {
+view = new WebInspector.DatabaseTableView(database, tableName);
+database._tableViews[tableName] = view;
+}
+} else {
+view = database._queryView;
+if (!view) {
+view = new WebInspector.DatabaseQueryView(database);
+database._queryView = view;
+}
+}
+
+this._innerShowView(view);
+},
+
+showDOMStorage: function(domStorage)
+{
+if (!domStorage)
+return;
+
+var view;
+view = domStorage._domStorageView;
+if (!view) {
+view = new WebInspector.DOMStorageItemsView(domStorage);
+domStorage._domStorageView = view;
+}
+
+this._innerShowView(view);
+},
+
+showCookies: function(treeElement, cookieDomain)
+{
+var view = this._cookieViews[cookieDomain];
+if (!view) {
+view = new WebInspector.CookieItemsView(treeElement, cookieDomain);
+this._cookieViews[cookieDomain] = view;
+}
+
+this._innerShowView(view);
+},
+
+showApplicationCache: function(treeElement, appcacheDomain)
+{
+var view = this._applicationCacheView;
+if (!view) {
+view = new WebInspector.ApplicationCacheItemsView(treeElement, appcacheDomain);
+this._applicationCacheView = view;
+}
+
+this._innerShowView(view);
+
+if ("_cachedApplicationCacheViewStatus" in this)
+this._applicationCacheView.updateStatus(this._cachedApplicationCacheViewStatus);
+},
+
+showFileSystem: function(treeElement, origin)
+{
+this._fileSystemView = new WebInspector.FileSystemView(treeElement, origin);
+this._innerShowView(this._fileSystemView);
+},
+
+showCategoryView: function(categoryName)
+{
+if (!this._categoryView)
+this._categoryView = new WebInspector.StorageCategoryView();
+this._categoryView.setText(categoryName);
+this._innerShowView(this._categoryView);
+},
+
+_innerShowView: function(view)
+{
+if (this.visibleView)
+this.visibleView.hide();
+
+view.show(this.storageViews);
+this.visibleView = view;
+
+this.storageViewStatusBarItemsContainer.removeChildren();
+var statusBarItems = view.statusBarItems || [];
+for (var i = 0; i < statusBarItems.length; ++i)
+this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
+},
+
+closeVisibleView: function()
+{
+if (this.visibleView)
+this.visibleView.hide();
+delete this.visibleView;
+},
+
+updateDatabaseTables: function(database)
+{
+if (!database || !database._databasesTreeElement)
+return;
+
+database._databasesTreeElement.shouldRefreshChildren = true;
+
+if (!("_tableViews" in database))
+return;
+
+var tableNamesHash = {};
+var self = this;
+function tableNamesCallback(tableNames)
+{
+var tableNamesLength = tableNames.length;
+for (var i = 0; i < tableNamesLength; ++i)
+tableNamesHash[tableNames[i]] = true;
+
+for (var tableName in database._tableViews) {
+if (!(tableName in tableNamesHash)) {
+if (self.visibleView === database._tableViews[tableName])
+self.closeVisibleView();
+delete database._tableViews[tableName];
+}
+}
+}
+database.getTableNames(tableNamesCallback);
+},
+
+dataGridForResult: function(columnNames, values)
+{
+var numColumns = columnNames.length;
+if (!numColumns)
+return null;
+
+var columns = {};
+
+for (var i = 0; i < columnNames.length; ++i) {
+var column = {};
+column.width = columnNames[i].length;
+column.title = columnNames[i];
+column.sortable = true;
+
+columns[columnNames[i]] = column;
+}
+
+var nodes = [];
+for (var i = 0; i < values.length / numColumns; ++i) {
+var data = {};
+for (var j = 0; j < columnNames.length; ++j)
+data[columnNames[j]] = values[numColumns * i + j];
+
+var node = new WebInspector.DataGridNode(data, false);
+node.selectable = false;
+nodes.push(node);
+}
+
+var dataGrid = new WebInspector.DataGrid(columns);
+var length = nodes.length;
+for (var i = 0; i < length; ++i)
+dataGrid.appendChild(nodes[i]);
+
+dataGrid.addEventListener("sorting changed", this._sortDataGrid.bind(this, dataGrid), this);
+return dataGrid;
+},
+
+_sortDataGrid: function(dataGrid)
+{
+var nodes = dataGrid.children.slice();
+var sortColumnIdentifier = dataGrid.sortColumnIdentifier;
+var sortDirection = dataGrid.sortOrder === "ascending" ? 1 : -1;
+var columnIsNumeric = true;
+
+for (var i = 0; i < nodes.length; i++) {
+if (isNaN(Number(nodes[i].data[sortColumnIdentifier])))
+columnIsNumeric = false;
+}
+
+function comparator(dataGridNode1, dataGridNode2)
+{
+var item1 = dataGridNode1.data[sortColumnIdentifier];
+var item2 = dataGridNode2.data[sortColumnIdentifier];
+
+var comparison;
+if (columnIsNumeric) {
+
+var number1 = parseFloat(item1);
+var number2 = parseFloat(item2);
+comparison = number1 < number2 ? -1 : (number1 > number2 ? 1 : 0);
+} else
+comparison = item1 < item2 ? -1 : (item1 > item2 ? 1 : 0);
+
+return sortDirection * comparison;
+}
+
+nodes.sort(comparator);
+dataGrid.removeChildren();
+for (var i = 0; i < nodes.length; i++)
+dataGrid.appendChild(nodes[i]);
+},
+
+updateDOMStorage: function(storageId)
+{
+var domStorage = this._domStorageForId(storageId);
+if (!domStorage)
+return;
+
+var view = domStorage._domStorageView;
+if (this.visibleView && view === this.visibleView)
+domStorage._domStorageView.update();
+},
+
+updateApplicationCacheStatus: function(status)
+{
+this._cachedApplicationCacheViewStatus = status;
+if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
+this._applicationCacheView.updateStatus(status);
+},
+
+updateFileSystemPath: function(root, type, origin)
+{
+if (this._fileSystemView && this._fileSystemView === this.visibleView)
+this._fileSystemView.updateFileSystemPath(root, type, origin);  
+},
+
+updateFileSystemError: function(type, origin)
+{
+if (this._fileSystemView && this._fileSystemView === this.visibleView)
+this._fileSystemView.updateFileSystemError(type, origin);  
+},
+
+setFileSystemDisabled: function()
+{
+if (this._fileSystemView && this._fileSystemView === this.visibleView)
+this._fileSystemView.setFileSystemDisabled();  
+},
+
+updateNetworkState: function(isNowOnline)
+{
+if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
+this._applicationCacheView.updateNetworkState(isNowOnline);
+},
+
+updateManifest: function(manifest)
+{
+if (this._applicationCacheView && this._applicationCacheView === this.visibleView)
+this._applicationCacheView.updateManifest(manifest);
+},
+
+_domStorageForId: function(storageId)
+{
+if (!this._domStorage)
+return null;
+var domStorageLength = this._domStorage.length;
+for (var i = 0; i < domStorageLength; ++i) {
+var domStorage = this._domStorage[i];
+if (domStorage.id == storageId)
+return domStorage;
+}
+return null;
+},
+
+updateMainViewWidth: function(width)
+{
+this.storageViews.style.left = width + "px";
+this.storageViewStatusBarItemsContainer.style.left = width + "px";
+this.resize();
+},
+
+get searchableViews()
+{
+var views = [];
+
+const visibleView = this.visibleView;
+if (visibleView instanceof WebInspector.ResourceView && visibleView.performSearch)
+views.push(visibleView);
+
+function callback(resourceTreeElement)
+{
+var resource = resourceTreeElement._resource;
+var resourceView = WebInspector.ResourceManager.resourceViewForResource(resource);
+if (resourceView.performSearch && resourceView !== visibleView)
+views.push(resourceView);
+}
+this._forAllResourceTreeElements(callback);
+return views;
+},
+
+_forAllResourceTreeElements: function(callback)
+{
+var stop = false;
+for (var treeElement = this.resourcesListTreeElement; !stop && treeElement; treeElement = treeElement.traverseNextTreeElement(false, this.resourcesListTreeElement, true)) {
+if (treeElement instanceof WebInspector.FrameResourceTreeElement)
+stop = callback(treeElement);
+}
+},
+
+searchMatchFound: function(view, matches)
+{
+if (!view.resource)
+return;
+var treeElement = this._findTreeElementForResource(view.resource);
+if (treeElement)
+treeElement.searchMatchFound(matches);
+},
+
+_findTreeElementForResource: function(resource)
+{
+function isAncestor(ancestor, object)
+{
+
+return false;
+}
+
+function getParent(object)
+{
+
+return null;
+}
+
+return this.sidebarTree.findTreeElement(resource, isAncestor, getParent);
+},
+
+searchCanceled: function(startingNewSearch)
+{
+WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
+
+if (startingNewSearch)
+return;
+
+function callback(resourceTreeElement)
+{
+resourceTreeElement._errorsWarningsUpdated();
+}
+this._forAllResourceTreeElements(callback);
+},
+
+performSearch: function(query)
+{
+function callback(resourceTreeElement)
+{
+resourceTreeElement._resetBubble();
+}
+this._forAllResourceTreeElements(callback);
+WebInspector.Panel.prototype.performSearch.call(this, query);
+},
+
+showView: function(view)
+{
+if (view)
+this.showResource(view.resource);
+},
+
+_onmousemove: function(event)
+{
+var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY);
+if (!nodeUnderMouse)
+return;
+
+var listNode = nodeUnderMouse.enclosingNodeOrSelfWithNodeName("li");
+if (!listNode)
+return;
+
+var element = listNode.treeElement;
+if (this._previousHoveredElement === element)
+return;
+
+if (this._previousHoveredElement) {
+this._previousHoveredElement.hovered = false;
+delete this._previousHoveredElement;
+}
+
+if (element instanceof WebInspector.FrameTreeElement) {
+this._previousHoveredElement = element;
+element.hovered = true;
+}
+},
+
+_onmouseout: function(event)
+{
+if (this._previousHoveredElement) {
+this._previousHoveredElement.hovered = false;
+delete this._previousHoveredElement;
+}
+}
+}
+
+WebInspector.ResourcesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.BaseStorageTreeElement = function(storagePanel, representedObject, title, iconClass, hasChildren)
+{
+TreeElement.call(this, "", representedObject, hasChildren);
+this._storagePanel = storagePanel;
+this._titleText = title;
+this._iconClass = iconClass;
+}
+
+WebInspector.BaseStorageTreeElement.prototype = {
+onattach: function()
+{
+this.listItemElement.removeChildren();
+this.listItemElement.addStyleClass(this._iconClass);
+
+var selectionElement = document.createElement("div");
+selectionElement.className = "selection";
+this.listItemElement.appendChild(selectionElement);
+
+this.imageElement = document.createElement("img");
+this.imageElement.className = "icon";
+this.listItemElement.appendChild(this.imageElement);
+
+this.titleElement = document.createElement("div");
+this.titleElement.className = "base-storage-tree-element-title";
+this.titleElement.textContent = this._titleText;
+this.listItemElement.appendChild(this.titleElement);
+},
+
+onselect: function()
+{
+var itemURL = this.itemURL;
+if (itemURL)
+WebInspector.settings.resourcesLastSelectedItem = itemURL;
+},
+
+onreveal: function()
+{
+if (this.listItemElement)
+this.listItemElement.scrollIntoViewIfNeeded(false);
+},
+
+get titleText()
+{
+return this._titleText;
+},
+
+set titleText(titleText)
+{
+this._titleText = titleText;
+if (this.titleElement)
+this.titleElement.textContent = this._titleText;
+},
+
+isEventWithinDisclosureTriangle: function()
+{
+
+
+
+const paddingLeft = 14;
+var left = this.listItemElement.totalOffsetLeft + paddingLeft;
+return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth && this.hasChildren;
+}
+}
+
+WebInspector.BaseStorageTreeElement.prototype.__proto__ = TreeElement.prototype;
+
+WebInspector.StorageCategoryTreeElement = function(storagePanel, categoryName, settingsKey, iconClass)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, categoryName, iconClass, true);
+this._expandedSettingKey = "resources" + settingsKey + "Expanded";
+WebInspector.settings.installApplicationSetting(this._expandedSettingKey, settingsKey === "Frames");
+this._categoryName = categoryName;
+}
+
+WebInspector.StorageCategoryTreeElement.prototype = {
+get itemURL()
+{
+return "category://" + this._categoryName;
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showCategoryView(this._categoryName);
+},
+
+onattach: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+if (WebInspector.settings[this._expandedSettingKey])
+this.expand();
+},
+
+onexpand: function()
+{
+WebInspector.settings[this._expandedSettingKey] = true;
+},
+
+oncollapse: function()
+{
+WebInspector.settings[this._expandedSettingKey] = false;
+}
+}
+WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.FrameTreeElement = function(storagePanel, frameId, title, subtitle)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, "", "frame-storage-tree-item");
+this._frameId = frameId;
+this.setTitles(title, subtitle);
+}
+
+WebInspector.FrameTreeElement.prototype = {
+get itemURL()
+{
+return "frame://" + encodeURI(this._displayName);
+},
+
+onattach: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+if (this._titleToSetOnAttach || this._subtitleToSetOnAttach) {
+this.setTitles(this._titleToSetOnAttach, this._subtitleToSetOnAttach);
+delete this._titleToSetOnAttach;
+delete this._subtitleToSetOnAttach;
+}
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showCategoryView(this._displayName);
+
+this.listItemElement.removeStyleClass("hovered");
+InspectorBackend.hideFrameHighlight();
+},
+
+get displayName()
+{
+return this._displayName;
+},
+
+setTitles: function(title, subtitle)
+{
+this._displayName = "";
+if (this.parent) {
+if (title) {
+this.titleElement.textContent = title;
+this._displayName = title;
+}
+if (subtitle) {
+var subtitleElement = document.createElement("span");
+subtitleElement.className = "base-storage-tree-element-subtitle";
+subtitleElement.textContent = "(" + subtitle + ")";
+this._displayName += " (" + subtitle + ")";
+this.titleElement.appendChild(subtitleElement);
+}
+} else {
+this._titleToSetOnAttach = title;
+this._subtitleToSetOnAttach = subtitle;
+}
+},
+
+set hovered(hovered)
+{
+if (hovered) {
+this.listItemElement.addStyleClass("hovered");
+InspectorBackend.highlightFrame(this._frameId);
+} else {
+this.listItemElement.removeStyleClass("hovered");
+InspectorBackend.hideFrameHighlight();
+}
+}
+}
+WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.FrameResourceTreeElement = function(storagePanel, resource)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, resource, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name);
+this._resource = resource;
+this._resource.addEventListener("errors-warnings-updated", this._errorsWarningsUpdated, this);
+this._resource.addEventListener("content-changed", this._contentChanged, this);
+this.tooltip = resource.url;
+}
+
+WebInspector.FrameResourceTreeElement.prototype = {
+get itemURL()
+{
+return this._resource.url;
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel._showResourceView(this._resource);
+},
+
+ondblclick: function(event)
+{
+InspectorBackend.openInInspectedWindow(this._resource.url);
+},
+
+onattach: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+
+if (this._resource.category === WebInspector.resourceCategories.images) {
+var previewImage = document.createElement("img");
+previewImage.className = "image-resource-icon-preview";
+previewImage.src = this._resource.url;
+
+var iconElement = document.createElement("div");
+iconElement.className = "icon";
+iconElement.appendChild(previewImage);
+this.listItemElement.replaceChild(iconElement, this.imageElement);
+}
+
+this._statusElement = document.createElement("div");
+this._statusElement.className = "status";
+this.listItemElement.insertBefore(this._statusElement, this.titleElement);
+
+this.listItemElement.draggable = true;
+this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
+},
+
+_ondragstart: function(event)
+{
+event.dataTransfer.setData("text/plain", this._resource.content);
+event.dataTransfer.effectAllowed = "copy";
+return true;
+},
+
+_setBubbleText: function(x)
+{
+if (!this._bubbleElement) {
+this._bubbleElement = document.createElement("div");
+this._bubbleElement.className = "bubble";
+this._statusElement.appendChild(this._bubbleElement);
+}
+
+this._bubbleElement.textContent = x;
+},
+
+_resetBubble: function()
+{
+if (this._bubbleElement) {
+this._bubbleElement.textContent = "";
+this._bubbleElement.removeStyleClass("search-matches");
+this._bubbleElement.removeStyleClass("warning");
+this._bubbleElement.removeStyleClass("error");
+}
+},
+
+searchMatchFound: function(matches)
+{
+this._resetBubble();
+
+this._setBubbleText(matches);
+this._bubbleElement.addStyleClass("search-matches");
+
+
+var currentAncestor = this.parent;
+while (currentAncestor && !currentAncestor.root) {
+if (!currentAncestor.expanded)
+currentAncestor.expand();
+currentAncestor = currentAncestor.parent;
+}
+},
+
+_errorsWarningsUpdated: function()
+{
+
+if (!this._resource.warnings && !this._resource.errors) {
+var view = WebInspector.ResourceManager.existingResourceViewForResource(this._resource);
+if (view && view.clearMessages)
+view.clearMessages();
+}
+
+if (this._storagePanel.currentQuery)
+return;
+
+this._resetBubble();
+
+if (this._resource.warnings || this._resource.errors)
+this._setBubbleText(this._resource.warnings + this._resource.errors);
+
+if (this._resource.warnings)
+this._bubbleElement.addStyleClass("warning");
+
+if (this._resource.errors)
+this._bubbleElement.addStyleClass("error");
+},
+
+_contentChanged: function(event)
+{
+this.insertChild(new WebInspector.ResourceRevisionTreeElement(this._storagePanel, event.data.revision), 0);
+var oldView = WebInspector.ResourceManager.existingResourceViewForResource(this._resource);
+if (oldView) {
+var newView = WebInspector.ResourceManager.recreateResourceView(this._resource);
+if (oldView === this._storagePanel.visibleView)
+this._storagePanel.visibleView = newView;
+}
+}
+}
+
+WebInspector.FrameResourceTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.DatabaseTreeElement = function(storagePanel, database)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, database.name, "database-storage-tree-item", true);
+this._database = database;
+}
+
+WebInspector.DatabaseTreeElement.prototype = {
+get itemURL()
+{
+return "database://" + encodeURI(this._database.name);
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showDatabase(this._database);
+},
+
+oncollapse: function()
+{
+
+
+this.shouldRefreshChildren = true;
+},
+
+onpopulate: function()
+{
+this.removeChildren();
+
+function tableNamesCallback(tableNames)
+{
+var tableNamesLength = tableNames.length;
+for (var i = 0; i < tableNamesLength; ++i)
+this.appendChild(new WebInspector.DatabaseTableTreeElement(this._storagePanel, this._database, tableNames[i]));
+}
+this._database.getTableNames(tableNamesCallback.bind(this));
+}
+
+}
+WebInspector.DatabaseTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.DatabaseTableTreeElement = function(storagePanel, database, tableName)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, tableName, "database-storage-tree-item");
+this._database = database;
+this._tableName = tableName;
+}
+
+WebInspector.DatabaseTableTreeElement.prototype = {
+get itemURL()
+{
+return "database://" + encodeURI(this._database.name) + "/" + encodeURI(this._tableName);
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showDatabase(this._database, this._tableName);
+}
+}
+WebInspector.DatabaseTableTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.DOMStorageTreeElement = function(storagePanel, domStorage, className)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, domStorage.domain ? domStorage.domain : WebInspector.UIString("Local Files"), "domstorage-storage-tree-item " + className);
+this._domStorage = domStorage;
+}
+
+WebInspector.DOMStorageTreeElement.prototype = {
+get itemURL()
+{
+return "storage://" + this._domStorage.domain + "/" + (this._domStorage.isLocalStorage ? "local" : "session");
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showDOMStorage(this._domStorage);
+}
+}
+WebInspector.DOMStorageTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.CookieTreeElement = function(storagePanel, cookieDomain)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, cookieDomain ? cookieDomain : WebInspector.UIString("Local Files"), "cookie-storage-tree-item");
+this._cookieDomain = cookieDomain;
+}
+
+WebInspector.CookieTreeElement.prototype = {
+get itemURL()
+{
+return "cookies://" + this._cookieDomain;
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showCookies(this, this._cookieDomain);
+}
+}
+WebInspector.CookieTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.ApplicationCacheTreeElement = function(storagePanel, appcacheDomain)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, appcacheDomain ? appcacheDomain : WebInspector.UIString("Local Files"), "application-cache-storage-tree-item");
+this._appcacheDomain = appcacheDomain;
+}
+
+WebInspector.ApplicationCacheTreeElement.prototype = {
+get itemURL()
+{
+return "appcache://" + this._appcacheDomain;
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showApplicationCache(this, this._appcacheDomain);
+}
+}
+WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.ResourceRevisionTreeElement = function(storagePanel, revision)
+{
+var title = revision.timestamp ? revision.timestamp.toLocaleTimeString() : "(original)";
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, title, "resource-sidebar-tree-item resources-category-" + revision.category.name);
+if (revision.timestamp)
+this.tooltip = revision.timestamp.toLocaleString();
+this._resource = revision;
+}
+
+WebInspector.ResourceRevisionTreeElement.prototype = {
+onattach: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
+this.listItemElement.draggable = true;
+this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false);
+this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel._showResourceView(this._resource);
+},
+
+_ondragstart: function(event)
+{
+event.dataTransfer.setData("text/plain", this._resource.content);
+event.dataTransfer.effectAllowed = "copy";
+return true;
+},
+
+_handleContextMenuEvent: function(event)
+{
+var contextMenu = new WebInspector.ContextMenu();
+contextMenu.appendItem(WebInspector.UIString("Revert to this revision"), this._resource.revertToThis.bind(this._resource));
+contextMenu.show(event);
+}
+}
+
+WebInspector.ResourceRevisionTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.FileSystemTreeElement = function(storagePanel, origin)
+{
+WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, origin, "file-system-storage-tree-item");
+this._origin = origin;
+}
+
+WebInspector.FileSystemTreeElement.prototype = {
+get itemURL()
+{
+return "file-system://" + encodeURI(this._origin);
+},
+
+onselect: function()
+{
+WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
+this._storagePanel.showFileSystem(this, this._origin);
+}
+}
+
+WebInspector.FileSystemTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
+
+WebInspector.StorageCategoryView = function()
+{
+WebInspector.View.call(this);
+
+this.element.addStyleClass("storage-view");
+
+this._emptyMsgElement = document.createElement("div");
+this._emptyMsgElement.className = "storage-empty-view";
+this.element.appendChild(this._emptyMsgElement);
+}
+
+WebInspector.StorageCategoryView.prototype = {
+setText: function(text)
+{
+this._emptyMsgElement.textContent = text;
+}
+}
+
+WebInspector.StorageCategoryView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
 
 const UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
 
 WebInspector.ProfileType = function(id, name)
 {
-    this._id = id;
-    this._name = name;
+this._id = id;
+this._name = name;
 }
 
 WebInspector.ProfileType.URLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
 
 WebInspector.ProfileType.prototype = {
-    get buttonTooltip()
-    {
-        return "";
-    },
+get buttonTooltip()
+{
+return "";
+},
 
-    get buttonStyle()
-    {
-        return undefined;
-    },
+get buttonStyle()
+{
+return undefined;
+},
 
-    get buttonCaption()
-    {
-        return this.name;
-    },
+get buttonCaption()
+{
+return this.name;
+},
 
-    get id()
-    {
-        return this._id;
-    },
+get id()
+{
+return this._id;
+},
 
-    get name()
-    {
-        return this._name;
-    },
+get name()
+{
+return this._name;
+},
 
-    buttonClicked: function()
-    {
-    },
+buttonClicked: function()
+{
+},
 
-    viewForProfile: function(profile)
-    {
-        if (!profile._profileView)
-            profile._profileView = this.createView(profile);
-        return profile._profileView;
-    },
+viewForProfile: function(profile)
+{
+if (!profile._profileView)
+profile._profileView = this.createView(profile);
+return profile._profileView;
+},
 
-    get welcomeMessage()
-    {
-        return "";
-    },
+get welcomeMessage()
+{
+return "";
+},
 
-    // Must be implemented by subclasses.
-    createView: function(profile)
-    {
-        throw new Error("Needs implemented.");
-    },
 
-    // Must be implemented by subclasses.
-    createSidebarTreeElementForProfile: function(profile)
-    {
-        throw new Error("Needs implemented.");
-    }
+createView: function(profile)
+{
+throw new Error("Needs implemented.");
+},
+
+
+createSidebarTreeElementForProfile: function(profile)
+{
+throw new Error("Needs implemented.");
+}
 }
 
 WebInspector.ProfilesPanel = function()
 {
-    WebInspector.Panel.call(this);
+WebInspector.Panel.call(this, "profiles");
 
-    this.createSidebar();
+this.createSidebar();
 
-    this.element.addStyleClass("profiles");
-    this._profileTypesByIdMap = {};
-    this._profileTypeButtonsByIdMap = {};
+this._profileTypesByIdMap = {};
+this._profileTypeButtonsByIdMap = {};
 
-    var panelEnablerHeading = WebInspector.UIString("You need to enable profiling before you can use the Profiles panel.");
-    var panelEnablerDisclaimer = WebInspector.UIString("Enabling profiling will make scripts run slower.");
-    var panelEnablerButton = WebInspector.UIString("Enable Profiling");
-    this.panelEnablerView = new WebInspector.PanelEnablerView("profiles", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
-    this.panelEnablerView.addEventListener("enable clicked", this._enableProfiling, this);
+var panelEnablerHeading = WebInspector.UIString("You need to enable profiling before you can use the Profiles panel.");
+var panelEnablerDisclaimer = WebInspector.UIString("Enabling profiling will make scripts run slower.");
+var panelEnablerButton = WebInspector.UIString("Enable Profiling");
+this.panelEnablerView = new WebInspector.PanelEnablerView("profiles", panelEnablerHeading, panelEnablerDisclaimer, panelEnablerButton);
+this.panelEnablerView.addEventListener("enable clicked", this._enableProfiling, this);
 
-    this.element.appendChild(this.panelEnablerView.element);
+this.element.appendChild(this.panelEnablerView.element);
 
-    this.profileViews = document.createElement("div");
-    this.profileViews.id = "profile-views";
-    this.element.appendChild(this.profileViews);
+this.profileViews = document.createElement("div");
+this.profileViews.id = "profile-views";
+this.element.appendChild(this.profileViews);
 
-    this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
-    this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false);
+this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
+this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false);
 
-    this.profileViewStatusBarItemsContainer = document.createElement("div");
-    this.profileViewStatusBarItemsContainer.id = "profile-view-status-bar-items";
+this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear CPU profiles."), "clear-status-bar-item");
+this.clearResultsButton.addEventListener("click", this._clearProfiles.bind(this), false);
 
-    this.welcomeView = new WebInspector.WelcomeView("profiles", WebInspector.UIString("Welcome to the Profiles panel"));
-    this.element.appendChild(this.welcomeView.element);
+this.profileViewStatusBarItemsContainer = document.createElement("div");
+this.profileViewStatusBarItemsContainer.className = "status-bar-items";
 
-    this._profiles = [];
-    this._profilerEnabled = Preferences.profilerAlwaysEnabled;
-    this.reset();
+this.welcomeView = new WebInspector.WelcomeView("profiles", WebInspector.UIString("Welcome to the Profiles panel"));
+this.element.appendChild(this.welcomeView.element);
+
+this._profiles = [];
+this._profilerEnabled = Preferences.profilerAlwaysEnabled;
+this._reset();
 }
 
 WebInspector.ProfilesPanel.prototype = {
-    toolbarItemClass: "profiles",
+get toolbarItemLabel()
+{
+return WebInspector.UIString("Profiles");
+},
 
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Profiles");
-    },
+get statusBarItems()
+{
+function clickHandler(profileType, buttonElement)
+{
+profileType.buttonClicked.call(profileType);
+this.updateProfileTypeButtons();
+}
 
-    get statusBarItems()
-    {
-        function clickHandler(profileType, buttonElement)
-        {
-            profileType.buttonClicked.call(profileType);
-            this.updateProfileTypeButtons();
-        }
+var items = [this.enableToggleButton.element];
 
-        var items = [this.enableToggleButton.element];
-        // FIXME: Generate a single "combo-button".
-        for (var typeId in this._profileTypesByIdMap) {
-            var profileType = this.getProfileType(typeId);
-            if (profileType.buttonStyle) {
-                var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle, profileType.buttonCaption);
-                this._profileTypeButtonsByIdMap[typeId] = button.element;
-                button.element.addEventListener("click", clickHandler.bind(this, profileType, button.element), false);
-                items.push(button.element);
-            }
-        }
-        items.push(this.profileViewStatusBarItemsContainer);
-        return items;
-    },
+for (var typeId in this._profileTypesByIdMap) {
+var profileType = this.getProfileType(typeId);
+if (profileType.buttonStyle) {
+var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle, profileType.buttonCaption);
+this._profileTypeButtonsByIdMap[typeId] = button.element;
+button.element.addEventListener("click", clickHandler.bind(this, profileType, button.element), false);
+items.push(button.element);
+}
+}
+items.push(this.clearResultsButton.element, this.profileViewStatusBarItemsContainer);
+return items;
+},
 
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-        if (this._shouldPopulateProfiles)
-            this._populateProfiles();
-    },
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+this._populateProfiles();
+},
 
-    populateInterface: function()
-    {
-        if (this.visible)
-            this._populateProfiles();
-        else
-            this._shouldPopulateProfiles = true;
-    },
+profilerWasEnabled: function()
+{
+if (this._profilerEnabled)
+return;
 
-    profilerWasEnabled: function()
-    {
-        if (this._profilerEnabled)
-            return;
+this._profilerEnabled = true;
 
-        this._profilerEnabled = true;
-        this.reset();
-        this.populateInterface();
-    },
+this._reset();
+if (this.visible)
+this._populateProfiles();
+},
 
-    profilerWasDisabled: function()
-    {
-        if (!this._profilerEnabled)
-            return;
+profilerWasDisabled: function()
+{
+if (!this._profilerEnabled)
+return;
 
-        this._profilerEnabled = false;
-        this.reset();
-    },
+this._profilerEnabled = false;
+this._reset();
+},
 
-    reset: function()
-    {
-        for (var i = 0; i < this._profiles.length; ++i)
-            delete this._profiles[i]._profileView;
-        delete this.visibleView;
+resetProfiles: function()
+{
+this._reset();
+},
 
-        delete this.currentQuery;
-        this.searchCanceled();
+_reset: function()
+{
+for (var i = 0; i < this._profiles.length; ++i)
+delete this._profiles[i]._profileView;
+delete this.visibleView;
 
-        this._profiles = [];
-        this._profilesIdMap = {};
-        this._profileGroups = {};
-        this._profileGroupsForLinks = {}
+delete this.currentQuery;
+this.searchCanceled();
 
-        this.sidebarTreeElement.removeStyleClass("some-expandable");
+this._profiles = [];
+this._profilesIdMap = {};
+this._profileGroups = {};
+this._profileGroupsForLinks = {}
+this._profilesWereRequested = false;
 
-        for (var typeId in this._profileTypesByIdMap)
-            this.getProfileType(typeId).treeElement.removeChildren();
+this.sidebarTreeElement.removeStyleClass("some-expandable");
 
-        this.profileViews.removeChildren();
+for (var typeId in this._profileTypesByIdMap)
+this.getProfileType(typeId).treeElement.removeChildren();
 
-        this.profileViewStatusBarItemsContainer.removeChildren();
+this.profileViews.removeChildren();
 
-        this._updateInterface();
-        this.welcomeView.show();
-    },
+this.profileViewStatusBarItemsContainer.removeChildren();
 
-    registerProfileType: function(profileType)
-    {
-        this._profileTypesByIdMap[profileType.id] = profileType;
-        profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.name, null, true);
-        this.sidebarTree.appendChild(profileType.treeElement);
-        profileType.treeElement.expand();
-        this._addWelcomeMessage(profileType);
-    },
+this._updateInterface();
+this.welcomeView.show();
+},
 
-    _addWelcomeMessage: function(profileType)
-    {
-        var message = profileType.welcomeMessage;
-        // Message text is supposed to have a '%s' substring as a placeholder
-        // for a status bar button. If it is there, we split the message in two
-        // parts, and insert the button between them.
-        var buttonPos = message.indexOf("%s");
-        if (buttonPos > -1) {
-            var container = document.createDocumentFragment();
-            var part1 = document.createElement("span");
-            part1.innerHTML = message.substr(0, buttonPos);
-            container.appendChild(part1);
-     
-            var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle, profileType.buttonCaption);
-            button.element.addEventListener("click", profileType.buttonClicked.bind(profileType), false);
-            container.appendChild(button.element);
-       
-            var part2 = document.createElement("span");
-            part2.innerHTML = message.substr(buttonPos + 2);
-            container.appendChild(part2);
-            this.welcomeView.addMessage(container);
-        } else
-            this.welcomeView.addMessage(message);
-    },
+_clearProfiles: function()
+{
+InspectorBackend.clearProfiles();
+this._reset();
+},
 
-    _makeKey: function(text, profileTypeId)
-    {
-        return escape(text) + '/' + escape(profileTypeId);
-    },
+registerProfileType: function(profileType)
+{
+this._profileTypesByIdMap[profileType.id] = profileType;
+profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.name, null, true);
+this.sidebarTree.appendChild(profileType.treeElement);
+profileType.treeElement.expand();
+this._addWelcomeMessage(profileType);
+},
 
-    addProfileHeader: function(profile)
-    {
-        var typeId = profile.typeId;
-        var profileType = this.getProfileType(typeId);
-        var sidebarParent = profileType.treeElement;
-        var small = false;
-        var alternateTitle;
+_addWelcomeMessage: function(profileType)
+{
+var message = profileType.welcomeMessage;
 
-        profile.__profilesPanelProfileType = profileType;
-        this._profiles.push(profile);
-        this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
 
-        if (profile.title.indexOf(UserInitiatedProfileName) !== 0) {
-            var profileTitleKey = this._makeKey(profile.title, typeId);
-            if (!(profileTitleKey in this._profileGroups))
-                this._profileGroups[profileTitleKey] = [];
 
-            var group = this._profileGroups[profileTitleKey];
-            group.push(profile);
+var buttonPos = message.indexOf("%s");
+if (buttonPos > -1) {
+var container = document.createDocumentFragment();
+var part1 = document.createElement("span");
+part1.innerHTML = message.substr(0, buttonPos);
+container.appendChild(part1);
 
-            if (group.length === 2) {
-                // Make a group TreeElement now that there are 2 profiles.
-                group._profilesTreeElement = new WebInspector.ProfileGroupSidebarTreeElement(profile.title);
+var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle, profileType.buttonCaption);
+container.appendChild(button.element);
 
-                // Insert at the same index for the first profile of the group.
-                var index = sidebarParent.children.indexOf(group[0]._profilesTreeElement);
-                sidebarParent.insertChild(group._profilesTreeElement, index);
+var part2 = document.createElement("span");
+part2.innerHTML = message.substr(buttonPos + 2);
+container.appendChild(part2);
+this.welcomeView.addMessage(container);
+} else
+this.welcomeView.addMessage(message);
+},
 
-                // Move the first profile to the group.
-                var selected = group[0]._profilesTreeElement.selected;
-                sidebarParent.removeChild(group[0]._profilesTreeElement);
-                group._profilesTreeElement.appendChild(group[0]._profilesTreeElement);
-                if (selected) {
-                    group[0]._profilesTreeElement.select();
-                    group[0]._profilesTreeElement.reveal();
-                }
+_makeKey: function(text, profileTypeId)
+{
+return escape(text) + '/' + escape(profileTypeId);
+},
 
-                group[0]._profilesTreeElement.small = true;
-                group[0]._profilesTreeElement.mainTitle = WebInspector.UIString("Run %d", 1);
+addProfileHeader: function(profile)
+{
+var typeId = profile.typeId;
+var profileType = this.getProfileType(typeId);
+var sidebarParent = profileType.treeElement;
+var small = false;
+var alternateTitle;
 
-                this.sidebarTreeElement.addStyleClass("some-expandable");
-            }
+profile.__profilesPanelProfileType = profileType;
+this._profiles.push(profile);
+this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
 
-            if (group.length >= 2) {
-                sidebarParent = group._profilesTreeElement;
-                alternateTitle = WebInspector.UIString("Run %d", group.length);
-                small = true;
-            }
-        }
+if (profile.title.indexOf(UserInitiatedProfileName) !== 0) {
+var profileTitleKey = this._makeKey(profile.title, typeId);
+if (!(profileTitleKey in this._profileGroups))
+this._profileGroups[profileTitleKey] = [];
 
-        var profileTreeElement = profileType.createSidebarTreeElementForProfile(profile);
-        profileTreeElement.small = small;
-        if (alternateTitle)
-            profileTreeElement.mainTitle = alternateTitle;
-        profile._profilesTreeElement = profileTreeElement;
+var group = this._profileGroups[profileTitleKey];
+group.push(profile);
 
-        sidebarParent.appendChild(profileTreeElement);
-        this.welcomeView.hide();
-        if (!this.visibleView)
-            this.showProfile(profile);
-    },
+if (group.length === 2) {
 
-    showProfile: function(profile)
-    {
-        if (!profile)
-            return;
+group._profilesTreeElement = new WebInspector.ProfileGroupSidebarTreeElement(profile.title);
 
-        this.closeVisibleView();
 
-        var view = profile.__profilesPanelProfileType.viewForProfile(profile);
+var index = sidebarParent.children.indexOf(group[0]._profilesTreeElement);
+sidebarParent.insertChild(group._profilesTreeElement, index);
 
-        view.show(this.profileViews);
 
-        profile._profilesTreeElement.select(true);
-        profile._profilesTreeElement.reveal();
+var selected = group[0]._profilesTreeElement.selected;
+sidebarParent.removeChild(group[0]._profilesTreeElement);
+group._profilesTreeElement.appendChild(group[0]._profilesTreeElement);
+if (selected) {
+group[0]._profilesTreeElement.select();
+group[0]._profilesTreeElement.reveal();
+}
 
-        this.visibleView = view;
+group[0]._profilesTreeElement.small = true;
+group[0]._profilesTreeElement.mainTitle = WebInspector.UIString("Run %d", 1);
 
-        this.profileViewStatusBarItemsContainer.removeChildren();
+this.sidebarTreeElement.addStyleClass("some-expandable");
+}
 
-        var statusBarItems = view.statusBarItems;
-        for (var i = 0; i < statusBarItems.length; ++i)
-            this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
-    },
+if (group.length >= 2) {
+sidebarParent = group._profilesTreeElement;
+alternateTitle = WebInspector.UIString("Run %d", group.length);
+small = true;
+}
+}
 
-    showView: function(view)
-    {
-        this.showProfile(view.profile);
-    },
+var profileTreeElement = profileType.createSidebarTreeElementForProfile(profile);
+profileTreeElement.small = small;
+if (alternateTitle)
+profileTreeElement.mainTitle = alternateTitle;
+profile._profilesTreeElement = profileTreeElement;
 
-    getProfileType: function(typeId)
-    {
-        return this._profileTypesByIdMap[typeId];
-    },
+sidebarParent.appendChild(profileTreeElement);
+if (!profile.isTemporary) {
+this.welcomeView.hide();
+if (!this.visibleView)
+this.showProfile(profile);
+this.dispatchEventToListeners("profile added");
+}
+},
 
-    showProfileForURL: function(url)
-    {
-        var match = url.match(WebInspector.ProfileType.URLRegExp);
-        if (!match)
-            return;
-        this.showProfile(this._profilesIdMap[this._makeKey(match[3], match[1])]);
-    },
+removeProfileHeader: function(profile)
+{
+var typeId = profile.typeId;
+var profileType = this.getProfileType(typeId);
+var sidebarParent = profileType.treeElement;
 
-    updateProfileTypeButtons: function()
-    {
-        for (var typeId in this._profileTypeButtonsByIdMap) {
-            var buttonElement = this._profileTypeButtonsByIdMap[typeId];
-            var profileType = this.getProfileType(typeId);
-            buttonElement.className = profileType.buttonStyle;
-            buttonElement.title = profileType.buttonTooltip;
-            // FIXME: Apply profileType.buttonCaption once captions are added to button controls.
-        }
-    },
+for (var i = 0; i < this._profiles.length; ++i) {
+if (this._profiles[i].uid === profile.uid) {
+profile = this._profiles[i];
+this._profiles.splice(i, 1);
+break;
+}
+}
+delete this._profilesIdMap[this._makeKey(profile.uid, typeId)];
 
-    closeVisibleView: function()
-    {
-        if (this.visibleView)
-            this.visibleView.hide();
-        delete this.visibleView;
-    },
+var profileTitleKey = this._makeKey(profile.title, typeId);
+delete this._profileGroups[profileTitleKey];
 
-    displayTitleForProfileLink: function(title, typeId)
-    {
-        title = unescape(title);
-        if (title.indexOf(UserInitiatedProfileName) === 0) {
-            title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));
-        } else {
-            var titleKey = this._makeKey(title, typeId);
-            if (!(titleKey in this._profileGroupsForLinks))
-                this._profileGroupsForLinks[titleKey] = 0;
+sidebarParent.removeChild(profile._profilesTreeElement);
 
-            groupNumber = ++this._profileGroupsForLinks[titleKey];
+if (!profile.isTemporary)
+InspectorBackend.removeProfile(profile.typeId, profile.uid);
 
-            if (groupNumber > 2)
-                // The title is used in the console message announcing that a profile has started so it gets
-                // incremented twice as often as it's displayed
-                title += " " + WebInspector.UIString("Run %d", groupNumber / 2);
-        }
-        
-        return title;
-    },
 
-    get searchableViews()
-    {
-        var views = [];
 
-        const visibleView = this.visibleView;
-        if (visibleView && visibleView.performSearch)
-            views.push(visibleView);
+if (!this._profiles.length)
+this.closeVisibleView();
+},
 
-        var profilesLength = this._profiles.length;
-        for (var i = 0; i < profilesLength; ++i) {
-            var profile = this._profiles[i];
-            var view = profile.__profilesPanelProfileType.viewForProfile(profile);
-            if (!view.performSearch || view === visibleView)
-                continue;
-            views.push(view);
-        }
+showProfile: function(profile)
+{
+if (!profile || profile.isTemporary)
+return;
 
-        return views;
-    },
+this.closeVisibleView();
 
-    searchMatchFound: function(view, matches)
-    {
-        view.profile._profilesTreeElement.searchMatches = matches;
-    },
+var view = profile.__profilesPanelProfileType.viewForProfile(profile);
 
-    searchCanceled: function(startingNewSearch)
-    {
-        WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
+view.show(this.profileViews);
 
-        if (!this._profiles)
-            return;
+profile._profilesTreeElement.select(true);
+profile._profilesTreeElement.reveal();
 
-        for (var i = 0; i < this._profiles.length; ++i) {
-            var profile = this._profiles[i];
-            profile._profilesTreeElement.searchMatches = 0;
-        }
-    },
+this.visibleView = view;
 
-    _updateInterface: function()
-    {
-        // FIXME: Replace ProfileType-specific button visibility changes by a single ProfileType-agnostic "combo-button" visibility change.
-        if (this._profilerEnabled) {
-            this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");
-            this.enableToggleButton.toggled = true;
-            for (var typeId in this._profileTypeButtonsByIdMap)
-                this._profileTypeButtonsByIdMap[typeId].removeStyleClass("hidden");
-            this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
-            this.panelEnablerView.visible = false;
-        } else {
-            this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
-            this.enableToggleButton.toggled = false;
-            for (var typeId in this._profileTypeButtonsByIdMap)
-                this._profileTypeButtonsByIdMap[typeId].addStyleClass("hidden");
-            this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
-            this.panelEnablerView.visible = true;
-        }
-    },
+this.profileViewStatusBarItemsContainer.removeChildren();
 
-    _enableProfiling: function()
-    {
-        if (this._profilerEnabled)
-            return;
-        this._toggleProfiling(this.panelEnablerView.alwaysEnabled);
-    },
+var statusBarItems = view.statusBarItems;
+for (var i = 0; i < statusBarItems.length; ++i)
+this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
+},
 
-    _toggleProfiling: function(optionalAlways)
-    {
-        if (this._profilerEnabled)
-            InspectorBackend.disableProfiler(true);
-        else
-            InspectorBackend.enableProfiler(!!optionalAlways);
-    },
+getProfiles: function(typeId)
+{
+var result = [];
+var profilesCount = this._profiles.length;
+for (var i = 0; i < profilesCount; ++i)
+if (this._profiles[i].typeId === typeId)
+result.push(this._profiles[i]);
+return result;
+},
 
-    _populateProfiles: function()
-    {
-        var sidebarTreeChildrenCount = this.sidebarTree.children.length;
-        for (var i = 0; i < sidebarTreeChildrenCount; ++i) {
-            var treeElement = this.sidebarTree.children[i];
-            if (treeElement.children.length)
-                return;
-        }
+hasTemporaryProfile: function(typeId)
+{
+var profilesCount = this._profiles.length;
+for (var i = 0; i < profilesCount; ++i)
+if (this._profiles[i].typeId === typeId && this._profiles[i].isTemporary)
+return true;
+return false;
+},
 
-        function populateCallback(profileHeaders) {
-            profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
-            var profileHeadersLength = profileHeaders.length;
-            for (var i = 0; i < profileHeadersLength; ++i)
-                WebInspector.addProfileHeader(profileHeaders[i]);
-        }
+hasProfile: function(profile)
+{
+return !!this._profilesIdMap[this._makeKey(profile.uid, profile.typeId)];
+},
 
-        var callId = WebInspector.Callback.wrap(populateCallback);
-        InspectorBackend.getProfileHeaders(callId);
+updateProfile: function(profile)
+{
+var profilesCount = this._profiles.length;
+for (var i = 0; i < profilesCount; ++i)
+if (this._profiles[i].typeId === profile.typeId
+&& this._profiles[i].uid === profile.uid) {
+this._profiles[i] = profile;
+break;
+}
+},
 
-        delete this._shouldPopulateProfiles;
-    },
+loadHeapSnapshot: function(uid, callback)
+{
+var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)];
+if (!profile)
+return;
 
-    updateMainViewWidth: function(width)
-    {
-        this.welcomeView.element.style.left = width + "px";
-        this.profileViews.style.left = width + "px";
-        this.profileViewStatusBarItemsContainer.style.left = width + "px";
-        this.resize();
-    }
+if (profile._loaded)
+callback(profile);
+else if (profile._is_loading)
+profile._callbacks.push(callback);
+else {
+profile._is_loading = true;
+profile._callbacks = [callback];
+profile._json = "";
+InspectorBackend.getProfile(profile.typeId, profile.uid);
+}
+},
+
+addHeapSnapshotChunk: function(uid, chunk)
+{
+var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)];
+if (!profile || profile._loaded || !profile._is_loading)
+return;
+
+profile._json += chunk;
+},
+
+finishHeapSnapshot: function(uid)
+{
+var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)];
+if (!profile || profile._loaded || !profile._is_loading)
+return;
+
+var callbacks = profile._callbacks;
+delete profile._callbacks;
+var loadedSnapshot = JSON.parse(profile._json);
+delete profile._json;
+delete profile._is_loading;
+profile._loaded = true;
+WebInspector.HeapSnapshotView.prototype.processLoadedSnapshot(profile, loadedSnapshot);
+for (var i = 0; i < callbacks.length; ++i)
+callbacks[i](profile);
+},
+
+showView: function(view)
+{
+this.showProfile(view.profile);
+},
+
+getProfileType: function(typeId)
+{
+return this._profileTypesByIdMap[typeId];
+},
+
+showProfileForURL: function(url)
+{
+var match = url.match(WebInspector.ProfileType.URLRegExp);
+if (!match)
+return;
+this.showProfile(this._profilesIdMap[this._makeKey(match[3], match[1])]);
+},
+
+updateProfileTypeButtons: function()
+{
+for (var typeId in this._profileTypeButtonsByIdMap) {
+var buttonElement = this._profileTypeButtonsByIdMap[typeId];
+var profileType = this.getProfileType(typeId);
+buttonElement.className = profileType.buttonStyle;
+buttonElement.title = profileType.buttonTooltip;
+
+}
+},
+
+closeVisibleView: function()
+{
+if (this.visibleView)
+this.visibleView.hide();
+delete this.visibleView;
+},
+
+displayTitleForProfileLink: function(title, typeId)
+{
+title = unescape(title);
+if (title.indexOf(UserInitiatedProfileName) === 0) {
+title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));
+} else {
+var titleKey = this._makeKey(title, typeId);
+if (!(titleKey in this._profileGroupsForLinks))
+this._profileGroupsForLinks[titleKey] = 0;
+
+var groupNumber = ++this._profileGroupsForLinks[titleKey];
+
+if (groupNumber > 2)
+
+
+title += " " + WebInspector.UIString("Run %d", (groupNumber + 1) / 2);
+}
+
+return title;
+},
+
+get searchableViews()
+{
+var views = [];
+
+const visibleView = this.visibleView;
+if (visibleView && visibleView.performSearch)
+views.push(visibleView);
+
+var profilesLength = this._profiles.length;
+for (var i = 0; i < profilesLength; ++i) {
+var profile = this._profiles[i];
+var view = profile.__profilesPanelProfileType.viewForProfile(profile);
+if (!view.performSearch || view === visibleView)
+continue;
+views.push(view);
+}
+
+return views;
+},
+
+searchMatchFound: function(view, matches)
+{
+view.profile._profilesTreeElement.searchMatches = matches;
+},
+
+searchCanceled: function(startingNewSearch)
+{
+WebInspector.Panel.prototype.searchCanceled.call(this, startingNewSearch);
+
+if (!this._profiles)
+return;
+
+for (var i = 0; i < this._profiles.length; ++i) {
+var profile = this._profiles[i];
+profile._profilesTreeElement.searchMatches = 0;
+}
+},
+
+_updateInterface: function()
+{
+
+if (this._profilerEnabled) {
+this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");
+this.enableToggleButton.toggled = true;
+for (var typeId in this._profileTypeButtonsByIdMap)
+this._profileTypeButtonsByIdMap[typeId].removeStyleClass("hidden");
+this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
+this.clearResultsButton.element.removeStyleClass("hidden");
+this.panelEnablerView.visible = false;
+} else {
+this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
+this.enableToggleButton.toggled = false;
+for (var typeId in this._profileTypeButtonsByIdMap)
+this._profileTypeButtonsByIdMap[typeId].addStyleClass("hidden");
+this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
+this.clearResultsButton.element.addStyleClass("hidden");
+this.panelEnablerView.visible = true;
+}
+},
+
+_enableProfiling: function()
+{
+if (this._profilerEnabled)
+return;
+this._toggleProfiling(this.panelEnablerView.alwaysEnabled);
+},
+
+_toggleProfiling: function(optionalAlways)
+{
+if (this._profilerEnabled)
+InspectorBackend.disableProfiler(true);
+else
+InspectorBackend.enableProfiler(!!optionalAlways);
+},
+
+_populateProfiles: function()
+{
+if (!this._profilerEnabled || this._profilesWereRequested)
+return;
+
+function populateCallback(profileHeaders) {
+profileHeaders.sort(function(a, b) { return a.uid - b.uid; });
+var profileHeadersLength = profileHeaders.length;
+for (var i = 0; i < profileHeadersLength; ++i)
+if (!this.hasProfile(profileHeaders[i]))
+WebInspector.addProfileHeader(profileHeaders[i]);
+}
+
+InspectorBackend.getProfileHeaders(populateCallback.bind(this));
+
+this._profilesWereRequested = true;
+},
+
+updateMainViewWidth: function(width)
+{
+this.welcomeView.element.style.left = width + "px";
+this.profileViews.style.left = width + "px";
+this.profileViewStatusBarItemsContainer.style.left = Math.max(155, width) + "px";
+this.resize();
+}
 }
 
 WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
-WebInspector.ProfileSidebarTreeElement = function(profile)
+WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className)
 {
-    this.profile = profile;
+this.profile = profile;
+this._titleFormat = titleFormat;
 
-    if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
-        this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
+if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
+this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
 
-    WebInspector.SidebarTreeElement.call(this, "profile-sidebar-tree-item", "", "", profile, false);
+WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false);
 
-    this.refreshTitles();
+this.refreshTitles();
 }
 
 WebInspector.ProfileSidebarTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.profiles.showProfile(this.profile);
-    },
+onselect: function()
+{
+this.treeOutline.panel.showProfile(this.profile);
+},
 
-    get mainTitle()
-    {
-        if (this._mainTitle)
-            return this._mainTitle;
-        if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
-            return WebInspector.UIString("Profile %d", this._profileNumber);
-        return this.profile.title;
-    },
+ondelete: function()
+{
+this.treeOutline.panel.removeProfileHeader(this.profile);
+return true;
+},
 
-    set mainTitle(x)
-    {
-        this._mainTitle = x;
-        this.refreshTitles();
-    },
+get mainTitle()
+{
+if (this._mainTitle)
+return this._mainTitle;
+if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
+return WebInspector.UIString(this._titleFormat, this._profileNumber);
+return this.profile.title;
+},
 
-    get subtitle()
-    {
-        // There is no subtitle.
-    },
+set mainTitle(x)
+{
+this._mainTitle = x;
+this.refreshTitles();
+},
 
-    set subtitle(x)
-    {
-        // Can't change subtitle.
-    },
+get subtitle()
+{
 
-    set searchMatches(matches)
-    {
-        if (!matches) {
-            if (!this.bubbleElement)
-                return;
-            this.bubbleElement.removeStyleClass("search-matches");
-            this.bubbleText = "";
-            return;
-        }
+},
 
-        this.bubbleText = matches;
-        this.bubbleElement.addStyleClass("search-matches");
-    }
+set subtitle(x)
+{
+
+},
+
+set searchMatches(matches)
+{
+if (!matches) {
+if (!this.bubbleElement)
+return;
+this.bubbleElement.removeStyleClass("search-matches");
+this.bubbleText = "";
+return;
+}
+
+this.bubbleText = matches;
+this.bubbleElement.addStyleClass("search-matches");
+}
 }
 
 WebInspector.ProfileSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
 
 WebInspector.ProfileGroupSidebarTreeElement = function(title, subtitle)
 {
-    WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item", title, subtitle, null, true);
+WebInspector.SidebarTreeElement.call(this, "profile-group-sidebar-tree-item", title, subtitle, null, true);
 }
 
 WebInspector.ProfileGroupSidebarTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile);
-    }
+onselect: function()
+{
+if (this.children.length > 0)
+WebInspector.panels.profiles.showProfile(this.children[this.children.length - 1].profile);
+}
 }
 
 WebInspector.ProfileGroupSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
 
-WebInspector.didGetProfileHeaders = WebInspector.Callback.processCallback;
-WebInspector.didGetProfile = WebInspector.Callback.processCallback;
 
-/* ConsolePanel.js */
 
-/*
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ConsolePanel = function()
 {
-    WebInspector.Panel.call(this);
+WebInspector.Panel.call(this, "console");
 }
 
 WebInspector.ConsolePanel.prototype = {
-    toolbarItemClass: "console",
+get toolbarItemLabel()
+{
+return WebInspector.UIString("Console");
+},
 
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Console");
-    },
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
 
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
+this._previousConsoleState = WebInspector.drawer.state;
+WebInspector.drawer.enterPanelMode();
+WebInspector.showConsole();
 
-        this._previousConsoleState = WebInspector.drawer.state;
-        WebInspector.drawer.enterPanelMode();
-        WebInspector.showConsole();
-        
-        // Move the scope bar to the top of the messages, like the resources filter.
-        var scopeBar = document.getElementById("console-filter");
-        var consoleMessages = document.getElementById("console-messages");
 
-        scopeBar.parentNode.removeChild(scopeBar);
-        document.getElementById("console-view").insertBefore(scopeBar, consoleMessages);
-        
-        // Update styles, and give console-messages a top margin so it doesn't overwrite the scope bar.
-        scopeBar.addStyleClass("console-filter-top");
-        scopeBar.removeStyleClass("status-bar-item");
+var scopeBar = document.getElementById("console-filter");
+var consoleMessages = document.getElementById("console-messages");
 
-        consoleMessages.addStyleClass("console-filter-top");
-    },
+scopeBar.parentNode.removeChild(scopeBar);
+document.getElementById("console-view").insertBefore(scopeBar, consoleMessages);
 
-    hide: function()
-    {
-        WebInspector.Panel.prototype.hide.call(this);
 
-        if (this._previousConsoleState === WebInspector.Drawer.State.Hidden)
-            WebInspector.drawer.immediatelyExitPanelMode();
-        else
-            WebInspector.drawer.exitPanelMode();
-        delete this._previousConsoleState;
-        
-        // Move the scope bar back to the bottom bar, next to Clear Console.
-        var scopeBar = document.getElementById("console-filter");
+scopeBar.addStyleClass("console-filter-top");
+scopeBar.removeStyleClass("status-bar-item");
 
-        scopeBar.parentNode.removeChild(scopeBar);
-        document.getElementById("other-drawer-status-bar-items").appendChild(scopeBar);
-        
-        // Update styles, and remove the top margin on console-messages.
-        scopeBar.removeStyleClass("console-filter-top");
-        scopeBar.addStyleClass("status-bar-item");
+consoleMessages.addStyleClass("console-filter-top");
+},
 
-        document.getElementById("console-messages").removeStyleClass("console-filter-top");
-    }
+hide: function()
+{
+WebInspector.Panel.prototype.hide.call(this);
+
+if (this._previousConsoleState === WebInspector.Drawer.State.Hidden)
+WebInspector.drawer.immediatelyExitPanelMode();
+else
+WebInspector.drawer.exitPanelMode();
+delete this._previousConsoleState;
+
+
+var scopeBar = document.getElementById("console-filter");
+
+scopeBar.parentNode.removeChild(scopeBar);
+document.getElementById("other-drawer-status-bar-items").appendChild(scopeBar);
+
+
+scopeBar.removeStyleClass("console-filter-top");
+scopeBar.addStyleClass("status-bar-item");
+
+document.getElementById("console-messages").removeStyleClass("console-filter-top");
+}
 }
 
 WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
-/* AuditsPanel.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+WebInspector.injectedExtensionAPI = function(InjectedScriptHost, inspectedWindow, injectedScriptId)
+{
+
+
+
+
+
+
+
+function EventSinkImpl(type, customDispatch)
+{
+this._type = type;
+this._listeners = [];
+this._customDispatch = customDispatch;
+}
+
+EventSinkImpl.prototype = {
+addListener: function(callback)
+{
+if (typeof callback != "function")
+throw new "addListener: callback is not a function";
+if (this._listeners.length === 0)
+extensionServer.sendRequest({ command: "subscribe", type: this._type });
+this._listeners.push(callback);
+extensionServer.registerHandler("notify-" + this._type, bind(this._dispatch, this));
+},
+
+removeListener: function(callback)
+{
+var listeners = this._listeners;
+
+for (var i = 0; i < listeners.length; ++i) {
+if (listeners[i] === callback) {
+listeners.splice(i, 1);
+break;
+}
+}
+if (this._listeners.length === 0)
+extensionServer.sendRequest({ command: "unsubscribe", type: this._type });
+},
+
+_fire: function()
+{
+var listeners = this._listeners.slice();
+for (var i = 0; i < listeners.length; ++i)
+listeners[i].apply(null, arguments);
+},
+
+_dispatch: function(request)
+{
+if (this._customDispatch)
+this._customDispatch.call(this, request);
+else
+this._fire.apply(this, request.arguments);
+}
+}
+
+function InspectorExtensionAPI()
+{
+this.audits = new Audits();
+this.inspectedWindow = new InspectedWindow();
+this.panels = new Panels();
+this.resources = new Resources();
+
+this.onReset = new EventSink("reset");
+}
+
+InspectorExtensionAPI.prototype = {
+log: function(message)
+{
+extensionServer.sendRequest({ command: "log", message: message });
+}
+}
+
+function Resources()
+{
+function resourceDispatch(request)
+{
+var resource = request.arguments[1];
+resource.__proto__ = new Resource(request.arguments[0]);
+this._fire(resource);
+}
+this.onFinished = new EventSink("resource-finished", resourceDispatch);
+}
+
+Resources.prototype = {
+getHAR: function(callback)
+{
+function callbackWrapper(result)
+{
+var entries = (result && result.entries) || [];
+for (var i = 0; i < entries.length; ++i) {
+entries[i].__proto__ = new Resource(entries[i]._resourceId);
+delete entries[i]._resourceId;
+}
+callback(result);
+}
+return extensionServer.sendRequest({ command: "getHAR" }, callback && callbackWrapper);
+}
+}
+
+function ResourceImpl(id)
+{
+this._id = id;
+}
+
+ResourceImpl.prototype = {
+getContent: function(callback)
+{
+function callbackWrapper(response)
+{
+callback(response.content, response.encoding);
+}
+extensionServer.sendRequest({ command: "getResourceContent", id: this._id }, callback && callbackWrapper);
+}
+};
+
+function Panels()
+{
+var panels = {
+elements: new ElementsPanel()
+};
+
+function panelGetter(name)
+{
+return panels[name];
+}
+for (var panel in panels)
+this.__defineGetter__(panel, bind(panelGetter, null, panel));
+}
+
+Panels.prototype = {
+create: function(title, iconURL, pageURL, callback)
+{
+var id = "extension-panel-" + extensionServer.nextObjectId();
+var request = {
+command: "createPanel",
+id: id,
+title: title,
+icon: expandURL(iconURL),
+url: expandURL(pageURL)
+};
+extensionServer.sendRequest(request, callback && bind(callback, this, new ExtensionPanel(id)));
+}
+}
+
+function PanelImpl(id)
+{
+this._id = id;
+}
+
+function PanelWithSidebarImpl(id)
+{
+PanelImpl.call(this, id);
+}
+
+PanelWithSidebarImpl.prototype = {
+createSidebarPane: function(title, url, callback)
+{
+var id = "extension-sidebar-" + extensionServer.nextObjectId();
+var request = {
+command: "createSidebarPane",
+panel: this._id,
+id: id,
+title: title,
+url: expandURL(url)
+};
+function callbackWrapper()
+{
+callback(new ExtensionSidebarPane(id));
+}
+extensionServer.sendRequest(request, callback && callbackWrapper);
+},
+
+createWatchExpressionSidebarPane: function(title, callback)
+{
+var id = "watch-sidebar-" + extensionServer.nextObjectId();
+var request = {
+command: "createWatchExpressionSidebarPane",
+panel: this._id,
+id: id,
+title: title
+};
+function callbackWrapper()
+{
+callback(new WatchExpressionSidebarPane(id));
+}
+extensionServer.sendRequest(request, callback && callbackWrapper);
+}
+}
+
+PanelWithSidebarImpl.prototype.__proto__ = PanelImpl.prototype;
+
+function ElementsPanel()
+{
+var id = "elements";
+PanelWithSidebar.call(this, id);
+this.onSelectionChanged = new EventSink("panel-objectSelected-" + id);
+}
+
+function ExtensionPanel(id)
+{
+Panel.call(this, id);
+this.onSearch = new EventSink("panel-search-" + id);
+}
+
+function ExtensionSidebarPaneImpl(id)
+{
+this._id = id;
+}
+
+ExtensionSidebarPaneImpl.prototype = {
+setHeight: function(height)
+{
+extensionServer.sendRequest({ command: "setSidebarHeight", id: this._id, height: height });
+}
+}
+
+function WatchExpressionSidebarPaneImpl(id)
+{
+ExtensionSidebarPaneImpl.call(this, id);
+this.onUpdated = new EventSink("watch-sidebar-updated-" + id);
+}
+
+WatchExpressionSidebarPaneImpl.prototype = {
+setExpression: function(expression, rootTitle)
+{
+extensionServer.sendRequest({ command: "setWatchSidebarContent", id: this._id, expression: expression, rootTitle: rootTitle, evaluateOnPage: true });
+},
+
+setObject: function(jsonObject, rootTitle)
+{
+extensionServer.sendRequest({ command: "setWatchSidebarContent", id: this._id, expression: jsonObject, rootTitle: rootTitle });
+}
+}
+
+WatchExpressionSidebarPaneImpl.prototype.__proto__ = ExtensionSidebarPaneImpl.prototype;
+
+function WatchExpressionSidebarPane(id)
+{
+var impl = new WatchExpressionSidebarPaneImpl(id);
+ExtensionSidebarPane.call(this, id, impl);
+}
+
+function Audits()
+{
+}
+
+Audits.prototype = {
+addCategory: function(displayName, resultCount)
+{
+var id = "extension-audit-category-" + extensionServer.nextObjectId();
+extensionServer.sendRequest({ command: "addAuditCategory", id: id, displayName: displayName, resultCount: resultCount });
+return new AuditCategory(id);
+}
+}
+
+function AuditCategoryImpl(id)
+{
+function auditResultDispatch(request)
+{
+var auditResult = new AuditResult(request.arguments[0]);
+try {
+this._fire(auditResult);
+} catch (e) {
+console.error("Uncaught exception in extension audit event handler: " + e);
+auditResult.done();
+}
+}
+this._id = id;
+this.onAuditStarted = new EventSink("audit-started-" + id, auditResultDispatch);
+}
+
+function AuditResultImpl(id)
+{
+this._id = id;
+
+var formatterTypes = [
+"url",
+"snippet",
+"text"
+];
+for (var i = 0; i < formatterTypes.length; ++i)
+this[formatterTypes[i]] = bind(this._nodeFactory, null, formatterTypes[i]);
+}
+
+AuditResultImpl.prototype = {
+addResult: function(displayName, description, severity, details)
+{
+
+if (details && !(details instanceof AuditResultNode))
+details = details instanceof Array ? this.createNode.apply(this, details) : this.createNode(details);
+
+var request = {
+command: "addAuditResult",
+resultId: this._id,
+displayName: displayName,
+description: description,
+severity: severity,
+details: details
+};
+extensionServer.sendRequest(request);
+},
+
+createResult: function()
+{
+var node = new AuditResultNode();
+node.contents = Array.prototype.slice.call(arguments);
+return node;
+},
+
+done: function()
+{
+extensionServer.sendRequest({ command: "stopAuditCategoryRun", resultId: this._id });
+},
+
+get Severity()
+{
+return apiPrivate.audits.Severity;
+},
+
+_nodeFactory: function(type)
+{
+return {
+type: type,
+arguments: Array.prototype.slice.call(arguments, 1)
+};
+}
+}
+
+function AuditResultNode(contents)
+{
+this.contents = contents;
+this.children = [];
+this.expanded = false;
+}
+
+AuditResultNode.prototype = {
+addChild: function()
+{
+var node = AuditResultImpl.prototype.createResult.apply(null, arguments);
+this.children.push(node);
+return node;
+}
+};
+
+function InspectedWindow()
+{
+this.onDOMContentLoaded = new EventSink("inspectedPageDOMContentLoaded");
+this.onLoaded = new EventSink("inspectedPageLoaded");
+this.onNavigated = new EventSink("inspectedURLChanged");
+}
+
+InspectedWindow.prototype = {
+reload: function()
+{
+return extensionServer.sendRequest({ command: "reload" });
+},
+
+eval: function(expression, callback)
+{
+function callbackWrapper(result)
+{
+var value = result.value;
+if (!result.isException)
+value = value === "undefined" ? undefined : JSON.parse(value);
+callback(value, result.isException);
+}
+return extensionServer.sendRequest({ command: "evaluateOnInspectedPage", expression: expression }, callback && callbackWrapper);
+}
+}
+
+function ExtensionServerClient()
+{
+this._callbacks = {};
+this._handlers = {};
+this._lastRequestId = 0;
+this._lastObjectId = 0;
+
+this.registerHandler("callback", bind(this._onCallback, this));
+
+var channel = new MessageChannel();
+this._port = channel.port1;
+this._port.addEventListener("message", bind(this._onMessage, this), false);
+this._port.start();
+
+top.postMessage("registerExtension", [ channel.port2 ], "*");
+}
+
+ExtensionServerClient.prototype = {
+sendRequest: function(message, callback)
+{
+if (typeof callback === "function")
+message.requestId = this._registerCallback(callback);
+return this._port.postMessage(message);
+},
+
+registerHandler: function(command, handler)
+{
+this._handlers[command] = handler;
+},
+
+nextObjectId: function()
+{
+return injectedScriptId + "_" + ++this._lastObjectId;
+},
+
+_registerCallback: function(callback)
+{
+var id = ++this._lastRequestId;
+this._callbacks[id] = callback;
+return id;
+},
+
+_onCallback: function(request)
+{
+if (request.requestId in this._callbacks) {
+this._callbacks[request.requestId](request.result);
+delete this._callbacks[request.requestId];
+}
+},
+
+_onMessage: function(event)
+{
+var request = event.data;
+var handler = this._handlers[request.command];
+if (handler)
+handler.call(this, request);
+}
+}
+
+function expandURL(url)
+{
+if (!url)
+return url;
+if (/^[^/]+:/.exec(url)) // See if url has schema.
+return url;
+var baseURL = location.protocol + "//" + location.hostname + location.port;
+if (/^\//.exec(url))
+return baseURL + url;
+return baseURL + location.pathname.replace(/\/[^/]*$/,"/") + url;
+}
+
+function bind(func, thisObject)
+{
+var args = Array.prototype.slice.call(arguments, 2);
+return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); };
+}
+
+function populateInterfaceClass(interface, implementation)
+{
+for (var member in implementation) {
+if (member.charAt(0) === "_")
+continue;
+var value = implementation[member];
+interface[member] = typeof value === "function" ? bind(value, implementation)
+: interface[member] = implementation[member];
+}
+}
+
+function declareInterfaceClass(implConstructor)
+{
+return function()
+{
+var impl = { __proto__: implConstructor.prototype };
+implConstructor.apply(impl, arguments);
+populateInterfaceClass(this, impl);
+}
+}
+
+var AuditCategory = declareInterfaceClass(AuditCategoryImpl);
+var AuditResult = declareInterfaceClass(AuditResultImpl);
+var EventSink = declareInterfaceClass(EventSinkImpl);
+var ExtensionSidebarPane = declareInterfaceClass(ExtensionSidebarPaneImpl);
+var Panel = declareInterfaceClass(PanelImpl);
+var PanelWithSidebar = declareInterfaceClass(PanelWithSidebarImpl);
+var Resource = declareInterfaceClass(ResourceImpl);
+var WatchExpressionSidebarPane = declareInterfaceClass(WatchExpressionSidebarPaneImpl);
+
+var extensionServer = new ExtensionServerClient();
+
+webInspector = new InspectorExtensionAPI();
+
+}
+
+
+
+
+
+WebInspector.ExtensionAuditCategory = function(id, displayName, ruleCount)
+{
+this._id = id;
+this._displayName = displayName;
+this._ruleCount  = ruleCount;
+}
+
+WebInspector.ExtensionAuditCategory.prototype = {
+
+get id()
+{
+return this._id;
+},
+
+get displayName()
+{
+return this._displayName;
+},
+
+get ruleCount()
+{
+return this._ruleCount;
+},
+
+run: function(resources, callback)
+{
+new WebInspector.ExtensionAuditCategoryResults(this, callback);
+}
+}
+
+WebInspector.ExtensionAuditCategoryResults = function(category, callback)
+{
+this._category = category;
+this._pendingRules = category.ruleCount;
+this._ruleCompletionCallback = callback;
+
+this.id = category.id + "-" + ++WebInspector.ExtensionAuditCategoryResults._lastId;
+WebInspector.extensionServer.startAuditRun(category, this);
+}
+
+WebInspector.ExtensionAuditCategoryResults.prototype = {
+get complete()
+{
+return !this._pendingRules;
+},
+
+cancel: function()
+{
+while (!this.complete)
+this._addResult(null);
+},
+
+addResult: function(displayName, description, severity, details)
+{
+var result = new WebInspector.AuditRuleResult(displayName);
+result.addChild(description);
+result.severity = severity;
+if (details)
+this._addNode(result, details);
+this._addResult(result);
+},
+
+_addNode: function(parent, node)
+{
+var addedNode = parent.addChild(node.contents, node.expanded);
+if (node.children) {
+for (var i = 0; i < node.children.length; ++i)
+this._addNode(addedNode, node.children[i]);
+}
+},
+
+_addResult: function(result)
+{
+this._ruleCompletionCallback(result);
+this._pendingRules--;
+if (!this._pendingRules)
+WebInspector.extensionServer.stopAuditRun(this);
+}
+}
+
+WebInspector.ExtensionAuditCategoryResults._lastId = 0;
+
+
+
+
+
+WebInspector.commonExtensionSymbols = function(apiPrivate)
+{
+
+if (!apiPrivate.audits)
+apiPrivate.audits = {};
+
+apiPrivate.audits.Severity = {
+Info: "info",
+Warning: "warning",
+Severe: "severe"
+};
+}
+
+WebInspector.extensionAPI = {};
+
+WebInspector.commonExtensionSymbols(WebInspector.extensionAPI);
+
+
+
+
+
+WebInspector.ExtensionServer = function()
+{
+this._clientObjects = {};
+this._handlers = {};
+this._subscribers = {};
+this._status = new WebInspector.ExtensionStatus();
+
+this._registerHandler("addAuditCategory", this._onAddAuditCategory.bind(this));
+this._registerHandler("addAuditResult", this._onAddAuditResult.bind(this));
+this._registerHandler("createPanel", this._onCreatePanel.bind(this));
+this._registerHandler("createSidebarPane", this._onCreateSidebar.bind(this));
+this._registerHandler("createWatchExpressionSidebarPane", this._onCreateWatchExpressionSidebarPane.bind(this));
+this._registerHandler("evaluateOnInspectedPage", this._onEvaluateOnInspectedPage.bind(this));
+this._registerHandler("getHAR", this._onGetHAR.bind(this));
+this._registerHandler("getResourceContent", this._onGetResourceContent.bind(this));
+this._registerHandler("log", this._onLog.bind(this));
+this._registerHandler("reload", this._onReload.bind(this));
+this._registerHandler("setSidebarHeight", this._onSetSidebarHeight.bind(this));
+this._registerHandler("setWatchSidebarContent", this._onSetWatchSidebarContent.bind(this));
+this._registerHandler("stopAuditCategoryRun", this._onStopAuditCategoryRun.bind(this));
+this._registerHandler("subscribe", this._onSubscribe.bind(this));
+this._registerHandler("unsubscribe", this._onUnsubscribe.bind(this));
+
+
+window.addEventListener("message", this._onWindowMessage.bind(this), false);
+}
+
+WebInspector.ExtensionServer.prototype = {
+notifyPanelShown: function(panelName)
+{
+this._postNotification("panel-shown-" + panelName);
+},
+
+notifyObjectSelected: function(panelId, objectId)
+{
+this._postNotification("panel-objectSelected-" + panelId, objectId);
+},
+
+notifyResourceFinished: function(resource)
+{
+this._postNotification("resource-finished", resource.identifier, (new WebInspector.HAREntry(resource)).build());
+},
+
+notifySearchAction: function(panelId, action, searchString)
+{
+this._postNotification("panel-search-" + panelId, action, searchString);
+},
+
+notifyPageLoaded: function(milliseconds)
+{
+this._postNotification("inspectedPageLoaded", milliseconds);
+},
+
+notifyPageDOMContentLoaded: function(milliseconds)
+{
+this._postNotification("inspectedPageDOMContentLoaded", milliseconds);
+},
+
+notifyInspectedURLChanged: function()
+{
+this._postNotification("inspectedURLChanged");
+},
+
+notifyInspectorReset: function()
+{
+this._postNotification("reset");
+},
+
+notifyExtensionWatchSidebarUpdated: function(id)
+{
+this._postNotification("watch-sidebar-updated-" + id);
+},
+
+startAuditRun: function(category, auditRun)
+{
+this._clientObjects[auditRun.id] = auditRun;
+this._postNotification("audit-started-" + category.id, auditRun.id);
+},
+
+stopAuditRun: function(auditRun)
+{
+delete this._clientObjects[auditRun.id];
+},
+
+_postNotification: function(type, details)
+{
+var subscribers = this._subscribers[type];
+if (!subscribers)
+return;
+var message = {
+command: "notify-" + type,
+arguments: Array.prototype.slice.call(arguments, 1)
+};
+for (var i = 0; i < subscribers.length; ++i)
+subscribers[i].postMessage(message);
+},
+
+_onSubscribe: function(message, port)
+{
+var subscribers = this._subscribers[message.type];
+if (subscribers)
+subscribers.push(port);
+else
+this._subscribers[message.type] = [ port ];
+},
+
+_onUnsubscribe: function(message, port)
+{
+var subscribers = this._subscribers[message.type];
+if (!subscribers)
+return;
+subscribers.remove(port);
+if (!subscribers.length)
+delete this._subscribers[message.type];
+},
+
+_onCreatePanel: function(message, port)
+{
+var id = message.id;
+
+
+if (id in this._clientObjects || id in WebInspector.panels)
+return this._status.E_EXISTS(id);
+var panel = new WebInspector.ExtensionPanel(id, message.title, message.icon);
+this._clientObjects[id] = panel;
+
+var toolbarElement = document.getElementById("toolbar");
+var lastToolbarItem = WebInspector.panelOrder[WebInspector.panelOrder.length - 1].toolbarItem;
+WebInspector.addPanelToolbarIcon(toolbarElement, panel, lastToolbarItem);
+WebInspector.panels[id] = panel;
+var iframe = this._createClientIframe(panel.element, message.url);
+iframe.style.height = "100%";
+return this._status.OK();
+},
+
+_onCreateSidebar: function(message)
+{
+var sidebar = this._createSidebar(message, WebInspector.SidebarPane);
+if (sidebar.isError)
+return sidebar;
+this._createClientIframe(sidebar.bodyElement, message.url);
+return this._status.OK();
+},
+
+_onCreateWatchExpressionSidebarPane: function(message)
+{
+var sidebar = this._createSidebar(message, WebInspector.ExtensionWatchSidebarPane);
+return sidebar.isError ? sidebar : this._status.OK();
+},
+
+_createSidebar: function(message, constructor)
+{
+var panel = WebInspector.panels[message.panel];
+if (!panel)
+return this._status.E_NOTFOUND(message.panel);
+if (!panel.sidebarElement || !panel.sidebarPanes)
+return this._status.E_NOTSUPPORTED();
+var id = message.id;
+var sidebar = new constructor(message.title, message.id);
+this._clientObjects[id] = sidebar;
+panel.sidebarPanes[id] = sidebar;
+panel.sidebarElement.appendChild(sidebar.element);
+
+return sidebar;
+},
+
+_createClientIframe: function(parent, url, requestId, port)
+{
+var iframe = document.createElement("iframe");
+iframe.src = url;
+iframe.style.width = "100%";
+parent.appendChild(iframe);
+return iframe;
+},
+
+_onSetSidebarHeight: function(message)
+{
+var sidebar = this._clientObjects[message.id];
+if (!sidebar)
+return this._status.E_NOTFOUND(message.id);
+sidebar.bodyElement.firstChild.style.height = message.height;
+},
+
+_onSetWatchSidebarContent: function(message)
+{
+var sidebar = this._clientObjects[message.id];
+if (!sidebar)
+return this._status.E_NOTFOUND(message.id);
+if (message.evaluateOnPage)
+sidebar.setExpression(message.expression, message.rootTitle);
+else
+sidebar.setObject(message.expression, message.rootTitle);
+},
+
+_onLog: function(message)
+{
+WebInspector.log(message.message);
+},
+
+_onReload: function()
+{
+InspectorBackend.reloadPage();
+return this._status.OK();
+},
+
+_onEvaluateOnInspectedPage: function(message, port)
+{
+function callback(resultPayload)
+{
+var resultObject = WebInspector.RemoteObject.fromPayload(resultPayload);
+var result = {};
+if (resultObject.isError())
+result.isException = true;
+result.value = resultObject.description;
+this._dispatchCallback(message.requestId, port, result);
+}
+var evalExpression = "JSON.stringify(eval('" +
+"with (window.console._commandLineAPI) with (window) {' + unescape('" + escape(message.expression) +
+"') + '}'));";
+InjectedScriptAccess.getDefault().evaluate(evalExpression, callback.bind(this));
+},
+
+_onRevealAndSelect: function(message)
+{
+if (message.panelId === "resources" && type === "resource")
+return this._onRevealAndSelectResource(message);
+else
+return this._status.E_NOTSUPPORTED(message.panelId, message.type);
+},
+
+_onRevealAndSelectResource: function(message)
+{
+var id = message.id;
+var resource = null;
+
+resource = WebInspector.networkResources[id] || WebInspector.resourceForURL(id);
+if (!resource)
+return this._status.E_NOTFOUND(typeof id + ": " + id);
+
+WebInspector.panels.resources.showResource(resource, message.line);
+WebInspector.showPanel("resources");
+},
+
+_dispatchCallback: function(requestId, port, result)
+{
+port.postMessage({ command: "callback", requestId: requestId, result: result });
+},
+
+_onGetHAR: function(request)
+{
+var harLog = new WebInspector.HARLog();
+harLog.includeResourceIds = true;
+return harLog.build();
+},
+
+_onGetResourceContent: function(message, port)
+{
+function onContentAvailable(content, encoded)
+{
+var response = {
+encoding: encoded ? "base64" : "",
+content: content
+};
+this._dispatchCallback(message.requestId, port, response);
+}
+var resource = WebInspector.networkResources[message.id];
+if (!resource)
+return this._status.E_NOTFOUND(message.id);
+resource.requestContent(onContentAvailable.bind(this));
+},
+
+_onAddAuditCategory: function(request)
+{
+var category = new WebInspector.ExtensionAuditCategory(request.id, request.displayName, request.resultCount);
+if (WebInspector.panels.audits.getCategory(category.id))
+return this._status.E_EXISTS(category.id);
+this._clientObjects[request.id] = category;
+WebInspector.panels.audits.addCategory(category);
+},
+
+_onAddAuditResult: function(request)
+{
+var auditResult = this._clientObjects[request.resultId];
+if (!auditResult)
+return this._status.E_NOTFOUND(request.resultId);
+try {
+auditResult.addResult(request.displayName, request.description, request.severity, request.details);
+} catch (e) {
+return e;
+}
+return this._status.OK();
+},
+
+_onStopAuditCategoryRun: function(request)
+{
+var auditRun = this._clientObjects[request.resultId];
+if (!auditRun)
+return this._status.E_NOTFOUND(request.resultId);
+auditRun.cancel();
+},
+
+initExtensions: function()
+{
+InspectorExtensionRegistry.getExtensionsAsync();
+},
+
+_addExtensions: function(extensions)
+{
+
+InspectorFrontendHost.setExtensionAPI(this._buildExtensionAPIInjectedScript());
+for (var i = 0; i < extensions.length; ++i) {
+var extension = extensions[i];
+try {
+if (!extension.startPage)
+return;
+var iframe = document.createElement("iframe");
+iframe.src = extension.startPage;
+iframe.style.display = "none";
+document.body.appendChild(iframe);
+} catch (e) {
+console.error("Failed to initialize extension " + extension.startPage + ":" + e);
+}
+}
+},
+
+_buildExtensionAPIInjectedScript: function()
+{
+var resourceTypes = {};
+var resourceTypeProperties = Object.getOwnPropertyNames(WebInspector.Resource.Type);
+for (var i = 0; i < resourceTypeProperties.length; ++i) {
+var propName = resourceTypeProperties[i];
+var propValue = WebInspector.Resource.Type[propName];
+if (typeof propValue === "number")
+resourceTypes[propName] = WebInspector.Resource.Type.toString(propValue);
+}
+var platformAPI = WebInspector.buildPlatformExtensionAPI ? WebInspector.buildPlatformExtensionAPI() : "";
+return "(function(){ " +
+"var apiPrivate = {};" +
+"(" + WebInspector.commonExtensionSymbols.toString() + ")(apiPrivate);" +
+"(" + WebInspector.injectedExtensionAPI.toString() + ").apply(this, arguments);" +
+"webInspector.resources.Types = " + JSON.stringify(resourceTypes) + ";" +
+platformAPI +
+"})";
+},
+
+_onWindowMessage: function(event)
+{
+if (event.data !== "registerExtension")
+return;
+var port = event.ports[0];
+port.addEventListener("message", this._onmessage.bind(this), false);
+port.start();
+},
+
+_onmessage: function(event)
+{
+var request = event.data;
+var result;
+
+if (request.command in this._handlers)
+result = this._handlers[request.command](request, event.target);
+else
+result = this._status.E_NOTSUPPORTED(request.command);
+
+if (result && request.requestId)
+this._dispatchCallback(request.requestId, event.target, result);
+},
+
+_registerHandler: function(command, callback)
+{
+this._handlers[command] = callback;
+}
+}
+
+WebInspector.ExtensionServer._statuses =
+{
+OK: "",
+E_EXISTS: "Object already exists: %s",
+E_BADARG: "Invalid argument %s: %s",
+E_BADARGTYPE: "Invalid type for argument %s: got %s, expected %s",
+E_NOTFOUND: "Object not found: %s",
+E_NOTSUPPORTED: "Object does not support requested operation: %s",
+}
+
+WebInspector.ExtensionStatus = function()
+{
+function makeStatus(code)
+{
+var description = WebInspector.ExtensionServer._statuses[code] || code;
+var details = Array.prototype.slice.call(arguments, 1);
+var status = { code: code, description: description, details: details };
+if (code !== "OK") {
+status.isError = true;
+console.log("Extension server error: " + String.vsprintf(description, details));
+}
+return status;
+}
+for (status in WebInspector.ExtensionServer._statuses)
+this[status] = makeStatus.bind(null, status);
+}
+
+WebInspector.addExtensions = function(extensions)
+{
+WebInspector.extensionServer._addExtensions(extensions);
+}
+
+WebInspector.extensionServer = new WebInspector.ExtensionServer();
+
+
+
+
+
+WebInspector.ExtensionPanel = function(id, label, iconURL, options)
+{
+this.toolbarItemLabel = label;
+this._addStyleRule(".toolbar-item." + id + " .toolbar-icon", "background-image: url(" + iconURL + ");");
+WebInspector.Panel.call(this, id);
+}
+
+WebInspector.ExtensionPanel.prototype = {
+get defaultFocusedElement()
+{
+return this.sidebarTreeElement || this.element;
+},
+
+updateMainViewWidth: function(width)
+{
+this.bodyElement.style.left = width + "px";
+this.resize();
+},
+
+searchCanceled: function(startingNewSearch)
+{
+WebInspector.extensionServer.notifySearchAction(this._id, "cancelSearch");
+WebInspector.Panel.prototype.searchCanceled.apply(this, arguments);
+},
+
+performSearch: function(query)
+{
+WebInspector.extensionServer.notifySearchAction(this._id, "performSearch", query);
+WebInspector.Panel.prototype.performSearch.apply(this, arguments);
+},
+
+jumpToNextSearchResult: function()
+{
+WebInspector.extensionServer.notifySearchAction(this._id, "nextSearchResult");
+WebInspector.Panel.prototype.jumpToNextSearchResult.call(this);
+},
+
+jumpToPreviousSearchResult: function()
+{
+WebInspector.extensionServer.notifySearchAction(this._id, "previousSearchResult");
+WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this);
+},
+
+_addStyleRule: function(selector, body)
+{
+var style = document.createElement("style");
+style.textContent = selector + " { " + body + " }";
+document.head.appendChild(style);
+}
+}
+
+WebInspector.ExtensionPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.ExtensionWatchSidebarPane = function(title, id)
+{
+WebInspector.SidebarPane.call(this, title);
+this._id = id;
+}
+
+WebInspector.ExtensionWatchSidebarPane.prototype = {
+setObject: function(object, title)
+{
+this._setObject(WebInspector.RemoteObject.fromLocalObject(object), title);
+},
+
+setExpression: function(expression, title)
+{
+InjectedScriptAccess.getDefault().evaluate(expression, this._onEvaluate.bind(this, title));
+},
+
+_onEvaluate: function(title, result)
+{
+this._setObject(WebInspector.RemoteObject.fromPayload(result), title);
+},
+
+_setObject: function(object, title)
+{
+this.bodyElement.removeChildren();
+var section = new WebInspector.ObjectPropertiesSection(object, title, null, true);
+if (!title)
+section.headerElement.addStyleClass("hidden");
+section.expanded = true;
+this.bodyElement.appendChild(section.element);
+WebInspector.extensionServer.notifyExtensionWatchSidebarUpdated(this._id);
+}
+}
+
+WebInspector.ExtensionWatchSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+
+
+
+
 
 WebInspector.AuditsPanel = function()
 {
-    WebInspector.Panel.call(this);
+WebInspector.Panel.call(this, "audits");
 
-    this._constructCategories();
+this.createSidebar();
+this.auditsTreeElement = new WebInspector.SidebarSectionTreeElement("", {}, true);
+this.sidebarTree.appendChild(this.auditsTreeElement);
+this.auditsTreeElement.listItemElement.addStyleClass("hidden");
+this.auditsTreeElement.expand();
 
-    this.createSidebar();
-    this.auditsTreeElement = new WebInspector.SidebarSectionTreeElement("", {}, true);
-    this.sidebarTree.appendChild(this.auditsTreeElement);
-    this.auditsTreeElement.listItemElement.addStyleClass("hidden");
-    this.auditsTreeElement.expand();
+this.auditsItemTreeElement = new WebInspector.AuditsSidebarTreeElement();
+this.auditsTreeElement.appendChild(this.auditsItemTreeElement);
 
-    this.auditsItemTreeElement = new WebInspector.AuditsSidebarTreeElement();
-    this.auditsTreeElement.appendChild(this.auditsItemTreeElement);
+this.auditResultsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESULTS"), {}, true);
+this.sidebarTree.appendChild(this.auditResultsTreeElement);
+this.auditResultsTreeElement.expand();
 
-    this.auditResultsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RESULTS"), {}, true);
-    this.sidebarTree.appendChild(this.auditResultsTreeElement);
-    this.auditResultsTreeElement.expand();
+this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear-status-bar-item");
+this.clearResultsButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
 
-    this.element.addStyleClass("audits");
+this.viewsContainerElement = document.createElement("div");
+this.viewsContainerElement.id = "audit-views";
+this.element.appendChild(this.viewsContainerElement);
 
-    this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear-audit-results-status-bar-item");
-    this.clearResultsButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
+this._constructCategories();
 
-    this.viewsContainerElement = document.createElement("div");
-    this.viewsContainerElement.id = "audit-views";
-    this.element.appendChild(this.viewsContainerElement);
-
-    this._launcherView = new WebInspector.AuditLauncherView(this.categoriesById, this.initiateAudit.bind(this));
+this._launcherView = new WebInspector.AuditLauncherView(this.initiateAudit.bind(this));
+for (id in this.categoriesById)
+this._launcherView.addCategory(this.categoriesById[id]);
 }
 
 WebInspector.AuditsPanel.prototype = {
-    toolbarItemClass: "audits",
+get toolbarItemLabel()
+{
+return WebInspector.UIString("Audits");
+},
 
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Audits");
-    },
+get statusBarItems()
+{
+return [this.clearResultsButton.element];
+},
 
-    get statusBarItems()
-    {
-        return [this.clearResultsButton.element];
-    },
+get mainResourceLoadTime()
+{
+return this._mainResourceLoadTime;
+},
 
-    get mainResourceLoadTime()
-    {
-        return this._mainResourceLoadTime;
-    },
+set mainResourceLoadTime(x)
+{
+this._mainResourceLoadTime = x;
+this._didMainResourceLoad();
+},
 
-    set mainResourceLoadTime(x)
-    {
-        this._mainResourceLoadTime = x;
-        this._didMainResourceLoad();
-    },
+get mainResourceDOMContentTime()
+{
+return this._mainResourceDOMContentTime;
+},
 
-    get mainResourceDOMContentTime()
-    {
-        return this._mainResourceDOMContentTime;
-    },
+set mainResourceDOMContentTime(x)
+{
+this._mainResourceDOMContentTime = x;
+},
 
-    set mainResourceDOMContentTime(x)
-    {
-        this._mainResourceDOMContentTime = x;
-    },
+get categoriesById()
+{
+return this._auditCategoriesById;
+},
 
-    get categoriesById()
-    {
-        return this._auditCategoriesById;
-    },
+resourceStarted: function(resource)
+{
+this._launcherView.resourceStarted(resource);
+},
 
-    _constructCategories: function()
-    {
-        this._auditCategoriesById = {};
-        for (var categoryCtorID in WebInspector.AuditCategories) {
-            var auditCategory = new WebInspector.AuditCategories[categoryCtorID]();
-            auditCategory._id = categoryCtorID;
-            this.categoriesById[categoryCtorID] = auditCategory;
-        }
-    },
+resourceFinished: function(resource)
+{
+this._launcherView.resourceFinished(resource);
+},
 
-    _executeAudit: function(categories, resultCallback)
-    {
-        var resources = [];
-        for (var id in WebInspector.resources)
-            resources.push(WebInspector.resources[id]);
+addCategory: function(category)
+{
+this.categoriesById[category.id] = category;
+this._launcherView.addCategory(category);
+},
 
-        var rulesRemaining = 0;
-        for (var i = 0; i < categories.length; ++i)
-            rulesRemaining += categories[i].ruleCount;
+getCategory: function(id)
+{
+return this.categoriesById[id];
+},
 
-        var results = [];
-        var mainResourceURL = WebInspector.mainResource.url;
+_constructCategories: function()
+{
+this._auditCategoriesById = {};
+for (var categoryCtorID in WebInspector.AuditCategories) {
+var auditCategory = new WebInspector.AuditCategories[categoryCtorID]();
+auditCategory._id = categoryCtorID;
+this.categoriesById[categoryCtorID] = auditCategory;
+}
+},
 
-        function ruleResultReadyCallback(categoryResult, ruleResult)
-        {
-            if (ruleResult && ruleResult.children)
-                categoryResult.addRuleResult(ruleResult);
+_executeAudit: function(categories, resultCallback)
+{
+var resources = [];
+for (var id in WebInspector.networkResources)
+resources.push(WebInspector.networkResources[id]);
 
-            --rulesRemaining;
+var rulesRemaining = 0;
+for (var i = 0; i < categories.length; ++i)
+rulesRemaining += categories[i].ruleCount;
 
-            if (!rulesRemaining && resultCallback)
-                resultCallback(mainResourceURL, results);
-        }
+var results = [];
+var mainResourceURL = WebInspector.mainResource.url;
 
-        if (!rulesRemaining) {
-            resultCallback(mainResourceURL, results);
-            return;
-        }
+function ruleResultReadyCallback(categoryResult, ruleResult)
+{
+if (ruleResult && ruleResult.children)
+categoryResult.addRuleResult(ruleResult);
 
-        for (var i = 0; i < categories.length; ++i) {
-            var category = categories[i];
-            var result = new WebInspector.AuditCategoryResult(category);
-            results.push(result);
-            category.runRules(resources, ruleResultReadyCallback.bind(null, result));
-        }
-    },
+--rulesRemaining;
 
-    _auditFinishedCallback: function(launcherCallback, mainResourceURL, results)
-    {
-        var children = this.auditResultsTreeElement.children;
-        var ordinal = 1;
-        for (var i = 0; i < children.length; ++i) {
-            if (children[i].mainResourceURL === mainResourceURL)
-                ordinal++;
-        }
+if (!rulesRemaining && resultCallback)
+resultCallback(mainResourceURL, results);
+}
 
-        var resultTreeElement = new WebInspector.AuditResultSidebarTreeElement(results, mainResourceURL, ordinal);
-        this.auditResultsTreeElement.appendChild(resultTreeElement);
-        resultTreeElement.reveal();
-        resultTreeElement.select();
-        if (launcherCallback)
-            launcherCallback();
-    },
+if (!rulesRemaining) {
+resultCallback(mainResourceURL, results);
+return;
+}
 
-    initiateAudit: function(categoryIds, runImmediately, launcherCallback)
-    {
-        if (!categoryIds || !categoryIds.length)
-            return;
+for (var i = 0; i < categories.length; ++i) {
+var category = categories[i];
+var result = new WebInspector.AuditCategoryResult(category);
+results.push(result);
+category.run(resources, ruleResultReadyCallback.bind(null, result));
+}
+},
 
-        var categories = [];
-        for (var i = 0; i < categoryIds.length; ++i)
-            categories.push(this.categoriesById[categoryIds[i]]);
+_auditFinishedCallback: function(launcherCallback, mainResourceURL, results)
+{
+var children = this.auditResultsTreeElement.children;
+var ordinal = 1;
+for (var i = 0; i < children.length; ++i) {
+if (children[i].mainResourceURL === mainResourceURL)
+ordinal++;
+}
 
-        function initiateAuditCallback(categories, launcherCallback)
-        {
-            this._executeAudit(categories, this._auditFinishedCallback.bind(this, launcherCallback));
-        }
+var resultTreeElement = new WebInspector.AuditResultSidebarTreeElement(results, mainResourceURL, ordinal);
+this.auditResultsTreeElement.appendChild(resultTreeElement);
+resultTreeElement.reveal();
+resultTreeElement.select();
+if (launcherCallback)
+launcherCallback();
+},
 
-        if (runImmediately)
-            initiateAuditCallback.call(this, categories, launcherCallback);
-        else
-            this._reloadResources(initiateAuditCallback.bind(this, categories, launcherCallback));
-    },
+initiateAudit: function(categoryIds, runImmediately, launcherCallback)
+{
+if (!categoryIds || !categoryIds.length)
+return;
 
-    _reloadResources: function(callback)
-    {
-        this._resourceTrackingCallback = callback;
+var categories = [];
+for (var i = 0; i < categoryIds.length; ++i)
+categories.push(this.categoriesById[categoryIds[i]]);
 
-        if (!WebInspector.panels.resources.resourceTrackingEnabled) {
-            InspectorBackend.enableResourceTracking(false);
-            this._updateLauncherViewControls(true);
-        } else
-            InspectorBackend.reloadPage();
-    },
+function initiateAuditCallback(categories, launcherCallback)
+{
+this._executeAudit(categories, this._auditFinishedCallback.bind(this, launcherCallback));
+}
 
-    _didMainResourceLoad: function()
-    {
-        if (this._resourceTrackingCallback) {
-            var callback = this._resourceTrackingCallback;
-            delete this._resourceTrackingCallback;
-            callback();
-        }
-    },
+if (runImmediately)
+initiateAuditCallback.call(this, categories, launcherCallback);
+else
+this._reloadResources(initiateAuditCallback.bind(this, categories, launcherCallback));
+},
 
-    showResults: function(categoryResults)
-    {
-        if (!categoryResults._resultView)
-            categoryResults._resultView = new WebInspector.AuditResultView(categoryResults);
+_reloadResources: function(callback)
+{
+this._pageReloadCallback = callback;
+InspectorBackend.reloadPage();
+},
 
-        this.visibleView = categoryResults._resultView;
-    },
+_didMainResourceLoad: function()
+{
+if (this._pageReloadCallback) {
+var callback = this._pageReloadCallback;
+delete this._pageReloadCallback;
+callback();
+}
+},
 
-    showLauncherView: function()
-    {
-        this.visibleView = this._launcherView;
-    },
-    
-    get visibleView()
-    {
-        return this._visibleView;
-    },
+showResults: function(categoryResults)
+{
+if (!categoryResults._resultView)
+categoryResults._resultView = new WebInspector.AuditResultView(categoryResults);
 
-    set visibleView(x)
-    {
-        if (this._visibleView === x)
-            return;
+this.visibleView = categoryResults._resultView;
+},
 
-        if (this._visibleView)
-            this._visibleView.hide();
+showLauncherView: function()
+{
+this.visibleView = this._launcherView;
+},
 
-        this._visibleView = x;
+get visibleView()
+{
+return this._visibleView;
+},
 
-        if (x)
-            x.show(this.viewsContainerElement);
-    },
+set visibleView(x)
+{
+if (this._visibleView === x)
+return;
 
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-        this._updateLauncherViewControls(WebInspector.panels.resources.resourceTrackingEnabled);
-    },
+if (this._visibleView)
+this._visibleView.hide();
 
-    attach: function()
-    {
-        WebInspector.Panel.prototype.attach.call(this);
+this._visibleView = x;
 
-        this.auditsItemTreeElement.select();
-    },
+if (x)
+x.show(this.viewsContainerElement);
+},
 
-    updateMainViewWidth: function(width)
-    {
-        this.viewsContainerElement.style.left = width + "px";
-    },
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+this._updateLauncherViewControls(!WebInspector.panels.resources || WebInspector.panels.resources.resourceTrackingEnabled);
+},
 
-    _updateLauncherViewControls: function(isTracking)
-    {
-        if (this._launcherView)
-            this._launcherView.updateResourceTrackingState(isTracking);
-    },
+reset: function()
+{
+this._launcherView.reset();
+},
 
-    _clearButtonClicked: function()
-    {
-        this.auditsItemTreeElement.reveal();
-        this.auditsItemTreeElement.select();
-        this.auditResultsTreeElement.removeChildren();
-    }
+attach: function()
+{
+WebInspector.Panel.prototype.attach.call(this);
+
+this.auditsItemTreeElement.select();
+},
+
+updateMainViewWidth: function(width)
+{
+this.viewsContainerElement.style.left = width + "px";
+},
+
+_updateLauncherViewControls: function(isTracking)
+{
+if (this._launcherView)
+this._launcherView.updateResourceTrackingState(isTracking);
+},
+
+_clearButtonClicked: function()
+{
+this.auditsItemTreeElement.reveal();
+this.auditsItemTreeElement.select();
+this.auditResultsTreeElement.removeChildren();
+}
 }
 
 WebInspector.AuditsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
@@ -21988,168 +26897,184 @@
 
 WebInspector.AuditCategory = function(displayName)
 {
-    this._displayName = displayName;
-    this._rules = [];
+this._displayName = displayName;
+this._rules = [];
 }
 
 WebInspector.AuditCategory.prototype = {
-    get id()
-    {
-        // this._id value is injected at construction time.
-        return this._id;
-    },
+get id()
+{
 
-    get displayName()
-    {
-        return this._displayName;
-    },
+return this._id;
+},
 
-    get ruleCount()
-    {
-        this._ensureInitialized();
-        return this._rules.length;
-    },
+get displayName()
+{
+return this._displayName;
+},
 
-    addRule: function(rule, severity)
-    {
-        rule.severity = severity;
-        this._rules.push(rule);
-    },
+get ruleCount()
+{
+this._ensureInitialized();
+return this._rules.length;
+},
 
-    runRules: function(resources, callback)
-    {
-        this._ensureInitialized();
-        for (var i = 0; i < this._rules.length; ++i)
-            this._rules[i].run(resources, callback);
-    },
+addRule: function(rule, severity)
+{
+rule.severity = severity;
+this._rules.push(rule);
+},
 
-    _ensureInitialized: function()
-    {
-        if (!this._initialized) {
-            if ("initialize" in this)
-                this.initialize();
-            this._initialized = true;
-        }
-    }
+run: function(resources, callback)
+{
+this._ensureInitialized();
+for (var i = 0; i < this._rules.length; ++i)
+this._rules[i].run(resources, callback);
+},
+
+_ensureInitialized: function()
+{
+if (!this._initialized) {
+if ("initialize" in this)
+this.initialize();
+this._initialized = true;
+}
+}
 }
 
 
 WebInspector.AuditRule = function(id, displayName)
 {
-    this._id = id;
-    this._displayName = displayName;
+this._id = id;
+this._displayName = displayName;
 }
 
 WebInspector.AuditRule.Severity = {
-    Info: "info",
-    Warning: "warning",
-    Severe: "severe"
+Info: "info",
+Warning: "warning",
+Severe: "severe"
+}
+
+WebInspector.AuditRule.SeverityOrder = {
+"info": 3,
+"warning": 2,
+"severe": 1
 }
 
 WebInspector.AuditRule.prototype = {
-    get id()
-    {
-        return this._id;
-    },
+get id()
+{
+return this._id;
+},
 
-    get displayName()
-    {
-        return this._displayName;
-    },
+get displayName()
+{
+return this._displayName;
+},
 
-    set severity(severity)
-    {
-        this._severity = severity;
-    },
+set severity(severity)
+{
+this._severity = severity;
+},
 
-    run: function(resources, callback)
-    {
-        var result = new WebInspector.AuditRuleResult(this.displayName);
-        result.severity = this._severity;
-        this.doRun(resources, result, callback);
-    },
+run: function(resources, callback)
+{
+var result = new WebInspector.AuditRuleResult(this.displayName);
+result.severity = this._severity;
+this.doRun(resources, result, callback);
+},
 
-    doRun: function(resources, result, callback)
-    {
-        throw new Error("doRun() not implemented");
-    }
+doRun: function(resources, result, callback)
+{
+throw new Error("doRun() not implemented");
+}
 }
 
 WebInspector.AuditCategoryResult = function(category)
 {
-    this.title = category.displayName;
-    this.ruleResults = [];
+this.title = category.displayName;
+this.ruleResults = [];
 }
 
 WebInspector.AuditCategoryResult.prototype = {
-    addRuleResult: function(ruleResult)
-    {
-        this.ruleResults.push(ruleResult);
-    }
+addRuleResult: function(ruleResult)
+{
+this.ruleResults.push(ruleResult);
+}
 }
 
 WebInspector.AuditRuleResult = function(value, expanded, className)
 {
-    this.value = value;
-    this.className = className;
-    this.expanded = expanded;
-    this.violationCount = 0;
+this.value = value;
+this.className = className;
+this.expanded = expanded;
+this.violationCount = 0;
+}
+
+WebInspector.AuditRuleResult.linkifyDisplayName = function(url)
+{
+return WebInspector.linkifyURL(url, WebInspector.displayNameForURL(url));
+}
+
+WebInspector.AuditRuleResult.resourceDomain = function(domain)
+{
+return domain || WebInspector.UIString("[empty domain]");
 }
 
 WebInspector.AuditRuleResult.prototype = {
-    addChild: function(value, expanded, className)
-    {
-        if (!this.children)
-            this.children = [];
-        var entry = new WebInspector.AuditRuleResult(value, expanded, className);
-        this.children.push(entry);
-        return entry;
-    },
+addChild: function(value, expanded, className)
+{
+if (!this.children)
+this.children = [];
+var entry = new WebInspector.AuditRuleResult(value, expanded, className);
+this.children.push(entry);
+return entry;
+},
 
-    addURL: function(url)
-    {
-        return this.addChild(WebInspector.linkifyURL(url));
-    },
+addURL: function(url)
+{
+return this.addChild(WebInspector.AuditRuleResult.linkifyDisplayName(url));
+},
 
-    addURLs: function(urls)
-    {
-        for (var i = 0; i < urls.length; ++i)
-            this.addURL(urls[i]);
-    },
+addURLs: function(urls)
+{
+for (var i = 0; i < urls.length; ++i)
+this.addURL(urls[i]);
+},
 
-    addSnippet: function(snippet)
-    {
-        return this.addChild(snippet, false, "source-code");
-    }
+addSnippet: function(snippet)
+{
+return this.addChild(snippet, false, "source-code");
+}
 }
 
 WebInspector.AuditsSidebarTreeElement = function()
 {
-    this.small = false;
+this.small = false;
 
-    WebInspector.SidebarTreeElement.call(this, "audits-sidebar-tree-item", WebInspector.UIString("Audits"), "", null, false);
+WebInspector.SidebarTreeElement.call(this, "audits-sidebar-tree-item", WebInspector.UIString("Audits"), "", null, false);
 }
 
 WebInspector.AuditsSidebarTreeElement.prototype = {
-    onattach: function()
-    {
-        WebInspector.SidebarTreeElement.prototype.onattach.call(this);
-    },
+onattach: function()
+{
+WebInspector.SidebarTreeElement.prototype.onattach.call(this);
+},
 
-    onselect: function()
-    {
-        WebInspector.panels.audits.showLauncherView();
-    },
+onselect: function()
+{
+WebInspector.panels.audits.showLauncherView();
+},
 
-    get selectable()
-    {
-        return true;
-    },
+get selectable()
+{
+return true;
+},
 
-    refresh: function()
-    {
-        this.refreshTitles();
-    }
+refresh: function()
+{
+this.refreshTitles();
+}
 }
 
 WebInspector.AuditsSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
@@ -22157,71 +27082,47 @@
 
 WebInspector.AuditResultSidebarTreeElement = function(results, mainResourceURL, ordinal)
 {
-    this.results = results;
-    this.mainResourceURL = mainResourceURL;
+this.results = results;
+this.mainResourceURL = mainResourceURL;
 
-    WebInspector.SidebarTreeElement.call(this, "audit-result-sidebar-tree-item", String.sprintf("%s (%d)", mainResourceURL, ordinal), "", {}, false);
+WebInspector.SidebarTreeElement.call(this, "audit-result-sidebar-tree-item", String.sprintf("%s (%d)", mainResourceURL, ordinal), "", {}, false);
 }
 
 WebInspector.AuditResultSidebarTreeElement.prototype = {
-    onselect: function()
-    {
-        WebInspector.panels.audits.showResults(this.results);
-    },
+onselect: function()
+{
+WebInspector.panels.audits.showResults(this.results);
+},
 
-    get selectable()
-    {
-        return true;
-    }
+get selectable()
+{
+return true;
+}
 }
 
 WebInspector.AuditResultSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
 
-// Contributed audit rules should go into this namespace.
+
 WebInspector.AuditRules = {};
 
-// Contributed audit categories should go into this namespace.
+
 WebInspector.AuditCategories = {};
 
-/* AuditResultView.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.AuditResultView = function(categoryResults)
 {
-    WebInspector.View.call(this);
-    this.element.className = "audit-result-view";
+WebInspector.View.call(this);
+this.element.className = "audit-result-view";
 
-    for (var i = 0; i < categoryResults.length; ++i)
-        this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element);
+function categorySorter(a, b) {
+return (a.title || "").localeCompare(b.title || "");
+}
+categoryResults.sort(categorySorter);
+for (var i = 0; i < categoryResults.length; ++i)
+this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element);
 }
 
 WebInspector.AuditResultView.prototype.__proto__ = WebInspector.View.prototype;
@@ -22229,397 +27130,430 @@
 
 WebInspector.AuditCategoryResultPane = function(categoryResult)
 {
-    WebInspector.SidebarPane.call(this, categoryResult.title);
-    var treeOutlineElement = document.createElement("ol");
-    this.bodyElement.addStyleClass("audit-result-tree");
-    this.bodyElement.appendChild(treeOutlineElement);
+WebInspector.SidebarPane.call(this, categoryResult.title);
+var treeOutlineElement = document.createElement("ol");
+this.bodyElement.addStyleClass("audit-result-tree");
+this.bodyElement.appendChild(treeOutlineElement);
 
-    this._treeOutline = new TreeOutline(treeOutlineElement);
-    this._treeOutline.expandTreeElementsWhenArrowing = true;
-    for (var i = 0; i < categoryResult.ruleResults.length; ++i) {
-        var ruleResult = categoryResult.ruleResults[i];
-        var treeElement = this._appendResult(this._treeOutline, ruleResult);
-        treeElement.listItemElement.addStyleClass("audit-result");
+this._treeOutline = new TreeOutline(treeOutlineElement);
+this._treeOutline.expandTreeElementsWhenArrowing = true;
 
-        if (ruleResult.severity) {
-            var severityElement = document.createElement("img");
-            severityElement.className = "severity-" + ruleResult.severity;
-            treeElement.listItemElement.appendChild(severityElement);
-        }
-    }
-    this.expand();
+function ruleSorter(a, b)
+{
+var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - WebInspector.AuditRule.SeverityOrder[b.severity || 0];
+if (!result)
+result = (a.value || "").localeCompare(b.value || "");
+return result;
+}
+
+categoryResult.ruleResults.sort(ruleSorter);
+
+for (var i = 0; i < categoryResult.ruleResults.length; ++i) {
+var ruleResult = categoryResult.ruleResults[i];
+var treeElement = this._appendResult(this._treeOutline, ruleResult);
+treeElement.listItemElement.addStyleClass("audit-result");
+
+if (ruleResult.severity) {
+var severityElement = document.createElement("img");
+severityElement.className = "severity-" + ruleResult.severity;
+treeElement.listItemElement.appendChild(severityElement);
+}
+}
+this.expand();
 }
 
 WebInspector.AuditCategoryResultPane.prototype = {
-    _appendResult: function(parentTreeElement, result)
-    {
-        var title = result.value;
-        if (result.violationCount)
-            title = String.sprintf("%s (%d)", title, result.violationCount);
+_appendResult: function(parentTreeElement, result)
+{
+var title = "";
 
-        var treeElement = new TreeElement(title, null, !!result.children);
-        parentTreeElement.appendChild(treeElement);
+if (typeof result.value === "string") {
+title = result.value;
+if (result.violationCount)
+title = String.sprintf("%s (%d)", title, result.violationCount);
+}
 
-        if (result.className)
-            treeElement.listItemElement.addStyleClass(result.className);
-        if (result.children) {
-            for (var i = 0; i < result.children.length; ++i)
-                this._appendResult(treeElement, result.children[i]);
-        }
-        if (result.expanded) {
-            treeElement.listItemElement.removeStyleClass("parent");
-            treeElement.listItemElement.addStyleClass("parent-expanded");
-            treeElement.expand();
-        }
-        return treeElement;
-    }
+var treeElement = new TreeElement(null, null, !!result.children);
+treeElement.titleHTML = title;
+parentTreeElement.appendChild(treeElement);
+
+if (result.className)
+treeElement.listItemElement.addStyleClass(result.className);
+if (typeof result.value !== "string")
+treeElement.listItemElement.appendChild(WebInspector.applyFormatters(result.value));
+
+if (result.children) {
+for (var i = 0; i < result.children.length; ++i)
+this._appendResult(treeElement, result.children[i]);
+}
+if (result.expanded) {
+treeElement.listItemElement.removeStyleClass("parent");
+treeElement.listItemElement.addStyleClass("parent-expanded");
+treeElement.expand();
+}
+return treeElement;
+}
 }
 
 WebInspector.AuditCategoryResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
 
-/* AuditLauncherView.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.AuditLauncherView = function(categoriesById, runnerCallback)
+
+
+WebInspector.AuditLauncherView = function(runnerCallback)
 {
-    WebInspector.View.call(this);
-    this._categoriesById = categoriesById;
-    this._runnerCallback = runnerCallback;
-    this._categoryIdPrefix = "audit-category-item-";
-    this._auditRunning = false;
+WebInspector.View.call(this);
+this._runnerCallback = runnerCallback;
+this._categoryIdPrefix = "audit-category-item-";
+this._auditRunning = false;
 
-    this.element.addStyleClass("audit-launcher-view");
+this.element.addStyleClass("audit-launcher-view");
 
-    this._contentElement = document.createElement("div");
-    this._contentElement.className = "audit-launcher-view-content";
-    this.element.appendChild(this._contentElement);
+this._contentElement = document.createElement("div");
+this._contentElement.className = "audit-launcher-view-content";
+this.element.appendChild(this._contentElement);
+this._boundCategoryClickListener = this._categoryClicked.bind(this);
 
-    function categorySortFunction(a, b)
-    {
-        var aTitle = a.displayName || "";
-        var bTitle = b.displayName || "";
-        return aTitle.localeCompare(bTitle);
-    }
-    var sortedCategories = [];
-    for (var id in this._categoriesById)
-        sortedCategories.push(this._categoriesById[id]);
-    sortedCategories.sort(categorySortFunction);
+this._resetResourceCount();
 
-    if (!sortedCategories.length) {
-        this._headerElement = document.createElement("h1");
-        this._headerElement.className = "no-audits";
-        this._headerElement.textContent = WebInspector.UIString("No audits to run");
-        this._contentElement.appendChild(this._headerElement);
-    } else
-        this._createLauncherUI(sortedCategories);
+this._sortedCategories = [];
+
+this._headerElement = document.createElement("h1");
+this._headerElement.className = "no-audits";
+this._headerElement.textContent = WebInspector.UIString("No audits to run");
+this._contentElement.appendChild(this._headerElement);
 }
 
 WebInspector.AuditLauncherView.prototype = {
-    updateResourceTrackingState: function(isTracking)
-    {
-        if (!this._auditPresentStateLabelElement)
-            return;
-        if (isTracking) {
-            this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State");
-            this._auditPresentStateElement.disabled = false;
-            this._auditPresentStateElement.parentElement.removeStyleClass("disabled");
-        } else {
-            this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State (Resource Tracking must be enabled)");
-            this._auditPresentStateElement.disabled = true;
-            this._auditPresentStateElement.parentElement.addStyleClass("disabled");
-            this.auditReloadedStateElement.checked = true;
-        }
-    },
+updateResourceTrackingState: function(isTracking)
+{
+if (!this._auditPresentStateLabelElement)
+return;
 
-    _setAuditRunning: function(auditRunning)
-    {
-        if (this._auditRunning === auditRunning)
-            return;
-        this._auditRunning = auditRunning;
-        this._updateButton();
-    },
+if (isTracking) {
+this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State");
+this._auditPresentStateElement.disabled = false;
+this._auditPresentStateElement.parentElement.removeStyleClass("disabled");
+} else {
+this._resetResourceCount();
+this._auditPresentStateLabelElement.nodeValue = WebInspector.UIString("Audit Present State (Resource Tracking must be enabled)");
+this._auditPresentStateElement.disabled = true;
+this._auditPresentStateElement.parentElement.addStyleClass("disabled");
+this.auditReloadedStateElement.checked = true;
+}
+},
 
-    _launchButtonClicked: function(event)
-    {
-        var catIds = [];
-        var childNodes = this._categoriesElement.childNodes;
-        for (var id in this._categoriesById) {
-            if (this._categoriesById[id]._checkboxElement.checked)
-                catIds.push(id);
-        }
-        function profilingFinishedCallback()
-        {
-            this._setAuditRunning(false);
-        }
-        this._setAuditRunning(true);
-        this._runnerCallback(catIds, this._auditPresentStateElement.checked, profilingFinishedCallback.bind(this));
-    },
+get totalResources()
+{
+return this._totalResources;
+},
 
-    _selectAllClicked: function(checkCategories)
-    {
-        var childNodes = this._categoriesElement.childNodes;
-        for (var i = 0, length = childNodes.length; i < length; ++i)
-            childNodes[i].firstChild.checked = checkCategories;
-        this._currentCategoriesCount = checkCategories ? this._totalCategoriesCount : 0;
-        this._updateButton();
-    },
+set totalResources(x)
+{
+if (this._totalResources === x)
+return;
+this._totalResources = x;
+this._updateResourceProgress();
+},
 
-    _categoryClicked: function(event)
-    {
-        this._currentCategoriesCount += event.target.checked ? 1 : -1;
-        this._selectAllCheckboxElement.checked = this._currentCategoriesCount === this._totalCategoriesCount;
-        this._updateButton();
-    },
+get loadedResources()
+{
+return this._loadedResources;
+},
 
-    _createCategoryElement: function(title, id)
-    {
-        var element;
-        var labelElement = document.createElement("label");
-        labelElement.id = this._categoryIdPrefix + id;
+set loadedResources(x)
+{
+if (this._loadedResources === x)
+return;
+this._loadedResources = x;
+this._updateResourceProgress();
+},
 
-        element = document.createElement("input");
-        element.type = "checkbox";
-        labelElement.appendChild(element);
-        labelElement.appendChild(document.createTextNode(title));
+_resetResourceCount: function()
+{
+this.loadedResources = 0;
 
-        return labelElement;
-    },
 
-    _createLauncherUI: function(sortedCategories)
-    {
-        this._headerElement = document.createElement("h1");
-        this._headerElement.textContent = WebInspector.UIString("Select audits to run");
-        this._contentElement.appendChild(this._headerElement);
 
-        function handleSelectAllClick(event)
-        {
-            this._selectAllClicked(event.target.checked);
-        }
-        var categoryElement = this._createCategoryElement(WebInspector.UIString("Select All"), "");
-        categoryElement.id = "audit-launcher-selectall";
-        this._selectAllCheckboxElement = categoryElement.firstChild;
-        this._selectAllCheckboxElement.checked = true;
-        this._selectAllCheckboxElement.addEventListener("click", handleSelectAllClick.bind(this), false);
-        this._contentElement.appendChild(categoryElement);
+this.totalResources = 1;
+},
 
-        this._categoriesElement = document.createElement("div");
-        this._categoriesElement.className = "audit-categories-container";
-        this._contentElement.appendChild(this._categoriesElement);
+resourceStarted: function(resource)
+{
+++this.totalResources;
+},
 
-        var boundCategoryClickListener = this._categoryClicked.bind(this);
+resourceFinished: function(resource)
+{
+++this.loadedResources;
+},
 
-        for (var i = 0; i < sortedCategories.length; ++i) {
-            categoryElement = this._createCategoryElement(sortedCategories[i].displayName, sortedCategories[i].id);
-            categoryElement.firstChild.addEventListener("click", boundCategoryClickListener, false);
-            sortedCategories[i]._checkboxElement = categoryElement.firstChild;
-            this._categoriesElement.appendChild(categoryElement);
-        }
+reset: function()
+{
+this._resetResourceCount();
+},
 
-        this._totalCategoriesCount = this._categoriesElement.childNodes.length;
-        this._currentCategoriesCount = 0;
+addCategory: function(category)
+{
+if (!this._sortedCategories.length)
+this._createLauncherUI();
 
-        this._buttonContainerElement = document.createElement("div");
-        this._buttonContainerElement.className = "button-container";
+var categoryElement = this._createCategoryElement(category.displayName, category.id);
+category._checkboxElement = categoryElement.firstChild;
+if (this._selectAllCheckboxElement.checked) {
+category._checkboxElement.checked = true;
+++this._currentCategoriesCount;
+}
 
-        var labelElement = document.createElement("label");
-        this._auditPresentStateElement = document.createElement("input");
-        this._auditPresentStateElement.name = "audit-mode";
-        this._auditPresentStateElement.type = "radio";
-        this._auditPresentStateElement.checked = true;
-        this._auditPresentStateLabelElement = document.createTextNode("");
-        labelElement.appendChild(this._auditPresentStateElement);
-        labelElement.appendChild(this._auditPresentStateLabelElement);
-        this._buttonContainerElement.appendChild(labelElement);
+function compareCategories(a, b)
+{
+var aTitle = a.displayName || "";
+var bTitle = b.displayName || "";
+return aTitle.localeCompare(bTitle);
+}
+var insertBefore = insertionIndexForObjectInListSortedByFunction(category, this._sortedCategories, compareCategories);
+this._categoriesElement.insertBefore(categoryElement, this._categoriesElement.children[insertBefore]);
+this._sortedCategories.splice(insertBefore, 0, category);
+this._updateButton();
+},
 
-        labelElement = document.createElement("label");
-        this.auditReloadedStateElement = document.createElement("input");
-        this.auditReloadedStateElement.name = "audit-mode";
-        this.auditReloadedStateElement.type = "radio";
-        labelElement.appendChild(this.auditReloadedStateElement);
-        labelElement.appendChild(document.createTextNode("Reload Page and Audit on Load"));
-        this._buttonContainerElement.appendChild(labelElement);
+_setAuditRunning: function(auditRunning)
+{
+if (this._auditRunning === auditRunning)
+return;
+this._auditRunning = auditRunning;
+this._updateButton();
+this._updateResourceProgress();
+},
 
-        this._launchButton = document.createElement("button");
-        this._launchButton.setAttribute("type", "button");
-        this._launchButton.addEventListener("click", this._launchButtonClicked.bind(this), false);
-        this._buttonContainerElement.appendChild(this._launchButton);
+_launchButtonClicked: function(event)
+{
+var catIds = [];
+var childNodes = this._categoriesElement.childNodes;
+for (var category = 0; category < this._sortedCategories.length; ++category) {
+if (this._sortedCategories[category]._checkboxElement.checked)
+catIds.push(this._sortedCategories[category].id);
+}
 
-        this._contentElement.appendChild(this._buttonContainerElement);
+this._setAuditRunning(true);
+this._runnerCallback(catIds, this._auditPresentStateElement.checked, this._setAuditRunning.bind(this, false));
+},
 
-        this._selectAllClicked(this._selectAllCheckboxElement.checked);
-        this.updateResourceTrackingState();
-        this._updateButton();
-    },
+_selectAllClicked: function(checkCategories)
+{
+var childNodes = this._categoriesElement.childNodes;
+for (var i = 0, length = childNodes.length; i < length; ++i)
+childNodes[i].firstChild.checked = checkCategories;
+this._currentCategoriesCount = checkCategories ? this._sortedCategories.length : 0;
+this._updateButton();
+},
 
-    _updateButton: function()
-    {
-        this._launchButton.disabled = !this._currentCategoriesCount || this._auditRunning;
-        if (this._auditRunning)
-            this._launchButton.textContent = WebInspector.UIString("Running...");
-        else
-            this._launchButton.textContent = WebInspector.UIString("Run");
-    },
+_categoryClicked: function(event)
+{
+this._currentCategoriesCount += event.target.checked ? 1 : -1;
+this._selectAllCheckboxElement.checked = this._currentCategoriesCount === this._sortedCategories.length;
+this._updateButton();
+},
 
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        setTimeout(this.resize(), 0);
-    },
+_createCategoryElement: function(title, id)
+{
+var labelElement = document.createElement("label");
+labelElement.id = this._categoryIdPrefix + id;
 
-    resize: function()
-    {
-        if (this._categoriesElement)
-            this._categoriesElement.style.height = (this._buttonContainerElement.totalOffsetTop - this._categoriesElement.totalOffsetTop) + "px";
-    }
+var element = document.createElement("input");
+element.type = "checkbox";
+if (id !== "")
+element.addEventListener("click", this._boundCategoryClickListener, false);
+labelElement.appendChild(element);
+labelElement.appendChild(document.createTextNode(title));
+
+return labelElement;
+},
+
+_createLauncherUI: function()
+{
+this._headerElement = document.createElement("h1");
+this._headerElement.textContent = WebInspector.UIString("Select audits to run");
+
+for (var child = 0; child < this._contentElement.children.length; ++child)
+this._contentElement.removeChild(this._contentElement.children[child]);
+
+this._contentElement.appendChild(this._headerElement);
+
+function handleSelectAllClick(event)
+{
+this._selectAllClicked(event.target.checked);
+}
+var categoryElement = this._createCategoryElement(WebInspector.UIString("Select All"), "");
+categoryElement.id = "audit-launcher-selectall";
+this._selectAllCheckboxElement = categoryElement.firstChild;
+this._selectAllCheckboxElement.checked = true;
+this._selectAllCheckboxElement.addEventListener("click", handleSelectAllClick.bind(this), false);
+this._contentElement.appendChild(categoryElement);
+
+this._categoriesElement = document.createElement("div");
+this._categoriesElement.className = "audit-categories-container";
+this._contentElement.appendChild(this._categoriesElement);
+
+this._currentCategoriesCount = 0;
+
+var flexibleSpaceElement = document.createElement("div");
+flexibleSpaceElement.className = "flexible-space";
+this._contentElement.appendChild(flexibleSpaceElement);
+
+this._buttonContainerElement = document.createElement("div");
+this._buttonContainerElement.className = "button-container";
+
+var labelElement = document.createElement("label");
+this._auditPresentStateElement = document.createElement("input");
+this._auditPresentStateElement.name = "audit-mode";
+this._auditPresentStateElement.type = "radio";
+this._auditPresentStateElement.checked = true;
+this._auditPresentStateLabelElement = document.createTextNode("");
+labelElement.appendChild(this._auditPresentStateElement);
+labelElement.appendChild(this._auditPresentStateLabelElement);
+this._buttonContainerElement.appendChild(labelElement);
+
+labelElement = document.createElement("label");
+this.auditReloadedStateElement = document.createElement("input");
+this.auditReloadedStateElement.name = "audit-mode";
+this.auditReloadedStateElement.type = "radio";
+labelElement.appendChild(this.auditReloadedStateElement);
+labelElement.appendChild(document.createTextNode("Reload Page and Audit on Load"));
+this._buttonContainerElement.appendChild(labelElement);
+
+this._launchButton = document.createElement("button");
+this._launchButton.type = "button";
+this._launchButton.textContent = WebInspector.UIString("Run");
+this._launchButton.addEventListener("click", this._launchButtonClicked.bind(this), false);
+this._buttonContainerElement.appendChild(this._launchButton);
+
+this._resourceProgressContainer = document.createElement("span");
+this._resourceProgressContainer.className = "resource-progress";
+var resourceProgressImage = document.createElement("img");
+this._resourceProgressContainer.appendChild(resourceProgressImage);
+this._resourceProgressTextElement = document.createElement("span");
+this._resourceProgressContainer.appendChild(this._resourceProgressTextElement);
+this._buttonContainerElement.appendChild(this._resourceProgressContainer);
+
+this._contentElement.appendChild(this._buttonContainerElement);
+
+this._selectAllClicked(this._selectAllCheckboxElement.checked);
+this.updateResourceTrackingState();
+this._updateButton();
+this._updateResourceProgress();
+},
+
+_updateResourceProgress: function()
+{
+if (!this._resourceProgressContainer)
+return;
+
+if (!this._auditRunning) {
+this._resetResourceCount();
+this._resourceProgressContainer.addStyleClass("hidden");
+} else
+this._resourceProgressContainer.removeStyleClass("hidden");
+this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources);
+},
+
+_updateButton: function()
+{
+this._launchButton.disabled = !this._currentCategoriesCount || this._auditRunning;
+}
 }
 
 WebInspector.AuditLauncherView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* AuditRules.js */
 
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.AuditRules.IPAddressRegexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
 
 WebInspector.AuditRules.CacheableResponseCodes =
 {
-    200: true,
-    203: true,
-    206: true,
-    300: true,
-    301: true,
-    410: true,
+200: true,
+203: true,
+206: true,
+300: true,
+301: true,
+410: true,
 
-    304: true // Underlying resource is cacheable
+304: true 
 }
 
-WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, regexp, needFullResources)
+WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, needFullResources)
 {
-    var domainToResourcesMap = {};
-    for (var i = 0, size = resources.length; i < size; ++i) {
-        var resource = resources[i];
-        if (types && types.indexOf(resource.type) === -1)
-            continue;
-        var match = resource.url.match(regexp);
-        if (!match)
-            continue;
-        var domain = match[2];
-        var domainResources = domainToResourcesMap[domain];
-        if (domainResources === undefined) {
-          domainResources = [];
-          domainToResourcesMap[domain] = domainResources;
-        }
-        domainResources.push(needFullResources ? resource : resource.url);
-    }
-    return domainToResourcesMap;
+var domainToResourcesMap = {};
+for (var i = 0, size = resources.length; i < size; ++i) {
+var resource = resources[i];
+if (types && types.indexOf(resource.type) === -1)
+continue;
+var parsedURL = resource.url.asParsedURL();
+if (!parsedURL)
+continue;
+var domain = parsedURL.host;
+var domainResources = domainToResourcesMap[domain];
+if (domainResources === undefined) {
+domainResources = [];
+domainToResourcesMap[domain] = domainResources;
+}
+domainResources.push(needFullResources ? resource : resource.url);
+}
+return domainToResourcesMap;
 }
 
-WebInspector.AuditRules.evaluateInTargetWindow = function(func, callback)
+WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback)
 {
-    InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), callback);
+InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), args, callback);
 }
 
 
 WebInspector.AuditRules.GzipRule = function()
 {
-    WebInspector.AuditRule.call(this, "network-gzip", "Enable gzip compression");
+WebInspector.AuditRule.call(this, "network-gzip", "Enable gzip compression");
 }
 
 WebInspector.AuditRules.GzipRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        var totalSavings = 0;
-        var compressedSize = 0;
-        var candidateSize = 0;
-        var summary = result.addChild("", true);
-        for (var i = 0, length = resources.length; i < length; ++i) {
-            var resource = resources[i];
-            if (this._shouldCompress(resource)) {
-                var size = resource.resourceSize;
-                candidateSize += size;
-                if (this._isCompressed(resource)) {
-                    compressedSize += size;
-                    continue;
-                }
-                var savings = 2 * size / 3;
-                totalSavings += savings;
-                summary.addChild(String.sprintf("%s could save ~%s", WebInspector.linkifyURL(resource.url), Number.bytesToString(savings)));
-                result.violationCount++;
-            }
-        }
-        if (!totalSavings)
-            return callback(null);
-        summary.value = String.sprintf("Compressing the following resources with gzip could reduce their transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings));
-        callback(result);
-    },
+doRun: function(resources, result, callback)
+{
+var totalSavings = 0;
+var compressedSize = 0;
+var candidateSize = 0;
+var summary = result.addChild("", true);
+for (var i = 0, length = resources.length; i < length; ++i) {
+var resource = resources[i];
+if (this._shouldCompress(resource)) {
+var size = resource.resourceSize;
+candidateSize += size;
+if (this._isCompressed(resource)) {
+compressedSize += size;
+continue;
+}
+var savings = 2 * size / 3;
+totalSavings += savings;
+summary.addChild(String.sprintf("%s could save ~%s", WebInspector.AuditRuleResult.linkifyDisplayName(resource.url), Number.bytesToString(savings, WebInspector.UIString)));
+result.violationCount++;
+}
+}
+if (!totalSavings)
+return callback(null);
+summary.value = String.sprintf("Compressing the following resources with gzip could reduce their transfer size by about two thirds (~%s):", Number.bytesToString(totalSavings, WebInspector.UIString));
+callback(result);
+},
 
-    _isCompressed: function(resource)
-    {
-        var encoding = resource.responseHeaders["Content-Encoding"];
-        return encoding === "gzip" || encoding === "deflate";
-    },
+_isCompressed: function(resource)
+{
+var encoding = resource.responseHeaders["Content-Encoding"];
+return encoding === "gzip" || encoding === "deflate";
+},
 
-    _shouldCompress: function(resource)
-    {
-        return WebInspector.Resource.Type.isTextType(resource.type) && resource.domain && resource.resourceSize !== undefined && resource.resourceSize > 150;
-    }
+_shouldCompress: function(resource)
+{
+return WebInspector.Resource.Type.isTextType(resource.type) && resource.domain && resource.resourceSize !== undefined && resource.resourceSize > 150;
+}
 }
 
 WebInspector.AuditRules.GzipRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -22627,80 +27561,80 @@
 
 WebInspector.AuditRules.CombineExternalResourcesRule = function(id, name, type, resourceTypeName, allowedPerDomain)
 {
-    WebInspector.AuditRule.call(this, id, name);
-    this._type = type;
-    this._resourceTypeName = resourceTypeName;
-    this._allowedPerDomain = allowedPerDomain;
+WebInspector.AuditRule.call(this, id, name);
+this._type = type;
+this._resourceTypeName = resourceTypeName;
+this._allowedPerDomain = allowedPerDomain;
 }
 
 WebInspector.AuditRules.CombineExternalResourcesRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, [this._type], WebInspector.URLRegExp);
-        var penalizedResourceCount = 0;
-        // TODO: refactor according to the chosen i18n approach
-        var summary = result.addChild("", true);
-        for (var domain in domainToResourcesMap) {
-            var domainResources = domainToResourcesMap[domain];
-            var extraResourceCount = domainResources.length - this._allowedPerDomain;
-            if (extraResourceCount <= 0)
-                continue;
-            penalizedResourceCount += extraResourceCount - 1;
-            summary.addChild(String.sprintf("%d %s resources served from %s.", domainResources.length, this._resourceTypeName, domain));
-            result.violationCount += domainResources.length;
-        }
-        if (!penalizedResourceCount)
-            return callback(null);
+doRun: function(resources, result, callback)
+{
+var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, [this._type]);
+var penalizedResourceCount = 0;
 
-        summary.value = "There are multiple resources served from same domain. Consider combining them into as few files as possible.";
-        callback(result);
-    }
+var summary = result.addChild("", true);
+for (var domain in domainToResourcesMap) {
+var domainResources = domainToResourcesMap[domain];
+var extraResourceCount = domainResources.length - this._allowedPerDomain;
+if (extraResourceCount <= 0)
+continue;
+penalizedResourceCount += extraResourceCount - 1;
+summary.addChild(String.sprintf("%d %s resources served from %s.", domainResources.length, this._resourceTypeName, WebInspector.AuditRuleResult.resourceDomain(domain)));
+result.violationCount += domainResources.length;
+}
+if (!penalizedResourceCount)
+return callback(null);
+
+summary.value = "There are multiple resources served from same domain. Consider combining them into as few files as possible.";
+callback(result);
+}
 }
 
 WebInspector.AuditRules.CombineExternalResourcesRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
 WebInspector.AuditRules.CombineJsResourcesRule = function(allowedPerDomain) {
-    WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.Resource.Type.Script, "JavaScript", allowedPerDomain);
+WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externaljs", "Combine external JavaScript", WebInspector.Resource.Type.Script, "JavaScript", allowedPerDomain);
 }
 
 WebInspector.AuditRules.CombineJsResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype;
 
 
 WebInspector.AuditRules.CombineCssResourcesRule = function(allowedPerDomain) {
-    WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.Resource.Type.Stylesheet, "CSS", allowedPerDomain);
+WebInspector.AuditRules.CombineExternalResourcesRule.call(this, "page-externalcss", "Combine external CSS", WebInspector.Resource.Type.Stylesheet, "CSS", allowedPerDomain);
 }
 
 WebInspector.AuditRules.CombineCssResourcesRule.prototype.__proto__ = WebInspector.AuditRules.CombineExternalResourcesRule.prototype;
 
 
 WebInspector.AuditRules.MinimizeDnsLookupsRule = function(hostCountThreshold) {
-    WebInspector.AuditRule.call(this, "network-minimizelookups", "Minimize DNS lookups");
-    this._hostCountThreshold = hostCountThreshold;
+WebInspector.AuditRule.call(this, "network-minimizelookups", "Minimize DNS lookups");
+this._hostCountThreshold = hostCountThreshold;
 }
 
 WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        var summary = result.addChild("");
-        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, undefined, WebInspector.URLRegExp);
-        for (var domain in domainToResourcesMap) {
-            if (domainToResourcesMap[domain].length > 1)
-                continue;
-            var match = domain.match(WebInspector.URLRegExp);
-            if (!match)
-                continue;
-            if (!match[2].search(WebInspector.AuditRules.IPAddressRegexp))
-                continue; // an IP address
-            summary.addSnippet(match[2]);
-            result.violationCount++;
-        }
-        if (!summary.children || summary.children.length <= this._hostCountThreshold)
-            return callback(null);
+doRun: function(resources, result, callback)
+{
+var summary = result.addChild("");
+var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources, undefined);
+for (var domain in domainToResourcesMap) {
+if (domainToResourcesMap[domain].length > 1)
+continue;
+var parsedURL = domain.asParsedURL();
+if (!parsedURL)
+continue;
+if (!parsedURL.host.search(WebInspector.AuditRules.IPAddressRegexp))
+continue; 
+summary.addSnippet(match[2]);
+result.violationCount++;
+}
+if (!summary.children || summary.children.length <= this._hostCountThreshold)
+return callback(null);
 
-        summary.value = "The following domains only serve one resource each. If possible, avoid the extra DNS lookups by serving these resources from existing domains.";
-        callback(result);
-    }
+summary.value = "The following domains only serve one resource each. If possible, avoid the extra DNS lookups by serving these resources from existing domains.";
+callback(result);
+}
 }
 
 WebInspector.AuditRules.MinimizeDnsLookupsRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -22708,155 +27642,191 @@
 
 WebInspector.AuditRules.ParallelizeDownloadRule = function(optimalHostnameCount, minRequestThreshold, minBalanceThreshold)
 {
-    WebInspector.AuditRule.call(this, "network-parallelizehosts", "Parallelize downloads across hostnames");
-    this._optimalHostnameCount = optimalHostnameCount;
-    this._minRequestThreshold = minRequestThreshold;
-    this._minBalanceThreshold = minBalanceThreshold;
+WebInspector.AuditRule.call(this, "network-parallelizehosts", "Parallelize downloads across hostnames");
+this._optimalHostnameCount = optimalHostnameCount;
+this._minRequestThreshold = minRequestThreshold;
+this._minBalanceThreshold = minBalanceThreshold;
 }
 
 
 WebInspector.AuditRules.ParallelizeDownloadRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        function hostSorter(a, b)
-        {
-            var aCount = domainToResourcesMap[a].length;
-            var bCount = domainToResourcesMap[b].length;
-            return (aCount < bCount) ? 1 : (aCount == bCount) ? 0 : -1;
-        }
+doRun: function(resources, result, callback)
+{
+function hostSorter(a, b)
+{
+var aCount = domainToResourcesMap[a].length;
+var bCount = domainToResourcesMap[b].length;
+return (aCount < bCount) ? 1 : (aCount == bCount) ? 0 : -1;
+}
 
-        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(
-            resources,
-            [WebInspector.Resource.Type.Stylesheet, WebInspector.Resource.Type.Image],
-            WebInspector.URLRegExp,
-            true);
+var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(
+resources,
+[WebInspector.Resource.Type.Stylesheet, WebInspector.Resource.Type.Image],
+true);
 
-        var hosts = [];
-        for (var url in domainToResourcesMap)
-            hosts.push(url);
+var hosts = [];
+for (var url in domainToResourcesMap)
+hosts.push(url);
 
-        if (!hosts.length)
-            return callback(null); // no hosts (local file or something)
+if (!hosts.length)
+return callback(null); 
 
-        hosts.sort(hostSorter);
+hosts.sort(hostSorter);
 
-        var optimalHostnameCount = this._optimalHostnameCount;
-        if (hosts.length > optimalHostnameCount)
-            hosts.splice(optimalHostnameCount);
+var optimalHostnameCount = this._optimalHostnameCount;
+if (hosts.length > optimalHostnameCount)
+hosts.splice(optimalHostnameCount);
 
-        var busiestHostResourceCount = domainToResourcesMap[hosts[0]].length;
-        var resourceCountAboveThreshold = busiestHostResourceCount - this._minRequestThreshold;
-        if (resourceCountAboveThreshold <= 0)
-            return callback(null);
+var busiestHostResourceCount = domainToResourcesMap[hosts[0]].length;
+var resourceCountAboveThreshold = busiestHostResourceCount - this._minRequestThreshold;
+if (resourceCountAboveThreshold <= 0)
+return callback(null);
 
-        var avgResourcesPerHost = 0;
-        for (var i = 0, size = hosts.length; i < size; ++i)
-            avgResourcesPerHost += domainToResourcesMap[hosts[i]].length;
+var avgResourcesPerHost = 0;
+for (var i = 0, size = hosts.length; i < size; ++i)
+avgResourcesPerHost += domainToResourcesMap[hosts[i]].length;
 
-        // Assume optimal parallelization.
-        avgResourcesPerHost /= optimalHostnameCount;
-        avgResourcesPerHost = Math.max(avgResourcesPerHost, 1);
 
-        var pctAboveAvg = (resourceCountAboveThreshold / avgResourcesPerHost) - 1.0;
-        var minBalanceThreshold = this._minBalanceThreshold;
-        if (pctAboveAvg < minBalanceThreshold)
-            return callback(null);
+avgResourcesPerHost /= optimalHostnameCount;
+avgResourcesPerHost = Math.max(avgResourcesPerHost, 1);
 
-        var resourcesOnBusiestHost = domainToResourcesMap[hosts[0]];
-        var entry = result.addChild(String.sprintf("This page makes %d parallelizable requests to %s. Increase download parallelization by distributing the following requests across multiple hostnames.", busiestHostResourceCount, hosts[0]), true);
-        for (var i = 0; i < resourcesOnBusiestHost.length; ++i)
-            entry.addURL(resourcesOnBusiestHost[i].url);
+var pctAboveAvg = (resourceCountAboveThreshold / avgResourcesPerHost) - 1.0;
+var minBalanceThreshold = this._minBalanceThreshold;
+if (pctAboveAvg < minBalanceThreshold)
+return callback(null);
 
-        result.violationCount = resourcesOnBusiestHost.length;
-        callback(result);
-    }
+var resourcesOnBusiestHost = domainToResourcesMap[hosts[0]];
+var entry = result.addChild(String.sprintf("This page makes %d parallelizable requests to %s. Increase download parallelization by distributing the following requests across multiple hostnames.", busiestHostResourceCount, hosts[0]), true);
+for (var i = 0; i < resourcesOnBusiestHost.length; ++i)
+entry.addURL(resourcesOnBusiestHost[i].url);
+
+result.violationCount = resourcesOnBusiestHost.length;
+callback(result);
+}
 }
 
 WebInspector.AuditRules.ParallelizeDownloadRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
 
 
-// The reported CSS rule size is incorrect (parsed != original in WebKit),
-// so use percentages instead, which gives a better approximation.
+
+
 WebInspector.AuditRules.UnusedCssRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-unusedcss", "Remove unused CSS rules");
+WebInspector.AuditRule.call(this, "page-unusedcss", "Remove unused CSS rules");
 }
 
 WebInspector.AuditRules.UnusedCssRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        var self = this;
-        function evalCallback(routineResult, isException) {
-            if (isException || !routineResult || !routineResult.styleSheets.length)
-                return callback(null);
+doRun: function(resources, result, callback)
+{
+var self = this;
 
-            var totalUnusedPercent = Math.round(100 * routineResult.unusedSize / routineResult.totalSize);
-            var summary = result.addChild(String.sprintf("%d%% of CSS (estimated) is not used by the current page.", totalUnusedPercent), true);
+function evalCallback(styleSheets) {
+if (!styleSheets.length)
+return callback(null);
 
-            for (var i = 0; i < routineResult.styleSheets.length; ++i) {
-                var stylesheet = routineResult.styleSheets[i];
+var pseudoSelectorRegexp = /:hover|:link|:active|:visited|:focus|:before|:after/;
+var selectors = [];
+var testedSelectors = {};
+for (var i = 0; i < styleSheets.length; ++i) {
+var styleSheet = styleSheets[i];
+for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
+var selectorText = styleSheet.rules[curRule].selectorText;
+if (selectorText.match(pseudoSelectorRegexp) || testedSelectors[selectorText])
+continue;
+selectors.push(selectorText);
+testedSelectors[selectorText] = 1;
+}
+}
 
-                var url = stylesheet.type === "href" ? WebInspector.linkifyURL(stylesheet.location) : String.sprintf("Inline block #%s", stylesheet.location);
-                var pctUnused = Math.round(100 * stylesheet.unusedSize / stylesheet.totalSize);
-                var entry = summary.addChild(String.sprintf("%s: %d%% (estimated) is not used by the current page.", url, pctUnused));
+function selectorsCallback(callback, styleSheets, testedSelectors, foundSelectors)
+{
+var inlineBlockOrdinal = 0;
+var totalStylesheetSize = 0;
+var totalUnusedStylesheetSize = 0;
+var summary;
 
-                for (var j = 0; j < stylesheet.unusedRules.length; ++j)
-                    entry.addSnippet(stylesheet.unusedRules[j]);
+for (var i = 0; i < styleSheets.length; ++i) {
+var styleSheet = styleSheets[i];
+var stylesheetSize = 0;
+var unusedStylesheetSize = 0;
+var unusedRules = [];
+for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
+var rule = styleSheet.rules[curRule];
 
-                result.violationCount += stylesheet.unusedRules.length;
-            }
+var textLength = (rule.selectorRange && rule.style.properties.endOffset) ? rule.style.properties.endOffset - rule.selectorRange.start + 1 : 0;
+if (!textLength && rule.style.cssText)
+textLength = rule.style.cssText.length + rule.selectorText.length;
+stylesheetSize += textLength;
+if (!testedSelectors[rule.selectorText] || foundSelectors[rule.selectorText])
+continue;
+unusedStylesheetSize += textLength;
+unusedRules.push(rule.selectorText);
+}
+totalStylesheetSize += stylesheetSize;
+totalUnusedStylesheetSize += unusedStylesheetSize;
 
-            callback(result);
-        }
+if (!unusedRules.length)
+continue;
 
-        function routine()
-        {
-            var styleSheets = document.styleSheets;
-            if (!styleSheets)
-                return false;
-            var routineResult = { styleSheets: [] };
-            var inlineBlockOrdinal = 0;
-            var totalStylesheetSize = 0;
-            var totalUnusedStylesheetSize = 0;
-            var pseudoSelectorRegexp = /:hover|:link|:active|:visited|:focus/;
-            for (var i = 0; i < styleSheets.length; ++i) {
-                var styleSheet = styleSheets[i];
-                if (!styleSheet.cssRules)
-                    continue;
-                var stylesheetSize = 0;
-                var unusedStylesheetSize = 0;
-                var unusedRules = [];
-                for (var curRule = 0; curRule < styleSheet.cssRules.length; ++curRule) {
-                    var rule = styleSheet.cssRules[curRule];
-                    var textLength = rule.cssText ? rule.cssText.length : 0;
-                    stylesheetSize += textLength;
-                    if (rule.type !== 1 || rule.selectorText.match(pseudoSelectorRegexp))
-                        continue;
-                    var nodes = document.querySelectorAll(rule.selectorText);
-                    if (nodes && nodes.length)
-                        continue;
-                    unusedStylesheetSize += textLength;
-                    unusedRules.push(rule.selectorText);
-                }
-                totalStylesheetSize += stylesheetSize;
-                totalUnusedStylesheetSize += unusedStylesheetSize;
+var resource = WebInspector.resourceManager.resourceForURL(styleSheet.sourceURL);
+var isInlineBlock = resource && resource.type == WebInspector.Resource.Type.Document;
+var url = !isInlineBlock ? WebInspector.AuditRuleResult.linkifyDisplayName(styleSheet.sourceURL) : String.sprintf("Inline block #%d", ++inlineBlockOrdinal);
+var pctUnused = Math.round(100 * unusedStylesheetSize / stylesheetSize);
+if (!summary)
+summary = result.addChild("", true);
+var entry = summary.addChild(String.sprintf("%s: %s (%d%%) is not used by the current page.", url, Number.bytesToString(unusedStylesheetSize), pctUnused));
 
-                if (unusedRules.length) {
-                    var entry = { type: styleSheet.href ? "href" : "inline",
-                                  totalSize: stylesheetSize,
-                                  unusedSize: unusedStylesheetSize,
-                                  location: styleSheet.href ? styleSheet.href : ++inlineBlockOrdinal,
-                                  unusedRules: unusedRules };
-                    routineResult.styleSheets.push(entry);
-                }
-            }
-            routineResult.totalSize = totalStylesheetSize;
-            routineResult.unusedSize = totalUnusedStylesheetSize;
-            return routineResult;
-        }
+for (var j = 0; j < unusedRules.length; ++j)
+entry.addSnippet(unusedRules[j]);
 
-        WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback);
-    }
+result.violationCount += unusedRules.length;
+}
+
+if (!totalUnusedStylesheetSize)
+return callback(null);
+
+var totalUnusedPercent = Math.round(100 * totalUnusedStylesheetSize / totalStylesheetSize);
+summary.value = String.sprintf("%s (%d%%) of CSS is not used by the current page.", Number.bytesToString(totalUnusedStylesheetSize), totalUnusedPercent);
+
+callback(result);
+}
+
+function routine(selectorArray)
+{
+var result = {};
+for (var i = 0; i < selectorArray.length; ++i) {
+try {
+if (document.querySelector(selectorArray[i]))
+result[selectorArray[i]] = true;
+} catch(e) {
+
+}
+}
+return result;
+}
+
+WebInspector.AuditRules.evaluateInTargetWindow(routine, [selectors], selectorsCallback.bind(null, callback, styleSheets, testedSelectors));
+}
+
+function styleSheetCallback(styleSheets, continuation, styleSheet)
+{
+if (styleSheet)
+styleSheets.push(styleSheet);
+if (continuation)
+continuation(styleSheets);
+}
+
+function allStylesCallback(styleSheetIds)
+{
+if (!styleSheetIds || !styleSheetIds.length)
+return evalCallback([]);
+var styleSheets = [];
+for (var i = 0; i < styleSheetIds.length; ++i)
+WebInspector.CSSStyleSheet.createForId(styleSheetIds[i], styleSheetCallback.bind(null, styleSheets, i == styleSheetIds.length - 1 ? evalCallback : null));
+}
+
+InspectorBackend.getAllStyles2(allStylesCallback);
+}
 }
 
 WebInspector.AuditRules.UnusedCssRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -22864,137 +27834,137 @@
 
 WebInspector.AuditRules.CacheControlRule = function(id, name)
 {
-    WebInspector.AuditRule.call(this, id, name);
+WebInspector.AuditRule.call(this, id, name);
 }
 
 WebInspector.AuditRules.CacheControlRule.MillisPerMonth = 1000 * 60 * 60 * 24 * 30;
 
 WebInspector.AuditRules.CacheControlRule.prototype = {
 
-    doRun: function(resources, result, callback)
-    {
-        var cacheableAndNonCacheableResources = this._cacheableAndNonCacheableResources(resources);
-        if (cacheableAndNonCacheableResources[0].length)
-            this.runChecks(cacheableAndNonCacheableResources[0], result);
-        this.handleNonCacheableResources(cacheableAndNonCacheableResources[1], result);
+doRun: function(resources, result, callback)
+{
+var cacheableAndNonCacheableResources = this._cacheableAndNonCacheableResources(resources);
+if (cacheableAndNonCacheableResources[0].length)
+this.runChecks(cacheableAndNonCacheableResources[0], result);
+this.handleNonCacheableResources(cacheableAndNonCacheableResources[1], result);
 
-        callback(result);
-    },
+callback(result);
+},
 
-    handleNonCacheableResources: function()
-    {
-    },
+handleNonCacheableResources: function()
+{
+},
 
-    _cacheableAndNonCacheableResources: function(resources)
-    {
-        var processedResources = [[], []];
-        for (var i = 0; i < resources.length; ++i) {
-            var resource = resources[i];
-            if (!this.isCacheableResource(resource))
-                continue;
-            if (this._isExplicitlyNonCacheable(resource))
-                processedResources[1].push(resource);
-            else
-                processedResources[0].push(resource);
-        }
-        return processedResources;
-    },
+_cacheableAndNonCacheableResources: function(resources)
+{
+var processedResources = [[], []];
+for (var i = 0; i < resources.length; ++i) {
+var resource = resources[i];
+if (!this.isCacheableResource(resource))
+continue;
+if (this._isExplicitlyNonCacheable(resource))
+processedResources[1].push(resource);
+else
+processedResources[0].push(resource);
+}
+return processedResources;
+},
 
-    execCheck: function(messageText, resourceCheckFunction, resources, result)
-    {
-        var resourceCount = resources.length;
-        var urls = [];
-        for (var i = 0; i < resourceCount; ++i) {
-            if (resourceCheckFunction.call(this, resources[i]))
-                urls.push(resources[i].url);
-        }
-        if (urls.length) {
-            var entry = result.addChild(messageText, true);
-            entry.addURLs(urls);
-            result.violationCount += urls.length;
-        }
-    },
+execCheck: function(messageText, resourceCheckFunction, resources, result)
+{
+var resourceCount = resources.length;
+var urls = [];
+for (var i = 0; i < resourceCount; ++i) {
+if (resourceCheckFunction.call(this, resources[i]))
+urls.push(resources[i].url);
+}
+if (urls.length) {
+var entry = result.addChild(messageText, true);
+entry.addURLs(urls);
+result.violationCount += urls.length;
+}
+},
 
-    freshnessLifetimeGreaterThan: function(resource, timeMs)
-    {
-        var dateHeader = this.responseHeader(resource, "Date");
-        if (!dateHeader)
-            return false;
+freshnessLifetimeGreaterThan: function(resource, timeMs)
+{
+var dateHeader = this.responseHeader(resource, "Date");
+if (!dateHeader)
+return false;
 
-        var dateHeaderMs = Date.parse(dateHeader);
-        if (isNaN(dateHeaderMs))
-            return false;
+var dateHeaderMs = Date.parse(dateHeader);
+if (isNaN(dateHeaderMs))
+return false;
 
-        var freshnessLifetimeMs;
-        var maxAgeMatch = this.responseHeaderMatch(resource, "Cache-Control", "max-age=(\\d+)");
+var freshnessLifetimeMs;
+var maxAgeMatch = this.responseHeaderMatch(resource, "Cache-Control", "max-age=(\\d+)");
 
-        if (maxAgeMatch)
-            freshnessLifetimeMs = (maxAgeMatch[1]) ? 1000 * maxAgeMatch[1] : 0;
-        else {
-            var expiresHeader = this.responseHeader(resource, "Expires");
-            if (expiresHeader) {
-                var expDate = Date.parse(expiresHeader);
-                if (!isNaN(expDate))
-                    freshnessLifetimeMs = expDate - dateHeaderMs;
-            }
-        }
+if (maxAgeMatch)
+freshnessLifetimeMs = (maxAgeMatch[1]) ? 1000 * maxAgeMatch[1] : 0;
+else {
+var expiresHeader = this.responseHeader(resource, "Expires");
+if (expiresHeader) {
+var expDate = Date.parse(expiresHeader);
+if (!isNaN(expDate))
+freshnessLifetimeMs = expDate - dateHeaderMs;
+}
+}
 
-        return (isNaN(freshnessLifetimeMs)) ? false : freshnessLifetimeMs > timeMs;
-    },
+return (isNaN(freshnessLifetimeMs)) ? false : freshnessLifetimeMs > timeMs;
+},
 
-    responseHeader: function(resource, header)
-    {
-        return resource.responseHeaders[header];
-    },
+responseHeader: function(resource, header)
+{
+return resource.responseHeaders[header];
+},
 
-    hasResponseHeader: function(resource, header)
-    {
-        return resource.responseHeaders[header] !== undefined;
-    },
+hasResponseHeader: function(resource, header)
+{
+return resource.responseHeaders[header] !== undefined;
+},
 
-    isCompressible: function(resource)
-    {
-        return WebInspector.Resource.Type.isTextType(resource.type);
-    },
+isCompressible: function(resource)
+{
+return WebInspector.Resource.Type.isTextType(resource.type);
+},
 
-    isPubliclyCacheable: function(resource)
-    {
-        if (this._isExplicitlyNonCacheable(resource))
-            return false;
+isPubliclyCacheable: function(resource)
+{
+if (this._isExplicitlyNonCacheable(resource))
+return false;
 
-        if (this.responseHeaderMatch(resource, "Cache-Control", "public"))
-            return true;
+if (this.responseHeaderMatch(resource, "Cache-Control", "public"))
+return true;
 
-        return resource.url.indexOf("?") == -1 && !this.responseHeaderMatch(resource, "Cache-Control", "private");
-    },
+return resource.url.indexOf("?") == -1 && !this.responseHeaderMatch(resource, "Cache-Control", "private");
+},
 
-    responseHeaderMatch: function(resource, header, regexp)
-    {
-        return resource.responseHeaders[header]
-            ? resource.responseHeaders[header].match(new RegExp(regexp, "im"))
-            : undefined;
-    },
+responseHeaderMatch: function(resource, header, regexp)
+{
+return resource.responseHeaders[header]
+? resource.responseHeaders[header].match(new RegExp(regexp, "im"))
+: undefined;
+},
 
-    hasExplicitExpiration: function(resource)
-    {
-        return this.hasResponseHeader(resource, "Date") &&
-            (this.hasResponseHeader(resource, "Expires") || this.responseHeaderMatch(resource, "Cache-Control", "max-age"));
-    },
+hasExplicitExpiration: function(resource)
+{
+return this.hasResponseHeader(resource, "Date") &&
+(this.hasResponseHeader(resource, "Expires") || this.responseHeaderMatch(resource, "Cache-Control", "max-age"));
+},
 
-    _isExplicitlyNonCacheable: function(resource)
-    {
-        var hasExplicitExp = this.hasExplicitExpiration(resource);
-        return this.responseHeaderMatch(resource, "Cache-Control", "(no-cache|no-store|must-revalidate)") ||
-            this.responseHeaderMatch(resource, "Pragma", "no-cache") ||
-            (hasExplicitExp && !this.freshnessLifetimeGreaterThan(resource, 0)) ||
-            (!hasExplicitExp && resource.url && resource.url.indexOf("?") >= 0) ||
-            (!hasExplicitExp && !this.isCacheableResource(resource));
-    },
+_isExplicitlyNonCacheable: function(resource)
+{
+var hasExplicitExp = this.hasExplicitExpiration(resource);
+return this.responseHeaderMatch(resource, "Cache-Control", "(no-cache|no-store|must-revalidate)") ||
+this.responseHeaderMatch(resource, "Pragma", "no-cache") ||
+(hasExplicitExp && !this.freshnessLifetimeGreaterThan(resource, 0)) ||
+(!hasExplicitExp && resource.url && resource.url.indexOf("?") >= 0) ||
+(!hasExplicitExp && !this.isCacheableResource(resource));
+},
 
-    isCacheableResource: function(resource)
-    {
-        return resource.statusCode !== undefined && WebInspector.AuditRules.CacheableResponseCodes[resource.statusCode];
-    }
+isCacheableResource: function(resource)
+{
+return resource.statusCode !== undefined && WebInspector.AuditRules.CacheableResponseCodes[resource.statusCode];
+}
 }
 
 WebInspector.AuditRules.CacheControlRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -23002,102 +27972,102 @@
 
 WebInspector.AuditRules.BrowserCacheControlRule = function()
 {
-    WebInspector.AuditRules.CacheControlRule.call(this, "http-browsercache", "Leverage browser caching");
+WebInspector.AuditRules.CacheControlRule.call(this, "http-browsercache", "Leverage browser caching");
 }
 
 WebInspector.AuditRules.BrowserCacheControlRule.prototype = {
-    handleNonCacheableResources: function(resources, result)
-    {
-        if (resources.length) {
-            var entry = result.addChild("The following resources are explicitly non-cacheable. Consider making them cacheable if possible:", true);
-            result.violationCount += resources.length;
-            for (var i = 0; i < resources.length; ++i)
-                entry.addURL(resources[i].url);
-        }
-    },
+handleNonCacheableResources: function(resources, result)
+{
+if (resources.length) {
+var entry = result.addChild("The following resources are explicitly non-cacheable. Consider making them cacheable if possible:", true);
+result.violationCount += resources.length;
+for (var i = 0; i < resources.length; ++i)
+entry.addURL(resources[i].url);
+}
+},
 
-    runChecks: function(resources, result, callback)
-    {
-        this.execCheck("The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers:",
-            this._missingExpirationCheck, resources, result);
-        this.execCheck("The following resources specify a \"Vary\" header that disables caching in most versions of Internet Explorer:",
-            this._varyCheck, resources, result);
-        this.execCheck("The following cacheable resources have a short freshness lifetime:",
-            this._oneMonthExpirationCheck, resources, result);
+runChecks: function(resources, result, callback)
+{
+this.execCheck("The following resources are missing a cache expiration. Resources that do not specify an expiration may not be cached by browsers:",
+this._missingExpirationCheck, resources, result);
+this.execCheck("The following resources specify a \"Vary\" header that disables caching in most versions of Internet Explorer:",
+this._varyCheck, resources, result);
+this.execCheck("The following cacheable resources have a short freshness lifetime:",
+this._oneMonthExpirationCheck, resources, result);
 
-        // Unable to implement the favicon check due to the WebKit limitations.
-        this.execCheck("To further improve cache hit rate, specify an expiration one year in the future for the following cacheable resources:",
-            this._oneYearExpirationCheck, resources, result);
-    },
 
-    _missingExpirationCheck: function(resource)
-    {
-        return this.isCacheableResource(resource) && !this.hasResponseHeader(resource, "Set-Cookie") && !this.hasExplicitExpiration(resource);
-    },
+this.execCheck("To further improve cache hit rate, specify an expiration one year in the future for the following cacheable resources:",
+this._oneYearExpirationCheck, resources, result);
+},
 
-    _varyCheck: function(resource)
-    {
-        var varyHeader = this.responseHeader(resource, "Vary");
-        if (varyHeader) {
-            varyHeader = varyHeader.replace(/User-Agent/gi, "");
-            varyHeader = varyHeader.replace(/Accept-Encoding/gi, "");
-            varyHeader = varyHeader.replace(/[, ]*/g, "");
-        }
-        return varyHeader && varyHeader.length && this.isCacheableResource(resource) && this.freshnessLifetimeGreaterThan(resource, 0);
-    },
+_missingExpirationCheck: function(resource)
+{
+return this.isCacheableResource(resource) && !this.hasResponseHeader(resource, "Set-Cookie") && !this.hasExplicitExpiration(resource);
+},
 
-    _oneMonthExpirationCheck: function(resource)
-    {
-        return this.isCacheableResource(resource) &&
-            !this.hasResponseHeader(resource, "Set-Cookie") &&
-            !this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth) &&
-            this.freshnessLifetimeGreaterThan(resource, 0);
-    },
+_varyCheck: function(resource)
+{
+var varyHeader = this.responseHeader(resource, "Vary");
+if (varyHeader) {
+varyHeader = varyHeader.replace(/User-Agent/gi, "");
+varyHeader = varyHeader.replace(/Accept-Encoding/gi, "");
+varyHeader = varyHeader.replace(/[, ]*/g, "");
+}
+return varyHeader && varyHeader.length && this.isCacheableResource(resource) && this.freshnessLifetimeGreaterThan(resource, 0);
+},
 
-    _oneYearExpirationCheck: function(resource)
-    {
-        return this.isCacheableResource(resource) &&
-            !this.hasResponseHeader(resource, "Set-Cookie") &&
-            !this.freshnessLifetimeGreaterThan(resource, 11 * WebInspector.AuditRules.CacheControlRule.MillisPerMonth) &&
-            this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth);
-    }
+_oneMonthExpirationCheck: function(resource)
+{
+return this.isCacheableResource(resource) &&
+!this.hasResponseHeader(resource, "Set-Cookie") &&
+!this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth) &&
+this.freshnessLifetimeGreaterThan(resource, 0);
+},
+
+_oneYearExpirationCheck: function(resource)
+{
+return this.isCacheableResource(resource) &&
+!this.hasResponseHeader(resource, "Set-Cookie") &&
+!this.freshnessLifetimeGreaterThan(resource, 11 * WebInspector.AuditRules.CacheControlRule.MillisPerMonth) &&
+this.freshnessLifetimeGreaterThan(resource, WebInspector.AuditRules.CacheControlRule.MillisPerMonth);
+}
 }
 
 WebInspector.AuditRules.BrowserCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype;
 
 
 WebInspector.AuditRules.ProxyCacheControlRule = function() {
-    WebInspector.AuditRules.CacheControlRule.call(this, "http-proxycache", "Leverage proxy caching");
+WebInspector.AuditRules.CacheControlRule.call(this, "http-proxycache", "Leverage proxy caching");
 }
 
 WebInspector.AuditRules.ProxyCacheControlRule.prototype = {
-    runChecks: function(resources, result, callback)
-    {
-        this.execCheck("Resources with a \"?\" in the URL are not cached by most proxy caching servers:",
-            this._questionMarkCheck, resources, result);
-        this.execCheck("Consider adding a \"Cache-Control: public\" header to the following resources:",
-            this._publicCachingCheck, resources, result);
-        this.execCheck("The following publicly cacheable resources contain a Set-Cookie header. This security vulnerability can cause cookies to be shared by multiple users.",
-            this._setCookieCacheableCheck, resources, result);
-    },
+runChecks: function(resources, result, callback)
+{
+this.execCheck("Resources with a \"?\" in the URL are not cached by most proxy caching servers:",
+this._questionMarkCheck, resources, result);
+this.execCheck("Consider adding a \"Cache-Control: public\" header to the following resources:",
+this._publicCachingCheck, resources, result);
+this.execCheck("The following publicly cacheable resources contain a Set-Cookie header. This security vulnerability can cause cookies to be shared by multiple users.",
+this._setCookieCacheableCheck, resources, result);
+},
 
-    _questionMarkCheck: function(resource)
-    {
-        return resource.url.indexOf("?") >= 0 && !this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource);
-    },
+_questionMarkCheck: function(resource)
+{
+return resource.url.indexOf("?") >= 0 && !this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource);
+},
 
-    _publicCachingCheck: function(resource)
-    {
-        return this.isCacheableResource(resource) &&
-            !this.isCompressible(resource) &&
-            !this.responseHeaderMatch(resource, "Cache-Control", "public") &&
-            !this.hasResponseHeader(resource, "Set-Cookie");
-    },
+_publicCachingCheck: function(resource)
+{
+return this.isCacheableResource(resource) &&
+!this.isCompressible(resource) &&
+!this.responseHeaderMatch(resource, "Cache-Control", "public") &&
+!this.hasResponseHeader(resource, "Set-Cookie");
+},
 
-    _setCookieCacheableCheck: function(resource)
-    {
-        return this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource);
-    }
+_setCookieCacheableCheck: function(resource)
+{
+return this.hasResponseHeader(resource, "Set-Cookie") && this.isPubliclyCacheable(resource);
+}
 }
 
 WebInspector.AuditRules.ProxyCacheControlRule.prototype.__proto__ = WebInspector.AuditRules.CacheControlRule.prototype;
@@ -23105,80 +28075,96 @@
 
 WebInspector.AuditRules.ImageDimensionsRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-imagedims", "Specify image dimensions");
+WebInspector.AuditRule.call(this, "page-imagedims", "Specify image dimensions");
 }
 
 WebInspector.AuditRules.ImageDimensionsRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        function evalCallback(evalResult, isException)
-        {
-            if (isException || !evalResult || !evalResult.totalImages)
-                return callback(null);
+doRun: function(resources, result, callback)
+{
+function doneCallback(context)
+{
+var map = context.urlToNoDimensionCount;
+for (var url in map) {
+var entry = entry || result.addChild("A width and height should be specified for all images in order to speed up page display. The following image(s) are missing a width and/or height:", true);
+var value = WebInspector.AuditRuleResult.linkifyDisplayName(url);
+if (map[url] > 1)
+value += String.sprintf(" (%d uses)", map[url]);
+entry.addChild(value);
+result.violationCount++;
+}
+callback(entry ? result : null);
+}
 
-            var entry = result.addChild("A width and height should be specified for all images in order to speed up page display. The following image(s) are missing a width and/or height:", true);
-            var map = evalResult.map;
-            for (var url in map) {
-                var value = WebInspector.linkifyURL(url);
-                if (map[url] > 1)
-                    value += " (" + map[url] + " uses)";
-                entry.addChild(value);
-                result.violationCount++;
-            }
-            callback(result);
-        }
+function imageStylesReady(imageId, context, styles)
+{
+--context.imagesLeft;
 
-        function routine()
-        {
-            var images = document.getElementsByTagName("img");
-            const widthRegExp = /width[^:;]*:/gim;
-            const heightRegExp = /height[^:;]*:/gim;
+const node = WebInspector.domAgent.nodeForId(imageId);
+var src = node.getAttribute("src");
+if (!src.asParsedURL()) {
+for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
+if (frameOwnerCandidate.documentURL) {
+var completeSrc = WebInspector.completeURL(frameOwnerCandidate.documentURL, src);
+break;
+}
+}
+}
+if (completeSrc)
+src = completeSrc;
 
-            function hasDimension(element, cssText, rules, regexp, attributeName) {
-                if (element.attributes.getNamedItem(attributeName) != null || (cssText && cssText.match(regexp)))
-                    return true;
+const computedStyle = styles.computedStyle;
+if (computedStyle.getPropertyValue("position") === "absolute") {
+if (!context.imagesLeft)
+doneCallback(context);
+return;
+}
 
-                if (!rules)
-                    return false;
-                for (var i = 0; i < rules.length; ++i) {
-                    if (rules.item(i).style.cssText.match(regexp))
-                        return true;
-                }
-                return false;
-            }
+var widthFound = "width" in styles.styleAttributes;
+var heightFound = "height" in styles.styleAttributes;
 
-            function hasWidth(element, cssText, rules) {
-                return hasDimension(element, cssText, rules, widthRegExp, "width");
-            }
+for (var i = styles.matchedCSSRules.length - 1; i >= 0 && !(widthFound && heightFound); --i) {
+var style = styles.matchedCSSRules[i].style;
+if (style.getPropertyValue("width") !== "")
+widthFound = true;
+if (style.getPropertyValue("height") !== "")
+heightFound = true;
+}
 
-            function hasHeight(element, cssText, rules) {
-                return hasDimension(element, cssText, rules, heightRegExp, "height");
-            }
+if (!widthFound || !heightFound) {
+if (src in context.urlToNoDimensionCount)
+++context.urlToNoDimensionCount[src];
+else
+context.urlToNoDimensionCount[src] = 1;
+}
 
-            var urlToNoDimensionCount = {};
-            var found = false;
-            for (var i = 0; i < images.length; ++i) {
-                var image = images[i];
-                if (!image.src)
-                    continue;
-                var position = document.defaultView.getComputedStyle(image).getPropertyValue("position");
-                if (position === "absolute")
-                    continue;
-                var cssText = (image.style && image.style.cssText) ? image.style.cssText : "";
-                var rules = document.defaultView.getMatchedCSSRules(image, "", true);
-                if (!hasWidth(image, cssText, rules) || !hasHeight(image, cssText, rules)) {
-                    found = true;
-                    if (urlToNoDimensionCount.hasOwnProperty(image.src))
-                        ++urlToNoDimensionCount[image.src];
-                    else
-                        urlToNoDimensionCount[image.src] = 1;
-                }
-            }
-            return found ? {totalImages: images.length, map: urlToNoDimensionCount} : null;
-        }
+if (!context.imagesLeft)
+doneCallback(context);
+}
 
-        WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this));
-    }
+function receivedImages(imageIds)
+{
+if (!imageIds || !imageIds.length)
+return callback(null);
+var context = {imagesLeft: imageIds.length, urlToNoDimensionCount: {}};
+for (var i = imageIds.length - 1; i >= 0; --i)
+WebInspector.cssModel.getStylesAsync(imageIds[i], imageStylesReady.bind(this, imageIds[i], context));
+}
+
+function pushImageNodes()
+{
+const nodeIds = [];
+var nodes = document.getElementsByTagName("img");
+for (var i = 0; i < nodes.length; ++i) {
+if (!nodes[i].src)
+continue;
+var nodeId = this.getNodeId(nodes[i]);
+nodeIds.push(nodeId);
+}
+return nodeIds;
+}
+
+WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, null, receivedImages);
+}
 }
 
 WebInspector.AuditRules.ImageDimensionsRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -23186,73 +28172,75 @@
 
 WebInspector.AuditRules.CssInHeadRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-cssinhead", "Put CSS in the document head");
+WebInspector.AuditRule.call(this, "page-cssinhead", "Put CSS in the document head");
 }
 
 WebInspector.AuditRules.CssInHeadRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        function evalCallback(evalResult, isException)
-        {
-            if (isException || !evalResult)
-                return callback(null);
+doRun: function(resources, result, callback)
+{
+function evalCallback(evalResult)
+{
+if (!evalResult)
+return callback(null);
 
-            var summary = result.addChild("");
+var summary = result.addChild("");
 
-            var outputMessages = [];
-            for (var url in evalResult) {
-                var urlViolations = evalResult[url];
-                if (urlViolations[0])
-                    result.addChild(String.sprintf("%s style block(s) in the %s body should be moved to the document head.", urlViolations[0], WebInspector.linkifyURL(url)));
-                for (var i = 0; i < urlViolations[1].length; ++i)
-                    result.addChild(String.sprintf("Link node %s should be moved to the document head in %s", WebInspector.linkifyURL(urlViolations[1])), WebInspector.linkifyURL(url));
-                result.violationCount += urlViolations.length;
-            }
-            summary.value = String.sprintf("CSS in the document body adversely impacts rendering performance.");
-            callback(result);
-        }
+var outputMessages = [];
+for (var url in evalResult) {
+var urlViolations = evalResult[url];
+if (urlViolations[0]) {
+result.addChild(String.sprintf("%s style block(s) in the %s body should be moved to the document head.", urlViolations[0], WebInspector.AuditRuleResult.linkifyDisplayName(url)));
+result.violationCount += urlViolations[0];
+}
+for (var i = 0; i < urlViolations[1].length; ++i)
+result.addChild(String.sprintf("Link node %s should be moved to the document head in %s", WebInspector.AuditRuleResult.linkifyDisplayName(urlViolations[1][i]), WebInspector.AuditRuleResult.linkifyDisplayName(url)));
+result.violationCount += urlViolations[1].length;
+}
+summary.value = String.sprintf("CSS in the document body adversely impacts rendering performance.");
+callback(result);
+}
 
-        function routine()
-        {
-            function allViews() {
-                var views = [document.defaultView];
-                var curView = 0;
-                while (curView < views.length) {
-                    var view = views[curView];
-                    var frames = view.frames;
-                    for (var i = 0; i < frames.length; ++i) {
-                        if (frames[i] !== view)
-                            views.push(frames[i]);
-                    }
-                    ++curView;
-                }
-                return views;
-            }
+function routine()
+{
+function allViews() {
+var views = [document.defaultView];
+var curView = 0;
+while (curView < views.length) {
+var view = views[curView];
+var frames = view.frames;
+for (var i = 0; i < frames.length; ++i) {
+if (frames[i] !== view)
+views.push(frames[i]);
+}
+++curView;
+}
+return views;
+}
 
-            var views = allViews();
-            var urlToViolationsArray = {};
-            var found = false;
-            for (var i = 0; i < views.length; ++i) {
-                var view = views[i];
-                if (!view.document)
-                    continue;
+var views = allViews();
+var urlToViolationsArray = {};
+var found = false;
+for (var i = 0; i < views.length; ++i) {
+var view = views[i];
+if (!view.document)
+continue;
 
-                var inlineStyles = view.document.querySelectorAll("body style");
-                var inlineStylesheets = view.document.querySelectorAll("body link[rel~='stylesheet'][href]");
-                if (!inlineStyles.length && !inlineStylesheets.length)
-                    continue;
+var inlineStyles = view.document.querySelectorAll("body style");
+var inlineStylesheets = view.document.querySelectorAll("body link[rel~='stylesheet'][href]");
+if (!inlineStyles.length && !inlineStylesheets.length)
+continue;
 
-                found = true;
-                var inlineStylesheetHrefs = [];
-                for (var j = 0; j < inlineStylesheets.length; ++j)
-                    inlineStylesheetHrefs.push(inlineStylesheets[j].href);
-                urlToViolationsArray[view.location.href] = [inlineStyles.length, inlineStylesheetHrefs];
-            }
-            return found ? urlToViolationsArray : null;
-        }
+found = true;
+var inlineStylesheetHrefs = [];
+for (var j = 0; j < inlineStylesheets.length; ++j)
+inlineStylesheetHrefs.push(inlineStylesheets[j].href);
+urlToViolationsArray[view.location.href] = [inlineStyles.length, inlineStylesheetHrefs];
+}
+return found ? urlToViolationsArray : null;
+}
 
-        WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback);
-    }
+WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback);
+}
 }
 
 WebInspector.AuditRules.CssInHeadRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -23260,46 +28248,46 @@
 
 WebInspector.AuditRules.StylesScriptsOrderRule = function()
 {
-    WebInspector.AuditRule.call(this, "page-stylescriptorder", "Optimize the order of styles and scripts");
+WebInspector.AuditRule.call(this, "page-stylescriptorder", "Optimize the order of styles and scripts");
 }
 
 WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        function evalCallback(resultValue, isException)
-        {
-            if (isException || !resultValue)
-                return callback(null);
+doRun: function(resources, result, callback)
+{
+function evalCallback(resultValue)
+{
+if (!resultValue)
+return callback(null);
 
-            var lateCssUrls = resultValue[0];
-            var cssBeforeInlineCount = resultValue[1];
+var lateCssUrls = resultValue[0];
+var cssBeforeInlineCount = resultValue[1];
 
-            var entry = result.addChild("The following external CSS files were included after an external JavaScript file in the document head. To ensure CSS files are downloaded in parallel, always include external CSS before external JavaScript.", true);
-            entry.addURLs(lateCssUrls);
-            result.violationCount += lateCssUrls.length;
+var entry = result.addChild("The following external CSS files were included after an external JavaScript file in the document head. To ensure CSS files are downloaded in parallel, always include external CSS before external JavaScript.", true);
+entry.addURLs(lateCssUrls);
+result.violationCount += lateCssUrls.length;
 
-            if (cssBeforeInlineCount) {
-                result.addChild(String.sprintf(" %d inline script block%s found in the head between an external CSS file and another resource. To allow parallel downloading, move the inline script before the external CSS file, or after the next resource.", cssBeforeInlineCount, cssBeforeInlineCount > 1 ? "s were" : " was"));
-                result.violationCount += cssBeforeInlineCount;
-            }
-            callback(result);
-        }
+if (cssBeforeInlineCount) {
+result.addChild(String.sprintf(" %d inline script block%s found in the head between an external CSS file and another resource. To allow parallel downloading, move the inline script before the external CSS file, or after the next resource.", cssBeforeInlineCount, cssBeforeInlineCount > 1 ? "s were" : " was"));
+result.violationCount += cssBeforeInlineCount;
+}
+callback(result);
+}
 
-        function routine()
-        {
-            var lateStyles = document.querySelectorAll("head script[src] ~ link[rel~='stylesheet'][href]");
-            var cssBeforeInlineCount = document.querySelectorAll("head link[rel~='stylesheet'][href] ~ script:not([src])").length;
-            if (!lateStyles.length && !cssBeforeInlineCount)
-                return null;
+function routine()
+{
+var lateStyles = document.querySelectorAll("head script[src] ~ link[rel~='stylesheet'][href]");
+var cssBeforeInlineCount = document.querySelectorAll("head link[rel~='stylesheet'][href] ~ script:not([src])").length;
+if (!lateStyles.length && !cssBeforeInlineCount)
+return null;
 
-            var lateStyleUrls = [];
-            for (var i = 0; i < lateStyles.length; ++i)
-                lateStyleUrls.push(lateStyles[i].href);
-            return [ lateStyleUrls, cssBeforeInlineCount ];
-        }
+var lateStyleUrls = [];
+for (var i = 0; i < lateStyles.length; ++i)
+lateStyleUrls.push(lateStyles[i].href);
+return [ lateStyleUrls, cssBeforeInlineCount ];
+}
 
-        WebInspector.AuditRules.evaluateInTargetWindow(routine, evalCallback.bind(this));
-    }
+WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback.bind(this));
+}
 }
 
 WebInspector.AuditRules.StylesScriptsOrderRule.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -23307,39 +28295,39 @@
 
 WebInspector.AuditRules.CookieRuleBase = function(id, name)
 {
-    WebInspector.AuditRule.call(this, id, name);
+WebInspector.AuditRule.call(this, id, name);
 }
 
 WebInspector.AuditRules.CookieRuleBase.prototype = {
-    doRun: function(resources, result, callback)
-    {
-        var self = this;
-        function resultCallback(receivedCookies, isAdvanced) {
-            self.processCookies(isAdvanced ? receivedCookies : [], resources, result);
-            callback(result);
-        }
-        WebInspector.Cookies.getCookiesAsync(resultCallback);
-    },
+doRun: function(resources, result, callback)
+{
+var self = this;
+function resultCallback(receivedCookies, isAdvanced) {
+self.processCookies(isAdvanced ? receivedCookies : [], resources, result);
+callback(result);
+}
+WebInspector.Cookies.getCookiesAsync(resultCallback);
+},
 
-    mapResourceCookies: function(resourcesByDomain, allCookies, callback)
-    {
-        for (var i = 0; i < allCookies.length; ++i) {
-            for (var resourceDomain in resourcesByDomain) {
-                if (WebInspector.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain, resourceDomain))
-                    this._callbackForResourceCookiePairs(resourcesByDomain[resourceDomain], allCookies[i], callback);
-            }
-        }
-    },
+mapResourceCookies: function(resourcesByDomain, allCookies, callback)
+{
+for (var i = 0; i < allCookies.length; ++i) {
+for (var resourceDomain in resourcesByDomain) {
+if (WebInspector.Cookies.cookieDomainMatchesResourceDomain(allCookies[i].domain, resourceDomain))
+this._callbackForResourceCookiePairs(resourcesByDomain[resourceDomain], allCookies[i], callback);
+}
+}
+},
 
-    _callbackForResourceCookiePairs: function(resources, cookie, callback)
-    {
-        if (!resources)
-            return;
-        for (var i = 0; i < resources.length; ++i) {
-            if (WebInspector.Cookies.cookieMatchesResourceURL(cookie, resources[i].url))
-                callback(resources[i], cookie);
-        }
-    }
+_callbackForResourceCookiePairs: function(resources, cookie, callback)
+{
+if (!resources)
+return;
+for (var i = 0; i < resources.length; ++i) {
+if (WebInspector.Cookies.cookieMatchesResourceURL(cookie, resources[i].url))
+callback(resources[i], cookie);
+}
+}
 }
 
 WebInspector.AuditRules.CookieRuleBase.prototype.__proto__ = WebInspector.AuditRule.prototype;
@@ -23347,106 +28335,105 @@
 
 WebInspector.AuditRules.CookieSizeRule = function(avgBytesThreshold)
 {
-    WebInspector.AuditRules.CookieRuleBase.call(this, "http-cookiesize", "Minimize cookie size");
-    this._avgBytesThreshold = avgBytesThreshold;
-    this._maxBytesThreshold = 1000;
+WebInspector.AuditRules.CookieRuleBase.call(this, "http-cookiesize", "Minimize cookie size");
+this._avgBytesThreshold = avgBytesThreshold;
+this._maxBytesThreshold = 1000;
 }
 
 WebInspector.AuditRules.CookieSizeRule.prototype = {
-    _average: function(cookieArray)
-    {
-        var total = 0;
-        for (var i = 0; i < cookieArray.length; ++i)
-            total += cookieArray[i].size;
-        return cookieArray.length ? Math.round(total / cookieArray.length) : 0;
-    },
+_average: function(cookieArray)
+{
+var total = 0;
+for (var i = 0; i < cookieArray.length; ++i)
+total += cookieArray[i].size;
+return cookieArray.length ? Math.round(total / cookieArray.length) : 0;
+},
 
-    _max: function(cookieArray)
-    {
-        var result = 0;
-        for (var i = 0; i < cookieArray.length; ++i)
-            result = Math.max(cookieArray[i].size, result);
-        return result;
-    },
+_max: function(cookieArray)
+{
+var result = 0;
+for (var i = 0; i < cookieArray.length; ++i)
+result = Math.max(cookieArray[i].size, result);
+return result;
+},
 
-    processCookies: function(allCookies, resources, result)
-    {
-        function maxSizeSorter(a, b)
-        {
-            return b.maxCookieSize - a.maxCookieSize;
-        }
+processCookies: function(allCookies, resources, result)
+{
+function maxSizeSorter(a, b)
+{
+return b.maxCookieSize - a.maxCookieSize;
+}
 
-        function avgSizeSorter(a, b)
-        {
-            return b.avgCookieSize - a.avgCookieSize;
-        }
+function avgSizeSorter(a, b)
+{
+return b.avgCookieSize - a.avgCookieSize;
+}
 
-        var cookiesPerResourceDomain = {};
+var cookiesPerResourceDomain = {};
 
-        function collectorCallback(resource, cookie)
-        {
-            var cookies = cookiesPerResourceDomain[resource.domain];
-            if (!cookies) {
-                cookies = [];
-                cookiesPerResourceDomain[resource.domain] = cookies;
-            }
-            cookies.push(cookie);
-        }
+function collectorCallback(resource, cookie)
+{
+var cookies = cookiesPerResourceDomain[resource.domain];
+if (!cookies) {
+cookies = [];
+cookiesPerResourceDomain[resource.domain] = cookies;
+}
+cookies.push(cookie);
+}
 
-        if (!allCookies.length)
-            return;
+if (!allCookies.length)
+return;
 
-        var sortedCookieSizes = [];
+var sortedCookieSizes = [];
 
-        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources,
-                null,
-                WebInspector.URLRegExp,
-                true);
-        var matchingResourceData = {};
-        this.mapResourceCookies(domainToResourcesMap, allCookies, collectorCallback.bind(this));
+var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources,
+null,
+true);
+var matchingResourceData = {};
+this.mapResourceCookies(domainToResourcesMap, allCookies, collectorCallback.bind(this));
 
-        for (var resourceDomain in cookiesPerResourceDomain) {
-            var cookies = cookiesPerResourceDomain[resourceDomain];
-            sortedCookieSizes.push({
-                domain: resourceDomain,
-                avgCookieSize: this._average(cookies),
-                maxCookieSize: this._max(cookies)
-            });
-        }
-        var avgAllCookiesSize = this._average(allCookies);
+for (var resourceDomain in cookiesPerResourceDomain) {
+var cookies = cookiesPerResourceDomain[resourceDomain];
+sortedCookieSizes.push({
+domain: resourceDomain,
+avgCookieSize: this._average(cookies),
+maxCookieSize: this._max(cookies)
+});
+}
+var avgAllCookiesSize = this._average(allCookies);
 
-        var hugeCookieDomains = [];
-        sortedCookieSizes.sort(maxSizeSorter);
+var hugeCookieDomains = [];
+sortedCookieSizes.sort(maxSizeSorter);
 
-        for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
-            var maxCookieSize = sortedCookieSizes[i].maxCookieSize;
-            if (maxCookieSize > this._maxBytesThreshold)
-                hugeCookieDomains.push(sortedCookieSizes[i].domain + ": " + Number.bytesToString(maxCookieSize));
-        }
+for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
+var maxCookieSize = sortedCookieSizes[i].maxCookieSize;
+if (maxCookieSize > this._maxBytesThreshold)
+hugeCookieDomains.push(WebInspector.AuditRuleResult.resourceDomain(sortedCookieSizes[i].domain) + ": " + Number.bytesToString(maxCookieSize, WebInspector.UIString));
+}
 
-        var bigAvgCookieDomains = [];
-        sortedCookieSizes.sort(avgSizeSorter);
-        for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
-            var domain = sortedCookieSizes[i].domain;
-            var avgCookieSize = sortedCookieSizes[i].avgCookieSize;
-            if (avgCookieSize > this._avgBytesThreshold && avgCookieSize < this._maxBytesThreshold)
-                bigAvgCookieDomains.push(domain + ": " + Number.bytesToString(avgCookieSize));
-        }
-        result.addChild(String.sprintf("The average cookie size for all requests on this page is %s", Number.bytesToString(avgAllCookiesSize)));
+var bigAvgCookieDomains = [];
+sortedCookieSizes.sort(avgSizeSorter);
+for (var i = 0, len = sortedCookieSizes.length; i < len; ++i) {
+var domain = sortedCookieSizes[i].domain;
+var avgCookieSize = sortedCookieSizes[i].avgCookieSize;
+if (avgCookieSize > this._avgBytesThreshold && avgCookieSize < this._maxBytesThreshold)
+bigAvgCookieDomains.push(WebInspector.AuditRuleResult.resourceDomain(domain) + ": " + Number.bytesToString(avgCookieSize, WebInspector.UIString));
+}
+result.addChild(String.sprintf("The average cookie size for all requests on this page is %s", Number.bytesToString(avgAllCookiesSize, WebInspector.UIString)));
 
-        var message;
-        if (hugeCookieDomains.length) {
-            var entry = result.addChild("The following domains have a cookie size in excess of 1KB. This is harmful because requests with cookies larger than 1KB typically cannot fit into a single network packet.", true);
-            entry.addURLs(hugeCookieDomains);
-            result.violationCount += hugeCookieDomains.length;
-        }
+var message;
+if (hugeCookieDomains.length) {
+var entry = result.addChild("The following domains have a cookie size in excess of 1KB. This is harmful because requests with cookies larger than 1KB typically cannot fit into a single network packet.", true);
+entry.addURLs(hugeCookieDomains);
+result.violationCount += hugeCookieDomains.length;
+}
 
-        if (bigAvgCookieDomains.length) {
-            var entry = result.addChild(String.sprintf("The following domains have an average cookie size in excess of %d bytes. Reducing the size of cookies for these domains can reduce the time it takes to send requests.", this._avgBytesThreshold), true);
-            entry.addURLs(bigAvgCookieDomains.length);
-            result.violationCount += bigAvgCookieDomains.length;
-        }
-    }
+if (bigAvgCookieDomains.length) {
+var entry = result.addChild(String.sprintf("The following domains have an average cookie size in excess of %d bytes. Reducing the size of cookies for these domains can reduce the time it takes to send requests.", this._avgBytesThreshold), true);
+entry.addURLs(bigAvgCookieDomains);
+result.violationCount += bigAvgCookieDomains.length;
+}
+}
 }
 
 WebInspector.AuditRules.CookieSizeRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype;
@@ -23454,18370 +28441,10483 @@
 
 WebInspector.AuditRules.StaticCookielessRule = function(minResources)
 {
-    WebInspector.AuditRules.CookieRuleBase.call(this, "http-staticcookieless", "Serve static content from a cookieless domain");
-    this._minResources = minResources;
+WebInspector.AuditRules.CookieRuleBase.call(this, "http-staticcookieless", "Serve static content from a cookieless domain");
+this._minResources = minResources;
 }
 
 WebInspector.AuditRules.StaticCookielessRule.prototype = {
-    processCookies: function(allCookies, resources, result)
-    {
-        var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources,
-                [WebInspector.Resource.Type.Stylesheet,
-                 WebInspector.Resource.Type.Image],
-                WebInspector.URLRegExp,
-                true);
-        var totalStaticResources = 0;
-        for (var domain in domainToResourcesMap)
-            totalStaticResources += domainToResourcesMap[domain].length;
-        if (totalStaticResources < this._minResources)
-            return;
-        var matchingResourceData = {};
-        this.mapResourceCookies(domainToResourcesMap, allCookies, this._collectorCallback.bind(this, matchingResourceData));
+processCookies: function(allCookies, resources, result)
+{
+var domainToResourcesMap = WebInspector.AuditRules.getDomainToResourcesMap(resources,
+[WebInspector.Resource.Type.Stylesheet,
+WebInspector.Resource.Type.Image],
+true);
+var totalStaticResources = 0;
+for (var domain in domainToResourcesMap)
+totalStaticResources += domainToResourcesMap[domain].length;
+if (totalStaticResources < this._minResources)
+return;
+var matchingResourceData = {};
+this.mapResourceCookies(domainToResourcesMap, allCookies, this._collectorCallback.bind(this, matchingResourceData));
 
-        var badUrls = [];
-        var cookieBytes = 0;
-        for (var url in matchingResourceData) {
-            badUrls.push(url);
-            cookieBytes += matchingResourceData[url]
-        }
-        if (badUrls.length < this._minResources)
-            return;
+var badUrls = [];
+var cookieBytes = 0;
+for (var url in matchingResourceData) {
+badUrls.push(url);
+cookieBytes += matchingResourceData[url]
+}
+if (badUrls.length < this._minResources)
+return;
 
-        var entry = result.addChild(String.sprintf("%s of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:", Number.bytesToString(cookieBytes)), true);
-        entry.addURLs(badUrls);
-        result.violationCount = badUrls.length;
-    },
+var entry = result.addChild(String.sprintf("%s of cookies were sent with the following static resources. Serve these static resources from a domain that does not set cookies:", Number.bytesToString(cookieBytes, WebInspector.UIString)), true);
+entry.addURLs(badUrls);
+result.violationCount = badUrls.length;
+},
 
-    _collectorCallback: function(matchingResourceData, resource, cookie)
-    {
-        matchingResourceData[resource.url] = (matchingResourceData[resource.url] || 0) + cookie.size;
-    }
+_collectorCallback: function(matchingResourceData, resource, cookie)
+{
+matchingResourceData[resource.url] = (matchingResourceData[resource.url] || 0) + cookie.size;
+}
 }
 
 WebInspector.AuditRules.StaticCookielessRule.prototype.__proto__ = WebInspector.AuditRules.CookieRuleBase.prototype;
 
-/* AuditCategories.js */
 
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.AuditCategories.PagePerformance = function() {
-    WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.PagePerformance.AuditCategoryName);
+WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.PagePerformance.AuditCategoryName);
 }
 
 WebInspector.AuditCategories.PagePerformance.AuditCategoryName = "Web Page Performance";
 
 WebInspector.AuditCategories.PagePerformance.prototype = {
-    initialize: function()
-    {
-        this.addRule(new WebInspector.AuditRules.UnusedCssRule(), WebInspector.AuditRule.Severity.Warning);
-        this.addRule(new WebInspector.AuditRules.CssInHeadRule(), WebInspector.AuditRule.Severity.Severe);
-        this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule(), WebInspector.AuditRule.Severity.Severe);
-    }
+initialize: function()
+{
+this.addRule(new WebInspector.AuditRules.UnusedCssRule(), WebInspector.AuditRule.Severity.Warning);
+this.addRule(new WebInspector.AuditRules.CssInHeadRule(), WebInspector.AuditRule.Severity.Severe);
+this.addRule(new WebInspector.AuditRules.StylesScriptsOrderRule(), WebInspector.AuditRule.Severity.Severe);
+}
 }
 
 WebInspector.AuditCategories.PagePerformance.prototype.__proto__ = WebInspector.AuditCategory.prototype;
 
 WebInspector.AuditCategories.NetworkUtilization = function() {
-    WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName);
+WebInspector.AuditCategory.call(this, WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName);
 }
 
 WebInspector.AuditCategories.NetworkUtilization.AuditCategoryName = "Network Utilization";
 
 WebInspector.AuditCategories.NetworkUtilization.prototype = {
-    initialize: function()
-    {
-        this.addRule(new WebInspector.AuditRules.GzipRule(), WebInspector.AuditRule.Severity.Severe);
-        this.addRule(new WebInspector.AuditRules.ImageDimensionsRule(), WebInspector.AuditRule.Severity.Warning);
-        this.addRule(new WebInspector.AuditRules.CookieSizeRule(400), WebInspector.AuditRule.Severity.Warning);
-        this.addRule(new WebInspector.AuditRules.StaticCookielessRule(5), WebInspector.AuditRule.Severity.Warning);
-        this.addRule(new WebInspector.AuditRules.CombineJsResourcesRule(2), WebInspector.AuditRule.Severity.Severe);
-        this.addRule(new WebInspector.AuditRules.CombineCssResourcesRule(2), WebInspector.AuditRule.Severity.Severe);
-        this.addRule(new WebInspector.AuditRules.MinimizeDnsLookupsRule(4), WebInspector.AuditRule.Severity.Warning);
-        this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule(4, 10, 0.5), WebInspector.AuditRule.Severity.Warning);
-        this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule(), WebInspector.AuditRule.Severity.Severe);
-        this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule(), WebInspector.AuditRule.Severity.Warning);
-    }
+initialize: function()
+{
+this.addRule(new WebInspector.AuditRules.GzipRule(), WebInspector.AuditRule.Severity.Severe);
+this.addRule(new WebInspector.AuditRules.ImageDimensionsRule(), WebInspector.AuditRule.Severity.Warning);
+this.addRule(new WebInspector.AuditRules.CookieSizeRule(400), WebInspector.AuditRule.Severity.Warning);
+this.addRule(new WebInspector.AuditRules.StaticCookielessRule(5), WebInspector.AuditRule.Severity.Warning);
+this.addRule(new WebInspector.AuditRules.CombineJsResourcesRule(2), WebInspector.AuditRule.Severity.Severe);
+this.addRule(new WebInspector.AuditRules.CombineCssResourcesRule(2), WebInspector.AuditRule.Severity.Severe);
+this.addRule(new WebInspector.AuditRules.MinimizeDnsLookupsRule(4), WebInspector.AuditRule.Severity.Warning);
+this.addRule(new WebInspector.AuditRules.ParallelizeDownloadRule(4, 10, 0.5), WebInspector.AuditRule.Severity.Warning);
+this.addRule(new WebInspector.AuditRules.BrowserCacheControlRule(), WebInspector.AuditRule.Severity.Severe);
+this.addRule(new WebInspector.AuditRules.ProxyCacheControlRule(), WebInspector.AuditRule.Severity.Warning);
+}
 }
 
 WebInspector.AuditCategories.NetworkUtilization.prototype.__proto__ = WebInspector.AuditCategory.prototype;
 
-/* ResourceView.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) IBM Corp. 2009  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
+
+WebInspector.applyFormatters = function(value)
+{
+var formatter;
+var type = typeof value;
+var args;
+
+switch (type) {
+case "string":
+case "boolean":
+case "number":
+formatter = WebInspector.AuditFormatters.text;
+args = [ value.toString() ];
+break;
+
+case "object":
+if (value instanceof Array) {
+formatter = WebInspector.AuditFormatters.concat;
+args = value;
+} else if (value.type && value.arguments) {
+formatter = WebInspector.AuditFormatters[value.type];
+args = value.arguments;
+}
+}
+if (!formatter)
+throw "Invalid value or formatter: " + type + JSON.stringify(value);
+
+return formatter.apply(null, args);
+}
+
+WebInspector.AuditFormatters = {
+text: function(text)
+{
+return document.createTextNode(text);
+},
+
+snippet: function(snippetText)
+{
+var div = document.createElement("div");
+div.innerText = snippetText;
+div.className = "source-code";
+return div;
+},
+
+concat: function()
+{
+var parent = document.createElement("span");
+for (var arg = 0; arg < arguments.length; ++arg)
+parent.appendChild(WebInspector.applyFormatters(arguments[arg]));
+return parent;
+},
+
+url: function(url, displayText, allowExternalNavigation)
+{
+var a = document.createElement("a");
+a.href = url;
+a.title = url;
+a.textContent = displayText || url;
+if (allowExternalNavigation)
+a.target = "_blank";
+return a;
+}
+};
+
+
+
+
+
+WebInspector.ResourceHeadersView = function(resource)
+{
+WebInspector.View.call(this);
+this.element.addStyleClass("resource-headers-view");
+
+this._resource = resource;
+
+this._headersListElement = document.createElement("ol");
+this._headersListElement.className = "outline-disclosure";
+this.element.appendChild(this._headersListElement);
+
+this._headersTreeOutline = new TreeOutline(this._headersListElement);
+this._headersTreeOutline.expandTreeElementsWhenArrowing = true;
+
+this._urlTreeElement = new TreeElement("", null, false);
+this._urlTreeElement.selectable = false;
+this._headersTreeOutline.appendChild(this._urlTreeElement);
+
+this._requestMethodTreeElement = new TreeElement("", null, false);
+this._requestMethodTreeElement.selectable = false;
+this._headersTreeOutline.appendChild(this._requestMethodTreeElement);
+
+this._statusCodeTreeElement = new TreeElement("", null, false);
+this._statusCodeTreeElement.selectable = false;
+this._headersTreeOutline.appendChild(this._statusCodeTreeElement);
+
+this._requestHeadersTreeElement = new TreeElement("", null, true);
+this._requestHeadersTreeElement.expanded = true;
+this._requestHeadersTreeElement.selectable = false;
+this._headersTreeOutline.appendChild(this._requestHeadersTreeElement);
+
+this._decodeHover = WebInspector.UIString("Double-Click to toggle between URL encoded and decoded formats");
+this._decodeRequestParameters = true;
+
+this._queryStringTreeElement = new TreeElement("", null, true);
+this._queryStringTreeElement.expanded = true;
+this._queryStringTreeElement.selectable = false;
+this._queryStringTreeElement.hidden = true;
+this._headersTreeOutline.appendChild(this._queryStringTreeElement);
+
+this._formDataTreeElement = new TreeElement("", null, true);
+this._formDataTreeElement.expanded = true;
+this._formDataTreeElement.selectable = false;
+this._formDataTreeElement.hidden = true;
+this._headersTreeOutline.appendChild(this._formDataTreeElement);
+
+this._requestPayloadTreeElement = new TreeElement(WebInspector.UIString("Request Payload"), null, true);
+this._requestPayloadTreeElement.expanded = true;
+this._requestPayloadTreeElement.selectable = false;
+this._requestPayloadTreeElement.hidden = true;
+this._headersTreeOutline.appendChild(this._requestPayloadTreeElement);
+
+this._responseHeadersTreeElement = new TreeElement("", null, true);
+this._responseHeadersTreeElement.expanded = true;
+this._responseHeadersTreeElement.selectable = false;
+this._headersTreeOutline.appendChild(this._responseHeadersTreeElement);
+
+resource.addEventListener("requestHeaders changed", this._refreshRequestHeaders, this);
+resource.addEventListener("responseHeaders changed", this._refreshResponseHeaders, this);
+resource.addEventListener("finished", this._refreshHTTPInformation, this);
+
+this._refreshURL();
+this._refreshQueryString();
+this._refreshRequestHeaders();
+this._refreshResponseHeaders();
+this._refreshHTTPInformation();
+}
+
+WebInspector.ResourceHeadersView.prototype = {
+
+_refreshURL: function()
+{
+this._urlTreeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +
+"<div class=\"header-value source-code\">" + this._resource.url.escapeHTML() + "</div>";
+},
+
+_refreshQueryString: function()
+{
+var queryParameters = this._resource.queryParameters;
+this._queryStringTreeElement.hidden = !queryParameters;
+if (queryParameters)
+this._refreshParms(WebInspector.UIString("Query String Parameters"), queryParameters, this._queryStringTreeElement);
+},
+
+_refreshFormData: function()
+{
+this._formDataTreeElement.hidden = true;
+this._requestPayloadTreeElement.hidden = true;
+
+var formData = this._resource.requestFormData;
+if (!formData)
+return;
+
+var formParameters = this._resource.formParameters;
+if (formParameters) {
+this._formDataTreeElement.hidden = false;
+this._refreshParms(WebInspector.UIString("Form Data"), formParameters, this._formDataTreeElement);
+} else {
+this._requestPayloadTreeElement.hidden = false;
+this._refreshRequestPayload(formData);
+}
+},
+
+_refreshRequestPayload: function(formData)
+{
+this._requestPayloadTreeElement.removeChildren();
+
+var title = "<div class=\"raw-form-data header-value source-code\">" + formData.escapeHTML() + "</div>";
+var parmTreeElement = new TreeElement(null, null, false);
+parmTreeElement.titleHTML = title;
+parmTreeElement.selectable = false;
+this._requestPayloadTreeElement.appendChild(parmTreeElement);
+},
+
+_refreshParms: function(title, parms, parmsTreeElement)
+{
+parmsTreeElement.removeChildren();
+
+parmsTreeElement.titleHTML = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>";
+
+for (var i = 0; i < parms.length; ++i) {
+var name = parms[i].name;
+var value = parms[i].value;
+
+var errorDecoding = false;
+if (this._decodeRequestParameters) {
+if (value.indexOf("%") >= 0) {
+try {
+value = decodeURIComponent(value);
+} catch(e) {
+errorDecoding = true;
+}
+}
+
+value = value.replace(/\+/g, " ");
+}
+
+valueEscaped = value.escapeHTML();
+if (errorDecoding)
+valueEscaped += " <span class=\"error-message\">" + WebInspector.UIString("(unable to decode value)").escapeHTML() + "</span>";
+
+var title = "<div class=\"header-name\">" + name.escapeHTML() + ":</div>";
+title += "<div class=\"header-value source-code\">" + valueEscaped + "</div>";
+
+var parmTreeElement = new TreeElement(null, null, false);
+parmTreeElement.titleHTML = title;
+parmTreeElement.selectable = false;
+parmTreeElement.tooltip = this._decodeHover;
+parmTreeElement.ondblclick = this._toggleURLdecoding.bind(this);
+parmsTreeElement.appendChild(parmTreeElement);
+}
+},
+
+_toggleURLdecoding: function(event)
+{
+this._decodeRequestParameters = !this._decodeRequestParameters;
+this._refreshQueryString();
+this._refreshFormData();
+},
+
+_getHeaderValue: function(headers, key)
+{
+var lowerKey = key.toLowerCase();
+for (var testKey in headers) {
+if (testKey.toLowerCase() === lowerKey)
+return headers[testKey];
+}
+},
+
+_refreshRequestHeaders: function()
+{
+var additionalRow = null;
+if (typeof this._resource.webSocketRequestKey3 !== "undefined")
+additionalRow = {header: "(Key3)", value: this._resource.webSocketRequestKey3};
+this._refreshHeaders(WebInspector.UIString("Request Headers"), this._resource.sortedRequestHeaders, additionalRow, this._requestHeadersTreeElement);
+this._refreshFormData();
+},
+
+_refreshResponseHeaders: function()
+{
+var additionalRow = null;
+if (typeof this._resource.webSocketChallengeResponse !== "undefined")
+additionalRow = {header: "(Challenge Response)", value: this._resource.webSocketChallengeResponse};
+this._refreshHeaders(WebInspector.UIString("Response Headers"), this._resource.sortedResponseHeaders, additionalRow, this._responseHeadersTreeElement);
+},
+
+_refreshHTTPInformation: function()
+{
+var requestMethodElement = this._requestMethodTreeElement;
+requestMethodElement.hidden = !this._resource.statusCode;
+var statusCodeElement = this._statusCodeTreeElement;
+statusCodeElement.hidden = !this._resource.statusCode;
+var statusCodeImage = "";
+
+if (this._resource.statusCode) {
+var statusImageSource = "";
+if (this._resource.statusCode < 300)
+statusImageSource = "Images/successGreenDot.png";
+else if (this._resource.statusCode < 400)
+statusImageSource = "Images/warningOrangeDot.png";
+else
+statusImageSource = "Images/errorRedDot.png";
+
+var statusTextEscaped = this._resource.statusCode + " " + this._resource.statusText.escapeHTML();
+statusCodeImage = "<img class=\"resource-status-image\" src=\"" + statusImageSource + "\" title=\"" + statusTextEscaped + "\">";
+
+requestMethodElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>" +
+"<div class=\"header-value source-code\">" + this._resource.requestMethod + "</div>";
+
+statusCodeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>" +
+statusCodeImage + "<div class=\"header-value source-code\">" + statusTextEscaped + "</div>";
+}
+},
+
+_refreshHeaders: function(title, headers, additionalRow, headersTreeElement)
+{
+headersTreeElement.removeChildren();
+
+var length = headers.length;
+headersTreeElement.titleHTML = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>";
+headersTreeElement.hidden = !length;
+
+var length = headers.length;
+for (var i = 0; i < length; ++i) {
+var title = "<div class=\"header-name\">" + headers[i].header.escapeHTML() + ":</div>";
+title += "<div class=\"header-value source-code\">" + headers[i].value.escapeHTML() + "</div>"
+
+var headerTreeElement = new TreeElement(null, null, false);
+headerTreeElement.titleHTML = title;
+headerTreeElement.selectable = false;
+headersTreeElement.appendChild(headerTreeElement);
+}
+
+if (additionalRow) {
+var title = "<div class=\"header-name\">" + additionalRow.header.escapeHTML() + ":</div>";
+title += "<div class=\"header-value source-code\">" + additionalRow.value.escapeHTML() + "</div>"
+
+var headerTreeElement = new TreeElement(null, null, false);
+headerTreeElement.titleHTML = title;
+headerTreeElement.selectable = false;
+headersTreeElement.appendChild(headerTreeElement);
+}
+}
+}
+
+WebInspector.ResourceHeadersView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
+
+WebInspector.ResourceCookiesView = function(resource)
+{
+WebInspector.View.call(this);
+this.element.addStyleClass("resource-cookies-view");
+
+this._resource = resource;
+
+resource.addEventListener("requestHeaders changed", this.show, this);
+resource.addEventListener("responseHeaders changed", this.show, this);
+}
+
+WebInspector.ResourceCookiesView.prototype = {
+show: function(parentElement)
+{
+if (!this._resource.requestCookies && !this._resource.responseCookies) {
+if (!this._emptyMsgElement) {
+this._emptyMsgElement = document.createElement("div");
+this._emptyMsgElement.className = "storage-empty-view";
+this._emptyMsgElement.textContent = WebInspector.UIString("This request has no cookies.");
+this.element.appendChild(this._emptyMsgElement);
+}
+WebInspector.View.prototype.show.call(this, parentElement);
+return;
+}
+
+if (this._emptyMsgElement)
+this._emptyMsgElement.parentElement.removeChild(this._emptyMsgElement);
+
+this._cookiesTable = new WebInspector.CookiesTable(null, true, true);
+this._cookiesTable.addCookiesFolder(WebInspector.UIString("Request Cookies"), this._resource.requestCookies);
+this._cookiesTable.addCookiesFolder(WebInspector.UIString("Response Cookies"), this._resource.responseCookies);
+this.element.appendChild(this._cookiesTable.element);
+
+WebInspector.View.prototype.show.call(this, parentElement);
+this._cookiesTable.updateWidths();
+}
+}
+
+WebInspector.ResourceCookiesView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
+
+WebInspector.ResourceTimingView = function(resource)
+{
+WebInspector.View.call(this);
+this.element.addStyleClass("resource-timing-view");
+
+this._resource = resource;
+
+resource.addEventListener("timing changed", this._refresh, this);
+}
+
+WebInspector.ResourceTimingView.prototype = {
+show: function(parentElement)
+{
+if (!this._resource.timing) {
+if (!this._emptyMsgElement) {
+this._emptyMsgElement = document.createElement("div");
+this._emptyMsgElement.className = "storage-empty-view";
+this._emptyMsgElement.textContent = WebInspector.UIString("This request has no detailed timing info.");
+this.element.appendChild(this._emptyMsgElement);
+}
+WebInspector.View.prototype.show.call(this, parentElement);
+return;
+}
+
+if (this._emptyMsgElement)
+this._emptyMsgElement.parentElement.removeChild(this._emptyMsgElement);
+
+this._refresh();
+WebInspector.View.prototype.show.call(this, parentElement);
+},
+
+_refresh: function()
+{
+if (this._tableElement)
+this._tableElement.parentElement.removeChild(this._tableElement);
+
+this._tableElement = WebInspector.ResourceTimingView.createTimingTable(this._resource);
+this.element.appendChild(this._tableElement);
+}
+}
+
+WebInspector.ResourceTimingView.createTimingTable = function(resource)
+{
+var tableElement = document.createElement("table");
+var rows = [];
+
+function addRow(title, className, start, end, color)
+{
+var row = {};
+row.title = title;
+row.className = className;
+row.start = start;
+row.end = end;
+rows.push(row);
+}
+
+if (resource.timing.proxyStart !== -1)
+addRow(WebInspector.UIString("Proxy"), "proxy", resource.timing.proxyStart, resource.timing.proxyEnd);
+
+if (resource.timing.dnsStart !== -1)
+addRow(WebInspector.UIString("DNS Lookup"), "dns", resource.timing.dnsStart, resource.timing.dnsEnd);
+
+if (resource.timing.connectStart !== -1) {
+if (resource.connectionReused)
+addRow(WebInspector.UIString("Blocking"), "connecting", resource.timing.connectStart, resource.timing.connectEnd);
+else {
+var connectStart = resource.timing.connectStart;
+
+if (resource.timing.dnsStart !== -1)
+connectStart += resource.timing.dnsEnd - resource.timing.dnsStart;
+addRow(WebInspector.UIString("Connecting"), "connecting", connectStart, resource.timing.connectEnd);
+}
+}
+
+if (resource.timing.sslStart !== -1)
+addRow(WebInspector.UIString("SSL"), "ssl", resource.timing.sslStart, resource.timing.sslEnd);
+
+var sendStart = resource.timing.sendStart;
+if (resource.timing.sslStart !== -1)
+sendStart += resource.timing.sslEnd - resource.timing.sslStart;
+
+addRow(WebInspector.UIString("Sending"), "sending", resource.timing.sendStart, resource.timing.sendEnd);
+addRow(WebInspector.UIString("Waiting"), "waiting", resource.timing.sendEnd, resource.timing.receiveHeadersEnd);
+addRow(WebInspector.UIString("Receiving"), "receiving", (resource.responseReceivedTime - resource.timing.requestTime) * 1000, (resource.endTime - resource.timing.requestTime) * 1000);
+
+const chartWidth = 200;
+var total = (resource.endTime - resource.timing.requestTime) * 1000;
+var scale = chartWidth / total;
+
+for (var i = 0; i < rows.length; ++i) {
+var tr = document.createElement("tr");
+tableElement.appendChild(tr);
+
+var td = document.createElement("td");
+td.textContent = rows[i].title;
+tr.appendChild(td);
+
+td = document.createElement("td");
+td.width = chartWidth + "px";
+
+var row = document.createElement("div");
+row.className = "network-timing-row";
+td.appendChild(row);
+
+var bar = document.createElement("span");
+bar.className = "network-timing-bar " + rows[i].className;
+bar.style.left = scale * rows[i].start + "px";
+bar.style.right = scale * (total - rows[i].end) + "px";
+bar.style.backgroundColor = rows[i].color;
+bar.textContent = "\u200B"; 
+row.appendChild(bar);
+
+var title = document.createElement("span");
+title.className = "network-timing-bar-title";
+if (total - rows[i].end < rows[i].start)
+title.style.right = (scale * (total - rows[i].end) + 3) + "px";
+else
+title.style.left = (scale * rows[i].start + 3) + "px";
+title.textContent = Number.millisToString(rows[i].end - rows[i].start);
+row.appendChild(title);
+
+tr.appendChild(td);
+}
+return tableElement;
+}
+
+WebInspector.ResourceTimingView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
+
+WebInspector.NetworkItemView = function(resource)
+{
+WebInspector.View.call(this);
+
+this.element.addStyleClass("network-item-view");
+
+this._headersView = new WebInspector.ResourceHeadersView(resource);
+
+var contentView = WebInspector.ResourceManager.resourceViewForResource(resource);
+
+this._tabbedPane = new WebInspector.TabbedPane(this.element);
+this._tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this._headersView);
+if (contentView.hasContent()) {
+
+contentView.visible = false;
+this._tabbedPane.appendTab("content", WebInspector.UIString("Content"), contentView);
+}
+if (Preferences.showCookiesTab) {
+this._cookiesView = new WebInspector.ResourceCookiesView(resource);
+this._tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView);
+}
+if (Preferences.showTimingTab) {
+var timingView = new WebInspector.ResourceTimingView(resource);
+this._tabbedPane.appendTab("timing", WebInspector.UIString("Timing"), timingView);
+}
+
+this._tabbedPane.addEventListener("tab-selected", this._tabSelected, this);
+}
+
+WebInspector.NetworkItemView.prototype = {
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this._selectTab();
+},
+
+_selectTab: function(tabId)
+{
+if (!tabId)
+tabId = WebInspector.settings.resourceViewTab;
+
+if (!this._tabbedPane.selectTab(tabId)) {
+this._isInFallbackSelection = true;
+this._tabbedPane.selectTab("headers");
+delete this._isInFallbackSelection;
+}
+},
+
+_tabSelected: function(event)
+{
+WebInspector.settings.resourceViewTab = event.data.tabId;
+},
+
+resize: function()
+{
+if (this._cookiesView && this._cookiesView.visible)
+this._cookiesView.resize();
+}
+}
+
+WebInspector.NetworkItemView.prototype.__proto__ = WebInspector.View.prototype;
+
+
+
+
 
 WebInspector.ResourceView = function(resource)
 {
-    WebInspector.View.call(this);
-
-    this.element.addStyleClass("resource-view");
-
-    this.resource = resource;
-
-    this.tabsElement = document.createElement("div");
-    this.tabsElement.className = "scope-bar";
-    this.element.appendChild(this.tabsElement);
-
-    this.headersTabElement = document.createElement("li");
-    this.headersTabElement.textContent = WebInspector.UIString("Headers");
-    this.contentTabElement = document.createElement("li");
-    this.contentTabElement.textContent = WebInspector.UIString("Content");
-    this.tabsElement.appendChild(this.headersTabElement);
-    this.tabsElement.appendChild(this.contentTabElement);
-
-    this.headersTabElement.addEventListener("click", this._selectHeadersTab.bind(this), false);
-    this.contentTabElement.addEventListener("click", this.selectContentTab.bind(this), false);
-
-    this.headersElement = document.createElement("div");
-    this.headersElement.className = "resource-view-headers";
-    this.element.appendChild(this.headersElement);
-
-    this.contentElement = document.createElement("div");
-    this.contentElement.className = "resource-view-content";
-    this.element.appendChild(this.contentElement);
-
-    this.headersListElement = document.createElement("ol");
-    this.headersListElement.className = "outline-disclosure";
-    this.headersElement.appendChild(this.headersListElement);
-
-    this.headersTreeOutline = new TreeOutline(this.headersListElement);
-    this.headersTreeOutline.expandTreeElementsWhenArrowing = true;
-
-    this.urlTreeElement = new TreeElement("", null, false);
-    this.urlTreeElement.selectable = false;
-    this.headersTreeOutline.appendChild(this.urlTreeElement);
-
-    this.requestMethodTreeElement = new TreeElement("", null, false);
-    this.requestMethodTreeElement.selectable = false;
-    this.headersTreeOutline.appendChild(this.requestMethodTreeElement);
-
-    this.statusCodeTreeElement = new TreeElement("", null, false);
-    this.statusCodeTreeElement.selectable = false;
-    this.headersTreeOutline.appendChild(this.statusCodeTreeElement);
-     
-    this.requestHeadersTreeElement = new TreeElement("", null, true);
-    this.requestHeadersTreeElement.expanded = true;
-    this.requestHeadersTreeElement.selectable = false;
-    this.headersTreeOutline.appendChild(this.requestHeadersTreeElement);
-
-    this._decodeHover = WebInspector.UIString("Double-Click to toggle between URL encoded and decoded formats");
-    this._decodeRequestParameters = true;
-
-    this.queryStringTreeElement = new TreeElement("", null, true);
-    this.queryStringTreeElement.expanded = true;
-    this.queryStringTreeElement.selectable = false;
-    this.queryStringTreeElement.hidden = true;
-    this.headersTreeOutline.appendChild(this.queryStringTreeElement);
-
-    this.formDataTreeElement = new TreeElement("", null, true);
-    this.formDataTreeElement.expanded = true;
-    this.formDataTreeElement.selectable = false;
-    this.formDataTreeElement.hidden = true;
-    this.headersTreeOutline.appendChild(this.formDataTreeElement);
-
-    this.requestPayloadTreeElement = new TreeElement(WebInspector.UIString("Request Payload"), null, true);
-    this.requestPayloadTreeElement.expanded = true;
-    this.requestPayloadTreeElement.selectable = false;
-    this.requestPayloadTreeElement.hidden = true;
-    this.headersTreeOutline.appendChild(this.requestPayloadTreeElement);
-
-    this.responseHeadersTreeElement = new TreeElement("", null, true);
-    this.responseHeadersTreeElement.expanded = true;
-    this.responseHeadersTreeElement.selectable = false;
-    this.headersTreeOutline.appendChild(this.responseHeadersTreeElement);
-
-    this.headersVisible = true;
-
-    resource.addEventListener("url changed", this._refreshURL, this);
-    resource.addEventListener("requestHeaders changed", this._refreshRequestHeaders, this);
-    resource.addEventListener("responseHeaders changed", this._refreshResponseHeaders, this);
-    resource.addEventListener("finished", this._refreshHTTPInformation, this);
-
-    this._refreshURL();
-    this._refreshRequestHeaders();
-    this._refreshResponseHeaders();
-    this._refreshHTTPInformation();
-    this._selectTab();
+WebInspector.View.call(this);
+this.element.addStyleClass("resource-view");
+this.resource = resource;
 }
 
 WebInspector.ResourceView.prototype = {
-    attach: function()
-    {
-        if (!this.element.parentNode) {
-            var parentElement = (document.getElementById("resource-views") || document.getElementById("script-resource-views"));
-            if (parentElement)
-                parentElement.appendChild(this.element);
-        }
-    },
-
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this._selectTab();
-    },
-
-    set headersVisible(x)
-    {
-        if (x === this._headersVisible)
-            return;
-        this._headersVisible = x;
-        if (x)
-            this.element.addStyleClass("headers-visible"); 
-        else
-            this.element.removeStyleClass("headers-visible"); 
-        this._selectTab();
-    },
-
-    _selectTab: function()
-    {
-        if (this._headersVisible) {
-            if (WebInspector.settings.resourceViewTab === "headers")
-                this._selectHeadersTab();
-            else
-                this.selectContentTab();
-        } else
-            this._innerSelectContentTab();
-    },
-
-    _selectHeadersTab: function()
-    {
-        WebInspector.settings.resourceViewTab = "headers";
-        this.headersTabElement.addStyleClass("selected");
-        this.contentTabElement.removeStyleClass("selected");
-        this.headersElement.removeStyleClass("hidden");
-        this.contentElement.addStyleClass("hidden");
-    },
-
-    selectContentTab: function()
-    {
-        WebInspector.settings.resourceViewTab = "content";
-        this._innerSelectContentTab();
-    },
-
-    _innerSelectContentTab: function()
-    {
-        this.contentTabElement.addStyleClass("selected");
-        this.headersTabElement.removeStyleClass("selected");
-        this.contentElement.removeStyleClass("hidden");
-        this.headersElement.addStyleClass("hidden");
-        if ("resize" in this)
-            this.resize();
-        if ("contentTabSelected" in this)
-            this.contentTabSelected();
-    },
-
-    _refreshURL: function()
-    {
-        this.urlTreeElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +
-            "<div class=\"header-value source-code\">" + this.resource.url.escapeHTML() + "</div>";
-    },
-
-    _refreshQueryString: function()
-    {
-        var url = this.resource.url;
-        var hasQueryString = url.indexOf("?") >= 0;
-
-        if (!hasQueryString) {
-            this.queryStringTreeElement.hidden = true;
-            return;
-        }
-
-        this.queryStringTreeElement.hidden = false;
-        var parmString = url.split("?", 2)[1];
-        this._refreshParms(WebInspector.UIString("Query String Parameters"), parmString, this.queryStringTreeElement);
-    },
-
-    _refreshFormData: function()
-    {
-        this.formDataTreeElement.hidden = true;
-        this.requestPayloadTreeElement.hidden = true;
-
-        var isFormData = this.resource.requestFormData;
-        if (!isFormData)
-            return;
-
-        var isFormEncoded = false;
-        var requestContentType = this._getHeaderValue(this.resource.requestHeaders, "Content-Type");
-        if (requestContentType && requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
-            isFormEncoded = true;
-
-        if (isFormEncoded) {
-            this.formDataTreeElement.hidden = false;
-            this._refreshParms(WebInspector.UIString("Form Data"), this.resource.requestFormData, this.formDataTreeElement);
-        } else {
-            this.requestPayloadTreeElement.hidden = false;
-            this._refreshRequestPayload(this.resource.requestFormData);
-        }
-    },
-
-    _refreshRequestPayload: function(formData)
-    {
-        this.requestPayloadTreeElement.removeChildren();
-
-        var title = "<div class=\"header-name\">&nbsp;</div>";
-        title += "<div class=\"raw-form-data header-value source-code\">" + formData.escapeHTML() + "</div>";
-        var parmTreeElement = new TreeElement(title, null, false);
-        parmTreeElement.selectable = false;
-        this.requestPayloadTreeElement.appendChild(parmTreeElement);
-    },
-
-    _refreshParms: function(title, parmString, parmsTreeElement)
-    {
-        var parms = parmString.split("&");
-        for (var i = 0; i < parms.length; ++i) {
-            var parm = parms[i];
-            parm = parm.split("=", 2);
-            if (parm.length == 1)
-                parm.push("");
-            parms[i] = parm;
-        }
-
-        parmsTreeElement.removeChildren();
-
-        parmsTreeElement.title = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>";
-
-        for (var i = 0; i < parms.length; ++i) {
-            var key = parms[i][0];
-            var value = parms[i][1];
-
-            var errorDecoding = false;
-            if (this._decodeRequestParameters) {
-                if (value.indexOf("%") >= 0) {
-                    try {
-                        value = decodeURIComponent(value);
-                    } catch(e) {
-                        errorDecoding = true;
-                    }
-                }
-                    
-                value = value.replace(/\+/g, " ");
-            }
-
-            valueEscaped = value.escapeHTML();
-            if (errorDecoding)
-                valueEscaped += " <span class=\"error-message\">" + WebInspector.UIString("(unable to decode value)").escapeHTML() + "</span>";
-
-            var title = "<div class=\"header-name\">" + key.escapeHTML() + ":</div>";
-            title += "<div class=\"header-value source-code\">" + valueEscaped + "</div>";
-
-            var parmTreeElement = new TreeElement(title, null, false);
-            parmTreeElement.selectable = false;
-            parmTreeElement.tooltip = this._decodeHover;
-            parmTreeElement.ondblclick = this._toggleURLdecoding.bind(this);
-            parmsTreeElement.appendChild(parmTreeElement);
-        }
-    },
-
-    _toggleURLdecoding: function(event)
-    {
-        this._decodeRequestParameters = !this._decodeRequestParameters;
-        this._refreshQueryString();
-        this._refreshFormData();
-    },
-
-    _getHeaderValue: function(headers, key)
-    {
-        var lowerKey = key.toLowerCase();
-        for (var testKey in headers) {
-            if (testKey.toLowerCase() === lowerKey)
-                return headers[testKey];
-        }
-    },
-
-    _refreshRequestHeaders: function()
-    {
-        this._refreshHeaders(WebInspector.UIString("Request Headers"), this.resource.sortedRequestHeaders, this.requestHeadersTreeElement);
-        this._refreshFormData();
-    },
-
-    _refreshResponseHeaders: function()
-    {
-        this._refreshHeaders(WebInspector.UIString("Response Headers"), this.resource.sortedResponseHeaders, this.responseHeadersTreeElement);
-    },
-
-    _refreshHTTPInformation: function()
-    {
-        var requestMethodElement = this.requestMethodTreeElement;
-        requestMethodElement.hidden = !this.resource.statusCode;
-        var statusCodeElement = this.statusCodeTreeElement;
-        statusCodeElement.hidden = !this.resource.statusCode;
-        var statusCodeImage = "";
-
-        if (this.resource.statusCode) {
-            var statusImageSource = "";
-            if (this.resource.statusCode < 300)
-                statusImageSource = "Images/successGreenDot.png";
-            else if (this.resource.statusCode < 400)
-                statusImageSource = "Images/warningOrangeDot.png";
-            else
-                statusImageSource = "Images/errorRedDot.png";
-            statusCodeImage = "<img class=\"resource-status-image\" src=\"" + statusImageSource + "\" title=\"" + WebInspector.Resource.StatusTextForCode(this.resource.statusCode) + "\">";
-    
-            requestMethodElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>" +
-                "<div class=\"header-value source-code\">" + this.resource.requestMethod + "</div>";
-
-            statusCodeElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>" +
-                statusCodeImage + "<div class=\"header-value source-code\">" + WebInspector.Resource.StatusTextForCode(this.resource.statusCode) + "</div>";
-        }
-    },
-    
-    _refreshHeaders: function(title, headers, headersTreeElement)
-    {
-        headersTreeElement.removeChildren();
-
-        var length = headers.length;
-        headersTreeElement.title = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>";
-        headersTreeElement.hidden = !length;
-
-        var length = headers.length;
-        for (var i = 0; i < length; ++i) {
-            var title = "<div class=\"header-name\">" + headers[i].header.escapeHTML() + ":</div>";
-            title += "<div class=\"header-value source-code\">" + headers[i].value.escapeHTML() + "</div>"
-
-            var headerTreeElement = new TreeElement(title, null, false);
-            headerTreeElement.selectable = false;
-            headersTreeElement.appendChild(headerTreeElement);
-        }
-    }
+hasContent: function()
+{
+return false;
+}
 }
 
 WebInspector.ResourceView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* SourceFrame.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.SourceFrame = function(parentElement, addBreakpointDelegate, removeBreakpointDelegate)
+
+
+WebInspector.SourceFrame = function(parentElement, delegate)
 {
-    this._parentElement = parentElement;
+this._parentElement = parentElement;
+this._delegate = delegate;
 
-    this._textModel = new WebInspector.TextEditorModel();
-    this._textModel.replaceTabsWithSpaces = true;
+this._textModel = new WebInspector.TextEditorModel();
+this._textModel.replaceTabsWithSpaces = true;
 
-    this._messages = [];
-    this._rowMessages = {};
-    this._messageBubbles = {};
-    this.breakpoints = [];
-    this._shortcuts = {};
+this._messages = [];
+this._rowMessages = {};
+this._messageBubbles = {};
 
-    this._loaded = false;
-
-    this._addBreakpointDelegate = addBreakpointDelegate;
-    this._removeBreakpointDelegate = removeBreakpointDelegate;
-    this._popoverObjectGroup = "popover";
+this._loaded = false;
+this._popoverObjectGroup = "popover";
 }
 
 WebInspector.SourceFrame.prototype = {
 
-    set visible(visible)
-    {
-        this._visible = visible;
-        this._createViewerIfNeeded();
-        if (!visible && this._textViewer)
-            this._textViewer.freeCachedElements();
-            
-    },
+set visible(visible)
+{
+this._visible = visible;
+this._createViewerIfNeeded();
 
-    get executionLine()
-    {
-        return this._executionLine;
-    },
+if (visible) {
+if (this._textViewer && this._scrollTop)
+this._textViewer.element.scrollTop = this._scrollTop;
+if (this._textViewer && this._scrollLeft)
+this._textViewer.element.scrollLeft = this._scrollLeft;
+} else {
+this._hidePopup();
+if (this._textViewer) {
+this._scrollTop = this._textViewer.element.scrollTop;
+this._scrollLeft = this._textViewer.element.scrollLeft;
+this._textViewer.freeCachedElements();
+}
+}
+},
 
-    set executionLine(x)
-    {
-        if (this._executionLine === x)
-            return;
+get executionLine()
+{
+return this._executionLine;
+},
 
-        var previousLine = this._executionLine;
-        this._executionLine = x;
+set executionLine(x)
+{
+if (this._executionLine === x)
+return;
 
-        if (this._textViewer)
-            this._updateExecutionLine(previousLine);
-    },
+var previousLine = this._executionLine;
+this._executionLine = x;
 
-    revealLine: function(lineNumber)
-    {
-        if (this._textViewer)
-            this._textViewer.revealLine(lineNumber - 1, 0);
-        else
-            this._lineNumberToReveal = lineNumber;
-    },
+if (this._textViewer)
+this._updateExecutionLine(previousLine);
+},
 
-    addBreakpoint: function(breakpoint)
-    {
-        this.breakpoints.push(breakpoint);
-        breakpoint.addEventListener("enabled", this._breakpointChanged, this);
-        breakpoint.addEventListener("disabled", this._breakpointChanged, this);
-        breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
-        if (this._textViewer)
-            this._addBreakpointToSource(breakpoint);
-    },
+markDiff: function(diffData)
+{
+if (this._diffLines && this._textViewer)
+this._removeDiffDecorations();
 
-    removeBreakpoint: function(breakpoint)
-    {
-        this.breakpoints.remove(breakpoint);
-        breakpoint.removeEventListener("enabled", null, this);
-        breakpoint.removeEventListener("disabled", null, this);
-        breakpoint.removeEventListener("condition-changed", null, this);
-        if (this._textViewer)
-            this._removeBreakpointFromSource(breakpoint);
-    },
+this._diffLines = diffData;
+if (this._textViewer)
+this._updateDiffDecorations();
+},
 
-    addMessage: function(msg)
-    {
-        // Don't add the message if there is no message or valid line or if the msg isn't an error or warning.
-        if (!msg.message || msg.line <= 0 || !msg.isErrorOrWarning())
-            return;
-        this._messages.push(msg)
-        if (this._textViewer)
-            this._addMessageToSource(msg);
-    },
+revealLine: function(lineNumber)
+{
+if (this._textViewer)
+this._textViewer.revealLine(lineNumber - 1, 0);
+else
+this._lineNumberToReveal = lineNumber;
+},
 
-    clearMessages: function()
-    {
-        for (var line in this._messageBubbles) {
-            var bubble = this._messageBubbles[line];
-            bubble.parentNode.removeChild(bubble);
-        }
+addMessage: function(msg)
+{
 
-        this._messages = [];
-        this._rowMessages = {};
-        this._messageBubbles = {};
-        if (this._textViewer)
-            this._textViewer.resize();
-    },
+if (!msg.message || msg.line <= 0 || !msg.isErrorOrWarning())
+return;
+this._messages.push(msg)
+if (this._textViewer)
+this._addMessageToSource(msg);
+},
 
-    sizeToFitContentHeight: function()
-    {
-        if (this._textViewer)
-            this._textViewer.revalidateDecorationsAndPaint();
-    },
-
-    setContent: function(mimeType, content, url)
-    {
-        this._loaded = true;
-        this._textModel.setText(null, content);
-        this._mimeType = mimeType;
-        this._url = url;
-        this._createViewerIfNeeded();
-    },
-
-    highlightLine: function(line)
-    {
-        if (this._textViewer)
-            this._textViewer.highlightLine(line - 1);
-        else
-            this._lineToHighlight = line;
-    },
-
-    _createViewerIfNeeded: function()
-    {
-        if (!this._visible || !this._loaded || this._textViewer)
-            return;
-
-        this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url);
-        var element = this._textViewer.element;
-        element.addEventListener("keydown", this._keyDown.bind(this), true);
-        element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
-        element.addEventListener("mousedown", this._mouseDown.bind(this), true);
-        element.addEventListener("mousemove", this._mouseMove.bind(this), true);
-        element.addEventListener("scroll", this._scroll.bind(this), true);
-        this._parentElement.appendChild(element);
-
-        this._needsProgramCounterImage = true;
-        this._needsBreakpointImages = true;
-
-        this._textViewer.beginUpdates();
-
-        this._textViewer.mimeType = this._mimeType;
-        this._addExistingMessagesToSource();
-        this._addExistingBreakpointsToSource();
-        this._updateExecutionLine();
-        this._textViewer.resize();
-
-        if (this._lineNumberToReveal) {
-            this.revealLine(this._lineNumberToReveal);
-            delete this._lineNumberToReveal;
-        }
-
-        if (this._pendingMarkRange) {
-            var range = this._pendingMarkRange;
-            this.markAndRevealRange(range);
-            delete this._pendingMarkRange;
-        }
-
-        if (this._lineToHighlight) {
-            this.highlightLine(this._lineToHighlight);
-            delete this._lineToHighlight;
-        }
-        this._textViewer.endUpdates();
-    },
-
-    findSearchMatches: function(query)
-    {
-        var ranges = [];
-
-        // First do case-insensitive search.
-        var regexObject = createSearchRegex(query);
-        this._collectRegexMatches(regexObject, ranges);
-
-        // Then try regex search if user knows the / / hint.
-        try {
-            if (/^\/.*\/$/.test(query))
-                this._collectRegexMatches(new RegExp(query.substring(1, query.length - 1)), ranges);
-        } catch (e) {
-            // Silent catch.
-        }
-        return ranges;
-    },
-
-    _collectRegexMatches: function(regexObject, ranges)
-    {
-        for (var i = 0; i < this._textModel.linesCount; ++i) {
-            var line = this._textModel.line(i);
-            var offset = 0;
-            do {
-                var match = regexObject.exec(line);
-                if (match) {
-                    ranges.push(new WebInspector.TextRange(i, offset + match.index, i, offset + match.index + match[0].length));
-                    offset += match.index + 1;
-                    line = line.substring(match.index + 1);
-                }
-            } while (match)
-        }
-        return ranges;
-    },
-
-    markAndRevealRange: function(range)
-    {
-        if (this._textViewer)
-            this._textViewer.markAndRevealRange(range);
-        else
-            this._pendingMarkRange = range;
-    },
-
-    clearMarkedRange: function()
-    {
-        if (this._textViewer) {
-            this._textViewer.markAndRevealRange(null);
-        } else
-            delete this._pendingMarkRange;
-    },
-
-    _incrementMessageRepeatCount: function(msg, repeatDelta)
-    {
-        if (!msg._resourceMessageLineElement)
-            return;
-
-        if (!msg._resourceMessageRepeatCountElement) {
-            var repeatedElement = document.createElement("span");
-            msg._resourceMessageLineElement.appendChild(repeatedElement);
-            msg._resourceMessageRepeatCountElement = repeatedElement;
-        }
-
-        msg.repeatCount += repeatDelta;
-        msg._resourceMessageRepeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", msg.repeatCount);
-    },
-
-    _breakpointChanged: function(event)
-    {
-        var breakpoint = event.target;
-        var lineNumber = breakpoint.line - 1;
-        if (lineNumber >= this._textModel.linesCount)
-            return;
-
-        if (breakpoint.enabled)
-            this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
-        else
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
-
-        if (breakpoint.condition)
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
-        else
-            this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
-    },
-
-    _updateExecutionLine: function(previousLine)
-    {
-        if (previousLine) {
-            if (previousLine - 1 < this._textModel.linesCount)
-                this._textViewer.removeDecoration(previousLine - 1, "webkit-execution-line");
-        }
-
-        if (!this._executionLine)
-            return;
-
-        if (this._executionLine < this._textModel.linesCount)
-            this._textViewer.addDecoration(this._executionLine - 1, "webkit-execution-line");
-    },
-
-    _addExistingMessagesToSource: function()
-    {
-        var length = this._messages.length;
-        for (var i = 0; i < length; ++i)
-            this._addMessageToSource(this._messages[i]);
-    },
-
-    _addMessageToSource: function(msg)
-    {
-        if (msg.line >= this._textModel.linesCount)
-            return;
-
-        var messageBubbleElement = this._messageBubbles[msg.line];
-        if (!messageBubbleElement || messageBubbleElement.nodeType !== Node.ELEMENT_NODE || !messageBubbleElement.hasStyleClass("webkit-html-message-bubble")) {
-            messageBubbleElement = document.createElement("div");
-            messageBubbleElement.className = "webkit-html-message-bubble";
-            this._messageBubbles[msg.line] = messageBubbleElement;
-            this._textViewer.addDecoration(msg.line - 1, messageBubbleElement);
-        }
-
-        var rowMessages = this._rowMessages[msg.line];
-        if (!rowMessages) {
-            rowMessages = [];
-            this._rowMessages[msg.line] = rowMessages;
-        }
-
-        for (var i = 0; i < rowMessages.length; ++i) {
-            if (rowMessages[i].isEqual(msg, true)) {
-                this._incrementMessageRepeatCount(rowMessages[i], msg.repeatDelta);
-                return;
-            }
-        }
-
-        rowMessages.push(msg);
-
-        var imageURL;
-        switch (msg.level) {
-            case WebInspector.ConsoleMessage.MessageLevel.Error:
-                messageBubbleElement.addStyleClass("webkit-html-error-message");
-                imageURL = "Images/errorIcon.png";
-                break;
-            case WebInspector.ConsoleMessage.MessageLevel.Warning:
-                messageBubbleElement.addStyleClass("webkit-html-warning-message");
-                imageURL = "Images/warningIcon.png";
-                break;
-        }
-
-        var messageLineElement = document.createElement("div");
-        messageLineElement.className = "webkit-html-message-line";
-        messageBubbleElement.appendChild(messageLineElement);
-
-        // Create the image element in the Inspector's document so we can use relative image URLs.
-        var image = document.createElement("img");
-        image.src = imageURL;
-        image.className = "webkit-html-message-icon";
-        messageLineElement.appendChild(image);
-        messageLineElement.appendChild(document.createTextNode(msg.message));
-
-        msg._resourceMessageLineElement = messageLineElement;
-    },
-
-    _addExistingBreakpointsToSource: function()
-    {
-        for (var i = 0; i < this.breakpoints.length; ++i)
-            this._addBreakpointToSource(this.breakpoints[i]);
-    },
-
-    _addBreakpointToSource: function(breakpoint)
-    {
-        var lineNumber = breakpoint.line - 1;
-        if (lineNumber >= this._textModel.linesCount)
-            return;
-
-        this._textModel.setAttribute(lineNumber, "breakpoint", breakpoint);
-        breakpoint.sourceText = this._textModel.line(breakpoint.line - 1);
-
-        this._textViewer.beginUpdates();
-        this._textViewer.addDecoration(lineNumber, "webkit-breakpoint");
-        if (!breakpoint.enabled)
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
-        if (breakpoint.condition)
-            this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
-        this._textViewer.endUpdates();
-    },
-
-    _removeBreakpointFromSource: function(breakpoint)
-    {
-        var lineNumber = breakpoint.line - 1;
-        this._textViewer.beginUpdates();
-        this._textModel.removeAttribute(lineNumber, "breakpoint");
-        this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint");
-        this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
-        this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
-        this._textViewer.endUpdates();
-    },
-
-    _contextMenu: function(event)
-    {
-        var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
-        if (!target)
-            return;
-        var row = target.parentElement;
-
-        var lineNumber = row.lineNumber;
-        var contextMenu = new WebInspector.ContextMenu();
-
-        var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint");
-        if (!breakpoint) {
-            // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint.
-            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._addBreakpointDelegate.bind(this, lineNumber + 1));
-
-            function addConditionalBreakpoint() 
-            {
-                this._addBreakpointDelegate(lineNumber + 1);
-                var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint");
-                if (breakpoint)
-                    this._editBreakpointCondition(breakpoint);
-            }
-
-            contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint..."), addConditionalBreakpoint.bind(this));
-        } else {
-            // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable.
-            contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), WebInspector.panels.scripts.removeBreakpoint.bind(WebInspector.panels.scripts, breakpoint));
-            contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint..."), this._editBreakpointCondition.bind(this, breakpoint));
-            if (breakpoint.enabled)
-                contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), function() { breakpoint.enabled = false; });
-            else
-                contextMenu.appendItem(WebInspector.UIString("Enable Breakpoint"), function() { breakpoint.enabled = true; });
-        }
-        contextMenu.show(event);
-    },
-
-    _scroll: function(event)
-    {
-        this._hidePopup();
-    },
-
-    _mouseDown: function(event)
-    {
-        this._resetHoverTimer();
-        this._hidePopup();
-        if (event.button != 0 || event.altKey || event.ctrlKey || event.metaKey)
-            return;
-        var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
-        if (!target)
-            return;
-        var row = target.parentElement;
-
-        var lineNumber = row.lineNumber;
-
-        var breakpoint = this._textModel.getAttribute(lineNumber, "breakpoint");
-        if (breakpoint) {
-            if (event.shiftKey)
-                breakpoint.enabled = !breakpoint.enabled;
-            else
-                this._removeBreakpointDelegate(breakpoint);
-        } else
-            this._addBreakpointDelegate(lineNumber + 1);
-        event.preventDefault();
-    },
-
-    _mouseMove: function(event)
-    {
-        // Pretend that nothing has happened.
-        if (this._hoverElement === event.target || event.target.hasStyleClass("source-frame-eval-expression"))
-            return;
-
-        this._resetHoverTimer();
-        // User has 500ms to reach the popup.
-        if (this._popup) {
-            var self = this;
-            function doHide()
-            {
-                self._hidePopup();
-                delete self._hidePopupTimer;
-            }
-            this._hidePopupTimer = setTimeout(doHide, 500);
-        }
-
-        this._hoverElement = event.target;
-
-        // Now that cleanup routines are set up above, leave this in case we are not on a break.
-        if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
-            return;
-
-        // We are interested in identifiers and "this" keyword.
-        if (this._hoverElement.hasStyleClass("webkit-javascript-keyword")) {
-            if (this._hoverElement.textContent !== "this")
-                return;
-        } else if (!this._hoverElement.hasStyleClass("webkit-javascript-ident"))
-            return;
-
-        const toolTipDelay = this._popup ? 600 : 1000;
-        this._hoverTimer = setTimeout(this._mouseHover.bind(this, this._hoverElement), toolTipDelay);
-    },
-
-    _resetHoverTimer: function()
-    {
-        if (this._hoverTimer) {
-            clearTimeout(this._hoverTimer);
-            delete this._hoverTimer;
-        }
-    },
-
-    _hidePopup: function()
-    {
-        if (!this._popup)
-            return;
-
-        // Replace higlight element with its contents inplace.
-        var parentElement = this._popup.highlightElement.parentElement;
-        var child = this._popup.highlightElement.firstChild;
-        while (child) {
-            var nextSibling = child.nextSibling;
-            parentElement.insertBefore(child, this._popup.highlightElement);
-            child = nextSibling;
-        }
-        parentElement.removeChild(this._popup.highlightElement);
-
-        this._popup.hide();
-        delete this._popup;
-        InspectorBackend.releaseWrapperObjectGroup(0, this._popoverObjectGroup);
-    },
-
-    _mouseHover: function(element)
-    {
-        delete this._hoverTimer;
-
-        if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
-            return;
-
-        var lineRow = element.enclosingNodeOrSelfWithNodeName("tr");
-        if (!lineRow)
-            return;
-
-        // Collect tokens belonging to evaluated exression.
-        var tokens = [ element ];
-        var token = element.previousSibling;
-        while (token && (token.className === "webkit-javascript-ident" || token.className === "webkit-javascript-keyword" || token.textContent.trim() === ".")) {
-            tokens.push(token);
-            token = token.previousSibling;
-        }
-        tokens.reverse();
-
-        // Wrap them with highlight element.
-        var parentElement = element.parentElement;
-        var nextElement = element.nextSibling;
-        var container = document.createElement("span");
-        for (var i = 0; i < tokens.length; ++i)
-            container.appendChild(tokens[i]);
-        parentElement.insertBefore(container, nextElement);
-        this._showPopup(container);
-    },
-
-    _showPopup: function(element)
-    {
-        function killHidePopupTimer()
-        {
-            if (this._hidePopupTimer) {
-                clearTimeout(this._hidePopupTimer);
-                delete this._hidePopupTimer;
-
-                // We know that we reached the popup, but we might have moved over other elements.
-                // Discard pending command.
-                this._resetHoverTimer();
-            }
-        }
-
-        function showObjectPopup(result)
-        {
-            if (!WebInspector.panels.scripts.paused)
-                return;
-
-            var popupContentElement = null;
-            if (result.type !== "object" && result.type !== "node" && result.type !== "array") {
-                popupContentElement = document.createElement("span");
-                popupContentElement.className = "monospace";
-                popupContentElement.style.whiteSpace = "pre";
-                popupContentElement.textContent = result.description;
-                this._popup = new WebInspector.Popover(popupContentElement);
-                this._popup.show(element);
-            } else {
-                var popupContentElement = document.createElement("div");
-
-                var titleElement = document.createElement("div");
-                titleElement.className = "source-frame-popover-title monospace";
-                titleElement.textContent = result.description;
-                popupContentElement.appendChild(titleElement);
-
-                var section = new WebInspector.ObjectPropertiesSection(result, "", null, false);
-                section.expanded = true;
-                section.element.addStyleClass("source-frame-popover-tree");
-                section.headerElement.addStyleClass("hidden");
-                popupContentElement.appendChild(section.element);
-
-                this._popup = new WebInspector.Popover(popupContentElement);
-                const popupWidth = 300;
-                const popupHeight = 250;
-                this._popup.show(element, popupWidth, popupHeight);
-            }
-            this._popup.highlightElement = element;
-            this._popup.highlightElement.addStyleClass("source-frame-eval-expression");
-            popupContentElement.addEventListener("mousemove", killHidePopupTimer.bind(this), true);
-        }
-
-        function evaluateCallback(result, exception)
-        {
-            if (exception)
-                return;
-            if (!WebInspector.panels.scripts.paused)
-                return;
-            showObjectPopup.call(this, result);
-        }
-        WebInspector.panels.scripts.evaluateInSelectedCallFrame(element.textContent, false, this._popoverObjectGroup, evaluateCallback.bind(this));
-    },
-
-    _editBreakpointCondition: function(breakpoint)
-    {
-        this._showBreakpointConditionPopup(breakpoint.line);
-
-        function committed(element, newText)
-        {
-            breakpoint.condition = newText;
-            dismissed.call(this);
-        }
-
-        function dismissed()
-        {
-            if (this._conditionElement)
-                this._textViewer.removeDecoration(breakpoint.line - 1, this._conditionElement);
-            delete this._conditionEditorElement;
-            delete this._conditionElement;
-        }
-
-        var dismissedHandler = dismissed.bind(this);
-        this._conditionEditorElement.addEventListener("blur", dismissedHandler, false);
-
-        WebInspector.startEditing(this._conditionEditorElement, committed.bind(this), dismissedHandler);
-        this._conditionEditorElement.value = breakpoint.condition;
-        this._conditionEditorElement.select();
-    },
-
-    _showBreakpointConditionPopup: function(lineNumber)
-    {
-        this._conditionElement = this._createConditionElement(lineNumber);
-        this._textViewer.addDecoration(lineNumber - 1, this._conditionElement);
-    },
-
-    _createConditionElement: function(lineNumber)
-    {
-        var conditionElement = document.createElement("div");
-        conditionElement.className = "source-frame-breakpoint-condition";
-
-        var labelElement = document.createElement("label");
-        labelElement.className = "source-frame-breakpoint-message";
-        labelElement.htmlFor = "source-frame-breakpoint-condition";
-        labelElement.appendChild(document.createTextNode(WebInspector.UIString("The breakpoint on line %d will stop only if this expression is true:", lineNumber)));
-        conditionElement.appendChild(labelElement);
-
-        var editorElement = document.createElement("input");
-        editorElement.id = "source-frame-breakpoint-condition";
-        editorElement.className = "monospace";
-        editorElement.type = "text"
-        conditionElement.appendChild(editorElement);
-        this._conditionEditorElement = editorElement;
-
-        return conditionElement;
-    },
-
-    _keyDown: function(event)
-    {
-        var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
-        var handler = this._shortcuts[shortcut];
-        if (handler) {
-            handler(event);
-            event.preventDefault();
-        } else
-            WebInspector.documentKeyDown(event);
-    },
-
-    _evalSelectionInCallFrame: function(event)
-    {
-        if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
-            return;
-
-        var selection = this.element.contentWindow.getSelection();
-        if (!selection.rangeCount)
-            return;
-
-        var expression = selection.getRangeAt(0).toString().trimWhitespace();
-        WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result, exception) {
-            WebInspector.showConsole();
-            var commandMessage = new WebInspector.ConsoleCommand(expression);
-            WebInspector.console.addMessage(commandMessage);
-            WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, exception, commandMessage));
-        });
-    },
-
-    resize: function()
-    {
-        if (this._textViewer)
-            this._textViewer.resize();
-    }
+clearMessages: function()
+{
+for (var line in this._messageBubbles) {
+var bubble = this._messageBubbles[line];
+bubble.parentNode.removeChild(bubble);
 }
 
+this._messages = [];
+this._rowMessages = {};
+this._messageBubbles = {};
+if (this._textViewer)
+this._textViewer.resize();
+},
+
+sizeToFitContentHeight: function()
+{
+if (this._textViewer)
+this._textViewer.revalidateDecorationsAndPaint();
+},
+
+setContent: function(mimeType, content, url)
+{
+this._loaded = true;
+this._textModel.setText(null, content);
+this._mimeType = mimeType;
+this._url = url;
+this._createViewerIfNeeded();
+},
+
+updateContent: function(content)
+{
+this._textModel.setText(null, content);
+},
+
+get textModel()
+{
+return this._textModel;
+},
+
+get scrollTop()
+{
+return this._textViewer ? this._textViewer.element.scrollTop : 0;
+},
+
+set scrollTop(scrollTop)
+{
+if (this._textViewer)
+this._textViewer.element.scrollTop = scrollTop;
+},
+
+highlightLine: function(line)
+{
+if (this._textViewer)
+this._textViewer.highlightLine(line - 1);
+else
+this._lineToHighlight = line;
+},
+
+clearLineHighlight: function()
+{
+if (this._textViewer)
+this._textViewer.clearLineHighlight();
+else
+delete this._lineToHighlight;
+},
+
+_createViewerIfNeeded: function()
+{
+if (!this._visible || !this._loaded || this._textViewer)
+return;
+
+this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url);
+var element = this._textViewer.element;
+element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
+element.addEventListener("mousedown", this._mouseDown.bind(this), true);
+element.addEventListener("mousemove", this._mouseMove.bind(this), true);
+element.addEventListener("scroll", this._scroll.bind(this), true);
+this._parentElement.appendChild(element);
+
+this._textViewer.beginUpdates();
+
+this._textViewer.mimeType = this._mimeType;
+this._addExistingMessagesToSource();
+this._updateExecutionLine();
+this._updateDiffDecorations();
+this._textViewer.resize();
+
+if (this._lineNumberToReveal) {
+this.revealLine(this._lineNumberToReveal);
+delete this._lineNumberToReveal;
+}
+
+if (this._pendingMarkRange) {
+var range = this._pendingMarkRange;
+this.markAndRevealRange(range);
+delete this._pendingMarkRange;
+}
+
+if (this._lineToHighlight) {
+this.highlightLine(this._lineToHighlight);
+delete this._lineToHighlight;
+}
+
+var breakpoints = this._breakpoints();
+for (var i = 0; i < breakpoints.length; ++i)
+this._addBreakpoint(breakpoints[i]);
+WebInspector.debuggerModel.addEventListener("breakpoint-added", this._breakpointAdded, this);
+
+this._textViewer.endUpdates();
+
+if (this._delegate.canEditScripts())
+this._textViewer.editCallback = this._editLine.bind(this);
+},
+
+findSearchMatches: function(query)
+{
+var ranges = [];
+
+
+var regexObject = createSearchRegex(query);
+this._collectRegexMatches(regexObject, ranges);
+
+
+try {
+if (/^\/.*\/$/.test(query))
+this._collectRegexMatches(new RegExp(query.substring(1, query.length - 1)), ranges);
+} catch (e) {
+
+}
+return ranges;
+},
+
+_collectRegexMatches: function(regexObject, ranges)
+{
+for (var i = 0; i < this._textModel.linesCount; ++i) {
+var line = this._textModel.line(i);
+var offset = 0;
+do {
+var match = regexObject.exec(line);
+if (match) {
+ranges.push(new WebInspector.TextRange(i, offset + match.index, i, offset + match.index + match[0].length));
+offset += match.index + 1;
+line = line.substring(match.index + 1);
+}
+} while (match)
+}
+return ranges;
+},
+
+markAndRevealRange: function(range)
+{
+if (this._textViewer)
+this._textViewer.markAndRevealRange(range);
+else
+this._pendingMarkRange = range;
+},
+
+clearMarkedRange: function()
+{
+if (this._textViewer) {
+this._textViewer.markAndRevealRange(null);
+} else
+delete this._pendingMarkRange;
+},
+
+_incrementMessageRepeatCount: function(msg, repeatDelta)
+{
+if (!msg._resourceMessageLineElement)
+return;
+
+if (!msg._resourceMessageRepeatCountElement) {
+var repeatedElement = document.createElement("span");
+msg._resourceMessageLineElement.appendChild(repeatedElement);
+msg._resourceMessageRepeatCountElement = repeatedElement;
+}
+
+msg.repeatCount += repeatDelta;
+msg._resourceMessageRepeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", msg.repeatCount);
+},
+
+_breakpointChanged: function(event)
+{
+var breakpoint = event.target;
+var lineNumber = breakpoint.line - 1;
+if (lineNumber >= this._textModel.linesCount)
+return;
+
+if (breakpoint.enabled)
+this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
+else
+this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
+
+if (breakpoint.condition)
+this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
+else
+this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
+},
+
+_updateExecutionLine: function(previousLine)
+{
+if (previousLine) {
+if (previousLine - 1 < this._textModel.linesCount)
+this._textViewer.removeDecoration(previousLine - 1, "webkit-execution-line");
+}
+
+if (!this._executionLine)
+return;
+
+if (this._executionLine < this._textModel.linesCount)
+this._textViewer.addDecoration(this._executionLine - 1, "webkit-execution-line");
+},
+
+_updateDiffDecorations: function()
+{
+if (!this._diffLines)
+return;
+
+function addDecorations(textViewer, lines, className)
+{
+for (var i = 0; i < lines.length; ++i)
+textViewer.addDecoration(lines[i], className);
+}
+addDecorations(this._textViewer, this._diffLines.added, "webkit-added-line");
+addDecorations(this._textViewer, this._diffLines.removed, "webkit-removed-line");
+addDecorations(this._textViewer, this._diffLines.changed, "webkit-changed-line");
+},
+
+_removeDiffDecorations: function()
+{
+function removeDecorations(textViewer, lines, className)
+{
+for (var i = 0; i < lines.length; ++i)
+textViewer.removeDecoration(lines[i], className);
+}
+removeDecorations(this._textViewer, this._diffLines.added, "webkit-added-line");
+removeDecorations(this._textViewer, this._diffLines.removed, "webkit-removed-line");
+removeDecorations(this._textViewer, this._diffLines.changed, "webkit-changed-line");
+},
+
+_addExistingMessagesToSource: function()
+{
+var length = this._messages.length;
+for (var i = 0; i < length; ++i)
+this._addMessageToSource(this._messages[i]);
+},
+
+_addMessageToSource: function(msg)
+{
+if (msg.line >= this._textModel.linesCount)
+return;
+
+var messageBubbleElement = this._messageBubbles[msg.line];
+if (!messageBubbleElement || messageBubbleElement.nodeType !== Node.ELEMENT_NODE || !messageBubbleElement.hasStyleClass("webkit-html-message-bubble")) {
+messageBubbleElement = document.createElement("div");
+messageBubbleElement.className = "webkit-html-message-bubble";
+this._messageBubbles[msg.line] = messageBubbleElement;
+this._textViewer.addDecoration(msg.line - 1, messageBubbleElement);
+}
+
+var rowMessages = this._rowMessages[msg.line];
+if (!rowMessages) {
+rowMessages = [];
+this._rowMessages[msg.line] = rowMessages;
+}
+
+for (var i = 0; i < rowMessages.length; ++i) {
+if (rowMessages[i].isEqual(msg)) {
+this._incrementMessageRepeatCount(rowMessages[i], msg.repeatDelta);
+return;
+}
+}
+
+rowMessages.push(msg);
+
+var imageURL;
+switch (msg.level) {
+case WebInspector.ConsoleMessage.MessageLevel.Error:
+messageBubbleElement.addStyleClass("webkit-html-error-message");
+imageURL = "Images/errorIcon.png";
+break;
+case WebInspector.ConsoleMessage.MessageLevel.Warning:
+messageBubbleElement.addStyleClass("webkit-html-warning-message");
+imageURL = "Images/warningIcon.png";
+break;
+}
+
+var messageLineElement = document.createElement("div");
+messageLineElement.className = "webkit-html-message-line";
+messageBubbleElement.appendChild(messageLineElement);
+
+
+var image = document.createElement("img");
+image.src = imageURL;
+image.className = "webkit-html-message-icon";
+messageLineElement.appendChild(image);
+messageLineElement.appendChild(document.createTextNode(msg.message));
+
+msg._resourceMessageLineElement = messageLineElement;
+},
+
+_breakpointAdded: function(event)
+{
+var breakpoint = event.data;
+
+if (this._shouldDisplayBreakpoint(breakpoint))
+this._addBreakpoint(breakpoint);
+},
+
+_addBreakpoint: function(breakpoint)
+{
+var lineNumber = breakpoint.line - 1;
+if (lineNumber >= this._textModel.linesCount)
+return;
+
+breakpoint.addEventListener("enable-changed", this._breakpointChanged, this);
+breakpoint.addEventListener("condition-changed", this._breakpointChanged, this);
+breakpoint.addEventListener("removed", this._breakpointRemoved, this);
+
+breakpoint.sourceText = this._textModel.line(lineNumber);
+
+this._textViewer.beginUpdates();
+this._textViewer.addDecoration(lineNumber, "webkit-breakpoint");
+if (!breakpoint.enabled)
+this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-disabled");
+if (breakpoint.condition)
+this._textViewer.addDecoration(lineNumber, "webkit-breakpoint-conditional");
+this._textViewer.endUpdates();
+},
+
+_breakpointRemoved: function(event)
+{
+var breakpoint = event.target;
+
+breakpoint.removeEventListener("enable-changed", null, this);
+breakpoint.removeEventListener("condition-changed", null, this);
+breakpoint.removeEventListener("removed", null, this);
+
+var lineNumber = breakpoint.line - 1;
+this._textViewer.beginUpdates();
+this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint");
+this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled");
+this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-conditional");
+this._textViewer.endUpdates();
+},
+
+_contextMenu: function(event)
+{
+if (!WebInspector.panels.scripts)
+return;
+
+var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
+if (!target)
+return;
+var lineNumber = target.parentElement.lineNumber + 1;
+
+var contextMenu = new WebInspector.ContextMenu();
+
+contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._continueToLine.bind(this, lineNumber));
+
+var breakpoint = this._findBreakpoint(lineNumber);
+if (!breakpoint) {
+
+contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._setBreakpoint.bind(this, lineNumber));
+
+function addConditionalBreakpoint()
+{
+this._setBreakpoint(lineNumber);
+var breakpoint = this._findBreakpoint(lineNumber);
+if (breakpoint)
+this._editBreakpointCondition(breakpoint);
+}
+
+contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this));
+} else {
+
+contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpoint.remove.bind(breakpoint));
+contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), this._editBreakpointCondition.bind(this, breakpoint));
+if (breakpoint.enabled)
+contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), function() { breakpoint.enabled = false; });
+else
+contextMenu.appendItem(WebInspector.UIString("Enable Breakpoint"), function() { breakpoint.enabled = true; });
+}
+contextMenu.show(event);
+},
+
+_scroll: function(event)
+{
+this._hidePopup();
+},
+
+_mouseDown: function(event)
+{
+this._resetHoverTimer();
+this._hidePopup();
+if (event.button != 0 || event.altKey || event.ctrlKey || event.metaKey)
+return;
+var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number");
+if (!target)
+return;
+var lineNumber = target.parentElement.lineNumber + 1;
+
+var breakpoint = this._findBreakpoint(lineNumber);
+if (breakpoint) {
+if (event.shiftKey)
+breakpoint.enabled = !breakpoint.enabled;
+else
+breakpoint.remove();
+} else
+this._setBreakpoint(lineNumber);
+event.preventDefault();
+},
+
+_mouseMove: function(event)
+{
+
+if (this._hoverElement === event.target || event.target.hasStyleClass("source-frame-eval-expression"))
+return;
+
+this._resetHoverTimer();
+
+if (this._popup) {
+var self = this;
+function doHide()
+{
+self._hidePopup();
+delete self._hidePopupTimer;
+}
+if (!("_hidePopupTimer" in this))
+this._hidePopupTimer = setTimeout(doHide, 500);
+}
+
+this._hoverElement = event.target;
+
+
+if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+return;
+
+
+if (this._hoverElement.hasStyleClass("webkit-javascript-keyword")) {
+if (this._hoverElement.textContent !== "this")
+return;
+} else if (!this._hoverElement.hasStyleClass("webkit-javascript-ident"))
+return;
+
+const toolTipDelay = this._popup ? 600 : 1000;
+this._hoverTimer = setTimeout(this._mouseHover.bind(this, this._hoverElement), toolTipDelay);
+},
+
+_resetHoverTimer: function()
+{
+if (this._hoverTimer) {
+clearTimeout(this._hoverTimer);
+delete this._hoverTimer;
+}
+},
+
+_hidePopup: function()
+{
+if (!this._popup)
+return;
+
+
+var parentElement = this._popup.highlightElement.parentElement;
+var child = this._popup.highlightElement.firstChild;
+while (child) {
+var nextSibling = child.nextSibling;
+parentElement.insertBefore(child, this._popup.highlightElement);
+child = nextSibling;
+}
+parentElement.removeChild(this._popup.highlightElement);
+
+this._popup.hide();
+delete this._popup;
+InspectorBackend.releaseWrapperObjectGroup(0, this._popoverObjectGroup);
+},
+
+_mouseHover: function(element)
+{
+delete this._hoverTimer;
+
+if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+return;
+
+var lineRow = element.enclosingNodeOrSelfWithNodeName("tr");
+if (!lineRow)
+return;
+
+
+var tokens = [ element ];
+var token = element.previousSibling;
+while (token && (token.className === "webkit-javascript-ident" || token.className === "webkit-javascript-keyword" || token.textContent.trim() === ".")) {
+tokens.push(token);
+token = token.previousSibling;
+}
+tokens.reverse();
+
+
+var parentElement = element.parentElement;
+var nextElement = element.nextSibling;
+var container = document.createElement("span");
+for (var i = 0; i < tokens.length; ++i)
+container.appendChild(tokens[i]);
+parentElement.insertBefore(container, nextElement);
+this._showPopup(container);
+},
+
+_showPopup: function(element)
+{
+function killHidePopupTimer()
+{
+if (this._hidePopupTimer) {
+clearTimeout(this._hidePopupTimer);
+delete this._hidePopupTimer;
+
+
+
+this._resetHoverTimer();
+}
+}
+
+function showObjectPopup(result)
+{
+if (!WebInspector.panels.scripts.paused)
+return;
+
+var popupContentElement = null;
+if (result.type !== "object" && result.type !== "node" && result.type !== "array") {
+popupContentElement = document.createElement("span");
+popupContentElement.className = "monospace console-formatted-" + result.type;
+popupContentElement.style.whiteSpace = "pre";
+popupContentElement.textContent = result.description;
+if (result.type === "string")
+popupContentElement.textContent = "\"" + popupContentElement.textContent + "\"";
+this._popup = new WebInspector.Popover(popupContentElement);
+this._popup.show(element);
+} else {
+var popupContentElement = document.createElement("div");
+
+var titleElement = document.createElement("div");
+titleElement.className = "source-frame-popover-title monospace";
+titleElement.textContent = result.description;
+popupContentElement.appendChild(titleElement);
+
+var section = new WebInspector.ObjectPropertiesSection(result, "", null, false);
+section.expanded = true;
+section.element.addStyleClass("source-frame-popover-tree");
+section.headerElement.addStyleClass("hidden");
+popupContentElement.appendChild(section.element);
+
+this._popup = new WebInspector.Popover(popupContentElement);
+const popupWidth = 300;
+const popupHeight = 250;
+this._popup.show(element, popupWidth, popupHeight);
+}
+this._popup.highlightElement = element;
+this._popup.highlightElement.addStyleClass("source-frame-eval-expression");
+popupContentElement.addEventListener("mousemove", killHidePopupTimer.bind(this), true);
+}
+
+function evaluateCallback(result)
+{
+if (result.isError())
+return;
+if (!WebInspector.panels.scripts.paused)
+return;
+showObjectPopup.call(this, result);
+}
+WebInspector.panels.scripts.evaluateInSelectedCallFrame(element.textContent, false, this._popoverObjectGroup, evaluateCallback.bind(this));
+},
+
+_editBreakpointCondition: function(breakpoint)
+{
+this._showBreakpointConditionPopup(breakpoint.line);
+
+function committed(element, newText)
+{
+breakpoint.condition = newText;
+dismissed.call(this);
+}
+
+function dismissed()
+{
+if (this._conditionElement)
+this._textViewer.removeDecoration(breakpoint.line - 1, this._conditionElement);
+delete this._conditionEditorElement;
+delete this._conditionElement;
+}
+
+var dismissedHandler = dismissed.bind(this);
+this._conditionEditorElement.addEventListener("blur", dismissedHandler, false);
+
+WebInspector.startEditing(this._conditionEditorElement, committed.bind(this), dismissedHandler);
+this._conditionEditorElement.value = breakpoint.condition;
+this._conditionEditorElement.select();
+},
+
+_showBreakpointConditionPopup: function(lineNumber)
+{
+this._conditionElement = this._createConditionElement(lineNumber);
+this._textViewer.addDecoration(lineNumber - 1, this._conditionElement);
+},
+
+_createConditionElement: function(lineNumber)
+{
+var conditionElement = document.createElement("div");
+conditionElement.className = "source-frame-breakpoint-condition";
+
+var labelElement = document.createElement("label");
+labelElement.className = "source-frame-breakpoint-message";
+labelElement.htmlFor = "source-frame-breakpoint-condition";
+labelElement.appendChild(document.createTextNode(WebInspector.UIString("The breakpoint on line %d will stop only if this expression is true:", lineNumber)));
+conditionElement.appendChild(labelElement);
+
+var editorElement = document.createElement("input");
+editorElement.id = "source-frame-breakpoint-condition";
+editorElement.className = "monospace";
+editorElement.type = "text"
+conditionElement.appendChild(editorElement);
+this._conditionEditorElement = editorElement;
+
+return conditionElement;
+},
+
+_evalSelectionInCallFrame: function(event)
+{
+if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)
+return;
+
+var selection = this.element.contentWindow.getSelection();
+if (!selection.rangeCount)
+return;
+
+var expression = selection.getRangeAt(0).toString().trim();
+WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, false, "console", function(result) {
+WebInspector.showConsole();
+var commandMessage = new WebInspector.ConsoleCommand(expression);
+WebInspector.console.addMessage(commandMessage);
+WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));
+});
+},
+
+resize: function()
+{
+if (this._textViewer)
+this._textViewer.resize();
+},
+
+_continueToLine: function(lineNumber)
+{
+var sourceID = this._sourceIDForLine(lineNumber);
+WebInspector.panels.scripts.continueToLine(sourceID, lineNumber);
+},
+
+_editLine: function(lineNumber, newContent, cancelEditingCallback)
+{
+lineNumber += 1;
+
+var lines = [];
+for (var i = 0; i < this._textModel.linesCount; ++i) {
+if (i === lineNumber - 1)
+lines.push(newContent);
+else
+lines.push(this._textModel.line(i));
+}
+
+var editData = {};
+editData.sourceID = this._sourceIDForLine(lineNumber);
+editData.content = lines.join("\n");
+editData.line = lineNumber;
+editData.linesCountToShift = newContent.split("\n").length - 1;
+this._doEditLine(editData, cancelEditingCallback);
+},
+
+_revertEditLine: function(editData, contentToRevertTo)
+{
+var newEditData = {};
+newEditData.sourceID = editData.sourceID;
+newEditData.content = contentToRevertTo;
+newEditData.line = editData.line;
+newEditData.linesCountToShift = -editData.linesCountToShift;
+this._doEditLine(newEditData);
+},
+
+_doEditLine: function(editData, cancelEditingCallback)
+{
+var revertEditingCallback = this._revertEditLine.bind(this, editData);
+var commitEditingCallback = this._delegate.editLineComplete.bind(this._delegate, revertEditingCallback);
+WebInspector.panels.scripts.editScriptSource(editData, commitEditingCallback, cancelEditingCallback);
+},
+
+_setBreakpoint: function(lineNumber)
+{
+var sourceID = this._sourceIDForLine(lineNumber);
+WebInspector.debuggerModel.setBreakpoint(sourceID, this._url, lineNumber, true, "");
+if (!WebInspector.panels.scripts.breakpointsActivated)
+WebInspector.panels.scripts.toggleBreakpointsClicked();
+},
+
+_breakpoints: function()
+{
+var sourceIDs = {};
+var scripts = this._delegate.scripts();
+for (var i = 0; i < scripts.length; ++i)
+sourceIDs[scripts[i].sourceID] = true;
+function filter(breakpoint)
+{
+return breakpoint.sourceID in sourceIDs;
+}
+return WebInspector.debuggerModel.findBreakpoints(filter);
+},
+
+_findBreakpoint: function(lineNumber)
+{
+var sourceID = this._sourceIDForLine(lineNumber);
+return WebInspector.debuggerModel.findBreakpoint(sourceID, lineNumber);
+},
+
+_shouldDisplayBreakpoint: function(breakpoint)
+{
+var scripts = this._delegate.scripts();
+for (var i = 0; i < scripts.length; ++i) {
+if (breakpoint.sourceID === scripts[i].sourceID)
+return true;
+}
+return false;
+},
+
+_sourceIDForLine: function(lineNumber)
+{
+var sourceID = null;
+var scripts = this._delegate.scripts();
+var closestStartingLine = 0;
+for (var i = 0; i < scripts.length; ++i) {
+var script = scripts[i];
+if (script.startingLine <= lineNumber && script.startingLine >= closestStartingLine) {
+closestStartingLine = script.startingLine;
+sourceID = script.sourceID;
+}
+}
+return sourceID;
+}
+}
 
 WebInspector.SourceFrame.prototype.__proto__ = WebInspector.Object.prototype;
 
-/* DOMSyntaxHighlighter.js */
+WebInspector.SourceFrameDelegate = function()
+{
+}
 
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+WebInspector.SourceFrameDelegate.prototype = {
+canEditScripts: function()
+{
+
+},
+
+editLineComplete: function(revertEditLineCallback, newContent)
+{
+
+},
+
+scripts: function()
+{
+
+}
+}
+
+
+
+
 
 WebInspector.DOMSyntaxHighlighter = function(mimeType)
 {
-    this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
+this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
 }
 
 WebInspector.DOMSyntaxHighlighter.prototype = {
-    createSpan: function(content, className)
-    {
-        var span = document.createElement("span");
-        span.className = "webkit-" + className;
-        span.appendChild(document.createTextNode(content));
-        return span;
-    },
+createSpan: function(content, className)
+{
+var span = document.createElement("span");
+span.className = "webkit-" + className;
+span.appendChild(document.createTextNode(content));
+return span;
+},
 
-    syntaxHighlightNode: function(node)
-    {
-        this._tokenizer.condition = this._tokenizer.initialCondition;
-        var lines = node.textContent.split("\n");
-        node.removeChildren();
+syntaxHighlightNode: function(node)
+{
+this._tokenizer.condition = this._tokenizer.initialCondition;
+var lines = node.textContent.split("\n");
+node.removeChildren();
 
-        for (var i = lines[0].length ? 0 : 1; i < lines.length; ++i) {
-            var line = lines[i];
-            var plainTextStart = 0;
-            this._tokenizer.line = line;
-            var column = 0;
-            do {
-                var newColumn = this._tokenizer.nextToken(column);
-                var tokenType = this._tokenizer.tokenType;
-                if (tokenType) {
-                    if (column > plainTextStart) {
-                        var plainText = line.substring(plainTextStart, column);
-                        node.appendChild(document.createTextNode(plainText));
-                    }
-                    var token = line.substring(column, newColumn);
-                    node.appendChild(this.createSpan(token, tokenType));
-                    plainTextStart = newColumn;
-                }
-                column = newColumn;
-           } while (column < line.length)
+for (var i = lines[0].length ? 0 : 1; i < lines.length; ++i) {
+var line = lines[i];
+var plainTextStart = 0;
+this._tokenizer.line = line;
+var column = 0;
+do {
+var newColumn = this._tokenizer.nextToken(column);
+var tokenType = this._tokenizer.tokenType;
+if (tokenType) {
+if (column > plainTextStart) {
+var plainText = line.substring(plainTextStart, column);
+node.appendChild(document.createTextNode(plainText));
+}
+var token = line.substring(column, newColumn);
+node.appendChild(this.createSpan(token, tokenType));
+plainTextStart = newColumn;
+}
+column = newColumn;
+} while (column < line.length)
 
-           if (plainTextStart < line.length) {
-               var plainText = line.substring(plainTextStart, line.length);
-               node.appendChild(document.createTextNode(plainText));
-           }
-           if (i < lines.length - 1)
-               node.appendChild(document.createElement("br"));
-        }
-    }
+if (plainTextStart < line.length) {
+var plainText = line.substring(plainTextStart, line.length);
+node.appendChild(document.createTextNode(plainText));
+}
+if (i < lines.length - 1)
+node.appendChild(document.createElement("br"));
+}
+}
 }
 
-/* TextEditorModel.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.TextRange = function(startLine, startColumn, endLine, endColumn)
 {
-    this.startLine = startLine;
-    this.startColumn = startColumn;
-    this.endLine = endLine;
-    this.endColumn = endColumn;
+this.startLine = startLine;
+this.startColumn = startColumn;
+this.endLine = endLine;
+this.endColumn = endColumn;
 }
 
 WebInspector.TextRange.prototype = {
-    isEmpty: function()
-    {
-        return this.startLine === this.endLine && this.startColumn === this.endColumn;
-    },
+isEmpty: function()
+{
+return this.startLine === this.endLine && this.startColumn === this.endColumn;
+},
 
-    get linesCount()
-    {
-        return this.endLine - this.startLine;
-    },
+get linesCount()
+{
+return this.endLine - this.startLine;
+},
 
-    clone: function()
-    {
-        return new WebInspector.TextRange(this.startLine, this.startColumn, this.endLine, this.endColumn); 
-    }
+clone: function()
+{
+return new WebInspector.TextRange(this.startLine, this.startColumn, this.endLine, this.endColumn); 
+}
 }
 
 WebInspector.TextEditorModel = function()
 {
-    this._lines = [""];
-    this._attributes = [];
-    this._undoStack = [];
-    this._noPunctuationRegex = /[^ !%&()*+,-.:;<=>?\[\]\^{|}~]+/;
+this._lines = [""];
+this._attributes = [];
+this._undoStack = [];
+this._noPunctuationRegex = /[^ !%&()*+,-.:;<=>?\[\]\^{|}~]+/;
 }
 
 WebInspector.TextEditorModel.prototype = {
-    set changeListener(changeListener)
-    {
-        this._changeListener = changeListener;
-    },
+set changeListener(changeListener)
+{
+this._changeListener = changeListener;
+},
 
-    get linesCount()
-    {
-        return this._lines.length;
-    },
+get linesCount()
+{
+return this._lines.length;
+},
 
-    line: function(lineNumber)
-    {
-        if (lineNumber >= this._lines.length)
-            throw "Out of bounds:" + lineNumber;
-        return this._lines[lineNumber];
-    },
+line: function(lineNumber)
+{
+if (lineNumber >= this._lines.length)
+throw "Out of bounds:" + lineNumber;
+return this._lines[lineNumber];
+},
 
-    lineLength: function(lineNumber)
-    {
-        return this._lines[lineNumber].length;
-    },
+lineLength: function(lineNumber)
+{
+return this._lines[lineNumber].length;
+},
 
-    setText: function(range, text)
-    {
-        if (!range)
-            range = new WebInspector.TextRange(0, 0, this._lines.length - 1, this._lines[this._lines.length - 1].length);
-        var command = this._pushUndoableCommand(range, text);
-        var newRange = this._innerSetText(range, text);
-        command.range = newRange.clone();
+setText: function(range, text)
+{
+if (!range)
+range = new WebInspector.TextRange(0, 0, this._lines.length - 1, this._lines[this._lines.length - 1].length);
+var command = this._pushUndoableCommand(range, text);
+var newRange = this._innerSetText(range, text);
+command.range = newRange.clone();
 
-        if (this._changeListener)
-            this._changeListener(range, newRange, command.text, text);
-        return newRange;
-    },
+if (this._changeListener)
+this._changeListener(range, newRange, command.text, text);
+return newRange;
+},
 
-    set replaceTabsWithSpaces(replaceTabsWithSpaces)
-    {
-        this._replaceTabsWithSpaces = replaceTabsWithSpaces;
-    },
+set replaceTabsWithSpaces(replaceTabsWithSpaces)
+{
+this._replaceTabsWithSpaces = replaceTabsWithSpaces;
+},
 
-    _innerSetText: function(range, text)
-    {
-        this._eraseRange(range);
-        if (text === "")
-            return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn);
+_innerSetText: function(range, text)
+{
+this._eraseRange(range);
+if (text === "")
+return new WebInspector.TextRange(range.startLine, range.startColumn, range.startLine, range.startColumn);
 
-        var newLines = text.split("\n");
-        this._replaceTabsIfNeeded(newLines);
+var newLines = text.split("\n");
+this._replaceTabsIfNeeded(newLines);
 
-        var prefix = this._lines[range.startLine].substring(0, range.startColumn);
-        var prefixArguments = this._arguments
-        var suffix = this._lines[range.startLine].substring(range.startColumn);
+var prefix = this._lines[range.startLine].substring(0, range.startColumn);
+var prefixArguments = this._arguments
+var suffix = this._lines[range.startLine].substring(range.startColumn);
 
-        var postCaret = prefix.length;
-        // Insert text.
-        if (newLines.length === 1) {
-            this._setLine(range.startLine, prefix + newLines[0] + suffix);
-            postCaret += newLines[0].length;
-        } else {
-            this._setLine(range.startLine, prefix + newLines[0]);
-            for (var i = 1; i < newLines.length; ++i)
-                this._insertLine(range.startLine + i, newLines[i]);
-            this._setLine(range.startLine + newLines.length - 1, newLines[newLines.length - 1] + suffix);
-            postCaret = newLines[newLines.length - 1].length;
-        }
-        return new WebInspector.TextRange(range.startLine, range.startColumn,
-                                          range.startLine + newLines.length - 1, postCaret);
-    },
+var postCaret = prefix.length;
 
-    _replaceTabsIfNeeded: function(lines)
-    {
-        if (!this._replaceTabsWithSpaces)
-            return;
-        var spaces = [ "    ", "   ", "  ", " "];
-        for (var i = 0; i < lines.length; ++i) {
-            var line = lines[i];
-            var index = line.indexOf("\t");
-            while (index !== -1) {
-                line = line.substring(0, index) + spaces[index % 4] + line.substring(index + 1);
-                index = line.indexOf("\t", index + 1);
-            }
-            lines[i] = line;
-        }
-    },
+if (newLines.length === 1) {
+this._setLine(range.startLine, prefix + newLines[0] + suffix);
+postCaret += newLines[0].length;
+} else {
+this._setLine(range.startLine, prefix + newLines[0]);
+for (var i = 1; i < newLines.length; ++i)
+this._insertLine(range.startLine + i, newLines[i]);
+this._setLine(range.startLine + newLines.length - 1, newLines[newLines.length - 1] + suffix);
+postCaret = newLines[newLines.length - 1].length;
+}
+return new WebInspector.TextRange(range.startLine, range.startColumn,
+range.startLine + newLines.length - 1, postCaret);
+},
 
-    _eraseRange: function(range)
-    {
-        if (range.isEmpty())
-            return;
+_replaceTabsIfNeeded: function(lines)
+{
+if (!this._replaceTabsWithSpaces)
+return;
+var spaces = [ "    ", "   ", "  ", " "];
+for (var i = 0; i < lines.length; ++i) {
+var line = lines[i];
+var index = line.indexOf("\t");
+while (index !== -1) {
+line = line.substring(0, index) + spaces[index % 4] + line.substring(index + 1);
+index = line.indexOf("\t", index + 1);
+}
+lines[i] = line;
+}
+},
 
-        var prefix = this._lines[range.startLine].substring(0, range.startColumn);
-        var suffix = this._lines[range.endLine].substring(range.endColumn);
+_eraseRange: function(range)
+{
+if (range.isEmpty())
+return;
 
-        if (range.endLine > range.startLine)
-            this._removeLines(range.startLine + 1, range.endLine - range.startLine);
-        this._setLine(range.startLine, prefix + suffix);
-    },
+var prefix = this._lines[range.startLine].substring(0, range.startColumn);
+var suffix = this._lines[range.endLine].substring(range.endColumn);
 
-    _setLine: function(lineNumber, text)
-    {
-        this._lines[lineNumber] = text;
-    },
+if (range.endLine > range.startLine)
+this._removeLines(range.startLine + 1, range.endLine - range.startLine);
+this._setLine(range.startLine, prefix + suffix);
+},
 
-    _removeLines: function(fromLine, count)
-    {
-        this._lines.splice(fromLine, count);
-        this._attributes.splice(fromLine, count);
-    },
+_setLine: function(lineNumber, text)
+{
+this._lines[lineNumber] = text;
+},
 
-    _insertLine: function(lineNumber, text)
-    {
-        this._lines.splice(lineNumber, 0, text);
-        this._attributes.splice(lineNumber, 0, {});
-    },
+_removeLines: function(fromLine, count)
+{
+this._lines.splice(fromLine, count);
+this._attributes.splice(fromLine, count);
+},
 
-    wordRange: function(lineNumber, column)
-    {
-        return new WebInspector.TextRange(lineNumber, this.wordStart(lineNumber, column, true), lineNumber, this.wordEnd(lineNumber, column, true));
-    },
+_insertLine: function(lineNumber, text)
+{
+this._lines.splice(lineNumber, 0, text);
+this._attributes.splice(lineNumber, 0, {});
+},
 
-    wordStart: function(lineNumber, column, gapless)
-    {
-        var line = this._lines[lineNumber];
-        var prefix = line.substring(0, column).split("").reverse().join("");
-        var prefixMatch = this._noPunctuationRegex.exec(prefix);
-        return prefixMatch && (!gapless || prefixMatch.index === 0) ? column - prefixMatch.index - prefixMatch[0].length : column;
-    },
+wordRange: function(lineNumber, column)
+{
+return new WebInspector.TextRange(lineNumber, this.wordStart(lineNumber, column, true), lineNumber, this.wordEnd(lineNumber, column, true));
+},
 
-    wordEnd: function(lineNumber, column, gapless)
-    {
-        var line = this._lines[lineNumber];
-        var suffix = line.substring(column);
-        var suffixMatch = this._noPunctuationRegex.exec(suffix);
-        return suffixMatch && (!gapless || suffixMatch.index === 0) ? column + suffixMatch.index + suffixMatch[0].length : column;
-    },
+wordStart: function(lineNumber, column, gapless)
+{
+var line = this._lines[lineNumber];
+var prefix = line.substring(0, column).split("").reverse().join("");
+var prefixMatch = this._noPunctuationRegex.exec(prefix);
+return prefixMatch && (!gapless || prefixMatch.index === 0) ? column - prefixMatch.index - prefixMatch[0].length : column;
+},
 
-    copyRange: function(range)
-    {
-        var clip = [];
-        if (range.startLine === range.endLine) {
-            clip.push(this._lines[range.startLine].substring(range.startColumn, range.endColumn));
-            return clip.join("\n");
-        }
-        clip.push(this._lines[range.startLine].substring(range.startColumn));
-        for (var i = range.startLine + 1; i < range.endLine; ++i)
-            clip.push(this._lines[i]);
-        clip.push(this._lines[range.endLine].substring(0, range.endColumn));
-        return clip.join("\n");
-    },
+wordEnd: function(lineNumber, column, gapless)
+{
+var line = this._lines[lineNumber];
+var suffix = line.substring(column);
+var suffixMatch = this._noPunctuationRegex.exec(suffix);
+return suffixMatch && (!gapless || suffixMatch.index === 0) ? column + suffixMatch.index + suffixMatch[0].length : column;
+},
 
-    setAttribute: function(line, name, value)
-    {
-        var attrs = this._attributes[line];
-        if (!attrs) {
-            attrs = {};
-            this._attributes[line] = attrs;
-        }
-        attrs[name] = value;
-    },
+copyRange: function(range)
+{
+if (!range)
+range = new WebInspector.TextRange(0, 0, this._lines.length - 1, this._lines[this._lines.length - 1].length);
 
-    getAttribute: function(line, name)
-    {
-        var attrs = this._attributes[line];
-        return attrs ? attrs[name] : null;
-    },
+var clip = [];
+if (range.startLine === range.endLine) {
+clip.push(this._lines[range.startLine].substring(range.startColumn, range.endColumn));
+return clip.join("\n");
+}
+clip.push(this._lines[range.startLine].substring(range.startColumn));
+for (var i = range.startLine + 1; i < range.endLine; ++i)
+clip.push(this._lines[i]);
+clip.push(this._lines[range.endLine].substring(0, range.endColumn));
+return clip.join("\n");
+},
 
-    removeAttribute: function(line, name)
-    {
-        var attrs = this._attributes[line];
-        if (attrs)
-            delete attrs[name];
-    },
+setAttribute: function(line, name, value)
+{
+var attrs = this._attributes[line];
+if (!attrs) {
+attrs = {};
+this._attributes[line] = attrs;
+}
+attrs[name] = value;
+},
 
-    _pushUndoableCommand: function(range, text)
-    {
-        var command = {
-            text: this.copyRange(range),
-            startLine: range.startLine,
-            startColumn: range.startColumn,
-            endLine: range.startLine,
-            endColumn: range.startColumn
-        };
-        if (this._inUndo)
-            this._redoStack.push(command);
-        else {
-            if (!this._inRedo)
-                this._redoStack = [];
-            this._undoStack.push(command);
-        }
-        return command;
-    },
+getAttribute: function(line, name)
+{
+var attrs = this._attributes[line];
+return attrs ? attrs[name] : null;
+},
 
-    undo: function()
-    {
-        this._markRedoableState();
+removeAttribute: function(line, name)
+{
+var attrs = this._attributes[line];
+if (attrs)
+delete attrs[name];
+},
 
-        this._inUndo = true;
-        var range = this._doUndo(this._undoStack);
-        delete this._inUndo;
+_pushUndoableCommand: function(range, text)
+{
+var command = {
+text: this.copyRange(range),
+startLine: range.startLine,
+startColumn: range.startColumn,
+endLine: range.startLine,
+endColumn: range.startColumn
+};
+if (this._inUndo)
+this._redoStack.push(command);
+else {
+if (!this._inRedo)
+this._redoStack = [];
+this._undoStack.push(command);
+}
+return command;
+},
 
-        return range;
-    },
+undo: function()
+{
+this._markRedoableState();
 
-    redo: function()
-    {
-        this.markUndoableState();
+this._inUndo = true;
+var range = this._doUndo(this._undoStack);
+delete this._inUndo;
 
-        this._inRedo = true;
-        var range = this._doUndo(this._redoStack);
-        delete this._inRedo;
+return range;
+},
 
-        return range;
-    },
+redo: function()
+{
+this.markUndoableState();
 
-    _doUndo: function(stack)
-    {
-        var range = null;
-        for (var i = stack.length - 1; i >= 0; --i) {
-            var command = stack[i];
-            stack.length = i;
+this._inRedo = true;
+var range = this._doUndo(this._redoStack);
+delete this._inRedo;
 
-            range = this.setText(command.range, command.text);
-            if (i > 0 && stack[i - 1].explicit)
-                return range;
-        }
-        return range;
-    },
+return range;
+},
 
-    markUndoableState: function()
-    {
-        if (this._undoStack.length)
-            this._undoStack[this._undoStack.length - 1].explicit = true;
-    },
+_doUndo: function(stack)
+{
+var range = null;
+for (var i = stack.length - 1; i >= 0; --i) {
+var command = stack[i];
+stack.length = i;
 
-    _markRedoableState: function()
-    {
-        if (this._redoStack.length)
-            this._redoStack[this._redoStack.length - 1].explicit = true;
-    },
+range = this.setText(command.range, command.text);
+if (i > 0 && stack[i - 1].explicit)
+return range;
+}
+return range;
+},
 
-    resetUndoStack: function()
-    {
-        this._undoStack = [];
-    }
+markUndoableState: function()
+{
+if (this._undoStack.length)
+this._undoStack[this._undoStack.length - 1].explicit = true;
+},
+
+_markRedoableState: function()
+{
+if (this._redoStack.length)
+this._redoStack[this._redoStack.length - 1].explicit = true;
+},
+
+resetUndoStack: function()
+{
+this._undoStack = [];
+}
 }
 
-/* TextEditorHighlighter.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.TextEditorHighlighter = function(textModel, damageCallback)
 {
-    this._textModel = textModel;
-    this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html");
-    this._damageCallback = damageCallback;
-    this._lastHighlightedLine = 0;
-    this._lastHighlightedColumn = 0;
+this._textModel = textModel;
+this._tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/html");
+this._damageCallback = damageCallback;
+this.reset();
 }
 
 WebInspector.TextEditorHighlighter.prototype = {
-    set mimeType(mimeType)
-    {
-        var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
-        if (tokenizer) {
-            this._tokenizer = tokenizer;
-            this._tokenizerCondition = this._tokenizer.initialCondition;
-        }
-    },
+set mimeType(mimeType)
+{
+var tokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer(mimeType);
+if (tokenizer) {
+this._tokenizer = tokenizer;
+this._tokenizerCondition = this._tokenizer.initialCondition;
+}
+},
 
-    highlight: function(endLine)
-    {
-        // First check if we have work to do.
-        if (endLine <= this._lastHighlightedLine)
-            return;
+reset: function()
+{
+this._lastHighlightedLine = 0;
+this._lastHighlightedColumn = 0;
+this._tokenizerCondition = this._tokenizer.initialCondition;
+},
 
-        this._requestedEndLine = endLine;
+highlight: function(endLine)
+{
 
-        if (this._highlightTimer) {
-            // There is a timer scheduled, it will catch the new job based on the new endLine set.
-            return;
-        }
+if (endLine <= this._lastHighlightedLine)
+return;
 
-        // Do small highlight synchronously. This will provide instant highlight on PageUp / PageDown, gentle scrolling.
-        this._highlightInChunks(endLine);
+this._requestedEndLine = endLine;
 
-        // Schedule tail highlight if necessary.
-        if (this._lastHighlightedLine < endLine)
-            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, endLine), 100);
-    },
+if (this._highlightTimer) {
 
-    _highlightInChunks: function(endLine)
-    {
-        delete this._highlightTimer;
-
-        // First we always check if we have work to do. Could be that user scrolled back and we can quit.
-        if (this._requestedEndLine <= this._lastHighlightedLine)
-            return;
-
-        if (this._requestedEndLine !== endLine) {
-            // User keeps updating the job in between of our timer ticks. Just reschedule self, don't eat CPU (they must be scrolling).
-            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 100);
-            return;
-        }
-
-        this._highlightLines(this._requestedEndLine);
-
-        // Schedule tail highlight if necessary.
-        if (this._lastHighlightedLine < this._requestedEndLine)
-            this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 10);
-    },
-
-    _highlightLines: function(endLine)
-    {
-        // Tokenizer is stateless and reused accross viewers, restore its condition before highlight and save it after.
-        this._tokenizer.condition = this._tokenizerCondition;
-        var tokensCount = 0;
-        for (var lineNumber = this._lastHighlightedLine; lineNumber < endLine; ++lineNumber) {
-            var line = this._textModel.line(lineNumber);
-            this._tokenizer.line = line;
-            var attributes = this._textModel.getAttribute(lineNumber, "highlight") || {};
-
-            // Highlight line.
-            do {
-                var newColumn = this._tokenizer.nextToken(this._lastHighlightedColumn);
-                var tokenType = this._tokenizer.tokenType;
-                if (tokenType)
-                    attributes[this._lastHighlightedColumn] = { length: newColumn - this._lastHighlightedColumn, tokenType: tokenType, subTokenizer: this._tokenizer.subTokenizer };
-                this._lastHighlightedColumn = newColumn;
-                if (++tokensCount > 1000)
-                    break;
-            } while (this._lastHighlightedColumn < line.length)
-
-            this._textModel.setAttribute(lineNumber, "highlight", attributes);
-            if (this._lastHighlightedColumn < line.length) {
-                // Too much work for single chunk - exit.
-                break;
-            } else
-                this._lastHighlightedColumn = 0;
-        }
-
-        this._damageCallback(this._lastHighlightedLine, lineNumber);
-        this._tokenizerCondition = this._tokenizer.condition;
-        this._lastHighlightedLine = lineNumber;
-    }
+return;
 }
 
-/* TextViewer.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+this._highlightInChunks(endLine);
+
+
+if (this._lastHighlightedLine < endLine)
+this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, endLine), 100);
+},
+
+_highlightInChunks: function(endLine)
+{
+delete this._highlightTimer;
+
+
+if (this._requestedEndLine <= this._lastHighlightedLine)
+return;
+
+if (this._requestedEndLine !== endLine) {
+
+this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 100);
+return;
+}
+
+this._highlightLines(this._requestedEndLine);
+
+
+if (this._lastHighlightedLine < this._requestedEndLine)
+this._highlightTimer = setTimeout(this._highlightInChunks.bind(this, this._requestedEndLine), 10);
+},
+
+_highlightLines: function(endLine)
+{
+
+this._tokenizer.condition = this._tokenizerCondition;
+var tokensCount = 0;
+for (var lineNumber = this._lastHighlightedLine; lineNumber < endLine; ++lineNumber) {
+var line = this._textModel.line(lineNumber);
+this._tokenizer.line = line;
+var attributes = this._textModel.getAttribute(lineNumber, "highlight") || {};
+
+
+do {
+var newColumn = this._tokenizer.nextToken(this._lastHighlightedColumn);
+var tokenType = this._tokenizer.tokenType;
+if (tokenType)
+attributes[this._lastHighlightedColumn] = { length: newColumn - this._lastHighlightedColumn, tokenType: tokenType, subTokenizer: this._tokenizer.subTokenizer };
+this._lastHighlightedColumn = newColumn;
+if (++tokensCount > 1000)
+break;
+} while (this._lastHighlightedColumn < line.length)
+
+this._textModel.setAttribute(lineNumber, "highlight", attributes);
+if (this._lastHighlightedColumn < line.length) {
+
+break;
+} else
+this._lastHighlightedColumn = 0;
+}
+
+this._damageCallback(this._lastHighlightedLine, lineNumber);
+this._tokenizerCondition = this._tokenizer.condition;
+this._lastHighlightedLine = lineNumber;
+}
+}
+
+
+
+
 
 WebInspector.TextViewer = function(textModel, platform, url)
 {
-    this._textModel = textModel;
-    this._textModel.changeListener = this._buildChunks.bind(this);
-    this._highlighter = new WebInspector.TextEditorHighlighter(this._textModel, this._highlightDataReady.bind(this));
+this._textModel = textModel;
+this._textModel.changeListener = this._buildChunks.bind(this);
+this._highlighter = new WebInspector.TextEditorHighlighter(this._textModel, this._highlightDataReady.bind(this));
 
-    this.element = document.createElement("div");
-    this.element.className = "text-editor monospace";
-    this.element.tabIndex = 0;
+this.element = document.createElement("div");
+this.element.className = "text-editor monospace";
+this.element.tabIndex = 0;
 
-    this.element.addEventListener("scroll", this._scroll.bind(this), false);
-    this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
+this.element.addEventListener("scroll", this._scroll.bind(this), false);
+this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false);
+this.element.addEventListener("beforecopy", this._beforeCopy.bind(this), false);
+this.element.addEventListener("copy", this._copy.bind(this), false);
+this.element.addEventListener("dblclick", this._handleDoubleClick.bind(this), false);
 
-    this._url = url;
+this._url = url;
 
-    this._linesContainerElement = document.createElement("table");
-    this._linesContainerElement.className = "text-editor-lines";
-    this._linesContainerElement.setAttribute("cellspacing", 0);
-    this._linesContainerElement.setAttribute("cellpadding", 0);
-    this.element.appendChild(this._linesContainerElement);
+this._linesContainerElement = document.createElement("table");
+this._linesContainerElement.className = "text-editor-lines";
+this._linesContainerElement.setAttribute("cellspacing", 0);
+this._linesContainerElement.setAttribute("cellpadding", 0);
+this.element.appendChild(this._linesContainerElement);
 
-    this._defaultChunkSize = 50;
-    this._paintCoalescingLevel = 0;
+this._defaultChunkSize = 50;
+this._paintCoalescingLevel = 0;
 
-    this.freeCachedElements();
-    this._buildChunks();
+this.freeCachedElements();
+this._buildChunks();
 }
 
 WebInspector.TextViewer.prototype = {
-    set mimeType(mimeType)
-    {
-        this._highlighter.mimeType = mimeType;
-    },
+set mimeType(mimeType)
+{
+this._highlighter.mimeType = mimeType;
+},
 
-    get textModel()
-    {
-        return this._textModel;
-    },
+get textModel()
+{
+return this._textModel;
+},
 
-    revealLine: function(lineNumber)
-    {
-        if (lineNumber >= this._textModel.linesCount)
-            return;
+revealLine: function(lineNumber)
+{
+if (lineNumber >= this._textModel.linesCount)
+return;
 
-        var chunk = this._makeLineAChunk(lineNumber);
-        chunk.element.scrollIntoViewIfNeeded();
-    },
+var chunk = this._makeLineAChunk(lineNumber);
+chunk.element.scrollIntoViewIfNeeded();
+},
 
-    addDecoration: function(lineNumber, decoration)
-    {
-        var chunk = this._makeLineAChunk(lineNumber);
-        chunk.addDecoration(decoration);
-    },
+set editCallback(editCallback)
+{
+this._editCallback = editCallback;
+},
 
-    removeDecoration: function(lineNumber, decoration)
-    {
-        var chunk = this._makeLineAChunk(lineNumber);
-        chunk.removeDecoration(decoration);
-    },
+addDecoration: function(lineNumber, decoration)
+{
+var chunk = this._makeLineAChunk(lineNumber);
+chunk.addDecoration(decoration);
+},
 
-    markAndRevealRange: function(range)
-    {
-        if (this._rangeToMark) {
-            var markedLine = this._rangeToMark.startLine;
-            this._rangeToMark = null;
-            this._paintLines(markedLine, markedLine + 1);
-        }
+removeDecoration: function(lineNumber, decoration)
+{
+var chunk = this._makeLineAChunk(lineNumber);
+chunk.removeDecoration(decoration);
+},
 
-        if (range) {
-            this._rangeToMark = range;
-            this.revealLine(range.startLine);
-            this._paintLines(range.startLine, range.startLine + 1);
-            if (this._markedRangeElement)
-                this._markedRangeElement.scrollIntoViewIfNeeded();
-        }
-        delete this._markedRangeElement;
-    },
+markAndRevealRange: function(range)
+{
+if (this._rangeToMark) {
+var markedLine = this._rangeToMark.startLine;
+this._rangeToMark = null;
+this._paintLines(markedLine, markedLine + 1);
+}
 
-    highlightLine: function(lineNumber)
-    {
-        if (typeof this._highlightedLine === "number") {
-            var chunk = this._makeLineAChunk(this._highlightedLine);
-            chunk.removeDecoration("webkit-highlighted-line");
-        }
-        this._highlightedLine = lineNumber;
-        this.revealLine(lineNumber);
-        var chunk = this._makeLineAChunk(lineNumber);
-        chunk.addDecoration("webkit-highlighted-line");
-    },
+if (range) {
+this._rangeToMark = range;
+this.revealLine(range.startLine);
+this._paintLines(range.startLine, range.startLine + 1);
+if (this._markedRangeElement)
+this._markedRangeElement.scrollIntoViewIfNeeded();
+}
+delete this._markedRangeElement;
+},
 
-    freeCachedElements: function()
-    {
-        this._cachedSpans = [];
-        this._cachedTextNodes = [];
-        this._cachedRows = [];
-    },
+highlightLine: function(lineNumber)
+{
+this.clearLineHighlight();
+this._highlightedLine = lineNumber;
+this.revealLine(lineNumber);
+var chunk = this._makeLineAChunk(lineNumber);
+chunk.addDecoration("webkit-highlighted-line");
+},
 
-    _buildChunks: function()
-    {
-        this._linesContainerElement.removeChildren();
+clearLineHighlight: function()
+{
+if (typeof this._highlightedLine === "number") {
+var chunk = this._makeLineAChunk(this._highlightedLine);
+chunk.removeDecoration("webkit-highlighted-line");
+delete this._highlightedLine;
+}
+},
 
-        this._textChunks = [];
-        for (var i = 0; i < this._textModel.linesCount; i += this._defaultChunkSize) {
-            var chunk = new WebInspector.TextChunk(this, i, i + this._defaultChunkSize);
-            this._textChunks.push(chunk);
-            this._linesContainerElement.appendChild(chunk.element);
-        }
-        this._indexChunks();
-        this._repaintAll();
-    },
+freeCachedElements: function()
+{
+this._cachedSpans = [];
+this._cachedTextNodes = [];
+this._cachedRows = [];
+},
 
-    _makeLineAChunk: function(lineNumber)
-    {
-        if (!this._textChunks)
-            this._buildChunks();
+_buildChunks: function()
+{
+this._linesContainerElement.removeChildren();
 
-        var chunkNumber = this._chunkNumberForLine(lineNumber);
-        var oldChunk = this._textChunks[chunkNumber];
-        if (oldChunk.linesCount === 1)
-            return oldChunk;
+this._textChunks = [];
+for (var i = 0; i < this._textModel.linesCount; i += this._defaultChunkSize) {
+var chunk = new WebInspector.TextChunk(this, i, i + this._defaultChunkSize);
+this._textChunks.push(chunk);
+this._linesContainerElement.appendChild(chunk.element);
+}
 
-        var wasExpanded = oldChunk.expanded;
-        oldChunk.expanded = false;
+this._indexChunks();
+this._highlighter.reset();
+this._repaintAll();
+},
 
-        var insertIndex = oldChunk.chunkNumber + 1;
+_makeLineAChunk: function(lineNumber)
+{
+if (!this._textChunks)
+this._buildChunks();
 
-        // Prefix chunk.
-        if (lineNumber > oldChunk.startLine) {
-            var prefixChunk = new WebInspector.TextChunk(this, oldChunk.startLine, lineNumber);
-            this._textChunks.splice(insertIndex++, 0, prefixChunk);
-            this._linesContainerElement.insertBefore(prefixChunk.element, oldChunk.element);
-        }
+var chunkNumber = this._chunkNumberForLine(lineNumber);
+var oldChunk = this._textChunks[chunkNumber];
+if (oldChunk.linesCount === 1)
+return oldChunk;
 
-        // Line chunk.
-        var lineChunk = new WebInspector.TextChunk(this, lineNumber, lineNumber + 1);
-        this._textChunks.splice(insertIndex++, 0, lineChunk);
-        this._linesContainerElement.insertBefore(lineChunk.element, oldChunk.element);
+var wasExpanded = oldChunk.expanded;
+oldChunk.expanded = false;
 
-        // Suffix chunk.
-        if (oldChunk.startLine + oldChunk.linesCount > lineNumber + 1) {
-            var suffixChunk = new WebInspector.TextChunk(this, lineNumber + 1, oldChunk.startLine + oldChunk.linesCount);
-            this._textChunks.splice(insertIndex, 0, suffixChunk);
-            this._linesContainerElement.insertBefore(suffixChunk.element, oldChunk.element);
-        }
+var insertIndex = oldChunk.chunkNumber + 1;
 
-        // Remove enclosing chunk.
-        this._textChunks.splice(oldChunk.chunkNumber, 1);
-        this._linesContainerElement.removeChild(oldChunk.element);
-        this._indexChunks();
 
-        if (wasExpanded) {
-            if (prefixChunk)
-                prefixChunk.expanded = true;
-            lineChunk.expanded = true;
-            if (suffixChunk)
-                suffixChunk.expanded = true;
-        }
+if (lineNumber > oldChunk.startLine) {
+var prefixChunk = new WebInspector.TextChunk(this, oldChunk.startLine, lineNumber);
+this._textChunks.splice(insertIndex++, 0, prefixChunk);
+this._linesContainerElement.insertBefore(prefixChunk.element, oldChunk.element);
+}
 
-        return lineChunk;
-    },
 
-    _indexChunks: function()
-    {
-        for (var i = 0; i < this._textChunks.length; ++i)
-            this._textChunks[i].chunkNumber = i;
-    },
+var lineChunk = new WebInspector.TextChunk(this, lineNumber, lineNumber + 1);
+this._textChunks.splice(insertIndex++, 0, lineChunk);
+this._linesContainerElement.insertBefore(lineChunk.element, oldChunk.element);
 
-    _scroll: function()
-    {
-        var scrollTop = this.element.scrollTop;
-        setTimeout(function() {
-            if (scrollTop === this.element.scrollTop)
-                this._repaintAll();
-        }.bind(this), 50);
-    },
-    
-    _handleKeyDown: function()
-    {
-        if (event.metaKey || event.shiftKey || event.ctrlKey || event.altKey)
-            return;
-        
-        var scrollValue = 0;
-        if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Up)
-            scrollValue = -1;
-        else if (event.keyCode == WebInspector.KeyboardShortcut.KeyCodes.Down)
-            scrollValue = 1;
-        
-        if (scrollValue) {
-            event.preventDefault();
-            event.stopPropagation();
-            this.element.scrollByLines(scrollValue);
-            return;
-        }
-        
-        scrollValue = 0;
-        if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Left)
-            scrollValue = -40;
-        else if (event.keyCode == WebInspector.KeyboardShortcut.KeyCodes.Right)
-            scrollValue = 40;
-        
-        if (scrollValue) {
-            event.preventDefault();
-            event.stopPropagation();
-            this.element.scrollLeft += scrollValue;
-        }
-    },
 
-    beginUpdates: function(enabled)
-    {
-        this._paintCoalescingLevel++;
-    },
+if (oldChunk.startLine + oldChunk.linesCount > lineNumber + 1) {
+var suffixChunk = new WebInspector.TextChunk(this, lineNumber + 1, oldChunk.startLine + oldChunk.linesCount);
+this._textChunks.splice(insertIndex, 0, suffixChunk);
+this._linesContainerElement.insertBefore(suffixChunk.element, oldChunk.element);
+}
 
-    endUpdates: function(enabled)
-    {
-        this._paintCoalescingLevel--;
-        if (!this._paintCoalescingLevel)
-            this._repaintAll();
-    },
 
-    _chunkForOffset: function(offset)
-    {
-        var currentOffset = 0;
-        var row = this._linesContainerElement.firstChild;
-        while (row) {
-            var rowHeight = row.offsetHeight;
-            if (offset >= currentOffset && offset < currentOffset + rowHeight)
-                return row.chunkNumber;
-            row = row.nextSibling;
-            currentOffset += rowHeight;
-        }
-        return this._textChunks.length - 1;
-    },
+this._textChunks.splice(oldChunk.chunkNumber, 1);
+this._linesContainerElement.removeChild(oldChunk.element);
+this._indexChunks();
 
-    _chunkNumberForLine: function(lineNumber)
-    {
-        for (var i = 0; i < this._textChunks.length; ++i) {
-            var line = this._textChunks[i].startLine;
-            if (lineNumber >= this._textChunks[i].startLine && lineNumber < this._textChunks[i].startLine + this._textChunks[i].linesCount)
-                return i;
-        }
-        return this._textChunks.length - 1;
-    },
+if (wasExpanded) {
+if (prefixChunk)
+prefixChunk.expanded = true;
+lineChunk.expanded = true;
+if (suffixChunk)
+suffixChunk.expanded = true;
+}
 
-    _chunkForLine: function(lineNumber)
-    {
-        return this._textChunks[this._chunkNumberForLine(lineNumber)];
-    },
+return lineChunk;
+},
 
-    _chunkStartLine: function(chunkNumber)
-    {
-        var lineNumber = 0;
-        for (var i = 0; i < chunkNumber && i < this._textChunks.length; ++i)
-            lineNumber += this._textChunks[i].linesCount;
-        return lineNumber;
-    },
+_indexChunks: function()
+{
+for (var i = 0; i < this._textChunks.length; ++i)
+this._textChunks[i].chunkNumber = i;
+},
 
-    _repaintAll: function()
-    {
-        if (this._paintCoalescingLevel)
-            return;
+_scroll: function()
+{
+var scrollTop = this.element.scrollTop;
+setTimeout(function() {
+if (scrollTop === this.element.scrollTop)
+this._repaintAll();
+}.bind(this), 50);
+},
 
-        if (!this._textChunks)
-            this._buildChunks();
+_handleKeyDown: function()
+{
+if (this._editingLine || event.metaKey || event.shiftKey || event.ctrlKey || event.altKey)
+return;
 
-        var visibleFrom = this.element.scrollTop;
-        var visibleTo = this.element.scrollTop + this.element.clientHeight;
+var scrollValue = 0;
+if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Up.code)
+scrollValue = -1;
+else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Down.code)
+scrollValue = 1;
 
-        var offset = 0;
-        var firstVisibleLine = -1;
-        var lastVisibleLine = 0;
-        var toExpand = [];
-        var toCollapse = [];
-        for (var i = 0; i < this._textChunks.length; ++i) {
-            var chunk = this._textChunks[i];
-            var chunkHeight = chunk.height;
-            if (offset + chunkHeight > visibleFrom && offset < visibleTo) {
-                toExpand.push(chunk);
-                if (firstVisibleLine === -1)
-                    firstVisibleLine = chunk.startLine;
-                lastVisibleLine = chunk.startLine + chunk.linesCount;
-            } else {
-                toCollapse.push(chunk);
-                if (offset >= visibleTo)
-                    break;
-            }
-            offset += chunkHeight;
-        }
+if (scrollValue) {
+event.preventDefault();
+event.stopPropagation();
+this.element.scrollByLines(scrollValue);
+return;
+}
 
-        for (var j = i; j < this._textChunks.length; ++j)
-            toCollapse.push(this._textChunks[i]);
+scrollValue = 0;
+if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Left.code)
+scrollValue = -40;
+else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Right.code)
+scrollValue = 40;
 
-        var selection = this._getSelection();
+if (scrollValue) {
+event.preventDefault();
+event.stopPropagation();
+this.element.scrollLeft += scrollValue;
+}
+},
 
-        this._muteHighlightListener = true;
-        this._highlighter.highlight(lastVisibleLine);
-        delete this._muteHighlightListener;
+_handleDoubleClick: function(e)
+{
+if (!this._editCallback)
+return;
 
-        for (var i = 0; i < toCollapse.length; ++i)
-            toCollapse[i].expanded = false;
-        for (var i = 0; i < toExpand.length; ++i)
-            toExpand[i].expanded = true;
+var cell = e.target.enclosingNodeOrSelfWithNodeName("TD");
+if (!cell)
+return;
 
-        this._restoreSelection(selection);
-    },
+var lineRow = cell.parentElement;
+if (lineRow.firstChild === cell)
+return;  
 
-    _highlightDataReady: function(fromLine, toLine)
-    {
-        if (this._muteHighlightListener)
-            return;
+var oldContent = lineRow.lastChild.innerHTML;
+var cancelEditingCallback = this._cancelEditingLine.bind(this, lineRow.lastChild, oldContent);
+var commitEditingCallback = this._commitEditingLine.bind(this, lineRow.lineNumber, lineRow.lastChild, cancelEditingCallback);
+this._editingLine = WebInspector.startEditing(lineRow.lastChild, commitEditingCallback, cancelEditingCallback, null, true);
+},
 
-        var selection;
-        for (var i = fromLine; i < toLine; ++i) {
-            var lineRow = this._textModel.getAttribute(i, "line-row");
-            if (!lineRow || lineRow.highlighted)
-                continue;
-            if (!selection)
-                selection = this._getSelection();
-            this._paintLine(lineRow, i);
-        }
-        this._restoreSelection(selection);
-    },
+_commitEditingLine: function(lineNumber, element, cancelEditingCallback)
+{
+this._editCallback(lineNumber, element.textContent, cancelEditingCallback);
+delete this._editingLine;
+},
 
-    _paintLines: function(fromLine, toLine)
-    {
-        for (var i = fromLine; i < toLine; ++i) {
-            var lineRow = this._textModel.getAttribute(i, "line-row");
-            if (lineRow)
-                this._paintLine(lineRow, i);
-        }
-    },
+_cancelEditingLine: function(element, oldContent, e)
+{
+element.innerHTML = oldContent;
+delete this._editingLine;
+},
 
-    _paintLine: function(lineRow, lineNumber)
-    {
-        var element = lineRow.lastChild;
-        var highlight = this._textModel.getAttribute(lineNumber, "highlight");
-        if (!highlight) {
-            if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
-                this._markedRangeElement = highlightSearchResult(element, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
-            return;
-        }
+_beforeCopy: function(e)
+{
+e.preventDefault();
+},
 
-        element.removeChildren();
-        var line = this._textModel.line(lineNumber);
+_copy: function(e)
+{
+var range = this._getSelection();
+var text = this._textModel.copyRange(range);
+InspectorFrontendHost.copyText(text);
+e.preventDefault();
+},
 
-        var plainTextStart = -1;
-        for (var j = 0; j < line.length;) {
-            if (j > 1000) {
-                // This line is too long - do not waste cycles on minified js highlighting.
-                if (plainTextStart === -1)
-                    plainTextStart = j;
-                break;
-            }
-            var attribute = highlight[j];
-            if (!attribute || !attribute.tokenType) {
-                if (plainTextStart === -1)
-                    plainTextStart = j;
-                j++;
-            } else {
-                if (plainTextStart !== -1) {
-                    this._appendTextNode(element, line.substring(plainTextStart, j));
-                    plainTextStart = -1;
-                }
-                this._appendSpan(element, line.substring(j, j + attribute.length), attribute.tokenType);
-                j += attribute.length;
-            }
-        }
-        if (plainTextStart !== -1)
-            this._appendTextNode(element, line.substring(plainTextStart, line.length));
-        if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
-            this._markedRangeElement = highlightSearchResult(element, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
-        if (lineRow.decorationsElement)
-            element.appendChild(lineRow.decorationsElement);
-    },
+beginUpdates: function(enabled)
+{
+this._paintCoalescingLevel++;
+},
 
-    _releaseLinesHighlight: function(fromLine, toLine)
-    {
-        for (var i = fromLine; i < toLine; ++i) {
-            var lineRow = this._textModel.getAttribute(i, "line-row");
-            if (!lineRow)
-                continue;
-            var element = lineRow.lastChild;
-            if ("spans" in element) {
-                var spans = element.spans;
-                for (var j = 0; j < spans.length; ++j)
-                    this._cachedSpans.push(spans[j]);
-                delete element.spans;
-            }
-            if ("textNodes" in element) {
-                var textNodes = element.textNodes;
-                for (var j = 0; j < textNodes.length; ++j)
-                    this._cachedTextNodes.push(textNodes[j]);
-                delete element.textNodes;
-            }
-        }
-    },
+endUpdates: function(enabled)
+{
+this._paintCoalescingLevel--;
+if (!this._paintCoalescingLevel)
+this._repaintAll();
+},
 
-    _getSelection: function()
-    {
-        var selection = window.getSelection();
-        if (selection.isCollapsed)
-            return null;
-        var selectionRange = selection.getRangeAt(0);
-        var start = this._selectionToPosition(selectionRange.startContainer, selectionRange.startOffset);
-        var end = this._selectionToPosition(selectionRange.endContainer, selectionRange.endOffset);
-        return new WebInspector.TextRange(start.line, start.column, end.line, end.column);
-    },
+_chunkForOffset: function(offset)
+{
+var currentOffset = 0;
+var row = this._linesContainerElement.firstChild;
+while (row) {
+var rowHeight = row.offsetHeight;
+if (offset >= currentOffset && offset < currentOffset + rowHeight)
+return row.chunkNumber;
+row = row.nextSibling;
+currentOffset += rowHeight;
+}
+return this._textChunks.length - 1;
+},
 
-    _restoreSelection: function(range)
-    {
-        if (!range)
-            return;
-        var startRow = this._textModel.getAttribute(range.startLine, "line-row");
-        if (startRow)
-            var start = startRow.lastChild.rangeBoundaryForOffset(range.startColumn);
-        else {
-            var offset = range.startColumn;
-            var chunkNumber = this._chunkNumberForLine(range.startLine);
-            for (var i = this._chunkStartLine(chunkNumber); i < range.startLine; ++i)
-                offset += this._textModel.line(i).length + 1; // \n
-            var lineCell = this._textChunks[chunkNumber].element.lastChild;
-            if (lineCell.firstChild)
-                var start = { container: lineCell.firstChild, offset: offset };
-            else
-                var start = { container: lineCell, offset: 0 };
-        }
+_chunkNumberForLine: function(lineNumber)
+{
+for (var i = 0; i < this._textChunks.length; ++i) {
+var line = this._textChunks[i].startLine;
+if (lineNumber >= this._textChunks[i].startLine && lineNumber < this._textChunks[i].startLine + this._textChunks[i].linesCount)
+return i;
+}
+return this._textChunks.length - 1;
+},
 
-        var endRow = this._textModel.getAttribute(range.endLine, "line-row");
-        if (endRow)
-            var end = endRow.lastChild.rangeBoundaryForOffset(range.endColumn);
-        else {
-            var offset = range.endColumn;
-            var chunkNumber = this._chunkNumberForLine(range.endLine);
-            for (var i = this._chunkStartLine(chunkNumber); i < range.endLine; ++i)
-                offset += this._textModel.line(i).length + 1; // \n
-            var lineCell = this._textChunks[chunkNumber].element.lastChild;
-            if (lineCell.firstChild)
-                var end = { container: lineCell.firstChild, offset: offset };
-            else
-                var end = { container: lineCell, offset: 0 };
-        }
+_chunkForLine: function(lineNumber)
+{
+return this._textChunks[this._chunkNumberForLine(lineNumber)];
+},
 
-        var selectionRange = document.createRange();
-        selectionRange.setStart(start.container, start.offset);
-        selectionRange.setEnd(end.container, end.offset);
+_chunkStartLine: function(chunkNumber)
+{
+var lineNumber = 0;
+for (var i = 0; i < chunkNumber && i < this._textChunks.length; ++i)
+lineNumber += this._textChunks[i].linesCount;
+return lineNumber;
+},
 
-        var selection = window.getSelection();
-        selection.removeAllRanges();
-        selection.addRange(selectionRange);
-    },
+_repaintAll: function()
+{
+if (this._paintCoalescingLevel)
+return;
 
-    _selectionToPosition: function(container, offset)
-    {
-        if (container === this.element && offset === 0)
-            return { line: 0, column: 0 };
-        if (container === this.element && offset === 1)
-            return { line: this._textModel.linesCount - 1, column: this._textModel.lineLength(this._textModel.linesCount - 1) };
+if (!this._textChunks)
+this._buildChunks();
 
-        var lineRow = container.enclosingNodeOrSelfWithNodeName("tr");
-        var lineNumber = lineRow.lineNumber;
-        if (container.nodeName === "TD" && offset === 0)
-            return { line: lineNumber, column: 0 };
-        if (container.nodeName === "TD" && offset === 1)
-            return { line: lineNumber, column: this._textModel.lineLength(lineNumber) };
+var visibleFrom = this.element.scrollTop;
+var visibleTo = this.element.scrollTop + this.element.clientHeight;
 
-        var column = 0;
-        if (lineRow.chunk) {
-            // This is chunk.
-            var text = lineRow.lastChild.textContent;
-            for (var i = 0; i < offset; ++i) {
-                if (text.charAt(i) === "\n") {
-                    lineNumber++;
-                    column = 0;
-                } else
-                    column++; 
-            }
-            return { line: lineNumber, column: column };
-        }
+var offset = 0;
+var firstVisibleLine = -1;
+var lastVisibleLine = 0;
+var toExpand = [];
+var toCollapse = [];
+for (var i = 0; i < this._textChunks.length; ++i) {
+var chunk = this._textChunks[i];
+var chunkHeight = chunk.height;
+if (offset + chunkHeight > visibleFrom && offset < visibleTo) {
+toExpand.push(chunk);
+if (firstVisibleLine === -1)
+firstVisibleLine = chunk.startLine;
+lastVisibleLine = chunk.startLine + chunk.linesCount;
+} else {
+toCollapse.push(chunk);
+if (offset >= visibleTo)
+break;
+}
+offset += chunkHeight;
+}
 
-        // This is individul line.
-        var column = 0;
-        var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild);
-        while (node && node !== container) {
-            column += node.textContent.length;
-            node = node.traverseNextTextNode(lineRow.lastChild);
-        }
-        column += offset;
-        return { line: lineRow.lineNumber, column: column };
-    },
+for (var j = i; j < this._textChunks.length; ++j)
+toCollapse.push(this._textChunks[i]);
 
-    _appendSpan: function(element, content, className)
-    {
-        if (className === "html-resource-link" || className === "html-external-link") {
-            element.appendChild(this._createLink(content, className === "html-external-link"));
-            return;
-        }
+var selection = this._getSelection();
 
-        var span = this._cachedSpans.pop() || document.createElement("span");
-        span.className = "webkit-" + className;
-        span.textContent = content;
-        element.appendChild(span);
-        if (!("spans" in element))
-            element.spans = [];
-        element.spans.push(span);
-    },
+this._muteHighlightListener = true;
+this._highlighter.highlight(lastVisibleLine);
+delete this._muteHighlightListener;
 
-    _appendTextNode: function(element, text)
-    {
-        var textNode = this._cachedTextNodes.pop();
-        if (textNode) {
-            textNode.nodeValue = text;
-        } else
-            textNode = document.createTextNode(text);
-        element.appendChild(textNode);
-        if (!("textNodes" in element))
-            element.textNodes = [];
-        element.textNodes.push(textNode);
-    },
+for (var i = 0; i < toCollapse.length; ++i)
+toCollapse[i].expanded = false;
+for (var i = 0; i < toExpand.length; ++i)
+toExpand[i].expanded = true;
 
-    _createLink: function(content, isExternal)
-    {
-        var quote = content.charAt(0);
-        if (content.length > 1 && (quote === "\"" ||   quote === "'"))
-            content = content.substring(1, content.length - 1);
-        else
-            quote = null;
+this._restoreSelection(selection);
+},
 
-        var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal);
-        var span = document.createElement("span");
-        span.className = "webkit-html-attribute-value";
-        if (quote)
-            span.appendChild(document.createTextNode(quote));
-        span.appendChild(a);
-        if (quote)
-            span.appendChild(document.createTextNode(quote));
-        return span;
-    },
+_highlightDataReady: function(fromLine, toLine)
+{
+if (this._muteHighlightListener)
+return;
 
-    _rewriteHref: function(hrefValue, isExternal)
-    {
-        if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0)
-            return hrefValue;
-        return WebInspector.completeURL(this._url, hrefValue);
-    },
+var selection;
+for (var i = fromLine; i < toLine; ++i) {
+var lineRow = this._textModel.getAttribute(i, "line-row");
+if (!lineRow || lineRow.highlighted)
+continue;
+if (!selection)
+selection = this._getSelection();
+this._paintLine(lineRow, i);
+}
+this._restoreSelection(selection);
+},
 
-    resize: function()
-    {
-        this._repaintAll();
-    }
+_paintLines: function(fromLine, toLine)
+{
+for (var i = fromLine; i < toLine; ++i) {
+var lineRow = this._textModel.getAttribute(i, "line-row");
+if (lineRow)
+this._paintLine(lineRow, i);
+}
+},
+
+_paintLine: function(lineRow, lineNumber)
+{
+var element = lineRow.lastChild;
+var highlight = this._textModel.getAttribute(lineNumber, "highlight");
+if (!highlight) {
+if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
+this._markedRangeElement = highlightSearchResult(element, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
+return;
+}
+
+element.removeChildren();
+var line = this._textModel.line(lineNumber);
+
+var plainTextStart = -1;
+for (var j = 0; j < line.length;) {
+if (j > 1000) {
+
+if (plainTextStart === -1)
+plainTextStart = j;
+break;
+}
+var attribute = highlight[j];
+if (!attribute || !attribute.tokenType) {
+if (plainTextStart === -1)
+plainTextStart = j;
+j++;
+} else {
+if (plainTextStart !== -1) {
+this._appendTextNode(element, line.substring(plainTextStart, j));
+plainTextStart = -1;
+}
+this._appendSpan(element, line.substring(j, j + attribute.length), attribute.tokenType);
+j += attribute.length;
+}
+}
+if (plainTextStart !== -1)
+this._appendTextNode(element, line.substring(plainTextStart, line.length));
+if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
+this._markedRangeElement = highlightSearchResult(element, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
+if (lineRow.decorationsElement)
+element.appendChild(lineRow.decorationsElement);
+},
+
+_releaseLinesHighlight: function(fromLine, toLine)
+{
+for (var i = fromLine; i < toLine; ++i) {
+var lineRow = this._textModel.getAttribute(i, "line-row");
+if (!lineRow)
+continue;
+var element = lineRow.lastChild;
+if ("spans" in element) {
+var spans = element.spans;
+for (var j = 0; j < spans.length; ++j)
+this._cachedSpans.push(spans[j]);
+delete element.spans;
+}
+if ("textNodes" in element) {
+var textNodes = element.textNodes;
+for (var j = 0; j < textNodes.length; ++j)
+this._cachedTextNodes.push(textNodes[j]);
+delete element.textNodes;
+}
+}
+},
+
+_getSelection: function()
+{
+var selection = window.getSelection();
+if (selection.isCollapsed)
+return null;
+var selectionRange = selection.getRangeAt(0);
+
+if (!this.element.isAncestor(selectionRange.startContainer) || !this.element.isAncestor(selectionRange.endContainer))
+return null;
+var start = this._selectionToPosition(selectionRange.startContainer, selectionRange.startOffset);
+var end = this._selectionToPosition(selectionRange.endContainer, selectionRange.endOffset);
+return new WebInspector.TextRange(start.line, start.column, end.line, end.column);
+},
+
+_restoreSelection: function(range)
+{
+if (!range)
+return;
+var startRow = this._textModel.getAttribute(range.startLine, "line-row");
+if (startRow)
+var start = startRow.lastChild.rangeBoundaryForOffset(range.startColumn);
+else {
+var offset = range.startColumn;
+var chunkNumber = this._chunkNumberForLine(range.startLine);
+for (var i = this._chunkStartLine(chunkNumber); i < range.startLine; ++i)
+offset += this._textModel.line(i).length + 1; 
+var lineCell = this._textChunks[chunkNumber].element.lastChild;
+if (lineCell.firstChild)
+var start = { container: lineCell.firstChild, offset: offset };
+else
+var start = { container: lineCell, offset: 0 };
+}
+
+var endRow = this._textModel.getAttribute(range.endLine, "line-row");
+if (endRow)
+var end = endRow.lastChild.rangeBoundaryForOffset(range.endColumn);
+else {
+var offset = range.endColumn;
+var chunkNumber = this._chunkNumberForLine(range.endLine);
+for (var i = this._chunkStartLine(chunkNumber); i < range.endLine; ++i)
+offset += this._textModel.line(i).length + 1; 
+var lineCell = this._textChunks[chunkNumber].element.lastChild;
+if (lineCell.firstChild)
+var end = { container: lineCell.firstChild, offset: offset };
+else
+var end = { container: lineCell, offset: 0 };
+}
+
+var selectionRange = document.createRange();
+selectionRange.setStart(start.container, start.offset);
+selectionRange.setEnd(end.container, end.offset);
+
+var selection = window.getSelection();
+selection.removeAllRanges();
+selection.addRange(selectionRange);
+},
+
+_selectionToPosition: function(container, offset)
+{
+if (container === this.element && offset === 0)
+return { line: 0, column: 0 };
+if (container === this.element && offset === 1)
+return { line: this._textModel.linesCount - 1, column: this._textModel.lineLength(this._textModel.linesCount - 1) };
+
+var lineRow = container.enclosingNodeOrSelfWithNodeName("tr");
+var lineNumber = lineRow.lineNumber;
+if (container.nodeName === "TD" && offset === 0)
+return { line: lineNumber, column: 0 };
+if (container.nodeName === "TD" && offset === 1)
+return { line: lineNumber, column: this._textModel.lineLength(lineNumber) };
+
+var column = 0;
+var node = lineRow.lastChild.traverseNextTextNode(lineRow.lastChild);
+while (node && node !== container) {
+column += node.textContent.length;
+node = node.traverseNextTextNode(lineRow.lastChild);
+}
+
+
+if (node === container && offset) {
+var text = node.textContent;
+for (var i = 0; i < offset; ++i) {
+if (text.charAt(i) === "\n") {
+lineNumber++;
+column = 0;
+} else
+column++;
+}
+}
+return { line: lineNumber, column: column };
+},
+
+_appendSpan: function(element, content, className)
+{
+if (className === "html-resource-link" || className === "html-external-link") {
+element.appendChild(this._createLink(content, className === "html-external-link"));
+return;
+}
+
+var span = this._cachedSpans.pop() || document.createElement("span");
+span.className = "webkit-" + className;
+span.textContent = content;
+element.appendChild(span);
+if (!("spans" in element))
+element.spans = [];
+element.spans.push(span);
+},
+
+_appendTextNode: function(element, text)
+{
+var textNode = this._cachedTextNodes.pop();
+if (textNode) {
+textNode.nodeValue = text;
+} else
+textNode = document.createTextNode(text);
+element.appendChild(textNode);
+if (!("textNodes" in element))
+element.textNodes = [];
+element.textNodes.push(textNode);
+},
+
+_createLink: function(content, isExternal)
+{
+var quote = content.charAt(0);
+if (content.length > 1 && (quote === "\"" ||   quote === "'"))
+content = content.substring(1, content.length - 1);
+else
+quote = null;
+
+var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal);
+var span = document.createElement("span");
+span.className = "webkit-html-attribute-value";
+if (quote)
+span.appendChild(document.createTextNode(quote));
+span.appendChild(a);
+if (quote)
+span.appendChild(document.createTextNode(quote));
+return span;
+},
+
+_rewriteHref: function(hrefValue, isExternal)
+{
+if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0)
+return hrefValue;
+return WebInspector.completeURL(this._url, hrefValue);
+},
+
+resize: function()
+{
+this._repaintAll();
+}
 }
 
 var cachedSpans = [];
 
 WebInspector.TextChunk = function(textViewer, startLine, endLine)
 {
-    this._textViewer = textViewer;
-    this.element = document.createElement("tr");
-    this._textModel = textViewer._textModel;
-    this.element.chunk = this;
-    this.element.lineNumber = startLine;
+this._textViewer = textViewer;
+this.element = document.createElement("tr");
+this._textModel = textViewer._textModel;
+this.element.chunk = this;
+this.element.lineNumber = startLine;
 
-    this.startLine = startLine;
-    endLine = Math.min(this._textModel.linesCount, endLine);
-    this.linesCount = endLine - startLine;
+this.startLine = startLine;
+endLine = Math.min(this._textModel.linesCount, endLine);
+this.linesCount = endLine - startLine;
 
-    this._lineNumberElement = document.createElement("td");
-    this._lineNumberElement.className = "webkit-line-number";
-    this.element.appendChild(this._lineNumberElement);
+this._lineNumberElement = document.createElement("td");
+this._lineNumberElement.className = "webkit-line-number";
+this.element.appendChild(this._lineNumberElement);
 
-    this._lineContentElement = document.createElement("td");
-    this._lineContentElement.className = "webkit-line-content";
-    this.element.appendChild(this._lineContentElement);
+this._lineContentElement = document.createElement("td");
+this._lineContentElement.className = "webkit-line-content";
+this.element.appendChild(this._lineContentElement);
 
-    this._expanded = false;
+this._expanded = false;
 
-    var lineNumbers = [];
-    var lines = [];
-    for (var i = startLine; i < endLine; ++i) {
-        lineNumbers.push(i + 1);
-        lines.push(this._textModel.line(i));
-    }
-    if (this.linesCount === 1) {
-        // Single line chunks are typically created for decorations. Host line number in
-        // the sub-element in order to allow flexible border / margin management.
-        var innerSpan = document.createElement("span");
-        innerSpan.className = "webkit-line-number-inner";
-        innerSpan.textContent = startLine + 1;
-        var outerSpan = document.createElement("div");
-        outerSpan.className = "webkit-line-number-outer";
-        outerSpan.appendChild(innerSpan);
-        this._lineNumberElement.appendChild(outerSpan);
-    } else
-        this._lineNumberElement.textContent = lineNumbers.join("\n");
-    this._lineContentElement.textContent = lines.join("\n");
+var lineNumbers = [];
+var lines = [];
+for (var i = startLine; i < endLine; ++i) {
+lineNumbers.push(i + 1);
+lines.push(this._textModel.line(i));
+}
+if (this.linesCount === 1) {
+
+
+var innerSpan = document.createElement("span");
+innerSpan.className = "webkit-line-number-inner";
+innerSpan.textContent = startLine + 1;
+var outerSpan = document.createElement("div");
+outerSpan.className = "webkit-line-number-outer";
+outerSpan.appendChild(innerSpan);
+this._lineNumberElement.appendChild(outerSpan);
+} else
+this._lineNumberElement.textContent = lineNumbers.join("\n");
+this._lineContentElement.textContent = lines.join("\n");
 }
 
 WebInspector.TextChunk.prototype = {
-    addDecoration: function(decoration)
-    {
-        if (typeof decoration === "string") {
-            this.element.addStyleClass(decoration);
-            return;
-        }
-        if (!this.element.decorationsElement) {
-            this.element.decorationsElement = document.createElement("div");
-            this._lineContentElement.appendChild(this.element.decorationsElement);
-        }
-        this.element.decorationsElement.appendChild(decoration);
-    },
+addDecoration: function(decoration)
+{
+if (typeof decoration === "string") {
+this.element.addStyleClass(decoration);
+return;
+}
+if (!this.element.decorationsElement) {
+this.element.decorationsElement = document.createElement("div");
+this._lineContentElement.appendChild(this.element.decorationsElement);
+}
+this.element.decorationsElement.appendChild(decoration);
+},
 
-    removeDecoration: function(decoration)
-    {
-        if (typeof decoration === "string") {
-            this.element.removeStyleClass(decoration);
-            return;
-        }
-        if (!this.element.decorationsElement)
-            return;
-        this.element.decorationsElement.removeChild(decoration);
-    },
+removeDecoration: function(decoration)
+{
+if (typeof decoration === "string") {
+this.element.removeStyleClass(decoration);
+return;
+}
+if (!this.element.decorationsElement)
+return;
+this.element.decorationsElement.removeChild(decoration);
+},
 
-    get expanded()
-    {
-        return this._expanded;
-    },
+get expanded()
+{
+return this._expanded;
+},
 
-    set expanded(expanded)
-    {
-        if (this._expanded === expanded)
-            return;
+set expanded(expanded)
+{
+if (this._expanded === expanded)
+return;
 
-        this._expanded = expanded;
+this._expanded = expanded;
 
-        if (this.linesCount === 1) {
-            this._textModel.setAttribute(this.startLine, "line-row", this.element);
-            if (expanded)
-                this._textViewer._paintLines(this.startLine, this.startLine + 1);
-            return;
-        }
-
-        if (expanded) {
-            var parentElement = this.element.parentElement;
-            for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
-                var lineRow = this._createRow(i);
-                this._textModel.setAttribute(i, "line-row", lineRow);
-                parentElement.insertBefore(lineRow, this.element);
-            }
-            parentElement.removeChild(this.element);
-
-            this._textViewer._paintLines(this.startLine, this.startLine + this.linesCount);
-        } else {
-            var firstLine = this._textModel.getAttribute(this.startLine, "line-row");
-            var parentElement = firstLine.parentElement;
-            this._textViewer._releaseLinesHighlight(this.startLine, this.startLine + this.linesCount);
-
-            parentElement.insertBefore(this.element, firstLine);
-            for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
-                var lineRow = this._textModel.getAttribute(i, "line-row");
-                this._textModel.removeAttribute(i, "line-row");
-                this._textViewer._cachedRows.push(lineRow);
-                parentElement.removeChild(lineRow);
-            }
-        }
-    },
-
-    get height()
-    {
-        if (!this._expanded)
-            return this.element.offsetHeight;
-        var result = 0;
-        for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
-            var lineRow = this._textModel.getAttribute(i, "line-row");
-            result += lineRow.offsetHeight;
-        }
-        return result;
-    },
-
-    _createRow: function(lineNumber)
-    {
-        var cachedRows = this._textViewer._cachedRows;
-        if (cachedRows.length) {
-            var lineRow = cachedRows[cachedRows.length - 1];
-            cachedRows.length--;
-            var lineNumberElement = lineRow.firstChild;
-            var lineContentElement = lineRow.lastChild;
-        } else {
-            var lineRow = document.createElement("tr");
-
-            var lineNumberElement = document.createElement("td");
-            lineNumberElement.className = "webkit-line-number";
-            lineRow.appendChild(lineNumberElement);
-
-            var lineContentElement = document.createElement("td");
-            lineContentElement.className = "webkit-line-content";
-            lineRow.appendChild(lineContentElement);        
-        }
-        lineRow.lineNumber = lineNumber;
-        lineNumberElement.textContent = lineNumber + 1;
-        lineContentElement.textContent = this._textModel.line(lineNumber);
-        return lineRow;
-    }
+if (this.linesCount === 1) {
+this._textModel.setAttribute(this.startLine, "line-row", this.element);
+if (expanded)
+this._textViewer._paintLines(this.startLine, this.startLine + 1);
+return;
 }
 
-/* SourceTokenizer.js */
+if (expanded) {
+var parentElement = this.element.parentElement;
+for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
+var lineRow = this._createRow(i);
+this._textModel.setAttribute(i, "line-row", lineRow);
+parentElement.insertBefore(lineRow, this.element);
+}
+parentElement.removeChild(this.element);
 
-/* Generated by re2c 0.13.5 on Tue Jan 26 01:16:33 2010 */
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+this._textViewer._paintLines(this.startLine, this.startLine + this.linesCount);
+} else {
+var firstLine = this._textModel.getAttribute(this.startLine, "line-row");
+var parentElement = firstLine.parentElement;
+this._textViewer._releaseLinesHighlight(this.startLine, this.startLine + this.linesCount);
+
+parentElement.insertBefore(this.element, firstLine);
+for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
+var lineRow = this._textModel.getAttribute(i, "line-row");
+this._textModel.removeAttribute(i, "line-row");
+this._textViewer._cachedRows.push(lineRow);
+parentElement.removeChild(lineRow);
+}
+}
+},
+
+get height()
+{
+if (!this._expanded)
+return this.element.offsetHeight;
+var result = 0;
+for (var i = this.startLine; i < this.startLine + this.linesCount; ++i) {
+var lineRow = this._textModel.getAttribute(i, "line-row");
+result += lineRow.offsetHeight;
+}
+return result;
+},
+
+_createRow: function(lineNumber)
+{
+var cachedRows = this._textViewer._cachedRows;
+if (cachedRows.length) {
+var lineRow = cachedRows[cachedRows.length - 1];
+cachedRows.length--;
+var lineNumberElement = lineRow.firstChild;
+var lineContentElement = lineRow.lastChild;
+} else {
+var lineRow = document.createElement("tr");
+
+var lineNumberElement = document.createElement("td");
+lineNumberElement.className = "webkit-line-number";
+lineRow.appendChild(lineNumberElement);
+
+var lineContentElement = document.createElement("td");
+lineContentElement.className = "webkit-line-content";
+lineRow.appendChild(lineContentElement);        
+}
+lineRow.lineNumber = lineNumber;
+lineNumberElement.textContent = lineNumber + 1;
+lineContentElement.textContent = this._textModel.line(lineNumber);
+return lineRow;
+}
+}
+
+
+
+
+
 
 WebInspector.SourceTokenizer = function()
 {
 }
 
 WebInspector.SourceTokenizer.prototype = {
-    set line(line) {
-        this._line = line;
-    },
+set line(line) {
+this._line = line;
+},
 
-    set condition(condition)
-    {
-        this._condition = condition;
-    },
+set condition(condition)
+{
+this._condition = condition;
+},
 
-    get condition()
-    {
-        return this._condition;
-    },
+get condition()
+{
+return this._condition;
+},
 
-    get subTokenizer()
-    {
-        return this._condition.subTokenizer;
-    },
+get subTokenizer()
+{
+return this._condition.subTokenizer;
+},
 
-    getLexCondition: function()
-    {
-        return this.condition.lexCondition;
-    },
+getLexCondition: function()
+{
+return this.condition.lexCondition;
+},
 
-    setLexCondition: function(lexCondition)
-    {
-        this.condition.lexCondition = lexCondition;
-    },
+setLexCondition: function(lexCondition)
+{
+this.condition.lexCondition = lexCondition;
+},
 
-    _charAt: function(cursor)
-    {
-        return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
-    }
+_charAt: function(cursor)
+{
+return cursor < this._line.length ? this._line.charAt(cursor) : "\n";
+}
 }
 
 
 WebInspector.SourceTokenizer.Registry = function() {
-    this._tokenizers = {};
-    this._tokenizerConstructors = {
-        "text/css": "SourceCSSTokenizer",
-        "text/html": "SourceHTMLTokenizer",
-        "text/javascript": "SourceJavaScriptTokenizer",
-        "application/javascript": "SourceJavaScriptTokenizer",
-        "application/x-javascript": "SourceJavaScriptTokenizer"
-    };
+this._tokenizers = {};
+this._tokenizerConstructors = {
+"text/css": "SourceCSSTokenizer",
+"text/html": "SourceHTMLTokenizer",
+"text/javascript": "SourceJavaScriptTokenizer"
+};
 }
 
 WebInspector.SourceTokenizer.Registry.getInstance = function()
 {
-    if (!WebInspector.SourceTokenizer.Registry._instance)
-        WebInspector.SourceTokenizer.Registry._instance = new WebInspector.SourceTokenizer.Registry();
-    return WebInspector.SourceTokenizer.Registry._instance;
+if (!WebInspector.SourceTokenizer.Registry._instance)
+WebInspector.SourceTokenizer.Registry._instance = new WebInspector.SourceTokenizer.Registry();
+return WebInspector.SourceTokenizer.Registry._instance;
 }
 
 WebInspector.SourceTokenizer.Registry.prototype = {
-    getTokenizer: function(mimeType)
-    {
-        if (!this._tokenizerConstructors[mimeType])
-            return null;
-        var tokenizerClass = this._tokenizerConstructors[mimeType];
-        var tokenizer = this._tokenizers[tokenizerClass];
-        if (!tokenizer) {
-            tokenizer = new WebInspector[tokenizerClass]();
-            this._tokenizers[mimeType] = tokenizer;
-        }
-        return tokenizer;
-    }
+getTokenizer: function(mimeType)
+{
+if (!this._tokenizerConstructors[mimeType])
+return null;
+var tokenizerClass = this._tokenizerConstructors[mimeType];
+var tokenizer = this._tokenizers[tokenizerClass];
+if (!tokenizer) {
+tokenizer = new WebInspector[tokenizerClass]();
+this._tokenizers[mimeType] = tokenizer;
+}
+return tokenizer;
+}
 }
 
-/* SourceCSSTokenizer.js */
 
-/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-// Generate js file as follows:
-//
-// re2c -isc WebCore/inspector/front-end/SourceCSSTokenizer.re2js \
-// | sed 's|^yy\([^:]*\)*\:|case \1:|' \
-// | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \
-// | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \
-// | sed 's|[*]cursor|this._charAt(cursor)|' \
-// | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \
-// | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \
-// | sed 's|unsigned\ int|var|' \
-// | sed 's|var\ yych|case 1: case 1: var yych|'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 WebInspector.SourceCSSTokenizer = function()
 {
-    WebInspector.SourceTokenizer.call(this);
+WebInspector.SourceTokenizer.call(this);
 
-    this._propertyKeywords = [
-        "background", "background-attachment", "background-clip", "background-color", "background-image",
-        "background-origin", "background-position", "background-position-x", "background-position-y",
-        "background-repeat", "background-repeat-x", "background-repeat-y", "background-size", "border",
-        "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius",
-        "border-bottom-style", "border-bottom-width", "border-collapse", "border-color", "border-left",
-        "border-left-color", "border-left-style", "border-left-width", "border-radius", "border-right",
-        "border-right-color", "border-right-style", "border-right-width", "border-spacing", "border-style",
-        "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-style",
-        "border-top-width", "border-width", "bottom", "caption-side", "clear", "clip", "color", "content",
-        "counter-increment", "counter-reset", "cursor", "direction", "display", "empty-cells", "float",
-        "font", "font-family", "font-size", "font-stretch", "font-style", "font-variant", "font-weight",
-        "height", "left", "letter-spacing", "line-height", "list-style", "list-style-image", "list-style-position",
-        "list-style-type", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "max-height",
-        "max-width", "min-height", "min-width", "opacity", "orphans", "outline", "outline-color", "outline-offset",
-        "outline-style", "outline-width", "overflow", "overflow-x", "overflow-y", "padding", "padding-bottom",
-        "padding-left", "padding-right", "padding-top", "page", "page-break-after", "page-break-before",
-        "page-break-inside", "pointer-events", "position", "quotes", "resize", "right", "size", "src",
-        "table-layout", "text-align", "text-decoration", "text-indent", "text-line-through", "text-line-through-color",
-        "text-line-through-mode", "text-line-through-style", "text-line-through-width", "text-overflow", "text-overline",
-        "text-overline-color", "text-overline-mode", "text-overline-style", "text-overline-width", "text-rendering",
-        "text-shadow", "text-transform", "text-underline", "text-underline-color", "text-underline-mode",
-        "text-underline-style", "text-underline-width", "top", "unicode-bidi", "unicode-range", "vertical-align",
-        "visibility", "white-space", "widows", "width", "word-break", "word-spacing", "word-wrap", "z-index", "zoom",
-        "-webkit-animation", "-webkit-animation-delay", "-webkit-animation-direction", "-webkit-animation-duration",
-        "-webkit-animation-iteration-count", "-webkit-animation-name", "-webkit-animation-play-state",
-        "-webkit-animation-timing-function", "-webkit-appearance", "-webkit-backface-visibility",
-        "-webkit-background-clip", "-webkit-background-composite", "-webkit-background-origin", "-webkit-background-size",
-        "-webkit-binding", "-webkit-border-fit", "-webkit-border-horizontal-spacing", "-webkit-border-image",
-        "-webkit-border-radius", "-webkit-border-vertical-spacing", "-webkit-box-align", "-webkit-box-direction",
-        "-webkit-box-flex", "-webkit-box-flex-group", "-webkit-box-lines", "-webkit-box-ordinal-group",
-        "-webkit-box-orient", "-webkit-box-pack", "-webkit-box-reflect", "-webkit-box-shadow", "-webkit-box-sizing",
-        "-webkit-column-break-after", "-webkit-column-break-before", "-webkit-column-break-inside", "-webkit-column-count",
-        "-webkit-column-gap", "-webkit-column-rule", "-webkit-column-rule-color", "-webkit-column-rule-style",
-        "-webkit-column-rule-width", "-webkit-column-width", "-webkit-columns", "-webkit-font-size-delta",
-        "-webkit-font-smoothing", "-webkit-highlight", "-webkit-line-break", "-webkit-line-clamp",
-        "-webkit-margin-bottom-collapse", "-webkit-margin-collapse", "-webkit-margin-start", "-webkit-margin-top-collapse",
-        "-webkit-marquee", "-webkit-marquee-direction", "-webkit-marquee-increment", "-webkit-marquee-repetition",
-        "-webkit-marquee-speed", "-webkit-marquee-style", "-webkit-mask", "-webkit-mask-attachment",
-        "-webkit-mask-box-image", "-webkit-mask-clip", "-webkit-mask-composite", "-webkit-mask-image",
-        "-webkit-mask-origin", "-webkit-mask-position", "-webkit-mask-position-x", "-webkit-mask-position-y",
-        "-webkit-mask-repeat", "-webkit-mask-repeat-x", "-webkit-mask-repeat-y", "-webkit-mask-size",
-        "-webkit-match-nearest-mail-blockquote-color", "-webkit-nbsp-mode", "-webkit-padding-start",
-        "-webkit-perspective", "-webkit-perspective-origin", "-webkit-perspective-origin-x", "-webkit-perspective-origin-y",
-        "-webkit-rtl-ordering", "-webkit-text-decorations-in-effect", "-webkit-text-fill-color", "-webkit-text-security",
-        "-webkit-text-size-adjust", "-webkit-text-stroke", "-webkit-text-stroke-color", "-webkit-text-stroke-width",
-        "-webkit-transform", "-webkit-transform-origin", "-webkit-transform-origin-x", "-webkit-transform-origin-y",
-        "-webkit-transform-origin-z", "-webkit-transform-style", "-webkit-transition", "-webkit-transition-delay",
-        "-webkit-transition-duration", "-webkit-transition-property", "-webkit-transition-timing-function",
-        "-webkit-user-drag", "-webkit-user-modify", "-webkit-user-select", "-webkit-variable-declaration-block"
-    ].keySet();
-    
-    this._valueKeywords = [
-        "above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
-        "alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian",
-        "auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink",
-        "block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
-        "button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator",
-        "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic",
-        "clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu",
-        "continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
-        "default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document",
-        "dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element",
-        "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez",
-        "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et",
-        "ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
-        "ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
-        "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision",
-        "georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
-        "hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
-        "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline",
-        "inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana",
-        "katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
-        "list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-hexadecimal", "lower-latin",
-        "lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "maroon", "match", "media-controls-background", "media-current-time-display",
-        "media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button",
-        "media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display",
-        "media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button",
-        "menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple",
-        "myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
-        "normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "olive", "open-quote", "optimizeLegibility",
-        "optimizeSpeed", "orange", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
-        "persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
-        "push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x",
-        "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif",
-        "scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
-        "searchfield-results-decoration", "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", "silver", "single",
-        "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
-        "small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over",
-        "space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super",
-        "sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group",
-        "table-row", "table-row-group", "teal", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin",
-        "threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede",
-        "tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
-        "upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible",
-        "visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext",
-        "x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle",
-        "-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing",
-        "-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right",
-        "-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
-    ].keySet();
+this._propertyKeywords = WebInspector.CSSCompletions.keySet();
 
-    this._mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "import", "print", "projection", "screen", "tty", "tv"].keySet();
+this._valueKeywords = [
+"above", "absolute", "activeborder", "activecaption", "afar", "after-white-space", "ahead", "alias", "all", "all-scroll",
+"alternate", "always","amharic", "amharic-abegede", "antialiased", "appworkspace", "aqua", "arabic-indic", "armenian",
+"auto", "avoid", "background", "backwards", "baseline", "below", "bidi-override", "binary", "bengali", "black", "blink",
+"block", "block-axis", "blue", "bold", "bolder", "border", "border-box", "both", "bottom", "break-all", "break-word", "button",
+"button-bevel", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "cambodian", "capitalize", "caps-lock-indicator",
+"caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic",
+"clear", "clip", "close-quote", "col-resize", "collapse", "compact", "condensed", "contain", "content", "content-box", "context-menu",
+"continuous", "copy", "cover", "crop", "cross", "crosshair", "currentcolor", "cursive", "dashed", "decimal", "decimal-leading-zero", "default",
+"default-button", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "disc", "discard", "document",
+"dot-dash", "dot-dot-dash", "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element",
+"ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez",
+"ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-halehame-aa-et",
+"ethiopic-halehame-am-et", "ethiopic-halehame-gez", "ethiopic-halehame-om-et", "ethiopic-halehame-sid-et",
+"ethiopic-halehame-so-et", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ew-resize", "expanded",
+"extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "forwards", "from", "fuchsia", "geometricPrecision",
+"georgian", "gray", "graytext", "green", "grey", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hebrew", "help",
+"hidden", "hide", "higher", "highlight", "highlighttext", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "icon", "ignore",
+"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline",
+"inline-axis", "inline-block", "inline-table", "inset", "inside", "intrinsic", "invert", "italic", "justify", "kannada", "katakana",
+"katakana-iroha", "khmer", "landscape", "lao", "large", "larger", "left", "level", "lighter", "lime", "line-through", "linear", "lines",
+"list-button", "list-item", "listbox", "listitem", "local", "logical", "loud", "lower", "lower-alpha", "lower-greek", "lower-hexadecimal", "lower-latin",
+"lower-norwegian", "lower-roman", "lowercase", "ltr", "malayalam", "maroon", "match", "media-controls-background", "media-current-time-display",
+"media-fullscreen-button", "media-mute-button", "media-play-button", "media-return-to-realtime-button", "media-rewind-button",
+"media-seek-back-button", "media-seek-forward-button", "media-slider", "media-sliderthumb", "media-time-remaining-display",
+"media-volume-slider", "media-volume-slider-container", "media-volume-sliderthumb", "medium", "menu", "menulist", "menulist-button",
+"menulist-text", "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple",
+"myanmar", "n-resize", "narrower", "navy", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none",
+"normal", "not-allowed", "nowrap", "ns-resize", "nw-resize", "nwse-resize", "oblique", "octal", "olive", "open-quote", "optimizeLegibility",
+"optimizeSpeed", "orange", "oriya", "oromo", "outset", "outside", "overlay", "overline", "padding", "padding-box", "painted", "paused",
+"persian", "plus-darker", "plus-lighter", "pointer", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "purple",
+"push-button", "radio", "read-only", "read-write", "read-write-plaintext-only", "red", "relative", "repeat", "repeat-x",
+"repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "round", "row-resize", "rtl", "run-in", "running", "s-resize", "sans-serif",
+"scroll", "scrollbar", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button",
+"searchfield-results-decoration", "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", "silver", "single",
+"skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
+"small", "small-caps", "small-caption", "smaller", "solid", "somali", "source-atop", "source-in", "source-out", "source-over",
+"space", "square", "square-button", "start", "static", "status-bar", "stretch", "stroke", "sub", "subpixel-antialiased", "super",
+"sw-resize", "table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group",
+"table-row", "table-row-group", "teal", "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai", "thick", "thin",
+"threeddarkshadow", "threedface", "threedhighlight", "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er", "tigrinya-er-abegede",
+"tigrinya-et", "tigrinya-et-abegede", "to", "top", "transparent", "ultra-condensed", "ultra-expanded", "underline", "up", "upper-alpha", "upper-greek",
+"upper-hexadecimal", "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url", "vertical", "vertical-text", "visible",
+"visibleFill", "visiblePainted", "visibleStroke", "visual", "w-resize", "wait", "wave", "white", "wider", "window", "windowframe", "windowtext",
+"x-large", "x-small", "xor", "xx-large", "xx-small", "yellow", "-wap-marquee", "-webkit-activelink", "-webkit-auto", "-webkit-baseline-middle",
+"-webkit-body", "-webkit-box", "-webkit-center", "-webkit-control", "-webkit-focus-ring-color", "-webkit-grab", "-webkit-grabbing",
+"-webkit-gradient", "-webkit-inline-box", "-webkit-left", "-webkit-link", "-webkit-marquee", "-webkit-mini-control", "-webkit-nowrap", "-webkit-right",
+"-webkit-small-control", "-webkit-text", "-webkit-xxx-large", "-webkit-zoom-in", "-webkit-zoom-out",
+].keySet();
 
-    this._lexConditions = {
-        INITIAL: 0,
-        COMMENT: 1,
-        DSTRING: 2,
-        SSTRING: 3
-    };
+this._mediaTypes = ["all", "aural", "braille", "embossed", "handheld", "import", "print", "projection", "screen", "tty", "tv"].keySet();
 
-    this._parseConditions = {
-        INITIAL: 0,
-        PROPERTY: 1,
-        PROPERTY_VALUE: 2,
-        AT_RULE: 3
-    };
+this._lexConditions = {
+INITIAL: 0,
+COMMENT: 1,
+DSTRING: 2,
+SSTRING: 3
+};
 
-    this.case_INITIAL = 1000;
-    this.case_COMMENT = 1002;
-    this.case_DSTRING = 1003;
-    this.case_SSTRING = 1004;
+this._parseConditions = {
+INITIAL: 0,
+PROPERTY: 1,
+PROPERTY_VALUE: 2,
+AT_RULE: 3
+};
 
-    this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }
+this.case_INITIAL = 1000;
+this.case_COMMENT = 1002;
+this.case_DSTRING = 1003;
+this.case_SSTRING = 1004;
+
+this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }
 }
 
 WebInspector.SourceCSSTokenizer.prototype = {
-    _stringToken: function(cursor, stringEnds)
-    {
-        if (this._isPropertyValue())
-            this.tokenType = "css-string";
-        else
-            this.tokenType = null;
-        return cursor;
-    },
+_stringToken: function(cursor, stringEnds)
+{
+if (this._isPropertyValue())
+this.tokenType = "css-string";
+else
+this.tokenType = null;
+return cursor;
+},
 
-    _isPropertyValue: function()
-    {
-        return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE;
-    },
+_isPropertyValue: function()
+{
+return this._condition.parseCondition === this._parseConditions.PROPERTY_VALUE || this._condition.parseCondition === this._parseConditions.AT_RULE;
+},
 
-    nextToken: function(cursor)
-    {
-        var cursorOnEnter = cursor;
-        var gotoCase = 1;
-        while (1) {
-            switch (gotoCase)
-            // Following comment is replaced with generated state machine.
-            
-        {
-            case 1: var yych;
-            var yyaccept = 0;
-            if (this.getLexCondition() < 2) {
-                if (this.getLexCondition() < 1) {
-                    { gotoCase = this.case_INITIAL; continue; };
-                } else {
-                    { gotoCase = this.case_COMMENT; continue; };
-                }
-            } else {
-                if (this.getLexCondition() < 3) {
-                    { gotoCase = this.case_DSTRING; continue; };
-                } else {
-                    { gotoCase = this.case_SSTRING; continue; };
-                }
-            }
-/* *********************************** */
+nextToken: function(cursor)
+{
+var cursorOnEnter = cursor;
+var gotoCase = 1;
+while (1) {
+switch (gotoCase)
+
+
+{
+case 1: var yych;
+var yyaccept = 0;
+if (this.getLexCondition() < 2) {
+if (this.getLexCondition() < 1) {
+{ gotoCase = this.case_INITIAL; continue; };
+} else {
+{ gotoCase = this.case_COMMENT; continue; };
+}
+} else {
+if (this.getLexCondition() < 3) {
+{ gotoCase = this.case_DSTRING; continue; };
+} else {
+{ gotoCase = this.case_SSTRING; continue; };
+}
+}
+
 case this.case_COMMENT:
 
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 4; continue; };
-                { gotoCase = 3; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 4; continue; };
-                if (yych == '*') { gotoCase = 6; continue; };
-                { gotoCase = 3; continue; };
-            }
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 4; continue; };
+{ gotoCase = 3; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 4; continue; };
+if (yych == '*') { gotoCase = 6; continue; };
+{ gotoCase = 3; continue; };
+}
 case 2:
-            { this.tokenType = "css-comment"; return cursor; }
+{ this.tokenType = "css-comment"; return cursor; }
 case 3:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 12; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 12; continue; };
 case 4:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 6:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '*') { gotoCase = 9; continue; };
-            if (yych != '/') { gotoCase = 11; continue; };
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '*') { gotoCase = 9; continue; };
+if (yych != '/') { gotoCase = 11; continue; };
 case 7:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.INITIAL);
-            { this.tokenType = "css-comment"; return cursor; }
+++cursor;
+this.setLexCondition(this._lexConditions.INITIAL);
+{ this.tokenType = "css-comment"; return cursor; }
 case 9:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '*') { gotoCase = 9; continue; };
-            if (yych == '/') { gotoCase = 7; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 9; continue; };
+if (yych == '/') { gotoCase = 7; continue; };
 case 11:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
 case 12:
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 2; continue; };
-                { gotoCase = 11; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 2; continue; };
-                if (yych == '*') { gotoCase = 9; continue; };
-                { gotoCase = 11; continue; };
-            }
-/* *********************************** */
-case this.case_DSTRING:
-            yych = this._charAt(cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 17; continue; };
-                if (yych <= '\f') { gotoCase = 16; continue; };
-                { gotoCase = 17; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 16; continue; };
-                    { gotoCase = 19; continue; };
-                } else {
-                    if (yych == '\\') { gotoCase = 21; continue; };
-                    { gotoCase = 16; continue; };
-                }
-            }
-case 15:
-            { return this._stringToken(cursor); }
-case 16:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 23; continue; };
-case 17:
-            ++cursor;
-case 18:
-            { this.tokenType = null; return cursor; }
-case 19:
-            ++cursor;
-case 20:
-            this.setLexCondition(this._lexConditions.INITIAL);
-            { return this._stringToken(cursor, true); }
-case 21:
-            yych = this._charAt(++cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 22; continue; };
-                    if (yych <= '&') { gotoCase = 18; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych <= '[') { gotoCase = 18; continue; };
-                    } else {
-                        if (yych != 'b') { gotoCase = 18; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych >= 'g') { gotoCase = 18; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 22; continue; };
-                        if (yych <= 'q') { gotoCase = 18; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych <= 's') { gotoCase = 18; continue; };
-                    } else {
-                        if (yych != 'v') { gotoCase = 18; continue; };
-                    }
-                }
-            }
-case 22:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 23:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 15; continue; };
-                if (yych <= '\f') { gotoCase = 22; continue; };
-                { gotoCase = 15; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 22; continue; };
-                    { gotoCase = 26; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 22; continue; };
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 22; continue; };
-                    if (yych >= '\'') { gotoCase = 22; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych >= '\\') { gotoCase = 22; continue; };
-                    } else {
-                        if (yych == 'b') { gotoCase = 22; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych <= 'f') { gotoCase = 22; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 22; continue; };
-                        if (yych >= 'r') { gotoCase = 22; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych >= 't') { gotoCase = 22; continue; };
-                    } else {
-                        if (yych == 'v') { gotoCase = 22; continue; };
-                    }
-                }
-            }
-            cursor = YYMARKER;
-            { gotoCase = 15; continue; };
-case 26:
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 20; continue; };
-/* *********************************** */
-case this.case_INITIAL:
-            yych = this._charAt(cursor);
-            if (yych <= ';') {
-                if (yych <= '\'') {
-                    if (yych <= '"') {
-                        if (yych <= ' ') { gotoCase = 29; continue; };
-                        if (yych <= '!') { gotoCase = 31; continue; };
-                        { gotoCase = 33; continue; };
-                    } else {
-                        if (yych == '$') { gotoCase = 31; continue; };
-                        if (yych >= '\'') { gotoCase = 34; continue; };
-                    }
-                } else {
-                    if (yych <= '.') {
-                        if (yych <= ',') { gotoCase = 29; continue; };
-                        if (yych <= '-') { gotoCase = 35; continue; };
-                        { gotoCase = 36; continue; };
-                    } else {
-                        if (yych <= '/') { gotoCase = 37; continue; };
-                        if (yych <= '9') { gotoCase = 38; continue; };
-                        if (yych <= ':') { gotoCase = 40; continue; };
-                        { gotoCase = 42; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '^') {
-                    if (yych <= '?') {
-                        if (yych == '=') { gotoCase = 31; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 29; continue; };
-                        if (yych <= ']') { gotoCase = 31; continue; };
-                    }
-                } else {
-                    if (yych <= 'z') {
-                        if (yych != '`') { gotoCase = 31; continue; };
-                    } else {
-                        if (yych <= '{') { gotoCase = 44; continue; };
-                        if (yych == '}') { gotoCase = 46; continue; };
-                    }
-                }
-            }
-case 29:
-            ++cursor;
-case 30:
-            { this.tokenType = null; return cursor; }
-case 31:
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 49; continue; };
-case 32:
-            {
-                    var token = this._line.substring(cursorOnEnter, cursor);
-                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
-                        if (token === "@import" || token === "@media") {
-                            this.tokenType = "css-at-rule";
-                            this._condition.parseCondition = this._parseConditions.AT_RULE;
-                        } else if (token.indexOf("@") === 0)
-                            this.tokenType = "css-at-rule";
-                        else
-                            this.tokenType = "css-selector";
-                    }
-                    else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
-                        this.tokenType = "css-keyword";
-                    else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
-                        this.tokenType = "css-property";
-                    else if (this._isPropertyValue() && token in this._valueKeywords)
-                        this.tokenType = "css-keyword";
-                    else if (token === "!important")
-                        this.tokenType = "css-important";
-                    else
-                        this.tokenType = null;
-                    return cursor;
-                }
-case 33:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '-') {
-                if (yych <= '!') {
-                    if (yych <= '\f') {
-                        if (yych == '\n') { gotoCase = 32; continue; };
-                        { gotoCase = 124; continue; };
-                    } else {
-                        if (yych <= '\r') { gotoCase = 32; continue; };
-                        if (yych <= ' ') { gotoCase = 124; continue; };
-                        { gotoCase = 122; continue; };
-                    }
-                } else {
-                    if (yych <= '$') {
-                        if (yych <= '"') { gotoCase = 114; continue; };
-                        if (yych <= '#') { gotoCase = 124; continue; };
-                        { gotoCase = 122; continue; };
-                    } else {
-                        if (yych == '\'') { gotoCase = 122; continue; };
-                        if (yych <= ',') { gotoCase = 124; continue; };
-                        { gotoCase = 122; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '<') {
-                        if (yych <= '.') { gotoCase = 124; continue; };
-                        if (yych <= '9') { gotoCase = 122; continue; };
-                        { gotoCase = 124; continue; };
-                    } else {
-                        if (yych <= '=') { gotoCase = 122; continue; };
-                        if (yych <= '?') { gotoCase = 124; continue; };
-                        { gotoCase = 122; continue; };
-                    }
-                } else {
-                    if (yych <= '^') {
-                        if (yych <= '\\') { gotoCase = 126; continue; };
-                        if (yych <= ']') { gotoCase = 122; continue; };
-                        { gotoCase = 124; continue; };
-                    } else {
-                        if (yych == '`') { gotoCase = 124; continue; };
-                        if (yych <= 'z') { gotoCase = 122; continue; };
-                        { gotoCase = 124; continue; };
-                    }
-                }
-            }
-case 34:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '-') {
-                if (yych <= '"') {
-                    if (yych <= '\f') {
-                        if (yych == '\n') { gotoCase = 32; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych <= '\r') { gotoCase = 32; continue; };
-                        if (yych <= ' ') { gotoCase = 116; continue; };
-                        { gotoCase = 112; continue; };
-                    }
-                } else {
-                    if (yych <= '&') {
-                        if (yych == '$') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych <= '\'') { gotoCase = 114; continue; };
-                        if (yych <= ',') { gotoCase = 116; continue; };
-                        { gotoCase = 112; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '<') {
-                        if (yych <= '.') { gotoCase = 116; continue; };
-                        if (yych <= '9') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych <= '=') { gotoCase = 112; continue; };
-                        if (yych <= '?') { gotoCase = 116; continue; };
-                        { gotoCase = 112; continue; };
-                    }
-                } else {
-                    if (yych <= '^') {
-                        if (yych <= '\\') { gotoCase = 118; continue; };
-                        if (yych <= ']') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych == '`') { gotoCase = 116; continue; };
-                        if (yych <= 'z') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    }
-                }
-            }
-case 35:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '.') { gotoCase = 65; continue; };
-            if (yych <= '/') { gotoCase = 49; continue; };
-            if (yych <= '9') { gotoCase = 50; continue; };
-            { gotoCase = 49; continue; };
-case 36:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 30; continue; };
-            if (yych <= '9') { gotoCase = 68; continue; };
-            { gotoCase = 30; continue; };
-case 37:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '*') { gotoCase = 104; continue; };
-            { gotoCase = 49; continue; };
-case 38:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            switch (yych) {
-            case '!':
-            case '"':
-            case '$':
-            case '\'':
-            case '-':
-            case '/':
-            case '=':
-            case '@':
-            case 'A':
-            case 'B':
-            case 'C':
-            case 'D':
-            case 'E':
-            case 'F':
-            case 'G':
-            case 'I':
-            case 'J':
-            case 'K':
-            case 'L':
-            case 'M':
-            case 'N':
-            case 'O':
-            case 'P':
-            case 'Q':
-            case 'R':
-            case 'S':
-            case 'T':
-            case 'U':
-            case 'V':
-            case 'W':
-            case 'X':
-            case 'Y':
-            case 'Z':
-            case '[':
-            case ']':
-            case 'a':
-            case 'b':
-            case 'f':
-            case 'h':
-            case 'j':
-            case 'l':
-            case 'n':
-            case 'o':
-            case 'q':
-            case 'u':
-            case 'v':
-            case 'w':
-            case 'x':
-            case 'y':
-            case 'z':    { gotoCase = 48; continue; };
-            case '%':    { gotoCase = 67; continue; };
-            case '.':    { gotoCase = 65; continue; };
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':    { gotoCase = 50; continue; };
-            case 'H':    { gotoCase = 52; continue; };
-            case '_':    { gotoCase = 53; continue; };
-            case 'c':    { gotoCase = 54; continue; };
-            case 'd':    { gotoCase = 55; continue; };
-            case 'e':    { gotoCase = 56; continue; };
-            case 'g':    { gotoCase = 57; continue; };
-            case 'i':    { gotoCase = 58; continue; };
-            case 'k':    { gotoCase = 59; continue; };
-            case 'm':    { gotoCase = 60; continue; };
-            case 'p':    { gotoCase = 61; continue; };
-            case 'r':    { gotoCase = 62; continue; };
-            case 's':    { gotoCase = 63; continue; };
-            case 't':    { gotoCase = 64; continue; };
-            default:    { gotoCase = 39; continue; };
-            }
-case 39:
-            {
-                    if (this._isPropertyValue())
-                        this.tokenType = "css-number";
-                    else
-                        this.tokenType = null;
-                    return cursor;
-                }
-case 40:
-            ++cursor;
-            {
-                    this.tokenType = null;
-                    if (this._condition.parseCondition === this._parseConditions.PROPERTY)
-                        this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE;
-                    return cursor;
-                }
-case 42:
-            ++cursor;
-            {
-                    this.tokenType = null;
-                    if (this._condition.parseCondition === this._parseConditions.AT_RULE)
-                        this._condition.parseCondition = this._parseConditions.INITIAL;
-                    else
-                        this._condition.parseCondition = this._parseConditions.PROPERTY;
-                    return cursor;
-                }
-case 44:
-            ++cursor;
-            {
-                    this.tokenType = null;
-                    if (this._condition.parseCondition === this._parseConditions.AT_RULE)
-                        this._condition.parseCondition = this._parseConditions.INITIAL;
-                    else
-                        this._condition.parseCondition = this._parseConditions.PROPERTY;
-                    return cursor;
-                }
-case 46:
-            ++cursor;
-            {
-                    this.tokenType = null;
-                    this._condition.parseCondition = this._parseConditions.INITIAL;
-                    return cursor;
-                }
-case 48:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 49:
-            if (yych <= '9') {
-                if (yych <= '&') {
-                    if (yych <= '"') {
-                        if (yych <= ' ') { gotoCase = 32; continue; };
-                        { gotoCase = 48; continue; };
-                    } else {
-                        if (yych == '$') { gotoCase = 48; continue; };
-                        { gotoCase = 32; continue; };
-                    }
-                } else {
-                    if (yych <= ',') {
-                        if (yych <= '\'') { gotoCase = 48; continue; };
-                        { gotoCase = 32; continue; };
-                    } else {
-                        if (yych == '.') { gotoCase = 32; continue; };
-                        { gotoCase = 48; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '\\') {
-                    if (yych <= '=') {
-                        if (yych <= '<') { gotoCase = 32; continue; };
-                        { gotoCase = 48; continue; };
-                    } else {
-                        if (yych <= '?') { gotoCase = 32; continue; };
-                        if (yych <= '[') { gotoCase = 48; continue; };
-                        { gotoCase = 32; continue; };
-                    }
-                } else {
-                    if (yych <= '_') {
-                        if (yych == '^') { gotoCase = 32; continue; };
-                        { gotoCase = 48; continue; };
-                    } else {
-                        if (yych <= '`') { gotoCase = 32; continue; };
-                        if (yych <= 'z') { gotoCase = 48; continue; };
-                        { gotoCase = 32; continue; };
-                    }
-                }
-            }
-case 50:
-            yyaccept = 1;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            switch (yych) {
-            case '!':
-            case '"':
-            case '$':
-            case '\'':
-            case '-':
-            case '/':
-            case '=':
-            case '@':
-            case 'A':
-            case 'B':
-            case 'C':
-            case 'D':
-            case 'E':
-            case 'F':
-            case 'G':
-            case 'I':
-            case 'J':
-            case 'K':
-            case 'L':
-            case 'M':
-            case 'N':
-            case 'O':
-            case 'P':
-            case 'Q':
-            case 'R':
-            case 'S':
-            case 'T':
-            case 'U':
-            case 'V':
-            case 'W':
-            case 'X':
-            case 'Y':
-            case 'Z':
-            case '[':
-            case ']':
-            case 'a':
-            case 'b':
-            case 'f':
-            case 'h':
-            case 'j':
-            case 'l':
-            case 'n':
-            case 'o':
-            case 'q':
-            case 'u':
-            case 'v':
-            case 'w':
-            case 'x':
-            case 'y':
-            case 'z':    { gotoCase = 48; continue; };
-            case '%':    { gotoCase = 67; continue; };
-            case '.':    { gotoCase = 65; continue; };
-            case '0':
-            case '1':
-            case '2':
-            case '3':
-            case '4':
-            case '5':
-            case '6':
-            case '7':
-            case '8':
-            case '9':    { gotoCase = 50; continue; };
-            case 'H':    { gotoCase = 52; continue; };
-            case '_':    { gotoCase = 53; continue; };
-            case 'c':    { gotoCase = 54; continue; };
-            case 'd':    { gotoCase = 55; continue; };
-            case 'e':    { gotoCase = 56; continue; };
-            case 'g':    { gotoCase = 57; continue; };
-            case 'i':    { gotoCase = 58; continue; };
-            case 'k':    { gotoCase = 59; continue; };
-            case 'm':    { gotoCase = 60; continue; };
-            case 'p':    { gotoCase = 61; continue; };
-            case 'r':    { gotoCase = 62; continue; };
-            case 's':    { gotoCase = 63; continue; };
-            case 't':    { gotoCase = 64; continue; };
-            default:    { gotoCase = 39; continue; };
-            }
-case 52:
-            yych = this._charAt(++cursor);
-            if (yych == 'z') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 53:
-            yych = this._charAt(++cursor);
-            if (yych == '_') { gotoCase = 101; continue; };
-            { gotoCase = 49; continue; };
-case 54:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 55:
-            yych = this._charAt(++cursor);
-            if (yych == 'e') { gotoCase = 100; continue; };
-            { gotoCase = 49; continue; };
-case 56:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 63; continue; };
-            if (yych == 'x') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 57:
-            yych = this._charAt(++cursor);
-            if (yych == 'r') { gotoCase = 98; continue; };
-            { gotoCase = 49; continue; };
-case 58:
-            yych = this._charAt(++cursor);
-            if (yych == 'n') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 59:
-            yych = this._charAt(++cursor);
-            if (yych == 'H') { gotoCase = 97; continue; };
-            { gotoCase = 49; continue; };
-case 60:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 63; continue; };
-            if (yych == 's') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 61:
-            yych = this._charAt(++cursor);
-            if (yych <= 's') {
-                if (yych == 'c') { gotoCase = 63; continue; };
-                { gotoCase = 49; continue; };
-            } else {
-                if (yych <= 't') { gotoCase = 63; continue; };
-                if (yych == 'x') { gotoCase = 63; continue; };
-                { gotoCase = 49; continue; };
-            }
-case 62:
-            yych = this._charAt(++cursor);
-            if (yych == 'a') { gotoCase = 95; continue; };
-            if (yych == 'e') { gotoCase = 96; continue; };
-            { gotoCase = 49; continue; };
-case 63:
-            yych = this._charAt(++cursor);
-            if (yych <= '9') {
-                if (yych <= '&') {
-                    if (yych <= '"') {
-                        if (yych <= ' ') { gotoCase = 39; continue; };
-                        { gotoCase = 48; continue; };
-                    } else {
-                        if (yych == '$') { gotoCase = 48; continue; };
-                        { gotoCase = 39; continue; };
-                    }
-                } else {
-                    if (yych <= ',') {
-                        if (yych <= '\'') { gotoCase = 48; continue; };
-                        { gotoCase = 39; continue; };
-                    } else {
-                        if (yych == '.') { gotoCase = 39; continue; };
-                        { gotoCase = 48; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '\\') {
-                    if (yych <= '=') {
-                        if (yych <= '<') { gotoCase = 39; continue; };
-                        { gotoCase = 48; continue; };
-                    } else {
-                        if (yych <= '?') { gotoCase = 39; continue; };
-                        if (yych <= '[') { gotoCase = 48; continue; };
-                        { gotoCase = 39; continue; };
-                    }
-                } else {
-                    if (yych <= '_') {
-                        if (yych == '^') { gotoCase = 39; continue; };
-                        { gotoCase = 48; continue; };
-                    } else {
-                        if (yych <= '`') { gotoCase = 39; continue; };
-                        if (yych <= 'z') { gotoCase = 48; continue; };
-                        { gotoCase = 39; continue; };
-                    }
-                }
-            }
-case 64:
-            yych = this._charAt(++cursor);
-            if (yych == 'u') { gotoCase = 93; continue; };
-            { gotoCase = 49; continue; };
-case 65:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 66; continue; };
-            if (yych <= '9') { gotoCase = 68; continue; };
-case 66:
-            cursor = YYMARKER;
-            if (yyaccept <= 0) {
-                { gotoCase = 32; continue; };
-            } else {
-                { gotoCase = 39; continue; };
-            }
-case 67:
-            yych = this._charAt(++cursor);
-            { gotoCase = 39; continue; };
-case 68:
-            yyaccept = 1;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'f') {
-                if (yych <= 'H') {
-                    if (yych <= '/') {
-                        if (yych == '%') { gotoCase = 67; continue; };
-                        { gotoCase = 39; continue; };
-                    } else {
-                        if (yych <= '9') { gotoCase = 68; continue; };
-                        if (yych <= 'G') { gotoCase = 39; continue; };
-                        { gotoCase = 80; continue; };
-                    }
-                } else {
-                    if (yych <= 'b') {
-                        if (yych == '_') { gotoCase = 72; continue; };
-                        { gotoCase = 39; continue; };
-                    } else {
-                        if (yych <= 'c') { gotoCase = 74; continue; };
-                        if (yych <= 'd') { gotoCase = 77; continue; };
-                        if (yych >= 'f') { gotoCase = 39; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'm') {
-                    if (yych <= 'i') {
-                        if (yych <= 'g') { gotoCase = 78; continue; };
-                        if (yych <= 'h') { gotoCase = 39; continue; };
-                        { gotoCase = 76; continue; };
-                    } else {
-                        if (yych == 'k') { gotoCase = 81; continue; };
-                        if (yych <= 'l') { gotoCase = 39; continue; };
-                        { gotoCase = 75; continue; };
-                    }
-                } else {
-                    if (yych <= 'q') {
-                        if (yych == 'p') { gotoCase = 73; continue; };
-                        { gotoCase = 39; continue; };
-                    } else {
-                        if (yych <= 'r') { gotoCase = 71; continue; };
-                        if (yych <= 's') { gotoCase = 67; continue; };
-                        if (yych <= 't') { gotoCase = 79; continue; };
-                        { gotoCase = 39; continue; };
-                    }
-                }
-            }
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 67; continue; };
-            if (yych == 'x') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 71:
-            yych = this._charAt(++cursor);
-            if (yych == 'a') { gotoCase = 91; continue; };
-            if (yych == 'e') { gotoCase = 92; continue; };
-            { gotoCase = 66; continue; };
-case 72:
-            yych = this._charAt(++cursor);
-            if (yych == '_') { gotoCase = 88; continue; };
-            { gotoCase = 66; continue; };
-case 73:
-            yych = this._charAt(++cursor);
-            if (yych <= 's') {
-                if (yych == 'c') { gotoCase = 67; continue; };
-                { gotoCase = 66; continue; };
-            } else {
-                if (yych <= 't') { gotoCase = 67; continue; };
-                if (yych == 'x') { gotoCase = 67; continue; };
-                { gotoCase = 66; continue; };
-            }
-case 74:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 75:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 67; continue; };
-            if (yych == 's') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 76:
-            yych = this._charAt(++cursor);
-            if (yych == 'n') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 77:
-            yych = this._charAt(++cursor);
-            if (yych == 'e') { gotoCase = 87; continue; };
-            { gotoCase = 66; continue; };
-case 78:
-            yych = this._charAt(++cursor);
-            if (yych == 'r') { gotoCase = 85; continue; };
-            { gotoCase = 66; continue; };
-case 79:
-            yych = this._charAt(++cursor);
-            if (yych == 'u') { gotoCase = 83; continue; };
-            { gotoCase = 66; continue; };
-case 80:
-            yych = this._charAt(++cursor);
-            if (yych == 'z') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 81:
-            yych = this._charAt(++cursor);
-            if (yych != 'H') { gotoCase = 66; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'z') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 83:
-            yych = this._charAt(++cursor);
-            if (yych != 'r') { gotoCase = 66; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'n') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 85:
-            yych = this._charAt(++cursor);
-            if (yych != 'a') { gotoCase = 66; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'd') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 87:
-            yych = this._charAt(++cursor);
-            if (yych == 'g') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 88:
-            yych = this._charAt(++cursor);
-            if (yych != 'q') { gotoCase = 66; continue; };
-            yych = this._charAt(++cursor);
-            if (yych != 'e') { gotoCase = 66; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 91:
-            yych = this._charAt(++cursor);
-            if (yych == 'd') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 92:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 67; continue; };
-            { gotoCase = 66; continue; };
-case 93:
-            yych = this._charAt(++cursor);
-            if (yych != 'r') { gotoCase = 49; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'n') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 95:
-            yych = this._charAt(++cursor);
-            if (yych == 'd') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 96:
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 97:
-            yych = this._charAt(++cursor);
-            if (yych == 'z') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 98:
-            yych = this._charAt(++cursor);
-            if (yych != 'a') { gotoCase = 49; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'd') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 100:
-            yych = this._charAt(++cursor);
-            if (yych == 'g') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 101:
-            yych = this._charAt(++cursor);
-            if (yych != 'q') { gotoCase = 49; continue; };
-            yych = this._charAt(++cursor);
-            if (yych != 'e') { gotoCase = 49; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == 'm') { gotoCase = 63; continue; };
-            { gotoCase = 49; continue; };
-case 104:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 108; continue; };
-                { gotoCase = 104; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 108; continue; };
-                if (yych != '*') { gotoCase = 104; continue; };
-            }
-case 106:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '*') { gotoCase = 106; continue; };
-            if (yych == '/') { gotoCase = 110; continue; };
-            { gotoCase = 104; continue; };
-case 108:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.COMMENT);
-            { this.tokenType = "css-comment"; return cursor; }
-case 110:
-            ++cursor;
-            { this.tokenType = "css-comment"; return cursor; }
-case 112:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '-') {
-                if (yych <= '"') {
-                    if (yych <= '\f') {
-                        if (yych == '\n') { gotoCase = 32; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych <= '\r') { gotoCase = 32; continue; };
-                        if (yych <= ' ') { gotoCase = 116; continue; };
-                        { gotoCase = 112; continue; };
-                    }
-                } else {
-                    if (yych <= '&') {
-                        if (yych == '$') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych <= '\'') { gotoCase = 114; continue; };
-                        if (yych <= ',') { gotoCase = 116; continue; };
-                        { gotoCase = 112; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '<') {
-                        if (yych <= '.') { gotoCase = 116; continue; };
-                        if (yych <= '9') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych <= '=') { gotoCase = 112; continue; };
-                        if (yych <= '?') { gotoCase = 116; continue; };
-                        { gotoCase = 112; continue; };
-                    }
-                } else {
-                    if (yych <= '^') {
-                        if (yych <= '\\') { gotoCase = 118; continue; };
-                        if (yych <= ']') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych == '`') { gotoCase = 116; continue; };
-                        if (yych <= 'z') { gotoCase = 112; continue; };
-                        { gotoCase = 116; continue; };
-                    }
-                }
-            }
-case 114:
-            ++cursor;
-            if ((yych = this._charAt(cursor)) <= '9') {
-                if (yych <= '&') {
-                    if (yych <= '"') {
-                        if (yych >= '!') { gotoCase = 48; continue; };
-                    } else {
-                        if (yych == '$') { gotoCase = 48; continue; };
-                    }
-                } else {
-                    if (yych <= ',') {
-                        if (yych <= '\'') { gotoCase = 48; continue; };
-                    } else {
-                        if (yych != '.') { gotoCase = 48; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '\\') {
-                    if (yych <= '=') {
-                        if (yych >= '=') { gotoCase = 48; continue; };
-                    } else {
-                        if (yych <= '?') { gotoCase = 115; continue; };
-                        if (yych <= '[') { gotoCase = 48; continue; };
-                    }
-                } else {
-                    if (yych <= '_') {
-                        if (yych != '^') { gotoCase = 48; continue; };
-                    } else {
-                        if (yych <= '`') { gotoCase = 115; continue; };
-                        if (yych <= 'z') { gotoCase = 48; continue; };
-                    }
-                }
-            }
-case 115:
-            { return this._stringToken(cursor, true); }
-case 116:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 66; continue; };
-                if (yych <= '\f') { gotoCase = 116; continue; };
-                { gotoCase = 66; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 116; continue; };
-                    { gotoCase = 121; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 116; continue; };
-                }
-            }
-case 118:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'a') {
-                if (yych <= '!') {
-                    if (yych <= '\n') {
-                        if (yych <= '\t') { gotoCase = 66; continue; };
-                    } else {
-                        if (yych != '\r') { gotoCase = 66; continue; };
-                    }
-                } else {
-                    if (yych <= '\'') {
-                        if (yych <= '"') { gotoCase = 116; continue; };
-                        if (yych <= '&') { gotoCase = 66; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 116; continue; };
-                        { gotoCase = 66; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'q') {
-                    if (yych <= 'f') {
-                        if (yych <= 'b') { gotoCase = 116; continue; };
-                        if (yych <= 'e') { gotoCase = 66; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych == 'n') { gotoCase = 116; continue; };
-                        { gotoCase = 66; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych == 's') { gotoCase = 66; continue; };
-                        { gotoCase = 116; continue; };
-                    } else {
-                        if (yych == 'v') { gotoCase = 116; continue; };
-                        { gotoCase = 66; continue; };
-                    }
-                }
-            }
-            ++cursor;
-            this.setLexCondition(this._lexConditions.SSTRING);
-            { return this._stringToken(cursor); }
-case 121:
-            yych = this._charAt(++cursor);
-            { gotoCase = 115; continue; };
-case 122:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '-') {
-                if (yych <= '!') {
-                    if (yych <= '\f') {
-                        if (yych == '\n') { gotoCase = 32; continue; };
-                    } else {
-                        if (yych <= '\r') { gotoCase = 32; continue; };
-                        if (yych >= '!') { gotoCase = 122; continue; };
-                    }
-                } else {
-                    if (yych <= '$') {
-                        if (yych <= '"') { gotoCase = 114; continue; };
-                        if (yych >= '$') { gotoCase = 122; continue; };
-                    } else {
-                        if (yych == '\'') { gotoCase = 122; continue; };
-                        if (yych >= '-') { gotoCase = 122; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '<') {
-                        if (yych <= '.') { gotoCase = 124; continue; };
-                        if (yych <= '9') { gotoCase = 122; continue; };
-                    } else {
-                        if (yych <= '=') { gotoCase = 122; continue; };
-                        if (yych >= '@') { gotoCase = 122; continue; };
-                    }
-                } else {
-                    if (yych <= '^') {
-                        if (yych <= '\\') { gotoCase = 126; continue; };
-                        if (yych <= ']') { gotoCase = 122; continue; };
-                    } else {
-                        if (yych == '`') { gotoCase = 124; continue; };
-                        if (yych <= 'z') { gotoCase = 122; continue; };
-                    }
-                }
-            }
-case 124:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 66; continue; };
-                if (yych <= '\f') { gotoCase = 124; continue; };
-                { gotoCase = 66; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 124; continue; };
-                    { gotoCase = 121; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 124; continue; };
-                }
-            }
-case 126:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'a') {
-                if (yych <= '!') {
-                    if (yych <= '\n') {
-                        if (yych <= '\t') { gotoCase = 66; continue; };
-                    } else {
-                        if (yych != '\r') { gotoCase = 66; continue; };
-                    }
-                } else {
-                    if (yych <= '\'') {
-                        if (yych <= '"') { gotoCase = 124; continue; };
-                        if (yych <= '&') { gotoCase = 66; continue; };
-                        { gotoCase = 124; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 124; continue; };
-                        { gotoCase = 66; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'q') {
-                    if (yych <= 'f') {
-                        if (yych <= 'b') { gotoCase = 124; continue; };
-                        if (yych <= 'e') { gotoCase = 66; continue; };
-                        { gotoCase = 124; continue; };
-                    } else {
-                        if (yych == 'n') { gotoCase = 124; continue; };
-                        { gotoCase = 66; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych == 's') { gotoCase = 66; continue; };
-                        { gotoCase = 124; continue; };
-                    } else {
-                        if (yych == 'v') { gotoCase = 124; continue; };
-                        { gotoCase = 66; continue; };
-                    }
-                }
-            }
-            ++cursor;
-            this.setLexCondition(this._lexConditions.DSTRING);
-            { return this._stringToken(cursor); }
-/* *********************************** */
-case this.case_SSTRING:
-            yych = this._charAt(cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 133; continue; };
-                if (yych <= '\f') { gotoCase = 132; continue; };
-                { gotoCase = 133; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 132; continue; };
-                    { gotoCase = 135; continue; };
-                } else {
-                    if (yych == '\\') { gotoCase = 137; continue; };
-                    { gotoCase = 132; continue; };
-                }
-            }
-case 131:
-            { return this._stringToken(cursor); }
-case 132:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 139; continue; };
-case 133:
-            ++cursor;
-case 134:
-            { this.tokenType = null; return cursor; }
-case 135:
-            ++cursor;
-case 136:
-            this.setLexCondition(this._lexConditions.INITIAL);
-            { return this._stringToken(cursor, true); }
-case 137:
-            yych = this._charAt(++cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 138; continue; };
-                    if (yych <= '&') { gotoCase = 134; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych <= '[') { gotoCase = 134; continue; };
-                    } else {
-                        if (yych != 'b') { gotoCase = 134; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych >= 'g') { gotoCase = 134; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 138; continue; };
-                        if (yych <= 'q') { gotoCase = 134; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych <= 's') { gotoCase = 134; continue; };
-                    } else {
-                        if (yych != 'v') { gotoCase = 134; continue; };
-                    }
-                }
-            }
-case 138:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 139:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 131; continue; };
-                if (yych <= '\f') { gotoCase = 138; continue; };
-                { gotoCase = 131; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 138; continue; };
-                    { gotoCase = 142; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 138; continue; };
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 138; continue; };
-                    if (yych >= '\'') { gotoCase = 138; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych >= '\\') { gotoCase = 138; continue; };
-                    } else {
-                        if (yych == 'b') { gotoCase = 138; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych <= 'f') { gotoCase = 138; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 138; continue; };
-                        if (yych >= 'r') { gotoCase = 138; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych >= 't') { gotoCase = 138; continue; };
-                    } else {
-                        if (yych == 'v') { gotoCase = 138; continue; };
-                    }
-                }
-            }
-            cursor = YYMARKER;
-            { gotoCase = 131; continue; };
-case 142:
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 136; continue; };
-        }
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 2; continue; };
+{ gotoCase = 11; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 2; continue; };
+if (yych == '*') { gotoCase = 9; continue; };
+{ gotoCase = 11; continue; };
+}
 
-        }
-    }
+case this.case_DSTRING:
+yych = this._charAt(cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 17; continue; };
+if (yych <= '\f') { gotoCase = 16; continue; };
+{ gotoCase = 17; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 16; continue; };
+{ gotoCase = 19; continue; };
+} else {
+if (yych == '\\') { gotoCase = 21; continue; };
+{ gotoCase = 16; continue; };
+}
+}
+case 15:
+{ return this._stringToken(cursor); }
+case 16:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 23; continue; };
+case 17:
+++cursor;
+case 18:
+{ this.tokenType = null; return cursor; }
+case 19:
+++cursor;
+case 20:
+this.setLexCondition(this._lexConditions.INITIAL);
+{ return this._stringToken(cursor, true); }
+case 21:
+yych = this._charAt(++cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 22; continue; };
+if (yych <= '&') { gotoCase = 18; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 18; continue; };
+} else {
+if (yych != 'b') { gotoCase = 18; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych >= 'g') { gotoCase = 18; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 22; continue; };
+if (yych <= 'q') { gotoCase = 18; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 18; continue; };
+} else {
+if (yych != 'v') { gotoCase = 18; continue; };
+}
+}
+}
+case 22:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 23:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 15; continue; };
+if (yych <= '\f') { gotoCase = 22; continue; };
+{ gotoCase = 15; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 22; continue; };
+{ gotoCase = 26; continue; };
+} else {
+if (yych != '\\') { gotoCase = 22; continue; };
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 22; continue; };
+if (yych >= '\'') { gotoCase = 22; continue; };
+} else {
+if (yych <= '\\') {
+if (yych >= '\\') { gotoCase = 22; continue; };
+} else {
+if (yych == 'b') { gotoCase = 22; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych <= 'f') { gotoCase = 22; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 22; continue; };
+if (yych >= 'r') { gotoCase = 22; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych >= 't') { gotoCase = 22; continue; };
+} else {
+if (yych == 'v') { gotoCase = 22; continue; };
+}
+}
+}
+cursor = YYMARKER;
+{ gotoCase = 15; continue; };
+case 26:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 20; continue; };
+
+case this.case_INITIAL:
+yych = this._charAt(cursor);
+if (yych <= ';') {
+if (yych <= '\'') {
+if (yych <= '"') {
+if (yych <= ' ') { gotoCase = 29; continue; };
+if (yych <= '!') { gotoCase = 31; continue; };
+{ gotoCase = 33; continue; };
+} else {
+if (yych == '$') { gotoCase = 31; continue; };
+if (yych >= '\'') { gotoCase = 34; continue; };
+}
+} else {
+if (yych <= '.') {
+if (yych <= ',') { gotoCase = 29; continue; };
+if (yych <= '-') { gotoCase = 35; continue; };
+{ gotoCase = 36; continue; };
+} else {
+if (yych <= '/') { gotoCase = 37; continue; };
+if (yych <= '9') { gotoCase = 38; continue; };
+if (yych <= ':') { gotoCase = 40; continue; };
+{ gotoCase = 42; continue; };
+}
+}
+} else {
+if (yych <= '^') {
+if (yych <= '?') {
+if (yych == '=') { gotoCase = 31; continue; };
+} else {
+if (yych == '\\') { gotoCase = 29; continue; };
+if (yych <= ']') { gotoCase = 31; continue; };
+}
+} else {
+if (yych <= 'z') {
+if (yych != '`') { gotoCase = 31; continue; };
+} else {
+if (yych <= '{') { gotoCase = 44; continue; };
+if (yych == '}') { gotoCase = 46; continue; };
+}
+}
+}
+case 29:
+++cursor;
+case 30:
+{ this.tokenType = null; return cursor; }
+case 31:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 49; continue; };
+case 32:
+{
+var token = this._line.substring(cursorOnEnter, cursor);
+if (this._condition.parseCondition === this._parseConditions.INITIAL) {
+if (token === "@import" || token === "@media") {
+this.tokenType = "css-at-rule";
+this._condition.parseCondition = this._parseConditions.AT_RULE;
+} else if (token.indexOf("@") === 0)
+this.tokenType = "css-at-rule";
+else
+this.tokenType = "css-selector";
+}
+else if (this._condition.parseCondition === this._parseConditions.AT_RULE && token in this._mediaTypes)
+this.tokenType = "css-keyword";
+else if (this._condition.parseCondition === this._parseConditions.PROPERTY && token in this._propertyKeywords)
+this.tokenType = "css-property";
+else if (this._isPropertyValue() && token in this._valueKeywords)
+this.tokenType = "css-keyword";
+else if (token === "!important")
+this.tokenType = "css-important";
+else
+this.tokenType = null;
+return cursor;
+}
+case 33:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '-') {
+if (yych <= '!') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 32; continue; };
+{ gotoCase = 124; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 32; continue; };
+if (yych <= ' ') { gotoCase = 124; continue; };
+{ gotoCase = 122; continue; };
+}
+} else {
+if (yych <= '$') {
+if (yych <= '"') { gotoCase = 114; continue; };
+if (yych <= '#') { gotoCase = 124; continue; };
+{ gotoCase = 122; continue; };
+} else {
+if (yych == '\'') { gotoCase = 122; continue; };
+if (yych <= ',') { gotoCase = 124; continue; };
+{ gotoCase = 122; continue; };
+}
+}
+} else {
+if (yych <= '[') {
+if (yych <= '<') {
+if (yych <= '.') { gotoCase = 124; continue; };
+if (yych <= '9') { gotoCase = 122; continue; };
+{ gotoCase = 124; continue; };
+} else {
+if (yych <= '=') { gotoCase = 122; continue; };
+if (yych <= '?') { gotoCase = 124; continue; };
+{ gotoCase = 122; continue; };
+}
+} else {
+if (yych <= '^') {
+if (yych <= '\\') { gotoCase = 126; continue; };
+if (yych <= ']') { gotoCase = 122; continue; };
+{ gotoCase = 124; continue; };
+} else {
+if (yych == '`') { gotoCase = 124; continue; };
+if (yych <= 'z') { gotoCase = 122; continue; };
+{ gotoCase = 124; continue; };
+}
+}
+}
+case 34:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '-') {
+if (yych <= '"') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 32; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 32; continue; };
+if (yych <= ' ') { gotoCase = 116; continue; };
+{ gotoCase = 112; continue; };
+}
+} else {
+if (yych <= '&') {
+if (yych == '$') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych <= '\'') { gotoCase = 114; continue; };
+if (yych <= ',') { gotoCase = 116; continue; };
+{ gotoCase = 112; continue; };
+}
+}
+} else {
+if (yych <= '[') {
+if (yych <= '<') {
+if (yych <= '.') { gotoCase = 116; continue; };
+if (yych <= '9') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych <= '=') { gotoCase = 112; continue; };
+if (yych <= '?') { gotoCase = 116; continue; };
+{ gotoCase = 112; continue; };
+}
+} else {
+if (yych <= '^') {
+if (yych <= '\\') { gotoCase = 118; continue; };
+if (yych <= ']') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych == '`') { gotoCase = 116; continue; };
+if (yych <= 'z') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+}
+}
+}
+case 35:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '.') { gotoCase = 65; continue; };
+if (yych <= '/') { gotoCase = 49; continue; };
+if (yych <= '9') { gotoCase = 50; continue; };
+{ gotoCase = 49; continue; };
+case 36:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 30; continue; };
+if (yych <= '9') { gotoCase = 68; continue; };
+{ gotoCase = 30; continue; };
+case 37:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '*') { gotoCase = 104; continue; };
+{ gotoCase = 49; continue; };
+case 38:
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+switch (yych) {
+case '!':
+case '"':
+case '$':
+case '\'':
+case '-':
+case '/':
+case '=':
+case '@':
+case 'A':
+case 'B':
+case 'C':
+case 'D':
+case 'E':
+case 'F':
+case 'G':
+case 'I':
+case 'J':
+case 'K':
+case 'L':
+case 'M':
+case 'N':
+case 'O':
+case 'P':
+case 'Q':
+case 'R':
+case 'S':
+case 'T':
+case 'U':
+case 'V':
+case 'W':
+case 'X':
+case 'Y':
+case 'Z':
+case '[':
+case ']':
+case 'a':
+case 'b':
+case 'f':
+case 'h':
+case 'j':
+case 'l':
+case 'n':
+case 'o':
+case 'q':
+case 'u':
+case 'v':
+case 'w':
+case 'x':
+case 'y':
+case 'z':    { gotoCase = 48; continue; };
+case '%':    { gotoCase = 67; continue; };
+case '.':    { gotoCase = 65; continue; };
+case '0':
+case '1':
+case '2':
+case '3':
+case '4':
+case '5':
+case '6':
+case '7':
+case '8':
+case '9':    { gotoCase = 50; continue; };
+case 'H':    { gotoCase = 52; continue; };
+case '_':    { gotoCase = 53; continue; };
+case 'c':    { gotoCase = 54; continue; };
+case 'd':    { gotoCase = 55; continue; };
+case 'e':    { gotoCase = 56; continue; };
+case 'g':    { gotoCase = 57; continue; };
+case 'i':    { gotoCase = 58; continue; };
+case 'k':    { gotoCase = 59; continue; };
+case 'm':    { gotoCase = 60; continue; };
+case 'p':    { gotoCase = 61; continue; };
+case 'r':    { gotoCase = 62; continue; };
+case 's':    { gotoCase = 63; continue; };
+case 't':    { gotoCase = 64; continue; };
+default:    { gotoCase = 39; continue; };
+}
+case 39:
+{
+if (this._isPropertyValue())
+this.tokenType = "css-number";
+else
+this.tokenType = null;
+return cursor;
+}
+case 40:
+++cursor;
+{
+this.tokenType = null;
+if (this._condition.parseCondition === this._parseConditions.PROPERTY)
+this._condition.parseCondition = this._parseConditions.PROPERTY_VALUE;
+return cursor;
+}
+case 42:
+++cursor;
+{
+this.tokenType = null;
+if (this._condition.parseCondition === this._parseConditions.AT_RULE)
+this._condition.parseCondition = this._parseConditions.INITIAL;
+else
+this._condition.parseCondition = this._parseConditions.PROPERTY;
+return cursor;
+}
+case 44:
+++cursor;
+{
+this.tokenType = null;
+if (this._condition.parseCondition === this._parseConditions.AT_RULE)
+this._condition.parseCondition = this._parseConditions.INITIAL;
+else
+this._condition.parseCondition = this._parseConditions.PROPERTY;
+return cursor;
+}
+case 46:
+++cursor;
+{
+this.tokenType = null;
+this._condition.parseCondition = this._parseConditions.INITIAL;
+return cursor;
+}
+case 48:
+++cursor;
+yych = this._charAt(cursor);
+case 49:
+if (yych <= '9') {
+if (yych <= '&') {
+if (yych <= '"') {
+if (yych <= ' ') { gotoCase = 32; continue; };
+{ gotoCase = 48; continue; };
+} else {
+if (yych == '$') { gotoCase = 48; continue; };
+{ gotoCase = 32; continue; };
+}
+} else {
+if (yych <= ',') {
+if (yych <= '\'') { gotoCase = 48; continue; };
+{ gotoCase = 32; continue; };
+} else {
+if (yych == '.') { gotoCase = 32; continue; };
+{ gotoCase = 48; continue; };
+}
+}
+} else {
+if (yych <= '\\') {
+if (yych <= '=') {
+if (yych <= '<') { gotoCase = 32; continue; };
+{ gotoCase = 48; continue; };
+} else {
+if (yych <= '?') { gotoCase = 32; continue; };
+if (yych <= '[') { gotoCase = 48; continue; };
+{ gotoCase = 32; continue; };
+}
+} else {
+if (yych <= '_') {
+if (yych == '^') { gotoCase = 32; continue; };
+{ gotoCase = 48; continue; };
+} else {
+if (yych <= '`') { gotoCase = 32; continue; };
+if (yych <= 'z') { gotoCase = 48; continue; };
+{ gotoCase = 32; continue; };
+}
+}
+}
+case 50:
+yyaccept = 1;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+switch (yych) {
+case '!':
+case '"':
+case '$':
+case '\'':
+case '-':
+case '/':
+case '=':
+case '@':
+case 'A':
+case 'B':
+case 'C':
+case 'D':
+case 'E':
+case 'F':
+case 'G':
+case 'I':
+case 'J':
+case 'K':
+case 'L':
+case 'M':
+case 'N':
+case 'O':
+case 'P':
+case 'Q':
+case 'R':
+case 'S':
+case 'T':
+case 'U':
+case 'V':
+case 'W':
+case 'X':
+case 'Y':
+case 'Z':
+case '[':
+case ']':
+case 'a':
+case 'b':
+case 'f':
+case 'h':
+case 'j':
+case 'l':
+case 'n':
+case 'o':
+case 'q':
+case 'u':
+case 'v':
+case 'w':
+case 'x':
+case 'y':
+case 'z':    { gotoCase = 48; continue; };
+case '%':    { gotoCase = 67; continue; };
+case '.':    { gotoCase = 65; continue; };
+case '0':
+case '1':
+case '2':
+case '3':
+case '4':
+case '5':
+case '6':
+case '7':
+case '8':
+case '9':    { gotoCase = 50; continue; };
+case 'H':    { gotoCase = 52; continue; };
+case '_':    { gotoCase = 53; continue; };
+case 'c':    { gotoCase = 54; continue; };
+case 'd':    { gotoCase = 55; continue; };
+case 'e':    { gotoCase = 56; continue; };
+case 'g':    { gotoCase = 57; continue; };
+case 'i':    { gotoCase = 58; continue; };
+case 'k':    { gotoCase = 59; continue; };
+case 'm':    { gotoCase = 60; continue; };
+case 'p':    { gotoCase = 61; continue; };
+case 'r':    { gotoCase = 62; continue; };
+case 's':    { gotoCase = 63; continue; };
+case 't':    { gotoCase = 64; continue; };
+default:    { gotoCase = 39; continue; };
+}
+case 52:
+yych = this._charAt(++cursor);
+if (yych == 'z') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 53:
+yych = this._charAt(++cursor);
+if (yych == '_') { gotoCase = 101; continue; };
+{ gotoCase = 49; continue; };
+case 54:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 55:
+yych = this._charAt(++cursor);
+if (yych == 'e') { gotoCase = 100; continue; };
+{ gotoCase = 49; continue; };
+case 56:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 63; continue; };
+if (yych == 'x') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 57:
+yych = this._charAt(++cursor);
+if (yych == 'r') { gotoCase = 98; continue; };
+{ gotoCase = 49; continue; };
+case 58:
+yych = this._charAt(++cursor);
+if (yych == 'n') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 59:
+yych = this._charAt(++cursor);
+if (yych == 'H') { gotoCase = 97; continue; };
+{ gotoCase = 49; continue; };
+case 60:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 63; continue; };
+if (yych == 's') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 61:
+yych = this._charAt(++cursor);
+if (yych <= 's') {
+if (yych == 'c') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+} else {
+if (yych <= 't') { gotoCase = 63; continue; };
+if (yych == 'x') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+}
+case 62:
+yych = this._charAt(++cursor);
+if (yych == 'a') { gotoCase = 95; continue; };
+if (yych == 'e') { gotoCase = 96; continue; };
+{ gotoCase = 49; continue; };
+case 63:
+yych = this._charAt(++cursor);
+if (yych <= '9') {
+if (yych <= '&') {
+if (yych <= '"') {
+if (yych <= ' ') { gotoCase = 39; continue; };
+{ gotoCase = 48; continue; };
+} else {
+if (yych == '$') { gotoCase = 48; continue; };
+{ gotoCase = 39; continue; };
+}
+} else {
+if (yych <= ',') {
+if (yych <= '\'') { gotoCase = 48; continue; };
+{ gotoCase = 39; continue; };
+} else {
+if (yych == '.') { gotoCase = 39; continue; };
+{ gotoCase = 48; continue; };
+}
+}
+} else {
+if (yych <= '\\') {
+if (yych <= '=') {
+if (yych <= '<') { gotoCase = 39; continue; };
+{ gotoCase = 48; continue; };
+} else {
+if (yych <= '?') { gotoCase = 39; continue; };
+if (yych <= '[') { gotoCase = 48; continue; };
+{ gotoCase = 39; continue; };
+}
+} else {
+if (yych <= '_') {
+if (yych == '^') { gotoCase = 39; continue; };
+{ gotoCase = 48; continue; };
+} else {
+if (yych <= '`') { gotoCase = 39; continue; };
+if (yych <= 'z') { gotoCase = 48; continue; };
+{ gotoCase = 39; continue; };
+}
+}
+}
+case 64:
+yych = this._charAt(++cursor);
+if (yych == 'u') { gotoCase = 93; continue; };
+{ gotoCase = 49; continue; };
+case 65:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 66; continue; };
+if (yych <= '9') { gotoCase = 68; continue; };
+case 66:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 32; continue; };
+} else {
+{ gotoCase = 39; continue; };
+}
+case 67:
+yych = this._charAt(++cursor);
+{ gotoCase = 39; continue; };
+case 68:
+yyaccept = 1;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'f') {
+if (yych <= 'H') {
+if (yych <= '/') {
+if (yych == '%') { gotoCase = 67; continue; };
+{ gotoCase = 39; continue; };
+} else {
+if (yych <= '9') { gotoCase = 68; continue; };
+if (yych <= 'G') { gotoCase = 39; continue; };
+{ gotoCase = 80; continue; };
+}
+} else {
+if (yych <= 'b') {
+if (yych == '_') { gotoCase = 72; continue; };
+{ gotoCase = 39; continue; };
+} else {
+if (yych <= 'c') { gotoCase = 74; continue; };
+if (yych <= 'd') { gotoCase = 77; continue; };
+if (yych >= 'f') { gotoCase = 39; continue; };
+}
+}
+} else {
+if (yych <= 'm') {
+if (yych <= 'i') {
+if (yych <= 'g') { gotoCase = 78; continue; };
+if (yych <= 'h') { gotoCase = 39; continue; };
+{ gotoCase = 76; continue; };
+} else {
+if (yych == 'k') { gotoCase = 81; continue; };
+if (yych <= 'l') { gotoCase = 39; continue; };
+{ gotoCase = 75; continue; };
+}
+} else {
+if (yych <= 'q') {
+if (yych == 'p') { gotoCase = 73; continue; };
+{ gotoCase = 39; continue; };
+} else {
+if (yych <= 'r') { gotoCase = 71; continue; };
+if (yych <= 's') { gotoCase = 67; continue; };
+if (yych <= 't') { gotoCase = 79; continue; };
+{ gotoCase = 39; continue; };
+}
+}
+}
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 67; continue; };
+if (yych == 'x') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 71:
+yych = this._charAt(++cursor);
+if (yych == 'a') { gotoCase = 91; continue; };
+if (yych == 'e') { gotoCase = 92; continue; };
+{ gotoCase = 66; continue; };
+case 72:
+yych = this._charAt(++cursor);
+if (yych == '_') { gotoCase = 88; continue; };
+{ gotoCase = 66; continue; };
+case 73:
+yych = this._charAt(++cursor);
+if (yych <= 's') {
+if (yych == 'c') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+} else {
+if (yych <= 't') { gotoCase = 67; continue; };
+if (yych == 'x') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+}
+case 74:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 75:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 67; continue; };
+if (yych == 's') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 76:
+yych = this._charAt(++cursor);
+if (yych == 'n') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 77:
+yych = this._charAt(++cursor);
+if (yych == 'e') { gotoCase = 87; continue; };
+{ gotoCase = 66; continue; };
+case 78:
+yych = this._charAt(++cursor);
+if (yych == 'r') { gotoCase = 85; continue; };
+{ gotoCase = 66; continue; };
+case 79:
+yych = this._charAt(++cursor);
+if (yych == 'u') { gotoCase = 83; continue; };
+{ gotoCase = 66; continue; };
+case 80:
+yych = this._charAt(++cursor);
+if (yych == 'z') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 81:
+yych = this._charAt(++cursor);
+if (yych != 'H') { gotoCase = 66; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'z') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 83:
+yych = this._charAt(++cursor);
+if (yych != 'r') { gotoCase = 66; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'n') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 85:
+yych = this._charAt(++cursor);
+if (yych != 'a') { gotoCase = 66; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'd') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 87:
+yych = this._charAt(++cursor);
+if (yych == 'g') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 88:
+yych = this._charAt(++cursor);
+if (yych != 'q') { gotoCase = 66; continue; };
+yych = this._charAt(++cursor);
+if (yych != 'e') { gotoCase = 66; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 91:
+yych = this._charAt(++cursor);
+if (yych == 'd') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 92:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 67; continue; };
+{ gotoCase = 66; continue; };
+case 93:
+yych = this._charAt(++cursor);
+if (yych != 'r') { gotoCase = 49; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'n') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 95:
+yych = this._charAt(++cursor);
+if (yych == 'd') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 96:
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 97:
+yych = this._charAt(++cursor);
+if (yych == 'z') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 98:
+yych = this._charAt(++cursor);
+if (yych != 'a') { gotoCase = 49; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'd') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 100:
+yych = this._charAt(++cursor);
+if (yych == 'g') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 101:
+yych = this._charAt(++cursor);
+if (yych != 'q') { gotoCase = 49; continue; };
+yych = this._charAt(++cursor);
+if (yych != 'e') { gotoCase = 49; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'm') { gotoCase = 63; continue; };
+{ gotoCase = 49; continue; };
+case 104:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 108; continue; };
+{ gotoCase = 104; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 108; continue; };
+if (yych != '*') { gotoCase = 104; continue; };
+}
+case 106:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 106; continue; };
+if (yych == '/') { gotoCase = 110; continue; };
+{ gotoCase = 104; continue; };
+case 108:
+++cursor;
+this.setLexCondition(this._lexConditions.COMMENT);
+{ this.tokenType = "css-comment"; return cursor; }
+case 110:
+++cursor;
+{ this.tokenType = "css-comment"; return cursor; }
+case 112:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '-') {
+if (yych <= '"') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 32; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 32; continue; };
+if (yych <= ' ') { gotoCase = 116; continue; };
+{ gotoCase = 112; continue; };
+}
+} else {
+if (yych <= '&') {
+if (yych == '$') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych <= '\'') { gotoCase = 114; continue; };
+if (yych <= ',') { gotoCase = 116; continue; };
+{ gotoCase = 112; continue; };
+}
+}
+} else {
+if (yych <= '[') {
+if (yych <= '<') {
+if (yych <= '.') { gotoCase = 116; continue; };
+if (yych <= '9') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych <= '=') { gotoCase = 112; continue; };
+if (yych <= '?') { gotoCase = 116; continue; };
+{ gotoCase = 112; continue; };
+}
+} else {
+if (yych <= '^') {
+if (yych <= '\\') { gotoCase = 118; continue; };
+if (yych <= ']') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych == '`') { gotoCase = 116; continue; };
+if (yych <= 'z') { gotoCase = 112; continue; };
+{ gotoCase = 116; continue; };
+}
+}
+}
+case 114:
+++cursor;
+if ((yych = this._charAt(cursor)) <= '9') {
+if (yych <= '&') {
+if (yych <= '"') {
+if (yych >= '!') { gotoCase = 48; continue; };
+} else {
+if (yych == '$') { gotoCase = 48; continue; };
+}
+} else {
+if (yych <= ',') {
+if (yych <= '\'') { gotoCase = 48; continue; };
+} else {
+if (yych != '.') { gotoCase = 48; continue; };
+}
+}
+} else {
+if (yych <= '\\') {
+if (yych <= '=') {
+if (yych >= '=') { gotoCase = 48; continue; };
+} else {
+if (yych <= '?') { gotoCase = 115; continue; };
+if (yych <= '[') { gotoCase = 48; continue; };
+}
+} else {
+if (yych <= '_') {
+if (yych != '^') { gotoCase = 48; continue; };
+} else {
+if (yych <= '`') { gotoCase = 115; continue; };
+if (yych <= 'z') { gotoCase = 48; continue; };
+}
+}
+}
+case 115:
+{ return this._stringToken(cursor, true); }
+case 116:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 66; continue; };
+if (yych <= '\f') { gotoCase = 116; continue; };
+{ gotoCase = 66; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 116; continue; };
+{ gotoCase = 121; continue; };
+} else {
+if (yych != '\\') { gotoCase = 116; continue; };
+}
+}
+case 118:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 66; continue; };
+} else {
+if (yych != '\r') { gotoCase = 66; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 116; continue; };
+if (yych <= '&') { gotoCase = 66; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych == '\\') { gotoCase = 116; continue; };
+{ gotoCase = 66; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 116; continue; };
+if (yych <= 'e') { gotoCase = 66; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych == 'n') { gotoCase = 116; continue; };
+{ gotoCase = 66; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 66; continue; };
+{ gotoCase = 116; continue; };
+} else {
+if (yych == 'v') { gotoCase = 116; continue; };
+{ gotoCase = 66; continue; };
+}
+}
+}
+++cursor;
+this.setLexCondition(this._lexConditions.SSTRING);
+{ return this._stringToken(cursor); }
+case 121:
+yych = this._charAt(++cursor);
+{ gotoCase = 115; continue; };
+case 122:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '-') {
+if (yych <= '!') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 32; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 32; continue; };
+if (yych >= '!') { gotoCase = 122; continue; };
+}
+} else {
+if (yych <= '$') {
+if (yych <= '"') { gotoCase = 114; continue; };
+if (yych >= '$') { gotoCase = 122; continue; };
+} else {
+if (yych == '\'') { gotoCase = 122; continue; };
+if (yych >= '-') { gotoCase = 122; continue; };
+}
+}
+} else {
+if (yych <= '[') {
+if (yych <= '<') {
+if (yych <= '.') { gotoCase = 124; continue; };
+if (yych <= '9') { gotoCase = 122; continue; };
+} else {
+if (yych <= '=') { gotoCase = 122; continue; };
+if (yych >= '@') { gotoCase = 122; continue; };
+}
+} else {
+if (yych <= '^') {
+if (yych <= '\\') { gotoCase = 126; continue; };
+if (yych <= ']') { gotoCase = 122; continue; };
+} else {
+if (yych == '`') { gotoCase = 124; continue; };
+if (yych <= 'z') { gotoCase = 122; continue; };
+}
+}
+}
+case 124:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 66; continue; };
+if (yych <= '\f') { gotoCase = 124; continue; };
+{ gotoCase = 66; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 124; continue; };
+{ gotoCase = 121; continue; };
+} else {
+if (yych != '\\') { gotoCase = 124; continue; };
+}
+}
+case 126:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 66; continue; };
+} else {
+if (yych != '\r') { gotoCase = 66; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 124; continue; };
+if (yych <= '&') { gotoCase = 66; continue; };
+{ gotoCase = 124; continue; };
+} else {
+if (yych == '\\') { gotoCase = 124; continue; };
+{ gotoCase = 66; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 124; continue; };
+if (yych <= 'e') { gotoCase = 66; continue; };
+{ gotoCase = 124; continue; };
+} else {
+if (yych == 'n') { gotoCase = 124; continue; };
+{ gotoCase = 66; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 66; continue; };
+{ gotoCase = 124; continue; };
+} else {
+if (yych == 'v') { gotoCase = 124; continue; };
+{ gotoCase = 66; continue; };
+}
+}
+}
+++cursor;
+this.setLexCondition(this._lexConditions.DSTRING);
+{ return this._stringToken(cursor); }
+
+case this.case_SSTRING:
+yych = this._charAt(cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 133; continue; };
+if (yych <= '\f') { gotoCase = 132; continue; };
+{ gotoCase = 133; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 132; continue; };
+{ gotoCase = 135; continue; };
+} else {
+if (yych == '\\') { gotoCase = 137; continue; };
+{ gotoCase = 132; continue; };
+}
+}
+case 131:
+{ return this._stringToken(cursor); }
+case 132:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 139; continue; };
+case 133:
+++cursor;
+case 134:
+{ this.tokenType = null; return cursor; }
+case 135:
+++cursor;
+case 136:
+this.setLexCondition(this._lexConditions.INITIAL);
+{ return this._stringToken(cursor, true); }
+case 137:
+yych = this._charAt(++cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 138; continue; };
+if (yych <= '&') { gotoCase = 134; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 134; continue; };
+} else {
+if (yych != 'b') { gotoCase = 134; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych >= 'g') { gotoCase = 134; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 138; continue; };
+if (yych <= 'q') { gotoCase = 134; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 134; continue; };
+} else {
+if (yych != 'v') { gotoCase = 134; continue; };
+}
+}
+}
+case 138:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 139:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 131; continue; };
+if (yych <= '\f') { gotoCase = 138; continue; };
+{ gotoCase = 131; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 138; continue; };
+{ gotoCase = 142; continue; };
+} else {
+if (yych != '\\') { gotoCase = 138; continue; };
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 138; continue; };
+if (yych >= '\'') { gotoCase = 138; continue; };
+} else {
+if (yych <= '\\') {
+if (yych >= '\\') { gotoCase = 138; continue; };
+} else {
+if (yych == 'b') { gotoCase = 138; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych <= 'f') { gotoCase = 138; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 138; continue; };
+if (yych >= 'r') { gotoCase = 138; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych >= 't') { gotoCase = 138; continue; };
+} else {
+if (yych == 'v') { gotoCase = 138; continue; };
+}
+}
+}
+cursor = YYMARKER;
+{ gotoCase = 131; continue; };
+case 142:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 136; continue; };
+}
+
+}
+}
 }
 
 WebInspector.SourceCSSTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype;
 
-/* SourceHTMLTokenizer.js */
 
-/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-// Generate js file as follows:
-//
-// re2c -isc WebCore/inspector/front-end/SourceHTMLTokenizer.re2js \
-// | sed 's|^yy\([^:]*\)*\:|case \1:|' \
-// | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \
-// | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \
-// | sed 's|[*]cursor|this._charAt(cursor)|' \
-// | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \
-// | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \
-// | sed 's|unsigned\ int|var|' \
-// | sed 's|var\ yych|case 1: case 1: var yych|'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 WebInspector.SourceHTMLTokenizer = function()
 {
-    WebInspector.SourceTokenizer.call(this);
+WebInspector.SourceTokenizer.call(this);
 
-    // The order is determined by the generated code.
-    this._lexConditions = {
-        INITIAL: 0,
-        COMMENT: 1,
-        DOCTYPE: 2,
-        TAG: 3,
-        DSTRING: 4,
-        SSTRING: 5
-    };
-    this.case_INITIAL = 1000;
-    this.case_COMMENT = 1001;
-    this.case_DOCTYPE = 1002;
-    this.case_TAG = 1003;
-    this.case_DSTRING = 1004;
-    this.case_SSTRING = 1005;
 
-    this._parseConditions = {
-        INITIAL: 0,
-        ATTRIBUTE: 1,
-        ATTRIBUTE_VALUE: 2,
-        LINKIFY: 4,
-        A_NODE: 8,
-        SCRIPT: 16
-    };
+this._lexConditions = {
+INITIAL: 0,
+COMMENT: 1,
+DOCTYPE: 2,
+TAG: 3,
+DSTRING: 4,
+SSTRING: 5
+};
+this.case_INITIAL = 1000;
+this.case_COMMENT = 1001;
+this.case_DOCTYPE = 1002;
+this.case_TAG = 1003;
+this.case_DSTRING = 1004;
+this.case_SSTRING = 1005;
 
-    this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
-    this.condition = this.initialCondition;
+this._parseConditions = {
+INITIAL: 0,
+ATTRIBUTE: 1,
+ATTRIBUTE_VALUE: 2,
+LINKIFY: 4,
+A_NODE: 8,
+SCRIPT: 16
+};
+
+this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL };
+this.condition = this.initialCondition;
 }
 
 WebInspector.SourceHTMLTokenizer.prototype = {
-    set line(line) {
-        if (this._internalJavaScriptTokenizer) {
-            var match = /<\/script/i.exec(line);
-            if (match) {
-                this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
-            } else
-                this._internalJavaScriptTokenizer.line = line;
-        }
-        this._line = line;
-    },
+set line(line) {
+if (this._internalJavaScriptTokenizer) {
+var match = /<\/script/i.exec(line);
+if (match) {
+this._internalJavaScriptTokenizer.line = line.substring(0, match.index);
+} else
+this._internalJavaScriptTokenizer.line = line;
+}
+this._line = line;
+},
 
-    _isExpectingAttribute: function()
-    {
-        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
-    },
+_isExpectingAttribute: function()
+{
+return this._condition.parseCondition & this._parseConditions.ATTRIBUTE;
+},
 
-    _isExpectingAttributeValue: function()
-    {
-        return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
-    },
+_isExpectingAttributeValue: function()
+{
+return this._condition.parseCondition & this._parseConditions.ATTRIBUTE_VALUE;
+},
 
-    _setExpectingAttribute: function()
-    {
-        if (this._isExpectingAttributeValue())
-            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
-        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
-    },
+_setExpectingAttribute: function()
+{
+if (this._isExpectingAttributeValue())
+this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE;
+this._condition.parseCondition |= this._parseConditions.ATTRIBUTE;
+},
 
-    _setExpectingAttributeValue: function()
-    {
-        if (this._isExpectingAttribute())
-            this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
-        this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
-    },
+_setExpectingAttributeValue: function()
+{
+if (this._isExpectingAttribute())
+this._condition.parseCondition ^= this._parseConditions.ATTRIBUTE;
+this._condition.parseCondition |= this._parseConditions.ATTRIBUTE_VALUE;
+},
 
-    _stringToken: function(cursor, stringEnds)
-    {
-        if (!this._isExpectingAttributeValue()) {
-            this.tokenType = null;
-            return cursor;
-        }
-        this.tokenType = this._attrValueTokenType();
-        if (stringEnds)
-            this._setExpectingAttribute();
-        return cursor;
-    },
+_stringToken: function(cursor, stringEnds)
+{
+if (!this._isExpectingAttributeValue()) {
+this.tokenType = null;
+return cursor;
+}
+this.tokenType = this._attrValueTokenType();
+if (stringEnds)
+this._setExpectingAttribute();
+return cursor;
+},
 
-    _attrValueTokenType: function()
-    {
-        if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
-            if (this._condition.parseCondition & this._parseConditions.A_NODE)
-                return "html-external-link";
-            return "html-resource-link";
-        }
-        return "html-attribute-value";
-    },
+_attrValueTokenType: function()
+{
+if (this._condition.parseCondition & this._parseConditions.LINKIFY) {
+if (this._condition.parseCondition & this._parseConditions.A_NODE)
+return "html-external-link";
+return "html-resource-link";
+}
+return "html-attribute-value";
+},
 
-    nextToken: function(cursor)
-    {
-        if (this._internalJavaScriptTokenizer) {
-            // Re-set line to force </script> detection first.
-            this.line = this._line;
-            if (cursor !== this._internalJavaScriptTokenizer._line.length) {
-                // Tokenizer is stateless, so restore its condition before tokenizing and save it after.
-                this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
-                var result = this._internalJavaScriptTokenizer.nextToken(cursor);
-                this.tokenType = this._internalJavaScriptTokenizer.tokenType;
-                this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
-                return result;
-            } else if (cursor !== this._line.length)
-                delete this._internalJavaScriptTokenizer;
-        }
+nextToken: function(cursor)
+{
+if (this._internalJavaScriptTokenizer) {
 
-        var cursorOnEnter = cursor;
-        var gotoCase = 1;
-        while (1) {
-            switch (gotoCase)
-            // Following comment is replaced with generated state machine.
-            
-        {
-            case 1: var yych;
-            var yyaccept = 0;
-            if (this.getLexCondition() < 3) {
-                if (this.getLexCondition() < 1) {
-                    { gotoCase = this.case_INITIAL; continue; };
-                } else {
-                    if (this.getLexCondition() < 2) {
-                        { gotoCase = this.case_COMMENT; continue; };
-                    } else {
-                        { gotoCase = this.case_DOCTYPE; continue; };
-                    }
-                }
-            } else {
-                if (this.getLexCondition() < 4) {
-                    { gotoCase = this.case_TAG; continue; };
-                } else {
-                    if (this.getLexCondition() < 5) {
-                        { gotoCase = this.case_DSTRING; continue; };
-                    } else {
-                        { gotoCase = this.case_SSTRING; continue; };
-                    }
-                }
-            }
-/* *********************************** */
+this.line = this._line;
+if (cursor !== this._internalJavaScriptTokenizer._line.length) {
+
+this._internalJavaScriptTokenizer.condition = this._condition.internalJavaScriptTokenizerCondition;
+var result = this._internalJavaScriptTokenizer.nextToken(cursor);
+this.tokenType = this._internalJavaScriptTokenizer.tokenType;
+this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.condition;
+return result;
+} else if (cursor !== this._line.length)
+delete this._internalJavaScriptTokenizer;
+}
+
+var cursorOnEnter = cursor;
+var gotoCase = 1;
+while (1) {
+switch (gotoCase)
+
+
+{
+case 1: var yych;
+var yyaccept = 0;
+if (this.getLexCondition() < 3) {
+if (this.getLexCondition() < 1) {
+{ gotoCase = this.case_INITIAL; continue; };
+} else {
+if (this.getLexCondition() < 2) {
+{ gotoCase = this.case_COMMENT; continue; };
+} else {
+{ gotoCase = this.case_DOCTYPE; continue; };
+}
+}
+} else {
+if (this.getLexCondition() < 4) {
+{ gotoCase = this.case_TAG; continue; };
+} else {
+if (this.getLexCondition() < 5) {
+{ gotoCase = this.case_DSTRING; continue; };
+} else {
+{ gotoCase = this.case_SSTRING; continue; };
+}
+}
+}
+
 case this.case_COMMENT:
 
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 4; continue; };
-                { gotoCase = 3; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 4; continue; };
-                if (yych == '-') { gotoCase = 6; continue; };
-                { gotoCase = 3; continue; };
-            }
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 4; continue; };
+{ gotoCase = 3; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 4; continue; };
+if (yych == '-') { gotoCase = 6; continue; };
+{ gotoCase = 3; continue; };
+}
 case 2:
-            { this.tokenType = "html-comment"; return cursor; }
+{ this.tokenType = "html-comment"; return cursor; }
 case 3:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 9; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 9; continue; };
 case 4:
-            ++cursor;
+++cursor;
 case 5:
-            { this.tokenType = null; return cursor; }
+{ this.tokenType = null; return cursor; }
 case 6:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych != '-') { gotoCase = 5; continue; };
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych != '-') { gotoCase = 5; continue; };
 case 7:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '>') { gotoCase = 10; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '>') { gotoCase = 10; continue; };
 case 8:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
 case 9:
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 2; continue; };
-                { gotoCase = 8; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 2; continue; };
-                if (yych == '-') { gotoCase = 12; continue; };
-                { gotoCase = 8; continue; };
-            }
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 2; continue; };
+{ gotoCase = 8; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 2; continue; };
+if (yych == '-') { gotoCase = 12; continue; };
+{ gotoCase = 8; continue; };
+}
 case 10:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.INITIAL);
-            { this.tokenType = "html-comment"; return cursor; }
+++cursor;
+this.setLexCondition(this._lexConditions.INITIAL);
+{ this.tokenType = "html-comment"; return cursor; }
 case 12:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '-') { gotoCase = 7; continue; };
-            cursor = YYMARKER;
-            if (yyaccept <= 0) {
-                { gotoCase = 2; continue; };
-            } else {
-                { gotoCase = 5; continue; };
-            }
-/* *********************************** */
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '-') { gotoCase = 7; continue; };
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 2; continue; };
+} else {
+{ gotoCase = 5; continue; };
+}
+
 case this.case_DOCTYPE:
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 18; continue; };
-                { gotoCase = 17; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 18; continue; };
-                if (yych == '>') { gotoCase = 20; continue; };
-                { gotoCase = 17; continue; };
-            }
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 18; continue; };
+{ gotoCase = 17; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 18; continue; };
+if (yych == '>') { gotoCase = 20; continue; };
+{ gotoCase = 17; continue; };
+}
 case 16:
-            { this.tokenType = "html-doctype"; return cursor; }
+{ this.tokenType = "html-doctype"; return cursor; }
 case 17:
-            yych = this._charAt(++cursor);
-            { gotoCase = 23; continue; };
+yych = this._charAt(++cursor);
+{ gotoCase = 23; continue; };
 case 18:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 20:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.INITIAL);
-            { this.tokenType = "html-doctype"; return cursor; }
+++cursor;
+this.setLexCondition(this._lexConditions.INITIAL);
+{ this.tokenType = "html-doctype"; return cursor; }
 case 22:
-            ++cursor;
-            yych = this._charAt(cursor);
+++cursor;
+yych = this._charAt(cursor);
 case 23:
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 16; continue; };
-                { gotoCase = 22; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 16; continue; };
-                if (yych == '>') { gotoCase = 16; continue; };
-                { gotoCase = 22; continue; };
-            }
-/* *********************************** */
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 16; continue; };
+{ gotoCase = 22; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 16; continue; };
+if (yych == '>') { gotoCase = 16; continue; };
+{ gotoCase = 22; continue; };
+}
+
 case this.case_DSTRING:
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 28; continue; };
-                { gotoCase = 27; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 28; continue; };
-                if (yych == '"') { gotoCase = 30; continue; };
-                { gotoCase = 27; continue; };
-            }
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 28; continue; };
+{ gotoCase = 27; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 28; continue; };
+if (yych == '"') { gotoCase = 30; continue; };
+{ gotoCase = 27; continue; };
+}
 case 26:
-            { return this._stringToken(cursor); }
+{ return this._stringToken(cursor); }
 case 27:
-            yych = this._charAt(++cursor);
-            { gotoCase = 34; continue; };
+yych = this._charAt(++cursor);
+{ gotoCase = 34; continue; };
 case 28:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 30:
-            ++cursor;
+++cursor;
 case 31:
-            this.setLexCondition(this._lexConditions.TAG);
-            { return this._stringToken(cursor, true); }
+this.setLexCondition(this._lexConditions.TAG);
+{ return this._stringToken(cursor, true); }
 case 32:
-            yych = this._charAt(++cursor);
-            { gotoCase = 31; continue; };
+yych = this._charAt(++cursor);
+{ gotoCase = 31; continue; };
 case 33:
-            ++cursor;
-            yych = this._charAt(cursor);
+++cursor;
+yych = this._charAt(cursor);
 case 34:
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 26; continue; };
-                { gotoCase = 33; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 26; continue; };
-                if (yych == '"') { gotoCase = 32; continue; };
-                { gotoCase = 33; continue; };
-            }
-/* *********************************** */
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 26; continue; };
+{ gotoCase = 33; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 26; continue; };
+if (yych == '"') { gotoCase = 32; continue; };
+{ gotoCase = 33; continue; };
+}
+
 case this.case_INITIAL:
-            yych = this._charAt(cursor);
-            if (yych == '<') { gotoCase = 39; continue; };
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+yych = this._charAt(cursor);
+if (yych == '<') { gotoCase = 39; continue; };
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 39:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '/') {
-                if (yych == '!') { gotoCase = 44; continue; };
-                if (yych >= '/') { gotoCase = 41; continue; };
-            } else {
-                if (yych <= 'S') {
-                    if (yych >= 'S') { gotoCase = 42; continue; };
-                } else {
-                    if (yych == 's') { gotoCase = 42; continue; };
-                }
-            }
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '/') {
+if (yych == '!') { gotoCase = 44; continue; };
+if (yych >= '/') { gotoCase = 41; continue; };
+} else {
+if (yych <= 'S') {
+if (yych >= 'S') { gotoCase = 42; continue; };
+} else {
+if (yych == 's') { gotoCase = 42; continue; };
+}
+}
 case 40:
-            this.setLexCondition(this._lexConditions.TAG);
-            {
-                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        // Do not tokenize script tag contents, keep lexer state although processing "<".
-                        this.setLexCondition(this._lexConditions.INITIAL);
-                        this.tokenType = null;
-                        return cursor;
-                    }
+this.setLexCondition(this._lexConditions.TAG);
+{
+if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
 
-                    this._condition.parseCondition = this._parseConditions.INITIAL;
-                    this.tokenType = "html-tag";
-                    return cursor;
-                }
+this.setLexCondition(this._lexConditions.INITIAL);
+this.tokenType = null;
+return cursor;
+}
+
+this._condition.parseCondition = this._parseConditions.INITIAL;
+this.tokenType = "html-tag";
+return cursor;
+}
 case 41:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == 'S') { gotoCase = 68; continue; };
-            if (yych == 's') { gotoCase = 68; continue; };
-            { gotoCase = 40; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'S') { gotoCase = 68; continue; };
+if (yych == 's') { gotoCase = 68; continue; };
+{ gotoCase = 40; continue; };
 case 42:
-            yych = this._charAt(++cursor);
-            if (yych == 'C') { gotoCase = 62; continue; };
-            if (yych == 'c') { gotoCase = 62; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'C') { gotoCase = 62; continue; };
+if (yych == 'c') { gotoCase = 62; continue; };
 case 43:
-            cursor = YYMARKER;
-            { gotoCase = 40; continue; };
+cursor = YYMARKER;
+{ gotoCase = 40; continue; };
 case 44:
-            yych = this._charAt(++cursor);
-            if (yych <= 'C') {
-                if (yych != '-') { gotoCase = 43; continue; };
-            } else {
-                if (yych <= 'D') { gotoCase = 46; continue; };
-                if (yych == 'd') { gotoCase = 46; continue; };
-                { gotoCase = 43; continue; };
-            }
-            yych = this._charAt(++cursor);
-            if (yych == '-') { gotoCase = 54; continue; };
-            { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych <= 'C') {
+if (yych != '-') { gotoCase = 43; continue; };
+} else {
+if (yych <= 'D') { gotoCase = 46; continue; };
+if (yych == 'd') { gotoCase = 46; continue; };
+{ gotoCase = 43; continue; };
+}
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 54; continue; };
+{ gotoCase = 43; continue; };
 case 46:
-            yych = this._charAt(++cursor);
-            if (yych == 'O') { gotoCase = 47; continue; };
-            if (yych != 'o') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'O') { gotoCase = 47; continue; };
+if (yych != 'o') { gotoCase = 43; continue; };
 case 47:
-            yych = this._charAt(++cursor);
-            if (yych == 'C') { gotoCase = 48; continue; };
-            if (yych != 'c') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'C') { gotoCase = 48; continue; };
+if (yych != 'c') { gotoCase = 43; continue; };
 case 48:
-            yych = this._charAt(++cursor);
-            if (yych == 'T') { gotoCase = 49; continue; };
-            if (yych != 't') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'T') { gotoCase = 49; continue; };
+if (yych != 't') { gotoCase = 43; continue; };
 case 49:
-            yych = this._charAt(++cursor);
-            if (yych == 'Y') { gotoCase = 50; continue; };
-            if (yych != 'y') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'Y') { gotoCase = 50; continue; };
+if (yych != 'y') { gotoCase = 43; continue; };
 case 50:
-            yych = this._charAt(++cursor);
-            if (yych == 'P') { gotoCase = 51; continue; };
-            if (yych != 'p') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'P') { gotoCase = 51; continue; };
+if (yych != 'p') { gotoCase = 43; continue; };
 case 51:
-            yych = this._charAt(++cursor);
-            if (yych == 'E') { gotoCase = 52; continue; };
-            if (yych != 'e') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'E') { gotoCase = 52; continue; };
+if (yych != 'e') { gotoCase = 43; continue; };
 case 52:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.DOCTYPE);
-            { this.tokenType = "html-doctype"; return cursor; }
+++cursor;
+this.setLexCondition(this._lexConditions.DOCTYPE);
+{ this.tokenType = "html-doctype"; return cursor; }
 case 54:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 57; continue; };
-                { gotoCase = 54; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 57; continue; };
-                if (yych != '-') { gotoCase = 54; continue; };
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '-') { gotoCase = 59; continue; };
-            { gotoCase = 43; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 57; continue; };
+{ gotoCase = 54; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 57; continue; };
+if (yych != '-') { gotoCase = 54; continue; };
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '-') { gotoCase = 59; continue; };
+{ gotoCase = 43; continue; };
 case 57:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.COMMENT);
-            { this.tokenType = "html-comment"; return cursor; }
+++cursor;
+this.setLexCondition(this._lexConditions.COMMENT);
+{ this.tokenType = "html-comment"; return cursor; }
 case 59:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych != '>') { gotoCase = 54; continue; };
-            ++cursor;
-            { this.tokenType = "html-comment"; return cursor; }
+++cursor;
+yych = this._charAt(cursor);
+if (yych != '>') { gotoCase = 54; continue; };
+++cursor;
+{ this.tokenType = "html-comment"; return cursor; }
 case 62:
-            yych = this._charAt(++cursor);
-            if (yych == 'R') { gotoCase = 63; continue; };
-            if (yych != 'r') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'R') { gotoCase = 63; continue; };
+if (yych != 'r') { gotoCase = 43; continue; };
 case 63:
-            yych = this._charAt(++cursor);
-            if (yych == 'I') { gotoCase = 64; continue; };
-            if (yych != 'i') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'I') { gotoCase = 64; continue; };
+if (yych != 'i') { gotoCase = 43; continue; };
 case 64:
-            yych = this._charAt(++cursor);
-            if (yych == 'P') { gotoCase = 65; continue; };
-            if (yych != 'p') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'P') { gotoCase = 65; continue; };
+if (yych != 'p') { gotoCase = 43; continue; };
 case 65:
-            yych = this._charAt(++cursor);
-            if (yych == 'T') { gotoCase = 66; continue; };
-            if (yych != 't') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'T') { gotoCase = 66; continue; };
+if (yych != 't') { gotoCase = 43; continue; };
 case 66:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.TAG);
-            {
-                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        // Do not tokenize script tag contents, keep lexer state although processing "<".
-                        this.setLexCondition(this._lexConditions.INITIAL);
-                        this.tokenType = null;
-                        return cursor;
-                    }
-                    this.tokenType = "html-tag";
-                    this._condition.parseCondition = this._parseConditions.SCRIPT;
-                    this._setExpectingAttribute();
-                    return cursor;
-                }
+++cursor;
+this.setLexCondition(this._lexConditions.TAG);
+{
+if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+
+this.setLexCondition(this._lexConditions.INITIAL);
+this.tokenType = null;
+return cursor;
+}
+this.tokenType = "html-tag";
+this._condition.parseCondition = this._parseConditions.SCRIPT;
+this._setExpectingAttribute();
+return cursor;
+}
 case 68:
-            yych = this._charAt(++cursor);
-            if (yych == 'C') { gotoCase = 69; continue; };
-            if (yych != 'c') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'C') { gotoCase = 69; continue; };
+if (yych != 'c') { gotoCase = 43; continue; };
 case 69:
-            yych = this._charAt(++cursor);
-            if (yych == 'R') { gotoCase = 70; continue; };
-            if (yych != 'r') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'R') { gotoCase = 70; continue; };
+if (yych != 'r') { gotoCase = 43; continue; };
 case 70:
-            yych = this._charAt(++cursor);
-            if (yych == 'I') { gotoCase = 71; continue; };
-            if (yych != 'i') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'I') { gotoCase = 71; continue; };
+if (yych != 'i') { gotoCase = 43; continue; };
 case 71:
-            yych = this._charAt(++cursor);
-            if (yych == 'P') { gotoCase = 72; continue; };
-            if (yych != 'p') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'P') { gotoCase = 72; continue; };
+if (yych != 'p') { gotoCase = 43; continue; };
 case 72:
-            yych = this._charAt(++cursor);
-            if (yych == 'T') { gotoCase = 73; continue; };
-            if (yych != 't') { gotoCase = 43; continue; };
+yych = this._charAt(++cursor);
+if (yych == 'T') { gotoCase = 73; continue; };
+if (yych != 't') { gotoCase = 43; continue; };
 case 73:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.TAG);
-            {
-                    this.tokenType = "html-tag";
-                    this._condition.parseCondition = this._parseConditions.INITIAL;
-                    return cursor;
-                }
-/* *********************************** */
+++cursor;
+this.setLexCondition(this._lexConditions.TAG);
+{
+this.tokenType = "html-tag";
+this._condition.parseCondition = this._parseConditions.INITIAL;
+return cursor;
+}
+
 case this.case_SSTRING:
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 79; continue; };
-                { gotoCase = 78; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 79; continue; };
-                if (yych == '\'') { gotoCase = 81; continue; };
-                { gotoCase = 78; continue; };
-            }
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 79; continue; };
+{ gotoCase = 78; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 79; continue; };
+if (yych == '\'') { gotoCase = 81; continue; };
+{ gotoCase = 78; continue; };
+}
 case 77:
-            { return this._stringToken(cursor); }
+{ return this._stringToken(cursor); }
 case 78:
-            yych = this._charAt(++cursor);
-            { gotoCase = 85; continue; };
+yych = this._charAt(++cursor);
+{ gotoCase = 85; continue; };
 case 79:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 81:
-            ++cursor;
+++cursor;
 case 82:
-            this.setLexCondition(this._lexConditions.TAG);
-            { return this._stringToken(cursor, true); }
+this.setLexCondition(this._lexConditions.TAG);
+{ return this._stringToken(cursor, true); }
 case 83:
-            yych = this._charAt(++cursor);
-            { gotoCase = 82; continue; };
+yych = this._charAt(++cursor);
+{ gotoCase = 82; continue; };
 case 84:
-            ++cursor;
-            yych = this._charAt(cursor);
+++cursor;
+yych = this._charAt(cursor);
 case 85:
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 77; continue; };
-                { gotoCase = 84; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 77; continue; };
-                if (yych == '\'') { gotoCase = 83; continue; };
-                { gotoCase = 84; continue; };
-            }
-/* *********************************** */
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 77; continue; };
+{ gotoCase = 84; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 77; continue; };
+if (yych == '\'') { gotoCase = 83; continue; };
+{ gotoCase = 84; continue; };
+}
+
 case this.case_TAG:
-            yych = this._charAt(cursor);
-            if (yych <= '&') {
-                if (yych <= '\r') {
-                    if (yych == '\n') { gotoCase = 90; continue; };
-                    if (yych >= '\r') { gotoCase = 90; continue; };
-                } else {
-                    if (yych <= ' ') {
-                        if (yych >= ' ') { gotoCase = 90; continue; };
-                    } else {
-                        if (yych == '"') { gotoCase = 92; continue; };
-                    }
-                }
-            } else {
-                if (yych <= '>') {
-                    if (yych <= ';') {
-                        if (yych <= '\'') { gotoCase = 93; continue; };
-                    } else {
-                        if (yych <= '<') { gotoCase = 90; continue; };
-                        if (yych <= '=') { gotoCase = 94; continue; };
-                        { gotoCase = 96; continue; };
-                    }
-                } else {
-                    if (yych <= '[') {
-                        if (yych >= '[') { gotoCase = 90; continue; };
-                    } else {
-                        if (yych == ']') { gotoCase = 90; continue; };
-                    }
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 109; continue; };
+yych = this._charAt(cursor);
+if (yych <= '&') {
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 90; continue; };
+if (yych >= '\r') { gotoCase = 90; continue; };
+} else {
+if (yych <= ' ') {
+if (yych >= ' ') { gotoCase = 90; continue; };
+} else {
+if (yych == '"') { gotoCase = 92; continue; };
+}
+}
+} else {
+if (yych <= '>') {
+if (yych <= ';') {
+if (yych <= '\'') { gotoCase = 93; continue; };
+} else {
+if (yych <= '<') { gotoCase = 90; continue; };
+if (yych <= '=') { gotoCase = 94; continue; };
+{ gotoCase = 96; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych >= '[') { gotoCase = 90; continue; };
+} else {
+if (yych == ']') { gotoCase = 90; continue; };
+}
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 109; continue; };
 case 89:
-            {
-                    if (this._condition.parseCondition === this._parseConditions.SCRIPT) {
-                        // Fall through if expecting attributes.
-                        this.tokenType = null;
-                        return cursor;
-                    }
+{
+if (this._condition.parseCondition === this._parseConditions.SCRIPT) {
 
-                    if (this._condition.parseCondition === this._parseConditions.INITIAL) {
-                        this.tokenType = "html-tag";
-                        this._setExpectingAttribute();
-                        var token = this._line.substring(cursorOnEnter, cursor);
-                        if (token === "a")
-                            this._condition.parseCondition |= this._parseConditions.A_NODE;
-                        else if (this._condition.parseCondition & this._parseConditions.A_NODE)
-                            this._condition.parseCondition ^= this._parseConditions.A_NODE;
-                    } else if (this._isExpectingAttribute()) {
-                        var token = this._line.substring(cursorOnEnter, cursor);
-                        if (token === "href" || token === "src")
-                            this._condition.parseCondition |= this._parseConditions.LINKIFY;
-                        else if (this._condition.parseCondition |= this._parseConditions.LINKIFY)
-                            this._condition.parseCondition ^= this._parseConditions.LINKIFY;
-                        this.tokenType = "html-attribute-name";
-                    } else if (this._isExpectingAttributeValue())
-                        this.tokenType = this._attrValueTokenType();
-                    else
-                        this.tokenType = null;
-                    return cursor;
-                }
+this.tokenType = null;
+return cursor;
+}
+
+if (this._condition.parseCondition === this._parseConditions.INITIAL) {
+this.tokenType = "html-tag";
+this._setExpectingAttribute();
+var token = this._line.substring(cursorOnEnter, cursor);
+if (token === "a")
+this._condition.parseCondition |= this._parseConditions.A_NODE;
+else if (this._condition.parseCondition & this._parseConditions.A_NODE)
+this._condition.parseCondition ^= this._parseConditions.A_NODE;
+} else if (this._isExpectingAttribute()) {
+var token = this._line.substring(cursorOnEnter, cursor);
+if (token === "href" || token === "src")
+this._condition.parseCondition |= this._parseConditions.LINKIFY;
+else if (this._condition.parseCondition |= this._parseConditions.LINKIFY)
+this._condition.parseCondition ^= this._parseConditions.LINKIFY;
+this.tokenType = "html-attribute-name";
+} else if (this._isExpectingAttributeValue())
+this.tokenType = this._attrValueTokenType();
+else
+this.tokenType = null;
+return cursor;
+}
 case 90:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 92:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 105; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 105; continue; };
 case 93:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 99; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 99; continue; };
 case 94:
-            ++cursor;
-            {
-                    if (this._isExpectingAttribute())
-                        this._setExpectingAttributeValue();
-                    this.tokenType = null;
-                    return cursor;
-                }
+++cursor;
+{
+if (this._isExpectingAttribute())
+this._setExpectingAttributeValue();
+this.tokenType = null;
+return cursor;
+}
 case 96:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.INITIAL);
-            {
-                    this.tokenType = "html-tag";
-                    if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
-                        if (!this._internalJavaScriptTokenizer) {
-                            this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");
-                            this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition;
-                        }
-                        // Do not tokenize script tag contents.
-                        return cursor;
-                    }
+++cursor;
+this.setLexCondition(this._lexConditions.INITIAL);
+{
+this.tokenType = "html-tag";
+if (this._condition.parseCondition & this._parseConditions.SCRIPT) {
+if (!this._internalJavaScriptTokenizer) {
+this._internalJavaScriptTokenizer = WebInspector.SourceTokenizer.Registry.getInstance().getTokenizer("text/javascript");
+this._condition.internalJavaScriptTokenizerCondition = this._internalJavaScriptTokenizer.initialCondition;
+}
 
-                    this._condition.parseCondition = this._parseConditions.INITIAL;
-                    return cursor;
-                }
+return cursor;
+}
+
+this._condition.parseCondition = this._parseConditions.INITIAL;
+return cursor;
+}
 case 98:
-            ++cursor;
-            yych = this._charAt(cursor);
+++cursor;
+yych = this._charAt(cursor);
 case 99:
-            if (yych <= '\f') {
-                if (yych != '\n') { gotoCase = 98; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 100; continue; };
-                if (yych == '\'') { gotoCase = 102; continue; };
-                { gotoCase = 98; continue; };
-            }
+if (yych <= '\f') {
+if (yych != '\n') { gotoCase = 98; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 100; continue; };
+if (yych == '\'') { gotoCase = 102; continue; };
+{ gotoCase = 98; continue; };
+}
 case 100:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.SSTRING);
-            { return this._stringToken(cursor); }
+++cursor;
+this.setLexCondition(this._lexConditions.SSTRING);
+{ return this._stringToken(cursor); }
 case 102:
-            ++cursor;
-            { return this._stringToken(cursor, true); }
+++cursor;
+{ return this._stringToken(cursor, true); }
 case 104:
-            ++cursor;
-            yych = this._charAt(cursor);
+++cursor;
+yych = this._charAt(cursor);
 case 105:
-            if (yych <= '\f') {
-                if (yych != '\n') { gotoCase = 104; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 106; continue; };
-                if (yych == '"') { gotoCase = 102; continue; };
-                { gotoCase = 104; continue; };
-            }
+if (yych <= '\f') {
+if (yych != '\n') { gotoCase = 104; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 106; continue; };
+if (yych == '"') { gotoCase = 102; continue; };
+{ gotoCase = 104; continue; };
+}
 case 106:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.DSTRING);
-            { return this._stringToken(cursor); }
+++cursor;
+this.setLexCondition(this._lexConditions.DSTRING);
+{ return this._stringToken(cursor); }
 case 108:
-            ++cursor;
-            yych = this._charAt(cursor);
+++cursor;
+yych = this._charAt(cursor);
 case 109:
-            if (yych <= '"') {
-                if (yych <= '\r') {
-                    if (yych == '\n') { gotoCase = 89; continue; };
-                    if (yych <= '\f') { gotoCase = 108; continue; };
-                    { gotoCase = 89; continue; };
-                } else {
-                    if (yych == ' ') { gotoCase = 89; continue; };
-                    if (yych <= '!') { gotoCase = 108; continue; };
-                    { gotoCase = 89; continue; };
-                }
-            } else {
-                if (yych <= '>') {
-                    if (yych == '\'') { gotoCase = 89; continue; };
-                    if (yych <= ';') { gotoCase = 108; continue; };
-                    { gotoCase = 89; continue; };
-                } else {
-                    if (yych <= '[') {
-                        if (yych <= 'Z') { gotoCase = 108; continue; };
-                        { gotoCase = 89; continue; };
-                    } else {
-                        if (yych == ']') { gotoCase = 89; continue; };
-                        { gotoCase = 108; continue; };
-                    }
-                }
-            }
-        }
+if (yych <= '"') {
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 89; continue; };
+if (yych <= '\f') { gotoCase = 108; continue; };
+{ gotoCase = 89; continue; };
+} else {
+if (yych == ' ') { gotoCase = 89; continue; };
+if (yych <= '!') { gotoCase = 108; continue; };
+{ gotoCase = 89; continue; };
+}
+} else {
+if (yych <= '>') {
+if (yych == '\'') { gotoCase = 89; continue; };
+if (yych <= ';') { gotoCase = 108; continue; };
+{ gotoCase = 89; continue; };
+} else {
+if (yych <= '[') {
+if (yych <= 'Z') { gotoCase = 108; continue; };
+{ gotoCase = 89; continue; };
+} else {
+if (yych == ']') { gotoCase = 89; continue; };
+{ gotoCase = 108; continue; };
+}
+}
+}
+}
 
-        }
-    }
+}
+}
 }
 
 WebInspector.SourceHTMLTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype;
 
-/* SourceJavaScriptTokenizer.js */
 
-/* Generated by re2c 0.13.5 on Thu Feb 25 21:44:55 2010 */
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-// Generate js file as follows:
-//
-// re2c -isc WebCore/inspector/front-end/SourceJavaScriptTokenizer.re2js \
-// | sed 's|^yy\([^:]*\)*\:|case \1:|' \
-// | sed 's|[*]cursor[+][+]|this._charAt(cursor++)|' \
-// | sed 's|[[*][+][+]cursor|this._charAt(++cursor)|' \
-// | sed 's|[*]cursor|this._charAt(cursor)|' \
-// | sed 's|yych = \*\([^;]*\)|yych = this._charAt\1|' \
-// | sed 's|{ gotoCase = \([^; continue; };]*\)|{ gotoCase = \1; continue; }|' \
-// | sed 's|unsigned\ int|var|' \
-// | sed 's|var\ yych|case 1: case 1: var yych|'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 WebInspector.SourceJavaScriptTokenizer = function()
 {
-    WebInspector.SourceTokenizer.call(this);
+WebInspector.SourceTokenizer.call(this);
 
-    this._keywords = [
-        "null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for",
-        "instanceof", "new", "var", "continue", "function", "return", "void", "delete", "if",
-        "this", "do", "while", "else", "in", "switch", "throw", "try", "typeof", "debugger",
-        "class", "enum", "export", "extends", "import", "super", "get", "set", "with"
-    ].keySet();
+this._keywords = [
+"null", "true", "false", "break", "case", "catch", "const", "default", "finally", "for",
+"instanceof", "new", "var", "continue", "function", "return", "void", "delete", "if",
+"this", "do", "while", "else", "in", "switch", "throw", "try", "typeof", "debugger",
+"class", "enum", "export", "extends", "import", "super", "get", "set", "with"
+].keySet();
 
-    this._lexConditions = {
-        DIV: 0,
-        NODIV: 1,
-        COMMENT: 2,
-        DSTRING: 3,
-        SSTRING: 4,
-        REGEX: 5
-    };
+this._lexConditions = {
+DIV: 0,
+NODIV: 1,
+COMMENT: 2,
+DSTRING: 3,
+SSTRING: 4,
+REGEX: 5
+};
 
-    this.case_DIV = 1000;
-    this.case_NODIV = 1001;
-    this.case_COMMENT = 1002;
-    this.case_DSTRING = 1003;
-    this.case_SSTRING = 1004;
-    this.case_REGEX = 1005;
+this.case_DIV = 1000;
+this.case_NODIV = 1001;
+this.case_COMMENT = 1002;
+this.case_DSTRING = 1003;
+this.case_SSTRING = 1004;
+this.case_REGEX = 1005;
 
-    this.initialCondition = { lexCondition: this._lexConditions.NODIV }
-    this.condition = this.initialCondition;
+this.initialCondition = { lexCondition: this._lexConditions.NODIV }
+this.condition = this.initialCondition;
 }
 
 WebInspector.SourceJavaScriptTokenizer.prototype = {
-    nextToken: function(cursor)
-    {
-        var cursorOnEnter = cursor;
-        var gotoCase = 1;
-        while (1) {
-            switch (gotoCase)
-            // Following comment is replaced with generated state machine.
-            
-        {
-            case 1: var yych;
-            var yyaccept = 0;
-            if (this.getLexCondition() < 3) {
-                if (this.getLexCondition() < 1) {
-                    { gotoCase = this.case_DIV; continue; };
-                } else {
-                    if (this.getLexCondition() < 2) {
-                        { gotoCase = this.case_NODIV; continue; };
-                    } else {
-                        { gotoCase = this.case_COMMENT; continue; };
-                    }
-                }
-            } else {
-                if (this.getLexCondition() < 4) {
-                    { gotoCase = this.case_DSTRING; continue; };
-                } else {
-                    if (this.getLexCondition() < 5) {
-                        { gotoCase = this.case_SSTRING; continue; };
-                    } else {
-                        { gotoCase = this.case_REGEX; continue; };
-                    }
-                }
-            }
-/* *********************************** */
+nextToken: function(cursor)
+{
+var cursorOnEnter = cursor;
+var gotoCase = 1;
+while (1) {
+switch (gotoCase)
+
+
+{
+case 1: var yych;
+var yyaccept = 0;
+if (this.getLexCondition() < 3) {
+if (this.getLexCondition() < 1) {
+{ gotoCase = this.case_DIV; continue; };
+} else {
+if (this.getLexCondition() < 2) {
+{ gotoCase = this.case_NODIV; continue; };
+} else {
+{ gotoCase = this.case_COMMENT; continue; };
+}
+}
+} else {
+if (this.getLexCondition() < 4) {
+{ gotoCase = this.case_DSTRING; continue; };
+} else {
+if (this.getLexCondition() < 5) {
+{ gotoCase = this.case_SSTRING; continue; };
+} else {
+{ gotoCase = this.case_REGEX; continue; };
+}
+}
+}
+
 case this.case_COMMENT:
 
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 4; continue; };
-                { gotoCase = 3; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 4; continue; };
-                if (yych == '*') { gotoCase = 6; continue; };
-                { gotoCase = 3; continue; };
-            }
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 4; continue; };
+{ gotoCase = 3; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 4; continue; };
+if (yych == '*') { gotoCase = 6; continue; };
+{ gotoCase = 3; continue; };
+}
 case 2:
-            { this.tokenType = "javascript-comment"; return cursor; }
+{ this.tokenType = "javascript-comment"; return cursor; }
 case 3:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 12; continue; };
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 12; continue; };
 case 4:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
+++cursor;
+{ this.tokenType = null; return cursor; }
 case 6:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '*') { gotoCase = 9; continue; };
-            if (yych != '/') { gotoCase = 11; continue; };
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '*') { gotoCase = 9; continue; };
+if (yych != '/') { gotoCase = 11; continue; };
 case 7:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.NODIV);
-            { this.tokenType = "javascript-comment"; return cursor; }
+++cursor;
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = "javascript-comment"; return cursor; }
 case 9:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '*') { gotoCase = 9; continue; };
-            if (yych == '/') { gotoCase = 7; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 9; continue; };
+if (yych == '/') { gotoCase = 7; continue; };
 case 11:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
 case 12:
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 2; continue; };
-                { gotoCase = 11; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 2; continue; };
-                if (yych == '*') { gotoCase = 9; continue; };
-                { gotoCase = 11; continue; };
-            }
-/* *********************************** */
-case this.case_DIV:
-            yych = this._charAt(cursor);
-            if (yych <= '9') {
-                if (yych <= '(') {
-                    if (yych <= '#') {
-                        if (yych <= ' ') { gotoCase = 15; continue; };
-                        if (yych <= '!') { gotoCase = 17; continue; };
-                        if (yych <= '"') { gotoCase = 19; continue; };
-                    } else {
-                        if (yych <= '%') {
-                            if (yych <= '$') { gotoCase = 20; continue; };
-                            { gotoCase = 22; continue; };
-                        } else {
-                            if (yych <= '&') { gotoCase = 23; continue; };
-                            if (yych <= '\'') { gotoCase = 24; continue; };
-                            { gotoCase = 25; continue; };
-                        }
-                    }
-                } else {
-                    if (yych <= ',') {
-                        if (yych <= ')') { gotoCase = 26; continue; };
-                        if (yych <= '*') { gotoCase = 28; continue; };
-                        if (yych <= '+') { gotoCase = 29; continue; };
-                        { gotoCase = 25; continue; };
-                    } else {
-                        if (yych <= '.') {
-                            if (yych <= '-') { gotoCase = 30; continue; };
-                            { gotoCase = 31; continue; };
-                        } else {
-                            if (yych <= '/') { gotoCase = 32; continue; };
-                            if (yych <= '0') { gotoCase = 34; continue; };
-                            { gotoCase = 36; continue; };
-                        }
-                    }
-                }
-            } else {
-                if (yych <= '\\') {
-                    if (yych <= '>') {
-                        if (yych <= ';') { gotoCase = 25; continue; };
-                        if (yych <= '<') { gotoCase = 37; continue; };
-                        if (yych <= '=') { gotoCase = 38; continue; };
-                        { gotoCase = 39; continue; };
-                    } else {
-                        if (yych <= '@') {
-                            if (yych <= '?') { gotoCase = 25; continue; };
-                        } else {
-                            if (yych <= 'Z') { gotoCase = 20; continue; };
-                            if (yych <= '[') { gotoCase = 25; continue; };
-                            { gotoCase = 40; continue; };
-                        }
-                    }
-                } else {
-                    if (yych <= 'z') {
-                        if (yych <= '^') {
-                            if (yych <= ']') { gotoCase = 25; continue; };
-                            { gotoCase = 41; continue; };
-                        } else {
-                            if (yych != '`') { gotoCase = 20; continue; };
-                        }
-                    } else {
-                        if (yych <= '|') {
-                            if (yych <= '{') { gotoCase = 25; continue; };
-                            { gotoCase = 42; continue; };
-                        } else {
-                            if (yych <= '~') { gotoCase = 25; continue; };
-                            if (yych >= 0x80) { gotoCase = 20; continue; };
-                        }
-                    }
-                }
-            }
-case 15:
-            ++cursor;
-case 16:
-            { this.tokenType = null; return cursor; }
-case 17:
-            ++cursor;
-            if ((yych = this._charAt(cursor)) == '=') { gotoCase = 115; continue; };
-case 18:
-            this.setLexCondition(this._lexConditions.NODIV);
-            { this.tokenType = null; return cursor; }
-case 19:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '\n') { gotoCase = 16; continue; };
-            if (yych == '\r') { gotoCase = 16; continue; };
-            { gotoCase = 107; continue; };
-case 20:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 50; continue; };
-case 21:
-            {
-                    var token = this._line.substring(cursorOnEnter, cursor);
-                    if (token in this._keywords)
-                        this.tokenType = "javascript-keyword";
-                    else
-                        this.tokenType = "javascript-ident";
-                    return cursor;
-                }
-case 22:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 23:
-            yych = this._charAt(++cursor);
-            if (yych == '&') { gotoCase = 43; continue; };
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 24:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '\n') { gotoCase = 16; continue; };
-            if (yych == '\r') { gotoCase = 16; continue; };
-            { gotoCase = 96; continue; };
-case 25:
-            yych = this._charAt(++cursor);
-            { gotoCase = 18; continue; };
-case 26:
-            ++cursor;
-            { this.tokenType = null; return cursor; }
-case 28:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 29:
-            yych = this._charAt(++cursor);
-            if (yych == '+') { gotoCase = 43; continue; };
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 30:
-            yych = this._charAt(++cursor);
-            if (yych == '-') { gotoCase = 43; continue; };
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 31:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 18; continue; };
-            if (yych <= '9') { gotoCase = 89; continue; };
-            { gotoCase = 18; continue; };
-case 32:
-            yyaccept = 2;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '.') {
-                if (yych == '*') { gotoCase = 78; continue; };
-            } else {
-                if (yych <= '/') { gotoCase = 80; continue; };
-                if (yych == '=') { gotoCase = 77; continue; };
-            }
-case 33:
-            this.setLexCondition(this._lexConditions.NODIV);
-            { this.tokenType = null; return cursor; }
-case 34:
-            yyaccept = 3;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= 'E') {
-                if (yych <= '/') {
-                    if (yych == '.') { gotoCase = 63; continue; };
-                } else {
-                    if (yych <= '7') { gotoCase = 72; continue; };
-                    if (yych >= 'E') { gotoCase = 62; continue; };
-                }
-            } else {
-                if (yych <= 'd') {
-                    if (yych == 'X') { gotoCase = 74; continue; };
-                } else {
-                    if (yych <= 'e') { gotoCase = 62; continue; };
-                    if (yych == 'x') { gotoCase = 74; continue; };
-                }
-            }
-case 35:
-            { this.tokenType = "javascript-number"; return cursor; }
-case 36:
-            yyaccept = 3;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '9') {
-                if (yych == '.') { gotoCase = 63; continue; };
-                if (yych <= '/') { gotoCase = 35; continue; };
-                { gotoCase = 60; continue; };
-            } else {
-                if (yych <= 'E') {
-                    if (yych <= 'D') { gotoCase = 35; continue; };
-                    { gotoCase = 62; continue; };
-                } else {
-                    if (yych == 'e') { gotoCase = 62; continue; };
-                    { gotoCase = 35; continue; };
-                }
-            }
-case 37:
-            yych = this._charAt(++cursor);
-            if (yych <= ';') { gotoCase = 18; continue; };
-            if (yych <= '<') { gotoCase = 59; continue; };
-            if (yych <= '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 38:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 58; continue; };
-            { gotoCase = 18; continue; };
-case 39:
-            yych = this._charAt(++cursor);
-            if (yych <= '<') { gotoCase = 18; continue; };
-            if (yych <= '=') { gotoCase = 43; continue; };
-            if (yych <= '>') { gotoCase = 56; continue; };
-            { gotoCase = 18; continue; };
-case 40:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == 'u') { gotoCase = 44; continue; };
-            { gotoCase = 16; continue; };
-case 41:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 42:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            if (yych != '|') { gotoCase = 18; continue; };
-case 43:
-            yych = this._charAt(++cursor);
-            { gotoCase = 18; continue; };
-case 44:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 46; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 46; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych <= 'f') { gotoCase = 46; continue; };
-            }
-case 45:
-            cursor = YYMARKER;
-            if (yyaccept <= 1) {
-                if (yyaccept <= 0) {
-                    { gotoCase = 16; continue; };
-                } else {
-                    { gotoCase = 21; continue; };
-                }
-            } else {
-                if (yyaccept <= 2) {
-                    { gotoCase = 33; continue; };
-                } else {
-                    { gotoCase = 35; continue; };
-                }
-            }
-case 46:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 47; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 47:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 48; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 48:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 49; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 49:
-            yyaccept = 1;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 50:
-            if (yych <= '[') {
-                if (yych <= '/') {
-                    if (yych == '$') { gotoCase = 49; continue; };
-                    { gotoCase = 21; continue; };
-                } else {
-                    if (yych <= '9') { gotoCase = 49; continue; };
-                    if (yych <= '@') { gotoCase = 21; continue; };
-                    if (yych <= 'Z') { gotoCase = 49; continue; };
-                    { gotoCase = 21; continue; };
-                }
-            } else {
-                if (yych <= '_') {
-                    if (yych <= '\\') { gotoCase = 51; continue; };
-                    if (yych <= '^') { gotoCase = 21; continue; };
-                    { gotoCase = 49; continue; };
-                } else {
-                    if (yych <= '`') { gotoCase = 21; continue; };
-                    if (yych <= 'z') { gotoCase = 49; continue; };
-                    if (yych <= 0x7F) { gotoCase = 21; continue; };
-                    { gotoCase = 49; continue; };
-                }
-            }
-case 51:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych != 'u') { gotoCase = 45; continue; };
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 53; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 53:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 54; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 54:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 55; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 55:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 49; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 49; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych <= 'f') { gotoCase = 49; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 56:
-            yych = this._charAt(++cursor);
-            if (yych <= '<') { gotoCase = 18; continue; };
-            if (yych <= '=') { gotoCase = 43; continue; };
-            if (yych >= '?') { gotoCase = 18; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 58:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 59:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-case 60:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '9') {
-                if (yych == '.') { gotoCase = 63; continue; };
-                if (yych <= '/') { gotoCase = 35; continue; };
-                { gotoCase = 60; continue; };
-            } else {
-                if (yych <= 'E') {
-                    if (yych <= 'D') { gotoCase = 35; continue; };
-                } else {
-                    if (yych != 'e') { gotoCase = 35; continue; };
-                }
-            }
-case 62:
-            yych = this._charAt(++cursor);
-            if (yych <= ',') {
-                if (yych == '+') { gotoCase = 69; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= '-') { gotoCase = 69; continue; };
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 70; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 63:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'D') {
-                if (yych <= '/') { gotoCase = 35; continue; };
-                if (yych <= '9') { gotoCase = 63; continue; };
-                { gotoCase = 35; continue; };
-            } else {
-                if (yych <= 'E') { gotoCase = 65; continue; };
-                if (yych != 'e') { gotoCase = 35; continue; };
-            }
-case 65:
-            yych = this._charAt(++cursor);
-            if (yych <= ',') {
-                if (yych != '+') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= '-') { gotoCase = 66; continue; };
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 67; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 66:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 45; continue; };
-            if (yych >= ':') { gotoCase = 45; continue; };
-case 67:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 35; continue; };
-            if (yych <= '9') { gotoCase = 67; continue; };
-            { gotoCase = 35; continue; };
-case 69:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 45; continue; };
-            if (yych >= ':') { gotoCase = 45; continue; };
-case 70:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 35; continue; };
-            if (yych <= '9') { gotoCase = 70; continue; };
-            { gotoCase = 35; continue; };
-case 72:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 35; continue; };
-            if (yych <= '7') { gotoCase = 72; continue; };
-            { gotoCase = 35; continue; };
-case 74:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 75; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 75:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 35; continue; };
-                if (yych <= '9') { gotoCase = 75; continue; };
-                { gotoCase = 35; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 75; continue; };
-                if (yych <= '`') { gotoCase = 35; continue; };
-                if (yych <= 'f') { gotoCase = 75; continue; };
-                { gotoCase = 35; continue; };
-            }
-case 77:
-            yych = this._charAt(++cursor);
-            { gotoCase = 33; continue; };
-case 78:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 85; continue; };
-                { gotoCase = 78; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 85; continue; };
-                if (yych == '*') { gotoCase = 83; continue; };
-                { gotoCase = 78; continue; };
-            }
-case 80:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 82; continue; };
-            if (yych != '\r') { gotoCase = 80; continue; };
-case 82:
-            { this.tokenType = "javascript-comment"; return cursor; }
-case 83:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '*') { gotoCase = 83; continue; };
-            if (yych == '/') { gotoCase = 87; continue; };
-            { gotoCase = 78; continue; };
-case 85:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.COMMENT);
-            { this.tokenType = "javascript-comment"; return cursor; }
-case 87:
-            ++cursor;
-            { this.tokenType = "javascript-comment"; return cursor; }
-case 89:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'D') {
-                if (yych <= '/') { gotoCase = 35; continue; };
-                if (yych <= '9') { gotoCase = 89; continue; };
-                { gotoCase = 35; continue; };
-            } else {
-                if (yych <= 'E') { gotoCase = 91; continue; };
-                if (yych != 'e') { gotoCase = 35; continue; };
-            }
-case 91:
-            yych = this._charAt(++cursor);
-            if (yych <= ',') {
-                if (yych != '+') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= '-') { gotoCase = 92; continue; };
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 93; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 92:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 45; continue; };
-            if (yych >= ':') { gotoCase = 45; continue; };
-case 93:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 35; continue; };
-            if (yych <= '9') { gotoCase = 93; continue; };
-            { gotoCase = 35; continue; };
-case 95:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 96:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 45; continue; };
-                if (yych <= '\f') { gotoCase = 95; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 95; continue; };
-                    { gotoCase = 98; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 95; continue; };
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'a') {
-                if (yych <= '!') {
-                    if (yych <= '\n') {
-                        if (yych <= '\t') { gotoCase = 45; continue; };
-                        { gotoCase = 101; continue; };
-                    } else {
-                        if (yych == '\r') { gotoCase = 101; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                } else {
-                    if (yych <= '\'') {
-                        if (yych <= '"') { gotoCase = 95; continue; };
-                        if (yych <= '&') { gotoCase = 45; continue; };
-                        { gotoCase = 95; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 95; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'q') {
-                    if (yych <= 'f') {
-                        if (yych <= 'b') { gotoCase = 95; continue; };
-                        if (yych <= 'e') { gotoCase = 45; continue; };
-                        { gotoCase = 95; continue; };
-                    } else {
-                        if (yych == 'n') { gotoCase = 95; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych == 's') { gotoCase = 45; continue; };
-                        { gotoCase = 95; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 100; continue; };
-                        if (yych <= 'v') { gotoCase = 95; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                }
-            }
-case 98:
-            ++cursor;
-            { this.tokenType = "javascript-string"; return cursor; }
-case 100:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 103; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 103; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych <= 'f') { gotoCase = 103; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 101:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.SSTRING);
-            { this.tokenType = "javascript-string"; return cursor; }
-case 103:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 104; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 104:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 105; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 105:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 95; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 95; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych <= 'f') { gotoCase = 95; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 106:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 107:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 45; continue; };
-                if (yych <= '\f') { gotoCase = 106; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 106; continue; };
-                    { gotoCase = 98; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 106; continue; };
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'a') {
-                if (yych <= '!') {
-                    if (yych <= '\n') {
-                        if (yych <= '\t') { gotoCase = 45; continue; };
-                        { gotoCase = 110; continue; };
-                    } else {
-                        if (yych == '\r') { gotoCase = 110; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                } else {
-                    if (yych <= '\'') {
-                        if (yych <= '"') { gotoCase = 106; continue; };
-                        if (yych <= '&') { gotoCase = 45; continue; };
-                        { gotoCase = 106; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 106; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'q') {
-                    if (yych <= 'f') {
-                        if (yych <= 'b') { gotoCase = 106; continue; };
-                        if (yych <= 'e') { gotoCase = 45; continue; };
-                        { gotoCase = 106; continue; };
-                    } else {
-                        if (yych == 'n') { gotoCase = 106; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych == 's') { gotoCase = 45; continue; };
-                        { gotoCase = 106; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 109; continue; };
-                        if (yych <= 'v') { gotoCase = 106; continue; };
-                        { gotoCase = 45; continue; };
-                    }
-                }
-            }
-case 109:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 112; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 112; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych <= 'f') { gotoCase = 112; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 110:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.DSTRING);
-            { this.tokenType = "javascript-string"; return cursor; }
-case 112:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 113; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 113:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych >= ':') { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 114; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych >= 'g') { gotoCase = 45; continue; };
-            }
-case 114:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 45; continue; };
-                if (yych <= '9') { gotoCase = 106; continue; };
-                { gotoCase = 45; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 106; continue; };
-                if (yych <= '`') { gotoCase = 45; continue; };
-                if (yych <= 'f') { gotoCase = 106; continue; };
-                { gotoCase = 45; continue; };
-            }
-case 115:
-            ++cursor;
-            if ((yych = this._charAt(cursor)) == '=') { gotoCase = 43; continue; };
-            { gotoCase = 18; continue; };
-/* *********************************** */
-case this.case_DSTRING:
-            yych = this._charAt(cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 120; continue; };
-                if (yych <= '\f') { gotoCase = 119; continue; };
-                { gotoCase = 120; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 119; continue; };
-                    { gotoCase = 122; continue; };
-                } else {
-                    if (yych == '\\') { gotoCase = 124; continue; };
-                    { gotoCase = 119; continue; };
-                }
-            }
-case 118:
-            { this.tokenType = "javascript-string"; return cursor; }
-case 119:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 126; continue; };
-case 120:
-            ++cursor;
-case 121:
-            { this.tokenType = null; return cursor; }
-case 122:
-            ++cursor;
-case 123:
-            this.setLexCondition(this._lexConditions.NODIV);
-            { this.tokenType = "javascript-string"; return cursor; }
-case 124:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 125; continue; };
-                    if (yych <= '&') { gotoCase = 121; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych <= '[') { gotoCase = 121; continue; };
-                    } else {
-                        if (yych != 'b') { gotoCase = 121; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych >= 'g') { gotoCase = 121; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 125; continue; };
-                        if (yych <= 'q') { gotoCase = 121; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych <= 's') { gotoCase = 121; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 127; continue; };
-                        if (yych >= 'w') { gotoCase = 121; continue; };
-                    }
-                }
-            }
-case 125:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 126:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 118; continue; };
-                if (yych <= '\f') { gotoCase = 125; continue; };
-                { gotoCase = 118; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 125; continue; };
-                    { gotoCase = 133; continue; };
-                } else {
-                    if (yych == '\\') { gotoCase = 132; continue; };
-                    { gotoCase = 125; continue; };
-                }
-            }
-case 127:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 128; continue; };
-                if (yych <= '9') { gotoCase = 129; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 129; continue; };
-                if (yych <= '`') { gotoCase = 128; continue; };
-                if (yych <= 'f') { gotoCase = 129; continue; };
-            }
-case 128:
-            cursor = YYMARKER;
-            if (yyaccept <= 0) {
-                { gotoCase = 118; continue; };
-            } else {
-                { gotoCase = 121; continue; };
-            }
-case 129:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 128; continue; };
-                if (yych >= ':') { gotoCase = 128; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 130; continue; };
-                if (yych <= '`') { gotoCase = 128; continue; };
-                if (yych >= 'g') { gotoCase = 128; continue; };
-            }
-case 130:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 128; continue; };
-                if (yych >= ':') { gotoCase = 128; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 131; continue; };
-                if (yych <= '`') { gotoCase = 128; continue; };
-                if (yych >= 'g') { gotoCase = 128; continue; };
-            }
-case 131:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 128; continue; };
-                if (yych <= '9') { gotoCase = 125; continue; };
-                { gotoCase = 128; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 125; continue; };
-                if (yych <= '`') { gotoCase = 128; continue; };
-                if (yych <= 'f') { gotoCase = 125; continue; };
-                { gotoCase = 128; continue; };
-            }
-case 132:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 125; continue; };
-                    if (yych <= '&') { gotoCase = 128; continue; };
-                    { gotoCase = 125; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych <= '[') { gotoCase = 128; continue; };
-                        { gotoCase = 125; continue; };
-                    } else {
-                        if (yych == 'b') { gotoCase = 125; continue; };
-                        { gotoCase = 128; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych <= 'f') { gotoCase = 125; continue; };
-                        { gotoCase = 128; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 125; continue; };
-                        if (yych <= 'q') { gotoCase = 128; continue; };
-                        { gotoCase = 125; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych <= 's') { gotoCase = 128; continue; };
-                        { gotoCase = 125; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 127; continue; };
-                        if (yych <= 'v') { gotoCase = 125; continue; };
-                        { gotoCase = 128; continue; };
-                    }
-                }
-            }
-case 133:
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 123; continue; };
-/* *********************************** */
-case this.case_NODIV:
-            yych = this._charAt(cursor);
-            if (yych <= '9') {
-                if (yych <= '(') {
-                    if (yych <= '#') {
-                        if (yych <= ' ') { gotoCase = 136; continue; };
-                        if (yych <= '!') { gotoCase = 138; continue; };
-                        if (yych <= '"') { gotoCase = 140; continue; };
-                    } else {
-                        if (yych <= '%') {
-                            if (yych <= '$') { gotoCase = 141; continue; };
-                            { gotoCase = 143; continue; };
-                        } else {
-                            if (yych <= '&') { gotoCase = 144; continue; };
-                            if (yych <= '\'') { gotoCase = 145; continue; };
-                            { gotoCase = 146; continue; };
-                        }
-                    }
-                } else {
-                    if (yych <= ',') {
-                        if (yych <= ')') { gotoCase = 147; continue; };
-                        if (yych <= '*') { gotoCase = 149; continue; };
-                        if (yych <= '+') { gotoCase = 150; continue; };
-                        { gotoCase = 146; continue; };
-                    } else {
-                        if (yych <= '.') {
-                            if (yych <= '-') { gotoCase = 151; continue; };
-                            { gotoCase = 152; continue; };
-                        } else {
-                            if (yych <= '/') { gotoCase = 153; continue; };
-                            if (yych <= '0') { gotoCase = 154; continue; };
-                            { gotoCase = 156; continue; };
-                        }
-                    }
-                }
-            } else {
-                if (yych <= '\\') {
-                    if (yych <= '>') {
-                        if (yych <= ';') { gotoCase = 146; continue; };
-                        if (yych <= '<') { gotoCase = 157; continue; };
-                        if (yych <= '=') { gotoCase = 158; continue; };
-                        { gotoCase = 159; continue; };
-                    } else {
-                        if (yych <= '@') {
-                            if (yych <= '?') { gotoCase = 146; continue; };
-                        } else {
-                            if (yych <= 'Z') { gotoCase = 141; continue; };
-                            if (yych <= '[') { gotoCase = 146; continue; };
-                            { gotoCase = 160; continue; };
-                        }
-                    }
-                } else {
-                    if (yych <= 'z') {
-                        if (yych <= '^') {
-                            if (yych <= ']') { gotoCase = 146; continue; };
-                            { gotoCase = 161; continue; };
-                        } else {
-                            if (yych != '`') { gotoCase = 141; continue; };
-                        }
-                    } else {
-                        if (yych <= '|') {
-                            if (yych <= '{') { gotoCase = 146; continue; };
-                            { gotoCase = 162; continue; };
-                        } else {
-                            if (yych <= '~') { gotoCase = 146; continue; };
-                            if (yych >= 0x80) { gotoCase = 141; continue; };
-                        }
-                    }
-                }
-            }
-case 136:
-            ++cursor;
-case 137:
-            { this.tokenType = null; return cursor; }
-case 138:
-            ++cursor;
-            if ((yych = this._charAt(cursor)) == '=') { gotoCase = 260; continue; };
-case 139:
-            { this.tokenType = null; return cursor; }
-case 140:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '\n') { gotoCase = 137; continue; };
-            if (yych == '\r') { gotoCase = 137; continue; };
-            { gotoCase = 252; continue; };
-case 141:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 170; continue; };
-case 142:
-            this.setLexCondition(this._lexConditions.DIV);
-            {
-                    var token = this._line.substring(cursorOnEnter, cursor);
-                    if (token in this._keywords)
-                        this.tokenType = "javascript-keyword";
-                    else
-                        this.tokenType = "javascript-ident";
-                    return cursor;
-                }
-case 143:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 144:
-            yych = this._charAt(++cursor);
-            if (yych == '&') { gotoCase = 163; continue; };
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 145:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == '\n') { gotoCase = 137; continue; };
-            if (yych == '\r') { gotoCase = 137; continue; };
-            { gotoCase = 241; continue; };
-case 146:
-            yych = this._charAt(++cursor);
-            { gotoCase = 139; continue; };
-case 147:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.DIV);
-            { this.tokenType = null; return cursor; }
-case 149:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 150:
-            yych = this._charAt(++cursor);
-            if (yych == '+') { gotoCase = 163; continue; };
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 151:
-            yych = this._charAt(++cursor);
-            if (yych == '-') { gotoCase = 163; continue; };
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 152:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 139; continue; };
-            if (yych <= '9') { gotoCase = 234; continue; };
-            { gotoCase = 139; continue; };
-case 153:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 137; continue; };
-                    { gotoCase = 197; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 137; continue; };
-                    if (yych <= ')') { gotoCase = 197; continue; };
-                    { gotoCase = 202; continue; };
-                }
-            } else {
-                if (yych <= 'Z') {
-                    if (yych == '/') { gotoCase = 204; continue; };
-                    { gotoCase = 197; continue; };
-                } else {
-                    if (yych <= '[') { gotoCase = 200; continue; };
-                    if (yych <= '\\') { gotoCase = 199; continue; };
-                    if (yych <= ']') { gotoCase = 137; continue; };
-                    { gotoCase = 197; continue; };
-                }
-            }
-case 154:
-            yyaccept = 2;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= 'E') {
-                if (yych <= '/') {
-                    if (yych == '.') { gotoCase = 183; continue; };
-                } else {
-                    if (yych <= '7') { gotoCase = 192; continue; };
-                    if (yych >= 'E') { gotoCase = 182; continue; };
-                }
-            } else {
-                if (yych <= 'd') {
-                    if (yych == 'X') { gotoCase = 194; continue; };
-                } else {
-                    if (yych <= 'e') { gotoCase = 182; continue; };
-                    if (yych == 'x') { gotoCase = 194; continue; };
-                }
-            }
-case 155:
-            this.setLexCondition(this._lexConditions.DIV);
-            { this.tokenType = "javascript-number"; return cursor; }
-case 156:
-            yyaccept = 2;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '9') {
-                if (yych == '.') { gotoCase = 183; continue; };
-                if (yych <= '/') { gotoCase = 155; continue; };
-                { gotoCase = 180; continue; };
-            } else {
-                if (yych <= 'E') {
-                    if (yych <= 'D') { gotoCase = 155; continue; };
-                    { gotoCase = 182; continue; };
-                } else {
-                    if (yych == 'e') { gotoCase = 182; continue; };
-                    { gotoCase = 155; continue; };
-                }
-            }
-case 157:
-            yych = this._charAt(++cursor);
-            if (yych <= ';') { gotoCase = 139; continue; };
-            if (yych <= '<') { gotoCase = 179; continue; };
-            if (yych <= '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 158:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 178; continue; };
-            { gotoCase = 139; continue; };
-case 159:
-            yych = this._charAt(++cursor);
-            if (yych <= '<') { gotoCase = 139; continue; };
-            if (yych <= '=') { gotoCase = 163; continue; };
-            if (yych <= '>') { gotoCase = 176; continue; };
-            { gotoCase = 139; continue; };
-case 160:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych == 'u') { gotoCase = 164; continue; };
-            { gotoCase = 137; continue; };
-case 161:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 162:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            if (yych != '|') { gotoCase = 139; continue; };
-case 163:
-            yych = this._charAt(++cursor);
-            { gotoCase = 139; continue; };
-case 164:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 166; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 166; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych <= 'f') { gotoCase = 166; continue; };
-            }
-case 165:
-            cursor = YYMARKER;
-            if (yyaccept <= 1) {
-                if (yyaccept <= 0) {
-                    { gotoCase = 137; continue; };
-                } else {
-                    { gotoCase = 142; continue; };
-                }
-            } else {
-                if (yyaccept <= 2) {
-                    { gotoCase = 155; continue; };
-                } else {
-                    { gotoCase = 217; continue; };
-                }
-            }
-case 166:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 167; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 167:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 168; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 168:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 169; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 169:
-            yyaccept = 1;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 170:
-            if (yych <= '[') {
-                if (yych <= '/') {
-                    if (yych == '$') { gotoCase = 169; continue; };
-                    { gotoCase = 142; continue; };
-                } else {
-                    if (yych <= '9') { gotoCase = 169; continue; };
-                    if (yych <= '@') { gotoCase = 142; continue; };
-                    if (yych <= 'Z') { gotoCase = 169; continue; };
-                    { gotoCase = 142; continue; };
-                }
-            } else {
-                if (yych <= '_') {
-                    if (yych <= '\\') { gotoCase = 171; continue; };
-                    if (yych <= '^') { gotoCase = 142; continue; };
-                    { gotoCase = 169; continue; };
-                } else {
-                    if (yych <= '`') { gotoCase = 142; continue; };
-                    if (yych <= 'z') { gotoCase = 169; continue; };
-                    if (yych <= 0x7F) { gotoCase = 142; continue; };
-                    { gotoCase = 169; continue; };
-                }
-            }
-case 171:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych != 'u') { gotoCase = 165; continue; };
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 173; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 173:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 174; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 174:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 175; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 175:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 169; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 169; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych <= 'f') { gotoCase = 169; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 176:
-            yych = this._charAt(++cursor);
-            if (yych <= '<') { gotoCase = 139; continue; };
-            if (yych <= '=') { gotoCase = 163; continue; };
-            if (yych >= '?') { gotoCase = 139; continue; };
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 178:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 179:
-            yych = this._charAt(++cursor);
-            if (yych == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-case 180:
-            yyaccept = 2;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '9') {
-                if (yych == '.') { gotoCase = 183; continue; };
-                if (yych <= '/') { gotoCase = 155; continue; };
-                { gotoCase = 180; continue; };
-            } else {
-                if (yych <= 'E') {
-                    if (yych <= 'D') { gotoCase = 155; continue; };
-                } else {
-                    if (yych != 'e') { gotoCase = 155; continue; };
-                }
-            }
-case 182:
-            yych = this._charAt(++cursor);
-            if (yych <= ',') {
-                if (yych == '+') { gotoCase = 189; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= '-') { gotoCase = 189; continue; };
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 190; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 183:
-            yyaccept = 2;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'D') {
-                if (yych <= '/') { gotoCase = 155; continue; };
-                if (yych <= '9') { gotoCase = 183; continue; };
-                { gotoCase = 155; continue; };
-            } else {
-                if (yych <= 'E') { gotoCase = 185; continue; };
-                if (yych != 'e') { gotoCase = 155; continue; };
-            }
-case 185:
-            yych = this._charAt(++cursor);
-            if (yych <= ',') {
-                if (yych != '+') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= '-') { gotoCase = 186; continue; };
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 187; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 186:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 165; continue; };
-            if (yych >= ':') { gotoCase = 165; continue; };
-case 187:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 155; continue; };
-            if (yych <= '9') { gotoCase = 187; continue; };
-            { gotoCase = 155; continue; };
-case 189:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 165; continue; };
-            if (yych >= ':') { gotoCase = 165; continue; };
-case 190:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 155; continue; };
-            if (yych <= '9') { gotoCase = 190; continue; };
-            { gotoCase = 155; continue; };
-case 192:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 155; continue; };
-            if (yych <= '7') { gotoCase = 192; continue; };
-            { gotoCase = 155; continue; };
-case 194:
-            yych = this._charAt(++cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 195; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 195:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 155; continue; };
-                if (yych <= '9') { gotoCase = 195; continue; };
-                { gotoCase = 155; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 195; continue; };
-                if (yych <= '`') { gotoCase = 155; continue; };
-                if (yych <= 'f') { gotoCase = 195; continue; };
-                { gotoCase = 155; continue; };
-            }
-case 197:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '.') {
-                if (yych <= '\n') {
-                    if (yych <= '\t') { gotoCase = 197; continue; };
-                    { gotoCase = 165; continue; };
-                } else {
-                    if (yych == '\r') { gotoCase = 165; continue; };
-                    { gotoCase = 197; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '/') { gotoCase = 220; continue; };
-                    if (yych <= 'Z') { gotoCase = 197; continue; };
-                    { gotoCase = 228; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 227; continue; };
-                    if (yych <= ']') { gotoCase = 165; continue; };
-                    { gotoCase = 197; continue; };
-                }
-            }
-case 199:
-            yych = this._charAt(++cursor);
-            if (yych == '\n') { gotoCase = 165; continue; };
-            if (yych == '\r') { gotoCase = 165; continue; };
-            { gotoCase = 197; continue; };
-case 200:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 165; continue; };
-                    { gotoCase = 200; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 165; continue; };
-                    if (yych <= ')') { gotoCase = 200; continue; };
-                    { gotoCase = 165; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych == '/') { gotoCase = 165; continue; };
-                    { gotoCase = 200; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 215; continue; };
-                    if (yych <= ']') { gotoCase = 213; continue; };
-                    { gotoCase = 200; continue; };
-                }
-            }
-case 202:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '\f') {
-                if (yych == '\n') { gotoCase = 209; continue; };
-                { gotoCase = 202; continue; };
-            } else {
-                if (yych <= '\r') { gotoCase = 209; continue; };
-                if (yych == '*') { gotoCase = 207; continue; };
-                { gotoCase = 202; continue; };
-            }
-case 204:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 206; continue; };
-            if (yych != '\r') { gotoCase = 204; continue; };
-case 206:
-            { this.tokenType = "javascript-comment"; return cursor; }
-case 207:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '*') { gotoCase = 207; continue; };
-            if (yych == '/') { gotoCase = 211; continue; };
-            { gotoCase = 202; continue; };
-case 209:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.COMMENT);
-            { this.tokenType = "javascript-comment"; return cursor; }
-case 211:
-            ++cursor;
-            { this.tokenType = "javascript-comment"; return cursor; }
-case 213:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 165; continue; };
-                    { gotoCase = 213; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 165; continue; };
-                    if (yych <= ')') { gotoCase = 213; continue; };
-                    { gotoCase = 197; continue; };
-                }
-            } else {
-                if (yych <= 'Z') {
-                    if (yych == '/') { gotoCase = 220; continue; };
-                    { gotoCase = 213; continue; };
-                } else {
-                    if (yych <= '[') { gotoCase = 218; continue; };
-                    if (yych <= '\\') { gotoCase = 216; continue; };
-                    { gotoCase = 213; continue; };
-                }
-            }
-case 215:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 165; continue; };
-            if (yych == '\r') { gotoCase = 165; continue; };
-            { gotoCase = 200; continue; };
-case 216:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 217; continue; };
-            if (yych != '\r') { gotoCase = 213; continue; };
-case 217:
-            this.setLexCondition(this._lexConditions.REGEX);
-            { this.tokenType = "javascript-regexp"; return cursor; }
-case 218:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 165; continue; };
-                    { gotoCase = 218; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 165; continue; };
-                    if (yych <= ')') { gotoCase = 218; continue; };
-                    { gotoCase = 165; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych == '/') { gotoCase = 165; continue; };
-                    { gotoCase = 218; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 225; continue; };
-                    if (yych <= ']') { gotoCase = 223; continue; };
-                    { gotoCase = 218; continue; };
-                }
-            }
-case 220:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'h') {
-                if (yych == 'g') { gotoCase = 220; continue; };
-            } else {
-                if (yych <= 'i') { gotoCase = 220; continue; };
-                if (yych == 'm') { gotoCase = 220; continue; };
-            }
-            { this.tokenType = "javascript-regexp"; return cursor; }
-case 223:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 165; continue; };
-                    { gotoCase = 223; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 165; continue; };
-                    if (yych <= ')') { gotoCase = 223; continue; };
-                    { gotoCase = 197; continue; };
-                }
-            } else {
-                if (yych <= 'Z') {
-                    if (yych == '/') { gotoCase = 220; continue; };
-                    { gotoCase = 223; continue; };
-                } else {
-                    if (yych <= '[') { gotoCase = 218; continue; };
-                    if (yych <= '\\') { gotoCase = 226; continue; };
-                    { gotoCase = 223; continue; };
-                }
-            }
-case 225:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 165; continue; };
-            if (yych == '\r') { gotoCase = 165; continue; };
-            { gotoCase = 218; continue; };
-case 226:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 217; continue; };
-            if (yych == '\r') { gotoCase = 217; continue; };
-            { gotoCase = 223; continue; };
-case 227:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 217; continue; };
-            if (yych == '\r') { gotoCase = 217; continue; };
-            { gotoCase = 197; continue; };
-case 228:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 165; continue; };
-                    { gotoCase = 228; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 165; continue; };
-                    if (yych <= ')') { gotoCase = 228; continue; };
-                    { gotoCase = 165; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych == '/') { gotoCase = 165; continue; };
-                    { gotoCase = 228; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 232; continue; };
-                    if (yych >= '^') { gotoCase = 228; continue; };
-                }
-            }
-case 230:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 165; continue; };
-                    { gotoCase = 230; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 165; continue; };
-                    if (yych <= ')') { gotoCase = 230; continue; };
-                    { gotoCase = 197; continue; };
-                }
-            } else {
-                if (yych <= 'Z') {
-                    if (yych == '/') { gotoCase = 220; continue; };
-                    { gotoCase = 230; continue; };
-                } else {
-                    if (yych <= '[') { gotoCase = 228; continue; };
-                    if (yych <= '\\') { gotoCase = 233; continue; };
-                    { gotoCase = 230; continue; };
-                }
-            }
-case 232:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 165; continue; };
-            if (yych == '\r') { gotoCase = 165; continue; };
-            { gotoCase = 228; continue; };
-case 233:
-            yyaccept = 3;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 217; continue; };
-            if (yych == '\r') { gotoCase = 217; continue; };
-            { gotoCase = 230; continue; };
-case 234:
-            yyaccept = 2;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'D') {
-                if (yych <= '/') { gotoCase = 155; continue; };
-                if (yych <= '9') { gotoCase = 234; continue; };
-                { gotoCase = 155; continue; };
-            } else {
-                if (yych <= 'E') { gotoCase = 236; continue; };
-                if (yych != 'e') { gotoCase = 155; continue; };
-            }
-case 236:
-            yych = this._charAt(++cursor);
-            if (yych <= ',') {
-                if (yych != '+') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= '-') { gotoCase = 237; continue; };
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 238; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 237:
-            yych = this._charAt(++cursor);
-            if (yych <= '/') { gotoCase = 165; continue; };
-            if (yych >= ':') { gotoCase = 165; continue; };
-case 238:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '/') { gotoCase = 155; continue; };
-            if (yych <= '9') { gotoCase = 238; continue; };
-            { gotoCase = 155; continue; };
-case 240:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 241:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 165; continue; };
-                if (yych <= '\f') { gotoCase = 240; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 240; continue; };
-                    { gotoCase = 243; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 240; continue; };
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'a') {
-                if (yych <= '!') {
-                    if (yych <= '\n') {
-                        if (yych <= '\t') { gotoCase = 165; continue; };
-                        { gotoCase = 246; continue; };
-                    } else {
-                        if (yych == '\r') { gotoCase = 246; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                } else {
-                    if (yych <= '\'') {
-                        if (yych <= '"') { gotoCase = 240; continue; };
-                        if (yych <= '&') { gotoCase = 165; continue; };
-                        { gotoCase = 240; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 240; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'q') {
-                    if (yych <= 'f') {
-                        if (yych <= 'b') { gotoCase = 240; continue; };
-                        if (yych <= 'e') { gotoCase = 165; continue; };
-                        { gotoCase = 240; continue; };
-                    } else {
-                        if (yych == 'n') { gotoCase = 240; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych == 's') { gotoCase = 165; continue; };
-                        { gotoCase = 240; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 245; continue; };
-                        if (yych <= 'v') { gotoCase = 240; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                }
-            }
-case 243:
-            ++cursor;
-            { this.tokenType = "javascript-string"; return cursor; }
-case 245:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 248; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 248; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych <= 'f') { gotoCase = 248; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 246:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.SSTRING);
-            { this.tokenType = "javascript-string"; return cursor; }
-case 248:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 249; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 249:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 250; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 250:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 240; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 240; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych <= 'f') { gotoCase = 240; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 251:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 252:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 165; continue; };
-                if (yych <= '\f') { gotoCase = 251; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= '"') {
-                    if (yych <= '!') { gotoCase = 251; continue; };
-                    { gotoCase = 243; continue; };
-                } else {
-                    if (yych != '\\') { gotoCase = 251; continue; };
-                }
-            }
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'a') {
-                if (yych <= '!') {
-                    if (yych <= '\n') {
-                        if (yych <= '\t') { gotoCase = 165; continue; };
-                        { gotoCase = 255; continue; };
-                    } else {
-                        if (yych == '\r') { gotoCase = 255; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                } else {
-                    if (yych <= '\'') {
-                        if (yych <= '"') { gotoCase = 251; continue; };
-                        if (yych <= '&') { gotoCase = 165; continue; };
-                        { gotoCase = 251; continue; };
-                    } else {
-                        if (yych == '\\') { gotoCase = 251; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'q') {
-                    if (yych <= 'f') {
-                        if (yych <= 'b') { gotoCase = 251; continue; };
-                        if (yych <= 'e') { gotoCase = 165; continue; };
-                        { gotoCase = 251; continue; };
-                    } else {
-                        if (yych == 'n') { gotoCase = 251; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych == 's') { gotoCase = 165; continue; };
-                        { gotoCase = 251; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 254; continue; };
-                        if (yych <= 'v') { gotoCase = 251; continue; };
-                        { gotoCase = 165; continue; };
-                    }
-                }
-            }
-case 254:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 257; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 257; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych <= 'f') { gotoCase = 257; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 255:
-            ++cursor;
-            this.setLexCondition(this._lexConditions.DSTRING);
-            { this.tokenType = "javascript-string"; return cursor; }
-case 257:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 258; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 258:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych >= ':') { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 259; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych >= 'g') { gotoCase = 165; continue; };
-            }
-case 259:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 165; continue; };
-                if (yych <= '9') { gotoCase = 251; continue; };
-                { gotoCase = 165; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 251; continue; };
-                if (yych <= '`') { gotoCase = 165; continue; };
-                if (yych <= 'f') { gotoCase = 251; continue; };
-                { gotoCase = 165; continue; };
-            }
-case 260:
-            ++cursor;
-            if ((yych = this._charAt(cursor)) == '=') { gotoCase = 163; continue; };
-            { gotoCase = 139; continue; };
-/* *********************************** */
-case this.case_REGEX:
-            yych = this._charAt(cursor);
-            if (yych <= '.') {
-                if (yych <= '\n') {
-                    if (yych <= '\t') { gotoCase = 264; continue; };
-                    { gotoCase = 265; continue; };
-                } else {
-                    if (yych == '\r') { gotoCase = 265; continue; };
-                    { gotoCase = 264; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '/') { gotoCase = 267; continue; };
-                    if (yych <= 'Z') { gotoCase = 264; continue; };
-                    { gotoCase = 269; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 270; continue; };
-                    if (yych <= ']') { gotoCase = 265; continue; };
-                    { gotoCase = 264; continue; };
-                }
-            }
-case 263:
-            { this.tokenType = "javascript-regexp"; return cursor; }
-case 264:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 272; continue; };
-case 265:
-            ++cursor;
-case 266:
-            { this.tokenType = null; return cursor; }
-case 267:
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 278; continue; };
-case 268:
-            this.setLexCondition(this._lexConditions.NODIV);
-            { this.tokenType = "javascript-regexp"; return cursor; }
-case 269:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 266; continue; };
-                if (yych <= '\f') { gotoCase = 276; continue; };
-                { gotoCase = 266; continue; };
-            } else {
-                if (yych <= '*') {
-                    if (yych <= ')') { gotoCase = 276; continue; };
-                    { gotoCase = 266; continue; };
-                } else {
-                    if (yych == '/') { gotoCase = 266; continue; };
-                    { gotoCase = 276; continue; };
-                }
-            }
-case 270:
-            yych = this._charAt(++cursor);
-            if (yych == '\n') { gotoCase = 266; continue; };
-            if (yych == '\r') { gotoCase = 266; continue; };
-case 271:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 272:
-            if (yych <= '.') {
-                if (yych <= '\n') {
-                    if (yych <= '\t') { gotoCase = 271; continue; };
-                    { gotoCase = 263; continue; };
-                } else {
-                    if (yych == '\r') { gotoCase = 263; continue; };
-                    { gotoCase = 271; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych <= '/') { gotoCase = 277; continue; };
-                    if (yych <= 'Z') { gotoCase = 271; continue; };
-                    { gotoCase = 275; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 273; continue; };
-                    if (yych <= ']') { gotoCase = 263; continue; };
-                    { gotoCase = 271; continue; };
-                }
-            }
-case 273:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 274; continue; };
-            if (yych != '\r') { gotoCase = 271; continue; };
-case 274:
-            cursor = YYMARKER;
-            if (yyaccept <= 0) {
-                { gotoCase = 263; continue; };
-            } else {
-                { gotoCase = 266; continue; };
-            }
-case 275:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 276:
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 274; continue; };
-                    { gotoCase = 275; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 274; continue; };
-                    if (yych <= ')') { gotoCase = 275; continue; };
-                    { gotoCase = 274; continue; };
-                }
-            } else {
-                if (yych <= '[') {
-                    if (yych == '/') { gotoCase = 274; continue; };
-                    { gotoCase = 275; continue; };
-                } else {
-                    if (yych <= '\\') { gotoCase = 281; continue; };
-                    if (yych <= ']') { gotoCase = 279; continue; };
-                    { gotoCase = 275; continue; };
-                }
-            }
-case 277:
-            ++cursor;
-            yych = this._charAt(cursor);
-case 278:
-            if (yych <= 'h') {
-                if (yych == 'g') { gotoCase = 277; continue; };
-                { gotoCase = 268; continue; };
-            } else {
-                if (yych <= 'i') { gotoCase = 277; continue; };
-                if (yych == 'm') { gotoCase = 277; continue; };
-                { gotoCase = 268; continue; };
-            }
-case 279:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '*') {
-                if (yych <= '\f') {
-                    if (yych == '\n') { gotoCase = 263; continue; };
-                    { gotoCase = 279; continue; };
-                } else {
-                    if (yych <= '\r') { gotoCase = 263; continue; };
-                    if (yych <= ')') { gotoCase = 279; continue; };
-                    { gotoCase = 271; continue; };
-                }
-            } else {
-                if (yych <= 'Z') {
-                    if (yych == '/') { gotoCase = 277; continue; };
-                    { gotoCase = 279; continue; };
-                } else {
-                    if (yych <= '[') { gotoCase = 275; continue; };
-                    if (yych <= '\\') { gotoCase = 282; continue; };
-                    { gotoCase = 279; continue; };
-                }
-            }
-case 281:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 274; continue; };
-            if (yych == '\r') { gotoCase = 274; continue; };
-            { gotoCase = 275; continue; };
-case 282:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych == '\n') { gotoCase = 274; continue; };
-            if (yych == '\r') { gotoCase = 274; continue; };
-            { gotoCase = 279; continue; };
-/* *********************************** */
-case this.case_SSTRING:
-            yych = this._charAt(cursor);
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 287; continue; };
-                if (yych <= '\f') { gotoCase = 286; continue; };
-                { gotoCase = 287; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 286; continue; };
-                    { gotoCase = 289; continue; };
-                } else {
-                    if (yych == '\\') { gotoCase = 291; continue; };
-                    { gotoCase = 286; continue; };
-                }
-            }
-case 285:
-            { this.tokenType = "javascript-string"; return cursor; }
-case 286:
-            yyaccept = 0;
-            yych = this._charAt(YYMARKER = ++cursor);
-            { gotoCase = 293; continue; };
-case 287:
-            ++cursor;
-case 288:
-            { this.tokenType = null; return cursor; }
-case 289:
-            ++cursor;
-case 290:
-            this.setLexCondition(this._lexConditions.NODIV);
-            { this.tokenType = "javascript-string"; return cursor; }
-case 291:
-            yyaccept = 1;
-            yych = this._charAt(YYMARKER = ++cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 292; continue; };
-                    if (yych <= '&') { gotoCase = 288; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych <= '[') { gotoCase = 288; continue; };
-                    } else {
-                        if (yych != 'b') { gotoCase = 288; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych >= 'g') { gotoCase = 288; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 292; continue; };
-                        if (yych <= 'q') { gotoCase = 288; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych <= 's') { gotoCase = 288; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 294; continue; };
-                        if (yych >= 'w') { gotoCase = 288; continue; };
-                    }
-                }
-            }
-case 292:
-            yyaccept = 0;
-            YYMARKER = ++cursor;
-            yych = this._charAt(cursor);
-case 293:
-            if (yych <= '\r') {
-                if (yych == '\n') { gotoCase = 285; continue; };
-                if (yych <= '\f') { gotoCase = 292; continue; };
-                { gotoCase = 285; continue; };
-            } else {
-                if (yych <= '\'') {
-                    if (yych <= '&') { gotoCase = 292; continue; };
-                    { gotoCase = 300; continue; };
-                } else {
-                    if (yych == '\\') { gotoCase = 299; continue; };
-                    { gotoCase = 292; continue; };
-                }
-            }
-case 294:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 295; continue; };
-                if (yych <= '9') { gotoCase = 296; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 296; continue; };
-                if (yych <= '`') { gotoCase = 295; continue; };
-                if (yych <= 'f') { gotoCase = 296; continue; };
-            }
-case 295:
-            cursor = YYMARKER;
-            if (yyaccept <= 0) {
-                { gotoCase = 285; continue; };
-            } else {
-                { gotoCase = 288; continue; };
-            }
-case 296:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 295; continue; };
-                if (yych >= ':') { gotoCase = 295; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 297; continue; };
-                if (yych <= '`') { gotoCase = 295; continue; };
-                if (yych >= 'g') { gotoCase = 295; continue; };
-            }
-case 297:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 295; continue; };
-                if (yych >= ':') { gotoCase = 295; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 298; continue; };
-                if (yych <= '`') { gotoCase = 295; continue; };
-                if (yych >= 'g') { gotoCase = 295; continue; };
-            }
-case 298:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= '@') {
-                if (yych <= '/') { gotoCase = 295; continue; };
-                if (yych <= '9') { gotoCase = 292; continue; };
-                { gotoCase = 295; continue; };
-            } else {
-                if (yych <= 'F') { gotoCase = 292; continue; };
-                if (yych <= '`') { gotoCase = 295; continue; };
-                if (yych <= 'f') { gotoCase = 292; continue; };
-                { gotoCase = 295; continue; };
-            }
-case 299:
-            ++cursor;
-            yych = this._charAt(cursor);
-            if (yych <= 'e') {
-                if (yych <= '\'') {
-                    if (yych == '"') { gotoCase = 292; continue; };
-                    if (yych <= '&') { gotoCase = 295; continue; };
-                    { gotoCase = 292; continue; };
-                } else {
-                    if (yych <= '\\') {
-                        if (yych <= '[') { gotoCase = 295; continue; };
-                        { gotoCase = 292; continue; };
-                    } else {
-                        if (yych == 'b') { gotoCase = 292; continue; };
-                        { gotoCase = 295; continue; };
-                    }
-                }
-            } else {
-                if (yych <= 'r') {
-                    if (yych <= 'm') {
-                        if (yych <= 'f') { gotoCase = 292; continue; };
-                        { gotoCase = 295; continue; };
-                    } else {
-                        if (yych <= 'n') { gotoCase = 292; continue; };
-                        if (yych <= 'q') { gotoCase = 295; continue; };
-                        { gotoCase = 292; continue; };
-                    }
-                } else {
-                    if (yych <= 't') {
-                        if (yych <= 's') { gotoCase = 295; continue; };
-                        { gotoCase = 292; continue; };
-                    } else {
-                        if (yych <= 'u') { gotoCase = 294; continue; };
-                        if (yych <= 'v') { gotoCase = 292; continue; };
-                        { gotoCase = 295; continue; };
-                    }
-                }
-            }
-case 300:
-            ++cursor;
-            yych = this._charAt(cursor);
-            { gotoCase = 290; continue; };
-        }
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 2; continue; };
+{ gotoCase = 11; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 2; continue; };
+if (yych == '*') { gotoCase = 9; continue; };
+{ gotoCase = 11; continue; };
+}
 
-        }
-    }
+case this.case_DIV:
+yych = this._charAt(cursor);
+if (yych <= '9') {
+if (yych <= '(') {
+if (yych <= '#') {
+if (yych <= ' ') { gotoCase = 15; continue; };
+if (yych <= '!') { gotoCase = 17; continue; };
+if (yych <= '"') { gotoCase = 19; continue; };
+} else {
+if (yych <= '%') {
+if (yych <= '$') { gotoCase = 20; continue; };
+{ gotoCase = 22; continue; };
+} else {
+if (yych <= '&') { gotoCase = 23; continue; };
+if (yych <= '\'') { gotoCase = 24; continue; };
+{ gotoCase = 25; continue; };
+}
+}
+} else {
+if (yych <= ',') {
+if (yych <= ')') { gotoCase = 26; continue; };
+if (yych <= '*') { gotoCase = 28; continue; };
+if (yych <= '+') { gotoCase = 29; continue; };
+{ gotoCase = 25; continue; };
+} else {
+if (yych <= '.') {
+if (yych <= '-') { gotoCase = 30; continue; };
+{ gotoCase = 31; continue; };
+} else {
+if (yych <= '/') { gotoCase = 32; continue; };
+if (yych <= '0') { gotoCase = 34; continue; };
+{ gotoCase = 36; continue; };
+}
+}
+}
+} else {
+if (yych <= '\\') {
+if (yych <= '>') {
+if (yych <= ';') { gotoCase = 25; continue; };
+if (yych <= '<') { gotoCase = 37; continue; };
+if (yych <= '=') { gotoCase = 38; continue; };
+{ gotoCase = 39; continue; };
+} else {
+if (yych <= '@') {
+if (yych <= '?') { gotoCase = 25; continue; };
+} else {
+if (yych <= 'Z') { gotoCase = 20; continue; };
+if (yych <= '[') { gotoCase = 25; continue; };
+{ gotoCase = 40; continue; };
+}
+}
+} else {
+if (yych <= 'z') {
+if (yych <= '^') {
+if (yych <= ']') { gotoCase = 25; continue; };
+{ gotoCase = 41; continue; };
+} else {
+if (yych != '`') { gotoCase = 20; continue; };
+}
+} else {
+if (yych <= '|') {
+if (yych <= '{') { gotoCase = 25; continue; };
+{ gotoCase = 42; continue; };
+} else {
+if (yych <= '~') { gotoCase = 25; continue; };
+if (yych >= 0x80) { gotoCase = 20; continue; };
+}
+}
+}
+}
+case 15:
+++cursor;
+case 16:
+{ this.tokenType = null; return cursor; }
+case 17:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 115; continue; };
+case 18:
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = null; return cursor; }
+case 19:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\n') { gotoCase = 16; continue; };
+if (yych == '\r') { gotoCase = 16; continue; };
+{ gotoCase = 107; continue; };
+case 20:
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 50; continue; };
+case 21:
+{
+var token = this._line.substring(cursorOnEnter, cursor);
+if (token in this._keywords)
+this.tokenType = "javascript-keyword";
+else
+this.tokenType = "javascript-ident";
+return cursor;
+}
+case 22:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 23:
+yych = this._charAt(++cursor);
+if (yych == '&') { gotoCase = 43; continue; };
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 24:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\n') { gotoCase = 16; continue; };
+if (yych == '\r') { gotoCase = 16; continue; };
+{ gotoCase = 96; continue; };
+case 25:
+yych = this._charAt(++cursor);
+{ gotoCase = 18; continue; };
+case 26:
+++cursor;
+{ this.tokenType = null; return cursor; }
+case 28:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 29:
+yych = this._charAt(++cursor);
+if (yych == '+') { gotoCase = 43; continue; };
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 30:
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 43; continue; };
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 31:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 18; continue; };
+if (yych <= '9') { gotoCase = 89; continue; };
+{ gotoCase = 18; continue; };
+case 32:
+yyaccept = 2;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '.') {
+if (yych == '*') { gotoCase = 78; continue; };
+} else {
+if (yych <= '/') { gotoCase = 80; continue; };
+if (yych == '=') { gotoCase = 77; continue; };
+}
+case 33:
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = null; return cursor; }
+case 34:
+yyaccept = 3;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= 'E') {
+if (yych <= '/') {
+if (yych == '.') { gotoCase = 63; continue; };
+} else {
+if (yych <= '7') { gotoCase = 72; continue; };
+if (yych >= 'E') { gotoCase = 62; continue; };
+}
+} else {
+if (yych <= 'd') {
+if (yych == 'X') { gotoCase = 74; continue; };
+} else {
+if (yych <= 'e') { gotoCase = 62; continue; };
+if (yych == 'x') { gotoCase = 74; continue; };
+}
+}
+case 35:
+{ this.tokenType = "javascript-number"; return cursor; }
+case 36:
+yyaccept = 3;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '9') {
+if (yych == '.') { gotoCase = 63; continue; };
+if (yych <= '/') { gotoCase = 35; continue; };
+{ gotoCase = 60; continue; };
+} else {
+if (yych <= 'E') {
+if (yych <= 'D') { gotoCase = 35; continue; };
+{ gotoCase = 62; continue; };
+} else {
+if (yych == 'e') { gotoCase = 62; continue; };
+{ gotoCase = 35; continue; };
+}
+}
+case 37:
+yych = this._charAt(++cursor);
+if (yych <= ';') { gotoCase = 18; continue; };
+if (yych <= '<') { gotoCase = 59; continue; };
+if (yych <= '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 38:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 58; continue; };
+{ gotoCase = 18; continue; };
+case 39:
+yych = this._charAt(++cursor);
+if (yych <= '<') { gotoCase = 18; continue; };
+if (yych <= '=') { gotoCase = 43; continue; };
+if (yych <= '>') { gotoCase = 56; continue; };
+{ gotoCase = 18; continue; };
+case 40:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'u') { gotoCase = 44; continue; };
+{ gotoCase = 16; continue; };
+case 41:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 42:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+if (yych != '|') { gotoCase = 18; continue; };
+case 43:
+yych = this._charAt(++cursor);
+{ gotoCase = 18; continue; };
+case 44:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 46; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 46; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych <= 'f') { gotoCase = 46; continue; };
+}
+case 45:
+cursor = YYMARKER;
+if (yyaccept <= 1) {
+if (yyaccept <= 0) {
+{ gotoCase = 16; continue; };
+} else {
+{ gotoCase = 21; continue; };
+}
+} else {
+if (yyaccept <= 2) {
+{ gotoCase = 33; continue; };
+} else {
+{ gotoCase = 35; continue; };
+}
+}
+case 46:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 47; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 47:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 48; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 48:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 49; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 49:
+yyaccept = 1;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 50:
+if (yych <= '[') {
+if (yych <= '/') {
+if (yych == '$') { gotoCase = 49; continue; };
+{ gotoCase = 21; continue; };
+} else {
+if (yych <= '9') { gotoCase = 49; continue; };
+if (yych <= '@') { gotoCase = 21; continue; };
+if (yych <= 'Z') { gotoCase = 49; continue; };
+{ gotoCase = 21; continue; };
+}
+} else {
+if (yych <= '_') {
+if (yych <= '\\') { gotoCase = 51; continue; };
+if (yych <= '^') { gotoCase = 21; continue; };
+{ gotoCase = 49; continue; };
+} else {
+if (yych <= '`') { gotoCase = 21; continue; };
+if (yych <= 'z') { gotoCase = 49; continue; };
+if (yych <= 0x7F) { gotoCase = 21; continue; };
+{ gotoCase = 49; continue; };
+}
+}
+case 51:
+++cursor;
+yych = this._charAt(cursor);
+if (yych != 'u') { gotoCase = 45; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 53; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 53:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 54; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 54:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 55; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 55:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 49; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 49; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych <= 'f') { gotoCase = 49; continue; };
+{ gotoCase = 45; continue; };
+}
+case 56:
+yych = this._charAt(++cursor);
+if (yych <= '<') { gotoCase = 18; continue; };
+if (yych <= '=') { gotoCase = 43; continue; };
+if (yych >= '?') { gotoCase = 18; continue; };
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 58:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 59:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+case 60:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '9') {
+if (yych == '.') { gotoCase = 63; continue; };
+if (yych <= '/') { gotoCase = 35; continue; };
+{ gotoCase = 60; continue; };
+} else {
+if (yych <= 'E') {
+if (yych <= 'D') { gotoCase = 35; continue; };
+} else {
+if (yych != 'e') { gotoCase = 35; continue; };
+}
+}
+case 62:
+yych = this._charAt(++cursor);
+if (yych <= ',') {
+if (yych == '+') { gotoCase = 69; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= '-') { gotoCase = 69; continue; };
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 70; continue; };
+{ gotoCase = 45; continue; };
+}
+case 63:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'D') {
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '9') { gotoCase = 63; continue; };
+{ gotoCase = 35; continue; };
+} else {
+if (yych <= 'E') { gotoCase = 65; continue; };
+if (yych != 'e') { gotoCase = 35; continue; };
+}
+case 65:
+yych = this._charAt(++cursor);
+if (yych <= ',') {
+if (yych != '+') { gotoCase = 45; continue; };
+} else {
+if (yych <= '-') { gotoCase = 66; continue; };
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 67; continue; };
+{ gotoCase = 45; continue; };
+}
+case 66:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+case 67:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '9') { gotoCase = 67; continue; };
+{ gotoCase = 35; continue; };
+case 69:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+case 70:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '9') { gotoCase = 70; continue; };
+{ gotoCase = 35; continue; };
+case 72:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '7') { gotoCase = 72; continue; };
+{ gotoCase = 35; continue; };
+case 74:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 75; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 75:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '9') { gotoCase = 75; continue; };
+{ gotoCase = 35; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 75; continue; };
+if (yych <= '`') { gotoCase = 35; continue; };
+if (yych <= 'f') { gotoCase = 75; continue; };
+{ gotoCase = 35; continue; };
+}
+case 77:
+yych = this._charAt(++cursor);
+{ gotoCase = 33; continue; };
+case 78:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 85; continue; };
+{ gotoCase = 78; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 85; continue; };
+if (yych == '*') { gotoCase = 83; continue; };
+{ gotoCase = 78; continue; };
+}
+case 80:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 82; continue; };
+if (yych != '\r') { gotoCase = 80; continue; };
+case 82:
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 83:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 83; continue; };
+if (yych == '/') { gotoCase = 87; continue; };
+{ gotoCase = 78; continue; };
+case 85:
+++cursor;
+this.setLexCondition(this._lexConditions.COMMENT);
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 87:
+++cursor;
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 89:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'D') {
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '9') { gotoCase = 89; continue; };
+{ gotoCase = 35; continue; };
+} else {
+if (yych <= 'E') { gotoCase = 91; continue; };
+if (yych != 'e') { gotoCase = 35; continue; };
+}
+case 91:
+yych = this._charAt(++cursor);
+if (yych <= ',') {
+if (yych != '+') { gotoCase = 45; continue; };
+} else {
+if (yych <= '-') { gotoCase = 92; continue; };
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 93; continue; };
+{ gotoCase = 45; continue; };
+}
+case 92:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+case 93:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 35; continue; };
+if (yych <= '9') { gotoCase = 93; continue; };
+{ gotoCase = 35; continue; };
+case 95:
+++cursor;
+yych = this._charAt(cursor);
+case 96:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 45; continue; };
+if (yych <= '\f') { gotoCase = 95; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 95; continue; };
+{ gotoCase = 98; continue; };
+} else {
+if (yych != '\\') { gotoCase = 95; continue; };
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 45; continue; };
+{ gotoCase = 101; continue; };
+} else {
+if (yych == '\r') { gotoCase = 101; continue; };
+{ gotoCase = 45; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 95; continue; };
+if (yych <= '&') { gotoCase = 45; continue; };
+{ gotoCase = 95; continue; };
+} else {
+if (yych == '\\') { gotoCase = 95; continue; };
+{ gotoCase = 45; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 95; continue; };
+if (yych <= 'e') { gotoCase = 45; continue; };
+{ gotoCase = 95; continue; };
+} else {
+if (yych == 'n') { gotoCase = 95; continue; };
+{ gotoCase = 45; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 45; continue; };
+{ gotoCase = 95; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 100; continue; };
+if (yych <= 'v') { gotoCase = 95; continue; };
+{ gotoCase = 45; continue; };
+}
+}
+}
+case 98:
+++cursor;
+{ this.tokenType = "javascript-string"; return cursor; }
+case 100:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 103; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 103; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych <= 'f') { gotoCase = 103; continue; };
+{ gotoCase = 45; continue; };
+}
+case 101:
+++cursor;
+this.setLexCondition(this._lexConditions.SSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 103:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 104; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 104:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 105; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 105:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 95; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 95; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych <= 'f') { gotoCase = 95; continue; };
+{ gotoCase = 45; continue; };
+}
+case 106:
+++cursor;
+yych = this._charAt(cursor);
+case 107:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 45; continue; };
+if (yych <= '\f') { gotoCase = 106; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 106; continue; };
+{ gotoCase = 98; continue; };
+} else {
+if (yych != '\\') { gotoCase = 106; continue; };
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 45; continue; };
+{ gotoCase = 110; continue; };
+} else {
+if (yych == '\r') { gotoCase = 110; continue; };
+{ gotoCase = 45; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 106; continue; };
+if (yych <= '&') { gotoCase = 45; continue; };
+{ gotoCase = 106; continue; };
+} else {
+if (yych == '\\') { gotoCase = 106; continue; };
+{ gotoCase = 45; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 106; continue; };
+if (yych <= 'e') { gotoCase = 45; continue; };
+{ gotoCase = 106; continue; };
+} else {
+if (yych == 'n') { gotoCase = 106; continue; };
+{ gotoCase = 45; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 45; continue; };
+{ gotoCase = 106; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 109; continue; };
+if (yych <= 'v') { gotoCase = 106; continue; };
+{ gotoCase = 45; continue; };
+}
+}
+}
+case 109:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 112; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 112; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych <= 'f') { gotoCase = 112; continue; };
+{ gotoCase = 45; continue; };
+}
+case 110:
+++cursor;
+this.setLexCondition(this._lexConditions.DSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 112:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 113; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 113:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych >= ':') { gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 114; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych >= 'g') { gotoCase = 45; continue; };
+}
+case 114:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 45; continue; };
+if (yych <= '9') { gotoCase = 106; continue; };
+{ gotoCase = 45; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 106; continue; };
+if (yych <= '`') { gotoCase = 45; continue; };
+if (yych <= 'f') { gotoCase = 106; continue; };
+{ gotoCase = 45; continue; };
+}
+case 115:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 43; continue; };
+{ gotoCase = 18; continue; };
+
+case this.case_DSTRING:
+yych = this._charAt(cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 120; continue; };
+if (yych <= '\f') { gotoCase = 119; continue; };
+{ gotoCase = 120; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 119; continue; };
+{ gotoCase = 122; continue; };
+} else {
+if (yych == '\\') { gotoCase = 124; continue; };
+{ gotoCase = 119; continue; };
+}
+}
+case 118:
+{ this.tokenType = "javascript-string"; return cursor; }
+case 119:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 126; continue; };
+case 120:
+++cursor;
+case 121:
+{ this.tokenType = null; return cursor; }
+case 122:
+++cursor;
+case 123:
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 124:
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 125; continue; };
+if (yych <= '&') { gotoCase = 121; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 121; continue; };
+} else {
+if (yych != 'b') { gotoCase = 121; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych >= 'g') { gotoCase = 121; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 125; continue; };
+if (yych <= 'q') { gotoCase = 121; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 121; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 127; continue; };
+if (yych >= 'w') { gotoCase = 121; continue; };
+}
+}
+}
+case 125:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 126:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 118; continue; };
+if (yych <= '\f') { gotoCase = 125; continue; };
+{ gotoCase = 118; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 125; continue; };
+{ gotoCase = 133; continue; };
+} else {
+if (yych == '\\') { gotoCase = 132; continue; };
+{ gotoCase = 125; continue; };
+}
+}
+case 127:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 128; continue; };
+if (yych <= '9') { gotoCase = 129; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 129; continue; };
+if (yych <= '`') { gotoCase = 128; continue; };
+if (yych <= 'f') { gotoCase = 129; continue; };
+}
+case 128:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 118; continue; };
+} else {
+{ gotoCase = 121; continue; };
+}
+case 129:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 128; continue; };
+if (yych >= ':') { gotoCase = 128; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 130; continue; };
+if (yych <= '`') { gotoCase = 128; continue; };
+if (yych >= 'g') { gotoCase = 128; continue; };
+}
+case 130:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 128; continue; };
+if (yych >= ':') { gotoCase = 128; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 131; continue; };
+if (yych <= '`') { gotoCase = 128; continue; };
+if (yych >= 'g') { gotoCase = 128; continue; };
+}
+case 131:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 128; continue; };
+if (yych <= '9') { gotoCase = 125; continue; };
+{ gotoCase = 128; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 125; continue; };
+if (yych <= '`') { gotoCase = 128; continue; };
+if (yych <= 'f') { gotoCase = 125; continue; };
+{ gotoCase = 128; continue; };
+}
+case 132:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 125; continue; };
+if (yych <= '&') { gotoCase = 128; continue; };
+{ gotoCase = 125; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 128; continue; };
+{ gotoCase = 125; continue; };
+} else {
+if (yych == 'b') { gotoCase = 125; continue; };
+{ gotoCase = 128; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych <= 'f') { gotoCase = 125; continue; };
+{ gotoCase = 128; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 125; continue; };
+if (yych <= 'q') { gotoCase = 128; continue; };
+{ gotoCase = 125; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 128; continue; };
+{ gotoCase = 125; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 127; continue; };
+if (yych <= 'v') { gotoCase = 125; continue; };
+{ gotoCase = 128; continue; };
+}
+}
+}
+case 133:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 123; continue; };
+
+case this.case_NODIV:
+yych = this._charAt(cursor);
+if (yych <= '9') {
+if (yych <= '(') {
+if (yych <= '#') {
+if (yych <= ' ') { gotoCase = 136; continue; };
+if (yych <= '!') { gotoCase = 138; continue; };
+if (yych <= '"') { gotoCase = 140; continue; };
+} else {
+if (yych <= '%') {
+if (yych <= '$') { gotoCase = 141; continue; };
+{ gotoCase = 143; continue; };
+} else {
+if (yych <= '&') { gotoCase = 144; continue; };
+if (yych <= '\'') { gotoCase = 145; continue; };
+{ gotoCase = 146; continue; };
+}
+}
+} else {
+if (yych <= ',') {
+if (yych <= ')') { gotoCase = 147; continue; };
+if (yych <= '*') { gotoCase = 149; continue; };
+if (yych <= '+') { gotoCase = 150; continue; };
+{ gotoCase = 146; continue; };
+} else {
+if (yych <= '.') {
+if (yych <= '-') { gotoCase = 151; continue; };
+{ gotoCase = 152; continue; };
+} else {
+if (yych <= '/') { gotoCase = 153; continue; };
+if (yych <= '0') { gotoCase = 154; continue; };
+{ gotoCase = 156; continue; };
+}
+}
+}
+} else {
+if (yych <= '\\') {
+if (yych <= '>') {
+if (yych <= ';') { gotoCase = 146; continue; };
+if (yych <= '<') { gotoCase = 157; continue; };
+if (yych <= '=') { gotoCase = 158; continue; };
+{ gotoCase = 159; continue; };
+} else {
+if (yych <= '@') {
+if (yych <= '?') { gotoCase = 146; continue; };
+} else {
+if (yych <= 'Z') { gotoCase = 141; continue; };
+if (yych <= '[') { gotoCase = 146; continue; };
+{ gotoCase = 160; continue; };
+}
+}
+} else {
+if (yych <= 'z') {
+if (yych <= '^') {
+if (yych <= ']') { gotoCase = 146; continue; };
+{ gotoCase = 161; continue; };
+} else {
+if (yych != '`') { gotoCase = 141; continue; };
+}
+} else {
+if (yych <= '|') {
+if (yych <= '{') { gotoCase = 146; continue; };
+{ gotoCase = 162; continue; };
+} else {
+if (yych <= '~') { gotoCase = 146; continue; };
+if (yych >= 0x80) { gotoCase = 141; continue; };
+}
+}
+}
+}
+case 136:
+++cursor;
+case 137:
+{ this.tokenType = null; return cursor; }
+case 138:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 260; continue; };
+case 139:
+{ this.tokenType = null; return cursor; }
+case 140:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\n') { gotoCase = 137; continue; };
+if (yych == '\r') { gotoCase = 137; continue; };
+{ gotoCase = 252; continue; };
+case 141:
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 170; continue; };
+case 142:
+this.setLexCondition(this._lexConditions.DIV);
+{
+var token = this._line.substring(cursorOnEnter, cursor);
+if (token in this._keywords)
+this.tokenType = "javascript-keyword";
+else
+this.tokenType = "javascript-ident";
+return cursor;
+}
+case 143:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 144:
+yych = this._charAt(++cursor);
+if (yych == '&') { gotoCase = 163; continue; };
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 145:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == '\n') { gotoCase = 137; continue; };
+if (yych == '\r') { gotoCase = 137; continue; };
+{ gotoCase = 241; continue; };
+case 146:
+yych = this._charAt(++cursor);
+{ gotoCase = 139; continue; };
+case 147:
+++cursor;
+this.setLexCondition(this._lexConditions.DIV);
+{ this.tokenType = null; return cursor; }
+case 149:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 150:
+yych = this._charAt(++cursor);
+if (yych == '+') { gotoCase = 163; continue; };
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 151:
+yych = this._charAt(++cursor);
+if (yych == '-') { gotoCase = 163; continue; };
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 152:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 139; continue; };
+if (yych <= '9') { gotoCase = 234; continue; };
+{ gotoCase = 139; continue; };
+case 153:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 137; continue; };
+{ gotoCase = 197; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 137; continue; };
+if (yych <= ')') { gotoCase = 197; continue; };
+{ gotoCase = 202; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 204; continue; };
+{ gotoCase = 197; continue; };
+} else {
+if (yych <= '[') { gotoCase = 200; continue; };
+if (yych <= '\\') { gotoCase = 199; continue; };
+if (yych <= ']') { gotoCase = 137; continue; };
+{ gotoCase = 197; continue; };
+}
+}
+case 154:
+yyaccept = 2;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= 'E') {
+if (yych <= '/') {
+if (yych == '.') { gotoCase = 183; continue; };
+} else {
+if (yych <= '7') { gotoCase = 192; continue; };
+if (yych >= 'E') { gotoCase = 182; continue; };
+}
+} else {
+if (yych <= 'd') {
+if (yych == 'X') { gotoCase = 194; continue; };
+} else {
+if (yych <= 'e') { gotoCase = 182; continue; };
+if (yych == 'x') { gotoCase = 194; continue; };
+}
+}
+case 155:
+this.setLexCondition(this._lexConditions.DIV);
+{ this.tokenType = "javascript-number"; return cursor; }
+case 156:
+yyaccept = 2;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '9') {
+if (yych == '.') { gotoCase = 183; continue; };
+if (yych <= '/') { gotoCase = 155; continue; };
+{ gotoCase = 180; continue; };
+} else {
+if (yych <= 'E') {
+if (yych <= 'D') { gotoCase = 155; continue; };
+{ gotoCase = 182; continue; };
+} else {
+if (yych == 'e') { gotoCase = 182; continue; };
+{ gotoCase = 155; continue; };
+}
+}
+case 157:
+yych = this._charAt(++cursor);
+if (yych <= ';') { gotoCase = 139; continue; };
+if (yych <= '<') { gotoCase = 179; continue; };
+if (yych <= '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 158:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 178; continue; };
+{ gotoCase = 139; continue; };
+case 159:
+yych = this._charAt(++cursor);
+if (yych <= '<') { gotoCase = 139; continue; };
+if (yych <= '=') { gotoCase = 163; continue; };
+if (yych <= '>') { gotoCase = 176; continue; };
+{ gotoCase = 139; continue; };
+case 160:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych == 'u') { gotoCase = 164; continue; };
+{ gotoCase = 137; continue; };
+case 161:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 162:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+if (yych != '|') { gotoCase = 139; continue; };
+case 163:
+yych = this._charAt(++cursor);
+{ gotoCase = 139; continue; };
+case 164:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 166; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 166; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych <= 'f') { gotoCase = 166; continue; };
+}
+case 165:
+cursor = YYMARKER;
+if (yyaccept <= 1) {
+if (yyaccept <= 0) {
+{ gotoCase = 137; continue; };
+} else {
+{ gotoCase = 142; continue; };
+}
+} else {
+if (yyaccept <= 2) {
+{ gotoCase = 155; continue; };
+} else {
+{ gotoCase = 217; continue; };
+}
+}
+case 166:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 167; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 167:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 168; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 168:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 169; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 169:
+yyaccept = 1;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 170:
+if (yych <= '[') {
+if (yych <= '/') {
+if (yych == '$') { gotoCase = 169; continue; };
+{ gotoCase = 142; continue; };
+} else {
+if (yych <= '9') { gotoCase = 169; continue; };
+if (yych <= '@') { gotoCase = 142; continue; };
+if (yych <= 'Z') { gotoCase = 169; continue; };
+{ gotoCase = 142; continue; };
+}
+} else {
+if (yych <= '_') {
+if (yych <= '\\') { gotoCase = 171; continue; };
+if (yych <= '^') { gotoCase = 142; continue; };
+{ gotoCase = 169; continue; };
+} else {
+if (yych <= '`') { gotoCase = 142; continue; };
+if (yych <= 'z') { gotoCase = 169; continue; };
+if (yych <= 0x7F) { gotoCase = 142; continue; };
+{ gotoCase = 169; continue; };
+}
+}
+case 171:
+++cursor;
+yych = this._charAt(cursor);
+if (yych != 'u') { gotoCase = 165; continue; };
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 173; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 173:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 174; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 174:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 175; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 175:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 169; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 169; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych <= 'f') { gotoCase = 169; continue; };
+{ gotoCase = 165; continue; };
+}
+case 176:
+yych = this._charAt(++cursor);
+if (yych <= '<') { gotoCase = 139; continue; };
+if (yych <= '=') { gotoCase = 163; continue; };
+if (yych >= '?') { gotoCase = 139; continue; };
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 178:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 179:
+yych = this._charAt(++cursor);
+if (yych == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+case 180:
+yyaccept = 2;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '9') {
+if (yych == '.') { gotoCase = 183; continue; };
+if (yych <= '/') { gotoCase = 155; continue; };
+{ gotoCase = 180; continue; };
+} else {
+if (yych <= 'E') {
+if (yych <= 'D') { gotoCase = 155; continue; };
+} else {
+if (yych != 'e') { gotoCase = 155; continue; };
+}
+}
+case 182:
+yych = this._charAt(++cursor);
+if (yych <= ',') {
+if (yych == '+') { gotoCase = 189; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= '-') { gotoCase = 189; continue; };
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 190; continue; };
+{ gotoCase = 165; continue; };
+}
+case 183:
+yyaccept = 2;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'D') {
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '9') { gotoCase = 183; continue; };
+{ gotoCase = 155; continue; };
+} else {
+if (yych <= 'E') { gotoCase = 185; continue; };
+if (yych != 'e') { gotoCase = 155; continue; };
+}
+case 185:
+yych = this._charAt(++cursor);
+if (yych <= ',') {
+if (yych != '+') { gotoCase = 165; continue; };
+} else {
+if (yych <= '-') { gotoCase = 186; continue; };
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 187; continue; };
+{ gotoCase = 165; continue; };
+}
+case 186:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+case 187:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '9') { gotoCase = 187; continue; };
+{ gotoCase = 155; continue; };
+case 189:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+case 190:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '9') { gotoCase = 190; continue; };
+{ gotoCase = 155; continue; };
+case 192:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '7') { gotoCase = 192; continue; };
+{ gotoCase = 155; continue; };
+case 194:
+yych = this._charAt(++cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 195; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 195:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '9') { gotoCase = 195; continue; };
+{ gotoCase = 155; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 195; continue; };
+if (yych <= '`') { gotoCase = 155; continue; };
+if (yych <= 'f') { gotoCase = 195; continue; };
+{ gotoCase = 155; continue; };
+}
+case 197:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '.') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 197; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych == '\r') { gotoCase = 165; continue; };
+{ gotoCase = 197; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych <= '/') { gotoCase = 220; continue; };
+if (yych <= 'Z') { gotoCase = 197; continue; };
+{ gotoCase = 228; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 227; continue; };
+if (yych <= ']') { gotoCase = 165; continue; };
+{ gotoCase = 197; continue; };
+}
+}
+case 199:
+yych = this._charAt(++cursor);
+if (yych == '\n') { gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 165; continue; };
+{ gotoCase = 197; continue; };
+case 200:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 165; continue; };
+{ gotoCase = 200; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 165; continue; };
+if (yych <= ')') { gotoCase = 200; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 165; continue; };
+{ gotoCase = 200; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 215; continue; };
+if (yych <= ']') { gotoCase = 213; continue; };
+{ gotoCase = 200; continue; };
+}
+}
+case 202:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 209; continue; };
+{ gotoCase = 202; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 209; continue; };
+if (yych == '*') { gotoCase = 207; continue; };
+{ gotoCase = 202; continue; };
+}
+case 204:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 206; continue; };
+if (yych != '\r') { gotoCase = 204; continue; };
+case 206:
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 207:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '*') { gotoCase = 207; continue; };
+if (yych == '/') { gotoCase = 211; continue; };
+{ gotoCase = 202; continue; };
+case 209:
+++cursor;
+this.setLexCondition(this._lexConditions.COMMENT);
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 211:
+++cursor;
+{ this.tokenType = "javascript-comment"; return cursor; }
+case 213:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 165; continue; };
+{ gotoCase = 213; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 165; continue; };
+if (yych <= ')') { gotoCase = 213; continue; };
+{ gotoCase = 197; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 220; continue; };
+{ gotoCase = 213; continue; };
+} else {
+if (yych <= '[') { gotoCase = 218; continue; };
+if (yych <= '\\') { gotoCase = 216; continue; };
+{ gotoCase = 213; continue; };
+}
+}
+case 215:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 165; continue; };
+{ gotoCase = 200; continue; };
+case 216:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 217; continue; };
+if (yych != '\r') { gotoCase = 213; continue; };
+case 217:
+this.setLexCondition(this._lexConditions.REGEX);
+{ this.tokenType = "javascript-regexp"; return cursor; }
+case 218:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 165; continue; };
+{ gotoCase = 218; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 165; continue; };
+if (yych <= ')') { gotoCase = 218; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 165; continue; };
+{ gotoCase = 218; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 225; continue; };
+if (yych <= ']') { gotoCase = 223; continue; };
+{ gotoCase = 218; continue; };
+}
+}
+case 220:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'h') {
+if (yych == 'g') { gotoCase = 220; continue; };
+} else {
+if (yych <= 'i') { gotoCase = 220; continue; };
+if (yych == 'm') { gotoCase = 220; continue; };
+}
+{ this.tokenType = "javascript-regexp"; return cursor; }
+case 223:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 165; continue; };
+{ gotoCase = 223; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 165; continue; };
+if (yych <= ')') { gotoCase = 223; continue; };
+{ gotoCase = 197; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 220; continue; };
+{ gotoCase = 223; continue; };
+} else {
+if (yych <= '[') { gotoCase = 218; continue; };
+if (yych <= '\\') { gotoCase = 226; continue; };
+{ gotoCase = 223; continue; };
+}
+}
+case 225:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 165; continue; };
+{ gotoCase = 218; continue; };
+case 226:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 217; continue; };
+if (yych == '\r') { gotoCase = 217; continue; };
+{ gotoCase = 223; continue; };
+case 227:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 217; continue; };
+if (yych == '\r') { gotoCase = 217; continue; };
+{ gotoCase = 197; continue; };
+case 228:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 165; continue; };
+{ gotoCase = 228; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 165; continue; };
+if (yych <= ')') { gotoCase = 228; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 165; continue; };
+{ gotoCase = 228; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 232; continue; };
+if (yych >= '^') { gotoCase = 228; continue; };
+}
+}
+case 230:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 165; continue; };
+{ gotoCase = 230; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 165; continue; };
+if (yych <= ')') { gotoCase = 230; continue; };
+{ gotoCase = 197; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 220; continue; };
+{ gotoCase = 230; continue; };
+} else {
+if (yych <= '[') { gotoCase = 228; continue; };
+if (yych <= '\\') { gotoCase = 233; continue; };
+{ gotoCase = 230; continue; };
+}
+}
+case 232:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 165; continue; };
+if (yych == '\r') { gotoCase = 165; continue; };
+{ gotoCase = 228; continue; };
+case 233:
+yyaccept = 3;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 217; continue; };
+if (yych == '\r') { gotoCase = 217; continue; };
+{ gotoCase = 230; continue; };
+case 234:
+yyaccept = 2;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'D') {
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '9') { gotoCase = 234; continue; };
+{ gotoCase = 155; continue; };
+} else {
+if (yych <= 'E') { gotoCase = 236; continue; };
+if (yych != 'e') { gotoCase = 155; continue; };
+}
+case 236:
+yych = this._charAt(++cursor);
+if (yych <= ',') {
+if (yych != '+') { gotoCase = 165; continue; };
+} else {
+if (yych <= '-') { gotoCase = 237; continue; };
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 238; continue; };
+{ gotoCase = 165; continue; };
+}
+case 237:
+yych = this._charAt(++cursor);
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+case 238:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '/') { gotoCase = 155; continue; };
+if (yych <= '9') { gotoCase = 238; continue; };
+{ gotoCase = 155; continue; };
+case 240:
+++cursor;
+yych = this._charAt(cursor);
+case 241:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 165; continue; };
+if (yych <= '\f') { gotoCase = 240; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 240; continue; };
+{ gotoCase = 243; continue; };
+} else {
+if (yych != '\\') { gotoCase = 240; continue; };
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 165; continue; };
+{ gotoCase = 246; continue; };
+} else {
+if (yych == '\r') { gotoCase = 246; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 240; continue; };
+if (yych <= '&') { gotoCase = 165; continue; };
+{ gotoCase = 240; continue; };
+} else {
+if (yych == '\\') { gotoCase = 240; continue; };
+{ gotoCase = 165; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 240; continue; };
+if (yych <= 'e') { gotoCase = 165; continue; };
+{ gotoCase = 240; continue; };
+} else {
+if (yych == 'n') { gotoCase = 240; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 165; continue; };
+{ gotoCase = 240; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 245; continue; };
+if (yych <= 'v') { gotoCase = 240; continue; };
+{ gotoCase = 165; continue; };
+}
+}
+}
+case 243:
+++cursor;
+{ this.tokenType = "javascript-string"; return cursor; }
+case 245:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 248; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 248; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych <= 'f') { gotoCase = 248; continue; };
+{ gotoCase = 165; continue; };
+}
+case 246:
+++cursor;
+this.setLexCondition(this._lexConditions.SSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 248:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 249; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 249:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 250; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 250:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 240; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 240; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych <= 'f') { gotoCase = 240; continue; };
+{ gotoCase = 165; continue; };
+}
+case 251:
+++cursor;
+yych = this._charAt(cursor);
+case 252:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 165; continue; };
+if (yych <= '\f') { gotoCase = 251; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= '"') {
+if (yych <= '!') { gotoCase = 251; continue; };
+{ gotoCase = 243; continue; };
+} else {
+if (yych != '\\') { gotoCase = 251; continue; };
+}
+}
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'a') {
+if (yych <= '!') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 165; continue; };
+{ gotoCase = 255; continue; };
+} else {
+if (yych == '\r') { gotoCase = 255; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= '\'') {
+if (yych <= '"') { gotoCase = 251; continue; };
+if (yych <= '&') { gotoCase = 165; continue; };
+{ gotoCase = 251; continue; };
+} else {
+if (yych == '\\') { gotoCase = 251; continue; };
+{ gotoCase = 165; continue; };
+}
+}
+} else {
+if (yych <= 'q') {
+if (yych <= 'f') {
+if (yych <= 'b') { gotoCase = 251; continue; };
+if (yych <= 'e') { gotoCase = 165; continue; };
+{ gotoCase = 251; continue; };
+} else {
+if (yych == 'n') { gotoCase = 251; continue; };
+{ gotoCase = 165; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych == 's') { gotoCase = 165; continue; };
+{ gotoCase = 251; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 254; continue; };
+if (yych <= 'v') { gotoCase = 251; continue; };
+{ gotoCase = 165; continue; };
+}
+}
+}
+case 254:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 257; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 257; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych <= 'f') { gotoCase = 257; continue; };
+{ gotoCase = 165; continue; };
+}
+case 255:
+++cursor;
+this.setLexCondition(this._lexConditions.DSTRING);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 257:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 258; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 258:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych >= ':') { gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 259; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych >= 'g') { gotoCase = 165; continue; };
+}
+case 259:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 165; continue; };
+if (yych <= '9') { gotoCase = 251; continue; };
+{ gotoCase = 165; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 251; continue; };
+if (yych <= '`') { gotoCase = 165; continue; };
+if (yych <= 'f') { gotoCase = 251; continue; };
+{ gotoCase = 165; continue; };
+}
+case 260:
+++cursor;
+if ((yych = this._charAt(cursor)) == '=') { gotoCase = 163; continue; };
+{ gotoCase = 139; continue; };
+
+case this.case_REGEX:
+yych = this._charAt(cursor);
+if (yych <= '.') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 264; continue; };
+{ gotoCase = 265; continue; };
+} else {
+if (yych == '\r') { gotoCase = 265; continue; };
+{ gotoCase = 264; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych <= '/') { gotoCase = 267; continue; };
+if (yych <= 'Z') { gotoCase = 264; continue; };
+{ gotoCase = 269; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 270; continue; };
+if (yych <= ']') { gotoCase = 265; continue; };
+{ gotoCase = 264; continue; };
+}
+}
+case 263:
+{ this.tokenType = "javascript-regexp"; return cursor; }
+case 264:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 272; continue; };
+case 265:
+++cursor;
+case 266:
+{ this.tokenType = null; return cursor; }
+case 267:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 278; continue; };
+case 268:
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = "javascript-regexp"; return cursor; }
+case 269:
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 266; continue; };
+if (yych <= '\f') { gotoCase = 276; continue; };
+{ gotoCase = 266; continue; };
+} else {
+if (yych <= '*') {
+if (yych <= ')') { gotoCase = 276; continue; };
+{ gotoCase = 266; continue; };
+} else {
+if (yych == '/') { gotoCase = 266; continue; };
+{ gotoCase = 276; continue; };
+}
+}
+case 270:
+yych = this._charAt(++cursor);
+if (yych == '\n') { gotoCase = 266; continue; };
+if (yych == '\r') { gotoCase = 266; continue; };
+case 271:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 272:
+if (yych <= '.') {
+if (yych <= '\n') {
+if (yych <= '\t') { gotoCase = 271; continue; };
+{ gotoCase = 263; continue; };
+} else {
+if (yych == '\r') { gotoCase = 263; continue; };
+{ gotoCase = 271; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych <= '/') { gotoCase = 277; continue; };
+if (yych <= 'Z') { gotoCase = 271; continue; };
+{ gotoCase = 275; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 273; continue; };
+if (yych <= ']') { gotoCase = 263; continue; };
+{ gotoCase = 271; continue; };
+}
+}
+case 273:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych != '\r') { gotoCase = 271; continue; };
+case 274:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 263; continue; };
+} else {
+{ gotoCase = 266; continue; };
+}
+case 275:
+++cursor;
+yych = this._charAt(cursor);
+case 276:
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 274; continue; };
+{ gotoCase = 275; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 274; continue; };
+if (yych <= ')') { gotoCase = 275; continue; };
+{ gotoCase = 274; continue; };
+}
+} else {
+if (yych <= '[') {
+if (yych == '/') { gotoCase = 274; continue; };
+{ gotoCase = 275; continue; };
+} else {
+if (yych <= '\\') { gotoCase = 281; continue; };
+if (yych <= ']') { gotoCase = 279; continue; };
+{ gotoCase = 275; continue; };
+}
+}
+case 277:
+++cursor;
+yych = this._charAt(cursor);
+case 278:
+if (yych <= 'h') {
+if (yych == 'g') { gotoCase = 277; continue; };
+{ gotoCase = 268; continue; };
+} else {
+if (yych <= 'i') { gotoCase = 277; continue; };
+if (yych == 'm') { gotoCase = 277; continue; };
+{ gotoCase = 268; continue; };
+}
+case 279:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+if (yych <= '*') {
+if (yych <= '\f') {
+if (yych == '\n') { gotoCase = 263; continue; };
+{ gotoCase = 279; continue; };
+} else {
+if (yych <= '\r') { gotoCase = 263; continue; };
+if (yych <= ')') { gotoCase = 279; continue; };
+{ gotoCase = 271; continue; };
+}
+} else {
+if (yych <= 'Z') {
+if (yych == '/') { gotoCase = 277; continue; };
+{ gotoCase = 279; continue; };
+} else {
+if (yych <= '[') { gotoCase = 275; continue; };
+if (yych <= '\\') { gotoCase = 282; continue; };
+{ gotoCase = 279; continue; };
+}
+}
+case 281:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych == '\r') { gotoCase = 274; continue; };
+{ gotoCase = 275; continue; };
+case 282:
+++cursor;
+yych = this._charAt(cursor);
+if (yych == '\n') { gotoCase = 274; continue; };
+if (yych == '\r') { gotoCase = 274; continue; };
+{ gotoCase = 279; continue; };
+
+case this.case_SSTRING:
+yych = this._charAt(cursor);
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 287; continue; };
+if (yych <= '\f') { gotoCase = 286; continue; };
+{ gotoCase = 287; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 286; continue; };
+{ gotoCase = 289; continue; };
+} else {
+if (yych == '\\') { gotoCase = 291; continue; };
+{ gotoCase = 286; continue; };
+}
+}
+case 285:
+{ this.tokenType = "javascript-string"; return cursor; }
+case 286:
+yyaccept = 0;
+yych = this._charAt(YYMARKER = ++cursor);
+{ gotoCase = 293; continue; };
+case 287:
+++cursor;
+case 288:
+{ this.tokenType = null; return cursor; }
+case 289:
+++cursor;
+case 290:
+this.setLexCondition(this._lexConditions.NODIV);
+{ this.tokenType = "javascript-string"; return cursor; }
+case 291:
+yyaccept = 1;
+yych = this._charAt(YYMARKER = ++cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 292; continue; };
+if (yych <= '&') { gotoCase = 288; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 288; continue; };
+} else {
+if (yych != 'b') { gotoCase = 288; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych >= 'g') { gotoCase = 288; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 292; continue; };
+if (yych <= 'q') { gotoCase = 288; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 288; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 294; continue; };
+if (yych >= 'w') { gotoCase = 288; continue; };
+}
+}
+}
+case 292:
+yyaccept = 0;
+YYMARKER = ++cursor;
+yych = this._charAt(cursor);
+case 293:
+if (yych <= '\r') {
+if (yych == '\n') { gotoCase = 285; continue; };
+if (yych <= '\f') { gotoCase = 292; continue; };
+{ gotoCase = 285; continue; };
+} else {
+if (yych <= '\'') {
+if (yych <= '&') { gotoCase = 292; continue; };
+{ gotoCase = 300; continue; };
+} else {
+if (yych == '\\') { gotoCase = 299; continue; };
+{ gotoCase = 292; continue; };
+}
+}
+case 294:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 295; continue; };
+if (yych <= '9') { gotoCase = 296; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 296; continue; };
+if (yych <= '`') { gotoCase = 295; continue; };
+if (yych <= 'f') { gotoCase = 296; continue; };
+}
+case 295:
+cursor = YYMARKER;
+if (yyaccept <= 0) {
+{ gotoCase = 285; continue; };
+} else {
+{ gotoCase = 288; continue; };
+}
+case 296:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 295; continue; };
+if (yych >= ':') { gotoCase = 295; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 297; continue; };
+if (yych <= '`') { gotoCase = 295; continue; };
+if (yych >= 'g') { gotoCase = 295; continue; };
+}
+case 297:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 295; continue; };
+if (yych >= ':') { gotoCase = 295; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 298; continue; };
+if (yych <= '`') { gotoCase = 295; continue; };
+if (yych >= 'g') { gotoCase = 295; continue; };
+}
+case 298:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= '@') {
+if (yych <= '/') { gotoCase = 295; continue; };
+if (yych <= '9') { gotoCase = 292; continue; };
+{ gotoCase = 295; continue; };
+} else {
+if (yych <= 'F') { gotoCase = 292; continue; };
+if (yych <= '`') { gotoCase = 295; continue; };
+if (yych <= 'f') { gotoCase = 292; continue; };
+{ gotoCase = 295; continue; };
+}
+case 299:
+++cursor;
+yych = this._charAt(cursor);
+if (yych <= 'e') {
+if (yych <= '\'') {
+if (yych == '"') { gotoCase = 292; continue; };
+if (yych <= '&') { gotoCase = 295; continue; };
+{ gotoCase = 292; continue; };
+} else {
+if (yych <= '\\') {
+if (yych <= '[') { gotoCase = 295; continue; };
+{ gotoCase = 292; continue; };
+} else {
+if (yych == 'b') { gotoCase = 292; continue; };
+{ gotoCase = 295; continue; };
+}
+}
+} else {
+if (yych <= 'r') {
+if (yych <= 'm') {
+if (yych <= 'f') { gotoCase = 292; continue; };
+{ gotoCase = 295; continue; };
+} else {
+if (yych <= 'n') { gotoCase = 292; continue; };
+if (yych <= 'q') { gotoCase = 295; continue; };
+{ gotoCase = 292; continue; };
+}
+} else {
+if (yych <= 't') {
+if (yych <= 's') { gotoCase = 295; continue; };
+{ gotoCase = 292; continue; };
+} else {
+if (yych <= 'u') { gotoCase = 294; continue; };
+if (yych <= 'v') { gotoCase = 292; continue; };
+{ gotoCase = 295; continue; };
+}
+}
+}
+case 300:
+++cursor;
+yych = this._charAt(cursor);
+{ gotoCase = 290; continue; };
+}
+
+}
+}
 }
 
 WebInspector.SourceJavaScriptTokenizer.prototype.__proto__ = WebInspector.SourceTokenizer.prototype;
 
-/* SourceView.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.SourceView = function(resource)
 {
-    WebInspector.ResourceView.call(this, resource);
+WebInspector.ResourceView.call(this, resource);
 
-    this.element.addStyleClass("source");
+this.element.addStyleClass("source");
 
-    this.sourceFrame = new WebInspector.SourceFrame(this.contentElement, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this));
-    resource.addEventListener("finished", this._resourceLoadingFinished, this);
-    this._frameNeedsSetup = true;
+var delegate = new WebInspector.ResourceFrameDelegateImpl(this.resource);
+this.sourceFrame = new WebInspector.SourceFrame(this.element, delegate);
+resource.addEventListener("finished", this._resourceLoadingFinished, this);
+this._frameNeedsSetup = true;
+}
+
+
+
+WebInspector.SourceView.DefaultMIMETypeForResourceType = {
+0: "text/html",
+1: "text/css",
+4: "text/javascript"
 }
 
 WebInspector.SourceView.prototype = {
-    show: function(parentElement)
-    {
-        WebInspector.ResourceView.prototype.show.call(this, parentElement);
-        this.sourceFrame.visible = true;
-        this.resize();
-    },
+show: function(parentElement)
+{
+WebInspector.ResourceView.prototype.show.call(this, parentElement);
+this.setupSourceFrameIfNeeded();
+this.sourceFrame.visible = true;
+this.resize();
+},
 
-    hide: function()
-    {
-        WebInspector.View.prototype.hide.call(this);
-        this.sourceFrame.visible = false;
-        this._currentSearchResultIndex = -1;
-    },
+hide: function()
+{
+this.sourceFrame.visible = false;
+if (!this._frameNeedsSetup)
+this.sourceFrame.clearLineHighlight();
+WebInspector.View.prototype.hide.call(this);
+this._currentSearchResultIndex = -1;
+},
 
-    resize: function()
-    {
-        if (this.sourceFrame)
-            this.sourceFrame.resize();
-    },
+resize: function()
+{
+if (this.sourceFrame)
+this.sourceFrame.resize();
+},
 
-    setupSourceFrameIfNeeded: function()
-    {
-        if (!this._frameNeedsSetup)
-            return;
+get scrollTop()
+{
+return this.sourceFrame.scrollTop;
+},
 
-        this.attach();
+set scrollTop(scrollTop)
+{
+this.sourceFrame.scrollTop = scrollTop;
+},
 
-        delete this._frameNeedsSetup;
-        WebInspector.getResourceContent(this.resource.identifier, this._contentLoaded.bind(this));
-    },
 
-    contentTabSelected: function()
-    {
-        this.setupSourceFrameIfNeeded();
-    },
+setupSourceFrameIfNeeded: function()
+{
+if (!this._frameNeedsSetup)
+return;
 
-    _contentLoaded: function(content)
-    {
-        this.sourceFrame.setContent(this.resource.mimeType, content, this.resource.url);
-        this._sourceFrameSetupFinished();
-    },
+delete this._frameNeedsSetup;
+this.resource.requestContent(this._contentLoaded.bind(this));
+},
 
-    _resourceLoadingFinished: function(event)
-    {
-        this._frameNeedsSetup = true;
-        this._sourceFrameSetup = false;
-        if (this.visible)
-            this.setupSourceFrameIfNeeded();
-        this.resource.removeEventListener("finished", this._resourceLoadingFinished, this);
-    },
+hasContent: function()
+{
+return true;
+},
 
-    _addBreakpoint: function(line)
-    {
-        var sourceID = null;
-        var closestStartingLine = 0;
-        var scripts = this.resource.scripts;
-        for (var i = 0; i < scripts.length; ++i) {
-            var script = scripts[i];
-            if (script.startingLine <= line && script.startingLine >= closestStartingLine) {
-                closestStartingLine = script.startingLine;
-                sourceID = script.sourceID;
-            }
-        }
+_contentLoaded: function(content)
+{
+var mimeType = this._canonicalMimeType(this.resource);
+this.sourceFrame.setContent(mimeType, content, this.resource.url);
+this._sourceFrameSetupFinished();
+},
 
-        if (WebInspector.panels.scripts) {
-            var breakpoint = new WebInspector.Breakpoint(this.resource.url, line, sourceID);
-            WebInspector.panels.scripts.addBreakpoint(breakpoint);
-        }
-    },
+_canonicalMimeType: function(resource)
+{
+return WebInspector.SourceView.DefaultMIMETypeForResourceType[resource.type] || resource.mimeType;
+},
 
-    _removeBreakpoint: function(breakpoint)
-    {
-        if (WebInspector.panels.scripts)
-            WebInspector.panels.scripts.removeBreakpoint(breakpoint);
-    },
+_resourceLoadingFinished: function(event)
+{
+this._frameNeedsSetup = true;
+this._sourceFrameSetup = false;
+if (this.visible)
+this.setupSourceFrameIfNeeded();
+this.resource.removeEventListener("finished", this._resourceLoadingFinished, this);
+},
 
-    // The rest of the methods in this prototype need to be generic enough to work with a ScriptView.
-    // The ScriptView prototype pulls these methods into it's prototype to avoid duplicate code.
 
-    searchCanceled: function()
-    {
-        this._currentSearchResultIndex = -1;
-        this._searchResults = [];
-        this.sourceFrame.clearMarkedRange();
-        delete this._delayedFindSearchMatches;
-    },
 
-    performSearch: function(query, finishedCallback)
-    {
-        // Call searchCanceled since it will reset everything we need before doing a new search.
-        this.searchCanceled();
 
-        this._searchFinishedCallback = finishedCallback;
+searchCanceled: function()
+{
+this._currentSearchResultIndex = -1;
+this._searchResults = [];
+this.sourceFrame.clearMarkedRange();
+delete this._delayedFindSearchMatches;
+},
 
-        function findSearchMatches(query, finishedCallback)
-        {
-            this._searchResults = this.sourceFrame.findSearchMatches(query);
-            if (this._searchResults)
-                finishedCallback(this, this._searchResults.length);
-        }
+performSearch: function(query, finishedCallback)
+{
 
-        if (!this._sourceFrameSetup) {
-            // The search is performed in _sourceFrameSetupFinished by calling _delayedFindSearchMatches.
-            this._delayedFindSearchMatches = findSearchMatches.bind(this, query, finishedCallback);
-            this.setupSourceFrameIfNeeded();
-            return;
-        }
+this.searchCanceled();
 
-        findSearchMatches.call(this, query, finishedCallback);
-    },
+this._searchFinishedCallback = finishedCallback;
 
-    jumpToFirstSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        this._currentSearchResultIndex = 0;
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+function findSearchMatches(query, finishedCallback)
+{
+this._searchResults = this.sourceFrame.findSearchMatches(query);
+if (this._searchResults)
+finishedCallback(this, this._searchResults.length);
+}
 
-    jumpToLastSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        this._currentSearchResultIndex = (this._searchResults.length - 1);
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+if (!this._sourceFrameSetup) {
 
-    jumpToNextSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        if (++this._currentSearchResultIndex >= this._searchResults.length)
-            this._currentSearchResultIndex = 0;
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+this._delayedFindSearchMatches = findSearchMatches.bind(this, query, finishedCallback);
+this.setupSourceFrameIfNeeded();
+return;
+}
 
-    jumpToPreviousSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        if (--this._currentSearchResultIndex < 0)
-            this._currentSearchResultIndex = (this._searchResults.length - 1);
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+findSearchMatches.call(this, query, finishedCallback);
+},
 
-    showingFirstSearchResult: function()
-    {
-        return (this._currentSearchResultIndex === 0);
-    },
+jumpToFirstSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+this._currentSearchResultIndex = 0;
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-    showingLastSearchResult: function()
-    {
-        return (this._searchResults && this._currentSearchResultIndex === (this._searchResults.length - 1));
-    },
+jumpToLastSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+this._currentSearchResultIndex = (this._searchResults.length - 1);
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-    revealLine: function(lineNumber)
-    {
-        this.setupSourceFrameIfNeeded();
-        this.sourceFrame.revealLine(lineNumber);
-    },
+jumpToNextSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+if (++this._currentSearchResultIndex >= this._searchResults.length)
+this._currentSearchResultIndex = 0;
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-    highlightLine: function(lineNumber)
-    {
-        this.setupSourceFrameIfNeeded();
-        this.sourceFrame.highlightLine(lineNumber);
-    },
+jumpToPreviousSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+if (--this._currentSearchResultIndex < 0)
+this._currentSearchResultIndex = (this._searchResults.length - 1);
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-    addMessage: function(msg)
-    {
-        this.sourceFrame.addMessage(msg);
-    },
+showingFirstSearchResult: function()
+{
+return (this._currentSearchResultIndex === 0);
+},
 
-    clearMessages: function()
-    {
-        this.sourceFrame.clearMessages();
-    },
+showingLastSearchResult: function()
+{
+return (this._searchResults && this._currentSearchResultIndex === (this._searchResults.length - 1));
+},
 
-    _jumpToSearchResult: function(index)
-    {
-        var foundRange = this._searchResults[index];
-        if (!foundRange)
-            return;
+revealLine: function(lineNumber)
+{
+this.setupSourceFrameIfNeeded();
+this.sourceFrame.revealLine(lineNumber);
+},
 
-        this.sourceFrame.markAndRevealRange(foundRange);
-    },
+highlightLine: function(lineNumber)
+{
+this.setupSourceFrameIfNeeded();
+this.sourceFrame.highlightLine(lineNumber);
+},
 
-    _sourceFrameSetupFinished: function()
-    {
-        this._sourceFrameSetup = true;
-        this.resize();
-        if (this._delayedFindSearchMatches) {
-            this._delayedFindSearchMatches();
-            delete this._delayedFindSearchMatches;
-        }
-    }
+addMessage: function(msg)
+{
+this.sourceFrame.addMessage(msg);
+},
+
+clearMessages: function()
+{
+this.sourceFrame.clearMessages();
+},
+
+_jumpToSearchResult: function(index)
+{
+var foundRange = this._searchResults[index];
+if (!foundRange)
+return;
+
+this.sourceFrame.markAndRevealRange(foundRange);
+},
+
+_sourceFrameSetupFinished: function()
+{
+this._sourceFrameSetup = true;
+this.resize();
+if (this._delayedFindSearchMatches) {
+this._delayedFindSearchMatches();
+delete this._delayedFindSearchMatches;
+}
+}
 }
 
 WebInspector.SourceView.prototype.__proto__ = WebInspector.ResourceView.prototype;
 
-/* FontView.js */
+WebInspector.ResourceFrameDelegateImpl = function(resource)
+{
+WebInspector.SourceFrameDelegate.call(this);
+this._resource = resource;
+}
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+WebInspector.ResourceFrameDelegateImpl.prototype = {
+canEditScripts: function()
+{
+return WebInspector.panels.scripts.canEditScripts() && this._resource.type === WebInspector.Resource.Type.Script;
+},
+
+editLineComplete: function(revertEditLineCallback, newContent)
+{
+this._resource.setContent(newContent, revertEditLineCallback);
+},
+
+scripts: function()
+{
+return this._resource.scripts;
+}
+}
+
+WebInspector.ResourceFrameDelegateImpl.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype;
+
+
+
+
 
 WebInspector.FontView = function(resource)
 {
-    WebInspector.ResourceView.call(this, resource);
+WebInspector.ResourceView.call(this, resource);
 
-    this.element.addStyleClass("font");
-
-    var uniqueFontName = "WebInspectorFontPreview" + this.resource.identifier;
-
-    this.fontStyleElement = document.createElement("style");
-    this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.url + "); }";
-    document.head.appendChild(this.fontStyleElement);
-
-    this.fontPreviewElement = document.createElement("div");
-    this.fontPreviewElement.className = "preview";
-    this.contentElement.appendChild(this.fontPreviewElement);
-
-    this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null);
-    this.fontPreviewElement.innerHTML = "ABCDEFGHIJKLM<br>NOPQRSTUVWXYZ<br>abcdefghijklm<br>nopqrstuvwxyz<br>1234567890";
-
-    this.updateFontPreviewSize();
+this.element.addStyleClass("font");
 }
 
 WebInspector.FontView.prototype = {
-    show: function(parentElement)
-    {
-        WebInspector.ResourceView.prototype.show.call(this, parentElement);
-        this.updateFontPreviewSize();
-    },
+hasContent: function()
+{
+return true;
+},
 
-    resize: function()
-    {
-        this.updateFontPreviewSize();
-    },
+_createContentIfNeeded: function()
+{
+if (this.fontPreviewElement)
+return;
 
-    updateFontPreviewSize: function ()
-    {
-        if (!this.fontPreviewElement || !this.visible)
-            return;
+var uniqueFontName = "WebInspectorFontPreview" + this.resource.identifier;
 
-        this.fontPreviewElement.removeStyleClass("preview");
+this.fontStyleElement = document.createElement("style");
+this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.resource.url + "); }";
+document.head.appendChild(this.fontStyleElement);
 
-        var measureFontSize = 50;
-        this.fontPreviewElement.style.setProperty("position", "absolute", null);
-        this.fontPreviewElement.style.setProperty("font-size", measureFontSize + "px", null);
-        this.fontPreviewElement.style.removeProperty("height");
+this.fontPreviewElement = document.createElement("div");
+this.element.appendChild(this.fontPreviewElement);
 
-        var height = this.fontPreviewElement.offsetHeight;
-        var width = this.fontPreviewElement.offsetWidth;
+this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null);
+this.fontPreviewElement.innerHTML = "ABCDEFGHIJKLM<br>NOPQRSTUVWXYZ<br>abcdefghijklm<br>nopqrstuvwxyz<br>1234567890";
+this._lineCount = this.fontPreviewElement.getElementsByTagName("br").length + 1;
 
-        var containerWidth = this.contentElement.offsetWidth;
+this.updateFontPreviewSize();
+},
 
-        // Subtract some padding. This should match the padding in the CSS plus room for the scrollbar.
-        containerWidth -= 40;
+show: function(parentElement)
+{
+WebInspector.ResourceView.prototype.show.call(this, parentElement);
+this._createContentIfNeeded();
+this.updateFontPreviewSize();
+},
 
-        if (!height || !width || !containerWidth) {
-            this.fontPreviewElement.style.removeProperty("font-size");
-            this.fontPreviewElement.style.removeProperty("position");
-            this.fontPreviewElement.addStyleClass("preview");
-            return;
-        }
+resize: function()
+{
+this.updateFontPreviewSize();
+WebInspector.ResourceView.prototype.resize.call(this);
+},
 
-        var lineCount = this.fontPreviewElement.getElementsByTagName("br").length + 1;
-        var realLineHeight = Math.floor(height / lineCount);
-        var fontSizeLineRatio = measureFontSize / realLineHeight;
-        var widthRatio = containerWidth / width;
-        var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 1;
+updateFontPreviewSize: function()
+{
+if (!this.fontPreviewElement || !this.visible)
+return;
 
-        this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null);
-        this.fontPreviewElement.style.setProperty("height", this.fontPreviewElement.offsetHeight + "px", null);
-        this.fontPreviewElement.style.removeProperty("position");
+const measureFontSize = 50;
+this.fontPreviewElement.style.setProperty("font-size", measureFontSize + "px", null);
+this.fontPreviewElement.style.setProperty("position", "absolute", null);
+this.fontPreviewElement.style.removeProperty("height");
 
-        this.fontPreviewElement.addStyleClass("preview");
-    }
+const height = this.fontPreviewElement.offsetHeight;
+const width = this.fontPreviewElement.offsetWidth;
+
+
+const containerWidth = this.element.offsetWidth - 50;
+
+if (!height || !width || !containerWidth) {
+this.fontPreviewElement.style.removeProperty("font-size");
+this.fontPreviewElement.style.removeProperty("position");
+return;
+}
+
+var realLineHeight = Math.floor(height / this._lineCount);
+var fontSizeLineRatio = measureFontSize / realLineHeight;
+var widthRatio = containerWidth / width;
+var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 2;
+
+this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null);
+this.fontPreviewElement.style.setProperty("height", this.fontPreviewElement.offsetHeight + "px", null);
+this.fontPreviewElement.style.removeProperty("position");
+}
 }
 
 WebInspector.FontView.prototype.__proto__ = WebInspector.ResourceView.prototype;
 
-/* ImageView.js */
 
-/*
- * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ImageView = function(resource)
 {
-    WebInspector.ResourceView.call(this, resource);
+WebInspector.ResourceView.call(this, resource);
 
-    this.element.addStyleClass("image");
-
-    var container = document.createElement("div");
-    container.className = "image";
-    this.contentElement.appendChild(container);
-
-    this.imagePreviewElement = document.createElement("img");
-    this.imagePreviewElement.addStyleClass("resource-image-view");
-    this.imagePreviewElement.setAttribute("src", this.resource.url);
-
-    container.appendChild(this.imagePreviewElement);
-
-    container = document.createElement("div");
-    container.className = "info";
-    this.contentElement.appendChild(container);
-
-    var imageNameElement = document.createElement("h1");
-    imageNameElement.className = "title";
-    imageNameElement.textContent = this.resource.displayName;
-    container.appendChild(imageNameElement);
-
-    var infoListElement = document.createElement("dl");
-    infoListElement.className = "infoList";
-
-    var imageProperties = [
-        { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", this.imagePreviewElement.naturalWidth, this.imagePreviewElement.height) },
-        { name: WebInspector.UIString("File size"), value: Number.bytesToString(this.resource.resourceSize, WebInspector.UIString.bind(WebInspector)) },
-        { name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
-    ];
-
-    var listHTML = '';
-    for (var i = 0; i < imageProperties.length; ++i)
-        listHTML += "<dt>" + imageProperties[i].name + "</dt><dd>" + imageProperties[i].value + "</dd>";
-
-    infoListElement.innerHTML = listHTML;
-    container.appendChild(infoListElement);
+this.element.addStyleClass("image");
 }
 
 WebInspector.ImageView.prototype = {
-    
+hasContent: function()
+{
+return true;
+},
+
+show: function(parentElement)
+{
+WebInspector.ResourceView.prototype.show.call(this, parentElement);
+this._createContentIfNeeded();
+},
+
+_createContentIfNeeded: function()
+{
+if (this._container)
+return;
+
+var imageContainer = document.createElement("div");
+imageContainer.className = "image";
+this.element.appendChild(imageContainer);
+
+var imagePreviewElement = document.createElement("img");
+imagePreviewElement.addStyleClass("resource-image-view");
+imageContainer.appendChild(imagePreviewElement);
+
+this._container = document.createElement("div");
+this._container.className = "info";
+this.element.appendChild(this._container);
+
+var imageNameElement = document.createElement("h1");
+imageNameElement.className = "title";
+imageNameElement.textContent = this.resource.displayName;
+this._container.appendChild(imageNameElement);
+
+var infoListElement = document.createElement("dl");
+infoListElement.className = "infoList";
+
+function onResourceContent(element, content)
+{
+imagePreviewElement.setAttribute("src", this.resource.contentURL);
+}
+this.resource.requestContent(onResourceContent.bind(this));
+
+
+function onImageLoad()
+{
+var content = this.resource.content;
+if (content)
+var resourceSize = this._base64ToSize(content);
+else
+var resourceSize = this.resource.resourceSize;
+
+var imageProperties = [
+{ name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", imagePreviewElement.naturalWidth, imagePreviewElement.naturalHeight) },
+{ name: WebInspector.UIString("File size"), value: Number.bytesToString(resourceSize, WebInspector.UIString) },
+{ name: WebInspector.UIString("MIME type"), value: this.resource.mimeType }
+];
+
+infoListElement.removeChildren();
+for (var i = 0; i < imageProperties.length; ++i) {
+var dt = document.createElement("dt");
+dt.textContent = imageProperties[i].name;
+infoListElement.appendChild(dt);
+var dd = document.createElement("dd");
+dd.textContent = imageProperties[i].value;
+infoListElement.appendChild(dd);
+}
+this._container.appendChild(infoListElement);
+}
+imagePreviewElement.addEventListener("load", onImageLoad.bind(this), false);
+},
+
+_base64ToSize: function(content)
+{
+if (!content.length)
+return 0;
+var size = (content.length || 0) * 3 / 4;
+if (content.length > 0 && content[content.length - 1] === "=")
+size--;
+if (content.length > 1 && content[content.length - 2] === "=")
+size--;
+return size;
+}
 }
 
 WebInspector.ImageView.prototype.__proto__ = WebInspector.ResourceView.prototype;
 
-/* DatabaseTableView.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.DatabaseTableView = function(database, tableName)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.database = database;
-    this.tableName = tableName;
+this.database = database;
+this.tableName = tableName;
 
-    this.element.addStyleClass("storage-view");
-    this.element.addStyleClass("table");
+this.element.addStyleClass("storage-view");
+this.element.addStyleClass("table");
 
-    this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
+this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
 }
 
 WebInspector.DatabaseTableView.prototype = {
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this.update();
-    },
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this.update();
+},
 
-    get statusBarItems()
-    {
-        return [this.refreshButton];
-    },
+get statusBarItems()
+{
+return [this.refreshButton.element];
+},
 
-    update: function()
-    {
-        this.database.executeSql("SELECT * FROM " + this.tableName, this._queryFinished.bind(this), this._queryError.bind(this));
-    },
+update: function()
+{
+this.database.executeSql("SELECT * FROM " + this.tableName, this._queryFinished.bind(this), this._queryError.bind(this));
+},
 
-    _queryFinished: function(result)
-    {
-        this.element.removeChildren();
+_queryFinished: function(columnNames, values)
+{
+this.element.removeChildren();
 
-        var dataGrid = WebInspector.panels.storage.dataGridForResult(result);
-        if (!dataGrid) {
-            var emptyMsgElement = document.createElement("div");
-            emptyMsgElement.className = "storage-table-empty";
-            emptyMsgElement.textContent = WebInspector.UIString("The “%s”\ntable is empty.", this.tableName);
-            this.element.appendChild(emptyMsgElement);
-            return;
-        }
+var dataGrid = WebInspector.panels.resources.dataGridForResult(columnNames, values);
+if (!dataGrid) {
+var emptyMsgElement = document.createElement("div");
+emptyMsgElement.className = "storage-empty-view";
+emptyMsgElement.textContent = WebInspector.UIString("The “%s”\ntable is empty.", this.tableName);
+this.element.appendChild(emptyMsgElement);
+return;
+}
 
-        this.element.appendChild(dataGrid.element);
-        dataGrid.autoSizeColumns(5);
-    },
+this.element.appendChild(dataGrid.element);
+dataGrid.autoSizeColumns(5);
+},
 
-    _queryError: function(error)
-    {
-        this.element.removeChildren();
+_queryError: function(error)
+{
+this.element.removeChildren();
 
-        var errorMsgElement = document.createElement("div");
-        errorMsgElement.className = "storage-table-error";
-        errorMsgElement.textContent = WebInspector.UIString("An error occurred trying to\nread the “%s” table.", this.tableName);
-        this.element.appendChild(errorMsgElement);
-    },
+var errorMsgElement = document.createElement("div");
+errorMsgElement.className = "storage-table-error";
+errorMsgElement.textContent = WebInspector.UIString("An error occurred trying to\nread the “%s” table.", this.tableName);
+this.element.appendChild(errorMsgElement);
+},
 
-    _refreshButtonClicked: function(event)
-    {
-        this.update();
-    }
+_refreshButtonClicked: function(event)
+{
+this.update();
+}
 }
 
 WebInspector.DatabaseTableView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* DatabaseQueryView.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.DatabaseQueryView = function(database)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.database = database;
+this.database = database;
 
-    this.element.addStyleClass("storage-view");
-    this.element.addStyleClass("query");
-    this.element.addStyleClass("monospace");
-    this.element.tabIndex = 0;
+this.element.addStyleClass("storage-view");
+this.element.addStyleClass("query");
+this.element.addStyleClass("monospace");
+this.element.tabIndex = 0;
 
-    this.element.addEventListener("selectstart", this._selectStart.bind(this), false);
+this.element.addEventListener("selectstart", this._selectStart.bind(this), false);
 
-    this.promptElement = document.createElement("div");
-    this.promptElement.className = "database-query-prompt";
-    this.promptElement.appendChild(document.createElement("br"));
-    this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
-    this.element.appendChild(this.promptElement);
+this.promptElement = document.createElement("div");
+this.promptElement.className = "database-query-prompt";
+this.promptElement.appendChild(document.createElement("br"));
+this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
+this.element.appendChild(this.promptElement);
 
-    this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), " ");
+this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), " ");
 }
 
 WebInspector.DatabaseQueryView.prototype = {
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
 
-        function moveBackIfOutside()
-        {
-            if (!this.prompt.isCaretInsidePrompt() && window.getSelection().isCollapsed)
-                this.prompt.moveCaretToEndOfPrompt();
-        }
+function moveBackIfOutside()
+{
+if (!this.prompt.isCaretInsidePrompt() && window.getSelection().isCollapsed)
+this.prompt.moveCaretToEndOfPrompt();
+}
 
-        setTimeout(moveBackIfOutside.bind(this), 0);
-    },
+setTimeout(moveBackIfOutside.bind(this), 0);
+},
 
-    completions: function(wordRange, bestMatchOnly, completionsReadyCallback)
-    {
-        var prefix = wordRange.toString().toLowerCase();
-        if (!prefix.length)
-            return;
+completions: function(wordRange, bestMatchOnly, completionsReadyCallback)
+{
+var prefix = wordRange.toString().toLowerCase();
+if (!prefix.length)
+return;
 
-        var results = [];
+var results = [];
 
-        function accumulateMatches(textArray)
-        {
-            if (bestMatchOnly && results.length)
-                return;
-            for (var i = 0; i < textArray.length; ++i) {
-                var text = textArray[i].toLowerCase();
-                if (text.length < prefix.length)
-                    continue;
-                if (text.indexOf(prefix) !== 0)
-                    continue;
-                results.push(textArray[i]);
-                if (bestMatchOnly)
-                    return;
-            }
-        }
-        
-        function tableNamesCallback(tableNames)
-        {
-            accumulateMatches(tableNames.map(function(name) { return name + " " }));
-            accumulateMatches(["SELECT ", "FROM ", "WHERE ", "LIMIT ", "DELETE FROM ", "CREATE ", "DROP ", "TABLE ", "INDEX ", "UPDATE ", "INSERT INTO ", "VALUES ("]);
+function accumulateMatches(textArray)
+{
+if (bestMatchOnly && results.length)
+return;
+for (var i = 0; i < textArray.length; ++i) {
+var text = textArray[i].toLowerCase();
+if (text.length < prefix.length)
+continue;
+if (text.indexOf(prefix) !== 0)
+continue;
+results.push(textArray[i]);
+if (bestMatchOnly)
+return;
+}
+}
 
-            completionsReadyCallback(results);
-        }
-        this.database.getTableNames(tableNamesCallback);
-    },
+function tableNamesCallback(tableNames)
+{
+accumulateMatches(tableNames.map(function(name) { return name + " " }));
+accumulateMatches(["SELECT ", "FROM ", "WHERE ", "LIMIT ", "DELETE FROM ", "CREATE ", "DROP ", "TABLE ", "INDEX ", "UPDATE ", "INSERT INTO ", "VALUES ("]);
 
-    _promptKeyDown: function(event)
-    {
-        if (isEnterKey(event)) {
-            this._enterKeyPressed(event);
-            return;
-        }
-    },
+completionsReadyCallback(results);
+}
+this.database.getTableNames(tableNamesCallback);
+},
 
-    _selectStart: function(event)
-    {
-        if (this._selectionTimeout)
-            clearTimeout(this._selectionTimeout);
+_promptKeyDown: function(event)
+{
+if (isEnterKey(event)) {
+this._enterKeyPressed(event);
+return;
+}
+},
 
-        this.prompt.clearAutoComplete();
+_selectStart: function(event)
+{
+if (this._selectionTimeout)
+clearTimeout(this._selectionTimeout);
 
-        function moveBackIfOutside()
-        {
-            delete this._selectionTimeout;
-            if (!this.prompt.isCaretInsidePrompt() && window.getSelection().isCollapsed)
-                this.prompt.moveCaretToEndOfPrompt();
-            this.prompt.autoCompleteSoon();
-        }
+this.prompt.clearAutoComplete();
 
-        this._selectionTimeout = setTimeout(moveBackIfOutside.bind(this), 100);
-    },
+function moveBackIfOutside()
+{
+delete this._selectionTimeout;
+if (!this.prompt.isCaretInsidePrompt() && window.getSelection().isCollapsed)
+this.prompt.moveCaretToEndOfPrompt();
+this.prompt.autoCompleteSoon();
+}
 
-    _enterKeyPressed: function(event)
-    {
-        event.preventDefault();
-        event.stopPropagation();
+this._selectionTimeout = setTimeout(moveBackIfOutside.bind(this), 100);
+},
 
-        this.prompt.clearAutoComplete(true);
+_enterKeyPressed: function(event)
+{
+event.preventDefault();
+event.stopPropagation();
 
-        var query = this.prompt.text;
-        if (!query.length)
-            return;
+this.prompt.clearAutoComplete(true);
 
-        this.prompt.history.push(query);
-        this.prompt.historyOffset = 0;
-        this.prompt.text = "";
+var query = this.prompt.text;
+if (!query.length)
+return;
 
-        this.database.executeSql(query, this._queryFinished.bind(this, query), this._queryError.bind(this, query));
-    },
+this.prompt.history.push(query);
+this.prompt.historyOffset = 0;
+this.prompt.text = "";
 
-    _queryFinished: function(query, result)
-    {
-        var dataGrid = WebInspector.panels.storage.dataGridForResult(result);
-        if (!dataGrid)
-            return;
-        dataGrid.element.addStyleClass("inline");
-        this._appendQueryResult(query, dataGrid.element);
-        dataGrid.autoSizeColumns(5);
+this.database.executeSql(query, this._queryFinished.bind(this, query), this._queryError.bind(this, query));
+},
 
-        if (query.match(/^create /i) || query.match(/^drop table /i))
-            WebInspector.panels.storage.updateDatabaseTables(this.database);
-    },
+_queryFinished: function(query, columnNames, values)
+{
+var dataGrid = WebInspector.panels.resources.dataGridForResult(columnNames, values);
+var trimmedQuery = query.trim();
 
-    _queryError: function(query, error)
-    {
-        if (error.code == 1)
-            var message = error.message;
-        else if (error.code == 2)
-            var message = WebInspector.UIString("Database no longer has expected version.");
-        else
-            var message = WebInspector.UIString("An unexpected error %s occurred.", error.code);
+if (dataGrid) {
+dataGrid.element.addStyleClass("inline");
+this._appendQueryResult(trimmedQuery, dataGrid.element);
+dataGrid.autoSizeColumns(5);            
+}
 
-        this._appendQueryResult(query, message, "error");
-    },
+if (trimmedQuery.match(/^create /i) || trimmedQuery.match(/^drop table /i))
+WebInspector.panels.resources.updateDatabaseTables(this.database);
+},
 
-    _appendQueryResult: function(query, result, resultClassName)
-    {
-        var element = document.createElement("div");
-        element.className = "database-user-query";
+_queryError: function(query, error)
+{
+if (error.message)
+var message = error.message;
+else if (error.code == 2)
+var message = WebInspector.UIString("Database no longer has expected version.");
+else
+var message = WebInspector.UIString("An unexpected error %s occurred.", error.code);
 
-        var commandTextElement = document.createElement("span");
-        commandTextElement.className = "database-query-text";
-        commandTextElement.textContent = query;
-        element.appendChild(commandTextElement);
+this._appendQueryResult(query, message, "error");
+},
 
-        var resultElement = document.createElement("div");
-        resultElement.className = "database-query-result";
+_appendQueryResult: function(query, result, resultClassName)
+{
+var element = document.createElement("div");
+element.className = "database-user-query";
 
-        if (resultClassName)
-            resultElement.addStyleClass(resultClassName);
+var commandTextElement = document.createElement("span");
+commandTextElement.className = "database-query-text";
+commandTextElement.textContent = query;
+element.appendChild(commandTextElement);
 
-        if (typeof result === "string" || result instanceof String)
-            resultElement.textContent = result;
-        else if (result && result.nodeName)
-            resultElement.appendChild(result);
+var resultElement = document.createElement("div");
+resultElement.className = "database-query-result";
 
-        if (resultElement.childNodes.length)
-            element.appendChild(resultElement);
+if (resultClassName)
+resultElement.addStyleClass(resultClassName);
 
-        this.element.insertBefore(element, this.promptElement);
-        this.promptElement.scrollIntoView(false);
-    }
+if (typeof result === "string" || result instanceof String)
+resultElement.textContent = result;
+else if (result && result.nodeName)
+resultElement.appendChild(result);
+
+if (resultElement.childNodes.length)
+element.appendChild(resultElement);
+
+this.element.insertBefore(element, this.promptElement);
+this.promptElement.scrollIntoView(false);
+}
 }
 
 WebInspector.DatabaseQueryView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* ScriptView.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+
+
 
 WebInspector.ScriptView = function(script)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.element.addStyleClass("script-view");
+this.element.addStyleClass("script-view");
 
-    this.script = script;
+this.script = script;
 
-    this._frameNeedsSetup = true;
-    this._sourceFrameSetup = false;
-    this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), this._removeBreakpoint.bind(this));
+this._frameNeedsSetup = true;
+this._sourceFrameSetup = false;
+var delegate = new WebInspector.ScriptFrameDelegateImpl(this.script);
+this.sourceFrame = new WebInspector.SourceFrame(this.element, delegate);
+
+this.script.addEventListener(WebInspector.Script.Events.SourceChanged, this._scriptSourceChanged, this);
 }
 
 WebInspector.ScriptView.prototype = {
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this.setupSourceFrameIfNeeded();
-        this.sourceFrame.visible = true;
-        this.resize();
-    },
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this.setupSourceFrameIfNeeded();
+this.sourceFrame.visible = true;
+this.resize();
+},
 
-    setupSourceFrameIfNeeded: function()
-    {
-        if (!this._frameNeedsSetup)
-            return;
+setupSourceFrameIfNeeded: function()
+{
+if (!this._frameNeedsSetup)
+return;
+delete this._frameNeedsSetup;
 
-        this.attach();
+this.attach();
 
-        var prefix = "";
-        for (var i = 0; i < this.script.startingLine - 1; ++i)
-            prefix += "\n";
+if (this.script.source)
+this._sourceFrameSetupFinished();
+else
+InspectorBackend.getScriptSource(this.script.sourceID, this._didGetScriptSource.bind(this));
+},
 
-        this.sourceFrame.setContent("text/javascript", prefix + this.script.source);
-        this._sourceFrameSetup = true;
-        delete this._frameNeedsSetup;
-    },
+_didGetScriptSource: function(source)
+{
+this.script.source = source || WebInspector.UIString("<source is not available>");
+this._sourceFrameSetupFinished();
+},
 
-    attach: function()
-    {
-        if (!this.element.parentNode)
-            document.getElementById("script-resource-views").appendChild(this.element);
-    },
+_sourceFrameSetupFinished: function()
+{
+this.sourceFrame.setContent("text/javascript", this._prependWhitespace(this.script.source));
+this._sourceFrameSetup = true;
+},
 
-    _addBreakpoint: function(line)
-    {
-        var breakpoint = new WebInspector.Breakpoint(this.script.sourceURL, line, this.script.sourceID);
-        WebInspector.panels.scripts.addBreakpoint(breakpoint);
-    },
+_prependWhitespace: function(content) {
+var prefix = "";
+for (var i = 0; i < this.script.startingLine - 1; ++i)
+prefix += "\n";
+return prefix + content;
+},
 
-    // The follow methods are pulled from SourceView, since they are
-    // generic and work with ScriptView just fine.
+attach: function()
+{
+if (!this.element.parentNode)
+document.getElementById("script-resource-views").appendChild(this.element);
+},
 
-    hide: WebInspector.SourceView.prototype.hide,
-    revealLine: WebInspector.SourceView.prototype.revealLine,
-    highlightLine: WebInspector.SourceView.prototype.highlightLine,
-    addMessage: WebInspector.SourceView.prototype.addMessage,
-    clearMessages: WebInspector.SourceView.prototype.clearMessages,
-    searchCanceled: WebInspector.SourceView.prototype.searchCanceled,
-    performSearch: WebInspector.SourceView.prototype.performSearch,
-    jumpToFirstSearchResult: WebInspector.SourceView.prototype.jumpToFirstSearchResult,
-    jumpToLastSearchResult: WebInspector.SourceView.prototype.jumpToLastSearchResult,
-    jumpToNextSearchResult: WebInspector.SourceView.prototype.jumpToNextSearchResult,
-    jumpToPreviousSearchResult: WebInspector.SourceView.prototype.jumpToPreviousSearchResult,
-    showingFirstSearchResult: WebInspector.SourceView.prototype.showingFirstSearchResult,
-    showingLastSearchResult: WebInspector.SourceView.prototype.showingLastSearchResult,
-    _jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult,
-    _sourceFrameSetupFinished: WebInspector.SourceView.prototype._sourceFrameSetupFinished,
-    _removeBreakpoint: WebInspector.SourceView.prototype._removeBreakpoint,
-    resize: WebInspector.SourceView.prototype.resize
+_scriptSourceChanged: function(event)
+{
+this.sourceFrame.updateContent(this._prependWhitespace(this.script.source));
+},
+
+
+
+
+hide: WebInspector.SourceView.prototype.hide,
+revealLine: WebInspector.SourceView.prototype.revealLine,
+highlightLine: WebInspector.SourceView.prototype.highlightLine,
+addMessage: WebInspector.SourceView.prototype.addMessage,
+clearMessages: WebInspector.SourceView.prototype.clearMessages,
+searchCanceled: WebInspector.SourceView.prototype.searchCanceled,
+performSearch: WebInspector.SourceView.prototype.performSearch,
+jumpToFirstSearchResult: WebInspector.SourceView.prototype.jumpToFirstSearchResult,
+jumpToLastSearchResult: WebInspector.SourceView.prototype.jumpToLastSearchResult,
+jumpToNextSearchResult: WebInspector.SourceView.prototype.jumpToNextSearchResult,
+jumpToPreviousSearchResult: WebInspector.SourceView.prototype.jumpToPreviousSearchResult,
+showingFirstSearchResult: WebInspector.SourceView.prototype.showingFirstSearchResult,
+showingLastSearchResult: WebInspector.SourceView.prototype.showingLastSearchResult,
+_jumpToSearchResult: WebInspector.SourceView.prototype._jumpToSearchResult,
+resize: WebInspector.SourceView.prototype.resize
 }
 
 WebInspector.ScriptView.prototype.__proto__ = WebInspector.View.prototype;
 
-/* ProfileDataGridTree.js */
+WebInspector.ScriptFrameDelegateImpl = function(script)
+{
+WebInspector.SourceFrameDelegate.call(this);
+this._script = script;
+}
 
-/*
- * Copyright (C) 2009 280 North Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+WebInspector.ScriptFrameDelegateImpl.prototype = {
+canEditScripts: function()
+{
+return WebInspector.panels.scripts.canEditScripts();
+},
+
+editLineComplete: function(revertEditLineCallback, newContent)
+{
+this._script.source = newContent;
+},
+
+scripts: function()
+{
+return [this._script];
+}
+}
+
+WebInspector.ScriptFrameDelegateImpl.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype;
+
+
+
+
 
 WebInspector.ProfileDataGridNode = function(profileView, profileNode, owningTree, hasChildren)
 {
-    this.profileView = profileView;
-    this.profileNode = profileNode;
+this.profileView = profileView;
+this.profileNode = profileNode;
 
-    WebInspector.DataGridNode.call(this, null, hasChildren);
+WebInspector.DataGridNode.call(this, null, hasChildren);
 
-    this.addEventListener("populate", this._populate, this);
+this.addEventListener("populate", this._populate, this);
 
-    this.tree = owningTree;
+this.tree = owningTree;
 
-    this.childrenByCallUID = {};
-    this.lastComparator = null;
+this.childrenByCallUID = {};
+this.lastComparator = null;
 
-    this.callUID = profileNode.callUID;
-    this.selfTime = profileNode.selfTime;
-    this.totalTime = profileNode.totalTime;
-    this.functionName = profileNode.functionName;
-    this.numberOfCalls = profileNode.numberOfCalls;
-    this.url = profileNode.url;
+this.callUID = profileNode.callUID;
+this.selfTime = profileNode.selfTime;
+this.totalTime = profileNode.totalTime;
+this.functionName = profileNode.functionName;
+this.numberOfCalls = profileNode.numberOfCalls;
+this.url = profileNode.url;
 }
 
 WebInspector.ProfileDataGridNode.prototype = {
-    get data()
-    {
-        function formatMilliseconds(time)
-        {
-            return Number.secondsToString(time / 1000, WebInspector.UIString.bind(WebInspector), !Preferences.samplingCPUProfiler);
-        }
+get data()
+{
+function formatMilliseconds(time)
+{
+return Number.secondsToString(time / 1000, WebInspector.UIString, !Preferences.samplingCPUProfiler);
+}
 
-        var data = {};
+var data = {};
 
-        data["function"] = this.functionName;
-        data["calls"] = this.numberOfCalls;
+data["function"] = this.functionName;
+data["calls"] = this.numberOfCalls;
 
-        if (this.profileView.showSelfTimeAsPercent)
-            data["self"] = WebInspector.UIString("%.2f%%", this.selfPercent);
-        else
-            data["self"] = formatMilliseconds(this.selfTime);
+if (this.profileView.showSelfTimeAsPercent)
+data["self"] = WebInspector.UIString("%.2f%%", this.selfPercent);
+else
+data["self"] = formatMilliseconds(this.selfTime);
 
-        if (this.profileView.showTotalTimeAsPercent)
-            data["total"] = WebInspector.UIString("%.2f%%", this.totalPercent);
-        else
-            data["total"] = formatMilliseconds(this.totalTime);
+if (this.profileView.showTotalTimeAsPercent)
+data["total"] = WebInspector.UIString("%.2f%%", this.totalPercent);
+else
+data["total"] = formatMilliseconds(this.totalTime);
 
-        if (this.profileView.showAverageTimeAsPercent)
-            data["average"] = WebInspector.UIString("%.2f%%", this.averagePercent);
-        else
-            data["average"] = formatMilliseconds(this.averageTime);
+if (this.profileView.showAverageTimeAsPercent)
+data["average"] = WebInspector.UIString("%.2f%%", this.averagePercent);
+else
+data["average"] = formatMilliseconds(this.averageTime);
 
-        return data;
-    },
+return data;
+},
 
-    createCell: function(columnIdentifier)
-    {
-        var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
+createCell: function(columnIdentifier)
+{
+var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
 
-        if (columnIdentifier === "self" && this._searchMatchedSelfColumn)
-            cell.addStyleClass("highlight");
-        else if (columnIdentifier === "total" && this._searchMatchedTotalColumn)
-            cell.addStyleClass("highlight");
-        else if (columnIdentifier === "average" && this._searchMatchedAverageColumn)
-            cell.addStyleClass("highlight");
-        else if (columnIdentifier === "calls" && this._searchMatchedCallsColumn)
-            cell.addStyleClass("highlight");
+if (columnIdentifier === "self" && this._searchMatchedSelfColumn)
+cell.addStyleClass("highlight");
+else if (columnIdentifier === "total" && this._searchMatchedTotalColumn)
+cell.addStyleClass("highlight");
+else if (columnIdentifier === "average" && this._searchMatchedAverageColumn)
+cell.addStyleClass("highlight");
+else if (columnIdentifier === "calls" && this._searchMatchedCallsColumn)
+cell.addStyleClass("highlight");
 
-        if (columnIdentifier !== "function")
-            return cell;
+if (columnIdentifier !== "function")
+return cell;
 
-        if (this.profileNode._searchMatchedFunctionColumn)
-            cell.addStyleClass("highlight");
+if (this.profileNode._searchMatchedFunctionColumn)
+cell.addStyleClass("highlight");
 
-        if (this.profileNode.url) {
-            var fileName = WebInspector.displayNameForURL(this.profileNode.url);
+if (this.profileNode.url) {
+var lineNumber;
+if (this.profileNode.lineNumber > 0)
+lineNumber = this.profileNode.lineNumber;
+var urlElement = WebInspector.linkifyResourceAsNode(this.profileNode.url, "scripts", lineNumber, "profile-node-file");
+cell.insertBefore(urlElement, cell.firstChild);
+}
 
-            var urlElement = document.createElement("a");
-            urlElement.className = "profile-node-file webkit-html-resource-link";
-            urlElement.href = this.profileNode.url;
-            urlElement.lineNumber = this.profileNode.lineNumber;
-            urlElement.preferredPanel = "scripts";
+return cell;
+},
 
-            if (this.profileNode.lineNumber > 0)
-                urlElement.textContent = fileName + ":" + this.profileNode.lineNumber;
-            else
-                urlElement.textContent = fileName;
+select: function(supressSelectedEvent)
+{
+WebInspector.DataGridNode.prototype.select.call(this, supressSelectedEvent);
+this.profileView._dataGridNodeSelected(this);
+},
 
-            cell.insertBefore(urlElement, cell.firstChild);
-        }
+deselect: function(supressDeselectedEvent)
+{
+WebInspector.DataGridNode.prototype.deselect.call(this, supressDeselectedEvent);
+this.profileView._dataGridNodeDeselected(this);
+},
 
-        return cell;
-    },
+sort: function(  comparator,   force)
+{
+var gridNodeGroups = [[this]];
 
-    select: function(supressSelectedEvent)
-    {
-        WebInspector.DataGridNode.prototype.select.call(this, supressSelectedEvent);
-        this.profileView._dataGridNodeSelected(this);
-    },
+for (var gridNodeGroupIndex = 0; gridNodeGroupIndex < gridNodeGroups.length; ++gridNodeGroupIndex) {
+var gridNodes = gridNodeGroups[gridNodeGroupIndex];
+var count = gridNodes.length;
 
-    deselect: function(supressDeselectedEvent)
-    {
-        WebInspector.DataGridNode.prototype.deselect.call(this, supressDeselectedEvent);
-        this.profileView._dataGridNodeDeselected(this);
-    },
+for (var index = 0; index < count; ++index) {
+var gridNode = gridNodes[index];
 
-    sort: function(/*Function*/ comparator, /*Boolean*/ force)
-    {
-        var gridNodeGroups = [[this]];
 
-        for (var gridNodeGroupIndex = 0; gridNodeGroupIndex < gridNodeGroups.length; ++gridNodeGroupIndex) {
-            var gridNodes = gridNodeGroups[gridNodeGroupIndex];
-            var count = gridNodes.length;
 
-            for (var index = 0; index < count; ++index) {
-                var gridNode = gridNodes[index];
+if (!force && (!gridNode.expanded || gridNode.lastComparator === comparator)) {
+if (gridNode.children.length)
+gridNode.shouldRefreshChildren = true;
+continue;
+}
 
-                // If the grid node is collapsed, then don't sort children (save operation for later).
-                // If the grid node has the same sorting as previously, then there is no point in sorting it again.
-                if (!force && (!gridNode.expanded || gridNode.lastComparator === comparator)) {
-                    if (gridNode.children.length)
-                        gridNode.shouldRefreshChildren = true;
-                    continue;
-                }
+gridNode.lastComparator = comparator;
 
-                gridNode.lastComparator = comparator;
+var children = gridNode.children;
+var childCount = children.length;
 
-                var children = gridNode.children;
-                var childCount = children.length;
+if (childCount) {
+children.sort(comparator);
 
-                if (childCount) {
-                    children.sort(comparator);
+for (var childIndex = 0; childIndex < childCount; ++childIndex)
+children[childIndex]._recalculateSiblings(childIndex);
 
-                    for (var childIndex = 0; childIndex < childCount; ++childIndex)
-                        children[childIndex]._recalculateSiblings(childIndex);
+gridNodeGroups.push(children);
+}
+}
+}
+},
 
-                    gridNodeGroups.push(children);
-                }
-            }
-        }
-    },
+insertChild: function(  profileDataGridNode, index)
+{
+WebInspector.DataGridNode.prototype.insertChild.call(this, profileDataGridNode, index);
 
-    insertChild: function(/*ProfileDataGridNode*/ profileDataGridNode, index)
-    {
-        WebInspector.DataGridNode.prototype.insertChild.call(this, profileDataGridNode, index);
+this.childrenByCallUID[profileDataGridNode.callUID] = profileDataGridNode;
+},
 
-        this.childrenByCallUID[profileDataGridNode.callUID] = profileDataGridNode;
-    },
+removeChild: function(  profileDataGridNode)
+{
+WebInspector.DataGridNode.prototype.removeChild.call(this, profileDataGridNode);
 
-    removeChild: function(/*ProfileDataGridNode*/ profileDataGridNode)
-    {
-        WebInspector.DataGridNode.prototype.removeChild.call(this, profileDataGridNode);
+delete this.childrenByCallUID[profileDataGridNode.callUID];
+},
 
-        delete this.childrenByCallUID[profileDataGridNode.callUID];
-    },
+removeChildren: function(  profileDataGridNode)
+{
+WebInspector.DataGridNode.prototype.removeChildren.call(this);
 
-    removeChildren: function(/*ProfileDataGridNode*/ profileDataGridNode)
-    {
-        WebInspector.DataGridNode.prototype.removeChildren.call(this);
+this.childrenByCallUID = {};
+},
 
-        this.childrenByCallUID = {};
-    },
+findChild: function(  node)
+{
+if (!node)
+return null;
+return this.childrenByCallUID[node.callUID];
+},
 
-    findChild: function(/*Node*/ node)
-    {
-        if (!node)
-            return null;
-        return this.childrenByCallUID[node.callUID];
-    },
+get averageTime()
+{
+return this.selfTime / Math.max(1, this.numberOfCalls);
+},
 
-    get averageTime()
-    {
-        return this.selfTime / Math.max(1, this.numberOfCalls);
-    },
+get averagePercent()
+{
+return this.averageTime / this.tree.totalTime * 100.0;
+},
 
-    get averagePercent()
-    {
-        return this.averageTime / this.tree.totalTime * 100.0;
-    },
+get selfPercent()
+{
+return this.selfTime / this.tree.totalTime * 100.0;
+},
 
-    get selfPercent()
-    {
-        return this.selfTime / this.tree.totalTime * 100.0;
-    },
+get totalPercent()
+{
+return this.totalTime / this.tree.totalTime * 100.0;
+},
 
-    get totalPercent()
-    {
-        return this.totalTime / this.tree.totalTime * 100.0;
-    },
+get _parent()
+{
+return this.parent !== this.dataGrid ? this.parent : this.tree;
+},
 
-    get _parent()
-    {
-        return this.parent !== this.dataGrid ? this.parent : this.tree;
-    },
+_populate: function(event)
+{
+this._sharedPopulate();
 
-    _populate: function(event)
-    {
-        this._sharedPopulate();
+if (this._parent) {
+var currentComparator = this._parent.lastComparator;
 
-        if (this._parent) {
-            var currentComparator = this._parent.lastComparator;
+if (currentComparator)
+this.sort(currentComparator, true);
+}
 
-            if (currentComparator)
-                this.sort(currentComparator, true);
-        }
+if (this.removeEventListener)
+this.removeEventListener("populate", this._populate, this);
+},
 
-        if (this.removeEventListener)
-            this.removeEventListener("populate", this._populate, this);
-    },
 
-    // When focusing and collapsing we modify lots of nodes in the tree.
-    // This allows us to restore them all to their original state when we revert.
-    _save: function()
-    {
-        if (this._savedChildren)
-            return;
 
-        this._savedSelfTime = this.selfTime;
-        this._savedTotalTime = this.totalTime;
-        this._savedNumberOfCalls = this.numberOfCalls;
+_save: function()
+{
+if (this._savedChildren)
+return;
 
-        this._savedChildren = this.children.slice();
-    },
+this._savedSelfTime = this.selfTime;
+this._savedTotalTime = this.totalTime;
+this._savedNumberOfCalls = this.numberOfCalls;
 
-    // When focusing and collapsing we modify lots of nodes in the tree.
-    // This allows us to restore them all to their original state when we revert.
-    _restore: function()
-    {
-        if (!this._savedChildren)
-            return;
+this._savedChildren = this.children.slice();
+},
 
-        this.selfTime = this._savedSelfTime;
-        this.totalTime = this._savedTotalTime;
-        this.numberOfCalls = this._savedNumberOfCalls;
 
-        this.removeChildren();
 
-        var children = this._savedChildren;
-        var count = children.length;
+_restore: function()
+{
+if (!this._savedChildren)
+return;
 
-        for (var index = 0; index < count; ++index) {
-            children[index]._restore();
-            this.appendChild(children[index]);
-        }
-    },
+this.selfTime = this._savedSelfTime;
+this.totalTime = this._savedTotalTime;
+this.numberOfCalls = this._savedNumberOfCalls;
 
-    _merge: function(child, shouldAbsorb)
-    {
-        this.selfTime += child.selfTime;
+this.removeChildren();
 
-        if (!shouldAbsorb) {
-            this.totalTime += child.totalTime;
-            this.numberOfCalls += child.numberOfCalls;
-        }
+var children = this._savedChildren;
+var count = children.length;
 
-        var children = this.children.slice();
+for (var index = 0; index < count; ++index) {
+children[index]._restore();
+this.appendChild(children[index]);
+}
+},
 
-        this.removeChildren();
+_merge: function(child, shouldAbsorb)
+{
+this.selfTime += child.selfTime;
 
-        var count = children.length;
+if (!shouldAbsorb) {
+this.totalTime += child.totalTime;
+this.numberOfCalls += child.numberOfCalls;
+}
 
-        for (var index = 0; index < count; ++index) {
-            if (!shouldAbsorb || children[index] !== child)
-                this.appendChild(children[index]);
-        }
+var children = this.children.slice();
 
-        children = child.children.slice();
-        count = children.length;
+this.removeChildren();
 
-        for (var index = 0; index < count; ++index) {
-            var orphanedChild = children[index],
-                existingChild = this.childrenByCallUID[orphanedChild.callUID];
+var count = children.length;
 
-            if (existingChild)
-                existingChild._merge(orphanedChild, false);
-            else
-                this.appendChild(orphanedChild);
-        }
-    }
+for (var index = 0; index < count; ++index) {
+if (!shouldAbsorb || children[index] !== child)
+this.appendChild(children[index]);
+}
+
+children = child.children.slice();
+count = children.length;
+
+for (var index = 0; index < count; ++index) {
+var orphanedChild = children[index],
+existingChild = this.childrenByCallUID[orphanedChild.callUID];
+
+if (existingChild)
+existingChild._merge(orphanedChild, false);
+else
+this.appendChild(orphanedChild);
+}
+}
 }
 
 WebInspector.ProfileDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
 
 WebInspector.ProfileDataGridTree = function(profileView, profileNode)
 {
-    this.tree = this;
-    this.children = [];
+this.tree = this;
+this.children = [];
 
-    this.profileView = profileView;
+this.profileView = profileView;
 
-    this.totalTime = profileNode.totalTime;
-    this.lastComparator = null;
+this.totalTime = profileNode.totalTime;
+this.lastComparator = null;
 
-    this.childrenByCallUID = {};
+this.childrenByCallUID = {};
 }
 
 WebInspector.ProfileDataGridTree.prototype = {
-    get expanded()
-    {
-        return true;
-    },
+get expanded()
+{
+return true;
+},
 
-    appendChild: function(child)
-    {
-        this.insertChild(child, this.children.length);
-    },
+appendChild: function(child)
+{
+this.insertChild(child, this.children.length);
+},
 
-    insertChild: function(child, index)
-    {
-        this.children.splice(index, 0, child);
-        this.childrenByCallUID[child.callUID] = child;
-    },
+insertChild: function(child, index)
+{
+this.children.splice(index, 0, child);
+this.childrenByCallUID[child.callUID] = child;
+},
 
-    removeChildren: function()
-    {
-        this.children = [];
-        this.childrenByCallUID = {};
-    },
+removeChildren: function()
+{
+this.children = [];
+this.childrenByCallUID = {};
+},
 
-    findChild: WebInspector.ProfileDataGridNode.prototype.findChild,
-    sort: WebInspector.ProfileDataGridNode.prototype.sort,
+findChild: WebInspector.ProfileDataGridNode.prototype.findChild,
+sort: WebInspector.ProfileDataGridNode.prototype.sort,
 
-    _save: function()
-    {
-        if (this._savedChildren)
-            return;
+_save: function()
+{
+if (this._savedChildren)
+return;
 
-        this._savedTotalTime = this.totalTime;
-        this._savedChildren = this.children.slice();
-    },
+this._savedTotalTime = this.totalTime;
+this._savedChildren = this.children.slice();
+},
 
-    restore: function()
-    {
-        if (!this._savedChildren)
-            return;
+restore: function()
+{
+if (!this._savedChildren)
+return;
 
-        this.children = this._savedChildren;
-        this.totalTime = this._savedTotalTime;
+this.children = this._savedChildren;
+this.totalTime = this._savedTotalTime;
 
-        var children = this.children;
-        var count = children.length;
+var children = this.children;
+var count = children.length;
 
-        for (var index = 0; index < count; ++index)
-            children[index]._restore();
+for (var index = 0; index < count; ++index)
+children[index]._restore();
 
-        this._savedChildren = null;
-    }
+this._savedChildren = null;
+}
 }
 
 WebInspector.ProfileDataGridTree.propertyComparators = [{}, {}];
 
-WebInspector.ProfileDataGridTree.propertyComparator = function(/*String*/ property, /*Boolean*/ isAscending)
+WebInspector.ProfileDataGridTree.propertyComparator = function(  property,   isAscending)
 {
-    var comparator = this.propertyComparators[(isAscending ? 1 : 0)][property];
+var comparator = this.propertyComparators[(isAscending ? 1 : 0)][property];
 
-    if (!comparator) {
-        if (isAscending) {
-            comparator = function(lhs, rhs)
-            {
-                if (lhs[property] < rhs[property])
-                    return -1;
+if (!comparator) {
+if (isAscending) {
+comparator = function(lhs, rhs)
+{
+if (lhs[property] < rhs[property])
+return -1;
 
-                if (lhs[property] > rhs[property])
-                    return 1;
+if (lhs[property] > rhs[property])
+return 1;
 
-                return 0;
-            }
-        } else {
-            comparator = function(lhs, rhs)
-            {
-                if (lhs[property] > rhs[property])
-                    return -1;
+return 0;
+}
+} else {
+comparator = function(lhs, rhs)
+{
+if (lhs[property] > rhs[property])
+return -1;
 
-                if (lhs[property] < rhs[property])
-                    return 1;
+if (lhs[property] < rhs[property])
+return 1;
 
-                return 0;
-            }
-        }
-
-        this.propertyComparators[(isAscending ? 1 : 0)][property] = comparator;
-    }
-
-    return comparator;
+return 0;
+}
 }
 
-/* BottomUpProfileDataGridTree.js */
+this.propertyComparators[(isAscending ? 1 : 0)][property] = comparator;
+}
 
-/*
- * Copyright (C) 2009 280 North Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+return comparator;
+}
 
-// Bottom Up Profiling shows the entire callstack backwards:
-// The root node is a representation of each individual function called, and each child of that node represents
-// a reverse-callstack showing how many of those calls came from it. So, unlike top-down, the statistics in
-// each child still represent the root node. We have to be particularly careful of recursion with this mode
-// because a root node can represent itself AND an ancestor.
 
-WebInspector.BottomUpProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*BottomUpProfileDataGridTree*/ owningTree)
+
+
+
+
+
+
+
+
+
+WebInspector.BottomUpProfileDataGridNode = function(  profileView,   profileNode,   owningTree)
 {
-    WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode));
+WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode));
 
-    this._remainingNodeInfos = [];
+this._remainingNodeInfos = [];
 }
 
 WebInspector.BottomUpProfileDataGridNode.prototype = {
-    _takePropertiesFromProfileDataGridNode: function(/*ProfileDataGridNode*/ profileDataGridNode)
-    {
-        this._save();
+_takePropertiesFromProfileDataGridNode: function(  profileDataGridNode)
+{
+this._save();
 
-        this.selfTime = profileDataGridNode.selfTime;
-        this.totalTime = profileDataGridNode.totalTime;
-        this.numberOfCalls = profileDataGridNode.numberOfCalls;
-    },
+this.selfTime = profileDataGridNode.selfTime;
+this.totalTime = profileDataGridNode.totalTime;
+this.numberOfCalls = profileDataGridNode.numberOfCalls;
+},
 
-    // When focusing, we keep just the members of the callstack.
-    _keepOnlyChild: function(/*ProfileDataGridNode*/ child)
-    {
-        this._save();
 
-        this.removeChildren();
-        this.appendChild(child);
-    },
+_keepOnlyChild: function(  child)
+{
+this._save();
 
-    _exclude: function(aCallUID)
-    {
-        if (this._remainingNodeInfos)
-            this._populate();
+this.removeChildren();
+this.appendChild(child);
+},
 
-        this._save();
+_exclude: function(aCallUID)
+{
+if (this._remainingNodeInfos)
+this._populate();
 
-        var children = this.children;
-        var index = this.children.length;
+this._save();
 
-        while (index--)
-            children[index]._exclude(aCallUID);
+var children = this.children;
+var index = this.children.length;
 
-        var child = this.childrenByCallUID[aCallUID];
+while (index--)
+children[index]._exclude(aCallUID);
 
-        if (child)
-            this._merge(child, true);
-    },
+var child = this.childrenByCallUID[aCallUID];
 
-    _restore: function()
-    {
-        WebInspector.ProfileDataGridNode.prototype._restore();
+if (child)
+this._merge(child, true);
+},
 
-        if (!this.children.length)
-            this.hasChildren = this._willHaveChildren();
-    },
+_restore: function()
+{
+WebInspector.ProfileDataGridNode.prototype._restore();
 
-    _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb)
-    {
-        this.selfTime -= child.selfTime;
+if (!this.children.length)
+this.hasChildren = this._willHaveChildren();
+},
 
-        WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb);
-    },
+_merge: function(  child,   shouldAbsorb)
+{
+this.selfTime -= child.selfTime;
 
-    _sharedPopulate: function()
-    {
-        var remainingNodeInfos = this._remainingNodeInfos;
-        var count = remainingNodeInfos.length;
+WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb);
+},
 
-        for (var index = 0; index < count; ++index) {
-            var nodeInfo = remainingNodeInfos[index];
-            var ancestor = nodeInfo.ancestor;
-            var focusNode = nodeInfo.focusNode;
-            var child = this.findChild(ancestor);
+_sharedPopulate: function()
+{
+var remainingNodeInfos = this._remainingNodeInfos;
+var count = remainingNodeInfos.length;
 
-            // If we already have this child, then merge the data together.
-            if (child) {
-                var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor;
+for (var index = 0; index < count; ++index) {
+var nodeInfo = remainingNodeInfos[index];
+var ancestor = nodeInfo.ancestor;
+var focusNode = nodeInfo.focusNode;
+var child = this.findChild(ancestor);
 
-                child.selfTime += focusNode.selfTime;
-                child.numberOfCalls += focusNode.numberOfCalls;
 
-                if (!totalTimeAccountedFor)
-                    child.totalTime += focusNode.totalTime;
-            } else {
-                // If not, add it as a true ancestor.
-                // In heavy mode, we take our visual identity from ancestor node...
-                var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree);
+if (child) {
+var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor;
 
-                if (ancestor !== focusNode) {
-                    // but the actual statistics from the "root" node (bottom of the callstack).
-                    child.selfTime = focusNode.selfTime;
-                    child.totalTime = focusNode.totalTime;
-                    child.numberOfCalls = focusNode.numberOfCalls;
-                }
+child.selfTime += focusNode.selfTime;
+child.numberOfCalls += focusNode.numberOfCalls;
 
-                this.appendChild(child);
-            }
+if (!totalTimeAccountedFor)
+child.totalTime += focusNode.totalTime;
+} else {
 
-            var parent = ancestor.parent;
-            if (parent && parent.parent) {
-                nodeInfo.ancestor = parent;
-                child._remainingNodeInfos.push(nodeInfo);
-            }
-        }
 
-        delete this._remainingNodeInfos;
-    },
+var child = new WebInspector.BottomUpProfileDataGridNode(this.profileView, ancestor, this.tree);
 
-    _willHaveChildren: function(profileNode)
-    {
-        profileNode = profileNode || this.profileNode;
-        // In bottom up mode, our parents are our children since we display an inverted tree.
-        // However, we don't want to show the very top parent since it is redundant.
-        return !!(profileNode.parent && profileNode.parent.parent);
-    }
+if (ancestor !== focusNode) {
+
+child.selfTime = focusNode.selfTime;
+child.totalTime = focusNode.totalTime;
+child.numberOfCalls = focusNode.numberOfCalls;
+}
+
+this.appendChild(child);
+}
+
+var parent = ancestor.parent;
+if (parent && parent.parent) {
+nodeInfo.ancestor = parent;
+child._remainingNodeInfos.push(nodeInfo);
+}
+}
+
+delete this._remainingNodeInfos;
+},
+
+_willHaveChildren: function(profileNode)
+{
+profileNode = profileNode || this.profileNode;
+
+
+return !!(profileNode.parent && profileNode.parent.parent);
+}
 }
 
 WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype;
 
-WebInspector.BottomUpProfileDataGridTree = function(/*ProfileView*/ aProfileView, /*ProfileNode*/ aProfileNode)
+WebInspector.BottomUpProfileDataGridTree = function(  aProfileView,   aProfileNode)
 {
-    WebInspector.ProfileDataGridTree.call(this, aProfileView, aProfileNode);
+WebInspector.ProfileDataGridTree.call(this, aProfileView, aProfileNode);
 
-    // Iterate each node in pre-order.
-    var profileNodeUIDs = 0;
-    var profileNodeGroups = [[], [aProfileNode]];
-    var visitedProfileNodesForCallUID = {};
 
-    this._remainingNodeInfos = [];
+var profileNodeUIDs = 0;
+var profileNodeGroups = [[], [aProfileNode]];
+var visitedProfileNodesForCallUID = {};
 
-    for (var profileNodeGroupIndex = 0; profileNodeGroupIndex < profileNodeGroups.length; ++profileNodeGroupIndex) {
-        var parentProfileNodes = profileNodeGroups[profileNodeGroupIndex];
-        var profileNodes = profileNodeGroups[++profileNodeGroupIndex];
-        var count = profileNodes.length;
+this._remainingNodeInfos = [];
 
-        for (var index = 0; index < count; ++index) {
-            var profileNode = profileNodes[index];
+for (var profileNodeGroupIndex = 0; profileNodeGroupIndex < profileNodeGroups.length; ++profileNodeGroupIndex) {
+var parentProfileNodes = profileNodeGroups[profileNodeGroupIndex];
+var profileNodes = profileNodeGroups[++profileNodeGroupIndex];
+var count = profileNodes.length;
 
-            if (!profileNode.UID)
-                profileNode.UID = ++profileNodeUIDs;
+for (var index = 0; index < count; ++index) {
+var profileNode = profileNodes[index];
 
-            if (profileNode.head && profileNode !== profileNode.head) {
-                // The total time of this ancestor is accounted for if we're in any form of recursive cycle.
-                var visitedNodes = visitedProfileNodesForCallUID[profileNode.callUID];
-                var totalTimeAccountedFor = false;
+if (!profileNode.UID)
+profileNode.UID = ++profileNodeUIDs;
 
-                if (!visitedNodes) {
-                    visitedNodes = {}
-                    visitedProfileNodesForCallUID[profileNode.callUID] = visitedNodes;
-                } else {
-                    // The total time for this node has already been accounted for iff one of it's parents has already been visited.
-                    // We can do this check in this style because we are traversing the tree in pre-order.
-                    var parentCount = parentProfileNodes.length;
-                    for (var parentIndex = 0; parentIndex < parentCount; ++parentIndex) {
-                        if (visitedNodes[parentProfileNodes[parentIndex].UID]) {
-                            totalTimeAccountedFor = true;
-                            break;
-                        }
-                    }
-                }
+if (profileNode.head && profileNode !== profileNode.head) {
 
-                visitedNodes[profileNode.UID] = true;
+var visitedNodes = visitedProfileNodesForCallUID[profileNode.callUID];
+var totalTimeAccountedFor = false;
 
-                this._remainingNodeInfos.push({ ancestor:profileNode, focusNode:profileNode, totalTimeAccountedFor:totalTimeAccountedFor });
-            }
+if (!visitedNodes) {
+visitedNodes = {}
+visitedProfileNodesForCallUID[profileNode.callUID] = visitedNodes;
+} else {
 
-            var children = profileNode.children;
-            if (children.length) {
-                profileNodeGroups.push(parentProfileNodes.concat([profileNode]))
-                profileNodeGroups.push(children);
-            }
-        }
-    }
 
-    // Populate the top level nodes.
-    WebInspector.BottomUpProfileDataGridNode.prototype._populate.call(this);
+var parentCount = parentProfileNodes.length;
+for (var parentIndex = 0; parentIndex < parentCount; ++parentIndex) {
+if (visitedNodes[parentProfileNodes[parentIndex].UID]) {
+totalTimeAccountedFor = true;
+break;
+}
+}
+}
 
-    return this;
+visitedNodes[profileNode.UID] = true;
+
+this._remainingNodeInfos.push({ ancestor:profileNode, focusNode:profileNode, totalTimeAccountedFor:totalTimeAccountedFor });
+}
+
+var children = profileNode.children;
+if (children.length) {
+profileNodeGroups.push(parentProfileNodes.concat([profileNode]))
+profileNodeGroups.push(children);
+}
+}
+}
+
+
+WebInspector.BottomUpProfileDataGridNode.prototype._populate.call(this);
+
+return this;
 }
 
 WebInspector.BottomUpProfileDataGridTree.prototype = {
-    // When focusing, we keep the entire callstack up to this ancestor.
-    focus: function(/*ProfileDataGridNode*/ profileDataGridNode)
-    {
-        if (!profileDataGridNode)
-            return;
 
-        this._save();
+focus: function(  profileDataGridNode)
+{
+if (!profileDataGridNode)
+return;
 
-        var currentNode = profileDataGridNode;
-        var focusNode = profileDataGridNode;
+this._save();
 
-        while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) {
-            currentNode._takePropertiesFromProfileDataGridNode(profileDataGridNode);
+var currentNode = profileDataGridNode;
+var focusNode = profileDataGridNode;
 
-            focusNode = currentNode;
-            currentNode = currentNode.parent;
+while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) {
+currentNode._takePropertiesFromProfileDataGridNode(profileDataGridNode);
 
-            if (currentNode instanceof WebInspector.ProfileDataGridNode)
-                currentNode._keepOnlyChild(focusNode);
-        }
+focusNode = currentNode;
+currentNode = currentNode.parent;
 
-        this.children = [focusNode];
-        this.totalTime = profileDataGridNode.totalTime;
-    },
+if (currentNode instanceof WebInspector.ProfileDataGridNode)
+currentNode._keepOnlyChild(focusNode);
+}
 
-    exclude: function(/*ProfileDataGridNode*/ profileDataGridNode)
-    {
-        if (!profileDataGridNode)
-            return;
+this.children = [focusNode];
+this.totalTime = profileDataGridNode.totalTime;
+},
 
-        this._save();
+exclude: function(  profileDataGridNode)
+{
+if (!profileDataGridNode)
+return;
 
-        var excludedCallUID = profileDataGridNode.callUID;
-        var excludedTopLevelChild = this.childrenByCallUID[excludedCallUID];
+this._save();
 
-        // If we have a top level node that is excluded, get rid of it completely (not keeping children),
-        // since bottom up data relies entirely on the root node.
-        if (excludedTopLevelChild)
-            this.children.remove(excludedTopLevelChild);
+var excludedCallUID = profileDataGridNode.callUID;
+var excludedTopLevelChild = this.childrenByCallUID[excludedCallUID];
 
-        var children = this.children;
-        var count = children.length;
 
-        for (var index = 0; index < count; ++index)
-            children[index]._exclude(excludedCallUID);
 
-        if (this.lastComparator)
-            this.sort(this.lastComparator, true);
-    },
+if (excludedTopLevelChild)
+this.children.remove(excludedTopLevelChild);
 
-    _sharedPopulate: WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate
+var children = this.children;
+var count = children.length;
+
+for (var index = 0; index < count; ++index)
+children[index]._exclude(excludedCallUID);
+
+if (this.lastComparator)
+this.sort(this.lastComparator, true);
+},
+
+_sharedPopulate: WebInspector.BottomUpProfileDataGridNode.prototype._sharedPopulate
 }
 
 WebInspector.BottomUpProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype;
 
 
-/* TopDownProfileDataGridTree.js */
 
-/*
- * Copyright (C) 2009 280 North Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.TopDownProfileDataGridNode = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode, /*TopDownProfileDataGridTree*/ owningTree)
+
+
+WebInspector.TopDownProfileDataGridNode = function(  profileView,   profileNode,   owningTree)
 {
-    var hasChildren = (profileNode.children && profileNode.children.length);
+var hasChildren = (profileNode.children && profileNode.children.length);
 
-    WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren);
+WebInspector.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, hasChildren);
 
-    this._remainingChildren = profileNode.children;
+this._remainingChildren = profileNode.children;
 }
 
 WebInspector.TopDownProfileDataGridNode.prototype = {
-    _sharedPopulate: function()
-    {
-        var children = this._remainingChildren;
-        var childrenLength = children.length;
+_sharedPopulate: function()
+{
+var children = this._remainingChildren;
+var childrenLength = children.length;
 
-        for (var i = 0; i < childrenLength; ++i)
-            this.appendChild(new WebInspector.TopDownProfileDataGridNode(this.profileView, children[i], this.tree));
+for (var i = 0; i < childrenLength; ++i)
+this.appendChild(new WebInspector.TopDownProfileDataGridNode(this.profileView, children[i], this.tree));
 
-        this._remainingChildren = null;
-    },
+this._remainingChildren = null;
+},
 
-    _exclude: function(aCallUID)
-    {
-        if (this._remainingChildren)
-            this._populate();
+_exclude: function(aCallUID)
+{
+if (this._remainingChildren)
+this._populate();
 
-        this._save();
+this._save();
 
-        var children = this.children;
-        var index = this.children.length;
+var children = this.children;
+var index = this.children.length;
 
-        while (index--)
-            children[index]._exclude(aCallUID);
+while (index--)
+children[index]._exclude(aCallUID);
 
-        var child = this.childrenByCallUID[aCallUID];
+var child = this.childrenByCallUID[aCallUID];
 
-        if (child)
-            this._merge(child, true);
-    }
+if (child)
+this._merge(child, true);
+}
 }
 
 WebInspector.TopDownProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype;
 
-WebInspector.TopDownProfileDataGridTree = function(/*ProfileView*/ profileView, /*ProfileNode*/ profileNode)
+WebInspector.TopDownProfileDataGridTree = function(  profileView,   profileNode)
 {
-    WebInspector.ProfileDataGridTree.call(this, profileView, profileNode);
+WebInspector.ProfileDataGridTree.call(this, profileView, profileNode);
 
-    this._remainingChildren = profileNode.children;
+this._remainingChildren = profileNode.children;
 
-    WebInspector.TopDownProfileDataGridNode.prototype._populate.call(this);
+WebInspector.TopDownProfileDataGridNode.prototype._populate.call(this);
 }
 
 WebInspector.TopDownProfileDataGridTree.prototype = {
-    focus: function(/*ProfileDataGridNode*/ profileDataGrideNode)
-    {
-        if (!profileDataGrideNode)
-            return;
+focus: function(  profileDataGrideNode)
+{
+if (!profileDataGrideNode)
+return;
 
-        this._save();
-        profileDataGrideNode.savePosition();
+this._save();
+profileDataGrideNode.savePosition();
 
-        this.children = [profileDataGrideNode];
-        this.totalTime = profileDataGrideNode.totalTime;
-    },
+this.children = [profileDataGrideNode];
+this.totalTime = profileDataGrideNode.totalTime;
+},
 
-    exclude: function(/*ProfileDataGridNode*/ profileDataGrideNode)
-    {
-        if (!profileDataGrideNode)
-            return;
+exclude: function(  profileDataGrideNode)
+{
+if (!profileDataGrideNode)
+return;
 
-        this._save();
+this._save();
 
-        var excludedCallUID = profileDataGrideNode.callUID;
+var excludedCallUID = profileDataGrideNode.callUID;
 
-        WebInspector.TopDownProfileDataGridNode.prototype._exclude.call(this, excludedCallUID);
+WebInspector.TopDownProfileDataGridNode.prototype._exclude.call(this, excludedCallUID);
 
-        if (this.lastComparator)
-            this.sort(this.lastComparator, true);
-    },
+if (this.lastComparator)
+this.sort(this.lastComparator, true);
+},
 
-    restore: function()
-    {
-        if (!this._savedChildren)
-            return;
+restore: function()
+{
+if (!this._savedChildren)
+return;
 
-        this.children[0].restorePosition();
+this.children[0].restorePosition();
 
-        WebInspector.ProfileDataGridTree.prototype.restore.call(this);
-    },
+WebInspector.ProfileDataGridTree.prototype.restore.call(this);
+},
 
-    _merge: WebInspector.TopDownProfileDataGridNode.prototype._merge,
+_merge: WebInspector.TopDownProfileDataGridNode.prototype._merge,
 
-    _sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate
+_sharedPopulate: WebInspector.TopDownProfileDataGridNode.prototype._sharedPopulate
 }
 
 WebInspector.TopDownProfileDataGridTree.prototype.__proto__ = WebInspector.ProfileDataGridTree.prototype;
 
-/* ProfileView.js */
 
-/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-// FIXME: Rename the file.
+
+
+
 
 WebInspector.CPUProfileView = function(profile)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.element.addStyleClass("profile-view");
+this.element.addStyleClass("profile-view");
 
-    this.showSelfTimeAsPercent = true;
-    this.showTotalTimeAsPercent = true;
-    this.showAverageTimeAsPercent = true;
+this.showSelfTimeAsPercent = true;
+this.showTotalTimeAsPercent = true;
+this.showAverageTimeAsPercent = true;
 
-    var columns = { "self": { title: WebInspector.UIString("Self"), width: "72px", sort: "descending", sortable: true },
-                    "total": { title: WebInspector.UIString("Total"), width: "72px", sortable: true },
-                    "average": { title: WebInspector.UIString("Average"), width: "72px", sortable: true },
-                    "calls": { title: WebInspector.UIString("Calls"), width: "54px", sortable: true },
-                    "function": { title: WebInspector.UIString("Function"), disclosure: true, sortable: true } };
+var columns = { "self": { title: WebInspector.UIString("Self"), width: "72px", sort: "descending", sortable: true },
+"total": { title: WebInspector.UIString("Total"), width: "72px", sortable: true },
+"average": { title: WebInspector.UIString("Average"), width: "72px", sortable: true },
+"calls": { title: WebInspector.UIString("Calls"), width: "54px", sortable: true },
+"function": { title: WebInspector.UIString("Function"), disclosure: true, sortable: true } };
 
-    if (Preferences.samplingCPUProfiler) {
-        delete columns.average;
-        delete columns.calls;
-    }
+if (Preferences.samplingCPUProfiler) {
+delete columns.average;
+delete columns.calls;
+}
 
-    this.dataGrid = new WebInspector.DataGrid(columns);
-    this.dataGrid.addEventListener("sorting changed", this._sortData, this);
-    this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
-    this.element.appendChild(this.dataGrid.element);
+this.dataGrid = new WebInspector.DataGrid(columns);
+this.dataGrid.addEventListener("sorting changed", this._sortData, this);
+this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
+this.element.appendChild(this.dataGrid.element);
 
-    this.viewSelectElement = document.createElement("select");
-    this.viewSelectElement.className = "status-bar-item";
-    this.viewSelectElement.addEventListener("change", this._changeView.bind(this), false);
-    this.view = "Heavy";
+this.viewSelectElement = document.createElement("select");
+this.viewSelectElement.className = "status-bar-item";
+this.viewSelectElement.addEventListener("change", this._changeView.bind(this), false);
+this.view = "Heavy";
 
-    var heavyViewOption = document.createElement("option");
-    heavyViewOption.label = WebInspector.UIString("Heavy (Bottom Up)");
-    var treeViewOption = document.createElement("option");
-    treeViewOption.label = WebInspector.UIString("Tree (Top Down)");
-    this.viewSelectElement.appendChild(heavyViewOption);
-    this.viewSelectElement.appendChild(treeViewOption);
+var heavyViewOption = document.createElement("option");
+heavyViewOption.label = WebInspector.UIString("Heavy (Bottom Up)");
+var treeViewOption = document.createElement("option");
+treeViewOption.label = WebInspector.UIString("Tree (Top Down)");
+this.viewSelectElement.appendChild(heavyViewOption);
+this.viewSelectElement.appendChild(treeViewOption);
 
-    this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
-    this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
+this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
+this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
 
-    this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("Focus selected function."), "focus-profile-node-status-bar-item");
-    this.focusButton.disabled = true;
-    this.focusButton.addEventListener("click", this._focusClicked.bind(this), false);
+this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("Focus selected function."), "focus-profile-node-status-bar-item");
+this.focusButton.disabled = true;
+this.focusButton.addEventListener("click", this._focusClicked.bind(this), false);
 
-    this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."), "exclude-profile-node-status-bar-item");
-    this.excludeButton.disabled = true;
-    this.excludeButton.addEventListener("click", this._excludeClicked.bind(this), false);
+this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."), "exclude-profile-node-status-bar-item");
+this.excludeButton.disabled = true;
+this.excludeButton.addEventListener("click", this._excludeClicked.bind(this), false);
 
-    this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("Restore all functions."), "reset-profile-status-bar-item");
-    this.resetButton.visible = false;
-    this.resetButton.addEventListener("click", this._resetClicked.bind(this), false);
+this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("Restore all functions."), "reset-profile-status-bar-item");
+this.resetButton.visible = false;
+this.resetButton.addEventListener("click", this._resetClicked.bind(this), false);
 
-    this.profile = profile;
+this.profile = profile;
 
-    var self = this;
-    function profileCallback(profile)
-    {
-        self.profile = profile;
-        self._assignParentsInProfile();
-      
-        self.profileDataGridTree = self.bottomUpProfileDataGridTree;
-        self.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator("selfTime", false));
-     
-        self.refresh();
-     
-        self._updatePercentButton();
-    }
+var self = this;
+function profileCallback(profile)
+{
+self.profile.head = profile.head;
+self._assignParentsInProfile();
 
-    var callId = WebInspector.Callback.wrap(profileCallback);
-    InspectorBackend.getProfile(callId, this.profile.uid);
+self.profileDataGridTree = self.bottomUpProfileDataGridTree;
+self.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator("selfTime", false));
+
+self.refresh();
+
+self._updatePercentButton();
+}
+
+InspectorBackend.getProfile(this.profile.typeId, this.profile.uid, profileCallback);
 }
 
 WebInspector.CPUProfileView.prototype = {
-    get statusBarItems()
-    {
-        return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
-    },
+get statusBarItems()
+{
+return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
+},
 
-    get profile()
-    {
-        return this._profile;
-    },
+get profile()
+{
+return this._profile;
+},
 
-    set profile(profile)
-    {
-        this._profile = profile;
-    },
+set profile(profile)
+{
+this._profile = profile;
+},
 
-    get bottomUpProfileDataGridTree()
-    {
-        if (!this._bottomUpProfileDataGridTree)
-            this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(this, this.profile.head);
-        return this._bottomUpProfileDataGridTree;
-    },
+get bottomUpProfileDataGridTree()
+{
+if (!this._bottomUpProfileDataGridTree)
+this._bottomUpProfileDataGridTree = new WebInspector.BottomUpProfileDataGridTree(this, this.profile.head);
+return this._bottomUpProfileDataGridTree;
+},
 
-    get topDownProfileDataGridTree()
-    {
-        if (!this._topDownProfileDataGridTree)
-            this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(this, this.profile.head);
-        return this._topDownProfileDataGridTree;
-    },
+get topDownProfileDataGridTree()
+{
+if (!this._topDownProfileDataGridTree)
+this._topDownProfileDataGridTree = new WebInspector.TopDownProfileDataGridTree(this, this.profile.head);
+return this._topDownProfileDataGridTree;
+},
 
-    get currentTree()
-    {
-        return this._currentTree;
-    },
+get currentTree()
+{
+return this._currentTree;
+},
 
-    set currentTree(tree)
-    {
-        this._currentTree = tree;
-        this.refresh();
-    },
+set currentTree(tree)
+{
+this._currentTree = tree;
+this.refresh();
+},
 
-    get topDownTree()
-    {
-        if (!this._topDownTree) {
-            this._topDownTree = WebInspector.TopDownTreeFactory.create(this.profile.head);
-            this._sortProfile(this._topDownTree);
-        }
+get topDownTree()
+{
+if (!this._topDownTree) {
+this._topDownTree = WebInspector.TopDownTreeFactory.create(this.profile.head);
+this._sortProfile(this._topDownTree);
+}
 
-        return this._topDownTree;
-    },
+return this._topDownTree;
+},
 
-    get bottomUpTree()
-    {
-        if (!this._bottomUpTree) {
-            this._bottomUpTree = WebInspector.BottomUpTreeFactory.create(this.profile.head);
-            this._sortProfile(this._bottomUpTree);
-        }
+get bottomUpTree()
+{
+if (!this._bottomUpTree) {
+this._bottomUpTree = WebInspector.BottomUpTreeFactory.create(this.profile.head);
+this._sortProfile(this._bottomUpTree);
+}
 
-        return this._bottomUpTree;
-    },
+return this._bottomUpTree;
+},
 
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this.dataGrid.updateWidths();
-    },
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this.dataGrid.updateWidths();
+},
 
-    hide: function()
-    {
-        WebInspector.View.prototype.hide.call(this);
-        this._currentSearchResultIndex = -1;
-    },
+hide: function()
+{
+WebInspector.View.prototype.hide.call(this);
+this._currentSearchResultIndex = -1;
+},
 
-    resize: function()
-    {
-        if (this.dataGrid)
-            this.dataGrid.updateWidths();
-    },
+resize: function()
+{
+if (this.dataGrid)
+this.dataGrid.updateWidths();
+},
 
-    refresh: function()
-    {
-        var selectedProfileNode = this.dataGrid.selectedNode ? this.dataGrid.selectedNode.profileNode : null;
+refresh: function()
+{
+var selectedProfileNode = this.dataGrid.selectedNode ? this.dataGrid.selectedNode.profileNode : null;
 
-        this.dataGrid.removeChildren();
+this.dataGrid.removeChildren();
 
-        var children = this.profileDataGridTree.children;
-        var count = children.length;
+var children = this.profileDataGridTree.children;
+var count = children.length;
 
-        for (var index = 0; index < count; ++index)
-            this.dataGrid.appendChild(children[index]);
+for (var index = 0; index < count; ++index)
+this.dataGrid.appendChild(children[index]);
 
-        if (selectedProfileNode)
-            selectedProfileNode.selected = true;
-    },
+if (selectedProfileNode)
+selectedProfileNode.selected = true;
+},
 
-    refreshVisibleData: function()
-    {
-        var child = this.dataGrid.children[0];
-        while (child) {
-            child.refresh();
-            child = child.traverseNextNode(false, null, true);
-        }
-    },
+refreshVisibleData: function()
+{
+var child = this.dataGrid.children[0];
+while (child) {
+child.refresh();
+child = child.traverseNextNode(false, null, true);
+}
+},
 
-    refreshShowAsPercents: function()
-    {
-        this._updatePercentButton();
-        this.refreshVisibleData();
-    },
+refreshShowAsPercents: function()
+{
+this._updatePercentButton();
+this.refreshVisibleData();
+},
 
-    searchCanceled: function()
-    {
-        if (this._searchResults) {
-            for (var i = 0; i < this._searchResults.length; ++i) {
-                var profileNode = this._searchResults[i].profileNode;
+searchCanceled: function()
+{
+if (this._searchResults) {
+for (var i = 0; i < this._searchResults.length; ++i) {
+var profileNode = this._searchResults[i].profileNode;
 
-                delete profileNode._searchMatchedSelfColumn;
-                delete profileNode._searchMatchedTotalColumn;
-                delete profileNode._searchMatchedCallsColumn;
-                delete profileNode._searchMatchedFunctionColumn;
+delete profileNode._searchMatchedSelfColumn;
+delete profileNode._searchMatchedTotalColumn;
+delete profileNode._searchMatchedCallsColumn;
+delete profileNode._searchMatchedFunctionColumn;
 
-                profileNode.refresh();
-            }
-        }
+profileNode.refresh();
+}
+}
 
-        delete this._searchFinishedCallback;
-        this._currentSearchResultIndex = -1;
-        this._searchResults = [];
-    },
+delete this._searchFinishedCallback;
+this._currentSearchResultIndex = -1;
+this._searchResults = [];
+},
 
-    performSearch: function(query, finishedCallback)
-    {
-        // Call searchCanceled since it will reset everything we need before doing a new search.
-        this.searchCanceled();
+performSearch: function(query, finishedCallback)
+{
 
-        query = query.trim();
+this.searchCanceled();
 
-        if (!query.length)
-            return;
+query = query.trim();
 
-        this._searchFinishedCallback = finishedCallback;
+if (!query.length)
+return;
 
-        var greaterThan = (query.indexOf(">") === 0);
-        var lessThan = (query.indexOf("<") === 0);
-        var equalTo = (query.indexOf("=") === 0 || ((greaterThan || lessThan) && query.indexOf("=") === 1));
-        var percentUnits = (query.lastIndexOf("%") === (query.length - 1));
-        var millisecondsUnits = (query.length > 2 && query.lastIndexOf("ms") === (query.length - 2));
-        var secondsUnits = (!millisecondsUnits && query.lastIndexOf("s") === (query.length - 1));
+this._searchFinishedCallback = finishedCallback;
 
-        var queryNumber = parseFloat(query);
-        if (greaterThan || lessThan || equalTo) {
-            if (equalTo && (greaterThan || lessThan))
-                queryNumber = parseFloat(query.substring(2));
-            else
-                queryNumber = parseFloat(query.substring(1));
-        }
+var greaterThan = (query.indexOf(">") === 0);
+var lessThan = (query.indexOf("<") === 0);
+var equalTo = (query.indexOf("=") === 0 || ((greaterThan || lessThan) && query.indexOf("=") === 1));
+var percentUnits = (query.lastIndexOf("%") === (query.length - 1));
+var millisecondsUnits = (query.length > 2 && query.lastIndexOf("ms") === (query.length - 2));
+var secondsUnits = (!millisecondsUnits && query.lastIndexOf("s") === (query.length - 1));
 
-        var queryNumberMilliseconds = (secondsUnits ? (queryNumber * 1000) : queryNumber);
+var queryNumber = parseFloat(query);
+if (greaterThan || lessThan || equalTo) {
+if (equalTo && (greaterThan || lessThan))
+queryNumber = parseFloat(query.substring(2));
+else
+queryNumber = parseFloat(query.substring(1));
+}
 
-        // Make equalTo implicitly true if it wasn't specified there is no other operator.
-        if (!isNaN(queryNumber) && !(greaterThan || lessThan))
-            equalTo = true;
+var queryNumberMilliseconds = (secondsUnits ? (queryNumber * 1000) : queryNumber);
 
-        function matchesQuery(/*ProfileDataGridNode*/ profileDataGridNode)
-        {
-            delete profileDataGridNode._searchMatchedSelfColumn;
-            delete profileDataGridNode._searchMatchedTotalColumn;
-            delete profileDataGridNode._searchMatchedAverageColumn;
-            delete profileDataGridNode._searchMatchedCallsColumn;
-            delete profileDataGridNode._searchMatchedFunctionColumn;
 
-            if (percentUnits) {
-                if (lessThan) {
-                    if (profileDataGridNode.selfPercent < queryNumber)
-                        profileDataGridNode._searchMatchedSelfColumn = true;
-                    if (profileDataGridNode.totalPercent < queryNumber)
-                        profileDataGridNode._searchMatchedTotalColumn = true;
-                    if (profileDataGridNode.averagePercent < queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedAverageColumn = true;
-                } else if (greaterThan) {
-                    if (profileDataGridNode.selfPercent > queryNumber)
-                        profileDataGridNode._searchMatchedSelfColumn = true;
-                    if (profileDataGridNode.totalPercent > queryNumber)
-                        profileDataGridNode._searchMatchedTotalColumn = true;
-                    if (profileDataGridNode.averagePercent < queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedAverageColumn = true;
-                }
+if (!isNaN(queryNumber) && !(greaterThan || lessThan))
+equalTo = true;
 
-                if (equalTo) {
-                    if (profileDataGridNode.selfPercent == queryNumber)
-                        profileDataGridNode._searchMatchedSelfColumn = true;
-                    if (profileDataGridNode.totalPercent == queryNumber)
-                        profileDataGridNode._searchMatchedTotalColumn = true;
-                    if (profileDataGridNode.averagePercent < queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedAverageColumn = true;
-                }
-            } else if (millisecondsUnits || secondsUnits) {
-                if (lessThan) {
-                    if (profileDataGridNode.selfTime < queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedSelfColumn = true;
-                    if (profileDataGridNode.totalTime < queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedTotalColumn = true;
-                    if (profileDataGridNode.averageTime < queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedAverageColumn = true;
-                } else if (greaterThan) {
-                    if (profileDataGridNode.selfTime > queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedSelfColumn = true;
-                    if (profileDataGridNode.totalTime > queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedTotalColumn = true;
-                    if (profileDataGridNode.averageTime > queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedAverageColumn = true;
-                }
+function matchesQuery(  profileDataGridNode)
+{
+delete profileDataGridNode._searchMatchedSelfColumn;
+delete profileDataGridNode._searchMatchedTotalColumn;
+delete profileDataGridNode._searchMatchedAverageColumn;
+delete profileDataGridNode._searchMatchedCallsColumn;
+delete profileDataGridNode._searchMatchedFunctionColumn;
 
-                if (equalTo) {
-                    if (profileDataGridNode.selfTime == queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedSelfColumn = true;
-                    if (profileDataGridNode.totalTime == queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedTotalColumn = true;
-                    if (profileDataGridNode.averageTime == queryNumberMilliseconds)
-                        profileDataGridNode._searchMatchedAverageColumn = true;
-                }
-            } else {
-                if (equalTo && profileDataGridNode.numberOfCalls == queryNumber)
-                    profileDataGridNode._searchMatchedCallsColumn = true;
-                if (greaterThan && profileDataGridNode.numberOfCalls > queryNumber)
-                    profileDataGridNode._searchMatchedCallsColumn = true;
-                if (lessThan && profileDataGridNode.numberOfCalls < queryNumber)
-                    profileDataGridNode._searchMatchedCallsColumn = true;
-            }
+if (percentUnits) {
+if (lessThan) {
+if (profileDataGridNode.selfPercent < queryNumber)
+profileDataGridNode._searchMatchedSelfColumn = true;
+if (profileDataGridNode.totalPercent < queryNumber)
+profileDataGridNode._searchMatchedTotalColumn = true;
+if (profileDataGridNode.averagePercent < queryNumberMilliseconds)
+profileDataGridNode._searchMatchedAverageColumn = true;
+} else if (greaterThan) {
+if (profileDataGridNode.selfPercent > queryNumber)
+profileDataGridNode._searchMatchedSelfColumn = true;
+if (profileDataGridNode.totalPercent > queryNumber)
+profileDataGridNode._searchMatchedTotalColumn = true;
+if (profileDataGridNode.averagePercent < queryNumberMilliseconds)
+profileDataGridNode._searchMatchedAverageColumn = true;
+}
+
+if (equalTo) {
+if (profileDataGridNode.selfPercent == queryNumber)
+profileDataGridNode._searchMatchedSelfColumn = true;
+if (profileDataGridNode.totalPercent == queryNumber)
+profileDataGridNode._searchMatchedTotalColumn = true;
+if (profileDataGridNode.averagePercent < queryNumberMilliseconds)
+profileDataGridNode._searchMatchedAverageColumn = true;
+}
+} else if (millisecondsUnits || secondsUnits) {
+if (lessThan) {
+if (profileDataGridNode.selfTime < queryNumberMilliseconds)
+profileDataGridNode._searchMatchedSelfColumn = true;
+if (profileDataGridNode.totalTime < queryNumberMilliseconds)
+profileDataGridNode._searchMatchedTotalColumn = true;
+if (profileDataGridNode.averageTime < queryNumberMilliseconds)
+profileDataGridNode._searchMatchedAverageColumn = true;
+} else if (greaterThan) {
+if (profileDataGridNode.selfTime > queryNumberMilliseconds)
+profileDataGridNode._searchMatchedSelfColumn = true;
+if (profileDataGridNode.totalTime > queryNumberMilliseconds)
+profileDataGridNode._searchMatchedTotalColumn = true;
+if (profileDataGridNode.averageTime > queryNumberMilliseconds)
+profileDataGridNode._searchMatchedAverageColumn = true;
+}
+
+if (equalTo) {
+if (profileDataGridNode.selfTime == queryNumberMilliseconds)
+profileDataGridNode._searchMatchedSelfColumn = true;
+if (profileDataGridNode.totalTime == queryNumberMilliseconds)
+profileDataGridNode._searchMatchedTotalColumn = true;
+if (profileDataGridNode.averageTime == queryNumberMilliseconds)
+profileDataGridNode._searchMatchedAverageColumn = true;
+}
+} else {
+if (equalTo && profileDataGridNode.numberOfCalls == queryNumber)
+profileDataGridNode._searchMatchedCallsColumn = true;
+if (greaterThan && profileDataGridNode.numberOfCalls > queryNumber)
+profileDataGridNode._searchMatchedCallsColumn = true;
+if (lessThan && profileDataGridNode.numberOfCalls < queryNumber)
+profileDataGridNode._searchMatchedCallsColumn = true;
+}
+
+if (profileDataGridNode.functionName.hasSubstring(query, true) || profileDataGridNode.url.hasSubstring(query, true))
+profileDataGridNode._searchMatchedFunctionColumn = true;
+
+if (profileDataGridNode._searchMatchedSelfColumn ||
+profileDataGridNode._searchMatchedTotalColumn ||
+profileDataGridNode._searchMatchedAverageColumn ||
+profileDataGridNode._searchMatchedCallsColumn ||
+profileDataGridNode._searchMatchedFunctionColumn)
+{
+profileDataGridNode.refresh();
+return true;
+}
+
+return false;
+}
 
-            if (profileDataGridNode.functionName.hasSubstring(query, true) || profileDataGridNode.url.hasSubstring(query, true))
-                profileDataGridNode._searchMatchedFunctionColumn = true;
+var current = this.profileDataGridTree.children[0];
 
-            if (profileDataGridNode._searchMatchedSelfColumn ||
-                profileDataGridNode._searchMatchedTotalColumn ||
-                profileDataGridNode._searchMatchedAverageColumn ||
-                profileDataGridNode._searchMatchedCallsColumn ||
-                profileDataGridNode._searchMatchedFunctionColumn)
-            {
-                profileDataGridNode.refresh();
-                return true;
-            }
+while (current) {
+if (matchesQuery(current)) {
+this._searchResults.push({ profileNode: current });
+}
 
-            return false;
-        }
+current = current.traverseNextNode(false, null, false);
+}
 
-        var current = this.profileDataGridTree.children[0];
+finishedCallback(this, this._searchResults.length);
+},
 
-        while (current) {
-            if (matchesQuery(current)) {
-                this._searchResults.push({ profileNode: current });
-            }
+jumpToFirstSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+this._currentSearchResultIndex = 0;
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-            current = current.traverseNextNode(false, null, false);
-        }
+jumpToLastSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+this._currentSearchResultIndex = (this._searchResults.length - 1);
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-        finishedCallback(this, this._searchResults.length);
-    },
+jumpToNextSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+if (++this._currentSearchResultIndex >= this._searchResults.length)
+this._currentSearchResultIndex = 0;
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-    jumpToFirstSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        this._currentSearchResultIndex = 0;
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+jumpToPreviousSearchResult: function()
+{
+if (!this._searchResults || !this._searchResults.length)
+return;
+if (--this._currentSearchResultIndex < 0)
+this._currentSearchResultIndex = (this._searchResults.length - 1);
+this._jumpToSearchResult(this._currentSearchResultIndex);
+},
 
-    jumpToLastSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        this._currentSearchResultIndex = (this._searchResults.length - 1);
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+showingFirstSearchResult: function()
+{
+return (this._currentSearchResultIndex === 0);
+},
 
-    jumpToNextSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        if (++this._currentSearchResultIndex >= this._searchResults.length)
-            this._currentSearchResultIndex = 0;
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+showingLastSearchResult: function()
+{
+return (this._searchResults && this._currentSearchResultIndex === (this._searchResults.length - 1));
+},
 
-    jumpToPreviousSearchResult: function()
-    {
-        if (!this._searchResults || !this._searchResults.length)
-            return;
-        if (--this._currentSearchResultIndex < 0)
-            this._currentSearchResultIndex = (this._searchResults.length - 1);
-        this._jumpToSearchResult(this._currentSearchResultIndex);
-    },
+_jumpToSearchResult: function(index)
+{
+var searchResult = this._searchResults[index];
+if (!searchResult)
+return;
 
-    showingFirstSearchResult: function()
-    {
-        return (this._currentSearchResultIndex === 0);
-    },
+var profileNode = searchResult.profileNode;
+profileNode.reveal();
+profileNode.select();
+},
 
-    showingLastSearchResult: function()
-    {
-        return (this._searchResults && this._currentSearchResultIndex === (this._searchResults.length - 1));
-    },
+_changeView: function(event)
+{
+if (!event || !this.profile)
+return;
 
-    _jumpToSearchResult: function(index)
-    {
-        var searchResult = this._searchResults[index];
-        if (!searchResult)
-            return;
+if (event.target.selectedIndex == 1 && this.view == "Heavy") {
+this.profileDataGridTree = this.topDownProfileDataGridTree;
+this._sortProfile();
+this.view = "Tree";
+} else if (event.target.selectedIndex == 0 && this.view == "Tree") {
+this.profileDataGridTree = this.bottomUpProfileDataGridTree;
+this._sortProfile();
+this.view = "Heavy";
+}
 
-        var profileNode = searchResult.profileNode;
-        profileNode.reveal();
-        profileNode.select();
-    },
+if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
+return;
 
-    _changeView: function(event)
-    {
-        if (!event || !this.profile)
-            return;
 
-        if (event.target.selectedIndex == 1 && this.view == "Heavy") {
-            this.profileDataGridTree = this.topDownProfileDataGridTree;
-            this._sortProfile();
-            this.view = "Tree";
-        } else if (event.target.selectedIndex == 0 && this.view == "Tree") {
-            this.profileDataGridTree = this.bottomUpProfileDataGridTree;
-            this._sortProfile();
-            this.view = "Heavy";
-        }
 
-        if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
-            return;
 
-        // The current search needs to be performed again. First negate out previous match
-        // count by calling the search finished callback with a negative number of matches.
-        // Then perform the search again the with same query and callback.
-        this._searchFinishedCallback(this, -this._searchResults.length);
-        this.performSearch(this.currentQuery, this._searchFinishedCallback);
-    },
+this._searchFinishedCallback(this, -this._searchResults.length);
+this.performSearch(this.currentQuery, this._searchFinishedCallback);
+},
 
-    _percentClicked: function(event)
-    {
-        var currentState = this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent;
-        this.showSelfTimeAsPercent = !currentState;
-        this.showTotalTimeAsPercent = !currentState;
-        this.showAverageTimeAsPercent = !currentState;
-        this.refreshShowAsPercents();
-    },
+_percentClicked: function(event)
+{
+var currentState = this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent;
+this.showSelfTimeAsPercent = !currentState;
+this.showTotalTimeAsPercent = !currentState;
+this.showAverageTimeAsPercent = !currentState;
+this.refreshShowAsPercents();
+},
 
-    _updatePercentButton: function()
-    {
-        if (this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent) {
-            this.percentButton.title = WebInspector.UIString("Show absolute total and self times.");
-            this.percentButton.toggled = true;
-        } else {
-            this.percentButton.title = WebInspector.UIString("Show total and self times as percentages.");
-            this.percentButton.toggled = false;
-        }
-    },
+_updatePercentButton: function()
+{
+if (this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent) {
+this.percentButton.title = WebInspector.UIString("Show absolute total and self times.");
+this.percentButton.toggled = true;
+} else {
+this.percentButton.title = WebInspector.UIString("Show total and self times as percentages.");
+this.percentButton.toggled = false;
+}
+},
 
-    _focusClicked: function(event)
-    {
-        if (!this.dataGrid.selectedNode)
-            return;
+_focusClicked: function(event)
+{
+if (!this.dataGrid.selectedNode)
+return;
 
-        this.resetButton.visible = true;
-        this.profileDataGridTree.focus(this.dataGrid.selectedNode);
-        this.refresh();
-        this.refreshVisibleData();
-    },
+this.resetButton.visible = true;
+this.profileDataGridTree.focus(this.dataGrid.selectedNode);
+this.refresh();
+this.refreshVisibleData();
+},
 
-    _excludeClicked: function(event)
-    {
-        var selectedNode = this.dataGrid.selectedNode
+_excludeClicked: function(event)
+{
+var selectedNode = this.dataGrid.selectedNode
 
-        if (!selectedNode)
-            return;
+if (!selectedNode)
+return;
 
-        selectedNode.deselect();
+selectedNode.deselect();
 
-        this.resetButton.visible = true;
-        this.profileDataGridTree.exclude(selectedNode);
-        this.refresh();
-        this.refreshVisibleData();
-    },
+this.resetButton.visible = true;
+this.profileDataGridTree.exclude(selectedNode);
+this.refresh();
+this.refreshVisibleData();
+},
 
-    _resetClicked: function(event)
-    {
-        this.resetButton.visible = false;
-        this.profileDataGridTree.restore();
-        this.refresh();
-        this.refreshVisibleData();
-    },
+_resetClicked: function(event)
+{
+this.resetButton.visible = false;
+this.profileDataGridTree.restore();
+this.refresh();
+this.refreshVisibleData();
+},
 
-    _dataGridNodeSelected: function(node)
-    {
-        this.focusButton.disabled = false;
-        this.excludeButton.disabled = false;
-    },
+_dataGridNodeSelected: function(node)
+{
+this.focusButton.disabled = false;
+this.excludeButton.disabled = false;
+},
 
-    _dataGridNodeDeselected: function(node)
-    {
-        this.focusButton.disabled = true;
-        this.excludeButton.disabled = true;
-    },
+_dataGridNodeDeselected: function(node)
+{
+this.focusButton.disabled = true;
+this.excludeButton.disabled = true;
+},
 
-    _sortData: function(event)
-    {
-        this._sortProfile(this.profile);
-    },
+_sortData: function(event)
+{
+this._sortProfile(this.profile);
+},
 
-    _sortProfile: function()
-    {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
-        var sortProperty = {
-                "average": "averageTime",
-                "self": "selfTime",
-                "total": "totalTime",
-                "calls": "numberOfCalls",
-                "function": "functionName"
-            }[sortColumnIdentifier];
+_sortProfile: function()
+{
+var sortAscending = this.dataGrid.sortOrder === "ascending";
+var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+var sortProperty = {
+"average": "averageTime",
+"self": "selfTime",
+"total": "totalTime",
+"calls": "numberOfCalls",
+"function": "functionName"
+}[sortColumnIdentifier];
 
-        this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty, sortAscending));
+this.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator(sortProperty, sortAscending));
 
-        this.refresh();
-    },
+this.refresh();
+},
 
-    _mouseDownInDataGrid: function(event)
-    {
-        if (event.detail < 2)
-            return;
+_mouseDownInDataGrid: function(event)
+{
+if (event.detail < 2)
+return;
 
-        var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
-        if (!cell || (!cell.hasStyleClass("total-column") && !cell.hasStyleClass("self-column") && !cell.hasStyleClass("average-column")))
-            return;
+var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
+if (!cell || (!cell.hasStyleClass("total-column") && !cell.hasStyleClass("self-column") && !cell.hasStyleClass("average-column")))
+return;
 
-        if (cell.hasStyleClass("total-column"))
-            this.showTotalTimeAsPercent = !this.showTotalTimeAsPercent;
-        else if (cell.hasStyleClass("self-column"))
-            this.showSelfTimeAsPercent = !this.showSelfTimeAsPercent;
-        else if (cell.hasStyleClass("average-column"))
-            this.showAverageTimeAsPercent = !this.showAverageTimeAsPercent;
+if (cell.hasStyleClass("total-column"))
+this.showTotalTimeAsPercent = !this.showTotalTimeAsPercent;
+else if (cell.hasStyleClass("self-column"))
+this.showSelfTimeAsPercent = !this.showSelfTimeAsPercent;
+else if (cell.hasStyleClass("average-column"))
+this.showAverageTimeAsPercent = !this.showAverageTimeAsPercent;
 
-        this.refreshShowAsPercents();
+this.refreshShowAsPercents();
 
-        event.preventDefault();
-        event.stopPropagation();
-    },
+event.preventDefault();
+event.stopPropagation();
+},
 
-    _assignParentsInProfile: function()
-    {
-        var head = this.profile.head;
-        head.parent = null;
-        head.head = null;
-        var nodesToTraverse = [ { parent: head, children: head.children } ];
-        while (nodesToTraverse.length > 0) {
-            var pair = nodesToTraverse.shift();
-            var parent = pair.parent;
-            var children = pair.children;
-            var length = children.length;
-            for (var i = 0; i < length; ++i) {
-                children[i].head = head;
-                children[i].parent = parent;
-                if (children[i].children.length > 0)
-                    nodesToTraverse.push({ parent: children[i], children: children[i].children });
-            }
-        }
-    }
+_assignParentsInProfile: function()
+{
+var head = this.profile.head;
+head.parent = null;
+head.head = null;
+var nodesToTraverse = [ { parent: head, children: head.children } ];
+while (nodesToTraverse.length > 0) {
+var pair = nodesToTraverse.shift();
+var parent = pair.parent;
+var children = pair.children;
+var length = children.length;
+for (var i = 0; i < length; ++i) {
+children[i].head = head;
+children[i].parent = parent;
+if (children[i].children.length > 0)
+nodesToTraverse.push({ parent: children[i], children: children[i].children });
+}
+}
+}
 }
 
 WebInspector.CPUProfileView.prototype.__proto__ = WebInspector.View.prototype;
 
 WebInspector.CPUProfileType = function()
 {
-    WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebInspector.UIString("CPU PROFILES"));
-    this._recording = false;
+WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebInspector.UIString("CPU PROFILES"));
+this._recording = false;
 }
 
 WebInspector.CPUProfileType.TypeId = "CPU";
 
 WebInspector.CPUProfileType.prototype = {
-    get buttonTooltip()
-    {
-        return this._recording ? WebInspector.UIString("Stop profiling.") : WebInspector.UIString("Start profiling.");
-    },
+get buttonTooltip()
+{
+return this._recording ? WebInspector.UIString("Stop profiling.") : WebInspector.UIString("Start profiling.");
+},
 
-    get buttonStyle()
-    {
-        return this._recording ? "record-profile-status-bar-item status-bar-item toggled-on" : "record-profile-status-bar-item status-bar-item";
-    },
+get buttonStyle()
+{
+return this._recording ? "record-profile-status-bar-item status-bar-item toggled-on" : "record-profile-status-bar-item status-bar-item";
+},
 
-    buttonClicked: function()
-    {
-        this._recording = !this._recording;
+buttonClicked: function()
+{
+this._recording = !this._recording;
 
-        if (this._recording)
-            InspectorBackend.startProfiling();
-        else
-            InspectorBackend.stopProfiling();
-    },
+if (this._recording)
+InspectorBackend.startProfiling();
+else
+InspectorBackend.stopProfiling();
+},
 
-    get welcomeMessage()
-    {
-        return WebInspector.UIString("Start CPU profiling by pressing<br>the %s button on the status bar.");
-    },
+get welcomeMessage()
+{
+return WebInspector.UIString("Control CPU profiling by pressing the %s button on the status bar.");
+},
 
-    setRecordingProfile: function(isProfiling)
-    {
-        this._recording = isProfiling;
-    },
+setRecordingProfile: function(isProfiling)
+{
+this._recording = isProfiling;
+},
 
-    createSidebarTreeElementForProfile: function(profile)
-    {
-        return new WebInspector.ProfileSidebarTreeElement(profile);
-    },
+createSidebarTreeElementForProfile: function(profile)
+{
+return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.UIString("Profile %d"), "profile-sidebar-tree-item");
+},
 
-    createView: function(profile)
-    {
-        return new WebInspector.CPUProfileView(profile);
-    }
+createView: function(profile)
+{
+return new WebInspector.CPUProfileView(profile);
+}
 }
 
 WebInspector.CPUProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
 
-/* DOMAgent.js */
 
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-WebInspector.DOMNode = function(doc, payload) {
-    this.ownerDocument = doc;
 
-    this.id = payload.id;
-    // injectedScriptId is a node is for DOM nodes which should be converted
-    // to corresponding InjectedScript by the inspector backend. We indicate
-    // this by making injectedScriptId negative.
-    this.injectedScriptId = -payload.id;
-    this.nodeType = payload.nodeType;
-    this.nodeName = payload.nodeName;
-    this.localName = payload.localName;
-    this._nodeValue = payload.nodeValue;
-    this.textContent = this.nodeValue;
-
-    this.attributes = [];
-    this._attributesMap = {};
-    if (payload.attributes)
-        this._setAttributesPayload(payload.attributes);
-
-    this._childNodeCount = payload.childNodeCount;
-    this.children = null;
-
-    this.nextSibling = null;
-    this.prevSibling = null;
-    this.firstChild = null;
-    this.lastChild = null;
-    this.parentNode = null;
-
-    if (payload.children)
-        this._setChildrenPayload(payload.children);
-
-    this._computedStyle = null;
-    this.style = null;
-    this._matchedCSSRules = [];
-
-    if (this.nodeType === Node.ELEMENT_NODE) {
-        // HTML and BODY from internal iframes should not overwrite top-level ones.
-        if (!this.ownerDocument.documentElement && this.nodeName === "HTML")
-            this.ownerDocument.documentElement = this;
-        if (!this.ownerDocument.body && this.nodeName === "BODY")
-            this.ownerDocument.body = this;
-        if (payload.documentURL)
-            this.documentURL = payload.documentURL;
-    } else if (this.nodeType === Node.DOCUMENT_TYPE_NODE) {
-        this.publicId = payload.publicId;
-        this.systemId = payload.systemId;
-        this.internalSubset = payload.internalSubset;
-    } else if (this.nodeType === Node.DOCUMENT_NODE)
-        this.documentURL = payload.documentURL;
-}
-
-WebInspector.DOMNode.prototype = {
-    hasAttributes: function()
-    {
-        return this.attributes.length > 0;
-    },
-
-    hasChildNodes: function()  {
-        return this._childNodeCount > 0;
-    },
-
-    get nodeValue() {
-        return this._nodeValue;
-    },
-
-    set nodeValue(value) {
-        if (this.nodeType != Node.TEXT_NODE)
-            return;
-        var self = this;
-        var callback = function()
-        {
-            self._nodeValue = value;
-            self.textContent = value;
-        };
-        this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, callback);
-    },
-
-    getAttribute: function(name)
-    {
-        var attr = this._attributesMap[name];
-        return attr ? attr.value : undefined;
-    },
-
-    setAttribute: function(name, value)
-    {
-        var self = this;
-        var callback = function()
-        {
-            var attr = self._attributesMap[name];
-            if (attr)
-                attr.value = value;
-            else
-                attr = self._addAttribute(name, value);
-        };
-        this.ownerDocument._domAgent.setAttributeAsync(this, name, value, callback);
-    },
-
-    removeAttribute: function(name)
-    {
-        var self = this;
-        var callback = function()
-        {
-            delete self._attributesMap[name];
-            for (var i = 0;  i < self.attributes.length; ++i) {
-                if (self.attributes[i].name == name) {
-                    self.attributes.splice(i, 1);
-                    break;
-                }
-            }
-        };
-        this.ownerDocument._domAgent.removeAttributeAsync(this, name, callback);
-    },
-
-    _setAttributesPayload: function(attrs)
-    {
-        this.attributes = [];
-        this._attributesMap = {};
-        for (var i = 0; i < attrs.length; i += 2)
-            this._addAttribute(attrs[i], attrs[i + 1]);
-    },
-
-    _insertChild: function(prev, payload)
-    {
-        var node = new WebInspector.DOMNode(this.ownerDocument, payload);
-        if (!prev) {
-            if (!this.children) {
-                // First node
-                this.children = [ node ];
-            } else
-                this.children.unshift(node);
-        } else
-            this.children.splice(this.children.indexOf(prev) + 1, 0, node);
-        this._renumber();
-        return node;
-    },
-
-    removeChild_: function(node)
-    {
-        this.children.splice(this.children.indexOf(node), 1);
-        node.parentNode = null;
-        this._renumber();
-    },
-
-    _setChildrenPayload: function(payloads)
-    {
-        this.children = [];
-        for (var i = 0; i < payloads.length; ++i) {
-            var payload = payloads[i];
-            var node = new WebInspector.DOMNode(this.ownerDocument, payload);
-            this.children.push(node);
-        }
-        this._renumber();
-    },
-
-    _renumber: function()
-    {
-        this._childNodeCount = this.children.length;
-        if (this._childNodeCount == 0) {
-            this.firstChild = null;
-            this.lastChild = null;
-            return;
-        }
-        this.firstChild = this.children[0];
-        this.lastChild = this.children[this._childNodeCount - 1];
-        for (var i = 0; i < this._childNodeCount; ++i) {
-            var child = this.children[i];
-            child.index = i;
-            child.nextSibling = i + 1 < this._childNodeCount ? this.children[i + 1] : null;
-            child.prevSibling = i - 1 >= 0 ? this.children[i - 1] : null;
-            child.parentNode = this;
-        }
-    },
-
-    _addAttribute: function(name, value)
-    {
-        var attr = {
-            "name": name,
-            "value": value,
-            "_node": this
-        };
-        this._attributesMap[name] = attr;
-        this.attributes.push(attr);
-    },
-
-    _setStyles: function(computedStyle, inlineStyle, styleAttributes, matchedCSSRules)
-    {
-        this._computedStyle = new WebInspector.CSSStyleDeclaration(computedStyle);
-        this.style = new WebInspector.CSSStyleDeclaration(inlineStyle);
-
-        for (var name in styleAttributes) {
-            if (this._attributesMap[name])
-                this._attributesMap[name].style = new WebInspector.CSSStyleDeclaration(styleAttributes[name]);
-        }
-
-        this._matchedCSSRules = [];
-        for (var i = 0; i < matchedCSSRules.length; i++)
-            this._matchedCSSRules.push(WebInspector.CSSStyleDeclaration.parseRule(matchedCSSRules[i]));
-    },
-
-    _clearStyles: function()
-    {
-        this.computedStyle = null;
-        this.style = null;
-        for (var name in this._attributesMap)
-            this._attributesMap[name].style = null;
-        this._matchedCSSRules = null;
-    }
-}
-
-WebInspector.DOMDocument = function(domAgent, defaultView, payload)
+WebInspector.HeapSnapshotEdgesIterator = function(snapshot, edges)
 {
-    WebInspector.DOMNode.call(this, this, payload);
-    this._listeners = {};
-    this._domAgent = domAgent;
-    this.defaultView = defaultView;
+this._snapshot = snapshot;
+this._edges = edges;
+this._edgeIndex = 0;
 }
 
-WebInspector.DOMDocument.prototype = {
-
-    addEventListener: function(name, callback)
-    {
-        var listeners = this._listeners[name];
-        if (!listeners) {
-            listeners = [];
-            this._listeners[name] = listeners;
-        }
-        listeners.push(callback);
-    },
-
-    removeEventListener: function(name, callback)
-    {
-        var listeners = this._listeners[name];
-        if (!listeners)
-            return;
-
-        var index = listeners.indexOf(callback);
-        if (index != -1)
-            listeners.splice(index, 1);
-    },
-
-    _fireDomEvent: function(name, event)
-    {
-        var listeners = this._listeners[name];
-        if (!listeners)
-            return;
-
-        for (var i = 0; i < listeners.length; ++i) {
-            var listener = listeners[i];
-            listener.call(this, event);
-        }
-    }
-}
-
-WebInspector.DOMDocument.prototype.__proto__ = WebInspector.DOMNode.prototype;
-
-
-WebInspector.DOMWindow = function(domAgent)
+WebInspector.HeapSnapshotEdgesIterator.prototype = {
+get done()
 {
-    this._domAgent = domAgent;
-}
+return this._edgeIndex >= this._edges.length;
+},
 
-WebInspector.DOMWindow.prototype = {
-    get document()
-    {
-        return this._domAgent.document;
-    },
-
-    get Node()
-    {
-        return WebInspector.DOMNode;
-    },
-
-    get Element()
-    {
-        return WebInspector.DOMNode;
-    },
-
-    Object: function()
-    {
-    },
-
-    getComputedStyle: function(node)
-    {
-        return node._computedStyle;
-    },
-
-    getMatchedCSSRules: function(node, pseudoElement, authorOnly)
-    {
-        return node._matchedCSSRules;
-    }
-}
-
-WebInspector.DOMAgent = function() {
-    this._window = new WebInspector.DOMWindow(this);
-    this._idToDOMNode = null;
-    this.document = null;
-}
-
-WebInspector.DOMAgent.prototype = {
-    get domWindow()
-    {
-        return this._window;
-    },
-
-    getChildNodesAsync: function(parent, callback)
-    {
-        var children = parent.children;
-        if (children) {
-            callback(children);
-            return;
-        }
-        function mycallback() {
-            callback(parent.children);
-        }
-        var callId = WebInspector.Callback.wrap(mycallback);
-        InspectorBackend.getChildNodes(callId, parent.id);
-    },
-
-    setAttributeAsync: function(node, name, value, callback)
-    {
-        var mycallback = this._didApplyDomChange.bind(this, node, callback);
-        InspectorBackend.setAttribute(WebInspector.Callback.wrap(mycallback), node.id, name, value);
-    },
-
-    removeAttributeAsync: function(node, name, callback)
-    {
-        var mycallback = this._didApplyDomChange.bind(this, node, callback);
-        InspectorBackend.removeAttribute(WebInspector.Callback.wrap(mycallback), node.id, name);
-    },
-
-    setTextNodeValueAsync: function(node, text, callback)
-    {
-        var mycallback = this._didApplyDomChange.bind(this, node, callback);
-        InspectorBackend.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node.id, text);
-    },
-
-    _didApplyDomChange: function(node, callback, success)
-    {
-        if (!success)
-            return;
-        callback();
-        // TODO(pfeldman): Fix this hack.
-        var elem = WebInspector.panels.elements.treeOutline.findTreeElement(node);
-        if (elem)
-            elem.updateTitle();
-    },
-
-    _attributesUpdated: function(nodeId, attrsArray)
-    {
-        var node = this._idToDOMNode[nodeId];
-        node._setAttributesPayload(attrsArray);
-        var event = {target: node};
-        this.document._fireDomEvent("DOMAttrModified", event);
-    },
-
-    nodeForId: function(nodeId) {
-        return this._idToDOMNode[nodeId];
-    },
-
-    _setDocument: function(payload)
-    {
-        this._idToDOMNode = {};
-        if (payload && "id" in payload) {
-            this.document = new WebInspector.DOMDocument(this, this._window, payload);
-            this._idToDOMNode[payload.id] = this.document;
-            this._bindNodes(this.document.children);
-        } else
-            this.document = null;
-        WebInspector.panels.elements.setDocument(this.document);
-    },
-
-    _setDetachedRoot: function(payload)
-    {
-        var root = new WebInspector.DOMNode(this.document, payload);
-        this._idToDOMNode[payload.id] = root;
-    },
-
-    _setChildNodes: function(parentId, payloads)
-    {
-        var parent = this._idToDOMNode[parentId];
-        parent._setChildrenPayload(payloads);
-        this._bindNodes(parent.children);
-    },
-
-    _bindNodes: function(children)
-    {
-        for (var i = 0; i < children.length; ++i) {
-            var child = children[i];
-            this._idToDOMNode[child.id] = child;
-            if (child.children)
-                this._bindNodes(child.children);
-        }
-    },
-
-    _childNodeCountUpdated: function(nodeId, newValue)
-    {
-        var node = this._idToDOMNode[nodeId];
-        node._childNodeCount = newValue;
-        var outline = WebInspector.panels.elements.treeOutline;
-        var treeElement = outline.findTreeElement(node);
-        if (treeElement)
-            treeElement.hasChildren = newValue;
-    },
-
-    _childNodeInserted: function(parentId, prevId, payload)
-    {
-        var parent = this._idToDOMNode[parentId];
-        var prev = this._idToDOMNode[prevId];
-        var node = parent._insertChild(prev, payload);
-        this._idToDOMNode[node.id] = node;
-        var event = { target : node, relatedNode : parent };
-        this.document._fireDomEvent("DOMNodeInserted", event);
-    },
-
-    _childNodeRemoved: function(parentId, nodeId)
-    {
-        var parent = this._idToDOMNode[parentId];
-        var node = this._idToDOMNode[nodeId];
-        parent.removeChild_(node);
-        var event = { target : node, relatedNode : parent };
-        this.document._fireDomEvent("DOMNodeRemoved", event);
-        delete this._idToDOMNode[nodeId];
-    }
-}
-
-WebInspector.Cookies = {}
-
-WebInspector.Cookies.getCookiesAsync = function(callback)
+get isElement()
 {
-    function mycallback(cookies, cookiesString) {
-        if (cookiesString)
-            callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false);
-        else
-            callback(cookies, true);
-    }
-    var callId = WebInspector.Callback.wrap(mycallback);
-    InspectorBackend.getCookies(callId);
-}
+return this._getType() === this._snapshot._edgeElementType;
+},
 
-WebInspector.Cookies.buildCookiesFromString = function(rawCookieString)
+get isHidden()
 {
-    var rawCookies = rawCookieString.split(/;\s*/);
-    var cookies = [];
+return this._getType() === this._snapshot._edgeHiddenType;
+},
 
-    if (!(/^\s*$/.test(rawCookieString))) {
-        for (var i = 0; i < rawCookies.length; ++i) {
-            var cookie = rawCookies[i];
-            var delimIndex = cookie.indexOf("=");
-            var name = cookie.substring(0, delimIndex);
-            var value = cookie.substring(delimIndex + 1);
-            var size = name.length + value.length;
-            cookies.push({ name: name, value: value, size: size });
-        }
-    }
-
-    return cookies;
-}
-
-WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL)
-{
-    var match = resourceURL.match(WebInspector.URLRegExp);
-    if (!match)
-        return false;
-    // See WebInspector.URLRegExp for definitions of the group index constants.
-    if (!this.cookieDomainMatchesResourceDomain(cookie.domain, match[2]))
-        return false;
-    var resourcePort = match[3] ? match[3] : undefined;
-    var resourcePath = match[4] ? match[4] : '/';
-    return (resourcePath.indexOf(cookie.path) === 0
-        && (!cookie.port || resourcePort == cookie.port)
-        && (!cookie.secure || match[1].toLowerCase() === 'https'));
-}
-
-WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain)
-{
-    if (cookieDomain.charAt(0) !== '.')
-        return resourceDomain === cookieDomain;
-    return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i");
-}
-
-WebInspector.EventListeners = {}
-
-WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callback)
-{
-    if (!node)
-        return;
-
-    var callId = WebInspector.Callback.wrap(callback);
-    InspectorBackend.getEventListenersForNode(callId, node.id);
-}
-
-WebInspector.CSSStyleDeclaration = function(payload)
-{
-    this.id = payload.id;
-    this.injectedScriptId = payload.injectedScriptId;
-    this.width = payload.width;
-    this.height = payload.height;
-    this.__disabledProperties = payload.__disabledProperties;
-    this.__disabledPropertyValues = payload.__disabledPropertyValues;
-    this.__disabledPropertyPriorities = payload.__disabledPropertyPriorities;
-    this.uniqueStyleProperties = payload.uniqueStyleProperties;
-    this._shorthandValues = payload.shorthandValues;
-    this._propertyMap = {};
-    this._longhandProperties = {};
-    this.length = payload.properties.length;
-
-    for (var i = 0; i < this.length; ++i) {
-        var property = payload.properties[i];
-        var name = property.name;
-        this[i] = name;
-        this._propertyMap[name] = property;
-    }
-
-    // Index longhand properties.
-    for (var i = 0; i < this.uniqueStyleProperties.length; ++i) {
-        var name = this.uniqueStyleProperties[i];
-        var property = this._propertyMap[name];
-        if (property.shorthand) {
-            var longhands = this._longhandProperties[property.shorthand];
-            if (!longhands) {
-                longhands = [];
-                this._longhandProperties[property.shorthand] = longhands;
-            }
-            longhands.push(name);
-        }
-    }
-}
-
-WebInspector.CSSStyleDeclaration.parseStyle = function(payload)
-{
-    return new WebInspector.CSSStyleDeclaration(payload);
-}
-
-WebInspector.CSSStyleDeclaration.parseRule = function(payload)
-{
-    var rule = {};
-    rule.id = payload.id;
-    rule.injectedScriptId = payload.injectedScriptId;
-    rule.selectorText = payload.selectorText;
-    rule.style = new WebInspector.CSSStyleDeclaration(payload.style);
-    rule.style.parentRule = rule;
-    rule.isUserAgent = payload.isUserAgent;
-    rule.isUser = payload.isUser;
-    rule.isViaInspector = payload.isViaInspector;
-    if (payload.parentStyleSheet)
-        rule.parentStyleSheet = { href: payload.parentStyleSheet.href };
-
-    return rule;
-}
-
-WebInspector.CSSStyleDeclaration.prototype = {
-    getPropertyValue: function(name)
-    {
-        var property = this._propertyMap[name];
-        return property ? property.value : "";
-    },
-
-    getPropertyPriority: function(name)
-    {
-        var property = this._propertyMap[name];
-        return property ? property.priority : "";
-    },
-
-    getPropertyShorthand: function(name)
-    {
-        var property = this._propertyMap[name];
-        return property ? property.shorthand : "";
-    },
-
-    isPropertyImplicit: function(name)
-    {
-        var property = this._propertyMap[name];
-        return property ? property.implicit : "";
-    },
-
-    styleTextWithShorthands: function()
-    {
-        var cssText = "";
-        var foundProperties = {};
-        for (var i = 0; i < this.length; ++i) {
-            var individualProperty = this[i];
-            var shorthandProperty = this.getPropertyShorthand(individualProperty);
-            var propertyName = (shorthandProperty || individualProperty);
-
-            if (propertyName in foundProperties)
-                continue;
-
-            if (shorthandProperty) {
-                var value = this.getPropertyValue(shorthandProperty);
-                var priority = this.getShorthandPriority(shorthandProperty);
-            } else {
-                var value = this.getPropertyValue(individualProperty);
-                var priority = this.getPropertyPriority(individualProperty);
-            }
-
-            foundProperties[propertyName] = true;
-
-            cssText += propertyName + ": " + value;
-            if (priority)
-                cssText += " !" + priority;
-            cssText += "; ";
-        }
-
-        return cssText;
-    },
-
-    getLonghandProperties: function(name)
-    {
-        return this._longhandProperties[name] || [];
-    },
-
-    getShorthandValue: function(shorthandProperty)
-    {
-        return this._shorthandValues[shorthandProperty];
-    },
-
-    getShorthandPriority: function(shorthandProperty)
-    {
-        var priority = this.getPropertyPriority(shorthandProperty);
-        if (priority)
-            return priority;
-
-        var longhands = this._longhandProperties[shorthandProperty];
-        return longhands ? this.getPropertyPriority(longhands[0]) : null;
-    }
-}
-
-WebInspector.attributesUpdated = function()
-{
-    this.domAgent._attributesUpdated.apply(this.domAgent, arguments);
-}
-
-WebInspector.setDocument = function()
+get name()
 {
-    this.domAgent._setDocument.apply(this.domAgent, arguments);
-}
+return this.isElement || this.isHidden ? this._getNameOrIndex() : this._snapshot._strings[this._getNameOrIndex()];
+},
 
-WebInspector.setDetachedRoot = function()
+next: function()
 {
-    this.domAgent._setDetachedRoot.apply(this.domAgent, arguments);
-}
+this._edgeIndex += this._snapshot._edgeFieldsCount;
+},
 
-WebInspector.setChildNodes = function()
+get node()
 {
-    this.domAgent._setChildNodes.apply(this.domAgent, arguments);
-}
+return new WebInspector.HeapSnapshotNodeWrapper(this._snapshot, this.nodeIndex);
+},
 
-WebInspector.childNodeCountUpdated = function()
+get nodeIndex()
 {
-    this.domAgent._childNodeCountUpdated.apply(this.domAgent, arguments);
-}
+return this._edges[this._edgeIndex + this._snapshot._edgeToNodeOffset];
+},
 
-WebInspector.childNodeInserted = function()
+_getNameOrIndex: function()
 {
-    this.domAgent._childNodeInserted.apply(this.domAgent, arguments);
-}
+return this._edges[this._edgeIndex + this._snapshot._edgeNameOffset];
+},
 
-WebInspector.childNodeRemoved = function()
+_getType: function()
 {
-    this.domAgent._childNodeRemoved.apply(this.domAgent, arguments);
+return this._edges[this._edgeIndex + this._snapshot._edgeTypeOffset];
 }
-
-WebInspector.didGetCookies = WebInspector.Callback.processCallback;
-WebInspector.didGetChildNodes = WebInspector.Callback.processCallback;
-WebInspector.didPerformSearch = WebInspector.Callback.processCallback;
-WebInspector.didApplyDomChange = WebInspector.Callback.processCallback;
-WebInspector.didRemoveAttribute = WebInspector.Callback.processCallback;
-WebInspector.didSetTextNodeValue = WebInspector.Callback.processCallback;
-WebInspector.didGetEventListenersForNode = WebInspector.Callback.processCallback;
-
-/* InjectedScript.js */
-
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-var injectedScriptConstructor = (function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
-
-var InjectedScript = {};
-
-InjectedScript.lastBoundObjectId = 1;
-InjectedScript.idToWrappedObject = {};
-InjectedScript.objectGroups = {};
-InjectedScript.wrapObject = function(object, objectGroupName)
-{
-    var objectId;
-    if (typeof object === "object" || typeof object === "function" ||
-        (typeof object === "undefined" && object instanceof inspectedWindow.HTMLAllCollection)) { // FIXME(33716)
-        var id = InjectedScript.lastBoundObjectId++;
-        objectId = "object#" + id;
-        InjectedScript.idToWrappedObject[objectId] = object;
-
-        var group = InjectedScript.objectGroups[objectGroupName];
-        if (!group) {
-            group = [];
-            InjectedScript.objectGroups[objectGroupName] = group;
-        }
-        group.push(objectId);
-    }
-    return InjectedScript.createProxyObject(object, objectId);
-};
-
-InjectedScript.unwrapObject = function(objectId) {
-    return InjectedScript.idToWrappedObject[objectId];
-};
-
-InjectedScript.releaseWrapperObjectGroup = function(objectGroupName) {
-    var group = InjectedScript.objectGroups[objectGroupName];
-    if (!group)
-        return;
-    for (var i = 0; i < group.length; i++)
-        delete InjectedScript.idToWrappedObject[group[i]];
-    delete InjectedScript.objectGroups[objectGroupName];
 };
 
-// Called from within InspectorController on the 'inspected page' side.
-InjectedScript.reset = function()
+WebInspector.HeapSnapshotNodeWrapper = function(snapshot, nodeIndex)
 {
-    InjectedScript._styles = {};
-    InjectedScript._styleRules = {};
-    InjectedScript._lastStyleId = 0;
-    InjectedScript._lastStyleRuleId = 0;
-    InjectedScript._searchResults = [];
-    InjectedScript._includedInSearchResultsPropertyName = "__includedInInspectorSearchResults";
+this._snapshot = snapshot;
+this._nodes = snapshot._nodes;
+this._nodeIndex = nodeIndex;
 }
 
-InjectedScript.reset();
-
-InjectedScript.dispatch = function(methodName, args, callId)
+WebInspector.HeapSnapshotNodeWrapper.prototype = {
+get edges()
 {
-    var argsArray = eval("(" + args + ")");
-    if (callId)
-        argsArray.splice(0, 0, callId);  // Methods that run asynchronously have a call back id parameter.
-    var result = InjectedScript[methodName].apply(InjectedScript, argsArray);
-    if (typeof result === "undefined") {
-        InjectedScript._window().console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
-        result = null;
-    }
-    return result;
-}
+return new WebInspector.HeapSnapshotEdgesIterator(this._snapshot, this._getEdges());
+},
 
-InjectedScript.getStyles = function(nodeId, authorOnly)
+get edgesCount()
 {
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    var defaultView = node.ownerDocument.defaultView;
-    var matchedRules = defaultView.getMatchedCSSRules(node, "", authorOnly);
-    var matchedCSSRules = [];
-    for (var i = 0; matchedRules && i < matchedRules.length; ++i)
-        matchedCSSRules.push(InjectedScript._serializeRule(matchedRules[i]));
+return this._nodes[this._nodeIndex + this._snapshot._edgesCountOffset];
+},
 
-    var styleAttributes = {};
-    var attributes = node.attributes;
-    for (var i = 0; attributes && i < attributes.length; ++i) {
-        if (attributes[i].style)
-            styleAttributes[attributes[i].name] = InjectedScript._serializeStyle(attributes[i].style, true);
-    }
-    var result = {};
-    result.inlineStyle = InjectedScript._serializeStyle(node.style, true);
-    result.computedStyle = InjectedScript._serializeStyle(defaultView.getComputedStyle(node));
-    result.matchedCSSRules = matchedCSSRules;
-    result.styleAttributes = styleAttributes;
-    return result;
-}
-
-InjectedScript.getComputedStyle = function(nodeId)
+get instancesCount()
 {
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    return InjectedScript._serializeStyle(node.ownerDocument.defaultView.getComputedStyle(node));
-}
+return this._nodes[this._nodeIndex + this._snapshot._nodeInstancesCountOffset];
+},
 
-InjectedScript.getInlineStyle = function(nodeId)
+get isHidden()
 {
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    return InjectedScript._serializeStyle(node.style, true);
-}
+return this._getType() === this._snapshot._nodeHiddenType;
+},
 
-InjectedScript.applyStyleText = function(styleId, styleText, propertyName)
+get name()
 {
-    var style = InjectedScript._styles[styleId];
-    if (!style)
-        return false;
+return this._snapshot._strings[this._getName()];
+},
 
-    var styleTextLength = styleText.length;
-
-    // Create a new element to parse the user input CSS.
-    var parseElement = document.createElement("span");
-    parseElement.setAttribute("style", styleText);
-
-    var tempStyle = parseElement.style;
-    if (tempStyle.length || !styleTextLength) {
-        // The input was parsable or the user deleted everything, so remove the
-        // original property from the real style declaration. If this represents
-        // a shorthand remove all the longhand properties.
-        if (style.getPropertyShorthand(propertyName)) {
-            var longhandProperties = InjectedScript._getLonghandProperties(style, propertyName);
-            for (var i = 0; i < longhandProperties.length; ++i)
-                style.removeProperty(longhandProperties[i]);
-        } else
-            style.removeProperty(propertyName);
-    }
-
-    // Notify caller that the property was successfully deleted.
-    if (!styleTextLength)
-        return [null, [propertyName]];
-
-    if (!tempStyle.length)
-        return false;
-
-    // Iterate of the properties on the test element's style declaration and
-    // add them to the real style declaration. We take care to move shorthands.
-    var foundShorthands = {};
-    var changedProperties = [];
-    var uniqueProperties = InjectedScript._getUniqueStyleProperties(tempStyle);
-    for (var i = 0; i < uniqueProperties.length; ++i) {
-        var name = uniqueProperties[i];
-        var shorthand = tempStyle.getPropertyShorthand(name);
-
-        if (shorthand && shorthand in foundShorthands)
-            continue;
-
-        if (shorthand) {
-            var value = InjectedScript._getShorthandValue(tempStyle, shorthand);
-            var priority = InjectedScript._getShorthandPriority(tempStyle, shorthand);
-            foundShorthands[shorthand] = true;
-        } else {
-            var value = tempStyle.getPropertyValue(name);
-            var priority = tempStyle.getPropertyPriority(name);
-        }
-
-        // Set the property on the real style declaration.
-        style.setProperty((shorthand || name), value, priority);
-        changedProperties.push(shorthand || name);
-    }
-    return [InjectedScript._serializeStyle(style, true), changedProperties];
-}
-
-InjectedScript.setStyleText = function(style, cssText)
+get selfSize()
 {
-    style.cssText = cssText;
-    return true;
-}
+return this._nodes[this._nodeIndex + this._snapshot._nodeSelfSizeOffset]; 
+},
 
-InjectedScript.toggleStyleEnabled = function(styleId, propertyName, disabled)
+_getName: function()
 {
-    var style = InjectedScript._styles[styleId];
-    if (!style)
-        return false;
+return this._nodes[this._nodeIndex + this._snapshot._nodeNameOffset]; 
+},
 
-    if (disabled) {
-        if (!style.__disabledPropertyValues || !style.__disabledPropertyPriorities) {
-            style.__disabledProperties = {};
-            style.__disabledPropertyValues = {};
-            style.__disabledPropertyPriorities = {};
-        }
-
-        style.__disabledPropertyValues[propertyName] = style.getPropertyValue(propertyName);
-        style.__disabledPropertyPriorities[propertyName] = style.getPropertyPriority(propertyName);
-
-        if (style.getPropertyShorthand(propertyName)) {
-            var longhandProperties = InjectedScript._getLonghandProperties(style, propertyName);
-            for (var i = 0; i < longhandProperties.length; ++i) {
-                style.__disabledProperties[longhandProperties[i]] = true;
-                style.removeProperty(longhandProperties[i]);
-            }
-        } else {
-            style.__disabledProperties[propertyName] = true;
-            style.removeProperty(propertyName);
-        }
-    } else if (style.__disabledProperties && style.__disabledProperties[propertyName]) {
-        var value = style.__disabledPropertyValues[propertyName];
-        var priority = style.__disabledPropertyPriorities[propertyName];
-
-        style.setProperty(propertyName, value, priority);
-        delete style.__disabledProperties[propertyName];
-        delete style.__disabledPropertyValues[propertyName];
-        delete style.__disabledPropertyPriorities[propertyName];
-    }
-    return InjectedScript._serializeStyle(style, true);
-}
-
-InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNodeId)
+_getEdges: function()
 {
-    var rule = InjectedScript._styleRules[ruleId];
-    if (!rule)
-        return false;
+var firstEdgeIndex = this._nodeIndex + this._snapshot._firstEdgeOffset;
+return this._nodes.slice(firstEdgeIndex, firstEdgeIndex + this.edgesCount * this._snapshot._edgeFieldsCount);
+},
 
-    var selectedNode = InjectedScript._nodeForId(selectedNodeId);
-
-    try {
-        var stylesheet = rule.parentStyleSheet;
-        stylesheet.addRule(newContent);
-        var newRule = stylesheet.cssRules[stylesheet.cssRules.length - 1];
-        newRule.style.cssText = rule.style.cssText;
-
-        var parentRules = stylesheet.cssRules;
-        for (var i = 0; i < parentRules.length; ++i) {
-            if (parentRules[i] === rule) {
-                rule.parentStyleSheet.removeRule(i);
-                break;
-            }
-        }
-
-        return [InjectedScript._serializeRule(newRule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode)];
-    } catch(e) {
-        // Report invalid syntax.
-        return false;
-    }
-}
-
-InjectedScript.addStyleSelector = function(newContent, selectedNodeId)
+_getType: function()
 {
-    var selectedNode = InjectedScript._nodeForId(selectedNodeId);
-    if (!selectedNode)
-        return false;
-    var ownerDocument = selectedNode.ownerDocument;
-
-    var stylesheet = ownerDocument.__stylesheet;
-    if (!stylesheet) {
-        var head = ownerDocument.head;
-        var styleElement = ownerDocument.createElement("style");
-        styleElement.type = "text/css";
-        head.appendChild(styleElement);
-        stylesheet = ownerDocument.styleSheets[ownerDocument.styleSheets.length - 1];
-        ownerDocument.__stylesheet = stylesheet;
-    }
-
-    try {
-        stylesheet.addRule(newContent);
-    } catch (e) {
-        // Invalid Syntax for a Selector
-        return false;
-    }
-
-    var rule = stylesheet.cssRules[stylesheet.cssRules.length - 1];
-    rule.__isViaInspector = true;
-
-    return [ InjectedScript._serializeRule(rule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode) ];
-}
-
-InjectedScript._doesSelectorAffectNode = function(selectorText, node)
-{
-    if (!node)
-        return false;
-    var nodes = node.ownerDocument.querySelectorAll(selectorText);
-    for (var i = 0; i < nodes.length; ++i) {
-        if (nodes[i] === node) {
-            return true;
-        }
-    }
-    return false;
-}
-
-InjectedScript.setStyleProperty = function(styleId, name, value)
-{
-    var style = InjectedScript._styles[styleId];
-    if (!style)
-        return false;
-
-    style.setProperty(name, value, "");
-    return true;
-}
-
-InjectedScript._serializeRule = function(rule)
-{
-    var parentStyleSheet = rule.parentStyleSheet;
-
-    var ruleValue = {};
-    ruleValue.selectorText = rule.selectorText;
-    if (parentStyleSheet) {
-        ruleValue.parentStyleSheet = {};
-        ruleValue.parentStyleSheet.href = parentStyleSheet.href;
-    }
-    ruleValue.isUserAgent = parentStyleSheet && !parentStyleSheet.ownerNode && !parentStyleSheet.href;
-    ruleValue.isUser = parentStyleSheet && parentStyleSheet.ownerNode && parentStyleSheet.ownerNode.nodeName == "#document";
-    ruleValue.isViaInspector = !!rule.__isViaInspector;
-
-    // Bind editable scripts only.
-    var doBind = !ruleValue.isUserAgent && !ruleValue.isUser;
-    ruleValue.style = InjectedScript._serializeStyle(rule.style, doBind);
-
-    if (doBind) {
-        if (!rule.id) {
-            rule.id = InjectedScript._lastStyleRuleId++;
-            InjectedScript._styleRules[rule.id] = rule;
-        }
-        ruleValue.id = rule.id;
-        ruleValue.injectedScriptId = injectedScriptId;
-    }
-    return ruleValue;
-}
-
-InjectedScript._serializeStyle = function(style, doBind)
-{
-    var result = {};
-    result.width = style.width;
-    result.height = style.height;
-    result.__disabledProperties = style.__disabledProperties;
-    result.__disabledPropertyValues = style.__disabledPropertyValues;
-    result.__disabledPropertyPriorities = style.__disabledPropertyPriorities;
-    result.properties = [];
-    result.shorthandValues = {};
-    var foundShorthands = {};
-    for (var i = 0; i < style.length; ++i) {
-        var property = {};
-        var name = style[i];
-        property.name = name;
-        property.priority = style.getPropertyPriority(name);
-        property.implicit = style.isPropertyImplicit(name);
-        var shorthand =  style.getPropertyShorthand(name);
-        property.shorthand = shorthand;
-        if (shorthand && !(shorthand in foundShorthands)) {
-            foundShorthands[shorthand] = true;
-            result.shorthandValues[shorthand] = InjectedScript._getShorthandValue(style, shorthand);
-        }
-        property.value = style.getPropertyValue(name);
-        result.properties.push(property);
-    }
-    result.uniqueStyleProperties = InjectedScript._getUniqueStyleProperties(style);
-
-    if (doBind) {
-        if (!style.id) {
-            style.id = InjectedScript._lastStyleId++;
-            InjectedScript._styles[style.id] = style;
-        }
-        result.id = style.id;
-        result.injectedScriptId = injectedScriptId;
-    }
-    return result;
-}
-
-InjectedScript._getUniqueStyleProperties = function(style)
-{
-    var properties = [];
-    var foundProperties = {};
-
-    for (var i = 0; i < style.length; ++i) {
-        var property = style[i];
-        if (property in foundProperties)
-            continue;
-        foundProperties[property] = true;
-        properties.push(property);
-    }
-
-    return properties;
-}
-
-
-InjectedScript._getLonghandProperties = function(style, shorthandProperty)
-{
-    var properties = [];
-    var foundProperties = {};
-
-    for (var i = 0; i < style.length; ++i) {
-        var individualProperty = style[i];
-        if (individualProperty in foundProperties || style.getPropertyShorthand(individualProperty) !== shorthandProperty)
-            continue;
-        foundProperties[individualProperty] = true;
-        properties.push(individualProperty);
-    }
-
-    return properties;
-}
-
-InjectedScript._getShorthandValue = function(style, shorthandProperty)
-{
-    var value = style.getPropertyValue(shorthandProperty);
-    if (!value) {
-        // Some shorthands (like border) return a null value, so compute a shorthand value.
-        // FIXME: remove this when http://bugs.webkit.org/show_bug.cgi?id=15823 is fixed.
-
-        var foundProperties = {};
-        for (var i = 0; i < style.length; ++i) {
-            var individualProperty = style[i];
-            if (individualProperty in foundProperties || style.getPropertyShorthand(individualProperty) !== shorthandProperty)
-                continue;
-
-            var individualValue = style.getPropertyValue(individualProperty);
-            if (style.isPropertyImplicit(individualProperty) || individualValue === "initial")
-                continue;
-
-            foundProperties[individualProperty] = true;
-
-            if (!value)
-                value = "";
-            else if (value.length)
-                value += " ";
-            value += individualValue;
-        }
-    }
-    return value;
-}
-
-InjectedScript._getShorthandPriority = function(style, shorthandProperty)
-{
-    var priority = style.getPropertyPriority(shorthandProperty);
-    if (!priority) {
-        for (var i = 0; i < style.length; ++i) {
-            var individualProperty = style[i];
-            if (style.getPropertyShorthand(individualProperty) !== shorthandProperty)
-                continue;
-            priority = style.getPropertyPriority(individualProperty);
-            break;
-        }
-    }
-    return priority;
-}
-
-InjectedScript.getPrototypes = function(nodeId)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-
-    var result = [];
-    for (var prototype = node; prototype; prototype = prototype.__proto__) {
-        var title = InjectedScript._describe(prototype, true);
-        if (title.match(/Prototype$/)) {
-            title = title.replace(/Prototype$/, "");
-        }
-        result.push(title);
-    }
-    return result;
-}
-
-InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate)
-{
-    var object = InjectedScript._resolveObject(objectProxy);
-    if (!InjectedScript._isDefined(object))
-        return false;
-    var properties = [];
-    var propertyNames = ignoreHasOwnProperty ? InjectedScript._getPropertyNames(object) : Object.getOwnPropertyNames(object);
-    if (!ignoreHasOwnProperty && object.__proto__)
-        propertyNames.push("__proto__");
-
-    // Go over properties, prepare results.
-    for (var i = 0; i < propertyNames.length; ++i) {
-        var propertyName = propertyNames[i];
-
-        var property = {};
-        property.name = propertyName + "";
-        property.parentObjectProxy = objectProxy;
-        var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
-        if (!property.isGetter) {
-            try {
-                var childObject = object[propertyName];
-                var childObjectProxy = new InjectedScript.createProxyObject(childObject, objectProxy.objectId, abbreviate);
-                childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : [];
-                childObjectProxy.path.push(propertyName);
-                property.value = childObjectProxy;
-            } catch(e) {
-                property.value = { description: e.toString() };
-                property.isError = true;
-            }
-        } else {
-            // FIXME: this should show something like "getter" (bug 16734).
-            property.value = { description: "\u2014" }; // em dash
-            property.isGetter = true;
-        }
-        properties.push(property);
-    }
-    return properties;
-}
-
-InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression)
-{
-    var object = InjectedScript._resolveObject(objectProxy);
-    if (!InjectedScript._isDefined(object))
-        return false;
-
-    var expressionLength = expression.length;
-    if (!expressionLength) {
-        delete object[propertyName];
-        return !(propertyName in object);
-    }
-
-    try {
-        // Surround the expression in parenthesis so the result of the eval is the result
-        // of the whole expression not the last potential sub-expression.
-
-        // There is a regression introduced here: eval is now happening against global object,
-        // not call frame while on a breakpoint.
-        // TODO: bring evaluation against call frame back.
-        var result = InjectedScript._window().eval("(" + expression + ")");
-        // Store the result in the property.
-        object[propertyName] = result;
-        return true;
-    } catch(e) {
-        try {
-            var result = InjectedScript._window().eval("\"" + InjectedScript._escapeCharacters(expression, "\"") + "\"");
-            object[propertyName] = result;
-            return true;
-        } catch(e) {
-            return false;
-        }
-    }
-}
-
-InjectedScript.getNodePropertyValue = function(nodeId, propertyName)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-    var result = node[propertyName];
-    return result !== undefined ? result : false;
-}
-
-InjectedScript.setOuterHTML = function(nodeId, value, expanded)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-
-    var parent = node.parentNode;
-    var prevSibling = node.previousSibling;
-    node.outerHTML = value;
-    var newNode = prevSibling ? prevSibling.nextSibling : parent.firstChild;
-
-    return InjectedScriptHost.pushNodePathToFrontend(newNode, expanded, false);
-}
-
-InjectedScript._populatePropertyNames = function(object, resultSet)
-{
-    for (var o = object; o; o = o.__proto__) {
-        try {
-            var names = Object.getOwnPropertyNames(o);
-            for (var i = 0; i < names.length; ++i)
-                resultSet[names[i] + ""] = true;
-        } catch (e) {
-        }
-    }
-}
-
-InjectedScript._getPropertyNames = function(object, resultSet)
-{
-    var propertyNameSet = {};
-    InjectedScript._populatePropertyNames(object, propertyNameSet);
-    return Object.keys(propertyNameSet);
-}
-
-InjectedScript.getCompletions = function(expression, includeInspectorCommandLineAPI, callFrameId)
-{
-    var props = {};
-    try {
-        var expressionResult;
-        // Evaluate on call frame if call frame id is available.
-        if (typeof callFrameId === "number") {
-            var callFrame = InjectedScript._callFrameForId(callFrameId);
-            if (!callFrame)
-                return props;
-            if (expression)
-                expressionResult = InjectedScript._evaluateOn(callFrame.evaluate, callFrame, expression);
-            else {
-                // Evaluate into properties in scope of the selected call frame.
-                var scopeChain = callFrame.scopeChain;
-                for (var i = 0; i < scopeChain.length; ++i)
-                    InjectedScript._populatePropertyNames(scopeChain[i], props);
-            }
-        } else {
-            if (!expression)
-                expression = "this";
-            expressionResult = InjectedScript._evaluateOn(InjectedScript._window().eval, InjectedScript._window(), expression);
-        }
-        if (typeof expressionResult == "object")
-            InjectedScript._populatePropertyNames(expressionResult, props);
-        if (includeInspectorCommandLineAPI)
-            for (var prop in InjectedScript._window().console._inspectorCommandLineAPI)
-                if (prop.charAt(0) !== '_')
-                    props[prop] = true;
-    } catch(e) {
-    }
-    return props;
-}
-
-InjectedScript.evaluate = function(expression, objectGroup)
-{
-    return InjectedScript._evaluateAndWrap(InjectedScript._window().eval, InjectedScript._window(), expression, objectGroup);
-}
-
-InjectedScript._evaluateAndWrap = function(evalFunction, object, expression, objectGroup)
-{
-    var result = {};
-    try {
-        result.value = InjectedScript.wrapObject(InjectedScript._evaluateOn(evalFunction, object, expression), objectGroup);
-
-        // Handle error that might have happened while describing result.
-        if (result.value.errorText) {
-            result.value = result.value.errorText;
-            result.isException = true;
-        }
-    } catch (e) {
-        result.value = e.toString();
-        result.isException = true;
-    }
-    return result;
-}
-
-InjectedScript._evaluateOn = function(evalFunction, object, expression)
-{
-    InjectedScript._ensureCommandLineAPIInstalled(evalFunction, object);
-    // Surround the expression in with statements to inject our command line API so that
-    // the window object properties still take more precedent than our API functions.
-    expression = "with (window.console._inspectorCommandLineAPI) { with (window) {\n" + expression + "\n} }";
-    var value = evalFunction.call(object, expression);
-
-    // When evaluating on call frame error is not thrown, but returned as a value.
-    if (InjectedScript._type(value) === "error")
-        throw value.toString();
-
-    return value;
-}
-
-InjectedScript.addInspectedNode = function(nodeId)
-{
-    var node = InjectedScript._nodeForId(nodeId);
-    if (!node)
-        return false;
-
-    InjectedScript._ensureCommandLineAPIInstalled(InjectedScript._window().eval, InjectedScript._window());
-    var inspectedNodes = InjectedScript._window().console._inspectorCommandLineAPI._inspectedNodes;
-    inspectedNodes.unshift(node);
-    if (inspectedNodes.length >= 5)
-        inspectedNodes.pop();
-    return true;
-}
-
-InjectedScript.performSearch = function(whitespaceTrimmedQuery)
-{
-    // FIXME: Few things are missing here:
-    // 1) Search works with node granularity - number of matches within node is not calculated.
-    // 2) Search does not work outside main documents' domain - we need to use specific InjectedScript instances
-    //    for other domains.
-    // 3) There is no need to push all search results to the front-end at a time, pushing next / previous result
-    //    is sufficient.
-    var tagNameQuery = whitespaceTrimmedQuery;
-    var attributeNameQuery = whitespaceTrimmedQuery;
-    var startTagFound = (tagNameQuery.indexOf("<") === 0);
-    var endTagFound = (tagNameQuery.lastIndexOf(">") === (tagNameQuery.length - 1));
-
-    if (startTagFound || endTagFound) {
-        var tagNameQueryLength = tagNameQuery.length;
-        tagNameQuery = tagNameQuery.substring((startTagFound ? 1 : 0), (endTagFound ? (tagNameQueryLength - 1) : tagNameQueryLength));
-    }
-
-    // Check the tagNameQuery is it is a possibly valid tag name.
-    if (!/^[a-zA-Z0-9\-_:]+$/.test(tagNameQuery))
-        tagNameQuery = null;
-
-    // Check the attributeNameQuery is it is a possibly valid tag name.
-    if (!/^[a-zA-Z0-9\-_:]+$/.test(attributeNameQuery))
-        attributeNameQuery = null;
-
-    const escapedQuery = InjectedScript._escapeCharacters(whitespaceTrimmedQuery, "'");
-    const escapedTagNameQuery = (tagNameQuery ?  InjectedScript._escapeCharacters(tagNameQuery, "'") : null);
-    const escapedWhitespaceTrimmedQuery = InjectedScript._escapeCharacters(whitespaceTrimmedQuery, "'");
-    const searchResultsProperty = InjectedScript._includedInSearchResultsPropertyName;
-
-    function addNodesToResults(nodes, length, getItem)
-    {
-        if (!length)
-            return;
-
-        var nodeIds = [];
-        for (var i = 0; i < length; ++i) {
-            var node = getItem.call(nodes, i);
-            // Skip this node if it already has the property.
-            if (searchResultsProperty in node)
-                continue;
-
-            if (!InjectedScript._searchResults.length) {
-                InjectedScript._currentSearchResultIndex = 0;
-            }
-
-            node[searchResultsProperty] = true;
-            InjectedScript._searchResults.push(node);
-            var nodeId = InjectedScriptHost.pushNodePathToFrontend(node, false, false);
-            nodeIds.push(nodeId);
-        }
-        InjectedScriptHost.addNodesToSearchResult(nodeIds.join(","));
-    }
-
-    function matchExactItems(doc)
-    {
-        matchExactId.call(this, doc);
-        matchExactClassNames.call(this, doc);
-        matchExactTagNames.call(this, doc);
-        matchExactAttributeNames.call(this, doc);
-    }
-
-    function matchExactId(doc)
-    {
-        const result = doc.__proto__.getElementById.call(doc, whitespaceTrimmedQuery);
-        addNodesToResults.call(this, result, (result ? 1 : 0), function() { return this });
-    }
-
-    function matchExactClassNames(doc)
-    {
-        const result = doc.__proto__.getElementsByClassName.call(doc, whitespaceTrimmedQuery);
-        addNodesToResults.call(this, result, result.length, result.item);
-    }
-
-    function matchExactTagNames(doc)
-    {
-        if (!tagNameQuery)
-            return;
-        const result = doc.__proto__.getElementsByTagName.call(doc, tagNameQuery);
-        addNodesToResults.call(this, result, result.length, result.item);
-    }
-
-    function matchExactAttributeNames(doc)
-    {
-        if (!attributeNameQuery)
-            return;
-        const result = doc.__proto__.querySelectorAll.call(doc, "[" + attributeNameQuery + "]");
-        addNodesToResults.call(this, result, result.length, result.item);
-    }
-
-    function matchPartialTagNames(doc)
-    {
-        if (!tagNameQuery)
-            return;
-        const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-        addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem);
-    }
-
-    function matchStartOfTagNames(doc)
-    {
-        if (!tagNameQuery)
-            return;
-        const result = doc.__proto__.evaluate.call(doc, "//*[starts-with(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-        addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem);
-    }
-
-    function matchPartialTagNamesAndAttributeValues(doc)
-    {
-        if (!tagNameQuery) {
-            matchPartialAttributeValues.call(this, doc);
-            return;
-        }
-
-        const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "') or contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-        addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem);
-    }
-
-    function matchPartialAttributeValues(doc)
-    {
-        const result = doc.__proto__.evaluate.call(doc, "//*[contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-        addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem);
-    }
-
-    function matchStyleSelector(doc)
-    {
-        const result = doc.__proto__.querySelectorAll.call(doc, whitespaceTrimmedQuery);
-        addNodesToResults.call(this, result, result.length, result.item);
-    }
-
-    function matchPlainText(doc)
-    {
-        const result = doc.__proto__.evaluate.call(doc, "//text()[contains(., '" + escapedQuery + "')] | //comment()[contains(., '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-        addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem);
-    }
-
-    function matchXPathQuery(doc)
-    {
-        const result = doc.__proto__.evaluate.call(doc, whitespaceTrimmedQuery, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE);
-        addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem);
-    }
-
-    function finishedSearching()
-    {
-        // Remove the searchResultsProperty now that the search is finished.
-        for (var i = 0; i < InjectedScript._searchResults.length; ++i)
-            delete InjectedScript._searchResults[i][searchResultsProperty];
-    }
-
-    const mainFrameDocument = InjectedScript._window().document;
-    const searchDocuments = [mainFrameDocument];
-    var searchFunctions;
-    if (tagNameQuery && startTagFound && endTagFound)
-        searchFunctions = [matchExactTagNames, matchPlainText];
-    else if (tagNameQuery && startTagFound)
-        searchFunctions = [matchStartOfTagNames, matchPlainText];
-    else if (tagNameQuery && endTagFound) {
-        // FIXME: we should have a matchEndOfTagNames search function if endTagFound is true but not startTagFound.
-        // This requires ends-with() support in XPath, WebKit only supports starts-with() and contains().
-        searchFunctions = [matchPartialTagNames, matchPlainText];
-    } else if (whitespaceTrimmedQuery === "//*" || whitespaceTrimmedQuery === "*") {
-        // These queries will match every node. Matching everything isn't useful and can be slow for large pages,
-        // so limit the search functions list to plain text and attribute matching.
-        searchFunctions = [matchPartialAttributeValues, matchPlainText];
-    } else
-        searchFunctions = [matchExactItems, matchStyleSelector, matchPartialTagNamesAndAttributeValues, matchPlainText, matchXPathQuery];
-
-    // Find all frames, iframes and object elements to search their documents.
-    const querySelectorAllFunction = InjectedScript._window().Document.prototype.querySelectorAll;
-    const subdocumentResult = querySelectorAllFunction.call(mainFrameDocument, "iframe, frame, object");
-
-    for (var i = 0; i < subdocumentResult.length; ++i) {
-        var element = subdocumentResult.item(i);
-        if (element.contentDocument)
-            searchDocuments.push(element.contentDocument);
-    }
-
-    const panel = InjectedScript;
-    var documentIndex = 0;
-    var searchFunctionIndex = 0;
-    var chunkIntervalIdentifier = null;
-
-    // Split up the work into chunks so we don't block the UI thread while processing.
-
-    function processChunk()
-    {
-        var searchDocument = searchDocuments[documentIndex];
-        var searchFunction = searchFunctions[searchFunctionIndex];
-
-        if (++searchFunctionIndex > searchFunctions.length) {
-            searchFunction = searchFunctions[0];
-            searchFunctionIndex = 0;
-
-            if (++documentIndex > searchDocuments.length) {
-                if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier)
-                    delete panel._currentSearchChunkIntervalIdentifier;
-                clearInterval(chunkIntervalIdentifier);
-                finishedSearching.call(panel);
-                return;
-            }
-
-            searchDocument = searchDocuments[documentIndex];
-        }
-
-        if (!searchDocument || !searchFunction)
-            return;
-
-        try {
-            searchFunction.call(panel, searchDocument);
-        } catch(err) {
-            // ignore any exceptions. the query might be malformed, but we allow that.
-        }
-    }
-
-    processChunk();
-
-    chunkIntervalIdentifier = setInterval(processChunk, 25);
-    InjectedScript._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier;
-    return true;
-}
-
-InjectedScript.searchCanceled = function()
-{
-    if (InjectedScript._searchResults) {
-        const searchResultsProperty = InjectedScript._includedInSearchResultsPropertyName;
-        for (var i = 0; i < this._searchResults.length; ++i) {
-            var node = this._searchResults[i];
-
-            // Remove the searchResultsProperty since there might be an unfinished search.
-            delete node[searchResultsProperty];
-        }
-    }
-
-    if (InjectedScript._currentSearchChunkIntervalIdentifier) {
-        clearInterval(InjectedScript._currentSearchChunkIntervalIdentifier);
-        delete InjectedScript._currentSearchChunkIntervalIdentifier;
-    }
-    InjectedScript._searchResults = [];
-    return true;
-}
-
-InjectedScript.openInInspectedWindow = function(url)
-{
-    // Don't call window.open on wrapper - popup blocker mutes it.
-    // URIs should have no double quotes.
-    InjectedScript._window().eval("window.open(\"" + url + "\")");
-    return true;
-}
-
-InjectedScript.callFrames = function()
-{
-    var callFrame = InjectedScriptHost.currentCallFrame();
-    if (!callFrame)
-        return false;
-
-    var result = [];
-    var depth = 0;
-    do {
-        result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
-        callFrame = callFrame.caller;
-    } while (callFrame);
-    return result;
-}
-
-InjectedScript.evaluateInCallFrame = function(callFrameId, code, objectGroup)
-{
-    var callFrame = InjectedScript._callFrameForId(callFrameId);
-    if (!callFrame)
-        return false;
-    return InjectedScript._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup);
-}
-
-InjectedScript._callFrameForId = function(id)
-{
-    var callFrame = InjectedScriptHost.currentCallFrame();
-    while (--id >= 0 && callFrame)
-        callFrame = callFrame.caller;
-    return callFrame;
-}
-
-InjectedScript.clearConsoleMessages = function()
-{
-    InjectedScriptHost.clearConsoleMessages();
-    return true;
-}
-
-InjectedScript._inspectObject = function(o)
-{
-    if (arguments.length === 0)
-        return;
-
-    inspectedWindow.console.log(o);
-    if (InjectedScript._type(o) === "node") {
-        InjectedScriptHost.pushNodePathToFrontend(o, false, true);
-    } else {
-        switch (InjectedScript._describe(o)) {
-            case "Database":
-                InjectedScriptHost.selectDatabase(o);
-                break;
-            case "Storage":
-                InjectedScriptHost.selectDOMStorage(o);
-                break;
-        }
-    }
-}
-
-InjectedScript._copy = function(o)
-{
-    if (InjectedScript._type(o) === "node") {
-        var nodeId = InjectedScriptHost.pushNodePathToFrontend(o, false, false);
-        InjectedScriptHost.copyNode(nodeId);
-    } else {
-        InjectedScriptHost.copyText(o);
-    }
-}
-
-InjectedScript._ensureCommandLineAPIInstalled = function(evalFunction, evalObject)
-{
-    if (evalFunction.call(evalObject, "window.console._inspectorCommandLineAPI"))
-        return;
-    var inspectorCommandLineAPI = evalFunction.call(evalObject, "window.console._inspectorCommandLineAPI = { \n\
-        $: function() { return document.getElementById.apply(document, arguments) }, \n\
-        $$: function() { return document.querySelectorAll.apply(document, arguments) }, \n\
-        $x: function(xpath, context) \n\
-        { \n\
-            var nodes = []; \n\
-            try { \n\
-                var doc = context || document; \n\
-                var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); \n\
-                var node; \n\
-                while (node = results.iterateNext()) nodes.push(node); \n\
-            } catch (e) {} \n\
-            return nodes; \n\
-        }, \n\
-        dir: function() { return console.dir.apply(console, arguments) }, \n\
-        dirxml: function() { return console.dirxml.apply(console, arguments) }, \n\
-        keys: function(o) { var a = []; for (var k in o) a.push(k); return a; }, \n\
-        values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \n\
-        profile: function() { return console.profile.apply(console, arguments) }, \n\
-        profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \n\
-        _logEvent: function _inspectorCommandLineAPI_logEvent(e) { console.log(e.type, e); }, \n\
-        _allEventTypes: [\"mouse\", \"key\", \"load\", \"unload\", \"abort\", \"error\", \n\
-            \"select\", \"change\", \"submit\", \"reset\", \"focus\", \"blur\", \n\
-            \"resize\", \"scroll\"], \n\
-        _normalizeEventTypes: function(t) \n\
-        { \n\
-            if (typeof t === \"undefined\") \n\
-                t = console._inspectorCommandLineAPI._allEventTypes; \n\
-            else if (typeof t === \"string\") \n\
-                t = [t]; \n\
-            var i, te = []; \n\
-            for (i = 0; i < t.length; i++) { \n\
-                if (t[i] === \"mouse\") \n\
-                    te.splice(0, 0, \"mousedown\", \"mouseup\", \"click\", \"dblclick\", \n\
-                        \"mousemove\", \"mouseover\", \"mouseout\"); \n\
-                else if (t[i] === \"key\") \n\
-                    te.splice(0, 0, \"keydown\", \"keyup\", \"keypress\"); \n\
-                else \n\
-                    te.push(t[i]); \n\
-            } \n\
-            return te; \n\
-        }, \n\
-        monitorEvents: function(o, t) \n\
-        { \n\
-            if (!o || !o.addEventListener || !o.removeEventListener) \n\
-                return; \n\
-            t = console._inspectorCommandLineAPI._normalizeEventTypes(t); \n\
-            for (i = 0; i < t.length; i++) { \n\
-                o.removeEventListener(t[i], console._inspectorCommandLineAPI._logEvent, false); \n\
-                o.addEventListener(t[i], console._inspectorCommandLineAPI._logEvent, false); \n\
-            } \n\
-        }, \n\
-        unmonitorEvents: function(o, t) \n\
-        { \n\
-            if (!o || !o.removeEventListener) \n\
-                return; \n\
-            t = console._inspectorCommandLineAPI._normalizeEventTypes(t); \n\
-            for (i = 0; i < t.length; i++) { \n\
-                o.removeEventListener(t[i], console._inspectorCommandLineAPI._logEvent, false); \n\
-            } \n\
-        }, \n\
-        _inspectedNodes: [], \n\
-        get $0() { return console._inspectorCommandLineAPI._inspectedNodes[0] }, \n\
-        get $1() { return console._inspectorCommandLineAPI._inspectedNodes[1] }, \n\
-        get $2() { return console._inspectorCommandLineAPI._inspectedNodes[2] }, \n\
-        get $3() { return console._inspectorCommandLineAPI._inspectedNodes[3] }, \n\
-        get $4() { return console._inspectorCommandLineAPI._inspectedNodes[4] }, \n\
-    };");
-
-    inspectorCommandLineAPI.clear = InjectedScript.clearConsoleMessages;
-    inspectorCommandLineAPI.inspect = InjectedScript._inspectObject;
-    inspectorCommandLineAPI.copy = InjectedScript._copy;
-}
-
-InjectedScript._resolveObject = function(objectProxy)
-{
-    var object = InjectedScript._objectForId(objectProxy.objectId);
-    var path = objectProxy.path;
-    var protoDepth = objectProxy.protoDepth;
-
-    // Follow the property path.
-    for (var i = 0; InjectedScript._isDefined(object) && path && i < path.length; ++i)
-        object = object[path[i]];
-
-    return object;
-}
-
-InjectedScript._window = function()
-{
-    // TODO: replace with 'return window;' once this script is injected into
-    // the page's context.
-    return inspectedWindow;
-}
-
-InjectedScript._nodeForId = function(nodeId)
-{
-    if (!nodeId)
-        return null;
-    return InjectedScriptHost.nodeForId(nodeId);
-}
-
-InjectedScript._objectForId = function(objectId)
-{
-    // There are three types of object ids used:
-    // - numbers point to DOM Node via the InspectorDOMAgent mapping
-    // - strings point to console objects cached in InspectorController for lazy evaluation upon them
-    // - objects contain complex ids and are currently used for scoped objects
-    if (typeof objectId === "number") {
-        return InjectedScript._nodeForId(objectId);
-    } else if (typeof objectId === "string") {
-        return InjectedScript.unwrapObject(objectId);
-    } else if (typeof objectId === "object") {
-        var callFrame = InjectedScript._callFrameForId(objectId.callFrame);
-        if (objectId.thisObject)
-            return callFrame.thisObject;
-        else
-            return callFrame.scopeChain[objectId.chainIndex];
-    }
-    return objectId;
-}
-
-InjectedScript.pushNodeToFrontend = function(objectProxy)
-{
-    var object = InjectedScript._resolveObject(objectProxy);
-    if (!object || InjectedScript._type(object) !== "node")
-        return false;
-    return InjectedScriptHost.pushNodePathToFrontend(object, false, false);
-}
-
-InjectedScript.nodeByPath = function(path)
-{
-    // We make this call through the injected script only to get a nice
-    // callback for it.
-    return InjectedScriptHost.pushNodeByPathToFrontend(path.join(","));
-}
-
-// Called from within InspectorController on the 'inspected page' side.
-InjectedScript.createProxyObject = function(object, objectId, abbreviate)
-{
-    var result = {};
-    result.injectedScriptId = injectedScriptId;
-    result.objectId = objectId;
-    result.type = InjectedScript._type(object);
-    if (result.type === "array")
-        result.propertyLength = object.length;
-
-    var type = typeof object;
-    
-    result.hasChildren = (type === "object" && object !== null && (Object.getOwnPropertyNames(object).length || object.__proto__)) || type === "function";
-    try {
-        result.description = InjectedScript._describe(object, abbreviate);
-    } catch (e) {
-        result.errorText = e.toString();
-    }
-    return result;
-}
-
-InjectedScript.evaluateOnSelf = function(funcBody)
-{
-    return window.eval("(" + funcBody + ")();");
-}
-
-InjectedScript.CallFrameProxy = function(id, callFrame)
-{
-    this.id = id;
-    this.type = callFrame.type;
-    this.functionName = (this.type === "function" ? callFrame.functionName : "");
-    this.sourceID = callFrame.sourceID;
-    this.line = callFrame.line;
-    this.scopeChain = this._wrapScopeChain(callFrame);
-}
-
-InjectedScript.CallFrameProxy.prototype = {
-    _wrapScopeChain: function(callFrame)
-    {
-        var foundLocalScope = false;
-        var scopeChain = callFrame.scopeChain;
-        var scopeChainProxy = [];
-        for (var i = 0; i < scopeChain.length; ++i) {
-            var scopeObject = scopeChain[i];
-            var scopeObjectProxy = InjectedScript.createProxyObject(scopeObject, { callFrame: this.id, chainIndex: i }, true);
-
-            if (InjectedScriptHost.isActivation(scopeObject)) {
-                if (!foundLocalScope)
-                    scopeObjectProxy.thisObject = InjectedScript.createProxyObject(callFrame.thisObject, { callFrame: this.id, thisObject: true }, true);
-                else
-                    scopeObjectProxy.isClosure = true;
-                foundLocalScope = true;
-                scopeObjectProxy.isLocal = true;
-            } else if (foundLocalScope && scopeObject instanceof InjectedScript._window().Element)
-                scopeObjectProxy.isElement = true;
-            else if (foundLocalScope && scopeObject instanceof InjectedScript._window().Document)
-                scopeObjectProxy.isDocument = true;
-            else if (!foundLocalScope)
-                scopeObjectProxy.isWithBlock = true;
-            scopeChainProxy.push(scopeObjectProxy);
-        }
-        return scopeChainProxy;
-    }
-}
-
-InjectedScript.executeSql = function(callId, databaseId, query)
-{
-    function successCallback(tx, result)
-    {
-        var rows = result.rows;
-        var result = [];
-        var length = rows.length;
-        for (var i = 0; i < length; ++i) {
-            var data = {};
-            result.push(data);
-            var row = rows.item(i);
-            for (var columnIdentifier in row) {
-                // FIXME: (Bug 19439) We should specially format SQL NULL here
-                // (which is represented by JavaScript null here, and turned
-                // into the string "null" by the String() function).
-                var text = row[columnIdentifier];
-                data[columnIdentifier] = String(text);
-            }
-        }
-        InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, result, false);
-    }
-
-    function errorCallback(tx, error)
-    {
-        InjectedScriptHost.reportDidDispatchOnInjectedScript(callId, error, false);
-    }
-
-    function queryTransaction(tx)
-    {
-        tx.executeSql(query, null, successCallback, errorCallback);
-    }
-
-    var database = InjectedScriptHost.databaseForId(databaseId);
-    if (!database)
-        errorCallback(null, { code : 2 });  // Return as unexpected version.
-    database.transaction(queryTransaction, errorCallback);
-    return true;
-}
-
-InjectedScript._isDefined = function(object)
-{
-    return object || object instanceof inspectedWindow.HTMLAllCollection;
-}
-
-InjectedScript._type = function(obj)
-{
-    if (obj === null)
-        return "null";
-
-    // FIXME(33716): typeof document.all is always 'undefined'.
-    if (obj instanceof inspectedWindow.HTMLAllCollection)
-        return "array";
-
-    var type = typeof obj;
-    if (type !== "object" && type !== "function")
-        return type;
-
-    var win = InjectedScript._window();
-
-    if (obj instanceof win.Node)
-        return (obj.nodeType === undefined ? type : "node");
-    if (obj instanceof win.String)
-        return "string";
-    if (obj instanceof win.Array)
-        return "array";
-    if (obj instanceof win.Boolean)
-        return "boolean";
-    if (obj instanceof win.Number)
-        return "number";
-    if (obj instanceof win.Date)
-        return "date";
-    if (obj instanceof win.RegExp)
-        return "regexp";
-    if (obj instanceof win.NodeList)
-        return "array";
-    if (obj instanceof win.HTMLCollection || obj instanceof win.HTMLAllCollection)
-        return "array";
-    if (obj instanceof win.Error)
-        return "error";
-    return type;
-}
-
-InjectedScript._describe = function(obj, abbreviated)
-{
-    var type1 = InjectedScript._type(obj);
-    var type2 = InjectedScript._className(obj);
-
-    switch (type1) {
-    case "object":
-    case "node":
-    case "array":
-        return type2;
-    case "string":
-        if (!abbreviated)
-            return obj;
-        if (obj.length > 100)
-            return "\"" + obj.substring(0, 100) + "\u2026\"";
-        return "\"" + obj + "\"";
-    case "function":
-        var objectText = String(obj);
-        if (!/^function /.test(objectText))
-            objectText = (type2 == "object") ? type1 : type2;
-        else if (abbreviated)
-            objectText = /.*/.exec(obj)[0].replace(/ +$/g, "");
-        return objectText;
-    default:
-        return String(obj);
-    }
-}
-
-InjectedScript._className = function(obj)
-{
-    return Object.prototype.toString.call(obj).replace(/^\[object (.*)\]$/i, "$1")
-}
-
-InjectedScript._escapeCharacters = function(str, chars)
-{
-    var foundChar = false;
-    for (var i = 0; i < chars.length; ++i) {
-        if (str.indexOf(chars.charAt(i)) !== -1) {
-            foundChar = true;
-            break;
-        }
-    }
-
-    if (!foundChar)
-        return str;
-
-    var result = "";
-    for (var i = 0; i < str.length; ++i) {
-        if (chars.indexOf(str.charAt(i)) !== -1)
-            result += "\\";
-        result += str.charAt(i);
-    }
-
-    return result;
-}
-
-return InjectedScript;
-});
-
-/* InjectedScriptAccess.js */
-
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- * Copyright (C) 2009 Joseph Pecoraro
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-function InjectedScriptAccess(injectedScriptId) {
-    this._injectedScriptId = injectedScriptId;
-}
-
-InjectedScriptAccess.get = function(injectedScriptId)
-{
-    return new InjectedScriptAccess(injectedScriptId);
-}
-
-InjectedScriptAccess.getDefault = function()
-{
-    return InjectedScriptAccess.get(0);
-}
-
-InjectedScriptAccess.prototype = {};
-
-InjectedScriptAccess._installHandler = function(methodName, async)
-{
-    InjectedScriptAccess.prototype[methodName] = function()
-    {
-        var allArgs = Array.prototype.slice.call(arguments);
-        var callback = allArgs[allArgs.length - 1];
-        var argsString = JSON.stringify(Array.prototype.slice.call(allArgs, 0, allArgs.length - 1));
-        
-        function myCallback(result, isException)
-        {
-            if (!isException)
-                callback(result);
-            else
-                WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage("Error dispatching: " + methodName));
-        }
-        var callId = WebInspector.Callback.wrap(myCallback);
-
-        InspectorBackend.dispatchOnInjectedScript(callId, this._injectedScriptId, methodName, argsString, !!async);
-    };
-}
-
-// InjectedScriptAccess message forwarding puts some constraints on the way methods are implemented and called:
-// - Make sure corresponding methods in InjectedScript return non-null and non-undefined values,
-// - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function.
-// We keep these sorted.
-InjectedScriptAccess._installHandler("addInspectedNode");
-InjectedScriptAccess._installHandler("addStyleSelector");
-InjectedScriptAccess._installHandler("applyStyleRuleText");
-InjectedScriptAccess._installHandler("applyStyleText");
-InjectedScriptAccess._installHandler("clearConsoleMessages");
-InjectedScriptAccess._installHandler("evaluate");
-InjectedScriptAccess._installHandler("evaluateInCallFrame");
-InjectedScriptAccess._installHandler("getCompletions");
-InjectedScriptAccess._installHandler("getComputedStyle");
-InjectedScriptAccess._installHandler("getInlineStyle");
-InjectedScriptAccess._installHandler("getNodePropertyValue");
-InjectedScriptAccess._installHandler("getProperties");
-InjectedScriptAccess._installHandler("getPrototypes");
-InjectedScriptAccess._installHandler("getStyles");
-InjectedScriptAccess._installHandler("openInInspectedWindow");
-InjectedScriptAccess._installHandler("performSearch");
-InjectedScriptAccess._installHandler("pushNodeToFrontend");
-InjectedScriptAccess._installHandler("nodeByPath");
-InjectedScriptAccess._installHandler("searchCanceled");
-InjectedScriptAccess._installHandler("setOuterHTML");
-InjectedScriptAccess._installHandler("setPropertyValue");
-InjectedScriptAccess._installHandler("setStyleProperty");
-InjectedScriptAccess._installHandler("setStyleText");
-InjectedScriptAccess._installHandler("toggleStyleEnabled");
-InjectedScriptAccess._installHandler("evaluateOnSelf");
-
-// Some methods can't run synchronously even on the injected script side (such as DB transactions).
-// Mark them as asynchronous here.
-InjectedScriptAccess._installHandler("executeSql", true);
-
-WebInspector.didDispatchOnInjectedScript = WebInspector.Callback.processCallback;
-
-/* TimelineAgent.js */
-
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.TimelineAgent = function() {
-    // Not implemented.
+return this._nodes[this._nodeIndex + this._snapshot._nodeTypeOffset];
 }
-
-// Must be kept in sync with TimelineItem.h
-WebInspector.TimelineAgent.RecordType = {
-    EventDispatch : 0,
-    Layout : 1,
-    RecalculateStyles : 2,
-    Paint : 3,
-    ParseHTML : 4,
-    TimerInstall : 5,
-    TimerRemove : 6,
-    TimerFire : 7,
-    XHRReadyStateChange : 8,
-    XHRLoad : 9,
-    EvaluateScript : 10,
-    MarkTimeline : 11,
-    ResourceSendRequest : 12,
-    ResourceReceiveResponse : 13,
-    ResourceFinish : 14,
-    FunctionCall : 15
 };
 
-WebInspector.addRecordToTimeline = function(record) {
-    if (WebInspector.panels.timeline)
-        WebInspector.panels.timeline.addRecordToTimeline(record);
-}
-
-WebInspector.timelineProfilerWasStarted = function() {
-    if (WebInspector.panels.timeline)
-        WebInspector.panels.timeline.timelineWasStarted();
-}
-
-WebInspector.timelineProfilerWasStopped = function() {
-    if (WebInspector.panels.timeline)
-        WebInspector.panels.timeline.timelineWasStopped();
-}
-
-/* TimelinePanel.js */
-
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.TimelinePanel = function()
+WebInspector.HeapSnapshot = function(profile)
 {
-    WebInspector.Panel.call(this);
-    this.element.addStyleClass("timeline");
+this._profile = profile;
+this._nodes = profile.nodes;
+this._strings = profile.strings;
 
-    this._overviewPane = new WebInspector.TimelineOverviewPane(this.categories);
-    this._overviewPane.addEventListener("window changed", this._windowChanged, this);
-    this._overviewPane.addEventListener("filter changed", this._refresh, this);
-    this.element.appendChild(this._overviewPane.element);
-    this.element.tabIndex = 0;
-
-    this._sidebarBackgroundElement = document.createElement("div");
-    this._sidebarBackgroundElement.className = "sidebar timeline-sidebar-background";
-    this.element.appendChild(this._sidebarBackgroundElement);
-
-    this._containerElement = document.createElement("div");
-    this._containerElement.id = "timeline-container";
-    this._containerElement.addEventListener("scroll", this._onScroll.bind(this), false);
-    this.element.appendChild(this._containerElement);
-
-    this.createSidebar(this._containerElement, this._containerElement);
-    var itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true);
-    itemsTreeElement.expanded = true;
-    this.sidebarTree.appendChild(itemsTreeElement);
-
-    this._sidebarListElement = document.createElement("div");
-    this.sidebarElement.appendChild(this._sidebarListElement);
-
-    this._containerContentElement = document.createElement("div");
-    this._containerContentElement.id = "resources-container-content";
-    this._containerElement.appendChild(this._containerContentElement);
-
-    this._timelineGrid = new WebInspector.TimelineGrid();
-    this._itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
-    this._itemsGraphsElement.id = "timeline-graphs";
-    this._containerContentElement.appendChild(this._timelineGrid.element);
-
-    this._topGapElement = document.createElement("div");
-    this._topGapElement.className = "timeline-gap";
-    this._itemsGraphsElement.appendChild(this._topGapElement);
-
-    this._graphRowsElement = document.createElement("div");
-    this._itemsGraphsElement.appendChild(this._graphRowsElement);
-
-    this._bottomGapElement = document.createElement("div");
-    this._bottomGapElement.className = "timeline-gap";
-    this._itemsGraphsElement.appendChild(this._bottomGapElement);
-
-    this._createStatusbarButtons();
-
-    this._records = [];
-    this._sendRequestRecords = {};
-    this._timerRecords = {};
-
-    this._calculator = new WebInspector.TimelineCalculator();
-    this._boundariesAreValid = true;
-    this._scrollTop = 0;
-
-    this._popoverHelper = new WebInspector.PopoverHelper(this._containerElement, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), true);
+this._init();
 }
 
-WebInspector.TimelinePanel.prototype = {
-    toolbarItemClass: "timeline",
-
-    get toolbarItemLabel()
-    {
-        return WebInspector.UIString("Timeline");
-    },
-
-    get statusBarItems()
-    {
-        return [this.toggleTimelineButton.element, this.clearButton.element];
-    },
-
-    get categories()
-    {
-        if (!this._categories) {
-            this._categories = {
-                loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), "rgb(47,102,236)"),
-                scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), "rgb(157,231,119)"),
-                rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), "rgb(164,60,255)")
-            };
-        }
-        return this._categories;
-    },
-
-    get defaultFocusedElement()
-    {
-        return this.element;
-    },
-
-    get _recordStyles()
-    {
-        if (!this._recordStylesArray) {
-            var recordTypes = WebInspector.TimelineAgent.RecordType;
-            var recordStyles = {};
-            recordStyles[recordTypes.EventDispatch] = { title: WebInspector.UIString("Event"), category: this.categories.scripting };
-            recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: this.categories.rendering };
-            recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: this.categories.rendering };
-            recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: this.categories.rendering };
-            recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: this.categories.loading };
-            recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: this.categories.scripting };
-            recordStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: this.categories.scripting };
-            recordStyles[recordTypes.TimerFire] = { title: WebInspector.UIString("Timer Fired"), category: this.categories.scripting };
-            recordStyles[recordTypes.XHRReadyStateChange] = { title: WebInspector.UIString("XHR Ready State Change"), category: this.categories.scripting };
-            recordStyles[recordTypes.XHRLoad] = { title: WebInspector.UIString("XHR Load"), category: this.categories.scripting };
-            recordStyles[recordTypes.EvaluateScript] = { title: WebInspector.UIString("Evaluate Script"), category: this.categories.scripting };
-            recordStyles[recordTypes.MarkTimeline] = { title: WebInspector.UIString("Mark"), category: this.categories.scripting };
-            recordStyles[recordTypes.ResourceSendRequest] = { title: WebInspector.UIString("Send Request"), category: this.categories.loading };
-            recordStyles[recordTypes.ResourceReceiveResponse] = { title: WebInspector.UIString("Receive Response"), category: this.categories.loading };
-            recordStyles[recordTypes.ResourceFinish] = { title: WebInspector.UIString("Finish Loading"), category: this.categories.loading };
-            recordStyles[recordTypes.FunctionCall] = { title: WebInspector.UIString("Function Call"), category: this.categories.scripting };
-            this._recordStylesArray = recordStyles;
-        }
-        return this._recordStylesArray;
-    },
-
-    _createStatusbarButtons: function()
-    {
-        this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item");
-        this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked.bind(this), false);
-
-        this.clearButton = new WebInspector.StatusBarButton("", "timeline-clear-status-bar-item");
-        this.clearButton.addEventListener("click", this.reset.bind(this), false);
-    },
-
-    _toggleTimelineButtonClicked: function()
-    {
-        if (this.toggleTimelineButton.toggled)
-            InspectorBackend.stopTimelineProfiler();
-        else
-            InspectorBackend.startTimelineProfiler();
-    },
-
-    timelineWasStarted: function()
-    {
-        this.toggleTimelineButton.toggled = true;
-    },
-
-    timelineWasStopped: function()
-    {
-        this.toggleTimelineButton.toggled = false;
-    },
-
-    addRecordToTimeline: function(record)
-    {
-        this._innerAddRecordToTimeline(record, this._records);
-        this._scheduleRefresh();
-    },
-
-    _innerAddRecordToTimeline: function(record, collection)
-    {
-        var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, this._recordStyles, this._sendRequestRecords, this._timerRecords);
-
-        // Glue subsequent records with same category and title together if they are closer than 100ms to each other.
-        if (this._lastRecord && (!record.children || !record.children.length) &&
-                this._lastRecord.category == formattedRecord.category &&
-                this._lastRecord.title == formattedRecord.title &&
-                this._lastRecord.details == formattedRecord.details &&
-                this._lastRecord.callerScriptName == formattedRecord.callerScriptName &&
-                this._lastRecord.callerScriptLine == formattedRecord.callerScriptLine &&
-                formattedRecord.startTime - this._lastRecord.endTime < 0.1) {
-            this._lastRecord.endTime = formattedRecord.endTime;
-            this._lastRecord.count++;
-        } else {
-            collection.push(formattedRecord);
-            for (var i = 0; record.children && i < record.children.length; ++i) {
-                if (!formattedRecord.children)
-                    formattedRecord.children = [];
-                var formattedChild = this._innerAddRecordToTimeline(record.children[i], formattedRecord.children);
-                formattedChild.parent = formattedRecord;
-            }
-            this._lastRecord = record.children && record.children.length ? null : formattedRecord;
-        }
-        return formattedRecord;
-    },
-
-    setSidebarWidth: function(width)
-    {
-        WebInspector.Panel.prototype.setSidebarWidth.call(this, width);
-        this._sidebarBackgroundElement.style.width = width + "px";
-        this._overviewPane.setSidebarWidth(width);
-    },
-
-    updateMainViewWidth: function(width)
-    {
-        this._containerContentElement.style.left = width + "px";
-        this._scheduleRefresh();
-        this._overviewPane.updateMainViewWidth(width);
-    },
-
-    resize: function() {
-        this._closeRecordDetails();
-        this._scheduleRefresh();
-    },
-
-    reset: function()
-    {
-        this._lastRecord = null;
-        this._sendRequestRecords = {};
-        this._timerRecords = {};
-        this._records = [];
-        this._boundariesAreValid = false;
-        this._overviewPane.reset();
-        this._adjustScrollPosition(0);
-        this._refresh();
-        this._closeRecordDetails();
-    },
-
-    show: function()
-    {
-        WebInspector.Panel.prototype.show.call(this);
-        if (typeof this._scrollTop === "number")
-            this._containerElement.scrollTop = this._scrollTop;
-        else if (this._needsRefresh)
-            this._refresh();
-    },
-
-    hide: function()
-    {
-        WebInspector.Panel.prototype.hide.call(this);
-        this._closeRecordDetails();
-    },
-
-    _onScroll: function(event)
-    {
-        this._closeRecordDetails();
-        var scrollTop = this._containerElement.scrollTop;
-        var dividersTop = Math.max(0, scrollTop);
-        this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
-        this._scheduleRefresh(true);
-    },
-
-    _windowChanged: function()
-    {
-        this._closeRecordDetails();
-        this._scheduleRefresh();
-    },
-
-    _scheduleRefresh: function(preserveBoundaries)
-    {
-        if (preserveBoundaries)
-            this._closeRecordDetails();
-        this._boundariesAreValid &= preserveBoundaries;
-        if (this._needsRefresh)
-            return;
-        this._needsRefresh = true;
-
-        if (this.visible && !("_refreshTimeout" in this)) {
-            if (preserveBoundaries)
-                this._refresh();
-            else
-                this._refreshTimeout = setTimeout(this._refresh.bind(this), 100);
-        }
-    },
-
-    _refresh: function()
-    {
-        this._needsRefresh = false;
-        if ("_refreshTimeout" in this) {
-            clearTimeout(this._refreshTimeout);
-            delete this._refreshTimeout;
-        }
-
-        if (!this._boundariesAreValid)
-            this._overviewPane.update(this._records);
-        this._refreshRecords(!this._boundariesAreValid);
-        this._boundariesAreValid = true;
-    },
-
-    _refreshRecords: function(updateBoundaries)
-    {
-        if (updateBoundaries) {
-            this._calculator.reset();
-            this._calculator.windowLeft = this._overviewPane.windowLeft;
-            this._calculator.windowRight = this._overviewPane.windowRight;
-
-            for (var i = 0; i < this._records.length; ++i)
-                this._calculator.updateBoundaries(this._records[i]);
-
-            this._calculator.calculateWindow();
-        }
-
-        var recordsInWindow = [];
-        for (var i = 0; i < this._records.length; ++i) {
-            var record = this._records[i];
-            var percentages = this._calculator.computeBarGraphPercentages(record);
-            if (percentages.start < 100 && percentages.end >= 0 && !record.category.hidden)
-                this._addToRecordsWindow(record, recordsInWindow);
-        }
-
-        // Calculate the visible area.
-        this._scrollTop = this._containerElement.scrollTop;
-        var visibleTop = this._scrollTop;
-        var visibleBottom = visibleTop + this._containerElement.clientHeight;
-
-        // Define row height, should be in sync with styles for timeline graphs.
-        const rowHeight = 18;
-        const expandOffset = 15;
-
-        // Convert visible area to visible indexes. Always include top-level record for a visible nested record.
-        var startIndex = Math.max(0, Math.min(Math.floor(visibleTop / rowHeight) - 1, recordsInWindow.length - 1));
-        while (startIndex > 0 && recordsInWindow[startIndex].parent)
-            startIndex--;
-        var endIndex = Math.min(recordsInWindow.length, Math.ceil(visibleBottom / rowHeight));
-        while (endIndex < recordsInWindow.length - 1 && recordsInWindow[endIndex].parent)
-            endIndex++;
-
-        // Resize gaps first.
-        const top = (startIndex * rowHeight) + "px";
-        this._topGapElement.style.height = top;
-        this.sidebarElement.style.top = top;
-        this.sidebarResizeElement.style.top = top;
-        this._bottomGapElement.style.height = (recordsInWindow.length - endIndex) * rowHeight + "px";
-
-        // Update visible rows.
-        var listRowElement = this._sidebarListElement.firstChild;
-        var width = this._graphRowsElement.offsetWidth;
-        this._itemsGraphsElement.removeChild(this._graphRowsElement);
-        var graphRowElement = this._graphRowsElement.firstChild;
-        var scheduleRefreshCallback = this._scheduleRefresh.bind(this, true);
-
-        for (var i = startIndex; i < endIndex; ++i) {
-            var record = recordsInWindow[i];
-            var isEven = !(i % 2);
-
-            if (!listRowElement) {
-                listRowElement = new WebInspector.TimelineRecordListRow().element;
-                this._sidebarListElement.appendChild(listRowElement);
-            }
-            if (!graphRowElement) {
-                graphRowElement = new WebInspector.TimelineRecordGraphRow(this._itemsGraphsElement, scheduleRefreshCallback, rowHeight).element;
-                this._graphRowsElement.appendChild(graphRowElement);
-            }
-
-            listRowElement.row.update(record, isEven, this._calculator, visibleTop);
-            graphRowElement.row.update(record, isEven, this._calculator, width, expandOffset, i);
-
-            listRowElement = listRowElement.nextSibling;
-            graphRowElement = graphRowElement.nextSibling;
-        }
-
-        // Remove extra rows.
-        while (listRowElement) {
-            var nextElement = listRowElement.nextSibling;
-            listRowElement.row.dispose();
-            listRowElement = nextElement;
-        }
-        while (graphRowElement) {
-            var nextElement = graphRowElement.nextSibling;
-            graphRowElement.row.dispose();
-            graphRowElement = nextElement;
-        }
-
-        this._itemsGraphsElement.insertBefore(this._graphRowsElement, this._bottomGapElement);
-        // Reserve some room for expand / collapse controls to the left for records that start at 0ms.
-        var timelinePaddingLeft = this._calculator.windowLeft === 0 ? expandOffset : 0;
-        if (updateBoundaries)
-            this._timelineGrid.updateDividers(true, this._calculator, timelinePaddingLeft);
-        this._adjustScrollPosition((recordsInWindow.length + 1) * rowHeight);
-    },
-
-    _addToRecordsWindow: function(record, recordsWindow)
-    {
-        recordsWindow.push(record);
-        if (!record.collapsed) {
-            var index = recordsWindow.length;
-            for (var i = 0; record.children && i < record.children.length; ++i)
-                this._addToRecordsWindow(record.children[i], recordsWindow);
-            record.visibleChildrenCount = recordsWindow.length - index;
-        }
-    },
-
-    _adjustScrollPosition: function(totalHeight)
-    {
-        // Prevent the container from being scrolled off the end.
-        if ((this._containerElement.scrollTop + this._containerElement.offsetHeight) > totalHeight + 1)
-            this._containerElement.scrollTop = (totalHeight - this._containerElement.offsetHeight);
-    },
-
-    _getPopoverAnchor: function(element)
-    {
-        return element.enclosingNodeOrSelfWithClass("timeline-graph-bar") || element.enclosingNodeOrSelfWithClass("timeline-tree-item");
-    },
-
-    _showPopover: function(anchor)
-    {
-        var record = anchor.row._record;
-        var popover = new WebInspector.Popover(record._generatePopupContent(this._calculator));
-        popover.show(anchor);
-        return popover;
-    },
-
-    _closeRecordDetails: function()
-    {
-        this._popoverHelper.hidePopup();
-    }
-}
-
-WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype;
-
-WebInspector.TimelineCategory = function(name, title, color)
+WebInspector.HeapSnapshot.prototype = {
+_init: function()
 {
-    this.name = name;
-    this.title = title;
-    this.color = color;
-}
+this._metaNodeIndex = 0;
+this._rootNodeIndex = 1;
+var meta = this._nodes[this._metaNodeIndex];
+this._nodeTypeOffset = meta.fields.indexOf("type");
+this._nodeNameOffset = meta.fields.indexOf("name");
+this._nodeIdOffset = meta.fields.indexOf("id");
+this._nodeInstancesCountOffset = this._nodeIdOffset;
+this._nodeSelfSizeOffset = meta.fields.indexOf("self_size");
+this._edgesCountOffset = meta.fields.indexOf("children_count");
+this._firstEdgeOffset = meta.fields.indexOf("children");
+this._nodeTypes = meta.types[this._nodeTypeOffset];
+this._nodeHiddenType = this._nodeTypes.indexOf("hidden");
+var edgesMeta = meta.types[this._firstEdgeOffset];
+this._edgeFieldsCount = edgesMeta.fields.length;
+this._edgeTypeOffset = edgesMeta.fields.indexOf("type");
+this._edgeNameOffset = edgesMeta.fields.indexOf("name_or_index");
+this._edgeToNodeOffset = edgesMeta.fields.indexOf("to_node");
+this._edgeTypes = edgesMeta.types[this._edgeTypeOffset];
+this._edgeElementType = this._edgeTypes.indexOf("element");
+this._edgeHiddenType = this._edgeTypes.indexOf("hidden");
+},
 
-WebInspector.TimelineCalculator = function()
+get rootEdges()
 {
-    this.reset();
-    this.windowLeft = 0.0;
-    this.windowRight = 1.0;
-    this._uiString = WebInspector.UIString.bind(WebInspector);
+return (new WebInspector.HeapSnapshotNodeWrapper(this, this._rootNodeIndex)).edges;
 }
-
-WebInspector.TimelineCalculator.prototype = {
-    computeBarGraphPercentages: function(record)
-    {
-        var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100;
-        var end = (record.endTime - this.minimumBoundary) / this.boundarySpan * 100;
-        return {start: start, end: end};
-    },
-
-    calculateWindow: function()
-    {
-        this.minimumBoundary = this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
-        this.maximumBoundary = this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
-        this.boundarySpan = this.maximumBoundary - this.minimumBoundary;
-    },
-
-    reset: function()
-    {
-        this._absoluteMinimumBoundary = -1;
-        this._absoluteMaximumBoundary = -1;
-    },
-
-    updateBoundaries: function(record)
-    {
-        var lowerBound = record.startTime;
-        if (this._absoluteMinimumBoundary === -1 || lowerBound < this._absoluteMinimumBoundary)
-            this._absoluteMinimumBoundary = lowerBound;
-
-        var upperBound = record.endTime;
-        if (this._absoluteMaximumBoundary === -1 || upperBound > this._absoluteMaximumBoundary)
-            this._absoluteMaximumBoundary = upperBound;
-    },
-
-    formatValue: function(value)
-    {
-        return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, this._uiString);
-    }
-}
-
-
-WebInspector.TimelineRecordListRow = function()
-{
-    this.element = document.createElement("div");
-    this.element.row = this;
-    this.element.style.cursor = "pointer";
-    var iconElement = document.createElement("span");
-    iconElement.className = "timeline-tree-icon";
-    this.element.appendChild(iconElement);
-
-    this._typeElement = document.createElement("span");
-    this._typeElement.className = "type";
-    this.element.appendChild(this._typeElement);
-
-    var separatorElement = document.createElement("span");
-    separatorElement.className = "separator";
-    separatorElement.textContent = " ";
-
-    this._dataElement = document.createElement("span");
-    this._dataElement.className = "data dimmed";
-
-    this._repeatCountElement = document.createElement("span");
-    this._repeatCountElement.className = "count";
-
-    this.element.appendChild(separatorElement);
-    this.element.appendChild(this._dataElement);
-    this.element.appendChild(this._repeatCountElement);
-}
-
-WebInspector.TimelineRecordListRow.prototype = {
-    update: function(record, isEven, calculator, offset)
-    {
-        this._record = record;
-        this._calculator = calculator;
-        this._offset = offset;
-
-        this.element.className = "timeline-tree-item timeline-category-" + record.category.name + (isEven ? " even" : "");
-        this._typeElement.textContent = record.title;
-
-        if (record.details)
-            this._dataElement.textContent = "(" + record.details + ")";
-        else
-            this._dataElement.textContent = "";
-
-        if (record.count > 1)
-            this._repeatCountElement.textContent = "\u2009\u00d7\u2009" + record.count;
-        else
-            this._repeatCountElement.textContent = "";
-    },
-
-    dispose: function()
-    {
-        this.element.parentElement.removeChild(this.element);
-    }
-}
-
-WebInspector.TimelineRecordGraphRow = function(graphContainer, scheduleRefresh, rowHeight)
-{
-    this.element = document.createElement("div");
-    this.element.row = this;
-
-    this._barAreaElement = document.createElement("div");
-    this._barAreaElement.className = "timeline-graph-bar-area";
-    this.element.appendChild(this._barAreaElement);
-
-    this._barElement = document.createElement("div");
-    this._barElement.className = "timeline-graph-bar";
-    this._barElement.row = this;
-    this._barAreaElement.appendChild(this._barElement);
-
-    this._expandElement = document.createElement("div");
-    this._expandElement.className = "timeline-expandable";
-    graphContainer.appendChild(this._expandElement);
-
-    var leftBorder = document.createElement("div");
-    leftBorder.className = "timeline-expandable-left";
-    this._expandElement.appendChild(leftBorder);
-
-    this._expandElement.addEventListener("click", this._onClick.bind(this));
-    this._rowHeight = rowHeight;
-
-    this._scheduleRefresh = scheduleRefresh;
-}
-
-WebInspector.TimelineRecordGraphRow.prototype = {
-    update: function(record, isEven, calculator, clientWidth, expandOffset, index)
-    {
-        this._record = record;
-        this.element.className = "timeline-graph-side timeline-category-" + record.category.name + (isEven ? " even" : "");
-        var percentages = calculator.computeBarGraphPercentages(record);
-        var left = percentages.start / 100 * clientWidth;
-        var width = (percentages.end - percentages.start) / 100 * clientWidth;
-        this._barElement.style.left = (left + expandOffset) + "px";
-        this._barElement.style.width = width + "px";
-
-        if (record.visibleChildrenCount) {
-            this._expandElement.style.top = index * this._rowHeight + "px";
-            this._expandElement.style.left = left + "px";
-            this._expandElement.style.width = Math.max(12, width + 25) + "px";
-            if (!record.collapsed) {
-                this._expandElement.style.height = (record.visibleChildrenCount + 1) * this._rowHeight + "px";
-                this._expandElement.addStyleClass("timeline-expandable-expanded");
-                this._expandElement.removeStyleClass("timeline-expandable-collapsed");
-            } else {
-                this._expandElement.style.height = this._rowHeight + "px";
-                this._expandElement.addStyleClass("timeline-expandable-collapsed");
-                this._expandElement.removeStyleClass("timeline-expandable-expanded");
-            }
-            this._expandElement.removeStyleClass("hidden");
-        } else {
-            this._expandElement.addStyleClass("hidden");
-        }
-    },
-
-    _onClick: function(event)
-    {
-        this._record.collapsed = !this._record.collapsed;
-        this._scheduleRefresh();
-    },
-
-    dispose: function()
-    {
-        this.element.parentElement.removeChild(this.element);
-        this._expandElement.parentElement.removeChild(this._expandElement);
-    }
-}
-
-WebInspector.TimelinePanel.FormattedRecord = function(record, recordStyles, sendRequestRecords, timerRecords)
-{
-    var recordTypes = WebInspector.TimelineAgent.RecordType;
-    var style = recordStyles[record.type];
-
-    this.category = style.category;
-    this.title = style.title;
-    this.startTime = record.startTime / 1000;
-    this.data = record.data;
-    this.count = 1;
-    this.type = record.type;
-    this.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : this.startTime;
-    this.originalRecordForTests = record;
-    this.callerScriptName = record.callerScriptName;
-    this.callerScriptLine = record.callerScriptLine;
-
-    // Make resource receive record last since request was sent; make finish record last since response received.
-    if (record.type === recordTypes.ResourceSendRequest) {
-        sendRequestRecords[record.data.identifier] = this;
-    } else if (record.type === recordTypes.ResourceReceiveResponse) {
-        var sendRequestRecord = sendRequestRecords[record.data.identifier];
-        if (sendRequestRecord) { // False if we started instrumentation in the middle of request.
-            sendRequestRecord._responseReceivedFormattedTime = this.startTime;
-            record.data.url = sendRequestRecord.data.url;
-            this.startTime = sendRequestRecord.startTime;
-            this.details = this._getRecordDetails(sendRequestRecord, sendRequestRecords);
-            this.callerScriptName = sendRequestRecord.callerScriptName;
-            this.callerScriptLine = sendRequestRecord.callerScriptLine;
-        }
-    } else if (record.type === recordTypes.ResourceFinish) {
-        var sendRequestRecord = sendRequestRecords[record.data.identifier];
-        if (sendRequestRecord) {// False for main resource.
-            record.data.url = sendRequestRecord.data.url;
-            this.startTime = sendRequestRecord._responseReceivedFormattedTime;
-            this.callerScriptName = sendRequestRecord.callerScriptName;
-            this.callerScriptLine = sendRequestRecord.callerScriptLine;
-        }
-    } else if (record.type === recordTypes.TimerInstall) {
-        this.timeout = record.data.timeout;
-        this.singleShot = record.data.singleShot;
-        timerRecords[record.data.timerId] = this;
-    } else if (record.type === recordTypes.TimerFire) {
-        var timerInstalledRecord = timerRecords[record.data.timerId];
-        if (timerInstalledRecord) {
-            this.callSiteScriptName = timerInstalledRecord.callerScriptName;
-            this.callSiteScriptLine = timerInstalledRecord.callerScriptLine;
-            this.timeout = timerInstalledRecord.timeout;
-            this.singleShot = timerInstalledRecord.singleShot;
-        }
-    }
-    this.details = this._getRecordDetails(record, sendRequestRecords);
-}
-
-WebInspector.TimelinePanel.FormattedRecord.prototype = {
-    _createCell: function(content, styleName)
-    {
-        var text = document.createElement("label");
-        text.appendChild(document.createTextNode(content));
-        var cell = document.createElement("td");
-        cell.className = "timeline-details";
-        if (styleName)
-            cell.className += " " + styleName;
-        cell.textContent = content;
-        return cell;
-    },
-
-    _createRow: function(title, content)
-    {
-        var row = document.createElement("tr");
-        row.appendChild(this._createCell(title, "timeline-details-row-title"));
-        row.appendChild(this._createCell(content, "timeline-details-row-data"));
-        return row;
-    },
-
-    _createLinkRow: function(title, content)
-    {
-        var row = document.createElement("tr");
-        row.appendChild(this._createCell(title, "timeline-details-row-title"));
-        var cell = document.createElement("td");
-        cell.appendChild(content);
-        row.appendChild(cell);
-        return row;
-    },
-
-    _generatePopupContent: function(calculator)
-    {
-        var recordContentTable = document.createElement("table");
-        var titleCell = this._createCell(WebInspector.UIString("%s - Details", this.title), "timeline-details-title");
-        titleCell.colSpan = 2;
-        var titleRow = document.createElement("tr");
-        titleRow.appendChild(titleCell);
-        recordContentTable.appendChild(titleRow);
-        var text = Number.secondsToString(this.endTime - this.startTime) + " (@" +
-        calculator.formatValue(this.startTime - calculator.minimumBoundary) + ")";
-        recordContentTable.appendChild(this._createRow(WebInspector.UIString("Duration"), text));
-
-        const recordTypes = WebInspector.TimelineAgent.RecordType;
-        if (this.details) {
-            if (this.type === recordTypes.TimerInstall ||
-                this.type === recordTypes.TimerFire ||
-                this.type === recordTypes.TimerRemove) {
-                recordContentTable.appendChild(this._createRow(WebInspector.UIString("Timer Id"), this.data.timerId));
-                if (this.timeout) {
-                    recordContentTable.appendChild(this._createRow(WebInspector.UIString("Timeout"), this.timeout));
-                    recordContentTable.appendChild(this._createRow(WebInspector.UIString("Repeats"), !this.singleShot));
-                }
-                if (this.callSiteScriptLine) {
-                    var link = WebInspector.linkifyResourceAsNode(this.callSiteScriptName, "scripts", this.callSiteScriptLine, "timeline-details");
-                    recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Call Site"), link));
-                }
-            } else if (this.type === recordTypes.FunctionCall) {
-                var link = WebInspector.linkifyResourceAsNode(this.data.scriptName, "scripts", this.data.scriptLine, "timeline-details");
-                recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Location"), link));
-            } else if (this.type === recordTypes.ResourceSendRequest || this.type === recordTypes.ResourceReceiveResponse || this.type === recordTypes.ResourceFinish) {
-                var link = WebInspector.linkifyResourceAsNode(this.data.url, "resources", null, "timeline-details");
-                recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Resource"), link));
-            } else if (this.type === recordTypes.EvaluateScript) {
-                var link = WebInspector.linkifyResourceAsNode(this.data.url, "scripts", null, "timeline-details");
-                recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Script"), link));
-            } else if (this.type === recordTypes.Paint) {
-                recordContentTable.appendChild(this._createRow(WebInspector.UIString("Location"), this.data.x + "\u2009\u00d7\u2009" + this.data.y));
-                recordContentTable.appendChild(this._createRow(WebInspector.UIString("Dimensions"), this.data.width + "\u2009\u00d7\u2009" + this.data.height));
-            } else
-                recordContentTable.appendChild(this._createRow(WebInspector.UIString("Details"), this.details));
-        }
-
-        if (this.callerScriptName) {
-            var link = WebInspector.linkifyResourceAsNode(this.callerScriptName, "scripts", this.callerScriptLine);
-            recordContentTable.appendChild(this._createLinkRow(WebInspector.UIString("Caller"), link));
-        }
-        return recordContentTable;
-    },
-
-    _getRecordDetails: function(record, sendRequestRecords)
-    {
-        switch (record.type) {
-            case WebInspector.TimelineAgent.RecordType.FunctionCall:
-                return WebInspector.displayNameForURL(record.data.scriptName + ":" + record.data.scriptLine);
-            case WebInspector.TimelineAgent.RecordType.EventDispatch:
-                return record.data ? record.data.type : "";
-            case WebInspector.TimelineAgent.RecordType.Paint:
-                return record.data.width + "\u2009\u00d7\u2009" + record.data.height;
-            case WebInspector.TimelineAgent.RecordType.TimerInstall:
-            case WebInspector.TimelineAgent.RecordType.TimerRemove:
-            case WebInspector.TimelineAgent.RecordType.TimerFire:
-                return record.data.timerId;
-            case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange:
-            case WebInspector.TimelineAgent.RecordType.XHRLoad:
-            case WebInspector.TimelineAgent.RecordType.EvaluateScript:
-            case WebInspector.TimelineAgent.RecordType.ResourceSendRequest:
-            case WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse:
-            case WebInspector.TimelineAgent.RecordType.ResourceFinish:
-                return WebInspector.displayNameForURL(record.data.url);
-            case WebInspector.TimelineAgent.RecordType.MarkTimeline:
-                return record.data.message;
-            default:
-                return "";
-        }
-    }
-}
-
-
-/* TimelineOverviewPane.js */
-
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.TimelineOverviewPane = function(categories)
-{
-    this.element = document.createElement("div");
-    this.element.id = "timeline-overview-panel";
-
-    this._categories = categories;
-    this._overviewSidebarElement = document.createElement("div");
-    this._overviewSidebarElement.id = "timeline-overview-sidebar";
-    this.element.appendChild(this._overviewSidebarElement);
-
-    var overviewTreeElement = document.createElement("ol");
-    overviewTreeElement.className = "sidebar-tree";
-    this._overviewSidebarElement.appendChild(overviewTreeElement);
-    var sidebarTree = new TreeOutline(overviewTreeElement);
-
-    var categoriesTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("TIMELINES"), {}, true);
-    categoriesTreeElement.expanded = true;
-    sidebarTree.appendChild(categoriesTreeElement);
-    for (var categoryName in this._categories) {
-        var category = this._categories[categoryName];
-        categoriesTreeElement.appendChild(new WebInspector.TimelineCategoryTreeElement(category, this._onCheckboxClicked.bind(this, category)));
-    }
-
-    this._overviewGrid = new WebInspector.TimelineGrid();
-    this._overviewGrid.element.id = "timeline-overview-grid";
-    this._overviewGrid.itemsGraphsElement.id = "timeline-overview-graphs";
-    this.element.appendChild(this._overviewGrid.element);
-
-    this._categoryGraphs = {};
-    var i = 0;
-    for (var category in this._categories) {
-        var categoryGraph = new WebInspector.TimelineCategoryGraph(this._categories[category], i++ % 2);
-        this._categoryGraphs[category] = categoryGraph;
-        this._overviewGrid.itemsGraphsElement.appendChild(categoryGraph.graphElement);
-    }
-    this._overviewGrid.setScrollAndDividerTop(0, 0);
-
-    this._overviewWindowElement = document.createElement("div");
-    this._overviewWindowElement.id = "timeline-overview-window";
-    this._overviewWindowElement.addEventListener("mousedown", this._dragWindow.bind(this), false);
-    this._overviewGrid.element.appendChild(this._overviewWindowElement);
-
-    this._leftResizeElement = document.createElement("div");
-    this._leftResizeElement.className = "timeline-window-resizer";
-    this._leftResizeElement.style.left = 0;
-    this._overviewGrid.element.appendChild(this._leftResizeElement);
-    this._leftResizeElement.addEventListener("mousedown", this._resizeWindow.bind(this, this._leftResizeElement), false);
-
-    this._rightResizeElement = document.createElement("div");
-    this._rightResizeElement.className = "timeline-window-resizer timeline-window-resizer-right";
-    this._rightResizeElement.style.right = 0;
-    this._overviewGrid.element.appendChild(this._rightResizeElement);
-    this._rightResizeElement.addEventListener("mousedown", this._resizeWindow.bind(this, this._rightResizeElement), false);
-
-    this._overviewCalculator = new WebInspector.TimelineOverviewCalculator();
-
-    var separatorElement = document.createElement("div");
-    separatorElement.id = "timeline-overview-separator";
-    this.element.appendChild(separatorElement);
-
-    this.windowLeft = 0.0;
-    this.windowRight = 1.0;
-}
-
-
-WebInspector.TimelineOverviewPane.prototype = {
-    _onCheckboxClicked: function (category, event) {
-        if (event.target.checked)
-            category.hidden = false;
-        else
-            category.hidden = true;
-        this._categoryGraphs[category.name].dimmed = !event.target.checked;
-        this.dispatchEventToListeners("filter changed");
-    },
-
-    update: function(records)
-    {
-        // Clear summary bars.
-        var timelines = {};
-        for (var category in this._categories) {
-            timelines[category] = [];
-            this._categoryGraphs[category].clearChunks();
-        }
-
-        function forAllRecords(recordsArray, callback)
-        {
-            if (!recordsArray)
-                return;
-            for (var i = 0; i < recordsArray.length; ++i) {
-                callback(recordsArray[i]);
-                forAllRecords(recordsArray[i].children, callback);
-            }
-        }
-
-        // Create sparse arrays with 101 cells each to fill with chunks for a given category.
-        this._overviewCalculator.reset();
-        forAllRecords(records, this._overviewCalculator.updateBoundaries.bind(this._overviewCalculator));
-
-        function markTimeline(record)
-        {
-            var percentages = this._overviewCalculator.computeBarGraphPercentages(record);
-
-            var end = Math.round(percentages.end);
-            var categoryName = record.category.name;
-            for (var j = Math.round(percentages.start); j <= end; ++j)
-                timelines[categoryName][j] = true;
-        }
-        forAllRecords(records, markTimeline.bind(this));
-
-        // Convert sparse arrays to continuous segments, render graphs for each.
-        for (var category in this._categories) {
-            var timeline = timelines[category];
-            window.timelineSaved = timeline;
-            var chunkStart = -1;
-            for (var j = 0; j < 101; ++j) {
-                if (timeline[j]) {
-                    if (chunkStart === -1)
-                        chunkStart = j;
-                } else {
-                    if (chunkStart !== -1) {
-                        this._categoryGraphs[category].addChunk(chunkStart, j);
-                        chunkStart = -1;
-                    }
-                }
-            }
-            if (chunkStart !== -1) {
-                this._categoryGraphs[category].addChunk(chunkStart, 100);
-                chunkStart = -1;
-            }
-        }
-        this._overviewGrid.updateDividers(true, this._overviewCalculator);
-    },
-
-    setSidebarWidth: function(width)
-    {
-        this._overviewSidebarElement.style.width = width + "px";
-    },
-
-    updateMainViewWidth: function(width)
-    {
-        this._overviewGrid.element.style.left = width + "px";
-    },
-
-    reset: function()
-    {
-        this.windowLeft = 0.0;
-        this.windowRight = 1.0;
-        this._overviewWindowElement.style.left = "0%";
-        this._overviewWindowElement.style.width = "100%";
-        this._leftResizeElement.style.left = "0%";
-        this._rightResizeElement.style.left = "100%";
-        this._overviewCalculator.reset();
-        this._overviewGrid.updateDividers(true, this._overviewCalculator);
-    },
-
-    _resizeWindow: function(resizeElement, event)
-    {
-        WebInspector.elementDragStart(resizeElement, this._windowResizeDragging.bind(this, resizeElement), this._endWindowDragging.bind(this), event, "col-resize");
-    },
-
-    _windowResizeDragging: function(resizeElement, event)
-    {
-        if (resizeElement === this._leftResizeElement)
-            this._resizeWindowLeft(event.pageX - this._overviewGrid.element.offsetLeft);
-        else
-            this._resizeWindowRight(event.pageX - this._overviewGrid.element.offsetLeft);
-        event.preventDefault();
-    },
-
-    _dragWindow: function(event)
-    {
-        WebInspector.elementDragStart(this._overviewWindowElement, this._windowDragging.bind(this, event.pageX,
-            this._leftResizeElement.offsetLeft, this._rightResizeElement.offsetLeft), this._endWindowDragging.bind(this), event, "ew-resize");
-    },
-
-    _windowDragging: function(startX, windowLeft, windowRight, event)
-    {
-        var delta = event.pageX - startX;
-        var start = windowLeft + delta;
-        var end = windowRight + delta;
-        var windowSize = windowRight - windowLeft;
-
-        if (start < 0) {
-            start = 0;
-            end = windowSize;
-        }
-
-        if (end > this._overviewGrid.element.clientWidth) {
-            end = this._overviewGrid.element.clientWidth;
-            start = end - windowSize;
-        }
-        this._setWindowPosition(start, end);
-
-        event.preventDefault();
-    },
-
-    _resizeWindowLeft: function(start)
-    {
-        // Glue to edge.
-        if (start < 10)
-            start = 0;
-        this._setWindowPosition(start, null);
-    },
-
-    _resizeWindowRight: function(end)
-    {
-        // Glue to edge.
-        if (end > this._overviewGrid.element.clientWidth - 10)
-            end = this._overviewGrid.element.clientWidth;
-        this._setWindowPosition(null, end);
-    },
-
-    _setWindowPosition: function(start, end)
-    {
-        if (typeof start === "number") {
-            if (start > this._rightResizeElement.offsetLeft - 4)
-                start = this._rightResizeElement.offsetLeft - 4;
-
-            this.windowLeft = start / this._overviewGrid.element.clientWidth;
-            this._leftResizeElement.style.left = this.windowLeft * 100 + "%";
-            this._overviewWindowElement.style.left = this.windowLeft * 100 + "%";
-        }
-        if (typeof end === "number") {
-            if (end < this._leftResizeElement.offsetLeft + 12)
-                end = this._leftResizeElement.offsetLeft + 12;
-
-            this.windowRight = end / this._overviewGrid.element.clientWidth;
-            this._rightResizeElement.style.left = this.windowRight * 100 + "%";
-        }
-        this._overviewWindowElement.style.width = (this.windowRight - this.windowLeft) * 100 + "%";
-        this.dispatchEventToListeners("window changed");
-    },
-
-    _endWindowDragging: function(event)
-    {
-        WebInspector.elementDragEnd(event);
-    }
-}
-
-WebInspector.TimelineOverviewPane.prototype.__proto__ = WebInspector.Object.prototype;
-
-
-WebInspector.TimelineOverviewCalculator = function()
-{
-    this._uiString = WebInspector.UIString.bind(WebInspector);
-}
-
-WebInspector.TimelineOverviewCalculator.prototype = {
-    computeBarGraphPercentages: function(record)
-    {
-        var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100;
-        var end = (record.endTime - this.minimumBoundary) / this.boundarySpan * 100;
-        return {start: start, end: end};
-    },
-
-    reset: function()
-    {
-        delete this.minimumBoundary;
-        delete this.maximumBoundary;
-    },
-
-    updateBoundaries: function(record)
-    {
-        if (typeof this.minimumBoundary === "undefined" || record.startTime < this.minimumBoundary) {
-            this.minimumBoundary = record.startTime;
-            return true;
-        }
-        if (typeof this.maximumBoundary === "undefined" || record.endTime > this.maximumBoundary) {
-            this.maximumBoundary = record.endTime;
-            return true;
-        }
-        return false;
-    },
-
-    get boundarySpan()
-    {
-        return this.maximumBoundary - this.minimumBoundary;
-    },
-
-    formatValue: function(value)
-    {
-        return Number.secondsToString(value, this._uiString);
-    }
-}
-
-
-WebInspector.TimelineCategoryTreeElement = function(category, onCheckboxClicked)
-{
-    this._category = category;
-    this._onCheckboxClicked = onCheckboxClicked;
-    // Pass an empty title, the title gets made later in onattach.
-    TreeElement.call(this, "", null, false);
-}
-
-WebInspector.TimelineCategoryTreeElement.prototype = {
-    onattach: function()
-    {
-        this.listItemElement.removeChildren();
-        this.listItemElement.addStyleClass("timeline-category-tree-item");
-        this.listItemElement.addStyleClass("timeline-category-" + this._category.name);
-
-        var label = document.createElement("label");
-
-        var checkElement = document.createElement("input");
-        checkElement.type = "checkbox";
-        checkElement.className = "timeline-category-checkbox";
-        checkElement.checked = true;
-        checkElement.addEventListener("click", this._onCheckboxClicked);
-        label.appendChild(checkElement);
-
-        var typeElement = document.createElement("span");
-        typeElement.className = "type";
-        typeElement.textContent = this._category.title;
-        label.appendChild(typeElement);
-
-        this.listItemElement.appendChild(label);
-    }
-}
-
-WebInspector.TimelineCategoryTreeElement.prototype.__proto__ = TreeElement.prototype;
-
-WebInspector.TimelineCategoryGraph = function(category, isEven)
-{
-    this._category = category;
-
-    this._graphElement = document.createElement("div");
-    this._graphElement.className = "timeline-graph-side timeline-overview-graph-side" + (isEven ? " even" : "");
-
-    this._barAreaElement = document.createElement("div");
-    this._barAreaElement.className = "timeline-graph-bar-area timeline-category-" + category.name;
-    this._graphElement.appendChild(this._barAreaElement);
-}
-
-WebInspector.TimelineCategoryGraph.prototype = {
-    get graphElement()
-    {
-        return this._graphElement;
-    },
-
-    addChunk: function(start, end)
-    {
-        var chunk = document.createElement("div");
-        chunk.className = "timeline-graph-bar";
-        this._barAreaElement.appendChild(chunk);
-        chunk.style.setProperty("left", start + "%");
-        chunk.style.setProperty("width", (end - start) + "%");
-    },
-
-    clearChunks: function()
-    {
-        this._barAreaElement.removeChildren();
-    },
-
-    set dimmed(dimmed)
-    {
-        if (dimmed)
-            this._barAreaElement.removeStyleClass("timeline-category-" + this._category.name);
-        else
-            this._barAreaElement.addStyleClass("timeline-category-" + this._category.name);
-    }
-}
-
-/* TestController.js */
-
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WebInspector.TestController = function(callId)
-{
-    this._callId = callId;
-    this._waitUntilDone = false;
-}
-
-WebInspector.TestController.prototype = {
-    waitUntilDone: function()
-    {
-        this._waitUntilDone = true;
-    },
-
-    notifyDone: function(result)
-    {
-        var message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
-        InspectorBackend.didEvaluateForTestInFrontend(this._callId, message);
-    },
-
-    runAfterPendingDispatches: function(callback)
-    {
-        if (WebInspector.pendingDispatches === 0) {
-            callback();
-            return;
-        }
-        setTimeout(this.runAfterPendingDispatches.bind(this), 0, callback);
-    }
-}
-
-WebInspector.evaluateForTestInFrontend = function(callId, script)
-{
-    var controller = new WebInspector.TestController(callId);
-    function invokeMethod()
-    {
-        try {
-            var result;
-            if (window[script] && typeof window[script] === "function")
-                result = window[script].call(WebInspector, controller);
-            else
-                result = window.eval(script);
-
-            if (!controller._waitUntilDone)
-                controller.notifyDone(result);
-        } catch (e) {
-            controller.notifyDone(e.toString());
-        }
-    }
-    controller.runAfterPendingDispatches(invokeMethod);
-}
-
-/* codemap.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Initlialize namespaces
-var devtools = devtools || {};
-devtools.profiler = devtools.profiler || {};
-
-
-/**
- * Constructs a mapper that maps addresses into code entries.
- *
- * @constructor
- */
-devtools.profiler.CodeMap = function() {
-  /**
-   * Dynamic code entries. Used for JIT compiled code.
-   */
-  this.dynamics_ = new goog.structs.SplayTree();
-
-  /**
-   * Name generator for entries having duplicate names.
-   */
-  this.dynamicsNameGen_ = new devtools.profiler.CodeMap.NameGenerator();
-
-  /**
-   * Static code entries. Used for statically compiled code.
-   */
-  this.statics_ = new goog.structs.SplayTree();
-
-  /**
-   * Libraries entries. Used for the whole static code libraries.
-   */
-  this.libraries_ = new goog.structs.SplayTree();
-
-  /**
-   * Map of memory pages occupied with static code.
-   */
-  this.pages_ = [];
-};
-
-
-/**
- * The number of alignment bits in a page address.
- */
-devtools.profiler.CodeMap.PAGE_ALIGNMENT = 12;
-
-
-/**
- * Page size in bytes.
- */
-devtools.profiler.CodeMap.PAGE_SIZE =
-    1 << devtools.profiler.CodeMap.PAGE_ALIGNMENT;
-
-
-/**
- * Adds a dynamic (i.e. moveable and discardable) code entry.
- *
- * @param {number} start The starting address.
- * @param {devtools.profiler.CodeMap.CodeEntry} codeEntry Code entry object.
- */
-devtools.profiler.CodeMap.prototype.addCode = function(start, codeEntry) {
-  this.dynamics_.insert(start, codeEntry);
-};
-
-
-/**
- * Moves a dynamic code entry. Throws an exception if there is no dynamic
- * code entry with the specified starting address.
- *
- * @param {number} from The starting address of the entry being moved.
- * @param {number} to The destination address.
- */
-devtools.profiler.CodeMap.prototype.moveCode = function(from, to) {
-  var removedNode = this.dynamics_.remove(from);
-  this.dynamics_.insert(to, removedNode.value);
-};
-
-
-/**
- * Discards a dynamic code entry. Throws an exception if there is no dynamic
- * code entry with the specified starting address.
- *
- * @param {number} start The starting address of the entry being deleted.
- */
-devtools.profiler.CodeMap.prototype.deleteCode = function(start) {
-  var removedNode = this.dynamics_.remove(start);
-};
-
-
-/**
- * Adds a library entry.
- *
- * @param {number} start The starting address.
- * @param {devtools.profiler.CodeMap.CodeEntry} codeEntry Code entry object.
- */
-devtools.profiler.CodeMap.prototype.addLibrary = function(
-    start, codeEntry) {
-  this.markPages_(start, start + codeEntry.size);
-  this.libraries_.insert(start, codeEntry);
-};
-
-
-/**
- * Adds a static code entry.
- *
- * @param {number} start The starting address.
- * @param {devtools.profiler.CodeMap.CodeEntry} codeEntry Code entry object.
- */
-devtools.profiler.CodeMap.prototype.addStaticCode = function(
-    start, codeEntry) {
-  this.statics_.insert(start, codeEntry);
-};
-
-
-/**
- * @private
- */
-devtools.profiler.CodeMap.prototype.markPages_ = function(start, end) {
-  for (var addr = start; addr <= end;
-       addr += devtools.profiler.CodeMap.PAGE_SIZE) {
-    this.pages_[addr >>> devtools.profiler.CodeMap.PAGE_ALIGNMENT] = 1;
-  }
-};
-
-
-/**
- * @private
- */
-devtools.profiler.CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) {
-  return addr >= node.key && addr < (node.key + node.value.size);
-};
-
-
-/**
- * @private
- */
-devtools.profiler.CodeMap.prototype.findInTree_ = function(tree, addr) {
-  var node = tree.findGreatestLessThan(addr);
-  return node && this.isAddressBelongsTo_(addr, node) ? node.value : null;
-};
-
-
-/**
- * Finds a code entry that contains the specified address. Both static and
- * dynamic code entries are considered.
- *
- * @param {number} addr Address.
- */
-devtools.profiler.CodeMap.prototype.findEntry = function(addr) {
-  var pageAddr = addr >>> devtools.profiler.CodeMap.PAGE_ALIGNMENT;
-  if (pageAddr in this.pages_) {
-    // Static code entries can contain "holes" of unnamed code.
-    // In this case, the whole library is assigned to this address.
-    return this.findInTree_(this.statics_, addr) ||
-        this.findInTree_(this.libraries_, addr);
-  }
-  var min = this.dynamics_.findMin();
-  var max = this.dynamics_.findMax();
-  if (max != null && addr < (max.key + max.value.size) && addr >= min.key) {
-    var dynaEntry = this.findInTree_(this.dynamics_, addr);
-    if (dynaEntry == null) return null;
-    // Dedupe entry name.
-    if (!dynaEntry.nameUpdated_) {
-      dynaEntry.name = this.dynamicsNameGen_.getName(dynaEntry.name);
-      dynaEntry.nameUpdated_ = true;
-    }
-    return dynaEntry;
-  }
-  return null;
-};
-
-
-/**
- * Returns a dynamic code entry using its starting address.
- *
- * @param {number} addr Address.
- */
-devtools.profiler.CodeMap.prototype.findDynamicEntryByStartAddress =
-    function(addr) {
-  var node = this.dynamics_.find(addr);
-  return node ? node.value : null;
-};
-
-
-/**
- * Returns an array of all dynamic code entries.
- */
-devtools.profiler.CodeMap.prototype.getAllDynamicEntries = function() {
-  return this.dynamics_.exportValues();
-};
-
-
-/**
- * Returns an array of all static code entries.
- */
-devtools.profiler.CodeMap.prototype.getAllStaticEntries = function() {
-  return this.statics_.exportValues();
-};
-
-
-/**
- * Returns an array of all libraries entries.
- */
-devtools.profiler.CodeMap.prototype.getAllLibrariesEntries = function() {
-  return this.libraries_.exportValues();
-};
-
-
-/**
- * Creates a code entry object.
- *
- * @param {number} size Code entry size in bytes.
- * @param {string} opt_name Code entry name.
- * @constructor
- */
-devtools.profiler.CodeMap.CodeEntry = function(size, opt_name) {
-  this.size = size;
-  this.name = opt_name || '';
-  this.nameUpdated_ = false;
-};
-
-
-devtools.profiler.CodeMap.CodeEntry.prototype.getName = function() {
-  return this.name;
-};
-
-
-devtools.profiler.CodeMap.CodeEntry.prototype.toString = function() {
-  return this.name + ': ' + this.size.toString(16);
-};
-
-
-devtools.profiler.CodeMap.NameGenerator = function() {
-  this.knownNames_ = {};
-};
-
-
-devtools.profiler.CodeMap.NameGenerator.prototype.getName = function(name) {
-  if (!(name in this.knownNames_)) {
-    this.knownNames_[name] = 0;
-    return name;
-  }
-  var count = ++this.knownNames_[name];
-  return name + ' {' + count + '}';
-};
-
-/* consarray.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-/**
- * Constructs a ConsArray object. It is used mainly for tree traversal.
- * In this use case we have lots of arrays that we need to iterate
- * sequentally. The internal Array implementation is horribly slow
- * when concatenating on large (10K items) arrays due to memory copying.
- * That's why we avoid copying memory and insead build a linked list
- * of arrays to iterate through.
- *
- * @constructor
- */
-function ConsArray() {
-  this.tail_ = new ConsArray.Cell(null, null);
-  this.currCell_ = this.tail_;
-  this.currCellPos_ = 0;
-};
-
-
-/**
- * Concatenates another array for iterating. Empty arrays are ignored.
- * This operation can be safely performed during ongoing ConsArray
- * iteration.
- *
- * @param {Array} arr Array to concatenate.
- */
-ConsArray.prototype.concat = function(arr) {
-  if (arr.length > 0) {
-    this.tail_.data = arr;
-    this.tail_ = this.tail_.next = new ConsArray.Cell(null, null);
-  }
-};
-
-
-/**
- * Whether the end of iteration is reached.
- */
-ConsArray.prototype.atEnd = function() {
-  return this.currCell_ === null ||
-      this.currCell_.data === null ||
-      this.currCellPos_ >= this.currCell_.data.length;
-};
-
-
-/**
- * Returns the current item, moves to the next one.
- */
-ConsArray.prototype.next = function() {
-  var result = this.currCell_.data[this.currCellPos_++];
-  if (this.currCellPos_ >= this.currCell_.data.length) {
-    this.currCell_ = this.currCell_.next;
-    this.currCellPos_ = 0;
-  }
-  return result;
-};
-
-
-/**
- * A cell object used for constructing a list in ConsArray.
- *
- * @constructor
- */
-ConsArray.Cell = function(data, next) {
-  this.data = data;
-  this.next = next;
-};
-
-
-/* csvparser.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Initlialize namespaces.
-var devtools = devtools || {};
-devtools.profiler = devtools.profiler || {};
-
-
-/**
- * Creates a CSV lines parser.
- */
-devtools.profiler.CsvParser = function() {
-};
-
-
-/**
- * A regex for matching a CSV field.
- * @private
- */
-devtools.profiler.CsvParser.CSV_FIELD_RE_ = /^"((?:[^"]|"")*)"|([^,]*)/;
-
-
-/**
- * A regex for matching a double quote.
- * @private
- */
-devtools.profiler.CsvParser.DOUBLE_QUOTE_RE_ = /""/g;
-
-
-/**
- * Parses a line of CSV-encoded values. Returns an array of fields.
- *
- * @param {string} line Input line.
- */
-devtools.profiler.CsvParser.prototype.parseLine = function(line) {
-  var fieldRe = devtools.profiler.CsvParser.CSV_FIELD_RE_;
-  var doubleQuoteRe = devtools.profiler.CsvParser.DOUBLE_QUOTE_RE_;
-  var pos = 0;
-  var endPos = line.length;
-  var fields = [];
-  if (endPos > 0) {
-    do {
-      var fieldMatch = fieldRe.exec(line.substr(pos));
-      if (typeof fieldMatch[1] === "string") {
-        var field = fieldMatch[1];
-        pos += field.length + 3;  // Skip comma and quotes.
-        fields.push(field.replace(doubleQuoteRe, '"'));
-      } else {
-        // The second field pattern will match anything, thus
-        // in the worst case the match will be an empty string.
-        var field = fieldMatch[2];
-        pos += field.length + 1;  // Skip comma.
-        fields.push(field);
-      }
-    } while (pos <= endPos);
-  }
-  return fields;
-};
-
-/* logreader.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-/**
- * @fileoverview Log Reader is used to process log file produced by V8.
- */
-
-// Initlialize namespaces
-var devtools = devtools || {};
-devtools.profiler = devtools.profiler || {};
-
-
-/**
- * Base class for processing log files.
- *
- * @param {Array.<Object>} dispatchTable A table used for parsing and processing
- *     log records.
- * @constructor
- */
-devtools.profiler.LogReader = function(dispatchTable) {
-  /**
-   * @type {Array.<Object>}
-   */
-  this.dispatchTable_ = dispatchTable;
-  this.dispatchTable_['alias'] =
-      { parsers: [null, null], processor: this.processAlias_ };
-  this.dispatchTable_['repeat'] =
-      { parsers: [parseInt, 'var-args'], processor: this.processRepeat_,
-        backrefs: true };
-
-  /**
-   * A key-value map for aliases. Translates short name -> full name.
-   * @type {Object}
-   */
-  this.aliases_ = {};
-
-  /**
-   * A key-value map for previous address values.
-   * @type {Object}
-   */
-  this.prevAddresses_ = {};
-
-  /**
-   * A key-value map for events than can be backreference-compressed.
-   * @type {Object}
-   */
-  this.backRefsCommands_ = {};
-  this.initBackRefsCommands_();
-
-  /**
-   * Back references for decompression.
-   * @type {Array.<string>}
-   */
-  this.backRefs_ = [];
-
-  /**
-   * Current line.
-   * @type {number}
-   */
-  this.lineNum_ = 0;
-
-  /**
-   * CSV lines parser.
-   * @type {devtools.profiler.CsvParser}
-   */
-  this.csvParser_ = new devtools.profiler.CsvParser();
-};
-
-
-/**
- * Creates a parser for an address entry.
- *
- * @param {string} addressTag Address tag to perform offset decoding.
- * @return {function(string):number} Address parser.
- */
-devtools.profiler.LogReader.prototype.createAddressParser = function(
-    addressTag) {
-  var self = this;
-  return (function (str) {
-    var value = parseInt(str, 16);
-    var firstChar = str.charAt(0);
-    if (firstChar == '+' || firstChar == '-') {
-      var addr = self.prevAddresses_[addressTag];
-      addr += value;
-      self.prevAddresses_[addressTag] = addr;
-      return addr;
-    } else if (firstChar != '0' || str.charAt(1) != 'x') {
-      self.prevAddresses_[addressTag] = value;
-    }
-    return value;
-  });
-};
-
-
-/**
- * Expands an alias symbol, if applicable.
- *
- * @param {string} symbol Symbol to expand.
- * @return {string} Expanded symbol, or the input symbol itself.
- */
-devtools.profiler.LogReader.prototype.expandAlias = function(symbol) {
-  return symbol in this.aliases_ ? this.aliases_[symbol] : symbol;
-};
-
-
-/**
- * Used for printing error messages.
- *
- * @param {string} str Error message.
- */
-devtools.profiler.LogReader.prototype.printError = function(str) {
-  // Do nothing.
-};
-
-
-/**
- * Processes a portion of V8 profiler event log.
- *
- * @param {string} chunk A portion of log.
- */
-devtools.profiler.LogReader.prototype.processLogChunk = function(chunk) {
-  this.processLog_(chunk.split('\n'));
-};
-
-
-/**
- * Processes a line of V8 profiler event log.
- *
- * @param {string} line A line of log.
- */
-devtools.profiler.LogReader.prototype.processLogLine = function(line) {
-  this.processLog_([line]);
-};
-
-
-/**
- * Processes stack record.
- *
- * @param {number} pc Program counter.
- * @param {number} func JS Function.
- * @param {Array.<string>} stack String representation of a stack.
- * @return {Array.<number>} Processed stack.
- */
-devtools.profiler.LogReader.prototype.processStack = function(pc, func, stack) {
-  var fullStack = func ? [pc, func] : [pc];
-  var prevFrame = pc;
-  for (var i = 0, n = stack.length; i < n; ++i) {
-    var frame = stack[i];
-    var firstChar = frame.charAt(0);
-    if (firstChar == '+' || firstChar == '-') {
-      // An offset from the previous frame.
-      prevFrame += parseInt(frame, 16);
-      fullStack.push(prevFrame);
-    // Filter out possible 'overflow' string.
-    } else if (firstChar != 'o') {
-      fullStack.push(parseInt(frame, 16));
-    }
-  }
-  return fullStack;
-};
-
-
-/**
- * Returns whether a particular dispatch must be skipped.
- *
- * @param {!Object} dispatch Dispatch record.
- * @return {boolean} True if dispatch must be skipped.
- */
-devtools.profiler.LogReader.prototype.skipDispatch = function(dispatch) {
-  return false;
-};
-
-
-/**
- * Does a dispatch of a log record.
- *
- * @param {Array.<string>} fields Log record.
- * @private
- */
-devtools.profiler.LogReader.prototype.dispatchLogRow_ = function(fields) {
-  // Obtain the dispatch.
-  var command = fields[0];
-  if (!(command in this.dispatchTable_)) {
-    throw new Error('unknown command: ' + command);
-  }
-  var dispatch = this.dispatchTable_[command];
-
-  if (dispatch === null || this.skipDispatch(dispatch)) {
-    return;
-  }
-
-  // Parse fields.
-  var parsedFields = [];
-  for (var i = 0; i < dispatch.parsers.length; ++i) {
-    var parser = dispatch.parsers[i];
-    if (parser === null) {
-      parsedFields.push(fields[1 + i]);
-    } else if (typeof parser == 'function') {
-      parsedFields.push(parser(fields[1 + i]));
-    } else {
-      // var-args
-      parsedFields.push(fields.slice(1 + i));
-      break;
-    }
-  }
-
-  // Run the processor.
-  dispatch.processor.apply(this, parsedFields);
-};
-
-
-/**
- * Decompresses a line if it was backreference-compressed.
- *
- * @param {string} line Possibly compressed line.
- * @return {string} Decompressed line.
- * @private
- */
-devtools.profiler.LogReader.prototype.expandBackRef_ = function(line) {
-  var backRefPos;
-  // Filter out case when a regexp is created containing '#'.
-  if (line.charAt(line.length - 1) != '"'
-      && (backRefPos = line.lastIndexOf('#')) != -1) {
-    var backRef = line.substr(backRefPos + 1);
-    var backRefIdx = parseInt(backRef, 10) - 1;
-    var colonPos = backRef.indexOf(':');
-    var backRefStart =
-        colonPos != -1 ? parseInt(backRef.substr(colonPos + 1), 10) : 0;
-    line = line.substr(0, backRefPos) +
-        this.backRefs_[backRefIdx].substr(backRefStart);
-  }
-  this.backRefs_.unshift(line);
-  if (this.backRefs_.length > 10) {
-    this.backRefs_.length = 10;
-  }
-  return line;
-};
-
-
-/**
- * Initializes the map of backward reference compressible commands.
- * @private
- */
-devtools.profiler.LogReader.prototype.initBackRefsCommands_ = function() {
-  for (var event in this.dispatchTable_) {
-    var dispatch = this.dispatchTable_[event];
-    if (dispatch && dispatch.backrefs) {
-      this.backRefsCommands_[event] = true;
-    }
-  }
-};
-
-
-/**
- * Processes alias log record. Adds an alias to a corresponding map.
- *
- * @param {string} symbol Short name.
- * @param {string} expansion Long name.
- * @private
- */
-devtools.profiler.LogReader.prototype.processAlias_ = function(
-    symbol, expansion) {
-  if (expansion in this.dispatchTable_) {
-    this.dispatchTable_[symbol] = this.dispatchTable_[expansion];
-    if (expansion in this.backRefsCommands_) {
-      this.backRefsCommands_[symbol] = true;
-    }
-  } else {
-    this.aliases_[symbol] = expansion;
-  }
-};
-
-
-/**
- * Processes log lines.
- *
- * @param {Array.<string>} lines Log lines.
- * @private
- */
-devtools.profiler.LogReader.prototype.processLog_ = function(lines) {
-  for (var i = 0, n = lines.length; i < n; ++i, ++this.lineNum_) {
-    var line = lines[i];
-    if (!line) {
-      continue;
-    }
-    try {
-      if (line.charAt(0) == '#' ||
-          line.substr(0, line.indexOf(',')) in this.backRefsCommands_) {
-        line = this.expandBackRef_(line);
-      }
-      var fields = this.csvParser_.parseLine(line);
-      this.dispatchLogRow_(fields);
-    } catch (e) {
-      this.printError('line ' + (this.lineNum_ + 1) + ': ' + (e.message || e));
-    }
-  }
-};
-
-
-/**
- * Processes repeat log record. Expands it according to calls count and
- * invokes processing.
- *
- * @param {number} count Count.
- * @param {Array.<string>} cmd Parsed command.
- * @private
- */
-devtools.profiler.LogReader.prototype.processRepeat_ = function(count, cmd) {
-  // Replace the repeat-prefixed command from backrefs list with a non-prefixed.
-  this.backRefs_[0] = cmd.join(',');
-  for (var i = 0; i < count; ++i) {
-    this.dispatchLogRow_(cmd);
-  }
-};
-
-/* profile.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Initlialize namespaces
-var devtools = devtools || {};
-devtools.profiler = devtools.profiler || {};
-
-
-/**
- * Creates a profile object for processing profiling-related events
- * and calculating function execution times.
- *
- * @constructor
- */
-devtools.profiler.Profile = function() {
-  this.codeMap_ = new devtools.profiler.CodeMap();
-  this.topDownTree_ = new devtools.profiler.CallTree();
-  this.bottomUpTree_ = new devtools.profiler.CallTree();
-};
-
-/**
- * Version of profiler log.
- */
-devtools.profiler.Profile.VERSION = 2;
-
-
-/**
- * Returns whether a function with the specified name must be skipped.
- * Should be overriden by subclasses.
- *
- * @param {string} name Function name.
- */
-devtools.profiler.Profile.prototype.skipThisFunction = function(name) {
-  return false;
-};
-
-
-/**
- * Enum for profiler operations that involve looking up existing
- * code entries.
- *
- * @enum {number}
- */
-devtools.profiler.Profile.Operation = {
-  MOVE: 0,
-  DELETE: 1,
-  TICK: 2
-};
-
-
-/**
- * Called whenever the specified operation has failed finding a function
- * containing the specified address. Should be overriden by subclasses.
- * See the devtools.profiler.Profile.Operation enum for the list of
- * possible operations.
- *
- * @param {number} operation Operation.
- * @param {number} addr Address of the unknown code.
- * @param {number} opt_stackPos If an unknown address is encountered
- *     during stack strace processing, specifies a position of the frame
- *     containing the address.
- */
-devtools.profiler.Profile.prototype.handleUnknownCode = function(
-    operation, addr, opt_stackPos) {
-};
-
-
-/**
- * Registers a library.
- *
- * @param {string} name Code entry name.
- * @param {number} startAddr Starting address.
- * @param {number} endAddr Ending address.
- */
-devtools.profiler.Profile.prototype.addLibrary = function(
-    name, startAddr, endAddr) {
-  var entry = new devtools.profiler.CodeMap.CodeEntry(
-      endAddr - startAddr, name);
-  this.codeMap_.addLibrary(startAddr, entry);
-  return entry;
-};
-
-
-/**
- * Registers statically compiled code entry.
- *
- * @param {string} name Code entry name.
- * @param {number} startAddr Starting address.
- * @param {number} endAddr Ending address.
- */
-devtools.profiler.Profile.prototype.addStaticCode = function(
-    name, startAddr, endAddr) {
-  var entry = new devtools.profiler.CodeMap.CodeEntry(
-      endAddr - startAddr, name);
-  this.codeMap_.addStaticCode(startAddr, entry);
-  return entry;
-};
-
-
-/**
- * Registers dynamic (JIT-compiled) code entry.
- *
- * @param {string} type Code entry type.
- * @param {string} name Code entry name.
- * @param {number} start Starting address.
- * @param {number} size Code entry size.
- */
-devtools.profiler.Profile.prototype.addCode = function(
-    type, name, start, size) {
-  var entry = new devtools.profiler.Profile.DynamicCodeEntry(size, type, name);
-  this.codeMap_.addCode(start, entry);
-  return entry;
-};
-
-
-/**
- * Creates an alias entry for a code entry.
- *
- * @param {number} aliasAddr Alias address.
- * @param {number} addr Code entry address.
- */
-devtools.profiler.Profile.prototype.addCodeAlias = function(
-    aliasAddr, addr) {
-  var entry = this.codeMap_.findDynamicEntryByStartAddress(addr);
-  if (entry) {
-    this.codeMap_.addCode(aliasAddr, entry);
-  }
-};
-
-
-/**
- * Reports about moving of a dynamic code entry.
- *
- * @param {number} from Current code entry address.
- * @param {number} to New code entry address.
- */
-devtools.profiler.Profile.prototype.moveCode = function(from, to) {
-  try {
-    this.codeMap_.moveCode(from, to);
-  } catch (e) {
-    this.handleUnknownCode(devtools.profiler.Profile.Operation.MOVE, from);
-  }
-};
-
-
-/**
- * Reports about deletion of a dynamic code entry.
- *
- * @param {number} start Starting address.
- */
-devtools.profiler.Profile.prototype.deleteCode = function(start) {
-  try {
-    this.codeMap_.deleteCode(start);
-  } catch (e) {
-    this.handleUnknownCode(devtools.profiler.Profile.Operation.DELETE, start);
-  }
-};
-
-
-/**
- * Reports about moving of a dynamic code entry.
- *
- * @param {number} from Current code entry address.
- * @param {number} to New code entry address.
- */
-devtools.profiler.Profile.prototype.safeMoveDynamicCode = function(from, to) {
-  if (this.codeMap_.findDynamicEntryByStartAddress(from)) {
-    this.codeMap_.moveCode(from, to);
-  }
-};
-
-
-/**
- * Reports about deletion of a dynamic code entry.
- *
- * @param {number} start Starting address.
- */
-devtools.profiler.Profile.prototype.safeDeleteDynamicCode = function(start) {
-  if (this.codeMap_.findDynamicEntryByStartAddress(start)) {
-    this.codeMap_.deleteCode(start);
-  }
-};
-
-
-/**
- * Retrieves a code entry by an address.
- *
- * @param {number} addr Entry address.
- */
-devtools.profiler.Profile.prototype.findEntry = function(addr) {
-  return this.codeMap_.findEntry(addr);
-};
-
-
-/**
- * Records a tick event. Stack must contain a sequence of
- * addresses starting with the program counter value.
- *
- * @param {Array<number>} stack Stack sample.
- */
-devtools.profiler.Profile.prototype.recordTick = function(stack) {
-  var processedStack = this.resolveAndFilterFuncs_(stack);
-  this.bottomUpTree_.addPath(processedStack);
-  processedStack.reverse();
-  this.topDownTree_.addPath(processedStack);
-};
-
-
-/**
- * Translates addresses into function names and filters unneeded
- * functions.
- *
- * @param {Array<number>} stack Stack sample.
- */
-devtools.profiler.Profile.prototype.resolveAndFilterFuncs_ = function(stack) {
-  var result = [];
-  for (var i = 0; i < stack.length; ++i) {
-    var entry = this.codeMap_.findEntry(stack[i]);
-    if (entry) {
-      var name = entry.getName();
-      if (!this.skipThisFunction(name)) {
-        result.push(name);
-      }
-    } else {
-      this.handleUnknownCode(
-          devtools.profiler.Profile.Operation.TICK, stack[i], i);
-    }
-  }
-  return result;
-};
-
-
-/**
- * Performs a BF traversal of the top down call graph.
- *
- * @param {function(devtools.profiler.CallTree.Node)} f Visitor function.
- */
-devtools.profiler.Profile.prototype.traverseTopDownTree = function(f) {
-  this.topDownTree_.traverse(f);
-};
-
-
-/**
- * Performs a BF traversal of the bottom up call graph.
- *
- * @param {function(devtools.profiler.CallTree.Node)} f Visitor function.
- */
-devtools.profiler.Profile.prototype.traverseBottomUpTree = function(f) {
-  this.bottomUpTree_.traverse(f);
-};
-
-
-/**
- * Calculates a top down profile for a node with the specified label.
- * If no name specified, returns the whole top down calls tree.
- *
- * @param {string} opt_label Node label.
- */
-devtools.profiler.Profile.prototype.getTopDownProfile = function(opt_label) {
-  return this.getTreeProfile_(this.topDownTree_, opt_label);
-};
-
-
-/**
- * Calculates a bottom up profile for a node with the specified label.
- * If no name specified, returns the whole bottom up calls tree.
- *
- * @param {string} opt_label Node label.
- */
-devtools.profiler.Profile.prototype.getBottomUpProfile = function(opt_label) {
-  return this.getTreeProfile_(this.bottomUpTree_, opt_label);
-};
-
-
-/**
- * Helper function for calculating a tree profile.
- *
- * @param {devtools.profiler.Profile.CallTree} tree Call tree.
- * @param {string} opt_label Node label.
- */
-devtools.profiler.Profile.prototype.getTreeProfile_ = function(tree, opt_label) {
-  if (!opt_label) {
-    tree.computeTotalWeights();
-    return tree;
-  } else {
-    var subTree = tree.cloneSubtree(opt_label);
-    subTree.computeTotalWeights();
-    return subTree;
-  }
-};
-
-
-/**
- * Calculates a flat profile of callees starting from a node with
- * the specified label. If no name specified, starts from the root.
- *
- * @param {string} opt_label Starting node label.
- */
-devtools.profiler.Profile.prototype.getFlatProfile = function(opt_label) {
-  var counters = new devtools.profiler.CallTree();
-  var rootLabel = opt_label || devtools.profiler.CallTree.ROOT_NODE_LABEL;
-  var precs = {};
-  precs[rootLabel] = 0;
-  var root = counters.findOrAddChild(rootLabel);
-
-  this.topDownTree_.computeTotalWeights();
-  this.topDownTree_.traverseInDepth(
-    function onEnter(node) {
-      if (!(node.label in precs)) {
-        precs[node.label] = 0;
-      }
-      var nodeLabelIsRootLabel = node.label == rootLabel;
-      if (nodeLabelIsRootLabel || precs[rootLabel] > 0) {
-        if (precs[rootLabel] == 0) {
-          root.selfWeight += node.selfWeight;
-          root.totalWeight += node.totalWeight;
-        } else {
-          var rec = root.findOrAddChild(node.label);
-          rec.selfWeight += node.selfWeight;
-          if (nodeLabelIsRootLabel || precs[node.label] == 0) {
-            rec.totalWeight += node.totalWeight;
-          }
-        }
-        precs[node.label]++;
-      }
-    },
-    function onExit(node) {
-      if (node.label == rootLabel || precs[rootLabel] > 0) {
-        precs[node.label]--;
-      }
-    },
-    null);
-
-  if (!opt_label) {
-    // If we have created a flat profile for the whole program, we don't
-    // need an explicit root in it. Thus, replace the counters tree
-    // root with the node corresponding to the whole program.
-    counters.root_ = root;
-  } else {
-    // Propagate weights so percents can be calculated correctly.
-    counters.getRoot().selfWeight = root.selfWeight;
-    counters.getRoot().totalWeight = root.totalWeight;
-  }
-  return counters;
-};
-
-
-/**
- * Creates a dynamic code entry.
- *
- * @param {number} size Code size.
- * @param {string} type Code type.
- * @param {string} name Function name.
- * @constructor
- */
-devtools.profiler.Profile.DynamicCodeEntry = function(size, type, name) {
-  devtools.profiler.CodeMap.CodeEntry.call(this, size, name);
-  this.type = type;
-};
-
-
-/**
- * Returns node name.
- */
-devtools.profiler.Profile.DynamicCodeEntry.prototype.getName = function() {
-  var name = this.name;
-  if (name.length == 0) {
-    name = '<anonymous>';
-  } else if (name.charAt(0) == ' ') {
-    // An anonymous function with location: " aaa.js:10".
-    name = '<anonymous>' + name;
-  }
-  return this.type + ': ' + name;
-};
-
-
-/**
- * Returns raw node name (without type decoration).
- */
-devtools.profiler.Profile.DynamicCodeEntry.prototype.getRawName = function() {
-  return this.name;
-};
-
-
-devtools.profiler.Profile.DynamicCodeEntry.prototype.isJSFunction = function() {
-  return this.type == "Function" ||
-    this.type == "LazyCompile" ||
-    this.type == "Script";
-};
-
-
-/**
- * Constructs a call graph.
- *
- * @constructor
- */
-devtools.profiler.CallTree = function() {
-  this.root_ = new devtools.profiler.CallTree.Node(
-      devtools.profiler.CallTree.ROOT_NODE_LABEL);
-};
-
-
-/**
- * The label of the root node.
- */
-devtools.profiler.CallTree.ROOT_NODE_LABEL = '';
-
-
-/**
- * @private
- */
-devtools.profiler.CallTree.prototype.totalsComputed_ = false;
-
-
-/**
- * Returns the tree root.
- */
-devtools.profiler.CallTree.prototype.getRoot = function() {
-  return this.root_;
-};
-
-
-/**
- * Adds the specified call path, constructing nodes as necessary.
- *
- * @param {Array<string>} path Call path.
- */
-devtools.profiler.CallTree.prototype.addPath = function(path) {
-  if (path.length == 0) {
-    return;
-  }
-  var curr = this.root_;
-  for (var i = 0; i < path.length; ++i) {
-    curr = curr.findOrAddChild(path[i]);
-  }
-  curr.selfWeight++;
-  this.totalsComputed_ = false;
-};
-
-
-/**
- * Finds an immediate child of the specified parent with the specified
- * label, creates a child node if necessary. If a parent node isn't
- * specified, uses tree root.
- *
- * @param {string} label Child node label.
- */
-devtools.profiler.CallTree.prototype.findOrAddChild = function(label) {
-  return this.root_.findOrAddChild(label);
-};
-
-
-/**
- * Creates a subtree by cloning and merging all subtrees rooted at nodes
- * with a given label. E.g. cloning the following call tree on label 'A'
- * will give the following result:
- *
- *           <A>--<B>                                     <B>
- *          /                                            /
- *     <root>             == clone on 'A' ==>  <root>--<A>
- *          \                                            \
- *           <C>--<A>--<D>                                <D>
- *
- * And <A>'s selfWeight will be the sum of selfWeights of <A>'s from the
- * source call tree.
- *
- * @param {string} label The label of the new root node.
- */
-devtools.profiler.CallTree.prototype.cloneSubtree = function(label) {
-  var subTree = new devtools.profiler.CallTree();
-  this.traverse(function(node, parent) {
-    if (!parent && node.label != label) {
-      return null;
-    }
-    var child = (parent ? parent : subTree).findOrAddChild(node.label);
-    child.selfWeight += node.selfWeight;
-    return child;
-  });
-  return subTree;
-};
-
-
-/**
- * Computes total weights in the call graph.
- */
-devtools.profiler.CallTree.prototype.computeTotalWeights = function() {
-  if (this.totalsComputed_) {
-    return;
-  }
-  this.root_.computeTotalWeight();
-  this.totalsComputed_ = true;
-};
-
-
-/**
- * Traverses the call graph in preorder. This function can be used for
- * building optionally modified tree clones. This is the boilerplate code
- * for this scenario:
- *
- * callTree.traverse(function(node, parentClone) {
- *   var nodeClone = cloneNode(node);
- *   if (parentClone)
- *     parentClone.addChild(nodeClone);
- *   return nodeClone;
- * });
- *
- * @param {function(devtools.profiler.CallTree.Node, *)} f Visitor function.
- *    The second parameter is the result of calling 'f' on the parent node.
- */
-devtools.profiler.CallTree.prototype.traverse = function(f) {
-  var pairsToProcess = new ConsArray();
-  pairsToProcess.concat([{node: this.root_, param: null}]);
-  while (!pairsToProcess.atEnd()) {
-    var pair = pairsToProcess.next();
-    var node = pair.node;
-    var newParam = f(node, pair.param);
-    var morePairsToProcess = [];
-    node.forEachChild(function (child) {
-        morePairsToProcess.push({node: child, param: newParam}); });
-    pairsToProcess.concat(morePairsToProcess);
-  }
-};
-
-
-/**
- * Performs an indepth call graph traversal.
- *
- * @param {function(devtools.profiler.CallTree.Node)} enter A function called
- *     prior to visiting node's children.
- * @param {function(devtools.profiler.CallTree.Node)} exit A function called
- *     after visiting node's children.
- */
-devtools.profiler.CallTree.prototype.traverseInDepth = function(enter, exit) {
-  function traverse(node) {
-    enter(node);
-    node.forEachChild(traverse);
-    exit(node);
-  }
-  traverse(this.root_);
-};
-
-
-/**
- * Constructs a call graph node.
- *
- * @param {string} label Node label.
- * @param {devtools.profiler.CallTree.Node} opt_parent Node parent.
- */
-devtools.profiler.CallTree.Node = function(label, opt_parent) {
-  this.label = label;
-  this.parent = opt_parent;
-  this.children = {};
-};
-
-
-/**
- * Node self weight (how many times this node was the last node in
- * a call path).
- * @type {number}
- */
-devtools.profiler.CallTree.Node.prototype.selfWeight = 0;
-
-
-/**
- * Node total weight (includes weights of all children).
- * @type {number}
- */
-devtools.profiler.CallTree.Node.prototype.totalWeight = 0;
-
-
-/**
- * Adds a child node.
- *
- * @param {string} label Child node label.
- */
-devtools.profiler.CallTree.Node.prototype.addChild = function(label) {
-  var child = new devtools.profiler.CallTree.Node(label, this);
-  this.children[label] = child;
-  return child;
-};
-
-
-/**
- * Computes node's total weight.
- */
-devtools.profiler.CallTree.Node.prototype.computeTotalWeight =
-    function() {
-  var totalWeight = this.selfWeight;
-  this.forEachChild(function(child) {
-      totalWeight += child.computeTotalWeight(); });
-  return this.totalWeight = totalWeight;
-};
-
-
-/**
- * Returns all node's children as an array.
- */
-devtools.profiler.CallTree.Node.prototype.exportChildren = function() {
-  var result = [];
-  this.forEachChild(function (node) { result.push(node); });
-  return result;
-};
-
-
-/**
- * Finds an immediate child with the specified label.
- *
- * @param {string} label Child node label.
- */
-devtools.profiler.CallTree.Node.prototype.findChild = function(label) {
-  return this.children[label] || null;
-};
-
-
-/**
- * Finds an immediate child with the specified label, creates a child
- * node if necessary.
- *
- * @param {string} label Child node label.
- */
-devtools.profiler.CallTree.Node.prototype.findOrAddChild = function(label) {
-  return this.findChild(label) || this.addChild(label);
-};
-
-
-/**
- * Calls the specified function for every child.
- *
- * @param {function(devtools.profiler.CallTree.Node)} f Visitor function.
- */
-devtools.profiler.CallTree.Node.prototype.forEachChild = function(f) {
-  for (var c in this.children) {
-    f(this.children[c]);
-  }
-};
-
-
-/**
- * Walks up from the current node up to the call tree root.
- *
- * @param {function(devtools.profiler.CallTree.Node)} f Visitor function.
- */
-devtools.profiler.CallTree.Node.prototype.walkUpToRoot = function(f) {
-  for (var curr = this; curr != null; curr = curr.parent) {
-    f(curr);
-  }
-};
-
-
-/**
- * Tries to find a node with the specified path.
- *
- * @param {Array<string>} labels The path.
- * @param {function(devtools.profiler.CallTree.Node)} opt_f Visitor function.
- */
-devtools.profiler.CallTree.Node.prototype.descendToChild = function(
-    labels, opt_f) {
-  for (var pos = 0, curr = this; pos < labels.length && curr != null; pos++) {
-    var child = curr.findChild(labels[pos]);
-    if (opt_f) {
-      opt_f(child, pos);
-    }
-    curr = child;
-  }
-  return curr;
-};
-
-/* profile_view.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// Initlialize namespaces
-var devtools = devtools || {};
-devtools.profiler = devtools.profiler || {};
-
-
-/**
- * Creates a Profile View builder object.
- *
- * @param {number} samplingRate Number of ms between profiler ticks.
- * @constructor
- */
-devtools.profiler.ViewBuilder = function(samplingRate) {
-  this.samplingRate = samplingRate;
-};
-
-
-/**
- * Builds a profile view for the specified call tree.
- *
- * @param {devtools.profiler.CallTree} callTree A call tree.
- * @param {boolean} opt_bottomUpViewWeights Whether remapping
- *     of self weights for a bottom up view is needed.
- */
-devtools.profiler.ViewBuilder.prototype.buildView = function(
-    callTree, opt_bottomUpViewWeights) {
-  var head;
-  var samplingRate = this.samplingRate;
-  var createViewNode = this.createViewNode;
-  callTree.traverse(function(node, viewParent) {
-    var totalWeight = node.totalWeight * samplingRate;
-    var selfWeight = node.selfWeight * samplingRate;
-    if (opt_bottomUpViewWeights === true) {
-      if (viewParent === head) {
-        selfWeight = totalWeight;
-      } else {
-        selfWeight = 0;
-      }
-    }
-    var viewNode = createViewNode(node.label, totalWeight, selfWeight, head);
-    if (viewParent) {
-      viewParent.addChild(viewNode);
-    } else {
-      head = viewNode;
-    }
-    return viewNode;
-  });
-  var view = this.createView(head);
-  return view;
-};
-
-
-/**
- * Factory method for a profile view.
- *
- * @param {devtools.profiler.ProfileView.Node} head View head node.
- * @return {devtools.profiler.ProfileView} Profile view.
- */
-devtools.profiler.ViewBuilder.prototype.createView = function(head) {
-  return new devtools.profiler.ProfileView(head);
-};
-
-
-/**
- * Factory method for a profile view node.
- *
- * @param {string} internalFuncName A fully qualified function name.
- * @param {number} totalTime Amount of time that application spent in the
- *     corresponding function and its descendants (not that depending on
- *     profile they can be either callees or callers.)
- * @param {number} selfTime Amount of time that application spent in the
- *     corresponding function only.
- * @param {devtools.profiler.ProfileView.Node} head Profile view head.
- * @return {devtools.profiler.ProfileView.Node} Profile view node.
- */
-devtools.profiler.ViewBuilder.prototype.createViewNode = function(
-    funcName, totalTime, selfTime, head) {
-  return new devtools.profiler.ProfileView.Node(
-      funcName, totalTime, selfTime, head);
-};
-
-
-/**
- * Creates a Profile View object. It allows to perform sorting
- * and filtering actions on the profile.
- *
- * @param {devtools.profiler.ProfileView.Node} head Head (root) node.
- * @constructor
- */
-devtools.profiler.ProfileView = function(head) {
-  this.head = head;
-};
-
-
-/**
- * Sorts the profile view using the specified sort function.
- *
- * @param {function(devtools.profiler.ProfileView.Node,
- *     devtools.profiler.ProfileView.Node):number} sortFunc A sorting
- *     functions. Must comply with Array.sort sorting function requirements.
- */
-devtools.profiler.ProfileView.prototype.sort = function(sortFunc) {
-  this.traverse(function (node) {
-    node.sortChildren(sortFunc);
-  });
-};
-
-
-/**
- * Traverses profile view nodes in preorder.
- *
- * @param {function(devtools.profiler.ProfileView.Node)} f Visitor function.
- */
-devtools.profiler.ProfileView.prototype.traverse = function(f) {
-  var nodesToTraverse = new ConsArray();
-  nodesToTraverse.concat([this.head]);
-  while (!nodesToTraverse.atEnd()) {
-    var node = nodesToTraverse.next();
-    f(node);
-    nodesToTraverse.concat(node.children);
-  }
-};
-
-
-/**
- * Constructs a Profile View node object. Each node object corresponds to
- * a function call.
- *
- * @param {string} internalFuncName A fully qualified function name.
- * @param {number} totalTime Amount of time that application spent in the
- *     corresponding function and its descendants (not that depending on
- *     profile they can be either callees or callers.)
- * @param {number} selfTime Amount of time that application spent in the
- *     corresponding function only.
- * @param {devtools.profiler.ProfileView.Node} head Profile view head.
- * @constructor
- */
-devtools.profiler.ProfileView.Node = function(
-    internalFuncName, totalTime, selfTime, head) {
-  this.internalFuncName = internalFuncName;
-  this.totalTime = totalTime;
-  this.selfTime = selfTime;
-  this.head = head;
-  this.parent = null;
-  this.children = [];
-};
-
-
-/**
- * Returns a share of the function's total time in application's total time.
- */
-devtools.profiler.ProfileView.Node.prototype.__defineGetter__(
-    'totalPercent',
-    function() { return this.totalTime /
-      (this.head ? this.head.totalTime : this.totalTime) * 100.0; });
-
-
-/**
- * Returns a share of the function's self time in application's total time.
- */
-devtools.profiler.ProfileView.Node.prototype.__defineGetter__(
-    'selfPercent',
-    function() { return this.selfTime /
-      (this.head ? this.head.totalTime : this.totalTime) * 100.0; });
-
-
-/**
- * Returns a share of the function's total time in its parent's total time.
- */
-devtools.profiler.ProfileView.Node.prototype.__defineGetter__(
-    'parentTotalPercent',
-    function() { return this.totalTime /
-      (this.parent ? this.parent.totalTime : this.totalTime) * 100.0; });
-
-
-/**
- * Adds a child to the node.
- *
- * @param {devtools.profiler.ProfileView.Node} node Child node.
- */
-devtools.profiler.ProfileView.Node.prototype.addChild = function(node) {
-  node.parent = this;
-  this.children.push(node);
-};
-
-
-/**
- * Sorts all the node's children recursively.
- *
- * @param {function(devtools.profiler.ProfileView.Node,
- *     devtools.profiler.ProfileView.Node):number} sortFunc A sorting
- *     functions. Must comply with Array.sort sorting function requirements.
- */
-devtools.profiler.ProfileView.Node.prototype.sortChildren = function(
-    sortFunc) {
-  this.children.sort(sortFunc);
-};
-
-/* splaytree.js */
-
-// Copyright 2009 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-// A namespace stub. It will become more clear how to declare it properly
-// during integration of this script into Dev Tools.
-var goog = goog || {};
-goog.structs = goog.structs || {};
-
-
-/**
- * Constructs a Splay tree.  A splay tree is a self-balancing binary
- * search tree with the additional property that recently accessed
- * elements are quick to access again. It performs basic operations
- * such as insertion, look-up and removal in O(log(n)) amortized time.
- *
- * @constructor
- */
-goog.structs.SplayTree = function() {
-};
-
-
-/**
- * Pointer to the root node of the tree.
- *
- * @type {goog.structs.SplayTree.Node}
- * @private
- */
-goog.structs.SplayTree.prototype.root_ = null;
-
-
-/**
- * @return {boolean} Whether the tree is empty.
- */
-goog.structs.SplayTree.prototype.isEmpty = function() {
-  return !this.root_;
-};
-
-
-
-/**
- * Inserts a node into the tree with the specified key and value if
- * the tree does not already contain a node with the specified key. If
- * the value is inserted, it becomes the root of the tree.
- *
- * @param {number} key Key to insert into the tree.
- * @param {*} value Value to insert into the tree.
- */
-goog.structs.SplayTree.prototype.insert = function(key, value) {
-  if (this.isEmpty()) {
-    this.root_ = new goog.structs.SplayTree.Node(key, value);
-    return;
-  }
-  // Splay on the key to move the last node on the search path for
-  // the key to the root of the tree.
-  this.splay_(key);
-  if (this.root_.key == key) {
-    return;
-  }
-  var node = new goog.structs.SplayTree.Node(key, value);
-  if (key > this.root_.key) {
-    node.left = this.root_;
-    node.right = this.root_.right;
-    this.root_.right = null;
-  } else {
-    node.right = this.root_;
-    node.left = this.root_.left;
-    this.root_.left = null;
-  }
-  this.root_ = node;
-};
-
-
-/**
- * Removes a node with the specified key from the tree if the tree
- * contains a node with this key. The removed node is returned. If the
- * key is not found, an exception is thrown.
- *
- * @param {number} key Key to find and remove from the tree.
- * @return {goog.structs.SplayTree.Node} The removed node.
- */
-goog.structs.SplayTree.prototype.remove = function(key) {
-  if (this.isEmpty()) {
-    throw Error('Key not found: ' + key);
-  }
-  this.splay_(key);
-  if (this.root_.key != key) {
-    throw Error('Key not found: ' + key);
-  }
-  var removed = this.root_;
-  if (!this.root_.left) {
-    this.root_ = this.root_.right;
-  } else {
-    var right = this.root_.right;
-    this.root_ = this.root_.left;
-    // Splay to make sure that the new root has an empty right child.
-    this.splay_(key);
-    // Insert the original right child as the right child of the new
-    // root.
-    this.root_.right = right;
-  }
-  return removed;
-};
-
-
-/**
- * Returns the node having the specified key or null if the tree doesn't contain
- * a node with the specified key.
- *
- * @param {number} key Key to find in the tree.
- * @return {goog.structs.SplayTree.Node} Node having the specified key.
- */
-goog.structs.SplayTree.prototype.find = function(key) {
-  if (this.isEmpty()) {
-    return null;
-  }
-  this.splay_(key);
-  return this.root_.key == key ? this.root_ : null;
-};
-
-
-/**
- * @return {goog.structs.SplayTree.Node} Node having the minimum key value.
- */
-goog.structs.SplayTree.prototype.findMin = function() {
-  if (this.isEmpty()) {
-    return null;
-  }
-  var current = this.root_;
-  while (current.left) {
-    current = current.left;
-  }
-  return current;
-};
-
-
-/**
- * @return {goog.structs.SplayTree.Node} Node having the maximum key value.
- */
-goog.structs.SplayTree.prototype.findMax = function(opt_startNode) {
-  if (this.isEmpty()) {
-    return null;
-  }
-  var current = opt_startNode || this.root_;
-  while (current.right) {
-    current = current.right;
-  }
-  return current;
-};
-
-
-/**
- * @return {goog.structs.SplayTree.Node} Node having the maximum key value that
- *     is less or equal to the specified key value.
- */
-goog.structs.SplayTree.prototype.findGreatestLessThan = function(key) {
-  if (this.isEmpty()) {
-    return null;
-  }
-  // Splay on the key to move the node with the given key or the last
-  // node on the search path to the top of the tree.
-  this.splay_(key);
-  // Now the result is either the root node or the greatest node in
-  // the left subtree.
-  if (this.root_.key <= key) {
-    return this.root_;
-  } else if (this.root_.left) {
-    return this.findMax(this.root_.left);
-  } else {
-    return null;
-  }
-};
-
-
-/**
- * @return {Array<*>} An array containing all the values of tree's nodes.
- */
-goog.structs.SplayTree.prototype.exportValues = function() {
-  var result = [];
-  this.traverse_(function(node) { result.push(node.value); });
-  return result;
-};
-
-
-/**
- * Perform the splay operation for the given key. Moves the node with
- * the given key to the top of the tree.  If no node has the given
- * key, the last node on the search path is moved to the top of the
- * tree. This is the simplified top-down splaying algorithm from:
- * "Self-adjusting Binary Search Trees" by Sleator and Tarjan
- *
- * @param {number} key Key to splay the tree on.
- * @private
- */
-goog.structs.SplayTree.prototype.splay_ = function(key) {
-  if (this.isEmpty()) {
-    return;
-  }
-  // Create a dummy node.  The use of the dummy node is a bit
-  // counter-intuitive: The right child of the dummy node will hold
-  // the L tree of the algorithm.  The left child of the dummy node
-  // will hold the R tree of the algorithm.  Using a dummy node, left
-  // and right will always be nodes and we avoid special cases.
-  var dummy, left, right;
-  dummy = left = right = new goog.structs.SplayTree.Node(null, null);
-  var current = this.root_;
-  while (true) {
-    if (key < current.key) {
-      if (!current.left) {
-        break;
-      }
-      if (key < current.left.key) {
-        // Rotate right.
-        var tmp = current.left;
-        current.left = tmp.right;
-        tmp.right = current;
-        current = tmp;
-        if (!current.left) {
-          break;
-        }
-      }
-      // Link right.
-      right.left = current;
-      right = current;
-      current = current.left;
-    } else if (key > current.key) {
-      if (!current.right) {
-        break;
-      }
-      if (key > current.right.key) {
-        // Rotate left.
-        var tmp = current.right;
-        current.right = tmp.left;
-        tmp.left = current;
-        current = tmp;
-        if (!current.right) {
-          break;
-        }
-      }
-      // Link left.
-      left.right = current;
-      left = current;
-      current = current.right;
-    } else {
-      break;
-    }
-  }
-  // Assemble.
-  left.right = current.left;
-  right.left = current.right;
-  current.left = dummy.right;
-  current.right = dummy.left;
-  this.root_ = current;
-};
-
-
-/**
- * Performs a preorder traversal of the tree.
- *
- * @param {function(goog.structs.SplayTree.Node)} f Visitor function.
- * @private
- */
-goog.structs.SplayTree.prototype.traverse_ = function(f) {
-  var nodesToVisit = [this.root_];
-  while (nodesToVisit.length > 0) {
-    var node = nodesToVisit.shift();
-    if (node == null) {
-      continue;
-    }
-    f(node);
-    nodesToVisit.push(node.left);
-    nodesToVisit.push(node.right);
-  }
-};
-
-
-/**
- * Constructs a Splay tree node.
- *
- * @param {number} key Key.
- * @param {*} value Value.
- */
-goog.structs.SplayTree.Node = function(key, value) {
-  this.key = key;
-  this.value = value;
-};
-
-
-/**
- * @type {goog.structs.SplayTree.Node}
- */
-goog.structs.SplayTree.Node.prototype.left = null;
-
-
-/**
- * @type {goog.structs.SplayTree.Node}
- */
-goog.structs.SplayTree.Node.prototype.right = null;
-
-/* InspectorControllerImpl.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview DevTools' implementation of the InspectorController API.
- */
-
-if (!this.devtools)
-    devtools = {};
-
-devtools.InspectorBackendImpl = function()
-{
-    WebInspector.InspectorBackendStub.call(this);
-    this.installInspectorControllerDelegate_("clearMessages");
-    this.installInspectorControllerDelegate_("copyNode");
-    this.installInspectorControllerDelegate_("deleteCookie");
-    this.installInspectorControllerDelegate_("didEvaluateForTestInFrontend");
-    this.installInspectorControllerDelegate_("disableResourceTracking");
-    this.installInspectorControllerDelegate_("disableSearchingForNode");
-    this.installInspectorControllerDelegate_("disableTimeline");
-    this.installInspectorControllerDelegate_("enableResourceTracking");
-    this.installInspectorControllerDelegate_("enableSearchingForNode");
-    this.installInspectorControllerDelegate_("enableTimeline");
-    this.installInspectorControllerDelegate_("getChildNodes");
-    this.installInspectorControllerDelegate_("getCookies");
-    this.installInspectorControllerDelegate_("getDatabaseTableNames");
-    this.installInspectorControllerDelegate_("getDOMStorageEntries");
-    this.installInspectorControllerDelegate_("getEventListenersForNode");
-    this.installInspectorControllerDelegate_("getResourceContent");
-    this.installInspectorControllerDelegate_("highlightDOMNode");
-    this.installInspectorControllerDelegate_("hideDOMNodeHighlight");
-    this.installInspectorControllerDelegate_("releaseWrapperObjectGroup");
-    this.installInspectorControllerDelegate_("reloadPage");
-    this.installInspectorControllerDelegate_("removeAttribute");
-    this.installInspectorControllerDelegate_("removeDOMStorageItem");
-    this.installInspectorControllerDelegate_("removeNode");
-    this.installInspectorControllerDelegate_("saveFrontendSettings");
-    this.installInspectorControllerDelegate_("setAttribute");
-    this.installInspectorControllerDelegate_("setDOMStorageItem");
-    this.installInspectorControllerDelegate_("setInjectedScriptSource");
-    this.installInspectorControllerDelegate_("setTextNodeValue");
-    this.installInspectorControllerDelegate_("startTimelineProfiler");
-    this.installInspectorControllerDelegate_("stopTimelineProfiler");
-    this.installInspectorControllerDelegate_("storeLastActivePanel");
-};
-devtools.InspectorBackendImpl.prototype.__proto__ = WebInspector.InspectorBackendStub.prototype;
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.debuggerEnabled = function()
-{
-    return true;
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.profilerEnabled = function()
-{
-    return true;
-};
-
-
-devtools.InspectorBackendImpl.prototype.setBreakpoint = function(sourceID, line, enabled, condition)
-{
-    this.removeBreakpoint(sourceID, line);
-    if (enabled)
-        devtools.tools.getDebuggerAgent().addBreakpoint(sourceID, line, condition);
-};
-
-
-devtools.InspectorBackendImpl.prototype.removeBreakpoint = function(sourceID, line)
-{
-    devtools.tools.getDebuggerAgent().removeBreakpoint(sourceID, line);
-};
-
-
-devtools.InspectorBackendImpl.prototype.activateBreakpoints = function()
-{
-    devtools.tools.getDebuggerAgent().setBreakpointsActivated(true);
-};
-
-
-devtools.InspectorBackendImpl.prototype.deactivateBreakpoints = function()
-{
-    devtools.tools.getDebuggerAgent().setBreakpointsActivated(false);
-};
-
-
-devtools.InspectorBackendImpl.prototype.pauseInDebugger = function()
-{
-    devtools.tools.getDebuggerAgent().pauseExecution();
-};
-
-
-devtools.InspectorBackendImpl.prototype.resumeDebugger = function()
-{
-    devtools.tools.getDebuggerAgent().resumeExecution();
-};
-
-
-devtools.InspectorBackendImpl.prototype.stepIntoStatementInDebugger = function()
-{
-    devtools.tools.getDebuggerAgent().stepIntoStatement();
-};
-
-
-devtools.InspectorBackendImpl.prototype.stepOutOfFunctionInDebugger = function()
-{
-    devtools.tools.getDebuggerAgent().stepOutOfFunction();
-};
-
-
-devtools.InspectorBackendImpl.prototype.stepOverStatementInDebugger = function()
-{
-    devtools.tools.getDebuggerAgent().stepOverStatement();
-};
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.setPauseOnExceptionsState = function(state)
-{
-    this._setPauseOnExceptionsState = state;
-    // TODO(yurys): support all three states. See http://crbug.com/32877
-    var enabled = (state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions);
-    WebInspector.updatePauseOnExceptionsState(enabled ? WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions : WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions);
-    devtools.tools.getDebuggerAgent().setPauseOnExceptions(enabled);
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.pauseOnExceptions = function()
-{
-    return devtools.tools.getDebuggerAgent().pauseOnExceptions();
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.setPauseOnExceptions = function(value)
-{
-    return devtools.tools.getDebuggerAgent().setPauseOnExceptions(value);
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.startProfiling = function()
-{
-    devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU);
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.stopProfiling = function()
-{
-    devtools.tools.getProfilerAgent().stopProfiling( devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_CPU);
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.getProfileHeaders = function(callId)
-{
-    WebInspector.didGetProfileHeaders(callId, []);
-};
-
-
-/**
- * Emulate WebKit InspectorController behavior. It stores profiles on renderer side,
- * and is able to retrieve them by uid using "getProfile".
- */
-devtools.InspectorBackendImpl.prototype.addFullProfile = function(profile)
-{
-    WebInspector.__fullProfiles = WebInspector.__fullProfiles || {};
-    WebInspector.__fullProfiles[profile.uid] = profile;
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.getProfile = function(callId, uid)
-{
-    if (WebInspector.__fullProfiles && (uid in WebInspector.__fullProfiles))
-        WebInspector.didGetProfile(callId, WebInspector.__fullProfiles[uid]);
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.takeHeapSnapshot = function()
-{
-    devtools.tools.getProfilerAgent().startProfiling(devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT
-        | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_STATS
-        | devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_JS_CONSTRUCTORS);
-};
-
-
-/**
- * @override
- */
-devtools.InspectorBackendImpl.prototype.dispatchOnInjectedScript = function(callId, injectedScriptId, methodName, argsString, async)
-{
-    // Encode injectedScriptId into callId
-    if (typeof injectedScriptId !== "number")
-        injectedScriptId = 0;
-    RemoteToolsAgent.dispatchOnInjectedScript(callId, injectedScriptId, methodName, argsString, async);
-};
-
-
-/**
- * Installs delegating handler into the inspector controller.
- * @param {string} methodName Method to install delegating handler for.
- */
-devtools.InspectorBackendImpl.prototype.installInspectorControllerDelegate_ = function(methodName)
-{
-    this[methodName] = this.callInspectorController_.bind(this, methodName);
-};
-
-
-/**
- * Bound function with the installInjectedScriptDelegate_ actual
- * implementation.
- */
-devtools.InspectorBackendImpl.prototype.callInspectorController_ = function(methodName, var_arg)
-{
-    var args = Array.prototype.slice.call(arguments, 1);
-    RemoteToolsAgent.dispatchOnInspectorController(WebInspector.Callback.wrap(function(){}), methodName, JSON.stringify(args));
-};
-
-
-InspectorBackend = new devtools.InspectorBackendImpl();
-
-/* DebuggerAgent.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview Provides communication interface to remote v8 debugger. See
- * protocol decription at http://code.google.com/p/v8/wiki/DebuggerProtocol
- */
-
-/**
- * FIXME: change field naming style to use trailing underscore.
- * @constructor
- */
-devtools.DebuggerAgent = function()
-{
-    RemoteDebuggerAgent.debuggerOutput = this.handleDebuggerOutput_.bind(this);
-    RemoteDebuggerAgent.setContextId = this.setContextId_.bind(this);
-
-    /**
-     * Id of the inspected page global context. It is used for filtering scripts.
-     * @type {number}
-     */
-    this.contextId_ = null;
-
-    /**
-     * Mapping from script id to script info.
-     * @type {Object}
-     */
-    this.parsedScripts_ = null;
-
-    /**
-     * Mapping from the request id to the devtools.BreakpointInfo for the
-     * breakpoints whose v8 ids are not set yet. These breakpoints are waiting for
-     * "setbreakpoint" responses to learn their ids in the v8 debugger.
-     * @see #handleSetBreakpointResponse_
-     * @type {Object}
-     */
-    this.requestNumberToBreakpointInfo_ = null;
-
-    /**
-     * Information on current stack frames.
-     * @type {Array.<devtools.CallFrame>}
-     */
-    this.callFrames_ = [];
-
-    /**
-     * Whether to stop in the debugger on the exceptions.
-     * @type {boolean}
-     */
-    this.pauseOnExceptions_ = false;
-
-    /**
-     * Mapping: request sequence number->callback.
-     * @type {Object}
-     */
-    this.requestSeqToCallback_ = null;
-
-    /**
-     * Whether the scripts panel has been shown and initialilzed.
-     * @type {boolean}
-     */
-    this.scriptsPanelInitialized_ = false;
-
-    /**
-     * Whether the scripts list should be requested next time when context id is
-     * set.
-     * @type {boolean}
-     */
-    this.requestScriptsWhenContextIdSet_ = false;
-
-    /**
-     * Whether the agent is waiting for initial scripts response.
-     * @type {boolean}
-     */
-    this.waitingForInitialScriptsResponse_ = false;
-
-    /**
-     * If backtrace response is received when initial scripts response
-     * is not yet processed the backtrace handling will be postponed until
-     * after the scripts response processing. The handler bound to its arguments
-     * and this agent will be stored in this field then.
-     * @type {?function()}
-     */
-    this.pendingBacktraceResponseHandler_ = null;
-
-    /**
-     * Container of all breakpoints set using resource URL. These breakpoints
-     * survive page reload. Breakpoints set by script id(for scripts that don't
-     * have URLs) are stored in ScriptInfo objects.
-     * @type {Object}
-     */
-    this.urlToBreakpoints_ = {};
-
-    /**
-     * Exception message that is shown to user while on exception break.
-     * @type {WebInspector.ConsoleMessage}
-     */
-    this.currentExceptionMessage_ = null;
-
-    /**
-     * Whether breakpoints should suspend execution.
-     * @type {boolean}
-     */
-    this.breakpointsActivated_ = true;
-};
-
-
-/**
- * A copy of the scope types from v8/src/mirror-delay.js
- * @enum {number}
- */
-devtools.DebuggerAgent.ScopeType = {
-    Global: 0,
-    Local: 1,
-    With: 2,
-    Closure: 3,
-    Catch: 4
-};
-
-
-/**
- * Resets debugger agent to its initial state.
- */
-devtools.DebuggerAgent.prototype.reset = function()
-{
-    this.contextId_ = null;
-    // No need to request scripts since they all will be pushed in AfterCompile
-    // events.
-    this.requestScriptsWhenContextIdSet_ = false;
-    this.waitingForInitialScriptsResponse_ = false;
-
-    this.parsedScripts_ = {};
-    this.requestNumberToBreakpointInfo_ = {};
-    this.callFrames_ = [];
-    this.requestSeqToCallback_ = {};
-};
-
-
-/**
- * Initializes scripts UI. This method is called every time Scripts panel
- * is shown. It will send request for context id if it's not set yet.
- */
-devtools.DebuggerAgent.prototype.initUI = function()
-{
-    // Initialize scripts cache when Scripts panel is shown first time.
-    if (this.scriptsPanelInitialized_)
-        return;
-    this.scriptsPanelInitialized_ = true;
-    if (this.contextId_) {
-        // We already have context id. This means that we are here from the
-        // very beginning of the page load cycle and hence will get all scripts
-        // via after-compile events. No need to request scripts for this session.
-        //
-        // There can be a number of scripts from after-compile events that are
-        // pending addition into the UI.
-        for (var scriptId in this.parsedScripts_) {
-          var script = this.parsedScripts_[scriptId];
-          WebInspector.parsedScriptSource(scriptId, script.getUrl(), undefined /* script source */, script.getLineOffset() + 1);
-        }
-        return;
-    }
-    this.waitingForInitialScriptsResponse_ = true;
-    // Script list should be requested only when current context id is known.
-    RemoteDebuggerAgent.getContextId();
-    this.requestScriptsWhenContextIdSet_ = true;
-};
-
-
-/**
- * Asynchronously requests the debugger for the script source.
- * @param {number} scriptId Id of the script whose source should be resolved.
- * @param {function(source:?string):void} callback Function that will be called
- *     when the source resolution is completed. "source" parameter will be null
- *     if the resolution fails.
- */
-devtools.DebuggerAgent.prototype.resolveScriptSource = function(scriptId, callback)
-{
-    var script = this.parsedScripts_[scriptId];
-    if (!script || script.isUnresolved()) {
-        callback(null);
-        return;
-    }
-
-    var cmd = new devtools.DebugCommand("scripts", {
-        "ids": [scriptId],
-        "includeSource": true
-    });
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    // Force v8 execution so that it gets to processing the requested command.
-    RemoteDebuggerAgent.processDebugCommands();
-
-    this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
-        if (msg.isSuccess()) {
-            var scriptJson = msg.getBody()[0];
-            if (scriptJson)
-                callback(scriptJson.source);
-            else
-                callback(null);
-        } else
-            callback(null);
-    };
-};
-
-
-/**
- * Tells the v8 debugger to stop on as soon as possible.
- */
-devtools.DebuggerAgent.prototype.pauseExecution = function()
-{
-    RemoteDebuggerCommandExecutor.DebuggerPauseScript();
-};
-
-
-/**
- * @param {number} sourceId Id of the script fot the breakpoint.
- * @param {number} line Number of the line for the breakpoint.
- * @param {?string} condition The breakpoint condition.
- */
-devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line, condition)
-{
-    var script = this.parsedScripts_[sourceId];
-    if (!script)
-        return;
-
-    line = devtools.DebuggerAgent.webkitToV8LineNumber_(line);
-
-    var commandArguments;
-    if (script.getUrl()) {
-        var breakpoints = this.urlToBreakpoints_[script.getUrl()];
-        if (breakpoints && breakpoints[line])
-            return;
-        if (!breakpoints) {
-            breakpoints = {};
-            this.urlToBreakpoints_[script.getUrl()] = breakpoints;
-        }
-
-        var breakpointInfo = new devtools.BreakpointInfo(line);
-        breakpoints[line] = breakpointInfo;
-
-        commandArguments = {
-            "groupId": this.contextId_,
-            "type": "script",
-            "target": script.getUrl(),
-            "line": line,
-            "condition": condition
-        };
-    } else {
-        var breakpointInfo = script.getBreakpointInfo(line);
-        if (breakpointInfo)
-            return;
-
-        breakpointInfo = new devtools.BreakpointInfo(line);
-        script.addBreakpointInfo(breakpointInfo);
-
-        commandArguments = {
-            "groupId": this.contextId_,
-            "type": "scriptId",
-            "target": sourceId,
-            "line": line,
-            "condition": condition
-        };
-    }
-
-    var cmd = new devtools.DebugCommand("setbreakpoint", commandArguments);
-
-    this.requestNumberToBreakpointInfo_[cmd.getSequenceNumber()] = breakpointInfo;
-
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    // Force v8 execution so that it gets to processing the requested command.
-    // It is necessary for being able to change a breakpoint just after it
-    // has been created (since we need an existing breakpoint id for that).
-    RemoteDebuggerAgent.processDebugCommands();
-};
-
-
-/**
- * @param {number} sourceId Id of the script for the breakpoint.
- * @param {number} line Number of the line for the breakpoint.
- */
-devtools.DebuggerAgent.prototype.removeBreakpoint = function(sourceId, line)
-{
-    var script = this.parsedScripts_[sourceId];
-    if (!script)
-        return;
-
-    line = devtools.DebuggerAgent.webkitToV8LineNumber_(line);
-
-    var breakpointInfo;
-    if (script.getUrl()) {
-        var breakpoints = this.urlToBreakpoints_[script.getUrl()];
-        if (!breakpoints)
-            return;
-        breakpointInfo = breakpoints[line];
-        delete breakpoints[line];
-    } else {
-        breakpointInfo = script.getBreakpointInfo(line);
-        if (breakpointInfo)
-            script.removeBreakpointInfo(breakpointInfo);
-    }
-
-    if (!breakpointInfo)
-        return;
-
-    breakpointInfo.markAsRemoved();
-
-    var id = breakpointInfo.getV8Id();
-
-    // If we don't know id of this breakpoint in the v8 debugger we cannot send
-    // "clearbreakpoint" request. In that case it will be removed in
-    // "setbreakpoint" response handler when we learn the id.
-    if (id !== -1) {
-        this.requestClearBreakpoint_(id);
-    }
-};
-
-
-/**
- * @param {boolean} activated Whether breakpoints should be activated.
- */
-devtools.DebuggerAgent.prototype.setBreakpointsActivated = function(activated)
-{
-    this.breakpointsActivated_ = activated;
-};
-
-
-/**
- * Tells the v8 debugger to step into the next statement.
- */
-devtools.DebuggerAgent.prototype.stepIntoStatement = function()
-{
-    this.stepCommand_("in");
-};
-
-
-/**
- * Tells the v8 debugger to step out of current function.
- */
-devtools.DebuggerAgent.prototype.stepOutOfFunction = function()
-{
-    this.stepCommand_("out");
-};
-
-
-/**
- * Tells the v8 debugger to step over the next statement.
- */
-devtools.DebuggerAgent.prototype.stepOverStatement = function()
-{
-    this.stepCommand_("next");
-};
-
-
-/**
- * Tells the v8 debugger to continue execution after it has been stopped on a
- * breakpoint or an exception.
- */
-devtools.DebuggerAgent.prototype.resumeExecution = function()
-{
-    this.clearExceptionMessage_();
-    var cmd = new devtools.DebugCommand("continue");
-    devtools.DebuggerAgent.sendCommand_(cmd);
-};
-
-
-/**
- * Creates exception message and schedules it for addition to the resource upon
- * backtrace availability.
- * @param {string} url Resource url.
- * @param {number} line Resource line number.
- * @param {string} message Exception text.
- */
-devtools.DebuggerAgent.prototype.createExceptionMessage_ = function(url, line, message)
-{
-    this.currentExceptionMessage_ = new WebInspector.ConsoleMessage(
-        WebInspector.ConsoleMessage.MessageSource.JS,
-        WebInspector.ConsoleMessage.MessageType.Log,
-        WebInspector.ConsoleMessage.MessageLevel.Error,
-        line,
-        url,
-        0 /* group level */,
-        1 /* repeat count */,
-        "[Exception] " + message);
-};
-
-
-/**
- * Shows pending exception message that is created with createExceptionMessage_
- * earlier.
- */
-devtools.DebuggerAgent.prototype.showPendingExceptionMessage_ = function()
-{
-    if (!this.currentExceptionMessage_)
-        return;
-    var msg = this.currentExceptionMessage_;
-    var resource = WebInspector.resourceURLMap[msg.url];
-    if (resource) {
-        msg.resource = resource;
-        WebInspector.panels.resources.addMessageToResource(resource, msg);
-    } else
-        this.currentExceptionMessage_ = null;
-};
-
-
-/**
- * Clears exception message from the resource.
- */
-devtools.DebuggerAgent.prototype.clearExceptionMessage_ = function()
-{
-    if (this.currentExceptionMessage_) {
-        var messageElement = this.currentExceptionMessage_._resourceMessageLineElement;
-        var bubble = messageElement.parentElement;
-        bubble.removeChild(messageElement);
-        if (!bubble.firstChild) {
-            // Last message in bubble removed.
-            bubble.parentElement.removeChild(bubble);
-        }
-        this.currentExceptionMessage_ = null;
-    }
-};
-
-
-/**
- * @return {boolean} True iff the debugger will pause execution on the
- * exceptions.
- */
-devtools.DebuggerAgent.prototype.pauseOnExceptions = function()
-{
-    return this.pauseOnExceptions_;
-};
-
-
-/**
- * Tells whether to pause in the debugger on the exceptions or not.
- * @param {boolean} value True iff execution should be stopped in the debugger
- * on the exceptions.
- */
-devtools.DebuggerAgent.prototype.setPauseOnExceptions = function(value)
-{
-    this.pauseOnExceptions_ = value;
-};
-
-
-/**
- * Sends "evaluate" request to the debugger.
- * @param {Object} arguments Request arguments map.
- * @param {function(devtools.DebuggerMessage)} callback Callback to be called
- *     when response is received.
- */
-devtools.DebuggerAgent.prototype.requestEvaluate = function(arguments, callback)
-{
-    var cmd = new devtools.DebugCommand("evaluate", arguments);
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    this.requestSeqToCallback_[cmd.getSequenceNumber()] = callback;
-};
-
-
-/**
- * Sends "lookup" request for each unresolved property of the object. When
- * response is received the properties will be changed with their resolved
- * values.
- * @param {Object} object Object whose properties should be resolved.
- * @param {function(devtools.DebuggerMessage)} Callback to be called when all
- *     children are resolved.
- * @param {boolean} noIntrinsic Whether intrinsic properties should be included.
- */
-devtools.DebuggerAgent.prototype.resolveChildren = function(object, callback, noIntrinsic)
-{
-    if ("handle" in object) {
-        var result = [];
-        devtools.DebuggerAgent.formatObjectProperties_(object, result, noIntrinsic);
-        callback(result);
-    } else {
-        this.requestLookup_([object.ref], function(msg) {
-            var result = [];
-            if (msg.isSuccess()) {
-                var handleToObject = msg.getBody();
-                var resolved = handleToObject[object.ref];
-                devtools.DebuggerAgent.formatObjectProperties_(resolved, result, noIntrinsic);
-                callback(result);
-            } else
-                callback([]);
-        });
-    }
-};
-
-
-/**
- * Sends "scope" request for the scope object to resolve its variables.
- * @param {Object} scope Scope to be resolved.
- * @param {function(Array.<WebInspector.ObjectPropertyProxy>)} callback
- *     Callback to be called when all scope variables are resolved.
- */
-devtools.DebuggerAgent.prototype.resolveScope = function(scope, callback)
-{
-    var cmd = new devtools.DebugCommand("scope", {
-        "frameNumber": scope.frameNumber,
-        "number": scope.index,
-        "compactFormat": true
-    });
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
-        var result = [];
-        if (msg.isSuccess()) {
-            var scopeObjectJson = msg.getBody().object;
-            devtools.DebuggerAgent.formatObjectProperties_(scopeObjectJson, result, true /* no intrinsic */);
-        }
-        callback(result);
-    };
-};
-
-
-/**
- * Sends "scopes" request for the frame object to resolve all variables
- * available in the frame.
- * @param {number} callFrameId Id of call frame whose variables need to
- *     be resolved.
- * @param {function(Object)} callback Callback to be called when all frame
- *     variables are resolved.
- */
-devtools.DebuggerAgent.prototype.resolveFrameVariables_ = function(callFrameId, callback)
-{
-    var result = {};
-
-    var frame = this.callFrames_[callFrameId];
-    if (!frame) {
-        callback(result);
-        return;
-    }
-
-    var waitingResponses = 0;
-    function scopeResponseHandler(msg) {
-        waitingResponses--;
-
-        if (msg.isSuccess()) {
-            var properties = msg.getBody().object.properties;
-            for (var j = 0; j < properties.length; j++)
-                result[properties[j].name] = true;
-        }
-
-        // When all scopes are resolved invoke the callback.
-        if (waitingResponses === 0)
-            callback(result);
-    };
-
-    for (var i = 0; i < frame.scopeChain.length; i++) {
-        var scope = frame.scopeChain[i].objectId;
-        if (scope.type === devtools.DebuggerAgent.ScopeType.Global) {
-            // Do not resolve global scope since it takes for too long.
-            // TODO(yurys): allow to send only property names in the response.
-            continue;
-        }
-        var cmd = new devtools.DebugCommand("scope", {
-            "frameNumber": scope.frameNumber,
-            "number": scope.index,
-            "compactFormat": true
-        });
-        devtools.DebuggerAgent.sendCommand_(cmd);
-        this.requestSeqToCallback_[cmd.getSequenceNumber()] = scopeResponseHandler;
-        waitingResponses++;
-    }
-};
-
-/**
- * Evaluates the expressionString to an object in the call frame and reports
- * all its properties.
- * @param{string} expressionString Expression whose properties should be
- *     collected.
- * @param{number} callFrameId The frame id.
- * @param{function(Object result,bool isException)} reportCompletions Callback
- *     function.
- */
-devtools.DebuggerAgent.prototype.resolveCompletionsOnFrame = function(expressionString, callFrameId, reportCompletions)
-{
-      if (expressionString) {
-          expressionString = "var obj = " + expressionString +
-              "; var names = {}; for (var n in obj) { names[n] = true; };" +
-              "names;";
-          this.evaluateInCallFrame(
-              callFrameId,
-              expressionString,
-              function(result) {
-                  var names = {};
-                  if (!result.isException) {
-                      var props = result.value.objectId.properties;
-                      // Put all object properties into the map.
-                      for (var i = 0; i < props.length; i++)
-                          names[props[i].name] = true;
-                  }
-                  reportCompletions(names, result.isException);
-              });
-      } else {
-          this.resolveFrameVariables_(callFrameId,
-              function(result) {
-                  reportCompletions(result, false /* isException */);
-              });
-      }
-};
-
-
-/**
- * @param{number} scriptId
- * @return {string} Type of the context of the script with specified id.
- */
-devtools.DebuggerAgent.prototype.getScriptContextType = function(scriptId)
-{
-    return this.parsedScripts_[scriptId].getContextType();
-};
-
-
-/**
- * Removes specified breakpoint from the v8 debugger.
- * @param {number} breakpointId Id of the breakpoint in the v8 debugger.
- */
-devtools.DebuggerAgent.prototype.requestClearBreakpoint_ = function(breakpointId)
-{
-    var cmd = new devtools.DebugCommand("clearbreakpoint", {
-        "breakpoint": breakpointId
-    });
-    devtools.DebuggerAgent.sendCommand_(cmd);
-};
-
-
-/**
- * Sends "backtrace" request to v8.
- */
-devtools.DebuggerAgent.prototype.requestBacktrace_ = function()
-{
-    var cmd = new devtools.DebugCommand("backtrace", {
-        "compactFormat":true
-    });
-    devtools.DebuggerAgent.sendCommand_(cmd);
-};
-
-
-/**
- * Sends command to v8 debugger.
- * @param {devtools.DebugCommand} cmd Command to execute.
- */
-devtools.DebuggerAgent.sendCommand_ = function(cmd)
-{
-    RemoteDebuggerCommandExecutor.DebuggerCommand(cmd.toJSONProtocol());
-};
-
-
-/**
- * Tells the v8 debugger to make the next execution step.
- * @param {string} action "in", "out" or "next" action.
- */
-devtools.DebuggerAgent.prototype.stepCommand_ = function(action)
-{
-    this.clearExceptionMessage_();
-    var cmd = new devtools.DebugCommand("continue", {
-        "stepaction": action,
-        "stepcount": 1
-    });
-    devtools.DebuggerAgent.sendCommand_(cmd);
-};
-
-
-/**
- * Sends "lookup" request to v8.
- * @param {number} handle Handle to the object to lookup.
- */
-devtools.DebuggerAgent.prototype.requestLookup_ = function(handles, callback)
-{
-    var cmd = new devtools.DebugCommand("lookup", {
-        "compactFormat":true,
-        "handles": handles
-    });
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    this.requestSeqToCallback_[cmd.getSequenceNumber()] = callback;
-};
-
-
-/**
- * Sets debugger context id for scripts filtering.
- * @param {number} contextId Id of the inspected page global context.
- */
-devtools.DebuggerAgent.prototype.setContextId_ = function(contextId)
-{
-    this.contextId_ = contextId;
-
-    // If it's the first time context id is set request scripts list.
-    if (this.requestScriptsWhenContextIdSet_) {
-        this.requestScriptsWhenContextIdSet_ = false;
-        var cmd = new devtools.DebugCommand("scripts", {
-            "includeSource": false
-        });
-        devtools.DebuggerAgent.sendCommand_(cmd);
-        // Force v8 execution so that it gets to processing the requested command.
-        RemoteDebuggerAgent.processDebugCommands();
-
-        var debuggerAgent = this;
-        this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) {
-            // Handle the response iff the context id hasn't changed since the request
-            // was issued. Otherwise if the context id did change all up-to-date
-            // scripts will be pushed in after compile events and there is no need to
-            // handle the response.
-            if (contextId === debuggerAgent.contextId_)
-                debuggerAgent.handleScriptsResponse_(msg);
-
-            // We received initial scripts response so flush the flag and
-            // see if there is an unhandled backtrace response.
-            debuggerAgent.waitingForInitialScriptsResponse_ = false;
-            if (debuggerAgent.pendingBacktraceResponseHandler_) {
-                debuggerAgent.pendingBacktraceResponseHandler_();
-                debuggerAgent.pendingBacktraceResponseHandler_ = null;
-            }
-        };
-    }
-};
-
-
-/**
- * Handles output sent by v8 debugger. The output is either asynchronous event
- * or response to a previously sent request.  See protocol definitioun for more
- * details on the output format.
- * @param {string} output
- */
-devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output)
-{
-    var msg;
-    try {
-        msg = new devtools.DebuggerMessage(output);
-    } catch(e) {
-        debugPrint("Failed to handle debugger response:\n" + e);
-        throw e;
-    }
-
-    if (msg.getType() === "event") {
-        if (msg.getEvent() === "break")
-            this.handleBreakEvent_(msg);
-        else if (msg.getEvent() === "exception")
-            this.handleExceptionEvent_(msg);
-        else if (msg.getEvent() === "afterCompile")
-            this.handleAfterCompileEvent_(msg);
-    } else if (msg.getType() === "response") {
-        if (msg.getCommand() === "scripts")
-            this.invokeCallbackForResponse_(msg);
-        else if (msg.getCommand() === "setbreakpoint")
-            this.handleSetBreakpointResponse_(msg);
-        else if (msg.getCommand() === "clearbreakpoint")
-            this.handleClearBreakpointResponse_(msg);
-        else if (msg.getCommand() === "backtrace")
-            this.handleBacktraceResponse_(msg);
-        else if (msg.getCommand() === "lookup")
-            this.invokeCallbackForResponse_(msg);
-        else if (msg.getCommand() === "evaluate")
-            this.invokeCallbackForResponse_(msg);
-        else if (msg.getCommand() === "scope")
-            this.invokeCallbackForResponse_(msg);
-    }
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleBreakEvent_ = function(msg)
-{
-    if (!this.breakpointsActivated_) {
-        this.resumeExecution();
-        return;
-    }
-
-    // Force scripts panel to be shown first.
-    WebInspector.currentPanel = WebInspector.panels.scripts;
-
-    var body = msg.getBody();
-
-    var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine);
-    this.requestBacktrace_();
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg)
-{
-    // Force scripts panel to be shown first.
-    WebInspector.currentPanel = WebInspector.panels.scripts;
-
-    var body = msg.getBody();
-    // No script field in the body means that v8 failed to parse the script. We
-    // resume execution on parser errors automatically.
-    if (this.pauseOnExceptions_ && body.script) {
-        var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine);
-        this.createExceptionMessage_(body.script.name, line, body.exception.text);
-        this.requestBacktrace_();
-    } else
-        this.resumeExecution();
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg)
-{
-    var scripts = msg.getBody();
-    for (var i = 0; i < scripts.length; i++) {
-        var script = scripts[i];
-
-        // Skip scripts from other tabs.
-        if (!this.isScriptFromInspectedContext_(script, msg))
-            continue;
-
-        // We may already have received the info in an afterCompile event.
-        if (script.id in this.parsedScripts_)
-            continue;
-        this.addScriptInfo_(script, msg);
-    }
-};
-
-
-/**
- * @param {Object} script Json object representing script.
- * @param {devtools.DebuggerMessage} msg Debugger response.
- */
-devtools.DebuggerAgent.prototype.isScriptFromInspectedContext_ = function(script, msg)
-{
-    if (!script.context) {
-        // Always ignore scripts from the utility context.
-        return false;
-    }
-    var context = msg.lookup(script.context.ref);
-    var scriptContextId = context.data;
-    if (typeof scriptContextId === "undefined")
-        return false; // Always ignore scripts from the utility context.
-    if (this.contextId_ === null)
-        return true;
-    // Find the id from context data. The context data has the format "type,id".
-    var comma = context.data.indexOf(",");
-    if (comma < 0)
-        return false;
-    return (context.data.substring(comma + 1) == this.contextId_);
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg)
-{
-    var requestSeq = msg.getRequestSeq();
-    var breakpointInfo = this.requestNumberToBreakpointInfo_[requestSeq];
-    if (!breakpointInfo) {
-        // TODO(yurys): handle this case
-        return;
-    }
-    delete this.requestNumberToBreakpointInfo_[requestSeq];
-    if (!msg.isSuccess()) {
-        // TODO(yurys): handle this case
-        return;
-    }
-    var idInV8 = msg.getBody().breakpoint;
-    breakpointInfo.setV8Id(idInV8);
-
-    if (breakpointInfo.isRemoved())
-        this.requestClearBreakpoint_(idInV8);
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg)
-{
-    if (!this.contextId_) {
-        // Ignore scripts delta if main request has not been issued yet.
-        return;
-    }
-    var script = msg.getBody().script;
-
-    // Ignore scripts from other tabs.
-    if (!this.isScriptFromInspectedContext_(script, msg))
-        return;
-    this.addScriptInfo_(script, msg);
-};
-
-
-/**
- * Adds the script info to the local cache. This method assumes that the script
- * is not in the cache yet.
- * @param {Object} script Script json object from the debugger message.
- * @param {devtools.DebuggerMessage} msg Debugger message containing the script
- *     data.
- */
-devtools.DebuggerAgent.prototype.addScriptInfo_ = function(script, msg)
-{
-    var context = msg.lookup(script.context.ref);
-    var contextType;
-    // Find the type from context data. The context data has the format
-    // "type,id".
-    var comma = context.data.indexOf(",");
-    if (comma < 0)
-        return
-    contextType = context.data.substring(0, comma);
-    this.parsedScripts_[script.id] = new devtools.ScriptInfo(script.id, script.name, script.lineOffset, contextType);
-    if (this.scriptsPanelInitialized_) {
-        // Only report script as parsed after scripts panel has been shown.
-        WebInspector.parsedScriptSource(script.id, script.name, script.source, script.lineOffset + 1);
-    }
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleClearBreakpointResponse_ = function(msg)
-{
-    // Do nothing.
-};
-
-
-/**
- * Handles response to "backtrace" command.
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.handleBacktraceResponse_ = function(msg)
-{
-    if (this.waitingForInitialScriptsResponse_)
-        this.pendingBacktraceResponseHandler_ = this.doHandleBacktraceResponse_.bind(this, msg);
-    else
-        this.doHandleBacktraceResponse_(msg);
-};
-
-
-/**
- * @param {devtools.DebuggerMessage} msg
- */
-devtools.DebuggerAgent.prototype.doHandleBacktraceResponse_ = function(msg)
-{
-    var frames = msg.getBody().frames;
-    this.callFrames_ = [];
-    for (var i = 0; i <  frames.length; ++i)
-        this.callFrames_.push(this.formatCallFrame_(frames[i]));
-    WebInspector.pausedScript(this.callFrames_);
-    this.showPendingExceptionMessage_();
-    InspectorFrontendHost.activateWindow();
-};
-
-
-/**
- * Evaluates code on given callframe.
- */
-devtools.DebuggerAgent.prototype.evaluateInCallFrame = function(callFrameId, code, callback)
-{
-    var callFrame = this.callFrames_[callFrameId];
-    callFrame.evaluate_(code, callback);
-};
-
-
-/**
- * Handles response to a command by invoking its callback (if any).
- * @param {devtools.DebuggerMessage} msg
- * @return {boolean} Whether a callback for the given message was found and
- *     excuted.
- */
-devtools.DebuggerAgent.prototype.invokeCallbackForResponse_ = function(msg)
-{
-    var callback = this.requestSeqToCallback_[msg.getRequestSeq()];
-    if (!callback) {
-        // It may happend if reset was called.
-        return false;
-    }
-    delete this.requestSeqToCallback_[msg.getRequestSeq()];
-    callback(msg);
-    return true;
-};
-
-
-/**
- * @param {Object} stackFrame Frame json object from "backtrace" response.
- * @return {!devtools.CallFrame} Object containing information related to the
- *     call frame in the format expected by ScriptsPanel and its panes.
- */
-devtools.DebuggerAgent.prototype.formatCallFrame_ = function(stackFrame)
-{
-    var func = stackFrame.func;
-    var sourceId = func.scriptId;
-
-    // Add service script if it does not exist.
-    var existingScript = this.parsedScripts_[sourceId];
-    if (!existingScript) {
-        this.parsedScripts_[sourceId] = new devtools.ScriptInfo(sourceId, null /* name */, 0 /* line */, "unknown" /* type */, true /* unresolved */);
-        WebInspector.parsedScriptSource(sourceId, null, null, 0);
-    }
-
-    var funcName = func.name || func.inferredName || "(anonymous function)";
-    var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(stackFrame.line);
-
-    // Add basic scope chain info with scope variables.
-    var scopeChain = [];
-    var ScopeType = devtools.DebuggerAgent.ScopeType;
-    for (var i = 0; i < stackFrame.scopes.length; i++) {
-        var scope = stackFrame.scopes[i];
-        scope.frameNumber = stackFrame.index;
-        var scopeObjectProxy = new WebInspector.ObjectProxy(0, scope, [], "", true);
-        scopeObjectProxy.isScope = true;
-        switch(scope.type) {
-            case ScopeType.Global:
-                scopeObjectProxy.isDocument = true;
-                break;
-            case ScopeType.Local:
-                scopeObjectProxy.isLocal = true;
-                scopeObjectProxy.thisObject = devtools.DebuggerAgent.formatObjectProxy_(stackFrame.receiver);
-                break;
-            case ScopeType.With:
-            // Catch scope is treated as a regular with scope by WebKit so we
-            // also treat it this way.
-            case ScopeType.Catch:
-                scopeObjectProxy.isWithBlock = true;
-                break;
-            case ScopeType.Closure:
-                scopeObjectProxy.isClosure = true;
-                break;
-        }
-        scopeChain.push(scopeObjectProxy);
-    }
-    return new devtools.CallFrame(stackFrame.index, "function", funcName, sourceId, line, scopeChain);
-};
-
-
-/**
- * Collects properties for an object from the debugger response.
- * @param {Object} object An object from the debugger protocol response.
- * @param {Array.<WebInspector.ObjectPropertyProxy>} result An array to put the
- *     properties into.
- * @param {boolean} noIntrinsic Whether intrinsic properties should be
- *     included.
- */
-devtools.DebuggerAgent.formatObjectProperties_ = function(object, result, noIntrinsic)
-{
-    devtools.DebuggerAgent.propertiesToProxies_(object.properties, result);
-    if (noIntrinsic)
-        return;
-
-    result.push(new WebInspector.ObjectPropertyProxy("__proto__", devtools.DebuggerAgent.formatObjectProxy_(object.protoObject)));
-    result.push(new WebInspector.ObjectPropertyProxy("constructor", devtools.DebuggerAgent.formatObjectProxy_(object.constructorFunction)));
-    // Don't add 'prototype' property since it is one of the regualar properties.
-};
-
-
-/**
- * For each property in "properties" creates its proxy representative.
- * @param {Array.<Object>} properties Receiver properties or locals array from
- *     "backtrace" response.
- * @param {Array.<WebInspector.ObjectPropertyProxy>} Results holder.
- */
-devtools.DebuggerAgent.propertiesToProxies_ = function(properties, result)
-{
-    var map = {};
-    for (var i = 0; i < properties.length; ++i) {
-        var property = properties[i];
-        var name = String(property.name);
-        if (name in map)
-            continue;
-        map[name] = true;
-        var value = devtools.DebuggerAgent.formatObjectProxy_(property.value);
-        var propertyProxy = new WebInspector.ObjectPropertyProxy(name, value);
-        result.push(propertyProxy);
-    }
-};
-
-
-/**
- * @param {Object} v An object reference from the debugger response.
- * @return {*} The value representation expected by ScriptsPanel.
- */
-devtools.DebuggerAgent.formatObjectProxy_ = function(v)
-{
-    var description;
-    var hasChildren = false;
-    if (v.type === "object") {
-        description = v.className;
-        hasChildren = true;
-    } else if (v.type === "function") {
-        if (v.source)
-            description = v.source;
-        else
-            description = "function " + v.name + "()";
-        hasChildren = true;
-    } else if (v.type === "undefined")
-        description = "undefined";
-    else if (v.type === "null")
-        description = "null";
-    else if (typeof v.value !== "undefined") {
-        // Check for undefined and null types before checking the value, otherwise
-        // null/undefined may have blank value.
-        description = v.value;
-    } else
-        description = "<unresolved ref: " + v.ref + ", type: " + v.type + ">";
-
-    var proxy = new WebInspector.ObjectProxy(0, v, [], description, hasChildren);
-    proxy.type = v.type;
-    proxy.isV8Ref = true;
-    return proxy;
-};
-
-
-/**
- * Converts line number from Web Inspector UI(1-based) to v8(0-based).
- * @param {number} line Resource line number in Web Inspector UI.
- * @return {number} The line number in v8.
- */
-devtools.DebuggerAgent.webkitToV8LineNumber_ = function(line)
-{
-    return line - 1;
-};
-
-
-/**
- * Converts line number from v8(0-based) to Web Inspector UI(1-based).
- * @param {number} line Resource line number in v8.
- * @return {number} The line number in Web Inspector.
- */
-devtools.DebuggerAgent.v8ToWwebkitLineNumber_ = function(line)
-{
-    return line + 1;
-};
-
-
-/**
- * @param {number} scriptId Id of the script.
- * @param {?string} url Script resource URL if any.
- * @param {number} lineOffset First line 0-based offset in the containing
- *     document.
- * @param {string} contextType Type of the script's context:
- *     "page" - regular script from html page
- *     "injected" - extension content script
- * @param {bool} opt_isUnresolved If true, script will not be resolved.
- * @constructor
- */
-devtools.ScriptInfo = function(scriptId, url, lineOffset, contextType, opt_isUnresolved)
-{
-    this.scriptId_ = scriptId;
-    this.lineOffset_ = lineOffset;
-    this.contextType_ = contextType;
-    this.url_ = url;
-    this.isUnresolved_ = opt_isUnresolved;
-
-    this.lineToBreakpointInfo_ = {};
-};
-
-
-/**
- * @return {number}
- */
-devtools.ScriptInfo.prototype.getLineOffset = function()
-{
-    return this.lineOffset_;
-};
-
-
-/**
- * @return {string}
- */
-devtools.ScriptInfo.prototype.getContextType = function()
-{
-    return this.contextType_;
-};
-
-
-/**
- * @return {?string}
- */
-devtools.ScriptInfo.prototype.getUrl = function()
-{
-    return this.url_;
-};
-
-
-/**
- * @return {?bool}
- */
-devtools.ScriptInfo.prototype.isUnresolved = function()
-{
-    return this.isUnresolved_;
-};
-
-
-/**
- * @param {number} line 0-based line number in the script.
- * @return {?devtools.BreakpointInfo} Information on a breakpoint at the
- *     specified line in the script or undefined if there is no breakpoint at
- *     that line.
- */
-devtools.ScriptInfo.prototype.getBreakpointInfo = function(line)
-{
-    return this.lineToBreakpointInfo_[line];
-};
-
-
-/**
- * Adds breakpoint info to the script.
- * @param {devtools.BreakpointInfo} breakpoint
- */
-devtools.ScriptInfo.prototype.addBreakpointInfo = function(breakpoint)
-{
-    this.lineToBreakpointInfo_[breakpoint.getLine()] = breakpoint;
-};
-
-
-/**
- * @param {devtools.BreakpointInfo} breakpoint Breakpoint info to be removed.
- */
-devtools.ScriptInfo.prototype.removeBreakpointInfo = function(breakpoint)
-{
-    var line = breakpoint.getLine();
-    delete this.lineToBreakpointInfo_[line];
-};
-
-
-
-/**
- * @param {number} line Breakpoint 0-based line number in the containing script.
- * @constructor
- */
-devtools.BreakpointInfo = function(line)
-{
-    this.line_ = line;
-    this.v8id_ = -1;
-    this.removed_ = false;
-};
-
-
-/**
- * @return {number}
- */
-devtools.BreakpointInfo.prototype.getLine = function(n)
-{
-    return this.line_;
-};
-
-
-/**
- * @return {number} Unique identifier of this breakpoint in the v8 debugger.
- */
-devtools.BreakpointInfo.prototype.getV8Id = function(n)
-{
-    return this.v8id_;
-};
-
-
-/**
- * Sets id of this breakpoint in the v8 debugger.
- * @param {number} id
- */
-devtools.BreakpointInfo.prototype.setV8Id = function(id)
-{
-    this.v8id_ = id;
-};
-
-
-/**
- * Marks this breakpoint as removed from the  front-end.
- */
-devtools.BreakpointInfo.prototype.markAsRemoved = function()
-{
-    this.removed_ = true;
-};
-
-
-/**
- * @return {boolean} Whether this breakpoint has been removed from the
- *     front-end.
- */
-devtools.BreakpointInfo.prototype.isRemoved = function()
-{
-    return this.removed_;
-};
-
-
-/**
- * Call stack frame data.
- * @param {string} id CallFrame id.
- * @param {string} type CallFrame type.
- * @param {string} functionName CallFrame type.
- * @param {string} sourceID Source id.
- * @param {number} line Source line.
- * @param {Array.<Object>} scopeChain Array of scoped objects.
- * @construnctor
- */
-devtools.CallFrame = function(id, type, functionName, sourceID, line, scopeChain)
-{
-    this.id = id;
-    this.type = type;
-    this.functionName = functionName;
-    this.sourceID = sourceID;
-    this.line = line;
-    this.scopeChain = scopeChain;
-};
-
-
-/**
- * This method issues asynchronous evaluate request, reports result to the
- * callback.
- * @param {string} expression An expression to be evaluated in the context of
- *     this call frame.
- * @param {function(Object):undefined} callback Callback to report result to.
- */
-devtools.CallFrame.prototype.evaluate_ = function(expression, callback)
-{
-    devtools.tools.getDebuggerAgent().requestEvaluate({
-            "expression": expression,
-            "frame": this.id,
-            "global": false,
-            "disable_break": false,
-            "compactFormat": true,
-            "maxStringLength": -1
-        },
-        function(response) {
-            var result = {};
-            if (response.isSuccess())
-                result.value = devtools.DebuggerAgent.formatObjectProxy_(response.getBody());
-            else {
-                result.value = response.getMessage();
-                result.isException = true;
-            }
-            callback(result);
-        });
-};
-
-
-/**
- * JSON based commands sent to v8 debugger.
- * @param {string} command Name of the command to execute.
- * @param {Object} opt_arguments Command-specific arguments map.
- * @constructor
- */
-devtools.DebugCommand = function(command, opt_arguments)
-{
-    this.command_ = command;
-    this.type_ = "request";
-    this.seq_ = ++devtools.DebugCommand.nextSeq_;
-    if (opt_arguments)
-        this.arguments_ = opt_arguments;
-};
-
-
-/**
- * Next unique number to be used as debugger request sequence number.
- * @type {number}
- */
-devtools.DebugCommand.nextSeq_ = 1;
-
-
-/**
- * @return {number}
- */
-devtools.DebugCommand.prototype.getSequenceNumber = function()
-{
-    return this.seq_;
-};
-
-
-/**
- * @return {string}
- */
-devtools.DebugCommand.prototype.toJSONProtocol = function()
-{
-    var json = {
-        "seq": this.seq_,
-        "type": this.type_,
-        "command": this.command_
-    }
-    if (this.arguments_)
-        json.arguments = this.arguments_;
-    return JSON.stringify(json);
-};
-
-
-/**
- * JSON messages sent from v8 debugger. See protocol definition for more
- * details: http://code.google.com/p/v8/wiki/DebuggerProtocol
- * @param {string} msg Raw protocol packet as JSON string.
- * @constructor
- */
-devtools.DebuggerMessage = function(msg)
-{
-    this.packet_ = JSON.parse(msg);
-    this.refs_ = [];
-    if (this.packet_.refs) {
-        for (var i = 0; i < this.packet_.refs.length; i++)
-            this.refs_[this.packet_.refs[i].handle] = this.packet_.refs[i];
-    }
-};
-
-
-/**
- * @return {string} The packet type.
- */
-devtools.DebuggerMessage.prototype.getType = function()
-{
-    return this.packet_.type;
-};
-
-
-/**
- * @return {?string} The packet event if the message is an event.
- */
-devtools.DebuggerMessage.prototype.getEvent = function()
-{
-    return this.packet_.event;
-};
-
-
-/**
- * @return {?string} The packet command if the message is a response to a
- *     command.
- */
-devtools.DebuggerMessage.prototype.getCommand = function()
-{
-    return this.packet_.command;
-};
-
-
-/**
- * @return {number} The packet request sequence.
- */
-devtools.DebuggerMessage.prototype.getRequestSeq = function()
-{
-    return this.packet_.request_seq;
-};
-
-
-/**
- * @return {number} Whether the v8 is running after processing the request.
- */
-devtools.DebuggerMessage.prototype.isRunning = function()
-{
-    return this.packet_.running ? true : false;
-};
-
-
-/**
- * @return {boolean} Whether the request succeeded.
- */
-devtools.DebuggerMessage.prototype.isSuccess = function()
-{
-    return this.packet_.success ? true : false;
-};
-
-
-/**
- * @return {string}
- */
-devtools.DebuggerMessage.prototype.getMessage = function()
-{
-    return this.packet_.message;
-};
-
-
-/**
- * @return {Object} Parsed message body json.
- */
-devtools.DebuggerMessage.prototype.getBody = function()
-{
-    return this.packet_.body;
-};
-
-
-/**
- * @param {number} handle Object handle.
- * @return {?Object} Returns the object with the handle if it was sent in this
- *    message(some objects referenced by handles may be missing in the message).
- */
-devtools.DebuggerMessage.prototype.lookup = function(handle)
-{
-    return this.refs_[handle];
-};
-
-/* ProfilerAgent.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview Provides communication interface to remote v8 profiler.
- */
-
-/**
- * @constructor
- */
-devtools.ProfilerAgent = function()
-{
-    RemoteProfilerAgent.didGetActiveProfilerModules = this._didGetActiveProfilerModules.bind(this);
-    RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this);
-
-    /**
-     * Active profiler modules flags.
-     * @type {number}
-     */
-    this._activeProfilerModules = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE;
-
-    /**
-     * Interval for polling profiler state.
-     * @type {number}
-     */
-    this._getActiveProfilerModulesInterval = null;
-
-    /**
-     * Profiler log position.
-     * @type {number}
-     */
-    this._logPosition = 0;
-
-    /**
-     * Last requested log position.
-     * @type {number}
-     */
-    this._lastRequestedLogPosition = -1;
-
-    /**
-     * Whether log contents retrieval must be forced next time.
-     * @type {boolean}
-     */
-    this._forceGetLogLines = false;
-
-    /**
-     * Profiler processor instance.
-     * @type {devtools.profiler.Processor}
-     */
-    this._profilerProcessor = new devtools.profiler.Processor();
-};
-
-
-/**
- * A copy of enum from include/v8.h
- * @enum {number}
- */
-devtools.ProfilerAgent.ProfilerModules = {
-    PROFILER_MODULE_NONE: 0,
-    PROFILER_MODULE_CPU: 1,
-    PROFILER_MODULE_HEAP_STATS: 1 << 1,
-    PROFILER_MODULE_JS_CONSTRUCTORS: 1 << 2,
-    PROFILER_MODULE_HEAP_SNAPSHOT: 1 << 16
-};
-
-
-/**
- * Sets up callbacks that deal with profiles processing.
- */
-devtools.ProfilerAgent.prototype.setupProfilerProcessorCallbacks = function()
-{
-    // A temporary icon indicating that the profile is being processed.
-    var processingIcon = new WebInspector.SidebarTreeElement(
-        "profile-sidebar-tree-item",
-        WebInspector.UIString("Processing..."),
-        '', null, false);
-    var profilesSidebar = WebInspector.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).treeElement;
-
-    this._profilerProcessor.setCallbacks(
-        function onProfileProcessingStarted() {
-            // Set visually empty string. Subtitle hiding is done via styles
-            // manipulation which doesn't play well with dynamic append / removal.
-            processingIcon.subtitle = " ";
-            profilesSidebar.appendChild(processingIcon);
-        },
-        function onProfileProcessingStatus(ticksCount) {
-            processingIcon.subtitle = WebInspector.UIString("%d ticks processed", ticksCount);
-        },
-        function onProfileProcessingFinished(profile) {
-            profilesSidebar.removeChild(processingIcon);
-            profile.typeId = WebInspector.CPUProfileType.TypeId;
-            InspectorBackend.addFullProfile(profile);
-            WebInspector.addProfileHeader(profile);
-            // If no profile is currently shown, show the new one.
-            var profilesPanel = WebInspector.panels.profiles;
-            if (!profilesPanel.visibleView) {
-                profilesPanel.showProfile(profile);
-            }
-        }
-    );
-};
-
-
-/**
- * Initializes profiling state.
- */
-devtools.ProfilerAgent.prototype.initializeProfiling = function()
-{
-    this.setupProfilerProcessorCallbacks();
-    this._forceGetLogLines = true;
-    this._getActiveProfilerModulesInterval = setInterval(function() { RemoteProfilerAgent.getActiveProfilerModules(); }, 1000);
-};
-
-
-/**
- * Requests the next chunk of log lines.
- * @param {boolean} immediately Do not postpone the request.
- * @private
- */
-devtools.ProfilerAgent.prototype._getNextLogLines = function(immediately)
-{
-    if (this._lastRequestedLogPosition == this._logPosition)
-        return;
-    var pos = this._lastRequestedLogPosition = this._logPosition;
-    if (immediately)
-        RemoteProfilerAgent.getLogLines(pos);
-    else
-        setTimeout(function() { RemoteProfilerAgent.getLogLines(pos); }, 500);
-};
-
-
-/**
- * Starts profiling.
- * @param {number} modules List of modules to enable.
- */
-devtools.ProfilerAgent.prototype.startProfiling = function(modules)
-{
-    var cmd = new devtools.DebugCommand("profile", {
-        "modules": modules,
-        "command": "resume"});
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    RemoteDebuggerAgent.processDebugCommands();
-    if (modules & devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
-        // Active modules will not change, instead, a snapshot will be logged.
-        this._getNextLogLines();
-    }
-};
-
-
-/**
- * Stops profiling.
- */
-devtools.ProfilerAgent.prototype.stopProfiling = function(modules)
-{
-    var cmd = new devtools.DebugCommand("profile", {
-        "modules": modules,
-        "command": "pause"});
-    devtools.DebuggerAgent.sendCommand_(cmd);
-    RemoteDebuggerAgent.processDebugCommands();
-};
-
-
-/**
- * Handles current profiler status.
- * @param {number} modules List of active (started) modules.
- */
-devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules)
-{
-    var profModules = devtools.ProfilerAgent.ProfilerModules;
-    var profModuleNone = profModules.PROFILER_MODULE_NONE;
-    if (this._forceGetLogLines || (modules !== profModuleNone && this._activeProfilerModules === profModuleNone)) {
-        this._forceGetLogLines = false;
-        // Start to query log data.
-        this._getNextLogLines(true);
-    }
-    this._activeProfilerModules = modules;
-    // Update buttons.
-    WebInspector.setRecordingProfile(modules & profModules.PROFILER_MODULE_CPU);
-};
-
-
-/**
- * Handles a portion of a profiler log retrieved by getLogLines call.
- * @param {number} pos Current position in log.
- * @param {string} log A portion of profiler log.
- */
-devtools.ProfilerAgent.prototype._didGetLogLines = function(pos, log)
-{
-    this._logPosition = pos;
-    if (log.length > 0)
-        this._profilerProcessor.processLogChunk(log);
-    else {
-        // Allow re-reading from the last position.
-        this._lastRequestedLogPosition = this._logPosition - 1;
-        if (this._activeProfilerModules === devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE)
-            // No new data and profiling is stopped---suspend log reading.
-            return;
-    }
-    this._getNextLogLines();
-};
-
-/* ProfilerProcessor.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview Profiler processor is used to process log file produced
- * by V8 and produce an internal profile representation which is used
- * for building profile views in "Profiles" tab.
- */
-
-
-/**
- * Creates a Profile View builder object compatible with WebKit Profiler UI.
- *
- * @param {number} samplingRate Number of ms between profiler ticks.
- * @constructor
- */
-devtools.profiler.WebKitViewBuilder = function(samplingRate)
-{
-    devtools.profiler.ViewBuilder.call(this, samplingRate);
-};
-devtools.profiler.WebKitViewBuilder.prototype.__proto__ = devtools.profiler.ViewBuilder.prototype;
-
-
-/**
- * @override
- */
-devtools.profiler.WebKitViewBuilder.prototype.createViewNode = function(funcName, totalTime, selfTime, head)
-{
-    return new devtools.profiler.WebKitViewNode(funcName, totalTime, selfTime, head);
-};
-
-
-/**
- * Constructs a Profile View node object for displaying in WebKit Profiler UI.
- *
- * @param {string} internalFuncName A fully qualified function name.
- * @param {number} totalTime Amount of time that application spent in the
- *     corresponding function and its descendants (not that depending on
- *     profile they can be either callees or callers.)
- * @param {number} selfTime Amount of time that application spent in the
- *     corresponding function only.
- * @param {devtools.profiler.ProfileView.Node} head Profile view head.
- * @constructor
- */
-devtools.profiler.WebKitViewNode = function(internalFuncName, totalTime, selfTime, head)
-{
-    devtools.profiler.ProfileView.Node.call(this, internalFuncName, totalTime, selfTime, head);
-    this.initFuncInfo_();
-    this.callUID = internalFuncName;
-};
-devtools.profiler.WebKitViewNode.prototype.__proto__ = devtools.profiler.ProfileView.Node.prototype;
-
-
-/**
- * RegEx for stripping V8's prefixes of compiled functions.
- */
-devtools.profiler.WebKitViewNode.FUNC_NAME_STRIP_RE = /^(?:LazyCompile|Function|Callback): (.*)$/;
-
-
-/**
- * RegEx for extracting script source URL and line number.
- */
-devtools.profiler.WebKitViewNode.FUNC_NAME_PARSE_RE = /^((?:get | set )?[^ ]+) (.*):(\d+)( \{\d+\})?$/;
-
-
-/**
- * Inits "functionName", "url", and "lineNumber" fields using "internalFuncName"
- * field.
- * @private
- */
-devtools.profiler.WebKitViewNode.prototype.initFuncInfo_ = function()
-{
-    var nodeAlias = devtools.profiler.WebKitViewNode;
-    this.functionName = this.internalFuncName;
-
-    var strippedName = nodeAlias.FUNC_NAME_STRIP_RE.exec(this.functionName);
-    if (strippedName)
-        this.functionName = strippedName[1];
-
-    var parsedName = nodeAlias.FUNC_NAME_PARSE_RE.exec(this.functionName);
-    if (parsedName) {
-        this.functionName = parsedName[1];
-        if (parsedName[4])
-            this.functionName += parsedName[4];
-        this.url = parsedName[2];
-        this.lineNumber = parsedName[3];
-    } else {
-        this.url = '';
-        this.lineNumber = 0;
-    }
-};
-
-
-/**
- * Ancestor of a profile object that leaves out only JS-related functions.
- * @constructor
- */
-devtools.profiler.JsProfile = function()
-{
-    devtools.profiler.Profile.call(this);
-};
-devtools.profiler.JsProfile.prototype.__proto__ = devtools.profiler.Profile.prototype;
-
-
-/**
- * RegExp that leaves only non-native JS functions.
- * @type {RegExp}
- */
-devtools.profiler.JsProfile.JS_NON_NATIVE_RE = new RegExp(
-      "^" +
-        "(?:Callback:)|" +
-        "(?:Script: (?!native))|" +
-        "(?:(?:LazyCompile|Function): [^ ]*(?: (?!native )[^ ]+:\\d+)?$)");
-
-
-/**
- * @override
- */
-devtools.profiler.JsProfile.prototype.skipThisFunction = function(name)
-{
-    return !devtools.profiler.JsProfile.JS_NON_NATIVE_RE.test(name);
-};
-
-
-/**
- * Profiler processor. Consumes profiler log and builds profile views.
- * FIXME: change field naming style to use trailing underscore.
- *
- * @param {function(devtools.profiler.ProfileView)} newProfileCallback Callback
- *     that receives a new processed profile.
- * @constructor
- */
-devtools.profiler.Processor = function()
-{
-    var dispatches = {
-        "code-creation": {
-            parsers: [null, this.createAddressParser("code"), parseInt, null],
-            processor: this.processCodeCreation_, backrefs: true,
-            needsProfile: true },
-        "code-move": { parsers: [this.createAddressParser("code"),
-            this.createAddressParser("code-move-to")],
-            processor: this.processCodeMove_, backrefs: true,
-            needsProfile: true },
-        "code-delete": { parsers: [this.createAddressParser("code")],
-            processor: this.processCodeDelete_, backrefs: true,
-            needsProfile: true },
-        "function-creation": { parsers: [this.createAddressParser("code"),
-            this.createAddressParser("function-obj")],
-            processor: this.processFunctionCreation_, backrefs: true },
-        "function-move": { parsers: [this.createAddressParser("code"),
-            this.createAddressParser("code-move-to")],
-            processor: this.processFunctionMove_, backrefs: true },
-        "function-delete": { parsers: [this.createAddressParser("code")],
-            processor: this.processFunctionDelete_, backrefs: true },
-        "tick": { parsers: [this.createAddressParser("code"),
-            this.createAddressParser("stack"), parseInt, "var-args"],
-            processor: this.processTick_, backrefs: true, needProfile: true },
-        "profiler": { parsers: [null, "var-args"],
-            processor: this.processProfiler_, needsProfile: false },
-        "heap-sample-begin": { parsers: [null, null, parseInt],
-            processor: this.processHeapSampleBegin_ },
-        "heap-sample-stats": { parsers: [null, null, parseInt, parseInt],
-            processor: this.processHeapSampleStats_ },
-        "heap-sample-item": { parsers: [null, parseInt, parseInt],
-            processor: this.processHeapSampleItem_ },
-        "heap-js-cons-item": { parsers: [null, parseInt, parseInt],
-            processor: this.processHeapJsConsItem_ },
-        "heap-js-ret-item": { parsers: [null, "var-args"],
-            processor: this.processHeapJsRetItem_ },
-        "heap-sample-end": { parsers: [null, null],
-            processor: this.processHeapSampleEnd_ },
-        // Not used in DevTools Profiler.
-        "shared-library": null,
-        // Obsolete row types.
-        "code-allocate": null,
-        "begin-code-region": null,
-        "end-code-region": null};
-
-    if (devtools.profiler.Profile.VERSION === 2) {
-        dispatches["tick"] =  { parsers: [this.createAddressParser("code"),
-            this.createAddressParser("stack"),
-            this.createAddressParser("func"), parseInt, "var-args"],
-            processor: this.processTickV2_, backrefs: true };
-    }
-
-    devtools.profiler.LogReader.call(this, dispatches);
-
-    /**
-     * Callback that is called when a new profile is encountered in the log.
-     * @type {function()}
-     */
-    this.startedProfileProcessing_ = null;
-
-    /**
-     * Callback that is called periodically to display processing status.
-     * @type {function()}
-     */
-    this.profileProcessingStatus_ = null;
-
-    /**
-     * Callback that is called when a profile has been processed and is ready
-     * to be shown.
-     * @type {function(devtools.profiler.ProfileView)}
-     */
-    this.finishedProfileProcessing_ = null;
-
-    /**
-     * The current profile.
-     * @type {devtools.profiler.JsProfile}
-     */
-    this.currentProfile_ = null;
-
-    /**
-     * Builder of profile views. Created during "profiler,begin" event processing.
-     * @type {devtools.profiler.WebKitViewBuilder}
-     */
-    this.viewBuilder_ = null;
-
-    /**
-     * Next profile id.
-     * @type {number}
-     */
-    this.profileId_ = 1;
-
-    /**
-     * Counter for processed ticks.
-     * @type {number}
-     */
-    this.ticksCount_ = 0;
-
-    /**
-     * Interval id for updating processing status.
-     * @type {number}
-     */
-    this.processingInterval_ = null;
-
-    /**
-     * The current heap snapshot.
-     * @type {string}
-     */
-    this.currentHeapSnapshot_ = null;
-
-    /**
-     * Next heap snapshot id.
-     * @type {number}
-     */
-    this.heapSnapshotId_ = 1;
-};
-devtools.profiler.Processor.prototype.__proto__ = devtools.profiler.LogReader.prototype;
-
-
-/**
- * @override
- */
-devtools.profiler.Processor.prototype.printError = function(str)
-{
-    debugPrint(str);
-};
-
-
-/**
- * @override
- */
-devtools.profiler.Processor.prototype.skipDispatch = function(dispatch)
-{
-    return dispatch.needsProfile && this.currentProfile_ === null;
-};
-
-
-/**
- * Sets profile processing callbacks.
- *
- * @param {function()} started Started processing callback.
- * @param {function(devtools.profiler.ProfileView)} finished Finished
- *     processing callback.
- */
-devtools.profiler.Processor.prototype.setCallbacks = function(started, processing, finished)
-{
-    this.startedProfileProcessing_ = started;
-    this.profileProcessingStatus_ = processing;
-    this.finishedProfileProcessing_ = finished;
-};
-
-
-/**
- * An address for the fake "(program)" entry. WebKit's visualisation
- * has assumptions on how the top of the call tree should look like,
- * and we need to add a fake entry as the topmost function. This
- * address is chosen because it's the end address of the first memory
- * page, which is never used for code or data, but only as a guard
- * page for catching AV errors.
- *
- * @type {number}
- */
-devtools.profiler.Processor.PROGRAM_ENTRY = 0xffff;
-/**
- * @type {string}
- */
-devtools.profiler.Processor.PROGRAM_ENTRY_STR = "0xffff";
-
-
-/**
- * Sets new profile callback.
- * @param {function(devtools.profiler.ProfileView)} callback Callback function.
- */
-devtools.profiler.Processor.prototype.setNewProfileCallback = function(callback)
-{
-    this.newProfileCallback_ = callback;
-};
-
-
-devtools.profiler.Processor.prototype.processProfiler_ = function(state, params)
-{
-    switch (state) {
-        case "resume":
-            if (this.currentProfile_ === null) {
-                this.currentProfile_ = new devtools.profiler.JsProfile();
-                // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY
-                this.currentProfile_.addCode("Function", "(program)", devtools.profiler.Processor.PROGRAM_ENTRY, 1);
-                if (this.startedProfileProcessing_)
-                    this.startedProfileProcessing_();
-                this.ticksCount_ = 0;
-                var self = this;
-                if (this.profileProcessingStatus_) {
-                    this.processingInterval_ = window.setInterval(
-                        function() { self.profileProcessingStatus_(self.ticksCount_); },
-                        1000);
-                }
-            }
-            break;
-        case "pause":
-            if (this.currentProfile_ !== null) {
-                window.clearInterval(this.processingInterval_);
-                this.processingInterval_ = null;
-                if (this.finishedProfileProcessing_)
-                    this.finishedProfileProcessing_(this.createProfileForView());
-                this.currentProfile_ = null;
-            }
-            break;
-        case "begin":
-            var samplingRate = NaN;
-            if (params.length > 0)
-                samplingRate = parseInt(params[0]);
-            if (isNaN(samplingRate))
-                samplingRate = 1;
-            this.viewBuilder_ = new devtools.profiler.WebKitViewBuilder(samplingRate);
-            break;
-        // These events are valid but aren't used.
-        case "compression":
-        case "end": break;
-        default:
-            throw new Error("unknown profiler state: " + state);
-    }
-};
-
-
-devtools.profiler.Processor.prototype.processCodeCreation_ = function(type, start, size, name)
-{
-    this.currentProfile_.addCode(this.expandAlias(type), name, start, size);
-};
-
-
-devtools.profiler.Processor.prototype.processCodeMove_ = function(from, to)
-{
-    this.currentProfile_.moveCode(from, to);
-};
-
-
-devtools.profiler.Processor.prototype.processCodeDelete_ = function(start)
-{
-    this.currentProfile_.deleteCode(start);
-};
-
-
-devtools.profiler.Processor.prototype.processFunctionCreation_ = function(functionAddr, codeAddr)
-{
-    this.currentProfile_.addCodeAlias(functionAddr, codeAddr);
-};
-
-
-devtools.profiler.Processor.prototype.processFunctionMove_ = function(from, to)
-{
-    this.currentProfile_.safeMoveDynamicCode(from, to);
-};
-
-
-devtools.profiler.Processor.prototype.processFunctionDelete_ = function(start)
-{
-    this.currentProfile_.safeDeleteDynamicCode(start);
-};
-
-
-// TODO(mnaganov): Remove after next V8 roll.
-devtools.profiler.Processor.prototype.processTick_ = function(pc, sp, vmState, stack)
-{
-    // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY
-    stack.push(devtools.profiler.Processor.PROGRAM_ENTRY_STR);
-    this.currentProfile_.recordTick(this.processStack(pc, stack));
-    this.ticksCount_++;
-};
-
-
-devtools.profiler.Processor.prototype.processTickV2_ = function(pc, sp, func, vmState, stack)
-{
-    // see the comment for devtools.profiler.Processor.PROGRAM_ENTRY
-    stack.push(devtools.profiler.Processor.PROGRAM_ENTRY_STR);
-
-
-    if (func) {
-        var funcEntry = this.currentProfile_.findEntry(func);
-        if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction())
-            func = 0;
-        else {
-            var currEntry = this.currentProfile_.findEntry(pc);
-            if (!currEntry || !currEntry.isJSFunction || currEntry.isJSFunction()) {
-                func = 0;
-            }
-        }
-    }
-
-    this.currentProfile_.recordTick(this.processStack(pc, func, stack));
-    this.ticksCount_++;
-};
-
-
-devtools.profiler.Processor.prototype.processHeapSampleBegin_ = function(space, state, ticks)
-{
-    if (space !== "Heap") return;
-    this.currentHeapSnapshot_ = {
-        number: this.heapSnapshotId_++,
-        entries: {},
-        clusters: {},
-        lowlevels: {},
-        ticks: ticks
-    };
-};
-
-
-devtools.profiler.Processor.prototype.processHeapSampleStats_ = function(space, state, capacity, used)
-{
-    if (space !== "Heap") return;
-};
-
-
-devtools.profiler.Processor.prototype.processHeapSampleItem_ = function(item, number, size)
-{
-    if (!this.currentHeapSnapshot_) return;
-    this.currentHeapSnapshot_.lowlevels[item] = {
-        type: item, count: number, size: size
-    };
-};
-
-
-devtools.profiler.Processor.prototype.processHeapJsConsItem_ = function(item, number, size)
-{
-    if (!this.currentHeapSnapshot_) return;
-    this.currentHeapSnapshot_.entries[item] = {
-        cons: item, count: number, size: size, retainers: {}
-    };
-};
-
-
-devtools.profiler.Processor.prototype.processHeapJsRetItem_ = function(item, retainersArray)
-{
-    if (!this.currentHeapSnapshot_) return;
-    var rawRetainers = {};
-    for (var i = 0, n = retainersArray.length; i < n; ++i) {
-        var entry = retainersArray[i].split(";");
-        rawRetainers[entry[0]] = parseInt(entry[1], 10);
-    }
-
-    function mergeRetainers(entry) {
-        for (var rawRetainer in rawRetainers) {
-            var consName = rawRetainer.indexOf(":") !== -1 ? rawRetainer.split(":")[0] : rawRetainer;
-            if (!(consName in entry.retainers))
-                entry.retainers[consName] = { cons: consName, count: 0, clusters: {} };
-            var retainer = entry.retainers[consName];
-            retainer.count += rawRetainers[rawRetainer];
-            if (consName !== rawRetainer)
-                retainer.clusters[rawRetainer] = true;
-        }
-    }
-
-    if (item.indexOf(":") !== -1) {
-      // Array, Function, or Object instances cluster case.
-      if (!(item in this.currentHeapSnapshot_.clusters)) {
-          this.currentHeapSnapshot_.clusters[item] = {
-              cons: item, retainers: {}
-          };
-      }
-      mergeRetainers(this.currentHeapSnapshot_.clusters[item]);
-      item = item.split(":")[0];
-    }
-    mergeRetainers(this.currentHeapSnapshot_.entries[item]);
-};
-
-
-devtools.profiler.Processor.prototype.processHeapSampleEnd_ = function(space, state)
-{
-    if (space !== "Heap") return;
-    var snapshot = this.currentHeapSnapshot_;
-    this.currentHeapSnapshot_ = null;
-    WebInspector.panels.profiles.addSnapshot(snapshot);
-};
-
-
-/**
- * Creates a profile for further displaying in ProfileView.
- */
-devtools.profiler.Processor.prototype.createProfileForView = function()
-{
-    var profile = this.viewBuilder_.buildView(this.currentProfile_.getTopDownProfile());
-    profile.uid = this.profileId_++;
-    profile.title = UserInitiatedProfileName + "." + profile.uid;
-    return profile;
 };
 
-/* HeapProfilerPanel.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview Heap profiler panel implementation.
- */
-
-WebInspector.ProfilesPanel.prototype.addSnapshot = function(snapshot) {
-    snapshot.title = WebInspector.UIString("Snapshot %d", snapshot.number);
-    snapshot.typeId = WebInspector.HeapSnapshotProfileType.TypeId;
-
-    var snapshots = WebInspector.HeapSnapshotProfileType.snapshots;
-    snapshots.push(snapshot);
-
-    snapshot.listIndex = snapshots.length - 1;
-
-    if (WebInspector.CPUProfile)
-        this.addProfileHeader(WebInspector.HeapSnapshotProfileType.TypeId, snapshot);
-    else
-        this.addProfileHeader(snapshot);
-
-    this.dispatchEventToListeners("snapshot added");
-}
-
-
 WebInspector.HeapSnapshotView = function(parent, profile)
 {
-    WebInspector.View.call(this);
+WebInspector.View.call(this);
 
-    this.element.addStyleClass("heap-snapshot-view");
+this.element.addStyleClass("heap-snapshot-view");
 
-    this.parent = parent;
-    this.parent.addEventListener("snapshot added", this._updateBaseOptions, this);
+this.parent = parent;
+this.parent.addEventListener("profile added", this._updateBaseOptions, this);
 
-    this.showCountAsPercent = false;
-    this.showSizeAsPercent = false;
-    this.showCountDeltaAsPercent = false;
-    this.showSizeDeltaAsPercent = false;
+this.showCountAsPercent = false;
+this.showSizeAsPercent = false;
+this.showCountDeltaAsPercent = false;
+this.showSizeDeltaAsPercent = false;
 
-    this.categories = {
-        code: new WebInspector.ResourceCategory("code", WebInspector.UIString("Code"), "rgb(255,121,0)"),
-        data: new WebInspector.ResourceCategory("data", WebInspector.UIString("Objects"), "rgb(47,102,236)")
-    };
-
-    var summaryContainer = document.createElement("div");
-    summaryContainer.id = "heap-snapshot-summary-container";
-
-    this.countsSummaryBar = new WebInspector.SummaryBar(this.categories);
-    this.countsSummaryBar.element.className = "heap-snapshot-summary";
-    this.countsSummaryBar.calculator = new WebInspector.HeapSummaryCountCalculator();
-    var countsLabel = document.createElement("div");
-    countsLabel.className = "heap-snapshot-summary-label";
-    countsLabel.textContent = WebInspector.UIString("Count");
-    this.countsSummaryBar.element.appendChild(countsLabel);
-    summaryContainer.appendChild(this.countsSummaryBar.element);
-
-    this.sizesSummaryBar = new WebInspector.SummaryBar(this.categories);
-    this.sizesSummaryBar.element.className = "heap-snapshot-summary";
-    this.sizesSummaryBar.calculator = new WebInspector.HeapSummarySizeCalculator();
-    var sizesLabel = document.createElement("label");
-    sizesLabel.className = "heap-snapshot-summary-label";
-    sizesLabel.textContent = WebInspector.UIString("Size");
-    this.sizesSummaryBar.element.appendChild(sizesLabel);
-    summaryContainer.appendChild(this.sizesSummaryBar.element);
-
-    this.element.appendChild(summaryContainer);
-
-    var columns = { "cons": { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
-                    "count": { title: WebInspector.UIString("Count"), width: "54px", sortable: true },
-                    "size": { title: WebInspector.UIString("Size"), width: "72px", sort: "descending", sortable: true },
-                    "countDelta": { title: WebInspector.UIString("\xb1 Count"), width: "72px", sortable: true },
-                    "sizeDelta": { title: WebInspector.UIString("\xb1 Size"), width: "72px", sortable: true } };
-
-    this.dataGrid = new WebInspector.DataGrid(columns);
-    this.dataGrid.addEventListener("sorting changed", this._sortData, this);
-    this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
-    this.element.appendChild(this.dataGrid.element);
-
-    this.profile = profile;
-
-    this.baseSelectElement = document.createElement("select");
-    this.baseSelectElement.className = "status-bar-item";
-    this.baseSelectElement.addEventListener("change", this._changeBase.bind(this), false);
-    this._updateBaseOptions();
-    if (this.profile.listIndex > 0)
-        this.baseSelectElement.selectedIndex = this.profile.listIndex - 1;
-    else
-        this.baseSelectElement.selectedIndex = this.profile.listIndex;
-    this._resetDataGridList();
-
-    this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item");
-    this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
-
-    this.refresh();
-
-    this._updatePercentButton();
+this.categories = {
+code: new WebInspector.ResourceCategory("code", WebInspector.UIString("Code"), "rgb(255,121,0)"),
+data: new WebInspector.ResourceCategory("data", WebInspector.UIString("Objects"), "rgb(47,102,236)")
 };
 
+var summaryContainer = document.createElement("div");
+summaryContainer.id = "heap-snapshot-summary-container";
+
+this.countsSummaryBar = new WebInspector.SummaryBar(this.categories);
+this.countsSummaryBar.element.className = "heap-snapshot-summary";
+this.countsSummaryBar.calculator = new WebInspector.HeapSummaryCountCalculator();
+var countsLabel = document.createElement("div");
+countsLabel.className = "heap-snapshot-summary-label";
+countsLabel.textContent = WebInspector.UIString("Count");
+this.countsSummaryBar.element.appendChild(countsLabel);
+summaryContainer.appendChild(this.countsSummaryBar.element);
+
+this.sizesSummaryBar = new WebInspector.SummaryBar(this.categories);
+this.sizesSummaryBar.element.className = "heap-snapshot-summary";
+this.sizesSummaryBar.calculator = new WebInspector.HeapSummarySizeCalculator();
+var sizesLabel = document.createElement("label");
+sizesLabel.className = "heap-snapshot-summary-label";
+sizesLabel.textContent = WebInspector.UIString("Size");
+this.sizesSummaryBar.element.appendChild(sizesLabel);
+summaryContainer.appendChild(this.sizesSummaryBar.element);
+
+this.element.appendChild(summaryContainer);
+
+var columns = {
+cons: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true },
+count: { title: WebInspector.UIString("Count"), width: "54px", sortable: true },
+size: { title: WebInspector.UIString("Size"), width: "72px", sort: "descending", sortable: true },
+
+countDelta: { title: WebInspector.UIString("\xb1 Count"), width: "72px", sortable: true },
+sizeDelta: { title: WebInspector.UIString("\xb1 Size"), width: "72px", sortable: true }
+};
+
+this.dataGrid = new WebInspector.DataGrid(columns);
+this.dataGrid.addEventListener("sorting changed", this._sortData, this);
+this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
+this.element.appendChild(this.dataGrid.element);
+
+this.profile = profile;
+
+this.baseSelectElement = document.createElement("select");
+this.baseSelectElement.className = "status-bar-item";
+this.baseSelectElement.addEventListener("change", this._changeBase.bind(this), false);
+this._updateBaseOptions();
+
+this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item");
+this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
+
+this._loadProfile(this.profile, profileCallback.bind(this));
+
+function profileCallback(profile)
+{
+var list = this._getProfiles();
+var profileIndex;
+for (var i = 0; i < list.length; ++i)
+if (list[i].uid === profile.uid) {
+profileIndex = i;
+break;
+}
+if (profileIndex > 0)
+this.baseSelectElement.selectedIndex = profileIndex - 1;
+else
+this.baseSelectElement.selectedIndex = profileIndex;
+this._resetDataGridList(resetCompleted.bind(this));
+}
+
+function resetCompleted()
+{
+this.refresh();
+this._updatePercentButton();
+}
+}
+
 WebInspector.HeapSnapshotView.prototype = {
+get statusBarItems()
+{
+return [this.baseSelectElement, this.percentButton.element];
+},
 
-    get statusBarItems()
-    {
-        return [this.baseSelectElement, this.percentButton.element];
-    },
+get profile()
+{
+return this._profile;
+},
 
-    get profile()
-    {
-        return this._profile;
-    },
+set profile(profile)
+{
+this._profile = profile;
+},
 
-    set profile(profile)
-    {
-        this._profile = profile;
-    },
+show: function(parentElement)
+{
+WebInspector.View.prototype.show.call(this, parentElement);
+this.dataGrid.updateWidths();
+},
 
-    show: function(parentElement)
-    {
-        WebInspector.View.prototype.show.call(this, parentElement);
-        this.dataGrid.updateWidths();
-    },
+hide: function()
+{
+WebInspector.View.prototype.hide.call(this);
+this._currentSearchResultIndex = -1;
+},
 
-    hide: function()
-    {
-        WebInspector.View.prototype.hide.call(this);
-        this._currentSearchResultIndex = -1;
-    },
+resize: function()
+{
+if (this.dataGrid)
+this.dataGrid.updateWidths();
+},
 
-    resize: function()
-    {
-        if (this.dataGrid)
-            this.dataGrid.updateWidths();
-    },
+refresh: function()
+{
+this.dataGrid.removeChildren();
 
-    refresh: function()
-    {
-        this.dataGrid.removeChildren();
+var children = this.snapshotDataGridList.children;
+var count = children.length;
+for (var index = 0; index < count; ++index)
+this.dataGrid.appendChild(children[index]);
 
-        var children = this.snapshotDataGridList.children;
-        var count = children.length;
-        for (var index = 0; index < count; ++index)
-            this.dataGrid.appendChild(children[index]);
+this._updateSummaryGraph();
+},
 
-        this._updateSummaryGraph();
-    },
+refreshShowAsPercents: function()
+{
+this._updatePercentButton();
+this.refreshVisibleData();
+},
 
-    refreshShowAsPercents: function()
-    {
-        this._updatePercentButton();
-        this.refreshVisibleData();
-    },
+_deleteSearchMatchedFlags: function(node)
+{
+delete node._searchMatchedConsColumn;
+delete node._searchMatchedCountColumn;
+delete node._searchMatchedSizeColumn;
+delete node._searchMatchedCountDeltaColumn;
+delete node._searchMatchedSizeDeltaColumn;
+},
 
-    _deleteSearchMatchedFlags: function(node)
-    {
-        delete node._searchMatchedConsColumn;
-        delete node._searchMatchedCountColumn;
-        delete node._searchMatchedSizeColumn;
-        delete node._searchMatchedCountDeltaColumn;
-        delete node._searchMatchedSizeDeltaColumn;
-    },
+searchCanceled: function()
+{
+if (this._searchResults) {
+for (var i = 0; i < this._searchResults.length; ++i) {
+var profileNode = this._searchResults[i].profileNode;
+this._deleteSearchMatchedFlags(profileNode);
+profileNode.refresh();
+}
+}
 
-    searchCanceled: function()
-    {
-        if (this._searchResults) {
-            for (var i = 0; i < this._searchResults.length; ++i) {
-                var profileNode = this._searchResults[i].profileNode;
-                this._deleteSearchMatchedFlags(profileNode);
-                profileNode.refresh();
-            }
-        }
+delete this._searchFinishedCallback;
+this._currentSearchResultIndex = -1;
+this._searchResults = [];
+},
 
-        delete this._searchFinishedCallback;
-        this._currentSearchResultIndex = -1;
-        this._searchResults = [];
-    },
+performSearch: function(query, finishedCallback)
+{
 
-    performSearch: function(query, finishedCallback)
-    {
-        // Call searchCanceled since it will reset everything we need before doing a new search.
-        this.searchCanceled();
+this.searchCanceled();
 
-        query = query.trimWhitespace();
+query = query.trim();
 
-        if (!query.length)
-            return;
+if (!query.length)
+return;
 
-        this._searchFinishedCallback = finishedCallback;
+this._searchFinishedCallback = finishedCallback;
 
-        var helper = WebInspector.HeapSnapshotView.SearchHelper;
+var helper = WebInspector.HeapSnapshotView.SearchHelper;
 
-        var operationAndNumber = helper.parseOperationAndNumber(query);
-        var operation = operationAndNumber[0];
-        var queryNumber = operationAndNumber[1];
+var operationAndNumber = helper.parseOperationAndNumber(query);
+var operation = operationAndNumber[0];
+var queryNumber = operationAndNumber[1];
 
-        var percentUnits = helper.percents.test(query);
-        var megaBytesUnits = helper.megaBytes.test(query);
-        var kiloBytesUnits = helper.kiloBytes.test(query);
-        var bytesUnits = helper.bytes.test(query);
+var percentUnits = helper.percents.test(query);
+var megaBytesUnits = helper.megaBytes.test(query);
+var kiloBytesUnits = helper.kiloBytes.test(query);
+var bytesUnits = helper.bytes.test(query);
 
-        var queryNumberBytes = (megaBytesUnits ? (queryNumber * 1024 * 1024) : (kiloBytesUnits ? (queryNumber * 1024) : queryNumber));
+var queryNumberBytes = (megaBytesUnits ? (queryNumber * 1024 * 1024) : (kiloBytesUnits ? (queryNumber * 1024) : queryNumber));
 
-        function matchesQuery(heapSnapshotDataGridNode)
-        {
-            WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags(heapSnapshotDataGridNode);
+function matchesQuery(heapSnapshotDataGridNode)
+{
+WebInspector.HeapSnapshotView.prototype._deleteSearchMatchedFlags(heapSnapshotDataGridNode);
 
-            if (percentUnits) {
-                heapSnapshotDataGridNode._searchMatchedCountColumn = operation(heapSnapshotDataGridNode.countPercent, queryNumber);
-                heapSnapshotDataGridNode._searchMatchedSizeColumn = operation(heapSnapshotDataGridNode.sizePercent, queryNumber);
-                heapSnapshotDataGridNode._searchMatchedCountDeltaColumn = operation(heapSnapshotDataGridNode.countDeltaPercent, queryNumber);
-                heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn = operation(heapSnapshotDataGridNode.sizeDeltaPercent, queryNumber);
-            } else if (megaBytesUnits || kiloBytesUnits || bytesUnits) {
-                heapSnapshotDataGridNode._searchMatchedSizeColumn = operation(heapSnapshotDataGridNode.size, queryNumberBytes);
-                heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn = operation(heapSnapshotDataGridNode.sizeDelta, queryNumberBytes);
-            } else {
-                heapSnapshotDataGridNode._searchMatchedCountColumn = operation(heapSnapshotDataGridNode.count, queryNumber);
-                heapSnapshotDataGridNode._searchMatchedCountDeltaColumn = operation(heapSnapshotDataGridNode.countDelta, queryNumber);
-            }
+if (percentUnits) {
+heapSnapshotDataGridNode._searchMatchedCountColumn = operation(heapSnapshotDataGridNode.countPercent, queryNumber);
+heapSnapshotDataGridNode._searchMatchedSizeColumn = operation(heapSnapshotDataGridNode.sizePercent, queryNumber);
+heapSnapshotDataGridNode._searchMatchedCountDeltaColumn = operation(heapSnapshotDataGridNode.countDeltaPercent, queryNumber);
+heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn = operation(heapSnapshotDataGridNode.sizeDeltaPercent, queryNumber);
+} else if (megaBytesUnits || kiloBytesUnits || bytesUnits) {
+heapSnapshotDataGridNode._searchMatchedSizeColumn = operation(heapSnapshotDataGridNode.size, queryNumberBytes);
+heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn = operation(heapSnapshotDataGridNode.sizeDelta, queryNumberBytes);
+} else {
+heapSnapshotDataGridNode._searchMatchedCountColumn = operation(heapSnapshotDataGridNode.count, queryNumber);
+heapSnapshotDataGridNode._searchMatchedCountDeltaColumn = operation(heapSnapshotDataGridNode.countDelta, queryNumber);
+}
 
-            if (heapSnapshotDataGridNode.constructorName.hasSubstring(query, true))
-                heapSnapshotDataGridNode._searchMatchedConsColumn = true;
+if (heapSnapshotDataGridNode.constructorName.hasSubstring(query, true))
+heapSnapshotDataGridNode._searchMatchedConsColumn = true;
 
-            if (heapSnapshotDataGridNode._searchMatchedConsColumn ||
-                heapSnapshotDataGridNode._searchMatchedCountColumn ||
-                heapSnapshotDataGridNode._searchMatchedSizeColumn ||
-                heapSnapshotDataGridNode._searchMatchedCountDeltaColumn ||
-                heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn) {
-                heapSnapshotDataGridNode.refresh();
-                return true;
-            }
+if (heapSnapshotDataGridNode._searchMatchedConsColumn ||
+heapSnapshotDataGridNode._searchMatchedCountColumn ||
+heapSnapshotDataGridNode._searchMatchedSizeColumn ||
+heapSnapshotDataGridNode._searchMatchedCountDeltaColumn ||
+heapSnapshotDataGridNode._searchMatchedSizeDeltaColumn) {
+heapSnapshotDataGridNode.refresh();
+return true;
+}
 
-            return false;
-        }
+return false;
+}
 
-        var current = this.snapshotDataGridList.children[0];
-        var depth = 0;
-        var info = {};
+var current = this.snapshotDataGridList.children[0];
+var depth = 0;
+var info = {};
 
-        // The second and subsequent levels of heap snapshot nodes represent retainers,
-        // so recursive expansion will be infinite, since a graph is being traversed.
-        // So default to a recursion cap of 2 levels.
-        var maxDepth = 2;
 
-        while (current) {
-            if (matchesQuery(current))
-                this._searchResults.push({ profileNode: current });
-            current = current.traverseNextNode(false, null, (depth >= maxDepth), info);
-            depth += info.depthChange;
-        }
 
-        finishedCallback(this, this._searchResults.length);
-    },
 
-    jumpToFirstSearchResult: WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult,
-    jumpToLastSearchResult: WebInspector.CPUProfileView.prototype.jumpToLastSearchResult,
-    jumpToNextSearchResult: WebInspector.CPUProfileView.prototype.jumpToNextSearchResult,
-    jumpToPreviousSearchResult: WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult,
-    showingFirstSearchResult: WebInspector.CPUProfileView.prototype.showingFirstSearchResult,
-    showingLastSearchResult: WebInspector.CPUProfileView.prototype.showingLastSearchResult,
-    _jumpToSearchResult: WebInspector.CPUProfileView.prototype._jumpToSearchResult,
+const maxDepth = 2;
 
-    refreshVisibleData: function()
-    {
-        var child = this.dataGrid.children[0];
-        while (child) {
-            child.refresh();
-            child = child.traverseNextNode(false, null, true);
-        }
-        this._updateSummaryGraph();
-    },
+while (current) {
+if (matchesQuery(current))
+this._searchResults.push({ profileNode: current });
+current = current.traverseNextNode(false, null, (depth >= maxDepth), info);
+depth += info.depthChange;
+}
 
-    _changeBase: function() {
-        if (this.baseSnapshot === WebInspector.HeapSnapshotProfileType.snapshots[this.baseSelectElement.selectedIndex])
-            return;
+finishedCallback(this, this._searchResults.length);
+},
 
-        this._resetDataGridList();
-        this.refresh();
 
-        if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
-            return;
+jumpToFirstSearchResult: WebInspector.CPUProfileView.prototype.jumpToFirstSearchResult,
+jumpToLastSearchResult: WebInspector.CPUProfileView.prototype.jumpToLastSearchResult,
+jumpToNextSearchResult: WebInspector.CPUProfileView.prototype.jumpToNextSearchResult,
+jumpToPreviousSearchResult: WebInspector.CPUProfileView.prototype.jumpToPreviousSearchResult,
+showingFirstSearchResult: WebInspector.CPUProfileView.prototype.showingFirstSearchResult,
+showingLastSearchResult: WebInspector.CPUProfileView.prototype.showingLastSearchResult,
+_jumpToSearchResult: WebInspector.CPUProfileView.prototype._jumpToSearchResult,
 
-        // The current search needs to be performed again. First negate out previous match
-        // count by calling the search finished callback with a negative number of matches.
-        // Then perform the search again with the same query and callback.
-        this._searchFinishedCallback(this, -this._searchResults.length);
-        this.performSearch(this.currentQuery, this._searchFinishedCallback);
-    },
+refreshVisibleData: function()
+{
+var child = this.dataGrid.children[0];
+while (child) {
+child.refresh();
+child = child.traverseNextNode(false, null, true);
+}
+this._updateSummaryGraph();
+},
 
-    _createSnapshotDataGridList: function()
-    {
-        if (this._snapshotDataGridList)
-          delete this._snapshotDataGridList;
+_changeBase: function()
+{
+if (this.baseSnapshot.uid === this._getProfiles()[this.baseSelectElement.selectedIndex].uid)
+return;
 
-        this._snapshotDataGridList = new WebInspector.HeapSnapshotDataGridList(this, this.baseSnapshot.entries, this.profile.entries);
-        return this._snapshotDataGridList;
-    },
+this._resetDataGridList(resetCompleted.bind(this));
 
-    _mouseDownInDataGrid: function(event)
-    {
-        if (event.detail < 2)
-            return;
+function resetCompleted() {
+this.refresh();
 
-        var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
-        if (!cell || (!cell.hasStyleClass("count-column") && !cell.hasStyleClass("size-column") && !cell.hasStyleClass("countDelta-column") && !cell.hasStyleClass("sizeDelta-column")))
-            return;
+if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
+return;
 
-        if (cell.hasStyleClass("count-column"))
-            this.showCountAsPercent = !this.showCountAsPercent;
-        else if (cell.hasStyleClass("size-column"))
-            this.showSizeAsPercent = !this.showSizeAsPercent;
-        else if (cell.hasStyleClass("countDelta-column"))
-            this.showCountDeltaAsPercent = !this.showCountDeltaAsPercent;
-        else if (cell.hasStyleClass("sizeDelta-column"))
-            this.showSizeDeltaAsPercent = !this.showSizeDeltaAsPercent;
 
-        this.refreshShowAsPercents();
 
-        event.preventDefault();
-        event.stopPropagation();
-    },
 
-    get _isShowingAsPercent()
-    {
-        return this.showCountAsPercent && this.showSizeAsPercent && this.showCountDeltaAsPercent && this.showSizeDeltaAsPercent;
-    },
+this._searchFinishedCallback(this, -this._searchResults.length);
+this.performSearch(this.currentQuery, this._searchFinishedCallback);
+}
+},
 
-    _percentClicked: function(event)
-    {
-        var currentState = this._isShowingAsPercent;
-        this.showCountAsPercent = !currentState;
-        this.showSizeAsPercent = !currentState;
-        this.showCountDeltaAsPercent = !currentState;
-        this.showSizeDeltaAsPercent = !currentState;
-        this.refreshShowAsPercents();
-    },
+_createSnapshotDataGridList: function()
+{
+if (this._snapshotDataGridList)
+delete this._snapshotDataGridList;
 
-    _resetDataGridList: function()
-    {
-        this.baseSnapshot = WebInspector.HeapSnapshotProfileType.snapshots[this.baseSelectElement.selectedIndex];
-        var lastComparator = WebInspector.HeapSnapshotDataGridList.propertyComparator("size", false);
-        if (this.snapshotDataGridList)
-            lastComparator = this.snapshotDataGridList.lastComparator;
-        this.snapshotDataGridList = this._createSnapshotDataGridList();
-        this.snapshotDataGridList.sort(lastComparator, true);
-    },
+this._snapshotDataGridList = new WebInspector.HeapSnapshotDataGridList(this, this.baseSnapshot.entries, this.profile.entries);
+return this._snapshotDataGridList;
+},
 
-    _sortData: function()
-    {
-        var sortAscending = this.dataGrid.sortOrder === "ascending";
-        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
-        var sortProperty = {
-                "cons": ["constructorName", null],
-                "count": ["count", null],
-                "size": ["size", "count"],
-                "countDelta": this.showCountDeltaAsPercent ? ["countDeltaPercent", null] : ["countDelta", null],
-                "sizeDelta": this.showSizeDeltaAsPercent ? ["sizeDeltaPercent", "countDeltaPercent"] : ["sizeDelta", "sizeDeltaPercent"]
-        }[sortColumnIdentifier];
+_getProfiles: function()
+{
+return WebInspector.panels.profiles.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
+},
 
-        this.snapshotDataGridList.sort(WebInspector.HeapSnapshotDataGridList.propertyComparator(sortProperty[0], sortProperty[1], sortAscending));
+_loadProfile: function(profile, callback)
+{
+WebInspector.panels.profiles.loadHeapSnapshot(profile.uid, callback);
+},
 
-        this.refresh();
-    },
+processLoadedSnapshot: function(profile, loadedSnapshot)
+{
+var snapshot = WebInspector.HeapSnapshotView.prototype._convertSnapshot(loadedSnapshot);
+profile.children = snapshot.children;
+profile.entries = snapshot.entries;
+profile.lowlevels = snapshot.lowlevels;
+WebInspector.HeapSnapshotView.prototype._prepareProfile(profile);
+},
 
-    _updateBaseOptions: function()
-    {
-        var list = WebInspector.HeapSnapshotProfileType.snapshots;
-        // We're assuming that snapshots can only be added.
-        if (this.baseSelectElement.length === list.length)
-            return;
+_mouseDownInDataGrid: function(event)
+{
+if (event.detail < 2)
+return;
 
-        for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) {
-            var baseOption = document.createElement("option");
-            baseOption.label = WebInspector.UIString("Compared to %s", list[i].title);
-            this.baseSelectElement.appendChild(baseOption);
-        }
-    },
+var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
+if (!cell || (!cell.hasStyleClass("count-column") && !cell.hasStyleClass("size-column") && !cell.hasStyleClass("countDelta-column") && !cell.hasStyleClass("sizeDelta-column")))
+return;
 
-    _updatePercentButton: function()
-    {
-        if (this._isShowingAsPercent) {
-            this.percentButton.title = WebInspector.UIString("Show absolute counts and sizes.");
-            this.percentButton.toggled = true;
-        } else {
-            this.percentButton.title = WebInspector.UIString("Show counts and sizes as percentages.");
-            this.percentButton.toggled = false;
-        }
-    },
+if (cell.hasStyleClass("count-column"))
+this.showCountAsPercent = !this.showCountAsPercent;
+else if (cell.hasStyleClass("size-column"))
+this.showSizeAsPercent = !this.showSizeAsPercent;
+else if (cell.hasStyleClass("countDelta-column"))
+this.showCountDeltaAsPercent = !this.showCountDeltaAsPercent;
+else if (cell.hasStyleClass("sizeDelta-column"))
+this.showSizeDeltaAsPercent = !this.showSizeDeltaAsPercent;
 
-    _updateSummaryGraph: function()
-    {
-        this.countsSummaryBar.calculator.showAsPercent = this._isShowingAsPercent;
-        this.countsSummaryBar.update(this.profile.lowlevels);
+this.refreshShowAsPercents();
 
-        this.sizesSummaryBar.calculator.showAsPercent = this._isShowingAsPercent;
-        this.sizesSummaryBar.update(this.profile.lowlevels);
-    }
+event.preventDefault();
+event.stopPropagation();
+},
+
+get _isShowingAsPercent()
+{
+return this.showCountAsPercent && this.showSizeAsPercent && this.showCountDeltaAsPercent && this.showSizeDeltaAsPercent;
+},
+
+_percentClicked: function(event)
+{
+var currentState = this._isShowingAsPercent;
+this.showCountAsPercent = !currentState;
+this.showSizeAsPercent = !currentState;
+this.showCountDeltaAsPercent = !currentState;
+this.showSizeDeltaAsPercent = !currentState;
+this.refreshShowAsPercents();
+},
+
+_convertSnapshot: function(loadedSnapshot)
+{
+var snapshot = new WebInspector.HeapSnapshot(loadedSnapshot);
+var result = {lowlevels: {}, entries: {}, children: {}};
+for (var rootEdges = snapshot.rootEdges; !rootEdges.done; rootEdges.next()) {
+var node = rootEdges.node;
+if (node.isHidden)
+result.lowlevels[node.name] = {count: node.instancesCount, size: node.selfSize, type: node.name};
+else if (node.instancesCount)
+result.entries[node.name] = {constructorName: node.name, count: node.instancesCount, size: node.selfSize};
+else {
+var entry = {constructorName: node.name};
+for (var edges = node.edges; !edges.done; edges.next())
+entry[edges.nodeIndex] = {constructorName: edges.node.name, count: edges.name};
+result.children[rootEdges.nodeIndex] = entry;
+}
+}
+return result;
+},
+
+_prepareProfile: function(profile)
+{
+for (var profileEntry in profile.entries)
+profile.entries[profileEntry].retainers = {};
+profile.clusters = {};
+
+for (var addr in profile.children) {
+var retainer = profile.children[addr];
+var retainerId = retainer.constructorName + ":" + addr;
+for (var childAddr in retainer) {
+if (childAddr === "constructorName") continue;
+var item = retainer[childAddr];
+var itemId = item.constructorName + ":" + childAddr;
+if ((item.constructorName === "Object" || item.constructorName === "Array")) {
+if (!(itemId in profile.clusters))
+profile.clusters[itemId] = { constructorName: itemId, retainers: {} };
+mergeRetainers(profile.clusters[itemId], item);
+}
+mergeRetainers(profile.entries[item.constructorName], item);
+}
+}
+
+function mergeRetainers(entry, item)
+{
+if (!(retainer.constructorName in entry.retainers))
+entry.retainers[retainer.constructorName] = { constructorName: retainer.constructorName, count: 0, clusters: {} };
+var retainerEntry = entry.retainers[retainer.constructorName];
+retainerEntry.count += item.count;
+if (retainer.constructorName === "Object" || retainer.constructorName === "Array")
+retainerEntry.clusters[retainerId] = true;
+}
+},
+
+_resetDataGridList: function(callback)
+{
+this._loadProfile(this._getProfiles()[this.baseSelectElement.selectedIndex], profileLoaded.bind(this));
+
+function profileLoaded(profile)
+{
+this.baseSnapshot = profile;
+var lastComparator = WebInspector.HeapSnapshotDataGridList.propertyComparator("size", false);
+if (this.snapshotDataGridList)
+lastComparator = this.snapshotDataGridList.lastComparator;
+this.snapshotDataGridList = this._createSnapshotDataGridList();
+this.snapshotDataGridList.sort(lastComparator, true);
+callback();
+}
+},
+
+_sortData: function()
+{
+var sortAscending = this.dataGrid.sortOrder === "ascending";
+var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+var sortProperty = {
+cons: ["constructorName", null],
+count: ["count", null],
+size: ["size", "count"],
+countDelta: this.showCountDeltaAsPercent ? ["countDeltaPercent", null] : ["countDelta", null],
+sizeDelta: this.showSizeDeltaAsPercent ? ["sizeDeltaPercent", "countDeltaPercent"] : ["sizeDelta", "sizeDeltaPercent"]
+}[sortColumnIdentifier];
+
+this.snapshotDataGridList.sort(WebInspector.HeapSnapshotDataGridList.propertyComparator(sortProperty[0], sortProperty[1], sortAscending));
+
+this.refresh();
+},
+
+_updateBaseOptions: function()
+{
+var list = this._getProfiles();
+
+if (this.baseSelectElement.length === list.length)
+return;
+
+for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) {
+var baseOption = document.createElement("option");
+var title = list[i].title;
+if (!title.indexOf(UserInitiatedProfileName))
+title = WebInspector.UIString("Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
+baseOption.label = WebInspector.UIString("Compared to %s", title);
+this.baseSelectElement.appendChild(baseOption);
+}
+},
+
+_updatePercentButton: function()
+{
+if (this._isShowingAsPercent) {
+this.percentButton.title = WebInspector.UIString("Show absolute counts and sizes.");
+this.percentButton.toggled = true;
+} else {
+this.percentButton.title = WebInspector.UIString("Show counts and sizes as percentages.");
+this.percentButton.toggled = false;
+}
+},
+
+_updateSummaryGraph: function()
+{
+this.countsSummaryBar.calculator.showAsPercent = this._isShowingAsPercent;
+this.countsSummaryBar.update(this.profile.lowlevels);
+
+this.sizesSummaryBar.calculator.showAsPercent = this._isShowingAsPercent;
+this.sizesSummaryBar.update(this.profile.lowlevels);
+}
 };
 
 WebInspector.HeapSnapshotView.prototype.__proto__ = WebInspector.View.prototype;
 
 WebInspector.HeapSnapshotView.SearchHelper = {
-    // In comparators, we assume that a value from a node is passed as the first parameter.
-    operations: { LESS: function (a, b) { return a !== null && a < b; },
-                  LESS_OR_EQUAL: function (a, b) { return a !== null && a <= b; },
-                  EQUAL: function (a, b) { return a !== null && a === b; },
-                  GREATER_OR_EQUAL: function (a, b) { return a !== null && a >= b; },
-                  GREATER: function (a, b) { return a !== null && a > b; } },
 
-    operationParsers: { LESS: /^<(\d+)/,
-                        LESS_OR_EQUAL: /^<=(\d+)/,
-                        GREATER_OR_EQUAL: /^>=(\d+)/,
-                        GREATER: /^>(\d+)/ },
+operations: {
+LESS: function (a, b) { return a !== null && a < b; },
+LESS_OR_EQUAL: function (a, b) { return a !== null && a <= b; },
+EQUAL: function (a, b) { return a !== null && a === b; },
+GREATER_OR_EQUAL: function (a, b) { return a !== null && a >= b; },
+GREATER: function (a, b) { return a !== null && a > b; }
+},
 
-    parseOperationAndNumber: function(query)
-    {
-        var operations = WebInspector.HeapSnapshotView.SearchHelper.operations;
-        var parsers = WebInspector.HeapSnapshotView.SearchHelper.operationParsers;
-        for (var operation in parsers) {
-            var match = query.match(parsers[operation]);
-            if (match !== null)
-                return [operations[operation], parseFloat(match[1])];
-        }
-        return [operations.EQUAL, parseFloat(query)];
-    },
+operationParsers: {
+LESS: /^<(\d+)/,
+LESS_OR_EQUAL: /^<=(\d+)/,
+GREATER_OR_EQUAL: /^>=(\d+)/,
+GREATER: /^>(\d+)/
+},
 
-    percents: /%$/,
+parseOperationAndNumber: function(query)
+{
+var operations = WebInspector.HeapSnapshotView.SearchHelper.operations;
+var parsers = WebInspector.HeapSnapshotView.SearchHelper.operationParsers;
+for (var operation in parsers) {
+var match = query.match(parsers[operation]);
+if (match !== null)
+return [operations[operation], parseFloat(match[1])];
+}
+return [operations.EQUAL, parseFloat(query)];
+},
 
-    megaBytes: /MB$/i,
+percents: /%$/,
 
-    kiloBytes: /KB$/i,
+megaBytes: /MB$/i,
 
-    bytes: /B$/i
+kiloBytes: /KB$/i,
+
+bytes: /B$/i
 }
 
 WebInspector.HeapSummaryCalculator = function(lowLevelField)
 {
-    this.total = 1;
-    this.lowLevelField = lowLevelField;
+this.total = 1;
+this.lowLevelField = lowLevelField;
 }
 
 WebInspector.HeapSummaryCalculator.prototype = {
-    computeSummaryValues: function(lowLevels)
-    {
-        var highLevels = {data: 0, code: 0};
-        this.total = 0;
-        for (var item in lowLevels) {
-            var highItem = this._highFromLow(item);
-            if (highItem) {
-                var value = lowLevels[item][this.lowLevelField];
-                highLevels[highItem] += value;
-                this.total += value;
-            }
-        }
-        var result = {categoryValues: highLevels};
-        if (!this.showAsPercent)
-            result.total = this.total;
-        return result;
-    },
+computeSummaryValues: function(lowLevels)
+{
+var highLevels = { data: 0, code: 0 };
+this.total = 0;
+for (var item in lowLevels) {
+var highItem = this._highFromLow(item);
+if (highItem) {
+var value = lowLevels[item][this.lowLevelField];
+highLevels[highItem] += value;
+this.total += value;
+}
+}
+var result = { categoryValues: highLevels };
+if (!this.showAsPercent)
+result.total = this.total;
+return result;
+},
 
-    formatValue: function(value)
-    {
-        if (this.showAsPercent)
-            return WebInspector.UIString("%.2f%%", value / this.total * 100.0);
-        else
-            return this._valueToString(value);
-    },
+formatValue: function(value)
+{
+if (this.showAsPercent)
+return WebInspector.UIString("%.2f%%", value / this.total * 100.0);
+else
+return this._valueToString(value);
+},
 
-    get showAsPercent()
-    {
-        return this._showAsPercent;
-    },
+get showAsPercent()
+{
+return this._showAsPercent;
+},
 
-    set showAsPercent(x)
-    {
-        this._showAsPercent = x;
-    }
+set showAsPercent(x)
+{
+this._showAsPercent = x;
+}
 }
 
 WebInspector.HeapSummaryCountCalculator = function()
 {
-    WebInspector.HeapSummaryCalculator.call(this, "count");
+WebInspector.HeapSummaryCalculator.call(this, "count");
 }
 
 WebInspector.HeapSummaryCountCalculator.prototype = {
-    _highFromLow: function(type) {
-        if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
-        if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/)) return "data";
-        return null;
-    },
+_highFromLow: function(type)
+{
+if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
+if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/)) return "data";
+return null;
+},
 
-    _valueToString: function(value) {
-        return value.toString();
-    }
+_valueToString: function(value)
+{
+return value.toString();
+}
 }
 
 WebInspector.HeapSummaryCountCalculator.prototype.__proto__ = WebInspector.HeapSummaryCalculator.prototype;
 
 WebInspector.HeapSummarySizeCalculator = function()
 {
-    WebInspector.HeapSummaryCalculator.call(this, "size");
+WebInspector.HeapSummaryCalculator.call(this, "size");
 }
 
 WebInspector.HeapSummarySizeCalculator.prototype = {
-    _highFromLow: function(type) {
-        if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE") return "code";
-        if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/) || type.match(/_ARRAY_TYPE$/)) return "data";
-        return null;
-    },
+_highFromLow: function(type)
+{
+if (type === "CODE_TYPE" || type === "SHARED_FUNCTION_INFO_TYPE" || type === "SCRIPT_TYPE")
+return "code";
+if (type === "STRING_TYPE" || type === "HEAP_NUMBER_TYPE" || type.match(/^JS_/) || type.match(/_ARRAY_TYPE$/))
+return "data";
+return null;
+},
 
-    _valueToString: Number.bytesToString
+_valueToString: Number.bytesToString
 }
 
 WebInspector.HeapSummarySizeCalculator.prototype.__proto__ = WebInspector.HeapSummaryCalculator.prototype;
 
-WebInspector.HeapSnapshotSidebarTreeElement = function(snapshot)
-{
-    this.profile = snapshot;
-
-    WebInspector.SidebarTreeElement.call(this, "heap-snapshot-sidebar-tree-item", "", "", snapshot, false);
-
-    this.refreshTitles();
-};
-
-WebInspector.HeapSnapshotSidebarTreeElement.prototype = {
-    get mainTitle()
-    {
-        if (this._mainTitle)
-            return this._mainTitle;
-        return this.profile.title;
-    },
-
-    set mainTitle(x)
-    {
-        this._mainTitle = x;
-        this.refreshTitles();
-    }
-};
-
-WebInspector.HeapSnapshotSidebarTreeElement.prototype.__proto__ = WebInspector.ProfileSidebarTreeElement.prototype;
-
 WebInspector.HeapSnapshotDataGridNodeWithRetainers = function(owningTree)
 {
-    this.tree = owningTree;
+this.tree = owningTree;
 
-    WebInspector.DataGridNode.call(this, null, this._hasRetainers);
+WebInspector.DataGridNode.call(this, null, this._hasRetainers);
 
-    this.addEventListener("populate", this._populate, this);
+this.addEventListener("populate", this._populate, this);
 };
 
 WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype = {
-    isEmptySet: function(set)
-    {
-        for (var x in set)
-            return false;
-        return true;
-    },
+isEmptySet: function(set)
+{
+for (var x in set)
+return false;
+return true;
+},
 
-    get _hasRetainers()
-    {
-        return !this.isEmptySet(this.retainers);
-    },
+get _hasRetainers()
+{
+return !this.isEmptySet(this.retainers);
+},
 
-    get _parent()
-    {
-        // For top-level nodes, return owning tree as a parent, not data grid.
-        return this.parent !== this.dataGrid ? this.parent : this.tree;
-    },
+get _parent()
+{
 
-    _populate: function(event)
-    {
-        var self = this;
-        this.produceDiff(this.baseRetainers, this.retainers, function(baseItem, snapshotItem) {
-            self.appendChild(new WebInspector.HeapSnapshotDataGridRetainerNode(self.snapshotView, baseItem, snapshotItem, self.tree));
-        });
+return this.parent !== this.dataGrid ? this.parent : this.tree;
+},
 
-        if (this._parent) {
-            var currentComparator = this._parent.lastComparator;
-            if (currentComparator)
-                this.sort(currentComparator, true);
-        }
+_populate: function(event)
+{
+function appendDiffEntry(baseItem, snapshotItem)
+{
+this.appendChild(new WebInspector.HeapSnapshotDataGridRetainerNode(this.snapshotView, baseItem, snapshotItem, this.tree));
+}
 
-        this.removeEventListener("populate", this._populate, this);
-    },
+this.produceDiff(this.baseRetainers, this.retainers, appendDiffEntry.bind(this));
 
-    produceDiff: function(baseEntries, currentEntries, callback)
-    {
-        for (var item in currentEntries)
-            callback(baseEntries[item], currentEntries[item]);
+if (this._parent) {
+var currentComparator = this._parent.lastComparator;
+if (currentComparator)
+this.sort(currentComparator, true);
+}
 
-        for (item in baseEntries) {
-            if (!(item in currentEntries))
-                callback(baseEntries[item], null);
-        }
-    },
+this.removeEventListener("populate", this._populate, this);
+},
 
-    sort: function(comparator, force) {
-        if (!force && this.lastComparator === comparator)
-            return;
+produceDiff: function(baseEntries, currentEntries, callback)
+{
+for (var item in currentEntries)
+callback(baseEntries[item], currentEntries[item]);
 
-        this.children.sort(comparator);
-        var childCount = this.children.length;
-        for (var childIndex = 0; childIndex < childCount; ++childIndex)
-            this.children[childIndex]._recalculateSiblings(childIndex);
-        for (var i = 0; i < this.children.length; ++i) {
-            var child = this.children[i];
-            if (!force && (!child.expanded || child.lastComparator === comparator))
-                continue;
-            child.sort(comparator, force);
-        }
-        this.lastComparator = comparator;
-    },
+for (item in baseEntries) {
+if (!(item in currentEntries))
+callback(baseEntries[item], null);
+}
+},
 
-    signForDelta: function(delta) {
-        if (delta === 0)
-            return "";
-        if (delta > 0)
-            return "+";
-        else
-            // Math minus sign, same width as plus.
-            return "\u2212";
-    },
+sort: function(comparator, force) {
+if (!force && this.lastComparator === comparator)
+return;
 
-    showDeltaAsPercent: function(value) {
-        if (value === Number.POSITIVE_INFINITY)
-            return WebInspector.UIString("new");
-        else if (value === Number.NEGATIVE_INFINITY)
-            return WebInspector.UIString("deleted");
-        if (value > 1000.0)
-            return WebInspector.UIString("%s >1000%%", this.signForDelta(value));
-        return WebInspector.UIString("%s%.2f%%", this.signForDelta(value), Math.abs(value));
-    },
+this.children.sort(comparator);
+var childCount = this.children.length;
+for (var childIndex = 0; childIndex < childCount; ++childIndex)
+this.children[childIndex]._recalculateSiblings(childIndex);
+for (var i = 0; i < this.children.length; ++i) {
+var child = this.children[i];
+if (!force && (!child.expanded || child.lastComparator === comparator))
+continue;
+child.sort(comparator, force);
+}
+this.lastComparator = comparator;
+},
 
-    getTotalCount: function() {
-        if (!this._count) {
-            this._count = 0;
-            for (var i = 0, n = this.children.length; i < n; ++i)
-                this._count += this.children[i].count;
-        }
-        return this._count;
-    },
+signForDelta: function(delta) {
+if (delta === 0)
+return "";
+if (delta > 0)
+return "+";
+else
+return "\u2212";  
+},
 
-    getTotalSize: function() {
-        if (!this._size) {
-            this._size = 0;
-            for (var i = 0, n = this.children.length; i < n; ++i)
-                this._size += this.children[i].size;
-        }
-        return this._size;
-    },
+showDeltaAsPercent: function(value)
+{
+if (value === Number.POSITIVE_INFINITY)
+return WebInspector.UIString("new");
+else if (value === Number.NEGATIVE_INFINITY)
+return WebInspector.UIString("deleted");
+if (value > 1000.0)
+return WebInspector.UIString("%s >1000%%", this.signForDelta(value));
+return WebInspector.UIString("%s%.2f%%", this.signForDelta(value), Math.abs(value));
+},
 
-    get countPercent()
-    {
-        return this.count / this._parent.getTotalCount() * 100.0;
-    },
+getTotalCount: function()
+{
+if (!this._count) {
+this._count = 0;
+for (var i = 0, n = this.children.length; i < n; ++i)
+this._count += this.children[i].count;
+}
+return this._count;
+},
 
-    get sizePercent()
-    {
-        return this.size / this._parent.getTotalSize() * 100.0;
-    },
+getTotalSize: function()
+{
+if (!this._size) {
+this._size = 0;
+for (var i = 0, n = this.children.length; i < n; ++i)
+this._size += this.children[i].size;
+}
+return this._size;
+},
 
-    get countDeltaPercent()
-    {
-        if (this.baseCount > 0) {
-            if (this.count > 0)
-                return this.countDelta / this.baseCount * 100.0;
-            else
-                return Number.NEGATIVE_INFINITY;
-        } else
-            return Number.POSITIVE_INFINITY;
-    },
+get countPercent()
+{
+return this.count / this._parent.getTotalCount() * 100.0;
+},
 
-    get sizeDeltaPercent()
-    {
-        if (this.baseSize > 0) {
-            if (this.size > 0)
-                return this.sizeDelta / this.baseSize * 100.0;
-            else
-                return Number.NEGATIVE_INFINITY;
-        } else
-            return Number.POSITIVE_INFINITY;
-    },
+get sizePercent()
+{
+return this.size / this._parent.getTotalSize() * 100.0;
+},
 
-    get data()
-    {
-        var data = {};
+get countDeltaPercent()
+{
+if (this.baseCount > 0) {
+if (this.count > 0)
+return this.countDelta / this.baseCount * 100.0;
+else
+return Number.NEGATIVE_INFINITY;
+} else
+return Number.POSITIVE_INFINITY;
+},
 
-        data["cons"] = this.constructorName;
+get sizeDeltaPercent()
+{
+if (this.baseSize > 0) {
+if (this.size > 0)
+return this.sizeDelta / this.baseSize * 100.0;
+else
+return Number.NEGATIVE_INFINITY;
+} else
+return Number.POSITIVE_INFINITY;
+},
 
-        if (this.snapshotView.showCountAsPercent)
-            data["count"] = WebInspector.UIString("%.2f%%", this.countPercent);
-        else
-            data["count"] = this.count;
+get data()
+{
+var data = {};
 
-        if (this.size !== null) {
-            if (this.snapshotView.showSizeAsPercent)
-                data["size"] = WebInspector.UIString("%.2f%%", this.sizePercent);
-            else
-                data["size"] = Number.bytesToString(this.size);
-        } else
-            data["size"] = "";
+data["cons"] = this.constructorName;
 
-        if (this.snapshotView.showCountDeltaAsPercent)
-            data["countDelta"] = this.showDeltaAsPercent(this.countDeltaPercent);
-        else
-            data["countDelta"] = WebInspector.UIString("%s%d", this.signForDelta(this.countDelta), Math.abs(this.countDelta));
+if (this.snapshotView.showCountAsPercent)
+data["count"] = WebInspector.UIString("%.2f%%", this.countPercent);
+else
+data["count"] = this.count;
 
-        if (this.sizeDelta !== null) {
-            if (this.snapshotView.showSizeDeltaAsPercent)
-                data["sizeDelta"] = this.showDeltaAsPercent(this.sizeDeltaPercent);
-            else
-                data["sizeDelta"] = WebInspector.UIString("%s%s", this.signForDelta(this.sizeDelta), Number.bytesToString(Math.abs(this.sizeDelta)));
-        } else
-            data["sizeDelta"] = "";
+if (this.size !== null) {
+if (this.snapshotView.showSizeAsPercent)
+data["size"] = WebInspector.UIString("%.2f%%", this.sizePercent);
+else
+data["size"] = Number.bytesToString(this.size);
+} else
+data["size"] = "";
 
-        return data;
-    },
+if (this.snapshotView.showCountDeltaAsPercent)
+data["countDelta"] = this.showDeltaAsPercent(this.countDeltaPercent);
+else
+data["countDelta"] = WebInspector.UIString("%s%d", this.signForDelta(this.countDelta), Math.abs(this.countDelta));
 
-    createCell: function(columnIdentifier)
-    {
-        var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
+if (this.sizeDelta !== null) {
+if (this.snapshotView.showSizeDeltaAsPercent)
+data["sizeDelta"] = this.showDeltaAsPercent(this.sizeDeltaPercent);
+else
+data["sizeDelta"] = WebInspector.UIString("%s%s", this.signForDelta(this.sizeDelta), Number.bytesToString(Math.abs(this.sizeDelta)));
+} else
+data["sizeDelta"] = "";
 
-        if ((columnIdentifier === "cons" && this._searchMatchedConsColumn) ||
-            (columnIdentifier === "count" && this._searchMatchedCountColumn) ||
-            (columnIdentifier === "size" && this._searchMatchedSizeColumn) ||
-            (columnIdentifier === "countDelta" && this._searchMatchedCountDeltaColumn) ||
-            (columnIdentifier === "sizeDelta" && this._searchMatchedSizeDeltaColumn))
-            cell.addStyleClass("highlight");
+return data;
+},
 
-        return cell;
-    }
+createCell: function(columnIdentifier)
+{
+var cell = WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
+
+if ((columnIdentifier === "cons" && this._searchMatchedConsColumn) ||
+(columnIdentifier === "count" && this._searchMatchedCountColumn) ||
+(columnIdentifier === "size" && this._searchMatchedSizeColumn) ||
+(columnIdentifier === "countDelta" && this._searchMatchedCountDeltaColumn) ||
+(columnIdentifier === "sizeDelta" && this._searchMatchedSizeDeltaColumn))
+cell.addStyleClass("highlight");
+
+return cell;
+}
 };
 
 WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.__proto__ = WebInspector.DataGridNode.prototype;
 
 WebInspector.HeapSnapshotDataGridNode = function(snapshotView, baseEntry, snapshotEntry, owningTree)
 {
-    this.snapshotView = snapshotView;
+this.snapshotView = snapshotView;
 
-    if (!snapshotEntry)
-        snapshotEntry = { cons: baseEntry.cons, count: 0, size: 0, retainers: {} };
-    this.constructorName = snapshotEntry.cons;
-    this.count = snapshotEntry.count;
-    this.size = snapshotEntry.size;
-    this.retainers = snapshotEntry.retainers;
+if (!snapshotEntry)
+snapshotEntry = { constructorName: baseEntry.constructorName, count: 0, size: 0, retainers: {} };
+this.constructorName = snapshotEntry.constructorName;
+this.count = snapshotEntry.count;
+this.size = snapshotEntry.size;
+this.retainers = snapshotEntry.retainers;
 
-    if (!baseEntry)
-        baseEntry = { count: 0, size: 0, retainers: {} };
-    this.baseCount = baseEntry.count;
-    this.countDelta = this.count - this.baseCount;
-    this.baseSize = baseEntry.size;
-    this.sizeDelta = this.size - this.baseSize;
-    this.baseRetainers = baseEntry.retainers;
+if (!baseEntry)
+baseEntry = { count: 0, size: 0, retainers: {} };
+this.baseCount = baseEntry.count;
+this.countDelta = this.count - this.baseCount;
+this.baseSize = baseEntry.size;
+this.sizeDelta = this.size - this.baseSize;
+this.baseRetainers = baseEntry.retainers;
 
-    WebInspector.HeapSnapshotDataGridNodeWithRetainers.call(this, owningTree);
+WebInspector.HeapSnapshotDataGridNodeWithRetainers.call(this, owningTree);
 };
 
 WebInspector.HeapSnapshotDataGridNode.prototype.__proto__ = WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype;
 
 WebInspector.HeapSnapshotDataGridList = function(snapshotView, baseEntries, snapshotEntries)
 {
-    this.tree = this;
-    this.snapshotView = snapshotView;
-    this.children = [];
-    this.lastComparator = null;
-    this.populateChildren(baseEntries, snapshotEntries);
+this.tree = this;
+this.snapshotView = snapshotView;
+this.children = [];
+this.lastComparator = null;
+this.populateChildren(baseEntries, snapshotEntries);
 };
 
 WebInspector.HeapSnapshotDataGridList.prototype = {
-    appendChild: function(child)
-    {
-        this.insertChild(child, this.children.length);
-    },
+appendChild: function(child)
+{
+this.insertChild(child, this.children.length);
+},
 
-    insertChild: function(child, index)
-    {
-        this.children.splice(index, 0, child);
-    },
+insertChild: function(child, index)
+{
+this.children.splice(index, 0, child);
+},
 
-    removeChildren: function()
-    {
-        this.children = [];
-    },
+removeChildren: function()
+{
+this.children = [];
+},
 
-    populateChildren: function(baseEntries, snapshotEntries)
-    {
-        var self = this;
-        this.produceDiff(baseEntries, snapshotEntries, function(baseItem, snapshotItem) {
-            self.appendChild(new WebInspector.HeapSnapshotDataGridNode(self.snapshotView, baseItem, snapshotItem, self));
-        });
-    },
+populateChildren: function(baseEntries, snapshotEntries)
+{
+function appendListEntry(baseItem, snapshotItem)
+{
+this.appendChild(new WebInspector.HeapSnapshotDataGridNode(this.snapshotView, baseItem, snapshotItem, this));
+}
+this.produceDiff(baseEntries, snapshotEntries, appendListEntry.bind(this));
+},
 
-    produceDiff: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff,
-    sort: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort,
-    getTotalCount: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount,
-    getTotalSize: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize
+produceDiff: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.produceDiff,
+sort: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.sort,
+getTotalCount: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalCount,
+getTotalSize: WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype.getTotalSize
 };
 
 WebInspector.HeapSnapshotDataGridList.propertyComparators = [{}, {}];
 
 WebInspector.HeapSnapshotDataGridList.propertyComparator = function(property, property2, isAscending)
 {
-    var propertyHash = property + "#" + property2;
-    var comparator = this.propertyComparators[(isAscending ? 1 : 0)][propertyHash];
-    if (!comparator) {
-        comparator = function(lhs, rhs) {
-            var l = lhs[property], r = rhs[property];
-            if ((l === null || r === null) && property2 !== null)
-                l = lhs[property2], r = rhs[property2];
-            var result = l < r ? -1 : (l > r ? 1 : 0);
-            return isAscending ? result : -result;
-        };
-        this.propertyComparators[(isAscending ? 1 : 0)][propertyHash] = comparator;
-    }
-    return comparator;
+var propertyHash = property + "#" + property2;
+var comparator = this.propertyComparators[(isAscending ? 1 : 0)][propertyHash];
+if (!comparator) {
+comparator = function(lhs, rhs) {
+var l = lhs[property], r = rhs[property];
+if ((l === null || r === null) && property2 !== null)
+l = lhs[property2], r = rhs[property2];
+var result = l < r ? -1 : (l > r ? 1 : 0);
+return isAscending ? result : -result;
+};
+this.propertyComparators[(isAscending ? 1 : 0)][propertyHash] = comparator;
+}
+return comparator;
 };
 
 WebInspector.HeapSnapshotDataGridRetainerNode = function(snapshotView, baseEntry, snapshotEntry, owningTree)
 {
-    this.snapshotView = snapshotView;
+this.snapshotView = snapshotView;
 
-    if (!snapshotEntry)
-        snapshotEntry = { cons: baseEntry.cons, count: 0, clusters: {} };
-    this.constructorName = snapshotEntry.cons;
-    this.count = snapshotEntry.count;
-    this.retainers = this._calculateRetainers(this.snapshotView.profile, snapshotEntry.clusters);
+if (!snapshotEntry)
+snapshotEntry = { constructorName: baseEntry.constructorName, count: 0, clusters: {} };
+this.constructorName = snapshotEntry.constructorName;
+this.count = snapshotEntry.count;
+this.retainers = this._calculateRetainers(this.snapshotView.profile, snapshotEntry.clusters);
 
-    if (!baseEntry)
-        baseEntry = { count: 0, clusters: {} };
-    this.baseCount = baseEntry.count;
-    this.countDelta = this.count - this.baseCount;
-    this.baseRetainers = this._calculateRetainers(this.snapshotView.baseSnapshot, baseEntry.clusters);
+if (!baseEntry)
+baseEntry = { count: 0, clusters: {} };
+this.baseCount = baseEntry.count;
+this.countDelta = this.count - this.baseCount;
+this.baseRetainers = this._calculateRetainers(this.snapshotView.baseSnapshot, baseEntry.clusters);
 
-    this.size = null;
-    this.sizeDelta = null;
+this.size = null;
+this.sizeDelta = null;
 
-    WebInspector.HeapSnapshotDataGridNodeWithRetainers.call(this, owningTree);
+WebInspector.HeapSnapshotDataGridNodeWithRetainers.call(this, owningTree);
 }
 
 WebInspector.HeapSnapshotDataGridRetainerNode.prototype = {
-    get sizePercent()
-    {
-        return null;
-    },
+get sizePercent()
+{
+return null;
+},
 
-    get sizeDeltaPercent()
-    {
-        return null;
-    },
+get sizeDeltaPercent()
+{
+return null;
+},
 
-    _calculateRetainers: function(snapshot, clusters) {
-        var retainers = {};
-        if (this.isEmptySet(clusters)) {
-            if (this.constructorName in snapshot.entries)
-                return snapshot.entries[this.constructorName].retainers;
-        } else {
-            // In case when an entry is retained by clusters, we need to gather up the list
-            // of retainers by merging retainers of every cluster.
-            // E.g. having such a tree:
-            //   A
-            //     Object:1  10
-            //       X       3
-            //       Y       4
-            //     Object:2  5
-            //       X       6
-            //
-            // will result in a following retainers list: X 9, Y 4.
-            for (var clusterName in clusters) {
-                if (clusterName in snapshot.clusters) {
-                    var clusterRetainers = snapshot.clusters[clusterName].retainers;
-                    for (var clusterRetainer in clusterRetainers) {
-                        var clusterRetainerEntry = clusterRetainers[clusterRetainer];
-                        if (!(clusterRetainer in retainers))
-                            retainers[clusterRetainer] = { cons: clusterRetainerEntry.cons, count: 0, clusters: {} };
-                        retainers[clusterRetainer].count += clusterRetainerEntry.count;
-                        for (var clusterRetainerCluster in clusterRetainerEntry.clusters)
-                            retainers[clusterRetainer].clusters[clusterRetainerCluster] = true;
-                    }
-                }
-            }
-        }
-        return retainers;
-    }
+_calculateRetainers: function(snapshot, clusters)
+{
+var retainers = {};
+if (this.isEmptySet(clusters)) {
+if (this.constructorName in snapshot.entries)
+return snapshot.entries[this.constructorName].retainers;
+} else {
+
+
+
+
+
+
+
+
+
+
+
+for (var clusterName in clusters) {
+if (clusterName in snapshot.clusters) {
+var clusterRetainers = snapshot.clusters[clusterName].retainers;
+for (var clusterRetainer in clusterRetainers) {
+var clusterRetainerEntry = clusterRetainers[clusterRetainer];
+if (!(clusterRetainer in retainers))
+retainers[clusterRetainer] = { constructorName: clusterRetainerEntry.constructorName, count: 0, clusters: {} };
+retainers[clusterRetainer].count += clusterRetainerEntry.count;
+for (var clusterRetainerCluster in clusterRetainerEntry.clusters)
+retainers[clusterRetainer].clusters[clusterRetainerCluster] = true;
+}
+}
+}
+}
+return retainers;
+}
 };
 
 WebInspector.HeapSnapshotDataGridRetainerNode.prototype.__proto__ = WebInspector.HeapSnapshotDataGridNodeWithRetainers.prototype;
@@ -41825,2655 +38925,4905 @@
 
 WebInspector.HeapSnapshotProfileType = function()
 {
-    WebInspector.ProfileType.call(this, WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("HEAP SNAPSHOTS"));
+WebInspector.ProfileType.call(this, WebInspector.HeapSnapshotProfileType.TypeId, WebInspector.UIString("HEAP SNAPSHOTS"));
 }
 
 WebInspector.HeapSnapshotProfileType.TypeId = "HEAP";
 
-WebInspector.HeapSnapshotProfileType.snapshots = [];
-
 WebInspector.HeapSnapshotProfileType.prototype = {
-    get buttonTooltip()
-    {
-        return WebInspector.UIString("Take heap snapshot.");
-    },
+get buttonTooltip()
+{
+return WebInspector.UIString("Take heap snapshot.");
+},
 
-    get buttonStyle()
-    {
-        return "heap-snapshot-status-bar-item status-bar-item";
-    },
+get buttonStyle()
+{
+return "heap-snapshot-status-bar-item status-bar-item";
+},
 
-    buttonClicked: function()
-    {
-        InspectorBackend.takeHeapSnapshot();
-    },
+buttonClicked: function()
+{
+InspectorBackend.takeHeapSnapshot();
+},
 
-    get welcomeMessage()
-    {
-        return WebInspector.UIString("Get a heap snapshot by pressing<br>the %s button on the status bar.");
-    },
+get welcomeMessage()
+{
+return WebInspector.UIString("Get a heap snapshot by pressing the %s button on the status bar.");
+},
 
-    createSidebarTreeElementForProfile: function(profile)
-    {
-        var element = new WebInspector.HeapSnapshotSidebarTreeElement(profile);
-        element.small = false;
-        return element;
-    },
+createSidebarTreeElementForProfile: function(profile)
+{
+return new WebInspector.ProfileSidebarTreeElement(profile, WebInspector.UIString("Snapshot %d"), "heap-snapshot-sidebar-tree-item");
+},
 
-    createView: function(profile)
-    {
-        return new WebInspector.HeapSnapshotView(WebInspector.panels.profiles, profile);
-    }
+createView: function(profile)
+{
+return new WebInspector.HeapSnapshotView(WebInspector.panels.profiles, profile);
+}
 }
 
 WebInspector.HeapSnapshotProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
 
 
-(function() {
-    var originalCreatePanels = WebInspector._createPanels;
-    WebInspector._createPanels = function() {
-        originalCreatePanels.apply(this, arguments);
-        if (WebInspector.panels.profiles)
-            WebInspector.panels.profiles.registerProfileType(new WebInspector.HeapSnapshotProfileType());
-    }
-})();
 
-/* DevTools.js */
 
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
-/**
- * FIXME: change field naming style to use trailing underscore.
- * @fileoverview Tools is a main class that wires all components of the
- * DevTools frontend together. It is also responsible for overriding existing
- * WebInspector functionality while it is getting upstreamed into WebCore.
- */
-
-/**
- * Dispatches raw message from the host.
- * @param {string} remoteName
- * @prama {string} methodName
- * @param {string} param1, param2, param3 Arguments to dispatch.
- */
-devtools$$dispatch = function(remoteName, methodName, param1, param2, param3)
+WebInspector.DebuggerModel = function()
 {
-    remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8);
-    var agent = window[remoteName];
-    if (!agent) {
-        debugPrint("No remote agent '" + remoteName + "' found.");
-        return;
-    }
-    var method = agent[methodName];
-    if (!method) {
-        debugPrint("No method '" + remoteName + "." + methodName + "' found.");
-        return;
-    }
-    method.call(this, param1, param2, param3);
+this._breakpoints = {};
+}
+
+WebInspector.DebuggerModel.prototype = {
+setOneTimeBreakpoint: function(sourceID, line)
+{
+var breakpoint = new WebInspector.Breakpoint(this, sourceID, undefined, line, true, undefined);
+if (this._breakpoints[breakpoint.id])
+return;
+if (this._oneTimeBreakpoint)
+InspectorBackend.removeBreakpoint(this._oneTimeBreakpoint.sourceID, this._oneTimeBreakpoint.line);
+this._oneTimeBreakpoint = breakpoint;
+
+this._setBreakpointOnBackend(breakpoint, true);
+},
+
+removeOneTimeBreakpoint: function()
+{
+if (this._oneTimeBreakpoint) {
+InspectorBackend.removeBreakpoint(this._oneTimeBreakpoint.sourceID, this._oneTimeBreakpoint.line);
+delete this._oneTimeBreakpoint;
+}
+},
+
+setBreakpoint: function(sourceID, url, line, enabled, condition)
+{
+var breakpoint = this._setBreakpoint(sourceID, url, line, enabled, condition);
+if (breakpoint)
+this._setBreakpointOnBackend(breakpoint);
+},
+
+breakpointRestored: function(sourceID, url, line, enabled, condition)
+{
+this._setBreakpoint(sourceID, url, line, enabled, condition);
+},
+
+findBreakpoints: function(filter)
+{
+var breakpoints = [];
+for (var id in this._breakpoints) {
+var breakpoint = this._breakpoints[id];
+if (filter(breakpoint))
+breakpoints.push(breakpoint);
+}
+return breakpoints;
+},
+
+findBreakpoint: function(sourceID, lineNumber)
+{
+var breakpointId = WebInspector.Breakpoint.jsBreakpointId(sourceID, lineNumber);
+return this._breakpoints[breakpointId];
+},
+
+reset: function()
+{
+this._breakpoints = {};
+delete this._oneTimeBreakpoint;
+},
+
+_setBreakpoint: function(sourceID, url, line, enabled, condition)
+{
+var breakpoint = new WebInspector.Breakpoint(this, sourceID, url, line, enabled, condition);
+if (this._breakpoints[breakpoint.id])
+return;
+if (this._oneTimeBreakpoint && (this._oneTimeBreakpoint.id == breakpoint.id))
+delete this._oneTimeBreakpoint;
+this._breakpoints[breakpoint.id] = breakpoint;
+breakpoint.addEventListener("removed", this._breakpointRemoved, this);
+this.dispatchEventToListeners("breakpoint-added", breakpoint);
+return breakpoint;
+},
+
+_breakpointRemoved: function(event)
+{
+delete this._breakpoints[event.target.id];
+},
+
+_setBreakpointOnBackend: function(breakpoint, isOneTime)
+{
+function didSetBreakpoint(success, line)
+{
+if (success && line == breakpoint.line)
+return;
+if (isOneTime) {
+if (success)
+this._oneTimeBreakpoint.line = line;
+else
+delete this._oneTimeBreakpoint;
+} else {
+breakpoint.remove();
+if (success)
+this._setBreakpoint(breakpoint.sourceID, breakpoint.url, line, breakpoint.enabled, breakpoint.condition);
+}
+}
+InspectorBackend.setBreakpoint(breakpoint.sourceID, breakpoint.line, breakpoint.enabled, breakpoint.condition, didSetBreakpoint.bind(this));
+},
+
+debuggerPaused: function(details)
+{
+this.dispatchEventToListeners("debugger-paused", details.callFrames);
+
+if (details.eventType === WebInspector.DebuggerEventTypes.JavaScriptPause)
+return;
+if (details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint) {
+var breakpointId = details.eventData.breakpointId;
+this.dispatchEventToListeners("native-breakpoint-hit", { breakpointId: breakpointId, eventData: details.eventData });
+return;
+}
+
+var breakpointId = WebInspector.Breakpoint.jsBreakpointId(details.callFrames[0].sourceID, details.callFrames[0].line);
+var breakpoint = this._breakpoints[breakpointId];
+if (!breakpoint)
+return;
+breakpoint.hit = true;
+this._lastHitBreakpoint = breakpoint;
+this.dispatchEventToListeners("script-breakpoint-hit", breakpoint);
+},
+
+debuggerResumed: function()
+{
+this.dispatchEventToListeners("debugger-resumed");
+
+if (!this._lastHitBreakpoint)
+return;
+this._lastHitBreakpoint.hit = false;
+delete this._lastHitBreakpoint;
+}
+}
+
+WebInspector.DebuggerModel.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.DebuggerEventTypes = {
+JavaScriptPause: 0,
+JavaScriptBreakpoint: 1,
+NativeBreakpoint: 2
 };
 
 
-devtools.ToolsAgent = function()
+
+
+
+WebInspector.DOMNode = function(doc, payload) {
+this.ownerDocument = doc;
+
+this.id = payload.id;
+this.nodeType = payload.nodeType;
+this.nodeName = payload.nodeName;
+this.localName = payload.localName;
+this._nodeValue = payload.nodeValue;
+this.textContent = this.nodeValue;
+
+this.attributes = [];
+this._attributesMap = {};
+if (payload.attributes)
+this._setAttributesPayload(payload.attributes);
+
+this._childNodeCount = payload.childNodeCount;
+this.children = null;
+
+this.nextSibling = null;
+this.prevSibling = null;
+this.firstChild = null;
+this.lastChild = null;
+this.parentNode = null;
+
+if (payload.children)
+this._setChildrenPayload(payload.children);
+
+this._computedStyle = null;
+this.style = null;
+this._matchedCSSRules = [];
+
+this.breakpoints = {};
+
+if (this.nodeType === Node.ELEMENT_NODE) {
+
+if (!this.ownerDocument.documentElement && this.nodeName === "HTML")
+this.ownerDocument.documentElement = this;
+if (!this.ownerDocument.body && this.nodeName === "BODY")
+this.ownerDocument.body = this;
+if (payload.documentURL)
+this.documentURL = payload.documentURL;
+} else if (this.nodeType === Node.DOCUMENT_TYPE_NODE) {
+this.publicId = payload.publicId;
+this.systemId = payload.systemId;
+this.internalSubset = payload.internalSubset;
+} else if (this.nodeType === Node.DOCUMENT_NODE) {
+this.documentURL = payload.documentURL;
+} else if (this.nodeType === Node.ATTRIBUTE_NODE) {
+this.name = payload.name;
+this.value = payload.value;
+}
+}
+
+WebInspector.DOMNode.prototype = {
+hasAttributes: function()
 {
-    RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback;
-    RemoteToolsAgent.frameNavigate = this.frameNavigate_.bind(this);
-    RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this);
-    this.debuggerAgent_ = new devtools.DebuggerAgent();
-    this.profilerAgent_ = new devtools.ProfilerAgent();
-};
+return this.attributes.length > 0;
+},
 
-
-/**
- * Resets tools agent to its initial state.
- */
-devtools.ToolsAgent.prototype.reset = function()
+hasChildNodes: function()
 {
-    this.debuggerAgent_.reset();
-};
+return this._childNodeCount > 0;
+},
 
+get nodeValue() {
+return this._nodeValue;
+},
 
-/**
- * @param {string} script Script exression to be evaluated in the context of the
- *     inspected page.
- * @param {function(Object|string, boolean):undefined} opt_callback Function to
- *     call with the result.
- */
-devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback)
+set nodeValue(value) {
+if (this.nodeType != Node.TEXT_NODE)
+return;
+this.ownerDocument._domAgent.setTextNodeValueAsync(this, value, function() {});
+},
+
+getAttribute: function(name)
 {
-    InspectorBackend.evaluate(script, opt_callback || function() {});
-};
+var attr = this._attributesMap[name];
+return attr ? attr.value : undefined;
+},
 
-
-/**
- * @return {devtools.DebuggerAgent} Debugger agent instance.
- */
-devtools.ToolsAgent.prototype.getDebuggerAgent = function()
+setAttribute: function(name, value)
 {
-    return this.debuggerAgent_;
-};
-
-
-/**
- * @return {devtools.ProfilerAgent} Profiler agent instance.
- */
-devtools.ToolsAgent.prototype.getProfilerAgent = function()
+var self = this;
+var callback = function()
 {
-    return this.profilerAgent_;
+var attr = self._attributesMap[name];
+if (attr)
+attr.value = value;
+else
+attr = self._addAttribute(name, value);
 };
+this.ownerDocument._domAgent.setAttributeAsync(this, name, value, callback);
+},
 
-
-/**
- * @param {string} url Url frame navigated to.
- * @see tools_agent.h
- * @private
- */
-devtools.ToolsAgent.prototype.frameNavigate_ = function(url)
+removeAttribute: function(name)
 {
-    this.reset();
-    // Do not reset Profiles panel.
-    var profiles = null;
-    if ("profiles" in WebInspector.panels) {
-        profiles = WebInspector.panels["profiles"];
-        delete WebInspector.panels["profiles"];
-    }
-    WebInspector.reset();
-    if (profiles !== null)
-        WebInspector.panels["profiles"] = profiles;
-};
-
-
-/**
- * @param {string} message Serialized call to be dispatched on WebInspector.
- * @private
- */
-devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message)
+var self = this;
+var callback = function()
 {
-    var args = JSON.parse(message);
-    var methodName = args[0];
-    var parameters = args.slice(1);
-    WebInspector[methodName].apply(WebInspector, parameters);
+delete self._attributesMap[name];
+for (var i = 0;  i < self.attributes.length; ++i) {
+if (self.attributes[i].name == name) {
+self.attributes.splice(i, 1);
+break;
+}
+}
 };
+this.ownerDocument._domAgent.removeAttributeAsync(this, name, callback);
+},
 
-
-/**
- * Evaluates js expression.
- * @param {string} expr
- */
-devtools.ToolsAgent.prototype.evaluate = function(expr)
+path: function()
 {
-    RemoteToolsAgent.evaluate(expr);
+var path = [];
+var node = this;
+while (node && "index" in node && node.nodeName.length) {
+path.push([node.index, node.nodeName]);
+node = node.parentNode;
+}
+path.reverse();
+return path.join(",");
+},
+
+_setAttributesPayload: function(attrs)
+{
+this.attributes = [];
+this._attributesMap = {};
+for (var i = 0; i < attrs.length; i += 2)
+this._addAttribute(attrs[i], attrs[i + 1]);
+},
+
+_insertChild: function(prev, payload)
+{
+var node = new WebInspector.DOMNode(this.ownerDocument, payload);
+if (!prev) {
+if (!this.children) {
+
+this.children = [ node ];
+} else
+this.children.unshift(node);
+} else
+this.children.splice(this.children.indexOf(prev) + 1, 0, node);
+this._renumber();
+return node;
+},
+
+removeChild_: function(node)
+{
+this.children.splice(this.children.indexOf(node), 1);
+node.parentNode = null;
+this._renumber();
+},
+
+_setChildrenPayload: function(payloads)
+{
+this.children = [];
+for (var i = 0; i < payloads.length; ++i) {
+var payload = payloads[i];
+var node = new WebInspector.DOMNode(this.ownerDocument, payload);
+this.children.push(node);
+}
+this._renumber();
+},
+
+_renumber: function()
+{
+this._childNodeCount = this.children.length;
+if (this._childNodeCount == 0) {
+this.firstChild = null;
+this.lastChild = null;
+return;
+}
+this.firstChild = this.children[0];
+this.lastChild = this.children[this._childNodeCount - 1];
+for (var i = 0; i < this._childNodeCount; ++i) {
+var child = this.children[i];
+child.index = i;
+child.nextSibling = i + 1 < this._childNodeCount ? this.children[i + 1] : null;
+child.prevSibling = i - 1 >= 0 ? this.children[i - 1] : null;
+child.parentNode = this;
+}
+},
+
+_addAttribute: function(name, value)
+{
+var attr = {
+"name": name,
+"value": value,
+"_node": this
 };
+this._attributesMap[name] = attr;
+this.attributes.push(attr);
+}
+}
+
+WebInspector.DOMDocument = function(domAgent, defaultView, payload)
+{
+WebInspector.DOMNode.call(this, this, payload);
+this._listeners = {};
+this._domAgent = domAgent;
+this.defaultView = defaultView;
+}
+
+WebInspector.DOMDocument.prototype = {
+
+addEventListener: function(name, callback)
+{
+var listeners = this._listeners[name];
+if (!listeners) {
+listeners = [];
+this._listeners[name] = listeners;
+}
+listeners.push(callback);
+},
+
+removeEventListener: function(name, callback)
+{
+var listeners = this._listeners[name];
+if (!listeners)
+return;
+
+var index = listeners.indexOf(callback);
+if (index != -1)
+listeners.splice(index, 1);
+},
+
+_fireDomEvent: function(name, event)
+{
+var listeners = this._listeners[name];
+if (!listeners)
+return;
+
+for (var i = 0; i < listeners.length; ++i) {
+var listener = listeners[i];
+listener.call(this, event);
+}
+}
+}
+
+WebInspector.DOMDocument.prototype.__proto__ = WebInspector.DOMNode.prototype;
 
 
-/**
- * Prints string  to the inspector console or shows alert if the console doesn't
- * exist.
- * @param {string} text
- */
-function debugPrint(text) {
-    WebInspector.log(text);
+WebInspector.DOMWindow = function(domAgent)
+{
+this._domAgent = domAgent;
+}
+
+WebInspector.DOMWindow.prototype = {
+get document()
+{
+return this._domAgent.document;
+},
+
+get Node()
+{
+return WebInspector.DOMNode;
+},
+
+get Element()
+{
+return WebInspector.DOMNode;
+},
+
+Object: function()
+{
+}
+}
+
+WebInspector.DOMAgent = function() {
+this._window = new WebInspector.DOMWindow(this);
+this._idToDOMNode = null;
+this.document = null;
+InspectorBackend.registerDomainDispatcher("DOM", this);
+}
+
+WebInspector.DOMAgent.prototype = {
+get domWindow()
+{
+return this._window;
+},
+
+getChildNodesAsync: function(parent, callback)
+{
+var children = parent.children;
+if (children) {
+callback(children);
+return;
+}
+function mycallback() {
+callback(parent.children);
+}
+InspectorBackend.getChildNodes(parent.id, mycallback);
+},
+
+setAttributeAsync: function(node, name, value, callback)
+{
+var mycallback = this._didApplyDomChange.bind(this, node, callback);
+InspectorBackend.setAttribute(node.id, name, value, mycallback);
+},
+
+removeAttributeAsync: function(node, name, callback)
+{
+var mycallback = this._didApplyDomChange.bind(this, node, callback);
+InspectorBackend.removeAttribute(node.id, name, mycallback);
+},
+
+setTextNodeValueAsync: function(node, text, callback)
+{
+var mycallback = this._didApplyDomChange.bind(this, node, callback);
+InspectorBackend.setTextNodeValue(node.id, text, mycallback);
+},
+
+_didApplyDomChange: function(node, callback, success)
+{
+if (!success)
+return;
+callback();
+
+var elem = WebInspector.panels.elements.treeOutline.findTreeElement(node);
+if (elem)
+elem.updateTitle();
+},
+
+attributesUpdated: function(nodeId, attrsArray)
+{
+var node = this._idToDOMNode[nodeId];
+node._setAttributesPayload(attrsArray);
+var event = {target: node};
+this.document._fireDomEvent("DOMAttrModified", event);
+},
+
+characterDataModified: function(nodeId, newValue)
+{
+var node = this._idToDOMNode[nodeId];
+node._nodeValue = newValue;
+node.textContent = newValue;
+var event = { target : node };
+this.document._fireDomEvent("DOMCharacterDataModified", event);
+},
+
+nodeForId: function(nodeId)
+{
+return this._idToDOMNode[nodeId];
+},
+
+setDocument: function(payload)
+{
+this._idToDOMNode = {};
+if (payload && "id" in payload) {
+this.document = new WebInspector.DOMDocument(this, this._window, payload);
+this._idToDOMNode[payload.id] = this.document;
+this._bindNodes(this.document.children);
+WebInspector.breakpointManager.restoreDOMBreakpoints();
+} else
+this.document = null;
+WebInspector.panels.elements.setDocument(this.document);
+},
+
+setDetachedRoot: function(payload)
+{
+var root = new WebInspector.DOMNode(this.document, payload);
+this._idToDOMNode[payload.id] = root;
+},
+
+setChildNodes: function(parentId, payloads)
+{
+var parent = this._idToDOMNode[parentId];
+parent._setChildrenPayload(payloads);
+this._bindNodes(parent.children);
+},
+
+_bindNodes: function(children)
+{
+for (var i = 0; i < children.length; ++i) {
+var child = children[i];
+this._idToDOMNode[child.id] = child;
+if (child.children)
+this._bindNodes(child.children);
+}
+},
+
+childNodeCountUpdated: function(nodeId, newValue)
+{
+var node = this._idToDOMNode[nodeId];
+node._childNodeCount = newValue;
+var outline = WebInspector.panels.elements.treeOutline;
+var treeElement = outline.findTreeElement(node);
+if (treeElement)
+treeElement.hasChildren = newValue;
+},
+
+childNodeInserted: function(parentId, prevId, payload)
+{
+var parent = this._idToDOMNode[parentId];
+var prev = this._idToDOMNode[prevId];
+var node = parent._insertChild(prev, payload);
+this._idToDOMNode[node.id] = node;
+var event = { target : node, relatedNode : parent };
+this.document._fireDomEvent("DOMNodeInserted", event);
+},
+
+childNodeRemoved: function(parentId, nodeId)
+{
+var parent = this._idToDOMNode[parentId];
+var node = this._idToDOMNode[nodeId];
+parent.removeChild_(node);
+var event = { target : node, relatedNode : parent };
+this.document._fireDomEvent("DOMNodeRemoved", event);
+delete this._idToDOMNode[nodeId];
+this._removeBreakpoints(node);
+},
+
+_removeBreakpoints: function(node)
+{
+for (var type in node.breakpoints)
+node.breakpoints[type].remove();
+if (!node.children)
+return;
+for (var i = 0; i < node.children.length; ++i)
+this._removeBreakpoints(node.children[i]);
+}
+}
+
+WebInspector.ApplicationCache = {}
+
+WebInspector.ApplicationCache.getApplicationCachesAsync = function(callback)
+{
+function mycallback(applicationCaches)
+{
+
+if (applicationCaches)
+callback(applicationCaches);
+}
+
+InspectorBackend.getApplicationCaches(mycallback);
+}
+
+WebInspector.Cookies = {}
+
+WebInspector.Cookies.getCookiesAsync = function(callback)
+{
+function mycallback(cookies, cookiesString)
+{
+if (cookiesString)
+callback(WebInspector.Cookies.buildCookiesFromString(cookiesString), false);
+else
+callback(cookies, true);
+}
+
+InspectorBackend.getCookies(mycallback);
+}
+
+WebInspector.Cookies.buildCookiesFromString = function(rawCookieString)
+{
+var rawCookies = rawCookieString.split(/;\s*/);
+var cookies = [];
+
+if (!(/^\s*$/.test(rawCookieString))) {
+for (var i = 0; i < rawCookies.length; ++i) {
+var cookie = rawCookies[i];
+var delimIndex = cookie.indexOf("=");
+var name = cookie.substring(0, delimIndex);
+var value = cookie.substring(delimIndex + 1);
+var size = name.length + value.length;
+cookies.push({ name: name, value: value, size: size });
+}
+}
+
+return cookies;
+}
+
+WebInspector.Cookies.cookieMatchesResourceURL = function(cookie, resourceURL)
+{
+var url = resourceURL.asParsedURL();
+if (!url || !this.cookieDomainMatchesResourceDomain(cookie.domain, url.host))
+return false;
+return (url.path.indexOf(cookie.path) === 0
+&& (!cookie.port || url.port == cookie.port)
+&& (!cookie.secure || url.scheme === "https"));
+}
+
+WebInspector.Cookies.cookieDomainMatchesResourceDomain = function(cookieDomain, resourceDomain)
+{
+if (cookieDomain.charAt(0) !== '.')
+return resourceDomain === cookieDomain;
+return !!resourceDomain.match(new RegExp("^([^\\.]+\\.)?" + cookieDomain.substring(1).escapeForRegExp() + "$"), "i");
+}
+
+WebInspector.EventListeners = {}
+
+WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callback)
+{
+if (!node)
+return;
+InspectorBackend.getEventListenersForNode(node.id, callback);
 }
 
 
-/**
- * Global instance of the tools agent.
- * @type {devtools.ToolsAgent}
- */
-devtools.tools = null;
 
 
-var context = {};  // Used by WebCore's inspector routines.
 
-///////////////////////////////////////////////////////////////////////////////
-// Here and below are overrides to existing WebInspector methods only.
-// TODO(pfeldman): Patch WebCore and upstream changes.
-var oldLoaded = WebInspector.loaded;
-WebInspector.loaded = function()
+var injectedScriptConstructor = (function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
+
+var InjectedScript = function()
 {
-    devtools.tools = new devtools.ToolsAgent();
-    devtools.tools.reset();
+this._lastBoundObjectId = 1;
+this._idToWrappedObject = {};
+this._objectGroups = {};
+}
 
-    Preferences.ignoreWhitespace = false;
-    Preferences.samplingCPUProfiler = true;
-    Preferences.heapProfilerPresent = true;
-    Preferences.debuggerAlwaysEnabled = true;
-    Preferences.profilerAlwaysEnabled = true;
-    oldLoaded.call(this);
+InjectedScript.prototype = {
+wrapObjectForConsole: function(object, canAccessInspectedWindow)
+{
+if (canAccessInspectedWindow)
+return this._wrapObject(object, "console");
+var result = {};
+result.type = typeof object;
+result.description = this._toString(object);
+return result;
+},
 
-    InspectorFrontendHost.loaded();
+_wrapObject: function(object, objectGroupName, abbreviate)
+{
+try {
+var objectId;
+if (typeof object === "object" || typeof object === "function" || this._isHTMLAllCollection(object)) {
+var id = this._lastBoundObjectId++;
+this._idToWrappedObject[id] = object;
+
+var group = this._objectGroups[objectGroupName];
+if (!group) {
+group = [];
+this._objectGroups[objectGroupName] = group;
+}
+group.push(id);
+objectId = this._serializeObjectId(id, objectGroupName);
+}
+return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate);
+} catch (e) {
+return InjectedScript.RemoteObject.fromObject("[ Exception: " + e.toString() + " ]");
+}
+},
+
+_serializeObjectId: function(id, groupName)
+{
+return injectedScriptId + ":" + id + ":" + groupName;
+},
+
+_parseObjectId: function(objectId)
+{
+var tokens = objectId.split(":");
+var parsedObjectId = {};
+parsedObjectId.id = parseInt(tokens[1]);
+parsedObjectId.groupName = tokens[2];
+return parsedObjectId;
+},
+
+releaseWrapperObjectGroup: function(objectGroupName)
+{
+var group = this._objectGroups[objectGroupName];
+if (!group)
+return;
+for (var i = 0; i < group.length; i++)
+delete this._idToWrappedObject[group[i]];
+delete this._objectGroups[objectGroupName];
+},
+
+dispatch: function(methodName, args)
+{
+var argsArray = eval("(" + args + ")");
+var result = this[methodName].apply(this, argsArray);
+if (typeof result === "undefined") {
+inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName);
+result = null;
+}
+return result;
+},
+
+getPrototypes: function(nodeId)
+{
+this.releaseWrapperObjectGroup("prototypes");
+var node = this._nodeForId(nodeId);
+if (!node)
+return false;
+
+var result = [];
+var prototype = node;
+do {
+result.push(this._wrapObject(prototype, "prototypes"));
+prototype = prototype.__proto__;
+} while (prototype)
+return result;
+},
+
+getProperties: function(objectId, ignoreHasOwnProperty, abbreviate)
+{
+var parsedObjectId = this._parseObjectId(objectId);
+var object = this._objectForId(parsedObjectId);
+if (!this._isDefined(object))
+return false;
+var properties = [];
+
+var propertyNames = ignoreHasOwnProperty ? this._getPropertyNames(object) : Object.getOwnPropertyNames(object);
+if (!ignoreHasOwnProperty && object.__proto__)
+propertyNames.push("__proto__");
+
+
+for (var i = 0; i < propertyNames.length; ++i) {
+var propertyName = propertyNames[i];
+
+var property = {};
+property.name = propertyName + "";
+var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
+if (!isGetter) {
+try {
+property.value = this._wrapObject(object[propertyName], parsedObjectId.groupName, abbreviate);
+} catch(e) {
+property.value = new InjectedScript.RemoteObject.fromException(e);
+}
+} else {
+
+property.value = new InjectedScript.RemoteObject.fromObject("\u2014"); 
+property.isGetter = true;
+}
+properties.push(property);
+}
+return properties;
+},
+
+setPropertyValue: function(objectId, propertyName, expression)
+{
+var parsedObjectId = this._parseObjectId(objectId);
+var object = this._objectForId(parsedObjectId);
+if (!this._isDefined(object))
+return false;
+
+var expressionLength = expression.length;
+if (!expressionLength) {
+delete object[propertyName];
+return !(propertyName in object);
+}
+
+try {
+
+
+
+
+
+
+var result = inspectedWindow.eval("(" + expression + ")");
+
+object[propertyName] = result;
+return true;
+} catch(e) {
+try {
+var result = inspectedWindow.eval("\"" + expression.replace(/"/g, "\\\"") + "\"");
+object[propertyName] = result;
+return true;
+} catch(e) {
+return false;
+}
+}
+},
+
+_populatePropertyNames: function(object, resultSet)
+{
+for (var o = object; o; o = o.__proto__) {
+try {
+var names = Object.getOwnPropertyNames(o);
+for (var i = 0; i < names.length; ++i)
+resultSet[names[i]] = true;
+} catch (e) {
+}
+}
+},
+
+_getPropertyNames: function(object, resultSet)
+{
+var propertyNameSet = {};
+this._populatePropertyNames(object, propertyNameSet);
+return Object.keys(propertyNameSet);
+},
+
+getCompletions: function(expression, includeInspectorCommandLineAPI, callFrameId)
+{
+var props = {};
+try {
+var expressionResult;
+
+if (typeof callFrameId === "number") {
+var callFrame = this._callFrameForId(callFrameId);
+if (!callFrame)
+return props;
+if (expression)
+expressionResult = this._evaluateOn(callFrame.evaluate, callFrame, expression, true);
+else {
+
+var scopeChain = callFrame.scopeChain;
+for (var i = 0; i < scopeChain.length; ++i)
+this._populatePropertyNames(scopeChain[i], props);
+}
+} else {
+if (!expression)
+expression = "this";
+expressionResult = this._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false);
+}
+if (typeof expressionResult === "object")
+this._populatePropertyNames(expressionResult, props);
+
+if (includeInspectorCommandLineAPI) {
+for (var prop in this._commandLineAPI)
+props[prop] = true;
+}
+} catch(e) {
+}
+return props;
+},
+
+evaluate: function(expression, objectGroup)
+{
+return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false);
+},
+
+_evaluateAndWrap: function(evalFunction, object, expression, objectGroup, isEvalOnCallFrame)
+{
+try {
+return this._wrapObject(this._evaluateOn(evalFunction, object, expression, isEvalOnCallFrame), objectGroup);
+} catch (e) {
+return InjectedScript.RemoteObject.fromException(e);
+}
+},
+
+_evaluateOn: function(evalFunction, object, expression, isEvalOnCallFrame)
+{
+
+
+
+inspectedWindow.console._commandLineAPI = this._commandLineAPI;
+
+
+if (!isEvalOnCallFrame)
+expression = "with (window) {\n" + expression + "\n} ";
+expression = "with (window ? window.console._commandLineAPI : {}) {\n" + expression + "\n}";
+var value = evalFunction.call(object, expression);
+
+delete inspectedWindow.console._commandLineAPI;
+
+
+if (this._type(value) === "error")
+throw value.toString();
+
+return value;
+},
+
+getNodeId: function(node)
+{
+return InjectedScriptHost.pushNodePathToFrontend(node, false, false);
+},
+
+callFrames: function()
+{
+var callFrame = InjectedScriptHost.currentCallFrame();
+if (!callFrame)
+return false;
+
+injectedScript.releaseWrapperObjectGroup("backtrace");
+var result = [];
+var depth = 0;
+do {
+result.push(new InjectedScript.CallFrameProxy(depth++, callFrame));
+callFrame = callFrame.caller;
+} while (callFrame);
+return result;
+},
+
+evaluateInCallFrame: function(callFrameId, code, objectGroup)
+{
+var callFrame = this._callFrameForId(callFrameId);
+if (!callFrame)
+return false;
+return this._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup, true);
+},
+
+_callFrameForId: function(id)
+{
+var callFrame = InjectedScriptHost.currentCallFrame();
+while (--id >= 0 && callFrame)
+callFrame = callFrame.caller;
+return callFrame;
+},
+
+_nodeForId: function(nodeId)
+{
+if (!nodeId)
+return null;
+return InjectedScriptHost.nodeForId(nodeId);
+},
+
+_objectForId: function(parsedObjectId)
+{
+return this._idToWrappedObject[parsedObjectId.id];
+},
+
+resolveNode: function(nodeId)
+{
+var node = this._nodeForId(nodeId);
+if (!node)
+return false;
+
+return this._wrapObject(node, "prototype");
+},
+
+getNodeProperties: function(nodeId, properties)
+{
+var node = this._nodeForId(nodeId);
+if (!node)
+return false;
+var result = {};
+for (var i = 0; i < properties.length; ++i)
+result[properties[i]] = node[properties[i]];
+return result;
+},
+
+pushNodeToFrontend: function(objectId)
+{
+var parsedObjectId = this._parseObjectId(objectId);
+var object = this._objectForId(parsedObjectId);
+if (!object || this._type(object) !== "node")
+return false;
+return InjectedScriptHost.pushNodePathToFrontend(object, false, false);
+},
+
+evaluateOnSelf: function(funcBody, args)
+{
+var func = window.eval("(" + funcBody + ")");
+return func.apply(this, args || []);
+},
+
+_isDefined: function(object)
+{
+return object || this._isHTMLAllCollection(object);
+},
+
+_isHTMLAllCollection: function(object)
+{
+
+return (typeof object === "undefined") && inspectedWindow.HTMLAllCollection && object instanceof inspectedWindow.HTMLAllCollection;
+},
+
+_type: function(obj)
+{
+if (obj === null)
+return "null";
+
+var type = typeof obj;
+if (type !== "object" && type !== "function") {
+
+if (this._isHTMLAllCollection(obj))
+return "array";
+return type;
+}
+
+
+
+if (!inspectedWindow.document)
+return type;
+
+if (obj instanceof inspectedWindow.Node)
+return (obj.nodeType === undefined ? type : "node");
+if (obj instanceof inspectedWindow.String)
+return "string";
+if (obj instanceof inspectedWindow.Array)
+return "array";
+if (obj instanceof inspectedWindow.Boolean)
+return "boolean";
+if (obj instanceof inspectedWindow.Number)
+return "number";
+if (obj instanceof inspectedWindow.Date)
+return "date";
+if (obj instanceof inspectedWindow.RegExp)
+return "regexp";
+
+if (isFinite(obj.length) && typeof obj.splice === "function")
+return "array";
+if (isFinite(obj.length) && typeof obj.callee === "function") 
+return "array";
+if (obj instanceof inspectedWindow.NodeList)
+return "array";
+if (obj instanceof inspectedWindow.HTMLCollection)
+return "array";
+if (obj instanceof inspectedWindow.Error)
+return "error";
+return type;
+},
+
+_describe: function(obj, abbreviated)
+{
+var type = this._type(obj);
+
+switch (type) {
+case "object":
+case "node":
+var result = InjectedScriptHost.internalConstructorName(obj);
+if (result === "Object") {
+
+
+var constructorName = obj.constructor && obj.constructor.name;
+if (constructorName)
+return constructorName;
+}
+return result;
+case "array":
+var className = InjectedScriptHost.internalConstructorName(obj);
+if (typeof obj.length === "number")
+className += "[" + obj.length + "]";
+return className;
+case "string":
+if (!abbreviated)
+return obj;
+if (obj.length > 100)
+return "\"" + obj.substring(0, 100) + "\u2026\"";
+return "\"" + obj + "\"";
+case "function":
+var objectText = this._toString(obj);
+if (abbreviated)
+objectText = /.*/.exec(objectText)[0].replace(/ +$/g, "");
+return objectText;
+default:
+return this._toString(obj);
+}
+},
+
+_toString: function(obj)
+{
+
+return "" + obj;
+},
+
+_logEvent: function(event)
+{
+console.log(event.type, event);
+},
+
+_normalizeEventTypes: function(types)
+{
+if (typeof types === "undefined")
+types = [ "mouse", "key", "load", "unload", "abort", "error", "select", "change", "submit", "reset", "focus", "blur", "resize", "scroll" ];
+else if (typeof types === "string")
+types = [ types ];
+
+var result = [];
+for (var i = 0; i < types.length; i++) {
+if (types[i] === "mouse")
+result.splice(0, 0, "mousedown", "mouseup", "click", "dblclick", "mousemove", "mouseover", "mouseout");
+else if (types[i] === "key")
+result.splice(0, 0, "keydown", "keyup", "keypress");
+else
+result.push(types[i]);
+}
+return result;
+},
+
+_inspectedNode: function(num)
+{
+var nodeId = InjectedScriptHost.inspectedNode(num);
+return this._nodeForId(nodeId);
+},
+
+_bindToScript: function(func)
+{
+var args = Array.prototype.slice.call(arguments, 1);
+function bound()
+{
+return func.apply(injectedScript, args.concat(Array.prototype.slice.call(arguments)));
+}
+bound.toString = function() {
+return "bound: " + func;
+};
+return bound;
+}
+}
+
+var injectedScript = new InjectedScript();
+
+InjectedScript.RemoteObject = function(objectId, type, description, hasChildren)
+{
+this.objectId = objectId;
+this.type = type;
+this.description = description;
+this.hasChildren = hasChildren;
+}
+
+InjectedScript.RemoteObject.fromException = function(e)
+{
+return new InjectedScript.RemoteObject(null, "error", e.toString());
+}
+
+InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate)
+{
+var type = injectedScript._type(object);
+var rawType = typeof object;
+var hasChildren = (rawType === "object" && object !== null && (Object.getOwnPropertyNames(object).length || !!object.__proto__)) || rawType === "function";
+var description = "";
+try {
+var description = injectedScript._describe(object, abbreviate);
+return new InjectedScript.RemoteObject(objectId, type, description, hasChildren);
+} catch (e) {
+return InjectedScript.RemoteObject.fromException(e);
+}
+}
+
+InjectedScript.CallFrameProxy = function(id, callFrame)
+{
+this.id = id;
+this.type = callFrame.type;
+this.functionName = (this.type === "function" ? callFrame.functionName : "");
+this.sourceID = callFrame.sourceID;
+this.line = callFrame.line;
+this.scopeChain = this._wrapScopeChain(callFrame);
+this.worldId = injectedScriptId;
+}
+
+InjectedScript.CallFrameProxy.prototype = {
+_wrapScopeChain: function(callFrame)
+{
+const GLOBAL_SCOPE = 0;
+const LOCAL_SCOPE = 1;
+const WITH_SCOPE = 2;
+const CLOSURE_SCOPE = 3;
+const CATCH_SCOPE = 4;
+
+var scopeChain = callFrame.scopeChain;
+var scopeChainProxy = [];
+var foundLocalScope = false;
+for (var i = 0; i < scopeChain.length; i++) {
+var scopeType = callFrame.scopeType(i);
+var scopeObject = scopeChain[i];
+var scopeObjectProxy = injectedScript._wrapObject(scopeObject, "backtrace", true);
+
+switch(scopeType) {
+case LOCAL_SCOPE: {
+foundLocalScope = true;
+scopeObjectProxy.isLocal = true;
+scopeObjectProxy.thisObject = injectedScript._wrapObject(callFrame.thisObject, "backtrace", true);
+break;
+}
+case CLOSURE_SCOPE: {
+scopeObjectProxy.isClosure = true;
+break;
+}
+case WITH_SCOPE:
+case CATCH_SCOPE: {
+if (foundLocalScope && scopeObject instanceof inspectedWindow.Element)
+scopeObjectProxy.isElement = true;
+else if (foundLocalScope && scopeObject instanceof inspectedWindow.Document)
+scopeObjectProxy.isDocument = true;
+else
+scopeObjectProxy.isWithBlock = true;
+break;
+}
+}
+scopeChainProxy.push(scopeObjectProxy);
+}
+return scopeChainProxy;
+}
+}
+
+function CommandLineAPI()
+{
+for (var i = 0; i < 5; ++i)
+this.__defineGetter__("$" + i, injectedScript._bindToScript(injectedScript._inspectedNode, i));
+}
+
+CommandLineAPI.prototype = {
+
+
+$: function()
+{
+return document.getElementById.apply(document, arguments)
+},
+
+$$: function()
+{
+return document.querySelectorAll.apply(document, arguments)
+},
+
+$x: function(xpath, context)
+{
+var nodes = [];
+try {
+var doc = context || document;
+var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null);
+var node;
+while (node = results.iterateNext())
+nodes.push(node);
+} catch (e) {
+}
+return nodes;
+},
+
+dir: function()
+{
+return console.dir.apply(console, arguments)
+},
+
+dirxml: function()
+{
+return console.dirxml.apply(console, arguments)
+},
+
+keys: function(object)
+{
+return Object.keys(object);
+},
+
+values: function(object)
+{
+var result = [];
+for (var key in object)
+result.push(object[key]);
+return result;
+},
+
+profile: function()
+{
+return console.profile.apply(console, arguments)
+},
+
+profileEnd: function()
+{
+return console.profileEnd.apply(console, arguments)
+},
+
+monitorEvents: function(object, types)
+{
+if (!object || !object.addEventListener || !object.removeEventListener)
+return;
+types = injectedScript._normalizeEventTypes(types);
+for (var i = 0; i < types.length; ++i) {
+object.removeEventListener(types[i], injectedScript._logEvent, false);
+object.addEventListener(types[i], injectedScript._logEvent, false);
+}
+},
+
+unmonitorEvents: function(object, types)
+{
+if (!object || !object.addEventListener || !object.removeEventListener)
+return;
+types = injectedScript._normalizeEventTypes(types);
+for (var i = 0; i < types.length; ++i)
+object.removeEventListener(types[i], injectedScript._logEvent, false);
+},
+
+inspect: function(object)
+{
+if (arguments.length === 0)
+return;
+
+inspectedWindow.console.log(object);
+if (injectedScript._type(object) === "node")
+InjectedScriptHost.pushNodePathToFrontend(object, false, true);
+else {
+switch (injectedScript._describe(object)) {
+case "Database":
+InjectedScriptHost.selectDatabase(object);
+break;
+case "Storage":
+InjectedScriptHost.selectDOMStorage(object);
+break;
+}
+}
+},
+
+copy: function(object)
+{
+if (injectedScript._type(object) === "node")
+object = object.outerHTML;
+InjectedScriptHost.copyText(object);
+},
+
+clear: function()
+{
+InjectedScriptHost.clearConsoleMessages();
+}
+}
+
+injectedScript._commandLineAPI = new CommandLineAPI();
+return injectedScript;
+});
+
+
+
+
+
+function InjectedScriptAccess(worldId) {
+this._worldId = worldId;
+}
+
+InjectedScriptAccess.get = function(worldId)
+{
+if (typeof worldId === "number")
+return new InjectedScriptAccess(worldId);
+
+console.assert(false, "Access to injected script with no id");
+}
+
+InjectedScriptAccess.getForNode = function(node)
+{
+
+return InjectedScriptAccess.get(-node.id);
+}
+
+InjectedScriptAccess.getForObjectId = function(objectId)
+{
+
+var tokens = objectId.split(":");
+return InjectedScriptAccess.get(parseInt(tokens[0]));
+}
+
+InjectedScriptAccess.getDefault = function()
+{
+return InjectedScriptAccess.get(0);
+}
+
+InjectedScriptAccess.prototype = {};
+
+InjectedScriptAccess._installHandler = function(methodName, async)
+{
+InjectedScriptAccess.prototype[methodName] = function()
+{
+var allArgs = Array.prototype.slice.call(arguments);
+var callback = allArgs[allArgs.length - 1];
+var argsString = JSON.stringify(Array.prototype.slice.call(allArgs, 0, allArgs.length - 1));
+
+function myCallback(result, isException)
+{
+if (!isException)
+callback(result);
+else
+WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage("Error dispatching: " + methodName));
+}
+InspectorBackend.dispatchOnInjectedScript(this._worldId, methodName, argsString, myCallback);
+};
+}
+
+
+
+
+
+InjectedScriptAccess._installHandler("evaluate");
+InjectedScriptAccess._installHandler("evaluateInCallFrame");
+InjectedScriptAccess._installHandler("evaluateOnSelf");
+InjectedScriptAccess._installHandler("getCompletions");
+InjectedScriptAccess._installHandler("getProperties");
+InjectedScriptAccess._installHandler("getPrototypes");
+InjectedScriptAccess._installHandler("pushNodeToFrontend");
+InjectedScriptAccess._installHandler("resolveNode");
+InjectedScriptAccess._installHandler("getNodeProperties");
+InjectedScriptAccess._installHandler("setPropertyValue");
+
+
+
+
+
+WebInspector.TimelineAgent = function() {
+
+}
+
+
+WebInspector.TimelineAgent.RecordType = {
+EventDispatch : 0,
+Layout : 1,
+RecalculateStyles : 2,
+Paint : 3,
+ParseHTML : 4,
+TimerInstall : 5,
+TimerRemove : 6,
+TimerFire : 7,
+XHRReadyStateChange : 8,
+XHRLoad : 9,
+EvaluateScript : 10,
+MarkTimeline : 11,
+ResourceSendRequest : 12,
+ResourceReceiveResponse : 13,
+ResourceFinish : 14,
+FunctionCall : 15,
+ResourceReceiveData: 16,
+GCEvent : 17,
+MarkDOMContentEventType : 18,
+MarkLoadEventType : 19,
+ScheduleResourceRequest : 20
+};
+
+WebInspector.addRecordToTimeline = function(record) {
+if (WebInspector.panels.timeline)
+WebInspector.panels.timeline.addRecordToTimeline(record);
+}
+
+WebInspector.timelineProfilerWasStarted = function() {
+if (WebInspector.panels.timeline)
+WebInspector.panels.timeline.timelineWasStarted();
+}
+
+WebInspector.timelineProfilerWasStopped = function() {
+if (WebInspector.panels.timeline)
+WebInspector.panels.timeline.timelineWasStopped();
+}
+
+
+
+
+
+WebInspector.TimelinePanel = function()
+{
+WebInspector.Panel.call(this, "timeline");
+
+this.element.appendChild(this._createTopPane());
+this.element.tabIndex = 0;
+
+this._sidebarBackgroundElement = document.createElement("div");
+this._sidebarBackgroundElement.className = "sidebar timeline-sidebar-background";
+this.element.appendChild(this._sidebarBackgroundElement);
+
+this._containerElement = document.createElement("div");
+this._containerElement.id = "timeline-container";
+this._containerElement.addEventListener("scroll", this._onScroll.bind(this), false);
+this.element.appendChild(this._containerElement);
+
+this.createSidebar(this._containerElement, this._containerElement);
+var itemsTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("RECORDS"), {}, true);
+itemsTreeElement.expanded = true;
+this.sidebarTree.appendChild(itemsTreeElement);
+
+this._sidebarListElement = document.createElement("div");
+this.sidebarElement.appendChild(this._sidebarListElement);
+
+this._containerContentElement = document.createElement("div");
+this._containerContentElement.id = "resources-container-content";
+this._containerElement.appendChild(this._containerContentElement);
+
+this._timelineGrid = new WebInspector.TimelineGrid();
+this._itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
+this._itemsGraphsElement.id = "timeline-graphs";
+this._containerContentElement.appendChild(this._timelineGrid.element);
+
+this._topGapElement = document.createElement("div");
+this._topGapElement.className = "timeline-gap";
+this._itemsGraphsElement.appendChild(this._topGapElement);
+
+this._graphRowsElement = document.createElement("div");
+this._itemsGraphsElement.appendChild(this._graphRowsElement);
+
+this._bottomGapElement = document.createElement("div");
+this._bottomGapElement.className = "timeline-gap";
+this._itemsGraphsElement.appendChild(this._bottomGapElement);
+
+this._expandElements = document.createElement("div");
+this._expandElements.id = "orphan-expand-elements";
+this._itemsGraphsElement.appendChild(this._expandElements);
+
+this._rootRecord = this._createRootRecord();
+this._sendRequestRecords = {};
+this._scheduledResourceRequests = {};
+this._timerRecords = {};
+
+this._calculator = new WebInspector.TimelineCalculator();
+this._calculator._showShortEvents = false;
+var shortRecordThresholdTitle = Number.secondsToString(WebInspector.TimelinePanel.shortRecordThreshold, WebInspector.UIString);
+this._showShortRecordsTitleText = WebInspector.UIString("Show the records that are shorter than %s", shortRecordThresholdTitle);
+this._hideShortRecordsTitleText = WebInspector.UIString("Hide the records that are shorter than %s", shortRecordThresholdTitle);
+this._createStatusbarButtons();
+
+this._boundariesAreValid = true;
+this._scrollTop = 0;
+
+this._popoverHelper = new WebInspector.PopoverHelper(this._containerElement, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), true);
+
+
+this.toggleFilterButton.toggled = true;
+this._calculator._showShortEvents = this.toggleFilterButton.toggled;
+this._markTimelineRecords = [];
+this._expandOffset = 15;
+}
+
+
+WebInspector.TimelinePanel.rowHeight = 18;
+WebInspector.TimelinePanel.shortRecordThreshold = 0.015;
+
+WebInspector.TimelinePanel.prototype = {
+_createTopPane: function() {
+var topPaneElement = document.createElement("div");
+topPaneElement.id = "timeline-overview-panel";
+
+this._topPaneSidebarElement = document.createElement("div");
+this._topPaneSidebarElement.id = "timeline-overview-sidebar";
+
+var overviewTreeElement = document.createElement("ol");
+overviewTreeElement.className = "sidebar-tree";
+this._topPaneSidebarElement.appendChild(overviewTreeElement);
+topPaneElement.appendChild(this._topPaneSidebarElement);
+
+var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
+var timelinesOverviewItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Timelines"));
+topPaneSidebarTree.appendChild(timelinesOverviewItem);
+timelinesOverviewItem.onselect = this._timelinesOverviewItemSelected.bind(this);
+timelinesOverviewItem.select(true);
+
+var memoryOverviewItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Memory"));
+topPaneSidebarTree.appendChild(memoryOverviewItem);
+memoryOverviewItem.onselect = this._memoryOverviewItemSelected.bind(this);
+
+this._overviewPane = new WebInspector.TimelineOverviewPane(this.categories);
+this._overviewPane.addEventListener("window changed", this._windowChanged, this);
+this._overviewPane.addEventListener("filter changed", this._refresh, this);
+topPaneElement.appendChild(this._overviewPane.element);
+
+var separatorElement = document.createElement("div");
+separatorElement.id = "timeline-overview-separator";
+topPaneElement.appendChild(separatorElement);
+return topPaneElement;
+},
+
+get toolbarItemLabel()
+{
+return WebInspector.UIString("Timeline");
+},
+
+get statusBarItems()
+{
+return [this.toggleFilterButton.element, this.toggleTimelineButton.element, this.clearButton.element, this._overviewPane.statusBarFilters];
+},
+
+get categories()
+{
+if (!this._categories) {
+this._categories = {
+loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), "rgb(47,102,236)"),
+scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), "rgb(157,231,119)"),
+rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), "rgb(164,60,255)")
+};
+}
+return this._categories;
+},
+
+get defaultFocusedElement()
+{
+return this.element;
+},
+
+get _recordStyles()
+{
+if (!this._recordStylesArray) {
+var recordTypes = WebInspector.TimelineAgent.RecordType;
+var recordStyles = {};
+recordStyles[recordTypes.EventDispatch] = { title: WebInspector.UIString("Event"), category: this.categories.scripting };
+recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: this.categories.rendering };
+recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: this.categories.rendering };
+recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: this.categories.rendering };
+recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: this.categories.loading };
+recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: this.categories.scripting };
+recordStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: this.categories.scripting };
+recordStyles[recordTypes.TimerFire] = { title: WebInspector.UIString("Timer Fired"), category: this.categories.scripting };
+recordStyles[recordTypes.XHRReadyStateChange] = { title: WebInspector.UIString("XHR Ready State Change"), category: this.categories.scripting };
+recordStyles[recordTypes.XHRLoad] = { title: WebInspector.UIString("XHR Load"), category: this.categories.scripting };
+recordStyles[recordTypes.EvaluateScript] = { title: WebInspector.UIString("Evaluate Script"), category: this.categories.scripting };
+recordStyles[recordTypes.MarkTimeline] = { title: WebInspector.UIString("Mark"), category: this.categories.scripting };
+recordStyles[recordTypes.ResourceSendRequest] = { title: WebInspector.UIString("Send Request"), category: this.categories.loading };
+recordStyles[recordTypes.ResourceReceiveResponse] = { title: WebInspector.UIString("Receive Response"), category: this.categories.loading };
+recordStyles[recordTypes.ResourceFinish] = { title: WebInspector.UIString("Finish Loading"), category: this.categories.loading };
+recordStyles[recordTypes.FunctionCall] = { title: WebInspector.UIString("Function Call"), category: this.categories.scripting };
+recordStyles[recordTypes.ResourceReceiveData] = { title: WebInspector.UIString("Receive Data"), category: this.categories.loading };
+recordStyles[recordTypes.GCEvent] = { title: WebInspector.UIString("GC Event"), category: this.categories.scripting };
+recordStyles[recordTypes.MarkDOMContentEventType] = { title: WebInspector.UIString("DOMContent event"), category: this.categories.scripting };
+recordStyles[recordTypes.MarkLoadEventType] = { title: WebInspector.UIString("Load event"), category: this.categories.scripting };
+recordStyles[recordTypes.ScheduleResourceRequest] = { title: WebInspector.UIString("Schedule Request"), category: this.categories.loading };
+this._recordStylesArray = recordStyles;
+}
+return this._recordStylesArray;
+},
+
+_createStatusbarButtons: function()
+{
+this.toggleTimelineButton = new WebInspector.StatusBarButton(WebInspector.UIString("Record"), "record-profile-status-bar-item");
+this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked.bind(this), false);
+
+this.clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-status-bar-item");
+this.clearButton.addEventListener("click", this._clearPanel.bind(this), false);
+
+this.toggleFilterButton = new WebInspector.StatusBarButton(this._hideShortRecordsTitleText, "timeline-filter-status-bar-item");
+this.toggleFilterButton.addEventListener("click", this._toggleFilterButtonClicked.bind(this), false);
+
+this.recordsCounter = document.createElement("span");
+this.recordsCounter.className = "timeline-records-counter";
+},
+
+_updateRecordsCounter: function()
+{
+this.recordsCounter.textContent = WebInspector.UIString("%d of %d captured records are visible", this._rootRecord._visibleRecordsCount, this._rootRecord._allRecordsCount);
+},
+
+_updateEventDividers: function()
+{
+this._timelineGrid.removeEventDividers();
+var clientWidth = this._graphRowsElement.offsetWidth - this._expandOffset;
+var dividers = [];
+for (var i = 0; i < this._markTimelineRecords.length; ++i) {
+var record = this._markTimelineRecords[i];
+var positions = this._calculator.computeBarGraphWindowPosition(record, clientWidth);
+var dividerPosition = Math.round(positions.left);
+if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers[dividerPosition])
+continue;
+var divider = this._createEventDivider(record);
+divider.style.left = (dividerPosition + this._expandOffset) + "px";
+dividers[dividerPosition] = divider;
+}
+this._timelineGrid.addEventDividers(dividers);
+this._overviewPane.updateEventDividers(this._markTimelineRecords, this._createEventDivider.bind(this));
+},
+
+_createEventDivider: function(record)
+{
+var eventDivider = document.createElement("div");
+eventDivider.className = "resources-event-divider";
+var recordTypes = WebInspector.TimelineAgent.RecordType;
+
+var eventDividerPadding = document.createElement("div");
+eventDividerPadding.className = "resources-event-divider-padding";
+eventDividerPadding.title = record.title;
+
+if (record.type === recordTypes.MarkDOMContentEventType)
+eventDivider.className += " resources-blue-divider";
+else if (record.type === recordTypes.MarkLoadEventType)
+eventDivider.className += " resources-red-divider";
+else if (record.type === recordTypes.MarkTimeline) {
+eventDivider.className += " resources-orange-divider";
+eventDividerPadding.title = record.data.message;
+}
+eventDividerPadding.appendChild(eventDivider);
+return eventDividerPadding;
+},
+
+_timelinesOverviewItemSelected: function(event) {
+this._overviewPane.showTimelines();
+},
+
+_memoryOverviewItemSelected: function(event) {
+this._overviewPane.showMemoryGraph(this._rootRecord.children);
+},
+
+_toggleTimelineButtonClicked: function()
+{
+if (this.toggleTimelineButton.toggled)
+InspectorBackend.stopTimelineProfiler();
+else {
+this._clearPanel();
+InspectorBackend.startTimelineProfiler();
+}
+},
+
+_toggleFilterButtonClicked: function()
+{
+this.toggleFilterButton.toggled = !this.toggleFilterButton.toggled;
+this._calculator._showShortEvents = this.toggleFilterButton.toggled;
+this.toggleFilterButton.element.title = this._calculator._showShortEvents ? this._hideShortRecordsTitleText : this._showShortRecordsTitleText;
+this._scheduleRefresh(true);
+},
+
+timelineWasStarted: function()
+{
+this.toggleTimelineButton.toggled = true;
+},
+
+timelineWasStopped: function()
+{
+this.toggleTimelineButton.toggled = false;
+},
+
+addRecordToTimeline: function(record)
+{
+if (record.type == WebInspector.TimelineAgent.RecordType.ResourceSendRequest && record.data.isMainResource) {
+if (this._mainResourceIdentifier != record.data.identifier) {
+
+
+
+this._mainResourceIdentifier = record.data.identifier;
+this._clearPanel();
+}
+}
+this._innerAddRecordToTimeline(record, this._rootRecord);
+this._scheduleRefresh();
+},
+
+_findParentRecord: function(record)
+{
+var recordTypes = WebInspector.TimelineAgent.RecordType;
+var parentRecord;
+if (record.type === recordTypes.ResourceReceiveResponse ||
+record.type === recordTypes.ResourceFinish ||
+record.type === recordTypes.ResourceReceiveData)
+parentRecord = this._sendRequestRecords[record.data.identifier];
+else if (record.type === recordTypes.TimerFire)
+parentRecord = this._timerRecords[record.data.timerId];
+else if (record.type === recordTypes.ResourceSendRequest)
+parentRecord = this._scheduledResourceRequests[record.data.url];
+return parentRecord;
+},
+
+_innerAddRecordToTimeline: function(record, parentRecord)
+{
+var connectedToOldRecord = false;
+var recordTypes = WebInspector.TimelineAgent.RecordType;
+if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType)
+parentRecord = null; 
+else if (parentRecord === this._rootRecord) {
+var newParentRecord = this._findParentRecord(record);
+if (newParentRecord) {
+parentRecord = newParentRecord;
+connectedToOldRecord = true;
+}
+}
+
+if (record.type == recordTypes.TimerFire && record.children && record.children.length) {
+var childRecord = record.children[0];
+if (childRecord.type === recordTypes.FunctionCall) {
+record.data.scriptName = childRecord.data.scriptName;
+record.data.scriptLine = childRecord.data.scriptLine;
+record.children.shift();
+record.children = childRecord.children.concat(record.children);
+}
+}
+
+var formattedRecord = new WebInspector.TimelinePanel.FormattedRecord(record, parentRecord, this);
+
+if (record.type === recordTypes.MarkDOMContentEventType || record.type === recordTypes.MarkLoadEventType) {
+this._markTimelineRecords.push(formattedRecord);
+return;
+}
+
+++this._rootRecord._allRecordsCount;
+formattedRecord.collapsed = (parentRecord === this._rootRecord);
+
+var childrenCount = record.children ? record.children.length : 0;
+for (var i = 0; i < childrenCount; ++i)
+this._innerAddRecordToTimeline(record.children[i], formattedRecord);
+
+formattedRecord._calculateAggregatedStats(this.categories);
+
+if (connectedToOldRecord) {
+var record = formattedRecord;
+do {
+var parent = record.parent;
+parent._cpuTime += formattedRecord._cpuTime;
+if (parent._lastChildEndTime < record._lastChildEndTime)
+parent._lastChildEndTime = record._lastChildEndTime;
+for (var category in formattedRecord._aggregatedStats)
+parent._aggregatedStats[category] += formattedRecord._aggregatedStats[category];
+record = parent;
+} while (record.parent);
+} else
+if (parentRecord !== this._rootRecord)
+parentRecord._selfTime -= formattedRecord.endTime - formattedRecord.startTime;
+
+
+if (record.type === recordTypes.MarkTimeline)
+this._markTimelineRecords.push(formattedRecord);
+},
+
+setSidebarWidth: function(width)
+{
+WebInspector.Panel.prototype.setSidebarWidth.call(this, width);
+this._sidebarBackgroundElement.style.width = width + "px";
+this._topPaneSidebarElement.style.width = width + "px";
+},
+
+updateMainViewWidth: function(width)
+{
+this._containerContentElement.style.left = width + "px";
+this._scheduleRefresh();
+this._overviewPane.updateMainViewWidth(width);
+},
+
+resize: function()
+{
+this._closeRecordDetails();
+this._scheduleRefresh();
+},
+
+_createRootRecord: function()
+{
+var rootRecord = {};
+rootRecord.children = [];
+rootRecord._visibleRecordsCount = 0;
+rootRecord._allRecordsCount = 0;
+rootRecord._aggregatedStats = {};
+return rootRecord;
+},
+
+_clearPanel: function()
+{
+this._markTimelineRecords = [];
+this._sendRequestRecords = {};
+this._scheduledResourceRequests = {};
+this._timerRecords = {};
+this._rootRecord = this._createRootRecord();
+this._boundariesAreValid = false;
+this._overviewPane.reset();
+this._adjustScrollPosition(0);
+this._refresh();
+this._closeRecordDetails();
+},
+
+show: function()
+{
+WebInspector.Panel.prototype.show.call(this);
+if (typeof this._scrollTop === "number")
+this._containerElement.scrollTop = this._scrollTop;
+this._refresh();
+WebInspector.drawer.currentPanelCounters = this.recordsCounter;
+},
+
+hide: function()
+{
+WebInspector.Panel.prototype.hide.call(this);
+this._closeRecordDetails();
+WebInspector.drawer.currentPanelCounters = null;
+},
+
+_onScroll: function(event)
+{
+this._closeRecordDetails();
+var scrollTop = this._containerElement.scrollTop;
+var dividersTop = Math.max(0, scrollTop);
+this._timelineGrid.setScrollAndDividerTop(scrollTop, dividersTop);
+this._scheduleRefresh(true);
+},
+
+_windowChanged: function()
+{
+this._closeRecordDetails();
+this._scheduleRefresh();
+},
+
+_scheduleRefresh: function(preserveBoundaries)
+{
+this._closeRecordDetails();
+this._boundariesAreValid &= preserveBoundaries;
+
+if (!this.visible)
+return;
+
+if (preserveBoundaries)
+this._refresh();
+else
+if (!this._refreshTimeout)
+this._refreshTimeout = setTimeout(this._refresh.bind(this), 100);
+},
+
+_refresh: function()
+{
+if (this._refreshTimeout) {
+clearTimeout(this._refreshTimeout);
+delete this._refreshTimeout;
+}
+
+this._overviewPane.update(this._rootRecord.children, this._calculator._showShortEvents);
+this._refreshRecords(!this._boundariesAreValid);
+this._updateRecordsCounter();
+if(!this._boundariesAreValid)
+this._updateEventDividers();
+this._boundariesAreValid = true;
+},
+
+_updateBoundaries: function()
+{
+this._calculator.reset();
+this._calculator.windowLeft = this._overviewPane.windowLeft;
+this._calculator.windowRight = this._overviewPane.windowRight;
+
+for (var i = 0; i < this._rootRecord.children.length; ++i)
+this._calculator.updateBoundaries(this._rootRecord.children[i]);
+
+this._calculator.calculateWindow();
+},
+
+_addToRecordsWindow: function(record, recordsWindow, parentIsCollapsed)
+{
+if (!this._calculator._showShortEvents && !record.isLong())
+return;
+var percentages = this._calculator.computeBarGraphPercentages(record);
+if (percentages.start < 100 && percentages.endWithChildren >= 0 && !record.category.hidden) {
+++this._rootRecord._visibleRecordsCount;
+++record.parent._invisibleChildrenCount;
+if (!parentIsCollapsed)
+recordsWindow.push(record);
+}
+
+var index = recordsWindow.length;
+record._invisibleChildrenCount = 0;
+for (var i = 0; i < record.children.length; ++i)
+this._addToRecordsWindow(record.children[i], recordsWindow, parentIsCollapsed || record.collapsed);
+record._visibleChildrenCount = recordsWindow.length - index;
+},
+
+_filterRecords: function()
+{
+var recordsInWindow = [];
+this._rootRecord._visibleRecordsCount = 0;
+for (var i = 0; i < this._rootRecord.children.length; ++i)
+this._addToRecordsWindow(this._rootRecord.children[i], recordsInWindow);
+return recordsInWindow;
+},
+
+_refreshRecords: function(updateBoundaries)
+{
+if (updateBoundaries)
+this._updateBoundaries();
+
+var recordsInWindow = this._filterRecords();
+
+
+this._scrollTop = this._containerElement.scrollTop;
+var visibleTop = this._scrollTop;
+var visibleBottom = visibleTop + this._containerElement.clientHeight;
+
+const rowHeight = WebInspector.TimelinePanel.rowHeight;
+
+
+var startIndex = Math.max(0, Math.min(Math.floor(visibleTop / rowHeight) - 1, recordsInWindow.length - 1));
+var endIndex = Math.min(recordsInWindow.length, Math.ceil(visibleBottom / rowHeight));
+
+
+const top = (startIndex * rowHeight) + "px";
+this._topGapElement.style.height = top;
+this.sidebarElement.style.top = top;
+this.sidebarResizeElement.style.top = top;
+this._bottomGapElement.style.height = (recordsInWindow.length - endIndex) * rowHeight + "px";
+
+
+var listRowElement = this._sidebarListElement.firstChild;
+var width = this._graphRowsElement.offsetWidth;
+this._itemsGraphsElement.removeChild(this._graphRowsElement);
+var graphRowElement = this._graphRowsElement.firstChild;
+var scheduleRefreshCallback = this._scheduleRefresh.bind(this, true);
+this._itemsGraphsElement.removeChild(this._expandElements);
+this._expandElements.removeChildren();
+
+for (var i = 0; i < endIndex; ++i) {
+var record = recordsInWindow[i];
+var isEven = !(i % 2);
+
+if (i < startIndex) {
+var lastChildIndex = i + record._visibleChildrenCount;
+if (lastChildIndex >= startIndex && lastChildIndex < endIndex) {
+var expandElement = new WebInspector.TimelineExpandableElement(this._expandElements);
+expandElement._update(record, i, this._calculator.computeBarGraphWindowPosition(record, width - this._expandOffset));
+}
+} else {
+if (!listRowElement) {
+listRowElement = new WebInspector.TimelineRecordListRow().element;
+this._sidebarListElement.appendChild(listRowElement);
+}
+if (!graphRowElement) {
+graphRowElement = new WebInspector.TimelineRecordGraphRow(this._itemsGraphsElement, scheduleRefreshCallback, rowHeight).element;
+this._graphRowsElement.appendChild(graphRowElement);
+}
+
+listRowElement.row.update(record, isEven, this._calculator, visibleTop);
+graphRowElement.row.update(record, isEven, this._calculator, width, this._expandOffset, i);
+
+listRowElement = listRowElement.nextSibling;
+graphRowElement = graphRowElement.nextSibling;
+}
+}
+
+
+while (listRowElement) {
+var nextElement = listRowElement.nextSibling;
+listRowElement.row.dispose();
+listRowElement = nextElement;
+}
+while (graphRowElement) {
+var nextElement = graphRowElement.nextSibling;
+graphRowElement.row.dispose();
+graphRowElement = nextElement;
+}
+
+this._itemsGraphsElement.insertBefore(this._graphRowsElement, this._bottomGapElement);
+this._itemsGraphsElement.appendChild(this._expandElements);
+this.sidebarResizeElement.style.height = this.sidebarElement.clientHeight + "px";
+
+var timelinePaddingLeft = this._calculator.windowLeft === 0 ? this._expandOffset : 0;
+if (updateBoundaries)
+this._timelineGrid.updateDividers(true, this._calculator, timelinePaddingLeft);
+this._adjustScrollPosition((recordsInWindow.length + 1) * rowHeight);
+},
+
+_adjustScrollPosition: function(totalHeight)
+{
+
+if ((this._containerElement.scrollTop + this._containerElement.offsetHeight) > totalHeight + 1)
+this._containerElement.scrollTop = (totalHeight - this._containerElement.offsetHeight);
+},
+
+_getPopoverAnchor: function(element)
+{
+return element.enclosingNodeOrSelfWithClass("timeline-graph-bar") || element.enclosingNodeOrSelfWithClass("timeline-tree-item");
+},
+
+_showPopover: function(anchor)
+{
+var record = anchor.row._record;
+var popover = new WebInspector.Popover(record._generatePopupContent(this._calculator, this.categories));
+popover.show(anchor);
+return popover;
+},
+
+_closeRecordDetails: function()
+{
+this._popoverHelper.hidePopup();
+}
+}
+
+WebInspector.TimelinePanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+WebInspector.TimelineCategory = function(name, title, color)
+{
+this.name = name;
+this.title = title;
+this.color = color;
+}
+
+WebInspector.TimelineCalculator = function()
+{
+this.reset();
+this.windowLeft = 0.0;
+this.windowRight = 1.0;
+}
+
+WebInspector.TimelineCalculator.prototype = {
+computeBarGraphPercentages: function(record)
+{
+var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100;
+var end = (record.startTime + record._selfTime - this.minimumBoundary) / this.boundarySpan * 100;
+var endWithChildren = (record._lastChildEndTime - this.minimumBoundary) / this.boundarySpan * 100;
+var cpuWidth = record._cpuTime / this.boundarySpan * 100;
+return {start: start, end: end, endWithChildren: endWithChildren, cpuWidth: cpuWidth};
+},
+
+computeBarGraphWindowPosition: function(record, clientWidth)
+{
+const minWidth = 5;
+const borderWidth = 4;
+var workingArea = clientWidth - minWidth - borderWidth;
+var percentages = this.computeBarGraphPercentages(record);
+var left = percentages.start / 100 * workingArea;
+var width = (percentages.end - percentages.start) / 100 * workingArea + minWidth;
+var widthWithChildren =  (percentages.endWithChildren - percentages.start) / 100 * workingArea;
+var cpuWidth = percentages.cpuWidth / 100 * workingArea + minWidth;
+if (percentages.endWithChildren > percentages.end)
+widthWithChildren += borderWidth + minWidth;
+return {left: left, width: width, widthWithChildren: widthWithChildren, cpuWidth: cpuWidth};
+},
+
+calculateWindow: function()
+{
+this.minimumBoundary = this._absoluteMinimumBoundary + this.windowLeft * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
+this.maximumBoundary = this._absoluteMinimumBoundary + this.windowRight * (this._absoluteMaximumBoundary - this._absoluteMinimumBoundary);
+this.boundarySpan = this.maximumBoundary - this.minimumBoundary;
+},
+
+reset: function()
+{
+this._absoluteMinimumBoundary = -1;
+this._absoluteMaximumBoundary = -1;
+},
+
+updateBoundaries: function(record)
+{
+var lowerBound = record.startTime;
+if (this._absoluteMinimumBoundary === -1 || lowerBound < this._absoluteMinimumBoundary)
+this._absoluteMinimumBoundary = lowerBound;
+
+const minimumTimeFrame = 0.1;
+const minimumDeltaForZeroSizeEvents = 0.01;
+var upperBound = Math.max(record._lastChildEndTime + minimumDeltaForZeroSizeEvents, lowerBound + minimumTimeFrame);
+if (this._absoluteMaximumBoundary === -1 || upperBound > this._absoluteMaximumBoundary)
+this._absoluteMaximumBoundary = upperBound;
+},
+
+formatValue: function(value)
+{
+return Number.secondsToString(value + this.minimumBoundary - this._absoluteMinimumBoundary, WebInspector.UIString);
+}
+}
+
+
+WebInspector.TimelineRecordListRow = function()
+{
+this.element = document.createElement("div");
+this.element.row = this;
+this.element.style.cursor = "pointer";
+var iconElement = document.createElement("span");
+iconElement.className = "timeline-tree-icon";
+this.element.appendChild(iconElement);
+
+this._typeElement = document.createElement("span");
+this._typeElement.className = "type";
+this.element.appendChild(this._typeElement);
+
+var separatorElement = document.createElement("span");
+separatorElement.className = "separator";
+separatorElement.textContent = " ";
+
+this._dataElement = document.createElement("span");
+this._dataElement.className = "data dimmed";
+
+this.element.appendChild(separatorElement);
+this.element.appendChild(this._dataElement);
+}
+
+WebInspector.TimelineRecordListRow.prototype = {
+update: function(record, isEven, calculator, offset)
+{
+this._record = record;
+this._calculator = calculator;
+this._offset = offset;
+
+this.element.className = "timeline-tree-item timeline-category-" + record.category.name + (isEven ? " even" : "");
+this._typeElement.textContent = record.title;
+
+if (this._dataElement.firstChild)
+this._dataElement.removeChildren();
+if (record.details) {
+var detailsContainer = document.createElement("span");
+if (typeof record.details === "object") {
+detailsContainer.appendChild(document.createTextNode("("));
+detailsContainer.appendChild(record.details);
+detailsContainer.appendChild(document.createTextNode(")"));
+} else
+detailsContainer.textContent = "(" + record.details + ")";
+this._dataElement.appendChild(detailsContainer);
+}
+},
+
+dispose: function()
+{
+this.element.parentElement.removeChild(this.element);
+}
+}
+
+WebInspector.TimelineRecordGraphRow = function(graphContainer, scheduleRefresh)
+{
+this.element = document.createElement("div");
+this.element.row = this;
+
+this._barAreaElement = document.createElement("div");
+this._barAreaElement.className = "timeline-graph-bar-area";
+this.element.appendChild(this._barAreaElement);
+
+this._barWithChildrenElement = document.createElement("div");
+this._barWithChildrenElement.className = "timeline-graph-bar with-children";
+this._barWithChildrenElement.row = this;
+this._barAreaElement.appendChild(this._barWithChildrenElement);
+
+this._barCpuElement = document.createElement("div");
+this._barCpuElement.className = "timeline-graph-bar cpu"
+this._barCpuElement.row = this;
+this._barAreaElement.appendChild(this._barCpuElement);
+
+this._barElement = document.createElement("div");
+this._barElement.className = "timeline-graph-bar";
+this._barElement.row = this;
+this._barAreaElement.appendChild(this._barElement);
+
+this._expandElement = new WebInspector.TimelineExpandableElement(graphContainer);
+this._expandElement._element.addEventListener("click", this._onClick.bind(this));
+
+this._scheduleRefresh = scheduleRefresh;
+}
+
+WebInspector.TimelineRecordGraphRow.prototype = {
+update: function(record, isEven, calculator, clientWidth, expandOffset, index)
+{
+this._record = record;
+this.element.className = "timeline-graph-side timeline-category-" + record.category.name + (isEven ? " even" : "");
+var barPosition = calculator.computeBarGraphWindowPosition(record, clientWidth - expandOffset);
+this._barWithChildrenElement.style.left = barPosition.left + expandOffset + "px";
+this._barWithChildrenElement.style.width = barPosition.widthWithChildren + "px";
+this._barElement.style.left = barPosition.left + expandOffset + "px";
+this._barElement.style.width =  barPosition.width + "px";
+this._barCpuElement.style.left = barPosition.left + expandOffset + "px";
+this._barCpuElement.style.width = barPosition.cpuWidth + "px";
+this._expandElement._update(record, index, barPosition);
+},
+
+_onClick: function(event)
+{
+this._record.collapsed = !this._record.collapsed;
+this._scheduleRefresh();
+},
+
+dispose: function()
+{
+this.element.parentElement.removeChild(this.element);
+this._expandElement._dispose();
+}
+}
+
+WebInspector.TimelinePanel.FormattedRecord = function(record, parentRecord, panel)
+{
+var recordTypes = WebInspector.TimelineAgent.RecordType;
+var style = panel._recordStyles[record.type];
+
+this.parent = parentRecord;
+if (parentRecord)
+parentRecord.children.push(this);
+this.category = style.category;
+this.title = style.title;
+this.startTime = record.startTime / 1000;
+this.data = record.data;
+this.type = record.type;
+this.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : this.startTime;
+this._selfTime = this.endTime - this.startTime;
+this._lastChildEndTime = this.endTime;
+this.originalRecordForTests = record;
+if (record.stackTrace && record.stackTrace.length)
+this.stackTrace = record.stackTrace;
+this.totalHeapSize = record.totalHeapSize;
+this.usedHeapSize = record.usedHeapSize;
+
+
+if (record.type === recordTypes.ResourceSendRequest) {
+panel._sendRequestRecords[record.data.identifier] = this;
+} else if (record.type === recordTypes.ScheduleResourceRequest) {
+panel._scheduledResourceRequests[record.data.url] = this;
+} else if (record.type === recordTypes.ResourceReceiveResponse) {
+var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
+if (sendRequestRecord) { 
+record.data.url = sendRequestRecord.data.url;
+
+sendRequestRecord.details = this._getRecordDetails(sendRequestRecord, panel._sendRequestRecords);
+if (sendRequestRecord.parent !== panel._rootRecord && sendRequestRecord.parent.type === recordTypes.ScheduleResourceRequest)
+sendRequestRecord.parent.details = this._getRecordDetails(sendRequestRecord, panel._sendRequestRecords);
+}
+} else if (record.type === recordTypes.ResourceReceiveData) {
+var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
+if (sendRequestRecord) 
+record.data.url = sendRequestRecord.data.url;
+} else if (record.type === recordTypes.ResourceFinish) {
+var sendRequestRecord = panel._sendRequestRecords[record.data.identifier];
+if (sendRequestRecord) 
+record.data.url = sendRequestRecord.data.url;
+} else if (record.type === recordTypes.TimerInstall) {
+this.timeout = record.data.timeout;
+this.singleShot = record.data.singleShot;
+panel._timerRecords[record.data.timerId] = this;
+} else if (record.type === recordTypes.TimerFire) {
+var timerInstalledRecord = panel._timerRecords[record.data.timerId];
+if (timerInstalledRecord) {
+this.callSiteStackTrace = timerInstalledRecord.stackTrace;
+this.timeout = timerInstalledRecord.timeout;
+this.singleShot = timerInstalledRecord.singleShot;
+}
+}
+this.details = this._getRecordDetails(record, panel._sendRequestRecords);
+}
+
+WebInspector.TimelinePanel.FormattedRecord.prototype = {
+isLong: function()
+{
+return (this._lastChildEndTime - this.startTime) > WebInspector.TimelinePanel.shortRecordThreshold;
+},
+
+get children()
+{
+if (!this._children)
+this._children = [];
+return this._children;
+},
+
+_generateAggregatedInfo: function()
+{
+var cell = document.createElement("span");
+cell.className = "timeline-aggregated-info";
+for (var index in this._aggregatedStats) {
+var label = document.createElement("div");
+label.className = "timeline-aggregated-category timeline-" + index;
+cell.appendChild(label);
+var text = document.createElement("span");
+text.textContent = Number.secondsToString(this._aggregatedStats[index] + 0.0001, WebInspector.UIString);
+cell.appendChild(text);
+}
+return cell;
+},
+
+_generatePopupContent: function(calculator, categories)
+{
+var contentHelper = new WebInspector.TimelinePanel.PopupContentHelper(this.title);
+
+if (this._children && this._children.length) {
+contentHelper._appendTextRow(WebInspector.UIString("Self Time"), Number.secondsToString(this._selfTime + 0.0001, WebInspector.UIString));
+contentHelper._appendElementRow(WebInspector.UIString("Aggregated Time"), this._generateAggregatedInfo());
+}
+var text = WebInspector.UIString("%s (at %s)", Number.secondsToString(this._lastChildEndTime - this.startTime, WebInspector.UIString),
+calculator.formatValue(this.startTime - calculator.minimumBoundary));
+contentHelper._appendTextRow(WebInspector.UIString("Duration"), text);
+
+const recordTypes = WebInspector.TimelineAgent.RecordType;
+
+switch (this.type) {
+case recordTypes.GCEvent:
+contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data.usedHeapSizeDelta, WebInspector.UIString));
+break;
+case recordTypes.TimerInstall:
+case recordTypes.TimerFire:
+case recordTypes.TimerRemove:
+contentHelper._appendTextRow(WebInspector.UIString("Timer ID"), this.data.timerId);
+if (typeof this.timeout === "number") {
+contentHelper._appendTextRow(WebInspector.UIString("Timeout"), Number.secondsToString(this.timeout / 1000, WebInspector.UIString));
+contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
+}
+break;
+case recordTypes.FunctionCall:
+contentHelper._appendLinkRow(WebInspector.UIString("Location"), this.data.scriptName, this.data.scriptLine);
+break;
+case recordTypes.ScheduleResourceRequest:
+case recordTypes.ResourceSendRequest:
+case recordTypes.ResourceReceiveResponse:
+case recordTypes.ResourceReceiveData:
+case recordTypes.ResourceFinish:
+contentHelper._appendLinkRow(WebInspector.UIString("Resource"), this.data.url);
+if (this.data.requestMethod)
+contentHelper._appendTextRow(WebInspector.UIString("Request Method"), this.data.requestMethod);
+if (typeof this.data.statusCode === "number")
+contentHelper._appendTextRow(WebInspector.UIString("Status Code"), this.data.statusCode);
+if (this.data.mimeType)
+contentHelper._appendTextRow(WebInspector.UIString("MIME Type"), this.data.mimeType);
+if (typeof this.data.expectedContentLength === "number" && this.data.expectedContentLength !== -1)
+contentHelper._appendTextRow(WebInspector.UIString("Expected Content Length"), this.data.expectedContentLength);
+break;
+case recordTypes.EvaluateScript:
+if (this.data && this.data.url)
+contentHelper._appendLinkRow(WebInspector.UIString("Script"), this.data.url, this.data.lineNumber);
+break;
+case recordTypes.Paint:
+contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data.x, this.data.y));
+contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data.width, this.data.height));
+case recordTypes.RecalculateStyles: 
+break;
+default:
+if (this.details)
+contentHelper._appendTextRow(WebInspector.UIString("Details"), this.details);
+break;
+}
+
+if (this.data.scriptName && this.type !== recordTypes.FunctionCall)
+contentHelper._appendLinkRow(WebInspector.UIString("Function Call"), this.data.scriptName, this.data.scriptLine);
+
+if (this.usedHeapSize)
+contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize, WebInspector.UIString), Number.bytesToString(this.totalHeapSize, WebInspector.UIString)));
+
+if (this.callSiteStackTrace && this.callSiteStackTrace.length)
+contentHelper._appendStackTrace(WebInspector.UIString("Call Site stack"), this.callSiteStackTrace);
+
+if (this.stackTrace)
+contentHelper._appendStackTrace(WebInspector.UIString("Call Stack"), this.stackTrace);
+
+return contentHelper._contentTable;
+},
+
+_getRecordDetails: function(record, sendRequestRecords)
+{
+switch (record.type) {
+case WebInspector.TimelineAgent.RecordType.GCEvent:
+return WebInspector.UIString("%s collected", Number.bytesToString(record.data.usedHeapSizeDelta, WebInspector.UIString));
+case WebInspector.TimelineAgent.RecordType.TimerFire:
+return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine, "", "") : record.data.timerId;
+case WebInspector.TimelineAgent.RecordType.FunctionCall:
+return record.data.scriptName ? WebInspector.linkifyResourceAsNode(record.data.scriptName, "scripts", record.data.scriptLine, "", "") : null;
+case WebInspector.TimelineAgent.RecordType.EventDispatch:
+return record.data ? record.data.type : null;
+case WebInspector.TimelineAgent.RecordType.Paint:
+return record.data.width + "\u2009\u00d7\u2009" + record.data.height;
+case WebInspector.TimelineAgent.RecordType.TimerInstall:
+case WebInspector.TimelineAgent.RecordType.TimerRemove:
+return this.stackTrace ? WebInspector.linkifyResourceAsNode(this.stackTrace[0].scriptName, "scripts", this.stackTrace[0].lineNumber, "", "") : record.data.timerId;
+case WebInspector.TimelineAgent.RecordType.ParseHTML:
+case WebInspector.TimelineAgent.RecordType.RecalculateStyles:
+return this.stackTrace ? WebInspector.linkifyResourceAsNode(this.stackTrace[0].scriptName, "scripts", this.stackTrace[0].lineNumber, "", "") : null;
+case WebInspector.TimelineAgent.RecordType.EvaluateScript:
+return record.data.url ? WebInspector.linkifyResourceAsNode(record.data.url, "scripts", record.data.lineNumber, "", "") : null;
+case WebInspector.TimelineAgent.RecordType.XHRReadyStateChange:
+case WebInspector.TimelineAgent.RecordType.XHRLoad:
+case WebInspector.TimelineAgent.RecordType.ScheduleResourceRequest:
+case WebInspector.TimelineAgent.RecordType.ResourceSendRequest:
+case WebInspector.TimelineAgent.RecordType.ResourceReceiveData:
+case WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse:
+case WebInspector.TimelineAgent.RecordType.ResourceFinish:
+return WebInspector.displayNameForURL(record.data.url);
+case WebInspector.TimelineAgent.RecordType.MarkTimeline:
+return record.data.message;
+default:
+return null;
+}
+},
+
+_calculateAggregatedStats: function(categories)
+{
+this._aggregatedStats = {};
+for (var category in categories)
+this._aggregatedStats[category] = 0;
+this._cpuTime = this._selfTime;
+
+if (this._children) {
+for (var index = this._children.length; index; --index) {
+var child = this._children[index - 1];
+this._aggregatedStats[child.category.name] += child._selfTime;
+for (var category in categories)
+this._aggregatedStats[category] += child._aggregatedStats[category];
+}
+for (var category in this._aggregatedStats)
+this._cpuTime += this._aggregatedStats[category];
+}
+}
+}
+
+WebInspector.TimelinePanel.PopupContentHelper = function(title)
+{
+this._contentTable = document.createElement("table");;
+var titleCell = this._createCell(WebInspector.UIString("%s - Details", title), "timeline-details-title");
+titleCell.colSpan = 2;
+var titleRow = document.createElement("tr");
+titleRow.appendChild(titleCell);
+this._contentTable.appendChild(titleRow);
+}
+
+WebInspector.TimelinePanel.PopupContentHelper.prototype = {
+_createCell: function(content, styleName)
+{
+var text = document.createElement("label");
+text.appendChild(document.createTextNode(content));
+var cell = document.createElement("td");
+cell.className = "timeline-details";
+if (styleName)
+cell.className += " " + styleName;
+cell.textContent = content;
+return cell;
+},
+
+_appendTextRow: function(title, content)
+{
+var row = document.createElement("tr");
+row.appendChild(this._createCell(title, "timeline-details-row-title"));
+row.appendChild(this._createCell(content, "timeline-details-row-data"));
+this._contentTable.appendChild(row);
+},
+
+_appendElementRow: function(title, content, titleStyle)
+{
+var row = document.createElement("tr");
+var titleCell = this._createCell(title, "timeline-details-row-title");
+if (titleStyle)
+titleCell.addStyleClass(titleStyle);
+row.appendChild(titleCell);
+var cell = document.createElement("td");
+cell.className = "timeline-details";
+cell.appendChild(content);
+row.appendChild(cell);
+this._contentTable.appendChild(row);
+},
+
+_appendLinkRow: function(title, scriptName, scriptLine)
+{
+var link = WebInspector.linkifyResourceAsNode(scriptName, "scripts", scriptLine, "timeline-details");
+this._appendElementRow(title, link);
+},
+
+_appendStackTrace: function(title, stackTrace)
+{
+this._appendTextRow("", "");
+var framesTable = document.createElement("table");
+for (var i = 0; i < stackTrace.length; ++i) {
+var stackFrame = stackTrace[i];
+var row = document.createElement("tr");
+row.className = "timeline-details";
+row.appendChild(this._createCell(stackFrame.functionName ? stackFrame.functionName : WebInspector.UIString("(anonymous function)"), "timeline-function-name"));
+row.appendChild(this._createCell(" @ "));
+var linkCell = document.createElement("td");
+linkCell.appendChild(WebInspector.linkifyResourceAsNode(stackFrame.scriptName, "scripts", stackFrame.lineNumber, "timeline-details"));
+row.appendChild(linkCell);
+framesTable.appendChild(row);
+}
+this._appendElementRow(title, framesTable, "timeline-stacktrace-title");
+}
+}
+
+WebInspector.TimelineExpandableElement = function(container)
+{
+this._element = document.createElement("div");
+this._element.className = "timeline-expandable";
+
+var leftBorder = document.createElement("div");
+leftBorder.className = "timeline-expandable-left";
+this._element.appendChild(leftBorder);
+
+container.appendChild(this._element);
+}
+
+WebInspector.TimelineExpandableElement.prototype = {
+_update: function(record, index, barPosition)
+{
+const rowHeight = WebInspector.TimelinePanel.rowHeight;
+if (record._visibleChildrenCount || record._invisibleChildrenCount) {
+this._element.style.top = index * rowHeight + "px";
+this._element.style.left = barPosition.left + "px";
+this._element.style.width = Math.max(12, barPosition.width + 25) + "px";
+if (!record.collapsed) {
+this._element.style.height = (record._visibleChildrenCount + 1) * rowHeight + "px";
+this._element.addStyleClass("timeline-expandable-expanded");
+this._element.removeStyleClass("timeline-expandable-collapsed");
+} else {
+this._element.style.height = rowHeight + "px";
+this._element.addStyleClass("timeline-expandable-collapsed");
+this._element.removeStyleClass("timeline-expandable-expanded");
+}
+this._element.removeStyleClass("hidden");
+} else
+this._element.addStyleClass("hidden");
+},
+
+_dispose: function()
+{
+this._element.parentElement.removeChild(this._element);
+}
+}
+
+
+
+
+
+WebInspector.TimelineOverviewPane = function(categories)
+{
+this._categories = categories;
+
+this.statusBarFilters = document.createElement("div");
+this.statusBarFilters.className = "status-bar-items";
+for (var categoryName in this._categories) {
+var category = this._categories[categoryName];
+this.statusBarFilters.appendChild(this._createTimelineCategoryStatusBarCheckbox(category, this._onCheckboxClicked.bind(this, category)));
+}
+
+this._overviewGrid = new WebInspector.TimelineGrid();
+this._overviewGrid.element.id = "timeline-overview-grid";
+this._overviewGrid.itemsGraphsElement.id = "timeline-overview-timelines";
+this._overviewGrid.element.addEventListener("mousedown", this._dragWindow.bind(this), true);
+
+this._heapGraph = new WebInspector.HeapGraph();
+this._heapGraph.element.id = "timeline-overview-memory";
+this._overviewGrid.element.insertBefore(this._heapGraph.element, this._overviewGrid.itemsGraphsElement);
+
+this.element = this._overviewGrid.element;
+
+this._categoryGraphs = {};
+var i = 0;
+for (var category in this._categories) {
+var categoryGraph = new WebInspector.TimelineCategoryGraph(this._categories[category], i++ % 2);
+this._categoryGraphs[category] = categoryGraph;
+this._overviewGrid.itemsGraphsElement.appendChild(categoryGraph.graphElement);
+}
+this._overviewGrid.setScrollAndDividerTop(0, 0);
+
+this._overviewWindowElement = document.createElement("div");
+this._overviewWindowElement.id = "timeline-overview-window";
+this._overviewGrid.element.appendChild(this._overviewWindowElement);
+
+this._overviewWindowBordersElement = document.createElement("div");
+this._overviewWindowBordersElement.className = "timeline-overview-window-rulers";
+this._overviewGrid.element.appendChild(this._overviewWindowBordersElement);
+
+var overviewDividersBackground = document.createElement("div");
+overviewDividersBackground.className = "timeline-overview-dividers-background";
+this._overviewGrid.element.appendChild(overviewDividersBackground);
+
+this._leftResizeElement = document.createElement("div");
+this._leftResizeElement.className = "timeline-window-resizer";
+this._leftResizeElement.style.left = 0;
+this._overviewGrid.element.appendChild(this._leftResizeElement);
+
+this._rightResizeElement = document.createElement("div");
+this._rightResizeElement.className = "timeline-window-resizer timeline-window-resizer-right";
+this._rightResizeElement.style.right = 0;
+this._overviewGrid.element.appendChild(this._rightResizeElement);
+
+this._overviewCalculator = new WebInspector.TimelineOverviewCalculator();
+
+this.windowLeft = 0.0;
+this.windowRight = 1.0;
+}
+
+WebInspector.TimelineOverviewPane.minSelectableSize = 12;
+
+WebInspector.TimelineOverviewPane.prototype = {
+showTimelines: function(event) {
+this._heapGraph.hide();
+this._overviewGrid.itemsGraphsElement.removeStyleClass("hidden");
+},
+
+showMemoryGraph: function(records) {
+this._heapGraph.show();
+this._heapGraph.update(records);
+this._overviewGrid.itemsGraphsElement.addStyleClass("hidden");
+},
+
+_onCheckboxClicked: function (category, event) {
+if (event.target.checked)
+category.hidden = false;
+else
+category.hidden = true;
+this._categoryGraphs[category.name].dimmed = !event.target.checked;
+this.dispatchEventToListeners("filter changed");
+},
+
+_forAllRecords: function(recordsArray, callback)
+{
+if (!recordsArray)
+return;
+for (var i = 0; i < recordsArray.length; ++i) {
+callback(recordsArray[i]);
+this._forAllRecords(recordsArray[i].children, callback);
+}
+},
+
+update: function(records, showShortEvents)
+{
+this._showShortEvents = showShortEvents;
+
+var timelines = {};
+for (var category in this._categories) {
+timelines[category] = [];
+this._categoryGraphs[category].clearChunks();
+}
+
+
+this._overviewCalculator.reset();
+this._forAllRecords(records, this._overviewCalculator.updateBoundaries.bind(this._overviewCalculator));
+
+function markTimeline(record)
+{
+if (!(this._showShortEvents || record.isLong()))
+return;
+var percentages = this._overviewCalculator.computeBarGraphPercentages(record);
+
+var end = Math.round(percentages.end);
+var categoryName = record.category.name;
+for (var j = Math.round(percentages.start); j <= end; ++j)
+timelines[categoryName][j] = true;
+}
+this._forAllRecords(records, markTimeline.bind(this));
+
+
+for (var category in this._categories) {
+var timeline = timelines[category];
+window.timelineSaved = timeline;
+var chunkStart = -1;
+for (var j = 0; j < 101; ++j) {
+if (timeline[j]) {
+if (chunkStart === -1)
+chunkStart = j;
+} else {
+if (chunkStart !== -1) {
+this._categoryGraphs[category].addChunk(chunkStart, j);
+chunkStart = -1;
+}
+}
+}
+if (chunkStart !== -1) {
+this._categoryGraphs[category].addChunk(chunkStart, 100);
+chunkStart = -1;
+}
+}
+
+this._heapGraph.setSize(this._overviewGrid.element.offsetWidth, 60);
+if (this._heapGraph.visible)
+this._heapGraph.update(records);
+
+this._overviewGrid.updateDividers(true, this._overviewCalculator);
+},
+
+updateEventDividers: function(records, dividerConstructor)
+{
+this._overviewGrid.removeEventDividers();
+var dividers = [];
+for (var i = 0; i < records.length; ++i) {
+var record = records[i];
+var positions = this._overviewCalculator.computeBarGraphPercentages(record);
+var dividerPosition = Math.round(positions.start * 10);
+if (dividers[dividerPosition])
+continue;
+var divider = dividerConstructor(record);
+divider.style.left = positions.start + "%";
+dividers[dividerPosition] = divider;
+}
+this._overviewGrid.addEventDividers(dividers);
+},
+
+updateMainViewWidth: function(width, records)
+{
+this._overviewGrid.element.style.left = width + "px";
+this.statusBarFilters.style.left = Math.max(155, width) + "px";
+},
+
+reset: function()
+{
+this.windowLeft = 0.0;
+this.windowRight = 1.0;
+this._overviewWindowElement.style.left = "0%";
+this._overviewWindowElement.style.width = "100%";
+this._overviewWindowBordersElement.style.left = "0%";
+this._overviewWindowBordersElement.style.right = "0%";
+this._leftResizeElement.style.left = "0%";
+this._rightResizeElement.style.left = "100%";
+this._overviewCalculator.reset();
+this._overviewGrid.updateDividers(true, this._overviewCalculator);
+},
+
+_resizeWindow: function(resizeElement, event)
+{
+WebInspector.elementDragStart(resizeElement, this._windowResizeDragging.bind(this, resizeElement), this._endWindowDragging.bind(this), event, "col-resize");
+},
+
+_windowResizeDragging: function(resizeElement, event)
+{
+if (resizeElement === this._leftResizeElement)
+this._resizeWindowLeft(event.pageX - this._overviewGrid.element.offsetLeft);
+else
+this._resizeWindowRight(event.pageX - this._overviewGrid.element.offsetLeft);
+event.preventDefault();
+},
+
+_dragWindow: function(event)
+{
+var node = event.target;
+while (node) {
+if (node === this._overviewGrid._dividersLabelBarElement) {
+WebInspector.elementDragStart(this._overviewWindowElement, this._windowDragging.bind(this, event.pageX,
+this._leftResizeElement.offsetLeft, this._rightResizeElement.offsetLeft), this._endWindowDragging.bind(this), event, "ew-resize");
+break;
+} else if (node === this._overviewGrid.element) {
+var position = event.pageX - this._overviewGrid.element.offsetLeft;
+this._overviewWindowSelector = new WebInspector.TimelinePanel.WindowSelector(this._overviewGrid.element, position, event);
+WebInspector.elementDragStart(null, this._windowSelectorDragging.bind(this), this._endWindowSelectorDragging.bind(this), event, "col-resize");
+break;
+} else if (node === this._leftResizeElement || node === this._rightResizeElement) {
+this._resizeWindow(node, event);
+break;
+}
+node = node.parentNode;
+}
+},
+
+_windowSelectorDragging: function(event)
+{
+this._overviewWindowSelector._updatePosition(event.pageX - this._overviewGrid.element.offsetLeft);
+event.preventDefault();
+},
+
+_endWindowSelectorDragging: function(event)
+{
+WebInspector.elementDragEnd(event);
+var window = this._overviewWindowSelector._close(event.pageX - this._overviewGrid.element.offsetLeft);
+delete this._overviewWindowSelector;
+if (window.end - window.start < WebInspector.TimelineOverviewPane.minSelectableSize)
+if (this._overviewGrid.itemsGraphsElement.offsetWidth - window.end > WebInspector.TimelineOverviewPane.minSelectableSize)
+window.end = window.start + WebInspector.TimelineOverviewPane.minSelectableSize;
+else
+window.start = window.end - WebInspector.TimelineOverviewPane.minSelectableSize;
+this._setWindowPosition(window.start, window.end);
+},
+
+_windowDragging: function(startX, windowLeft, windowRight, event)
+{
+var delta = event.pageX - startX;
+var start = windowLeft + delta;
+var end = windowRight + delta;
+var windowSize = windowRight - windowLeft;
+
+if (start < 0) {
+start = 0;
+end = windowSize;
+}
+
+if (end > this._overviewGrid.element.clientWidth) {
+end = this._overviewGrid.element.clientWidth;
+start = end - windowSize;
+}
+this._setWindowPosition(start, end);
+
+event.preventDefault();
+},
+
+_resizeWindowLeft: function(start)
+{
+
+if (start < 10)
+start = 0;
+else if (start > this._rightResizeElement.offsetLeft -  4)
+start = this._rightResizeElement.offsetLeft - 4;
+this._setWindowPosition(start, null);
+},
+
+_resizeWindowRight: function(end)
+{
+
+if (end > this._overviewGrid.element.clientWidth - 10)
+end = this._overviewGrid.element.clientWidth;
+else if (end < this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.minSelectableSize)
+end = this._leftResizeElement.offsetLeft + WebInspector.TimelineOverviewPane.minSelectableSize;
+this._setWindowPosition(null, end);
+},
+
+_setWindowPosition: function(start, end)
+{
+const rulerAdjustment = 1 / this._overviewGrid.element.clientWidth;
+if (typeof start === "number") {
+this.windowLeft = start / this._overviewGrid.element.clientWidth;
+this._leftResizeElement.style.left = this.windowLeft * 100 + "%";
+this._overviewWindowElement.style.left = this.windowLeft * 100 + "%";
+this._overviewWindowBordersElement.style.left = (this.windowLeft - rulerAdjustment) * 100 + "%";
+}
+if (typeof end === "number") {
+this.windowRight = end / this._overviewGrid.element.clientWidth;
+this._rightResizeElement.style.left = this.windowRight * 100 + "%";
+}
+this._overviewWindowElement.style.width = (this.windowRight - this.windowLeft) * 100 + "%";
+this._overviewWindowBordersElement.style.right = (1 - this.windowRight + 2 * rulerAdjustment) * 100 + "%";
+this.dispatchEventToListeners("window changed");
+},
+
+_endWindowDragging: function(event)
+{
+WebInspector.elementDragEnd(event);
+},
+
+_createTimelineCategoryStatusBarCheckbox: function(category, onCheckboxClicked)
+{
+var labelContainer = document.createElement("div");
+labelContainer.addStyleClass("timeline-category-statusbar-item");
+labelContainer.addStyleClass("timeline-category-" + category.name);
+labelContainer.addStyleClass("status-bar-item");
+
+var label = document.createElement("label");
+var checkElement = document.createElement("input");
+checkElement.type = "checkbox";
+checkElement.className = "timeline-category-checkbox";
+checkElement.checked = true;
+checkElement.addEventListener("click", onCheckboxClicked);
+label.appendChild(checkElement);
+
+var typeElement = document.createElement("span");
+typeElement.className = "type";
+typeElement.textContent = category.title;
+label.appendChild(typeElement);
+
+labelContainer.appendChild(label);
+return labelContainer;
+}
+
+}
+
+WebInspector.TimelineOverviewPane.prototype.__proto__ = WebInspector.Object.prototype;
+
+
+WebInspector.TimelineOverviewCalculator = function()
+{
+}
+
+WebInspector.TimelineOverviewCalculator.prototype = {
+computeBarGraphPercentages: function(record)
+{
+var start = (record.startTime - this.minimumBoundary) / this.boundarySpan * 100;
+var end = (record.endTime - this.minimumBoundary) / this.boundarySpan * 100;
+return {start: start, end: end};
+},
+
+reset: function()
+{
+delete this.minimumBoundary;
+delete this.maximumBoundary;
+},
+
+updateBoundaries: function(record)
+{
+if (typeof this.minimumBoundary === "undefined" || record.startTime < this.minimumBoundary) {
+this.minimumBoundary = record.startTime;
+return true;
+}
+if (typeof this.maximumBoundary === "undefined" || record.endTime > this.maximumBoundary) {
+this.maximumBoundary = record.endTime;
+return true;
+}
+return false;
+},
+
+get boundarySpan()
+{
+return this.maximumBoundary - this.minimumBoundary;
+},
+
+formatValue: function(value)
+{
+return Number.secondsToString(value, WebInspector.UIString);
+}
+}
+
+
+WebInspector.TimelineCategoryGraph = function(category, isEven)
+{
+this._category = category;
+
+this._graphElement = document.createElement("div");
+this._graphElement.className = "timeline-graph-side timeline-overview-graph-side" + (isEven ? " even" : "");
+
+this._barAreaElement = document.createElement("div");
+this._barAreaElement.className = "timeline-graph-bar-area timeline-category-" + category.name;
+this._graphElement.appendChild(this._barAreaElement);
+}
+
+WebInspector.TimelineCategoryGraph.prototype = {
+get graphElement()
+{
+return this._graphElement;
+},
+
+addChunk: function(start, end)
+{
+var chunk = document.createElement("div");
+chunk.className = "timeline-graph-bar";
+this._barAreaElement.appendChild(chunk);
+chunk.style.setProperty("left", start + "%");
+chunk.style.setProperty("width", (end - start) + "%");
+},
+
+clearChunks: function()
+{
+this._barAreaElement.removeChildren();
+},
+
+set dimmed(dimmed)
+{
+if (dimmed)
+this._barAreaElement.removeStyleClass("timeline-category-" + this._category.name);
+else
+this._barAreaElement.addStyleClass("timeline-category-" + this._category.name);
+}
+}
+
+WebInspector.TimelinePanel.WindowSelector = function(parent, position, event)
+{
+this._startPosition = position;
+this._width = parent.offsetWidth;
+this._windowSelector = document.createElement("div");
+this._windowSelector.className = "timeline-window-selector";
+this._windowSelector.style.left = this._startPosition + "px";
+this._windowSelector.style.right = this._width - this._startPosition +  + "px";
+parent.appendChild(this._windowSelector);
+}
+
+WebInspector.TimelinePanel.WindowSelector.prototype = {
+_createSelectorElement: function(parent, left, width, height)
+{
+var selectorElement = document.createElement("div");
+selectorElement.className = "timeline-window-selector";
+selectorElement.style.left = left + "px";
+selectorElement.style.width = width + "px";
+selectorElement.style.top = "0px";
+selectorElement.style.height = height + "px";
+parent.appendChild(selectorElement);
+return selectorElement;
+},
+
+_close: function(position)
+{
+position = Math.max(0, Math.min(position, this._width));
+this._windowSelector.parentNode.removeChild(this._windowSelector);
+return this._startPosition < position ? {start: this._startPosition, end: position} : {start: position, end: this._startPosition};
+},
+
+_updatePosition: function(position)
+{
+position = Math.max(0, Math.min(position, this._width));
+if (position < this._startPosition) {
+this._windowSelector.style.left = position + "px";
+this._windowSelector.style.right = this._width - this._startPosition + "px";
+} else {
+this._windowSelector.style.left = this._startPosition + "px";
+this._windowSelector.style.right = this._width - position + "px";
+}
+}
+}
+
+WebInspector.HeapGraph = function() {
+this._canvas = document.createElement("canvas");
+
+this._maxHeapSizeLabel = document.createElement("div");
+this._maxHeapSizeLabel.addStyleClass("memory-graph-label");
+
+this._element = document.createElement("div");
+this._element.addStyleClass("hidden");
+this._element.appendChild(this._canvas);
+this._element.appendChild(this._maxHeapSizeLabel);
+}
+
+WebInspector.HeapGraph.prototype = {
+get element() {
+
+return this._element;
+},
+
+get visible() {
+return !this.element.hasStyleClass("hidden");
+},
+
+show: function() {
+this.element.removeStyleClass("hidden");
+},
+
+hide: function() {
+this.element.addStyleClass("hidden");
+},
+
+setSize: function(w, h) {
+this._canvas.width = w;
+this._canvas.height = h - 5;
+},
+
+update: function(records)
+{
+if (!records.length)
+return;
+
+var maxTotalHeapSize = 0;
+var minTime;
+var maxTime;
+this._forAllRecords(records, function(r) {
+if (r.totalHeapSize && r.totalHeapSize > maxTotalHeapSize)
+maxTotalHeapSize = r.totalHeapSize;
+
+if (typeof minTime === "undefined" || r.startTime < minTime)
+minTime = r.startTime;
+if (typeof maxTime === "undefined" || r.endTime > maxTime)
+maxTime = r.endTime;
+});
+
+var width = this._canvas.width;
+var height = this._canvas.height;
+var xFactor = width / (maxTime - minTime);
+var yFactor = height / maxTotalHeapSize;
+
+var histogram = new Array(width);
+this._forAllRecords(records, function(r) {
+if (!r.usedHeapSize)
+return;
+var x = Math.round((r.endTime - minTime) * xFactor);
+var y = Math.round(r.usedHeapSize * yFactor);
+histogram[x] = Math.max(histogram[x] || 0, y);
+});
+
+var ctx = this._canvas.getContext("2d");
+this._clear(ctx);
+
+
+height = height + 1;
+
+ctx.beginPath();
+var initialY = 0;
+for (var k = 0; k < histogram.length; k++) {
+if (histogram[k]) {
+initialY = histogram[k];
+break;
+}
+}
+ctx.moveTo(0, height - initialY);
+
+for (var x = 0; x < histogram.length; x++) {
+if (!histogram[x])
+continue;
+ctx.lineTo(x, height - histogram[x]);
+}
+
+ctx.lineWidth = 0.5;
+ctx.strokeStyle = "rgba(20,0,0,0.8)";
+ctx.stroke();
+
+ctx.fillStyle = "rgba(214,225,254, 0.8);";
+ctx.lineTo(width, 60);
+ctx.lineTo(0, 60);
+ctx.lineTo(0, height - initialY);
+ctx.fill();
+ctx.closePath();
+
+this._maxHeapSizeLabel.textContent = Number.bytesToString(maxTotalHeapSize);
+},
+
+_clear: function(ctx) {
+ctx.fillStyle = "rgba(255,255,255,0.8)";
+ctx.fillRect(0, 0, this._canvas.width, this._canvas.height);
+},
+
+_forAllRecords: WebInspector.TimelineOverviewPane.prototype._forAllRecords
+}
+
+
+
+
+
+WebInspector.TestController = function(callId)
+{
+this._callId = callId;
+this._waitUntilDone = false;
+this.results = [];
+}
+
+WebInspector.TestController.prototype = {
+waitUntilDone: function()
+{
+this._waitUntilDone = true;
+},
+
+notifyDone: function(result)
+{
+if (typeof result === "undefined" && this.results.length)
+result = this.results;
+var message = typeof result === "undefined" ? "\"<undefined>\"" : JSON.stringify(result);
+InspectorBackend.didEvaluateForTestInFrontend(this._callId, message);
+},
+
+runAfterPendingDispatches: function(callback)
+{
+if (WebInspector.pendingDispatches === 0) {
+callback();
+return;
+}
+setTimeout(this.runAfterPendingDispatches.bind(this), 0, callback);
+}
+}
+
+WebInspector.evaluateForTestInFrontend = function(callId, script)
+{
+var controller = new WebInspector.TestController(callId);
+function invokeMethod()
+{
+try {
+var result;
+if (window[script] && typeof window[script] === "function")
+result = window[script].call(WebInspector, controller);
+else
+result = window.eval(script);
+
+if (!controller._waitUntilDone)
+controller.notifyDone(result);
+} catch (e) {
+controller.notifyDone(e.toString());
+}
+}
+controller.runAfterPendingDispatches(invokeMethod);
+}
+
+
+
+
+
+WebInspector.HelpScreen = function(title)
+{
+this._element = document.createElement("div");
+this._element.className = "help-window-outer";
+this._element.addEventListener("keydown", this._onKeyDown.bind(this), false);
+
+var mainWindow = this._element.createChild("div", "help-window-main");
+var captionWindow = mainWindow.createChild("div", "help-window-caption");
+var closeButton = captionWindow.createChild("button", "help-close-button");
+this.contentElement = mainWindow.createChild("div", "help-content");
+this.contentElement.tabIndex = 0;
+this.contentElement.addEventListener("blur", this._onBlur.bind(this), false);
+captionWindow.createChild("h1", "help-window-title").innerText = title;
+
+closeButton.innerText = "\u2716"; 
+closeButton.addEventListener("click", this._hide.bind(this), false);
+this._closeKeys = [
+WebInspector.KeyboardShortcut.Keys.Enter.code,
+WebInspector.KeyboardShortcut.Keys.Esc.code,
+WebInspector.KeyboardShortcut.Keys.Space.code,
+];
+document.body.appendChild(this._element);
+}
+
+WebInspector.HelpScreen.prototype = {
+show: function()
+{
+if (this._isShown)
+return;
+
+this._element.style.visibility = "visible";
+this._isShown = true;
+this._previousFocusElement = WebInspector.currentFocusElement;
+WebInspector.currentFocusElement = this.contentElement;
+},
+
+_hide: function()
+{
+this._isShown = false;
+this._element.style.visibility = "hidden";
+WebInspector.currentFocusElement = this._previousFocusElement;
+},
+
+_onKeyDown: function(event)
+{
+if (this._isShown && this._closeKeys.indexOf(event.keyCode) >= 0) {
+this._hide();
+event.stopPropagation();
+}
+},
+
+_onBlur: function()
+{
+
+if (this._isShown)
+WebInspector.currentFocusElement = this.contentElement;
+}
+}
+
+
+
+
+
+WebInspector.GoToLineDialog = function(view)
+{
+this._element = document.createElement("div");
+this._element.className = "go-to-line-dialog";
+this._element.addEventListener("keydown", this._onKeyDown.bind(this), false);
+this._closeKeys = [
+WebInspector.KeyboardShortcut.Keys.Enter.code,
+WebInspector.KeyboardShortcut.Keys.Esc.code,
+];
+
+var dialogWindow = this._element;
+
+dialogWindow.createChild("label").innerText = WebInspector.UIString("Go to line: ");
+
+this._input = dialogWindow.createChild("input");
+this._input.setAttribute("type", "text");
+this._input.setAttribute("size", 6);
+var linesCount = view.sourceFrame.textModel.linesCount;
+if (linesCount)
+this._input.setAttribute("title", WebInspector.UIString("1 - %d", linesCount));
+var blurHandler = this._onBlur.bind(this);
+this._input.addEventListener("blur", blurHandler, false);
+
+
+var go = dialogWindow.createChild("button");
+go.innerText = WebInspector.UIString("Go");
+go.addEventListener("click", this._onClick.bind(this), false);
+go.addEventListener("mousedown", function(e) {
+
+
+this._input.removeEventListener("blur", blurHandler, false);
+}.bind(this), false);
+
+this._view = view;
+view.element.appendChild(this._element);
+
+this._previousFocusElement = WebInspector.currentFocusElement;
+WebInspector.currentFocusElement = this._input;
+this._input.select();
+}
+
+WebInspector.GoToLineDialog.show = function(sourceView)
+{
+if (this._instance)
+return;
+this._instance = new WebInspector.GoToLineDialog(sourceView);
+}
+
+WebInspector.GoToLineDialog.prototype = {
+_hide: function()
+{
+if (this._isHiding)
+return;
+this._isHiding = true;
+
+WebInspector.currentFocusElement = this._previousFocusElement;
+WebInspector.GoToLineDialog._instance = null;
+this._element.parentElement.removeChild(this._element);
+},
+
+_onBlur: function(event)
+{
+this._hide();
+},
+
+_onKeyDown: function(event)
+{
+if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Tab.code) {
+event.preventDefault();
+return;
+}
+
+if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code)
+this._highlightSelectedLine();
+
+if (this._closeKeys.indexOf(event.keyCode) >= 0) {
+this._hide();
+event.stopPropagation();
+}
+},
+
+_onClick: function(event)
+{
+this._highlightSelectedLine();
+this._hide();
+},
+
+_highlightSelectedLine: function()
+{
+var value = this._input.value;
+var lineNumber = parseInt(value, 10);
+if (!isNaN(lineNumber) && lineNumber > 0) {
+lineNumber = Math.min(lineNumber, this._view.sourceFrame.textModel.linesCount);
+this._view.highlightLine(lineNumber);
+}
+}
 };
 
 
-/**
- * This override is necessary for adding script source asynchronously.
- * @override
- */
-WebInspector.ScriptView.prototype.setupSourceFrameIfNeeded = function()
+
+
+
+WebInspector.ShortcutsHelp = function()
 {
-    if (!this._frameNeedsSetup)
-        return;
+this._sections = {};
+}
 
-    this.attach();
+WebInspector.ShortcutsHelp.prototype = {
+section: function(name)
+{
+var section = this._sections[name];
+if (!section)
+this._sections[name] = section = new WebInspector.ShortcutsSection(name);
+return section;
+},
 
-    if (this.script.source)
-        this.didResolveScriptSource_();
-    else {
-        var self = this;
-        devtools.tools.getDebuggerAgent().resolveScriptSource(
-            this.script.sourceID,
-            function(source) {
-                self.script.source = source || WebInspector.UIString("<source is not available>");
-                self.didResolveScriptSource_();
-            });
-    }
+show: function()
+{
+if (!this._helpScreen) {
+this._helpScreen = new WebInspector.HelpScreen(WebInspector.UIString("Keyboard Shortcuts"));
+this._buildTable(this._helpScreen.contentElement, 2);
+}
+this._helpScreen.show();
+},
+
+_buildTable: function(parent, nColumns)
+{
+var height = 0;
+var orderedSections = [];
+for (var section in this._sections) {
+height += this._sections[section]._height;
+orderedSections.push(this._sections[section])
+}
+function compareSections(a, b)
+{
+return a.order - b.order;
+}
+orderedSections = orderedSections.sort(compareSections);
+
+const wrapAfter = height / nColumns;
+var table = document.createElement("table");
+table.className = "help-table";
+var row = table.createChild("tr");
+
+
+
+for (var section = 0; section < orderedSections.length;) {
+var td = row.createChild("td");
+td.style.width = (100 / nColumns) + "%";
+var column = td.createChild("table");
+for (var columnHeight = 0;
+columnHeight < wrapAfter && section < orderedSections.length;
+columnHeight += orderedSections[section]._height, section++) {
+orderedSections[section].renderSection(column);
+}
+}
+parent.appendChild(table);
+}
+};
+
+WebInspector.shortcutsHelp = new WebInspector.ShortcutsHelp();
+
+WebInspector.ShortcutsSection = function(name)
+{
+this.name = name;
+this._lines = [];
+this.order = ++WebInspector.ShortcutsSection._sequenceNumber;
+};
+
+WebInspector.ShortcutsSection._sequenceNumber = 0;
+
+WebInspector.ShortcutsSection.prototype = {
+addKey: function(key, description)
+{
+this.addLine(this._renderKey(key), description);
+},
+
+addRelatedKeys: function(keys, description)
+{
+this.addLine(this._renderSequence(keys,"/"), description);
+},
+
+addAlternateKeys: function(keys, description)
+{
+this.addLine(this._renderSequence(keys,WebInspector.UIString("or")), description);
+},
+
+addLine: function(htmlKey, description)
+{
+this._lines.push({ key: htmlKey, text: description })
+},
+
+renderSection: function(parent)
+{
+this._renderHeader(parent);
+
+for (var line = 0; line < this._lines.length; ++line) {
+var tr = parent.createChild("tr");
+tr.createChild("td", "help-key-cell").innerHTML = this._lines[line].key + " : ";
+tr.createChild("td").innerText = this._lines[line].text;
+}
+},
+
+_renderHeader: function(parent)
+{
+var trHead = parent.createChild("tr");
+
+trHead.createChild("th");
+trHead.createChild("th").innerText = this.name;
+},
+
+_renderSequence: function(sequence, delimiter)
+{
+var delimiterHtml = '<span class="help-key-delimiter">' + delimiter.escapeHTML() + '</span>'
+return sequence.map(this._renderKey).join(delimiterHtml);
+},
+
+_renderKey: function(key)
+{
+function renderLabel(label)
+{
+return '<span class="help-key monospace">' + label.escapeHTML() + '</span>';
+}
+return key.split(" + ").map(renderLabel).join('<span class="help-combine-keys">+</span>');
+},
+
+get _height()
+{
+return this._lines.length + 2; 
+}
 };
 
 
-/**
- * Performs source frame setup when script source is aready resolved.
- */
-WebInspector.ScriptView.prototype.didResolveScriptSource_ = function()
+
+
+
+
+
+
+WebInspector.HAREntry = function(resource)
 {
-    this.sourceFrame.setContent("text/javascript", this.script.source);
-    this._sourceFrameSetup = true;
-    delete this._frameNeedsSetup;
+this._resource = resource;
+}
+
+WebInspector.HAREntry.prototype = {
+build: function()
+{
+return {
+pageref: this._resource.documentURL,
+startedDateTime: new Date(this._resource.startTime * 1000),
+time: WebInspector.HAREntry._toMilliseconds(this._resource.duration),
+request: this._buildRequest(),
+response: this._buildResponse(),
+
+timings: this._buildTimings()
 };
+},
 
-
-/**
- * @param {string} type Type of the the property value("object" or "function").
- * @param {string} className Class name of the property value.
- * @constructor
- */
-WebInspector.UnresolvedPropertyValue = function(type, className)
+_buildRequest: function()
 {
-    this.type = type;
-    this.className = className;
+var res = {
+method: this._resource.requestMethod,
+url: this._resource.url,
+
+headers: this._buildHeaders(this._resource.requestHeaders),
+headersSize: -1, 
+bodySize: -1 
 };
+if (this._resource.queryParameters)
+res.queryString = this._buildParameters(this._resource.queryParameters);
+if (this._resource.requestFormData)
+res.postData = this._buildPostData();
+if (this._resource.requestCookies)
+res.cookies = this._buildCookies(this._resource.requestCookies);
+return res;
+},
 
-
-(function()
+_buildResponse: function()
 {
-    var oldShow = WebInspector.ScriptsPanel.prototype.show;
-    WebInspector.ScriptsPanel.prototype.show =  function()
+var res = {
+status: this._resource.statusCode,
+statusText: this._resource.statusText,
+
+headers: this._buildHeaders(this._resource.responseHeaders),
+content: this._buildContent(),
+redirectURL: this._resource.responseHeaderValue("Location") || "",
+headersSize: -1, 
+bodySize: this._resource.resourceSize
+};
+if (this._resource.responseCookies)
+res.cookies = this._buildCookies(this._resource.responseCookies);
+return res;
+},
+
+_buildContent: function()
+{
+return {
+size: this._resource.resourceSize,
+
+mimeType: this._resource.mimeType,
+
+};
+},
+
+_buildTimings: function()
+{
+var waitForConnection = this._interval("connectStart", "connectEnd");
+var blocked;
+var connect;
+var dns = this._interval("dnsStart", "dnsEnd");
+var send = this._interval("sendStart", "sendEnd");
+var ssl = this._interval("sslStart", "sslEnd");
+
+if (ssl !== -1 && send !== -1)
+send -= ssl;
+
+if (this._resource.connectionReused) {
+connect = -1;
+blocked = waitForConnection;
+} else {
+blocked = 0;
+connect = waitForConnection;
+if (dns !== -1)
+connect -= dns;
+}
+
+return {
+blocked: blocked,
+dns: dns,
+connect: connect,
+send: send,
+wait: this._interval("sendEnd", "receiveHeadersEnd"),
+receive: WebInspector.HAREntry._toMilliseconds(this._resource.receiveDuration),
+ssl: ssl
+};
+},
+
+_buildHeaders: function(headers)
+{
+var result = [];
+for (var name in headers)
+result.push({ name: name, value: headers[name] });
+return result;
+},
+
+_buildPostData: function()
+{
+var res = {
+mimeType: this._resource.requestHeaderValue("Content-Type"),
+text: this._resource.requestFormData
+};
+if (this._resource.formParameters)
+res.params = this._buildParameters(this._resource.formParameters);
+return res;
+},
+
+_buildParameters: function(parameters)
+{
+return parameters.slice();
+},
+
+_buildCookies: function(cookies)
+{
+return cookies.map(this._buildCookie.bind(this));
+},
+
+_buildCookie: function(cookie)
+{
+
+return {
+name: cookie.name,
+value: cookie.value,
+path: cookie.path,
+domain: cookie.domain,
+expires: cookie.expires(new Date(this._resource.startTime * 1000)),
+httpOnly: cookie.httpOnly,
+secure: cookie.secure
+};
+},
+
+_interval: function(start, end)
+{
+var timing = this._resource.timing;
+if (!timing)
+return -1;
+var startTime = timing[start];
+return typeof startTime !== "number" || startTime === -1 ? -1 : Math.round(timing[end] - startTime);
+}
+}
+
+WebInspector.HAREntry._toMilliseconds = function(time)
+{
+return time === -1 ? -1 : Math.round(time * 1000);
+}
+
+WebInspector.HARLog = function()
+{
+this.includeResourceIds = false;
+}
+
+WebInspector.HARLog.prototype = {
+build: function()
+{
+var webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent);
+
+return {
+version: "1.2",
+creator: {
+name: "WebInspector",
+version: webKitVersion ? webKitVersion[1] : "n/a"
+},
+pages: this._buildPages(),
+entries: Object.keys(WebInspector.networkResources).map(this._convertResource.bind(this))
+}
+},
+
+_buildPages: function()
+{
+return [
+{
+startedDateTime: new Date(WebInspector.mainResource.startTime * 1000),
+id: WebInspector.mainResource.documentURL,
+title: "",
+pageTimings: this.buildMainResourceTimings()
+}
+];
+},
+
+buildMainResourceTimings: function()
+{
+return {
+onContentLoad: this._pageEventTime(WebInspector.mainResourceDOMContentTime),
+onLoad: this._pageEventTime(WebInspector.mainResourceLoadTime),
+}
+},
+
+_convertResource: function(id)
+{
+var entry = (new WebInspector.HAREntry(WebInspector.networkResources[id])).build();
+if (this.includeResourceIds)
+entry._resourceId = id;
+return entry;
+},
+
+_pageEventTime: function(time)
+{
+var startTime = WebInspector.mainResource.startTime;
+if (time === -1 || startTime === -1)
+return -1;
+return WebInspector.HAREntry._toMilliseconds(time - startTime);
+}
+}
+
+
+
+
+
+
+
+
+
+
+
+
+WebInspector.CookieParser = function()
+{
+}
+
+WebInspector.CookieParser.prototype = {
+get cookies()
+{
+return this._cookies;
+},
+
+parseCookie: function(cookieHeader)
+{
+if (!this._initialize(cookieHeader))
+return;
+
+for (var kv = this._extractKeyValue(); kv; kv = this._extractKeyValue()) {
+if (kv.key.charAt(0) === "$" && this._lastCookie)
+this._lastCookie.addAttribute(kv.key.slice(1), kv.value);
+else if (kv.key.toLowerCase() !== "$version" && typeof kv.value === "string")
+this._addCookie(kv, WebInspector.Cookie.Type.Request);
+this._advanceAndCheckCookieDelimiter();
+}
+this._flushCookie();
+return this._cookies;
+},
+
+parseSetCookie: function(setCookieHeader)
+{
+if (!this._initialize(setCookieHeader))
+return;
+for (var kv = this._extractKeyValue(); kv; kv = this._extractKeyValue()) {
+if (this._lastCookie)
+this._lastCookie.addAttribute(kv.key, kv.value);
+else 
+this._addCookie(kv, WebInspector.Cookie.Type.Response);
+if (this._advanceAndCheckCookieDelimiter())
+this._flushCookie();
+}
+this._flushCookie();
+return this._cookies;
+},
+
+_initialize: function(headerValue)
+{
+this._input = headerValue;
+if (typeof headerValue !== "string")
+return false;
+this._cookies = [];
+this._lastCookie = null;
+this._originalInputLength = this._input.length;
+return true;
+},
+
+_flushCookie: function()
+{
+if (this._lastCookie)
+this._lastCookie.size = this._originalInputLength - this._input.length - this._lastCookiePosition;
+this._lastCookie = null;
+},
+
+_extractKeyValue: function()
+{
+if (!this._input || !this._input.length)
+return null;
+
+
+
+
+
+var keyValueMatch = /^[ \t]*([^\s=;]+)[ \t]*(?:=[ \t]*([^;\n]*))?/.exec(this._input);
+        if (!keyValueMatch) {
+            console.log("Failed parsing cookie header before: " + this._input);
+            return null;
+        }
+
+        var result = {
+            key: keyValueMatch[1],
+            value: keyValueMatch[2] && keyValueMatch[2].trim(),
+            position: this._originalInputLength - this._input.length
+        };
+        this._input = this._input.slice(keyValueMatch[0].length);
+        return result;
+    },
+
+    _advanceAndCheckCookieDelimiter: function()
     {
-        devtools.tools.getDebuggerAgent().initUI();
-        this.enableToggleButton.visible = false;
-        oldShow.call(this);
-    };
+        var match = /^\s*[\n;]\s*/.exec(this._input);
+if (!match)
+return false;
+this._input = this._input.slice(match[0].length);
+return match[0].match("\n") !== null;
+},
+
+_addCookie: function(keyValue, type)
+{
+if (this._lastCookie)
+this._lastCookie.size = keyValue.position - this._lastCookiePosition;
+
+
+this._lastCookie = keyValue.value ? new WebInspector.Cookie(keyValue.key, keyValue.value, type) :
+new WebInspector.Cookie("", keyValue.key, type);
+this._lastCookiePosition = keyValue.position;
+this._cookies.push(this._lastCookie);
+}
+};
+
+WebInspector.CookieParser.parseCookie = function(header)
+{
+return (new WebInspector.CookieParser()).parseCookie(header);
+}
+
+WebInspector.CookieParser.parseSetCookie = function(header)
+{
+return (new WebInspector.CookieParser()).parseSetCookie(header);
+}
+
+WebInspector.Cookie = function(name, value, type)
+{
+this.name = name;
+this.value = value;
+this.type = type;
+this._attributes = {};
+}
+
+WebInspector.Cookie.prototype = {
+get httpOnly()
+{
+return "httponly" in this._attributes;
+},
+
+get secure()
+{
+return "secure" in this._attributes;
+},
+
+get session()
+{
+
+
+return  !("expries" in this._attributes || "max-age" in this._attributes);
+},
+
+get path()
+{
+return this._attributes.path;
+},
+
+get domain()
+{
+return this._attributes.domain;
+},
+
+expires: function(requestDate)
+{
+return this._attributes.expires ? new Date(this._attributes.expires) :
+(this._attributes["max-age"] ? new Date(requestDate.getTime() + 1000 * this._attributes["max-age"]) : null);
+},
+
+get attributes()
+{
+return this._attributes;
+},
+
+addAttribute: function(key, value)
+{
+this._attributes[key.toLowerCase()] = value;
+}
+}
+
+WebInspector.Cookie.Type = {
+Request: 0,
+Response: 1
+};
+
+
+
+
+
+
+
+var context = {};  
+
+(function () {
+Preferences.ignoreWhitespace = false;
+Preferences.samplingCPUProfiler = true;
+Preferences.heapProfilerPresent = true;
+Preferences.debuggerAlwaysEnabled = true;
+Preferences.profilerAlwaysEnabled = true;
+Preferences.canEditScriptSource = true;
+Preferences.onlineDetectionEnabled = false;
+Preferences.nativeInstrumentationEnabled = true;
+Preferences.fileSystemEnabled = false;
+Preferences.resourceExportEnabled = true;
+Preferences.showTimingTab = true;
+Preferences.showCookiesTab = true;
 })();
 
+var devtools = devtools || {};
+
+devtools.domContentLoaded = function()
+{
+WebInspector.setAttachedWindow(WebInspector.queryParamsObject.docked === "true");
+if (WebInspector.queryParamsObject.toolbar_color && WebInspector.queryParamsObject.text_color)
+WebInspector.setToolbarColors(WebInspector.queryParamsObject.toolbar_color, WebInspector.queryParamsObject.text_color);
+}
+document.addEventListener("DOMContentLoaded", devtools.domContentLoaded, false);
+
+
 
 (function InterceptProfilesPanelEvents()
 {
-    var oldShow = WebInspector.ProfilesPanel.prototype.show;
-    WebInspector.ProfilesPanel.prototype.show = function()
-    {
-        devtools.tools.getProfilerAgent().initializeProfiling();
-        this.enableToggleButton.visible = false;
-        oldShow.call(this);
-        // Show is called on every show event of a panel, so
-        // we only need to intercept it once.
-        WebInspector.ProfilesPanel.prototype.show = oldShow;
-    };
+var oldShow = WebInspector.ProfilesPanel.prototype.show;
+WebInspector.ProfilesPanel.prototype.show = function()
+{
+this.enableToggleButton.visible = false;
+oldShow.call(this);
+
+
+WebInspector.ProfilesPanel.prototype.show = oldShow;
+};
 })();
 
 
-/*
- * @override
- * TODO(mnaganov): Restore l10n when it will be agreed that it is needed.
- */
+
 WebInspector.UIString = function(string)
 {
-    return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
+return String.vsprintf(string, Array.prototype.slice.call(arguments, 1));
 };
 
-// Activate window upon node search complete. This will go away once InspectorFrontendClient is landed.
-(function() {
-    var original = WebInspector.searchingForNodeWasDisabled;
-    WebInspector.searchingForNodeWasDisabled = function()
-    {
-        if (this.panels.elements._nodeSearchButton.toggled)
-            InspectorFrontendHost.activateWindow();
-        original.apply(this, arguments);
-    }
-})();
-
-
-// There is no clear way of setting frame title yet. So sniffing main resource
-// load.
-(function OverrideUpdateResource() {
-    var originalUpdateResource = WebInspector.updateResource;
-    WebInspector.updateResource = function(identifier, payload)
-    {
-        originalUpdateResource.call(this, identifier, payload);
-        var resource = this.resources[identifier];
-        if (resource && resource.mainResource && resource.finished)
-            document.title = WebInspector.UIString("Developer Tools - %s", resource.url);
-    };
-})();
-
-
-// Highlight extension content scripts in the scripts list.
-(function () {
-    var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu;
-    WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu = function(script)
-    {
-        var result = original.apply(this, arguments);
-        var debuggerAgent = devtools.tools.getDebuggerAgent();
-        var type = debuggerAgent.getScriptContextType(script.sourceID);
-        var option = script.filesSelectOption;
-        if (type === "injected" && option)
-            option.addStyleClass("injected");
-        return result;
-    };
-})();
-
-
-/** Pending WebKit upstream by apavlov). Fixes iframe vs drag problem. */
-(function()
-{
-    var originalDragStart = WebInspector.elementDragStart;
-    WebInspector.elementDragStart = function(element)
-    {
-        if (element) {
-            var glassPane = document.createElement("div");
-            glassPane.style.cssText = "position:absolute;width:100%;height:100%;opacity:0;z-index:1";
-            glassPane.id = "glass-pane-for-drag";
-            element.parentElement.appendChild(glassPane);
-        }
-
-        originalDragStart.apply(this, arguments);
-    };
-
-    var originalDragEnd = WebInspector.elementDragEnd;
-    WebInspector.elementDragEnd = function()
-    {
-        originalDragEnd.apply(this, arguments);
-
-        var glassPane = document.getElementById("glass-pane-for-drag");
-        if (glassPane)
-            glassPane.parentElement.removeChild(glassPane);
-    };
-})();
-
-
-(function () {
-var orig = InjectedScriptAccess.prototype.getProperties;
-InjectedScriptAccess.prototype.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback)
-{
-    if (objectProxy.isScope)
-        devtools.tools.getDebuggerAgent().resolveScope(objectProxy.objectId, callback);
-    else if (objectProxy.isV8Ref)
-        devtools.tools.getDebuggerAgent().resolveChildren(objectProxy.objectId, callback, false);
-    else
-        orig.apply(this, arguments);
-};
-})();
 
 
 (function()
 {
-InjectedScriptAccess.prototype.evaluateInCallFrame = function(callFrameId, code, objectGroup, callback)
+var originalDragStart = WebInspector.elementDragStart;
+WebInspector.elementDragStart = function(element)
 {
-    //TODO(pfeldman): remove once 49084 is rolled.
-    if (!callback)
-        callback = objectGroup;
-    devtools.tools.getDebuggerAgent().evaluateInCallFrame(callFrameId, code, callback);
+if (element) {
+var glassPane = document.createElement("div");
+glassPane.style.cssText = "position:absolute;width:100%;height:100%;opacity:0;z-index:1";
+glassPane.id = "glass-pane-for-drag";
+element.parentElement.appendChild(glassPane);
+}
+
+originalDragStart.apply(this, arguments);
+};
+
+var originalDragEnd = WebInspector.elementDragEnd;
+WebInspector.elementDragEnd = function()
+{
+originalDragEnd.apply(this, arguments);
+
+var glassPane = document.getElementById("glass-pane-for-drag");
+if (glassPane)
+glassPane.parentElement.removeChild(glassPane);
 };
 })();
 
 
-(function()
-{
-var orig = InjectedScriptAccess.prototype.getCompletions;
-InjectedScriptAccess.prototype.getCompletions = function(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions)
-{
-    if (typeof callFrameId === "number")
-        devtools.tools.getDebuggerAgent().resolveCompletionsOnFrame(expressionString, callFrameId, reportCompletions);
-    else
-        return orig.apply(this, arguments);
-};
-})();
 
 
-// We need to have a place for postponed tasks
-// which should be executed when all the messages between agent and frontend
-// are processed.
+
+
 
 WebInspector.runAfterPendingDispatchesQueue = [];
 
 WebInspector.TestController.prototype.runAfterPendingDispatches = function(callback)
 {
-    WebInspector.runAfterPendingDispatchesQueue.push(callback);
+WebInspector.runAfterPendingDispatchesQueue.push(callback);
 };
 
 WebInspector.queuesAreEmpty = function()
 {
-    var copy = this.runAfterPendingDispatchesQueue.slice();
-    this.runAfterPendingDispatchesQueue = [];
-    for (var i = 0; i < copy.length; ++i)
-        copy[i].call(this);
-};
-
-(function()
-{
-var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame;
-InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element)
-{
-    var resource = WebInspector.resources[identifier];
-    if (!resource)
-        return;
-    originalAddToFrame.call(this, identifier, resource.mimeType, element);
-};
-})();
-
-WebInspector.pausedScript = function(callFrames)
-{
-    this.panels.scripts.debuggerPaused(callFrames);
-};
-
-/* DevToolsHostStub.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @fileoverview These stubs emulate backend functionality and allows
- * DevTools frontend to function as a standalone web app.
- */
-
-if (!window["RemoteDebuggerAgent"]) {
-
-/**
- * FIXME: change field naming style to use trailing underscore.
- * @constructor
- */
-RemoteDebuggerAgentStub = function()
-{
+var copy = this.runAfterPendingDispatchesQueue.slice();
+this.runAfterPendingDispatchesQueue = [];
+for (var i = 0; i < copy.length; ++i)
+copy[i].call(this);
 };
 
 
-RemoteDebuggerAgentStub.prototype.getContextId = function()
+
+
+
+
+WebInspector.setToolbarColors = function(backgroundColor, color)
 {
-    RemoteDebuggerAgent.setContextId(3);
-};
+if (!WebInspector._themeStyleElement) {
+WebInspector._themeStyleElement = document.createElement("style");
+document.head.appendChild(WebInspector._themeStyleElement);
+}
+WebInspector._themeStyleElement.textContent =
+"#toolbar {\
+             background-image: none !important;\
+             background-color: " + backgroundColor + " !important;\
+         }\
+         \
+         .toolbar-label {\
+             color: " + color + " !important;\
+             text-shadow: none;\
+         }";
+}
 
-
-RemoteDebuggerAgentStub.prototype.processDebugCommands = function()
+WebInspector.resetToolbarColors = function()
 {
-};
-
-
-/**
- * @constructor
- */
-RemoteProfilerAgentStub = function()
-{
-};
-
-
-RemoteProfilerAgentStub.prototype.getActiveProfilerModules = function()
-{
-    ProfilerStubHelper.GetInstance().getActiveProfilerModules();
-};
-
-
-RemoteProfilerAgentStub.prototype.getLogLines = function(pos)
-{
-    ProfilerStubHelper.GetInstance().getLogLines(pos);
-};
-
-
-/**
- * @constructor
- */
-RemoteToolsAgentStub = function()
-{
-};
-
-
-RemoteToolsAgentStub.prototype.dispatchOnInjectedScript = function()
-{
-};
-
-
-RemoteToolsAgentStub.prototype.dispatchOnInspectorController = function()
-{
-};
-
-
-/**
- * @constructor
- */
-ProfilerStubHelper = function()
-{
-    this.activeProfilerModules_ = devtools.ProfilerAgent.ProfilerModules.PROFILER_MODULE_NONE;
-    this.heapProfSample_ = 0;
-    this.log_ = '';
-};
-
-
-ProfilerStubHelper.GetInstance = function()
-{
-    if (!ProfilerStubHelper.instance_)
-        ProfilerStubHelper.instance_ = new ProfilerStubHelper();
-    return ProfilerStubHelper.instance_;
-};
-
-
-ProfilerStubHelper.prototype.StopProfiling = function(modules)
-{
-    this.activeProfilerModules_ &= ~modules;
-};
-
-
-ProfilerStubHelper.prototype.StartProfiling = function(modules)
-{
-    var profModules = devtools.ProfilerAgent.ProfilerModules;
-    if (modules & profModules.PROFILER_MODULE_HEAP_SNAPSHOT) {
-        if (modules & profModules.PROFILER_MODULE_HEAP_STATS) {
-            this.log_ +=
-                'heap-sample-begin,"Heap","allocated",' +
-                    (new Date()).getTime() + '\n' +
-                'heap-sample-stats,"Heap","allocated",10000,1000\n';
-            this.log_ +=
-                'heap-sample-item,STRING_TYPE,100,1000\n' +
-                'heap-sample-item,CODE_TYPE,10,200\n' +
-                'heap-sample-item,MAP_TYPE,20,350\n';
-            this.log_ += ProfilerStubHelper.HeapSamples[this.heapProfSample_++];
-            this.heapProfSample_ %= ProfilerStubHelper.HeapSamples.length;
-            this.log_ += 'heap-sample-end,"Heap","allocated"\n';
-        }
-    } else {
-        if (modules & profModules.PROFILER_MODULE_CPU)
-            this.log_ += ProfilerStubHelper.ProfilerLogBuffer;
-        this.activeProfilerModules_ |= modules;
-    }
-};
-
-
-ProfilerStubHelper.prototype.getActiveProfilerModules = function()
-{
-    var self = this;
-    setTimeout(function() {
-        RemoteProfilerAgent.didGetActiveProfilerModules(self.activeProfilerModules_);
-    }, 100);
-};
-
-
-ProfilerStubHelper.prototype.getLogLines = function(pos)
-{
-    var profModules = devtools.ProfilerAgent.ProfilerModules;
-    var logLines = this.log_.substr(pos);
-    setTimeout(function() {
-        RemoteProfilerAgent.didGetLogLines(pos + logLines.length, logLines);
-    }, 100);
-};
-
-
-ProfilerStubHelper.ProfilerLogBuffer =
-    'profiler,begin,1\n' +
-    'profiler,resume\n' +
-    'code-creation,LazyCompile,0x1000,256,"test1 http://aaa.js:1"\n' +
-    'code-creation,LazyCompile,0x2000,256,"test2 http://bbb.js:2"\n' +
-    'code-creation,LazyCompile,0x3000,256,"test3 http://ccc.js:3"\n' +
-    'tick,0x1010,0x0,3\n' +
-    'tick,0x2020,0x0,3,0x1010\n' +
-    'tick,0x2020,0x0,3,0x1010\n' +
-    'tick,0x3010,0x0,3,0x2020, 0x1010\n' +
-    'tick,0x2020,0x0,3,0x1010\n' +
-    'tick,0x2030,0x0,3,0x2020, 0x1010\n' +
-    'tick,0x2020,0x0,3,0x1010\n' +
-    'tick,0x1010,0x0,3\n' +
-    'profiler,pause\n';
-
-
-ProfilerStubHelper.HeapSamples = [
-    'heap-js-cons-item,foo,1,100\n' +
-    'heap-js-cons-item,bar,20,2000\n' +
-    'heap-js-cons-item,Object,5,100\n' +
-    'heap-js-ret-item,foo,bar;3\n' +
-    'heap-js-ret-item,bar,foo;5\n' +
-    'heap-js-ret-item,Object:0x1234,(roots);1\n',
-
-    'heap-js-cons-item,foo,2000,200000\n' +
-    'heap-js-cons-item,bar,10,1000\n' +
-    'heap-js-cons-item,Object,6,120\n' +
-    'heap-js-ret-item,foo,bar;7,Object:0x1234;10\n' +
-    'heap-js-ret-item,bar,foo;10,Object:0x1234;10\n' +
-    'heap-js-ret-item,Object:0x1234,(roots);1\n',
-
-    'heap-js-cons-item,foo,15,1500\n' +
-    'heap-js-cons-item,bar,15,1500\n' +
-    'heap-js-cons-item,Object,5,100\n' +
-    'heap-js-cons-item,Array,3,1000\n' +
-    'heap-js-ret-item,foo,bar;3,Array:0x5678;1\n' +
-    'heap-js-ret-item,bar,foo;5,Object:0x1234;8,Object:0x5678;2\n' +
-    'heap-js-ret-item,Object:0x1234,(roots);1,Object:0x5678;2\n' +
-    'heap-js-ret-item,Object:0x5678,(global property);3,Object:0x1234;5\n' +
-    'heap-js-ret-item,Array:0x5678,(global property);3,Array:0x5678;2\n',
-
-    'heap-js-cons-item,bar,20,2000\n' +
-    'heap-js-cons-item,Object,6,120\n' +
-    'heap-js-ret-item,bar,foo;5,Object:0x1234;1,Object:0x1235;3\n' +
-    'heap-js-ret-item,Object:0x1234,(global property);3\n' +
-    'heap-js-ret-item,Object:0x1235,(global property);5\n',
-
-    'heap-js-cons-item,foo,15,1500\n' +
-    'heap-js-cons-item,bar,15,1500\n' +
-    'heap-js-cons-item,Array,10,1000\n' +
-    'heap-js-ret-item,foo,bar;1,Array:0x5678;1\n' +
-    'heap-js-ret-item,bar,foo;5\n' +
-    'heap-js-ret-item,Array:0x5678,(roots);3\n',
-
-    'heap-js-cons-item,bar,20,2000\n' +
-    'heap-js-cons-item,baz,15,1500\n' +
-    'heap-js-ret-item,bar,baz;3\n' +
-    'heap-js-ret-item,baz,bar;3\n'
-];
-
-
-/**
- * @constructor
- */
-RemoteDebuggerCommandExecutorStub = function()
-{
-};
-
-
-RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd)
-{
-    if ('{"seq":2,"type":"request","command":"scripts","arguments":{"includeSource":false}}' === cmd) {
-        var response1 =
-            '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' +
-            'success":true,"body":[{"handle":61,"type":"script","name":"' +
-            'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
-            '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' +
-            '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' +
-            '"handle":60,"type":"context","data":"page,3"}],"running":false}';
-        this.sendResponse_(response1);
-    } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{"ids":[59],"includeSource":true}}' === cmd) {
-        this.sendResponse_(
-            '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' +
-            '"success":true,"body":[{"handle":1,"type":"script","name":' +
-            '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' +
-            '"lineCount":1,"source":"function fib(n) {return n+1;}",' +
-            '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' +
-            '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' +
-            '"running":false}');
-    } else if (cmd.indexOf('"command":"profile"') !== -1) {
-        var cmdObj = JSON.parse(cmd);
-        if (cmdObj.arguments.command === "resume")
-            ProfilerStubHelper.GetInstance().StartProfiling(parseInt(cmdObj.arguments.modules));
-        else if (cmdObj.arguments.command === "pause")
-            ProfilerStubHelper.GetInstance().StopProfiling(parseInt(cmdObj.arguments.modules));
-        else
-            debugPrint("Unexpected profile command: " + cmdObj.arguments.command);
-    } else
-        debugPrint("Unexpected command: " + cmd);
-};
-
-
-RemoteDebuggerCommandExecutorStub.prototype.DebuggerPauseScript = function()
-{
-};
-
-
-RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response)
-{
-    setTimeout(function() {
-        RemoteDebuggerAgent.debuggerOutput(response);
-    }, 0);
-};
-
-
-DevToolsHostStub = function()
-{
-    this.isStub = true;
-};
-DevToolsHostStub.prototype.__proto__ = WebInspector.InspectorFrontendHostStub.prototype;
-
-
-DevToolsHostStub.prototype.reset = function()
-{
-};
-
-
-DevToolsHostStub.prototype.setting = function()
-{
-};
-
-
-DevToolsHostStub.prototype.setSetting = function()
-{
-};
-
-
-window["RemoteDebuggerAgent"] = new RemoteDebuggerAgentStub();
-window["RemoteDebuggerCommandExecutor"] = new RemoteDebuggerCommandExecutorStub();
-window["RemoteProfilerAgent"] = new RemoteProfilerAgentStub();
-window["RemoteToolsAgent"] = new RemoteToolsAgentStub();
-InspectorFrontendHost = new DevToolsHostStub();
+if (WebInspector._themeStyleElement)
+WebInspector._themeStyleElement.textContent = "";
 
 }
 
-/* Tests.js */
-
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
 
 
-/**
- * @fileoverview This file contains small testing framework along with the
- * test suite for the frontend. These tests are a part of the continues build
- * and are executed by the devtools_sanity_unittest.cc as a part of the
- * Interactive UI Test suite.
- * FIXME: change field naming style to use trailing underscore.
- */
+
+
+WebInspector.platformExtensionAPI = function(tabId)
+{
+function getTabId()
+{
+return tabId;
+}
+webInspector.inspectedWindow.__proto__.__defineGetter__("tabId", getTabId);
+}
+
+WebInspector.buildPlatformExtensionAPI = function()
+{
+return "(" + WebInspector.platformExtensionAPI + ")(" + WebInspector._inspectedTabId + ");";
+}
+
+WebInspector.setInspectedTabId = function(tabId)
+{
+WebInspector._inspectedTabId = tabId;
+}
+
+
+
+
+
+
+
 
 if (window.domAutomationController) {
 
 var ___interactiveUiTestsMode = true;
 
-/**
- * Test suite for interactive UI tests.
- * @constructor
- */
+
 TestSuite = function()
 {
-    this.controlTaken_ = false;
-    this.timerId_ = -1;
+this.controlTaken_ = false;
+this.timerId_ = -1;
 };
 
 
-/**
- * Reports test failure.
- * @param {string} message Failure description.
- */
+
 TestSuite.prototype.fail = function(message)
 {
-    if (this.controlTaken_)
-        this.reportFailure_(message);
-    else
-        throw message;
+if (this.controlTaken_)
+this.reportFailure_(message);
+else
+throw message;
 };
 
 
-/**
- * Equals assertion tests that expected === actual.
- * @param {Object} expected Expected object.
- * @param {Object} actual Actual object.
- * @param {string} opt_message User message to print if the test fails.
- */
+
 TestSuite.prototype.assertEquals = function(expected, actual, opt_message)
 {
-    if (expected !== actual) {
-        var message = "Expected: '" + expected + "', but was '" + actual + "'";
-        if (opt_message)
-            message = opt_message + "(" + message + ")";
-        this.fail(message);
-    }
+if (expected !== actual) {
+var message = "Expected: '" + expected + "', but was '" + actual + "'";
+if (opt_message)
+message = opt_message + "(" + message + ")";
+this.fail(message);
+}
 };
 
 
-/**
- * True assertion tests that value == true.
- * @param {Object} value Actual object.
- * @param {string} opt_message User message to print if the test fails.
- */
+
 TestSuite.prototype.assertTrue = function(value, opt_message)
 {
-    this.assertEquals(true, !!value, opt_message);
+this.assertEquals(true, !!value, opt_message);
 };
 
 
-/**
- * Contains assertion tests that string contains substring.
- * @param {string} string Outer.
- * @param {string} substring Inner.
- */
+
 TestSuite.prototype.assertContains = function(string, substring)
 {
-    if (string.indexOf(substring) === -1)
-        this.fail("Expected to: '" + string + "' to contain '" + substring + "'");
+if (string.indexOf(substring) === -1)
+this.fail("Expected to: '" + string + "' to contain '" + substring + "'");
 };
 
 
-/**
- * Takes control over execution.
- */
+
 TestSuite.prototype.takeControl = function()
 {
-    this.controlTaken_ = true;
-    // Set up guard timer.
-    var self = this;
-    this.timerId_ = setTimeout(function() {
-        self.reportFailure_("Timeout exceeded: 20 sec");
-    }, 20000);
+this.controlTaken_ = true;
+
+var self = this;
+this.timerId_ = setTimeout(function() {
+self.reportFailure_("Timeout exceeded: 20 sec");
+}, 20000);
 };
 
 
-/**
- * Releases control over execution.
- */
+
 TestSuite.prototype.releaseControl = function()
 {
-    if (this.timerId_ !== -1) {
-        clearTimeout(this.timerId_);
-        this.timerId_ = -1;
-    }
-    this.reportOk_();
+if (this.timerId_ !== -1) {
+clearTimeout(this.timerId_);
+this.timerId_ = -1;
+}
+this.reportOk_();
 };
 
 
-/**
- * Async tests use this one to report that they are completed.
- */
+
 TestSuite.prototype.reportOk_ = function()
 {
-    window.domAutomationController.send("[OK]");
+window.domAutomationController.send("[OK]");
 };
 
 
-/**
- * Async tests use this one to report failures.
- */
+
 TestSuite.prototype.reportFailure_ = function(error)
 {
-    if (this.timerId_ !== -1) {
-        clearTimeout(this.timerId_);
-        this.timerId_ = -1;
-    }
-    window.domAutomationController.send("[FAILED] " + error);
+if (this.timerId_ !== -1) {
+clearTimeout(this.timerId_);
+this.timerId_ = -1;
+}
+window.domAutomationController.send("[FAILED] " + error);
 };
 
 
-/**
- * Runs all global functions starting with "test" as unit tests.
- */
+
 TestSuite.prototype.runTest = function(testName)
 {
-    try {
-        this[testName]();
-        if (!this.controlTaken_)
-            this.reportOk_();
-    } catch (e) {
-        this.reportFailure_(e);
-    }
+try {
+this[testName]();
+if (!this.controlTaken_)
+this.reportOk_();
+} catch (e) {
+this.reportFailure_(e);
+}
 };
 
 
-/**
- * @param {string} panelName Name of the panel to show.
- */
+
 TestSuite.prototype.showPanel = function(panelName)
 {
-    // Open Scripts panel.
-    var toolbar = document.getElementById("toolbar");
-    var button = toolbar.getElementsByClassName(panelName)[0];
-    button.click();
-    this.assertEquals(WebInspector.panels[panelName], WebInspector.currentPanel);
+
+var toolbar = document.getElementById("toolbar");
+var button = toolbar.getElementsByClassName(panelName)[0];
+button.click();
+this.assertEquals(WebInspector.panels[panelName], WebInspector.currentPanel);
 };
 
 
-/**
- * Overrides the method with specified name until it's called first time.
- * @param {Object} receiver An object whose method to override.
- * @param {string} methodName Name of the method to override.
- * @param {Function} override A function that should be called right after the
- *     overriden method returns.
- * @param {boolean} opt_sticky Whether restore original method after first run
- *     or not.
- */
+
 TestSuite.prototype.addSniffer = function(receiver, methodName, override, opt_sticky)
 {
-    var orig = receiver[methodName];
-    if (typeof orig !== "function")
-        this.fail("Cannot find method to override: " + methodName);
-    var test = this;
-    receiver[methodName] = function(var_args) {
-        try {
-            var result = orig.apply(this, arguments);
-        } finally {
-            if (!opt_sticky)
-                receiver[methodName] = orig;
-        }
-        // In case of exception the override won't be called.
-        try {
-            override.apply(this, arguments);
-        } catch (e) {
-            test.fail("Exception in overriden method '" + methodName + "': " + e);
-        }
-        return result;
-    };
+var orig = receiver[methodName];
+if (typeof orig !== "function")
+this.fail("Cannot find method to override: " + methodName);
+var test = this;
+receiver[methodName] = function(var_args) {
+try {
+var result = orig.apply(this, arguments);
+} finally {
+if (!opt_sticky)
+receiver[methodName] = orig;
+}
+
+try {
+override.apply(this, arguments);
+} catch (e) {
+test.fail("Exception in overriden method '" + methodName + "': " + e);
+}
+return result;
+};
 };
 
 
-// UI Tests
 
 
-/**
- * Tests that the real injected host is present in the context.
- */
-TestSuite.prototype.testHostIsPresent = function()
-{
-    this.assertTrue(typeof InspectorFrontendHost === "object" && !InspectorFrontendHost.isStub);
-};
 
 
-/**
- * Tests elements tree has an "HTML" root.
- */
-TestSuite.prototype.testElementsTreeRoot = function()
-{
-    var doc = WebInspector.domAgent.document;
-    this.assertEquals("HTML", doc.documentElement.nodeName);
-    this.assertTrue(doc.documentElement.hasChildNodes());
-};
-
-
-/**
- * Tests that main resource is present in the system and that it is
- * the only resource.
- */
-TestSuite.prototype.testMainResource = function()
-{
-    var tokens = [];
-    var resources = WebInspector.resources;
-    for (var id in resources)
-        tokens.push(resources[id].lastPathComponent);
-    this.assertEquals("simple_page.html", tokens.join(","));
-};
-
-
-/**
- * Tests that resources tab is enabled when corresponding item is selected.
- */
 TestSuite.prototype.testEnableResourcesTab = function()
 {
-    this.showPanel("resources");
+this.showPanel("resources");
 
-    var test = this;
-    this.addSniffer(WebInspector, "updateResource",
-        function(identifier, payload) {
-            test.assertEquals("simple_page.html", payload.lastPathComponent);
-            WebInspector.panels.resources.refresh();
-            WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[identifier]);
+var test = this;
+this.addSniffer(WebInspector, "updateResource",
+function(payload) {
+test.assertEquals("simple_page.html", payload.lastPathComponent);
+WebInspector.panels.resources.refresh();
+WebInspector.panels.resources.revealAndSelectItem(WebInspector.resources[payload.id]);
 
-            test.releaseControl();
-        });
+test.releaseControl();
+});
 
-    // Following call should lead to reload that we capture in the
-    // addResource override.
-    WebInspector.panels.resources._enableResourceTracking();
 
-    // We now have some time to report results to controller.
-    this.takeControl();
+
+WebInspector.panels.resources._enableResourceTracking();
+
+
+this.takeControl();
 };
 
 
-/**
- * Tests that correct content length is reported for resources.
- */
-TestSuite.prototype.testResourceContentLength = function()
-{
-    this.showPanel("resources");
-    var test = this;
 
-    var png = false;
-    var html = false;
-    this.addSniffer(WebInspector, "updateResource",
-        function(identifier, payload) {
-            if (!payload.didLengthChange)
-                return;
-            var resource = WebInspector.resources[identifier];
-            if (!resource || !resource.url)
-                return;
-            if (resource.url.search("image.html") !== -1) {
-              var expectedLength = 87;
-              test.assertTrue(
-                  resource.resourceSize <= expectedLength,
-                  "image.html content length is greater thatn expected.");
-              if (expectedLength === resource.resourceSize)
-                  html = true;
-            } else if (resource.url.search("image.png") !== -1) {
-              var expectedLength = 257796;
-              test.assertTrue(
-                  resource.resourceSize <= expectedLength,
-                  "image.png content length is greater than expected.");
-              if (expectedLength === resource.resourceSize)
-                  png = true;
-            }
-            if (html && png) {
-              // Wait 1 second before releasing control to check that the content
-              // lengths are not updated anymore.
-              setTimeout(function() {
-                  test.releaseControl();
-              }, 1000);
-            }
-        }, true);
-
-    // Make sure resource tracking is on.
-    WebInspector.panels.resources._enableResourceTracking();
-    // Reload inspected page to update all resources.
-    test.evaluateInConsole_(
-        "window.location.reload(true);",
-         function(resultText) {
-             test.assertEquals("undefined", resultText, "Unexpected result of reload().");
-         });
-
-    // We now have some time to report results to controller.
-    this.takeControl();
-};
-
-
-/**
- * Tests resource headers.
- */
-TestSuite.prototype.testResourceHeaders = function()
-{
-    this.showPanel("resources");
-
-    var test = this;
-
-    var responseOk = false;
-    var timingOk = false;
-
-    this.addSniffer(WebInspector, "updateResource",
-        function(identifier, payload) {
-            var resource = this.resources[identifier];
-            if (!resource || resource.mainResource) {
-                // We are only interested in secondary resources in this test.
-                return;
-            }
-
-            var requestHeaders = JSON.stringify(resource.requestHeaders);
-            test.assertContains(requestHeaders, "Accept");
-
-            if (payload.didResponseChange) {
-                var responseHeaders = JSON.stringify(resource.responseHeaders);
-                test.assertContains(responseHeaders, "Content-type");
-                test.assertContains(responseHeaders, "Content-Length");
-                test.assertTrue(typeof resource.responseReceivedTime !== "undefined");
-                responseOk = true;
-            }
-
-            if (payload.didTimingChange) {
-                test.assertTrue(typeof resource.startTime !== "undefined");
-                timingOk = true;
-            }
-
-            if (payload.didCompletionChange) {
-                test.assertTrue(responseOk);
-                test.assertTrue(timingOk);
-                test.assertTrue(typeof resource.endTime !== "undefined");
-                test.releaseControl();
-            }
-        }, true);
-
-    WebInspector.panels.resources._enableResourceTracking();
-    this.takeControl();
-};
-
-
-/**
- * Tests the mime type of a cached (HTTP 304) resource.
- */
-TestSuite.prototype.testCachedResourceMimeType = function()
-{
-    this.showPanel("resources");
-
-    var test = this;
-    var hasReloaded = false;
-
-    this.addSniffer(WebInspector, "updateResource",
-        function(identifier, payload) {
-            var resource = this.resources[identifier];
-            if (!resource || resource.mainResource) {
-                // We are only interested in secondary resources in this test.
-                return;
-            }
-
-            if (payload.didResponseChange) {
-                // Test server uses a default mime type for JavaScript files.
-                test.assertEquals("text/html", payload.mimeType);
-                if (!hasReloaded) {
-                    hasReloaded = true;
-                    // Reload inspected page to update all resources.
-                    test.evaluateInConsole_("window.location.reload(true);", function() {});
-                } else
-                    test.releaseControl();
-            }
-
-        }, true);
-
-    WebInspector.panels.resources._enableResourceTracking();
-    this.takeControl();
-};
-
-
-/**
- * Tests that profiler works.
- */
 TestSuite.prototype.testProfilerTab = function()
 {
-    this.showPanel("profiles");
+this.showPanel("profiles");
 
-    var test = this;
-    this.addSniffer(WebInspector.panels.profiles, "addProfileHeader",
-        function(typeOrProfile, profile) {
-            if (!profile)
-                profile = typeOrProfile;
-            var panel = WebInspector.panels.profiles;
-            panel.showProfile(profile);
-            var node = panel.visibleView.profileDataGridTree.children[0];
-            // Iterate over displayed functions and search for a function
-            // that is called "fib" or "eternal_fib". If found, it will mean
-            // that we actually have profiled page's code.
-            while (node) {
-                if (node.functionName.indexOf("fib") !== -1)
-                    test.releaseControl();
-                node = node.traverseNextNode(true, null, true);
-            }
+var panel = WebInspector.panels.profiles;
+var test = this;
 
-            test.fail();
-        });
-    var ticksCount = 0;
-    var tickRecord = "\nt,";
-    this.addSniffer(RemoteProfilerAgent, "didGetLogLines",
-        function(posIgnored, log) {
-            var pos = 0;
-            while ((pos = log.indexOf(tickRecord, pos)) !== -1) {
-                pos += tickRecord.length;
-                ticksCount++;
-            }
-            if (ticksCount > 100)
-                InspectorBackend.stopProfiling();
-        }, true);
+function findDisplayedNode() {
+var node = panel.visibleView.profileDataGridTree.children[0];
+if (!node) {
 
-    InspectorBackend.startProfiling();
-    this.takeControl();
-};
-
-
-/**
- * Tests that scripts tab can be open and populated with inspected scripts.
- */
-TestSuite.prototype.testShowScriptsTab = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-    // There should be at least main page script.
-    this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
-        function() {
-            test.releaseControl();
-        });
-    // Wait until all scripts are added to the debugger.
-    this.takeControl();
-};
-
-
-/**
- * Tests that scripts tab is populated with inspected scripts even if it
- * hadn't been shown by the moment inspected paged refreshed.
- * @see http://crbug.com/26312
- */
-TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
-{
-    var test = this;
-    this.assertEquals(WebInspector.panels.elements, WebInspector.currentPanel, "Elements panel should be current one.");
-
-    this.addSniffer(devtools.DebuggerAgent.prototype, "reset", waitUntilScriptIsParsed);
-
-    // Reload inspected page. It will reset the debugger agent.
-    test.evaluateInConsole_(
-        "window.location.reload(true);",
-        function(resultText) {
-            test.assertEquals("undefined", resultText, "Unexpected result of reload().");
-        });
-
-    function waitUntilScriptIsParsed() {
-        var parsed = devtools.tools.getDebuggerAgent().parsedScripts_;
-        for (var id in parsed) {
-            var url = parsed[id].getUrl();
-            if (url && url.search("debugger_test_page.html") !== -1) {
-                checkScriptsPanel();
-                return;
-            }
-        }
-        test.addSniffer(devtools.DebuggerAgent.prototype, "addScriptInfo_", waitUntilScriptIsParsed);
-    }
-
-    function checkScriptsPanel() {
-        test.showPanel("scripts");
-        test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Inspected script not found in the scripts list");
-        test.releaseControl();
-    }
-
-    // Wait until all scripts are added to the debugger.
-    this.takeControl();
-};
-
-
-/**
- * Tests that scripts list contains content scripts.
- */
-TestSuite.prototype.testContentScriptIsPresent = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    test._waitUntilScriptsAreParsed(
-        ["page_with_content_script.html", "simple_content_script.js"],
-        function() {
-          test.releaseControl();
-        });
-
-    // Wait until all scripts are added to the debugger.
-    this.takeControl();
-};
-
-
-/**
- * Tests that scripts are not duplicaed on Scripts tab switch.
- */
-TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function()
-{
-    var test = this;
-
-    // There should be two scripts: one for the main page and another
-    // one which is source of console API(see
-    // InjectedScript._ensureCommandLineAPIInstalled).
-    var expectedScriptsCount = 2;
-    var parsedScripts = [];
-
-    this.showPanel("scripts");
-
-
-    function switchToElementsTab() {
-        test.showPanel("elements");
-        setTimeout(switchToScriptsTab, 0);
-    }
-
-    function switchToScriptsTab() {
-        test.showPanel("scripts");
-        setTimeout(checkScriptsPanel, 0);
-    }
-
-    function checkScriptsPanel() {
-        test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view.");
-        test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing.");
-        checkNoDuplicates();
-        test.releaseControl();
-    }
-
-    function checkNoDuplicates() {
-        var scriptSelect = document.getElementById("scripts-files");
-        var options = scriptSelect.options;
-        for (var i = 0; i < options.length; i++) {
-            var scriptName = options[i].text;
-            for (var j = i + 1; j < options.length; j++)
-                test.assertTrue(scriptName !== options[j].text, "Found script duplicates: " + test.optionsToString_(options));
-        }
-    }
-
-    test._waitUntilScriptsAreParsed(
-        ["debugger_test_page.html"],
-        function() {
-            checkNoDuplicates();
-            setTimeout(switchToElementsTab, 0);
-        });
-
-
-    // Wait until all scripts are added to the debugger.
-    this.takeControl();
-};
-
-
-/**
- * Tests that a breakpoint can be set.
- */
-TestSuite.prototype.testSetBreakpoint = function()
-{
-    var test = this;
-    this.showPanel("scripts");
-
-    var breakpointLine = 12;
-
-    this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
-        function() {
-          test.showMainPageScriptSource_(
-              "debugger_test_page.html",
-              function(view, url) {
-                view._addBreakpoint(breakpointLine);
-                // Force v8 execution.
-                RemoteDebuggerAgent.processDebugCommands();
-                test.waitForSetBreakpointResponse_(url, breakpointLine,
-                    function() {
-                        test.releaseControl();
-                    });
-              });
-        });
-
-    this.takeControl();
-};
-
-
-/**
- * Tests that pause on exception works.
- */
-TestSuite.prototype.testPauseOnException = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    // TODO(yurys): remove else branch once the states are supported.
-    if (WebInspector.ScriptsPanel.PauseOnExceptionsState) {
-        while (WebInspector.currentPanel._pauseOnExceptionButton.state !== WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions)
-            WebInspector.currentPanel._pauseOnExceptionButton.element.click();
-    } else {
-        // Make sure pause on exceptions is on.
-        if (!WebInspector.currentPanel._pauseOnExceptionButton.toggled)
-            WebInspector.currentPanel._pauseOnExceptionButton.element.click();
-    }
-
-    this._executeCodeWhenScriptsAreParsed("handleClick()", ["pause_on_exception.html"]);
-
-    this._waitForScriptPause(
-        {
-            functionsOnStack: ["throwAnException", "handleClick", "(anonymous function)"],
-            lineNumber: 6,
-            lineText: "  return unknown_var;"
-        },
-        function() {
-            test.releaseControl();
-        });
-
-    this.takeControl();
-};
-
-
-// Tests that debugger works correctly if pause event occurs when DevTools
-// frontend is being loaded.
-TestSuite.prototype.testPauseWhenLoadingDevTools = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    var expectations = {
-            functionsOnStack: ["callDebugger"],
-            lineNumber: 8,
-            lineText: "  debugger;"
-        };
-
-
-    // Script execution can already be paused.
-    if (WebInspector.currentPanel.paused) {
-        var callFrame = WebInspector.currentPanel.sidebarPanes.callstack.selectedCallFrame;
-        this.assertEquals(expectations.functionsOnStack[0], callFrame.functionName);
-        var callbackInvoked = false;
-        this._checkSourceFrameWhenLoaded(expectations, function() {
-                callbackInvoked = true;
-                if (test.controlTaken_)
-                    test.releaseControl();
-            });
-        if (!callbackInvoked) {
-            test.takeControl();
-        }
-        return;
-    }
-
-    this._waitForScriptPause(
-        {
-            functionsOnStack: ["callDebugger"],
-            lineNumber: 8,
-            lineText: "  debugger;"
-        },
-        function() {
-            test.releaseControl();
-        });
-    this.takeControl();
-};
-
-
-// Tests that pressing "Pause" will pause script execution if the script
-// is already running.
-TestSuite.prototype.testPauseWhenScriptIsRunning = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    test.evaluateInConsole_(
-        'setTimeout("handleClick()" , 0)',
-        function(resultText) {
-          test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
-          testScriptPauseAfterDelay();
-        });
-
-    // Wait for some time to make sure that inspected page is running the
-    // infinite loop.
-    function testScriptPauseAfterDelay() {
-        setTimeout(testScriptPause, 300);
-    }
-
-    function testScriptPause() {
-        // The script should be in infinite loop. Click "Pause" button to
-        // pause it and wait for the result.
-        WebInspector.panels.scripts.pauseButton.click();
-
-        test._waitForScriptPause(
-            {
-                functionsOnStack: ["handleClick", "(anonymous function)"],
-                lineNumber: 5,
-                lineText: "  while(true) {"
-            },
-            function() {
-                test.releaseControl();
-            });
-    }
-
-    this.takeControl();
-};
-
-
-/**
- * Serializes options collection to string.
- * @param {HTMLOptionsCollection} options
- * @return {string}
- */
-TestSuite.prototype.optionsToString_ = function(options)
-{
-    var names = [];
-    for (var i = 0; i < options.length; i++)
-        names.push('"' + options[i].text + '"');
-    return names.join(",");
-};
-
-
-/**
- * Ensures that main HTML resource is selected in Scripts panel and that its
- * source frame is setup. Invokes the callback when the condition is satisfied.
- * @param {HTMLOptionsCollection} options
- * @param {function(WebInspector.SourceView,string)} callback
- */
-TestSuite.prototype.showMainPageScriptSource_ = function(scriptName, callback)
-{
-    var test = this;
-
-    var scriptSelect = document.getElementById("scripts-files");
-    var options = scriptSelect.options;
-
-    test.assertTrue(options.length, "Scripts list is empty");
-
-    // Select page's script if it's not current option.
-    var scriptResource;
-    if (options[scriptSelect.selectedIndex].text === scriptName)
-        scriptResource = options[scriptSelect.selectedIndex].representedObject;
-    else {
-        var pageScriptIndex = -1;
-        for (var i = 0; i < options.length; i++) {
-            if (options[i].text === scriptName) {
-                pageScriptIndex = i;
-                break;
-            }
-        }
-        test.assertTrue(-1 !== pageScriptIndex, "Script with url " + scriptName + " not found among " + test.optionsToString_(options));
-        scriptResource = options[pageScriptIndex].representedObject;
-
-        // Current panel is "Scripts".
-        WebInspector.currentPanel._showScriptOrResource(scriptResource);
-        test.assertEquals(pageScriptIndex, scriptSelect.selectedIndex, "Unexpected selected option index.");
-    }
-
-    test.assertTrue(scriptResource instanceof WebInspector.Resource,
-                    "Unexpected resource class.");
-    test.assertTrue(!!scriptResource.url, "Resource URL is null.");
-    test.assertTrue(scriptResource.url.search(scriptName + "$") !== -1, "Main HTML resource should be selected.");
-
-    var scriptsPanel = WebInspector.panels.scripts;
-
-    var view = scriptsPanel.visibleView;
-    test.assertTrue(view instanceof WebInspector.SourceView);
-
-    if (!view.sourceFrame._loaded) {
-        test.addSniffer(view, "_sourceFrameSetupFinished", function(event) {
-            callback(view, scriptResource.url);
-        });
-    } else
-        callback(view, scriptResource.url);
-};
-
-
-/*
- * Evaluates the code in the console as if user typed it manually and invokes
- * the callback when the result message is received and added to the console.
- * @param {string} code
- * @param {function(string)} callback
- */
-TestSuite.prototype.evaluateInConsole_ = function(code, callback)
-{
-    WebInspector.console.visible = true;
-    WebInspector.console.prompt.text = code;
-    WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter"));
-
-    this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
-        function(commandResult) {
-            callback(commandResult.toMessageElement().textContent);
-        });
-};
-
-
-/*
- * Waits for "setbreakpoint" response, checks that corresponding breakpoint
- * was successfully set and invokes the callback if it was.
- * @param {string} scriptUrl
- * @param {number} breakpointLine
- * @param {function()} callback
- */
-TestSuite.prototype.waitForSetBreakpointResponse_ = function(scriptUrl, breakpointLine, callback)
-{
-    var test = this;
-    test.addSniffer(
-        devtools.DebuggerAgent.prototype,
-        "handleSetBreakpointResponse_",
-        function(msg) {
-            var bps = this.urlToBreakpoints_[scriptUrl];
-            test.assertTrue(!!bps, "No breakpoints for line " + breakpointLine);
-            var line = devtools.DebuggerAgent.webkitToV8LineNumber_(breakpointLine);
-            test.assertTrue(!!bps[line].getV8Id(), "Breakpoint id was not assigned.");
-            callback();
-        });
-};
-
-
-/**
- * Tests eval on call frame.
- */
-TestSuite.prototype.testEvalOnCallFrame = function()
-{
-    this.showPanel("scripts");
-
-    var breakpointLine = 16;
-
-    var test = this;
-    this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_",
-        function(msg) {
-          test.showMainPageScriptSource_(
-              "debugger_test_page.html",
-              function(view, url) {
-                  view._addBreakpoint(breakpointLine);
-                  // Force v8 execution.
-                  RemoteDebuggerAgent.processDebugCommands();
-                  test.waitForSetBreakpointResponse_(url, breakpointLine, setBreakpointCallback);
-              });
-        });
-
-    function setBreakpointCallback() {
-      // Since breakpoints are ignored in evals' calculate() function is
-      // execute after zero-timeout so that the breakpoint is hit.
-      test.evaluateInConsole_(
-          'setTimeout("calculate(123)" , 0)',
-          function(resultText) {
-              test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
-              waitForBreakpointHit();
-          });
-    }
-
-    function waitForBreakpointHit() {
-      test.addSniffer(
-          devtools.DebuggerAgent.prototype,
-          "handleBacktraceResponse_",
-          function(msg) {
-            test.assertEquals(2, this.callFrames_.length, "Unexpected stack depth on the breakpoint. " + JSON.stringify(msg));
-            test.assertEquals("calculate", this.callFrames_[0].functionName, "Unexpected top frame function.");
-            // Evaluate "e+1" where "e" is an argument of "calculate" function.
-            test.evaluateInConsole_(
-                "e+1",
-                function(resultText) {
-                    test.assertEquals("124", resultText, 'Unexpected "e+1" value.');
-                    test.releaseControl();
-                });
-          });
-    }
-
-    this.takeControl();
-};
-
-
-/**
- * Tests that console auto completion works when script execution is paused.
- */
-TestSuite.prototype.testCompletionOnPause = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-    this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html"]);
-
-    this._waitForScriptPause(
-        {
-            functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"],
-            lineNumber: 9,
-            lineText: "    debugger;"
-        },
-        showConsole);
-
-    function showConsole() {
-        test.addSniffer(WebInspector.console, "afterShow", testLocalsCompletion);
-        WebInspector.showConsole();
-    }
-
-    function testLocalsCompletion() {
-        checkCompletions("th", ["parameter1", "closureLocal", "p", "createClosureLocal"], testThisCompletion);
-    }
-
-    function testThisCompletion() {
-        checkCompletions("this.", ["field1", "field2", "m"], testFieldCompletion);
-    }
-
-    function testFieldCompletion() {
-        checkCompletions("this.field1.", ["id", "name"], function() { test.releaseControl(); });
-    }
-
-    function checkCompletions(expression, expectedProperties, callback) {
-        test.addSniffer(WebInspector.console, "_reportCompletions",
-            function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) {
-                test.assertTrue(!isException, "Exception while collecting completions");
-                for (var i = 0; i < expectedProperties.length; i++) {
-                    var name = expectedProperties[i];
-                    test.assertTrue(result[name], "Name " + name + " not found among the completions: " + JSON.stringify(result));
-                }
-                setTimeout(callback, 0);
-            });
-      WebInspector.console.prompt.text = expression;
-      WebInspector.console.prompt.autoCompleteSoon();
-    }
-
-    this.takeControl();
-};
-
-
-/**
- * Tests that inspected page doesn't hang on reload if it contains a syntax
- * error and DevTools window is open.
- */
-TestSuite.prototype.testAutoContinueOnSyntaxError = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    function checkScriptsList() {
-        var scriptSelect = document.getElementById("scripts-files");
-        var options = scriptSelect.options;
-        // There should be only console API source (see
-        // InjectedScript._ensureCommandLineAPIInstalled) since the page script
-        // contains a syntax error.
-        for (var i = 0 ; i < options.length; i++) {
-            if (options[i].text.search("script_syntax_error.html") !== -1)
-                test.fail("Script with syntax error should not be in the list of parsed scripts.");
-        }
-    }
-
-    this.addSniffer(devtools.DebuggerAgent.prototype, "handleScriptsResponse_",
-        function(msg) {
-            checkScriptsList();
-
-            // Reload inspected page.
-            test.evaluateInConsole_(
-                "window.location.reload(true);",
-                function(resultText) {
-                    test.assertEquals("undefined", resultText, "Unexpected result of reload().");
-                    waitForExceptionEvent();
-                });
-        });
-
-    function waitForExceptionEvent() {
-      var exceptionCount = 0;
-      test.addSniffer(
-          devtools.DebuggerAgent.prototype,
-          "handleExceptionEvent_",
-          function(msg) {
-              exceptionCount++;
-              test.assertEquals(1, exceptionCount, "Too many exceptions.");
-              test.assertEquals(undefined, msg.getBody().script, "Unexpected exception: " + JSON.stringify(msg));
-              test.releaseControl();
-          });
-
-      // Check that the script is not paused on parse error.
-      test.addSniffer(
-          WebInspector,
-          "pausedScript",
-          function(callFrames) {
-              test.fail("Script execution should not pause on syntax error.");
-          });
-    }
-
-    this.takeControl();
-};
-
-
-/**
- * Checks current execution line against expectations.
- * @param {WebInspector.SourceFrame} sourceFrame
- * @param {number} lineNumber Expected line number
- * @param {string} lineContent Expected line text
- */
-TestSuite.prototype._checkExecutionLine = function(sourceFrame, lineNumber, lineContent)
-{
-    this.assertEquals(lineNumber, sourceFrame.executionLine, "Unexpected execution line number.");
-    this.assertEquals(lineContent, sourceFrame._textModel.line(lineNumber - 1), "Unexpected execution line text.");
+window.setTimeout(findDisplayedNode, 100);
+return;
 }
 
 
-/**
- * Checks that all expected scripts are present in the scripts list
- * in the Scripts panel.
- * @param {Array.<string>} expected Regular expressions describing
- *     expected script names.
- * @return {boolean} Whether all the scripts are in "scripts-files" select
- *     box
- */
+
+
+while (node) {
+if (node.functionName.indexOf("fib") !== -1)
+test.releaseControl();
+node = node.traverseNextNode(true, null, true);
+}
+
+test.fail();
+}
+
+function findVisibleView() {
+if (!panel.visibleView) {
+setTimeout(findVisibleView, 0);
+return;
+}
+setTimeout(findDisplayedNode, 0);
+}
+
+findVisibleView();
+this.takeControl();
+};
+
+
+
+TestSuite.prototype.testHeapProfiler = function()
+{
+this.showPanel("profiles");
+
+var panel = WebInspector.panels.profiles;
+var test = this;
+
+function findDisplayedNode() {
+var node = panel.visibleView.dataGrid.children[0];
+if (!node) {
+
+window.setTimeout(findDisplayedNode, 100);
+return;
+}
+
+
+
+while (node) {
+if (node.constructorName.indexOf("A") !== -1) {
+test.releaseControl();
+return;
+}
+node = node.traverseNextNode(false, null, true);
+}
+
+test.fail();
+}
+
+function findVisibleView() {
+if (!panel.visibleView) {
+setTimeout(findVisibleView, 0);
+return;
+}
+setTimeout(findDisplayedNode, 0);
+}
+
+WebInspector.HeapSnapshotProfileType.prototype.buttonClicked();
+findVisibleView();
+this.takeControl();
+};
+
+
+
+TestSuite.prototype.testShowScriptsTab = function()
+{
+this.showPanel("scripts");
+var test = this;
+
+this._waitUntilScriptsAreParsed(["debugger_test_page.html"],
+function() {
+test.releaseControl();
+});
+
+this.takeControl();
+};
+
+
+
+TestSuite.prototype.testScriptsTabIsPopulatedOnInspectedPageRefresh = function()
+{
+var test = this;
+this.assertEquals(WebInspector.panels.elements, WebInspector.currentPanel, "Elements panel should be current one.");
+
+this.addSniffer(WebInspector.panels.scripts, "reset", waitUntilScriptIsParsed);
+
+
+test.evaluateInConsole_(
+"window.location.reload(true);",
+function(resultText) {});
+
+function waitUntilScriptIsParsed() {
+test.showPanel("scripts");
+test._waitUntilScriptsAreParsed(["debugger_test_page.html"],
+function() {
+test.releaseControl();
+});
+}
+
+
+this.takeControl();
+};
+
+
+
+TestSuite.prototype.testContentScriptIsPresent = function()
+{
+this.showPanel("scripts");
+var test = this;
+
+test._waitUntilScriptsAreParsed(
+["page_with_content_script.html", "simple_content_script.js"],
+function() {
+test.releaseControl();
+});
+
+
+this.takeControl();
+};
+
+
+
+TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function()
+{
+var test = this;
+
+
+
+
+var expectedScriptsCount = 2;
+var parsedScripts = [];
+
+this.showPanel("scripts");
+
+
+function switchToElementsTab() {
+test.showPanel("elements");
+setTimeout(switchToScriptsTab, 0);
+}
+
+function switchToScriptsTab() {
+test.showPanel("scripts");
+setTimeout(checkScriptsPanel, 0);
+}
+
+function checkScriptsPanel() {
+test.assertTrue(!!WebInspector.panels.scripts.visibleView, "No visible script view.");
+test.assertTrue(test._scriptsAreParsed(["debugger_test_page.html"]), "Some scripts are missing.");
+checkNoDuplicates();
+test.releaseControl();
+}
+
+function checkNoDuplicates() {
+var scriptSelect = document.getElementById("scripts-files");
+var options = scriptSelect.options;
+for (var i = 0; i < options.length; i++) {
+var scriptName = options[i].text;
+for (var j = i + 1; j < options.length; j++)
+test.assertTrue(scriptName !== options[j].text, "Found script duplicates: " + test.optionsToString_(options));
+}
+}
+
+test._waitUntilScriptsAreParsed(
+["debugger_test_page.html"],
+function() {
+checkNoDuplicates();
+setTimeout(switchToElementsTab, 0);
+});
+
+
+
+this.takeControl();
+};
+
+
+
+
+TestSuite.prototype.testPauseWhenLoadingDevTools = function()
+{
+this.showPanel("scripts");
+var test = this;
+
+var expectations = {
+functionsOnStack: ["callDebugger"],
+lineNumber: 8,
+lineText: "  debugger;"
+};
+
+
+
+if (WebInspector.currentPanel.paused) {
+var callFrame = WebInspector.currentPanel.sidebarPanes.callstack.selectedCallFrame;
+this.assertEquals(expectations.functionsOnStack[0], callFrame.functionName);
+var callbackInvoked = false;
+this._checkSourceFrameWhenLoaded(expectations, function() {
+callbackInvoked = true;
+if (test.controlTaken_)
+test.releaseControl();
+});
+if (!callbackInvoked) {
+test.takeControl();
+}
+return;
+}
+
+this._waitForScriptPause(
+{
+functionsOnStack: ["callDebugger"],
+lineNumber: 8,
+lineText: "  debugger;"
+},
+function() {
+test.releaseControl();
+});
+this.takeControl();
+};
+
+
+
+
+TestSuite.prototype.testPauseWhenScriptIsRunning = function()
+{
+this.showPanel("scripts");
+var test = this;
+
+test.evaluateInConsole_(
+'setTimeout("handleClick()" , 0)',
+function(resultText) {
+test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
+testScriptPauseAfterDelay();
+});
+
+
+
+function testScriptPauseAfterDelay() {
+setTimeout(testScriptPause, 300);
+}
+
+function testScriptPause() {
+
+
+WebInspector.panels.scripts.pauseButton.click();
+
+test._waitForScriptPause(
+{
+functionsOnStack: ["handleClick", ""],
+lineNumber: 5,
+lineText: "  while(true) {"
+},
+function() {
+test.releaseControl();
+});
+}
+
+this.takeControl();
+};
+
+
+
+TestSuite.prototype.optionsToString_ = function(options)
+{
+var names = [];
+for (var i = 0; i < options.length; i++)
+names.push('"' + options[i].text + '"');
+return names.join(",");
+};
+
+
+
+TestSuite.prototype.showMainPageScriptSource_ = function(scriptName, callback)
+{
+var test = this;
+
+var scriptSelect = document.getElementById("scripts-files");
+var options = scriptSelect.options;
+
+test.assertTrue(options.length, "Scripts list is empty");
+
+
+var scriptResource;
+if (options[scriptSelect.selectedIndex].text === scriptName)
+scriptResource = options[scriptSelect.selectedIndex].representedObject;
+else {
+var pageScriptIndex = -1;
+for (var i = 0; i < options.length; i++) {
+if (options[i].text === scriptName) {
+pageScriptIndex = i;
+break;
+}
+}
+test.assertTrue(-1 !== pageScriptIndex, "Script with url " + scriptName + " not found among " + test.optionsToString_(options));
+scriptResource = options[pageScriptIndex].representedObject;
+
+
+WebInspector.currentPanel._showScriptOrResource(scriptResource);
+test.assertEquals(pageScriptIndex, scriptSelect.selectedIndex, "Unexpected selected option index.");
+}
+
+test.assertTrue(scriptResource instanceof WebInspector.Resource,
+"Unexpected resource class.");
+test.assertTrue(!!scriptResource.url, "Resource URL is null.");
+test.assertTrue(scriptResource.url.search(scriptName + "$") !== -1, "Main HTML resource should be selected.");
+
+var scriptsPanel = WebInspector.panels.scripts;
+
+var view = scriptsPanel.visibleView;
+test.assertTrue(view instanceof WebInspector.SourceView);
+
+if (!view.sourceFrame._loaded) {
+test.addSniffer(view, "_sourceFrameSetupFinished", function(event) {
+callback(view, scriptResource.url);
+});
+} else
+callback(view, scriptResource.url);
+};
+
+
+
+TestSuite.prototype.evaluateInConsole_ = function(code, callback)
+{
+WebInspector.showConsole();
+WebInspector.console.prompt.text = code;
+WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter"));
+
+this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
+function(commandResult) {
+callback(commandResult.toMessageElement().textContent);
+});
+};
+
+
+
+TestSuite.prototype.testCompletionOnPause = function()
+{
+this.showPanel("scripts");
+var test = this;
+this._executeCodeWhenScriptsAreParsed("handleClick()", ["completion_on_pause.html"]);
+
+this._waitForScriptPause(
+{
+functionsOnStack: ["innerFunction", "handleClick", ""],
+lineNumber: 9,
+lineText: "    debugger;"
+},
+showConsole);
+
+function showConsole() {
+if (WebInspector.currentFocusElement === WebInspector.console.promptElement)
+testLocalsCompletion();
+else {
+test.addSniffer(WebInspector.console, "afterShow", testLocalsCompletion);
+WebInspector.showConsole();
+}
+}
+
+function testLocalsCompletion() {
+checkCompletions("th", ["parameter1", "closureLocal", "p", "createClosureLocal"], testThisCompletion);
+}
+
+function testThisCompletion() {
+checkCompletions("this.", ["field1", "field2", "m"], testFieldCompletion);
+}
+
+function testFieldCompletion() {
+checkCompletions("this.field1.", ["id", "name"], function() { test.releaseControl(); });
+}
+
+function checkCompletions(expression, expectedProperties, callback) {
+test.addSniffer(WebInspector.console, "_reportCompletions",
+function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) {
+test.assertTrue(!isException, "Exception while collecting completions");
+for (var i = 0; i < expectedProperties.length; i++) {
+var name = expectedProperties[i];
+test.assertTrue(result[name], "Name " + name + " not found among the completions: " + JSON.stringify(result));
+}
+setTimeout(callback, 0);
+});
+WebInspector.console.prompt.text = expression;
+WebInspector.console.prompt.autoCompleteSoon();
+}
+
+this.takeControl();
+};
+
+
+
+TestSuite.prototype._checkExecutionLine = function(sourceFrame, lineNumber, lineContent)
+{
+this.assertEquals(lineNumber, sourceFrame.executionLine, "Unexpected execution line number.");
+this.assertEquals(lineContent, sourceFrame._textModel.line(lineNumber - 1), "Unexpected execution line text.");
+}
+
+
+
 TestSuite.prototype._scriptsAreParsed = function(expected)
 {
-    var scriptSelect = document.getElementById("scripts-files");
-    var options = scriptSelect.options;
+var scriptSelect = document.getElementById("scripts-files");
+var options = scriptSelect.options;
 
-    // Check that at least all the expected scripts are present.
-    var missing = expected.slice(0);
-    for (var i = 0 ; i < options.length; i++) {
-        for (var j = 0; j < missing.length; j++) {
-            if (options[i].text.search(missing[j]) !== -1) {
-                missing.splice(j, 1);
-                break;
-            }
-        }
-    }
-    return missing.length === 0;
+
+var missing = expected.slice(0);
+for (var i = 0 ; i < options.length; i++) {
+for (var j = 0; j < missing.length; j++) {
+if (options[i].text.search(missing[j]) !== -1) {
+missing.splice(j, 1);
+break;
+}
+}
+}
+return missing.length === 0;
 };
 
 
-/**
- * Waits for script pause, checks expectations, and invokes the callback.
- * @param {Object} expectations  Dictionary of expectations
- * @param {function():void} callback
- */
+
 TestSuite.prototype._waitForScriptPause = function(expectations, callback)
 {
-    var test = this;
-    // Wait until script is paused.
-    test.addSniffer(
-        WebInspector,
-        "pausedScript",
-        function(callFrames) {
-            var functionsOnStack = [];
-            for (var i = 0; i < callFrames.length; i++)
-                functionsOnStack.push(callFrames[i].functionName);
+var test = this;
 
-            test.assertEquals(expectations.functionsOnStack.join(","), functionsOnStack.join(","), "Unexpected stack.");
+test.addSniffer(
+WebInspector,
+"pausedScript",
+function(details) {
+var callFrames = details.callFrames;
+var functionsOnStack = [];
+for (var i = 0; i < callFrames.length; i++)
+functionsOnStack.push(callFrames[i].functionName);
 
-            // Check that execution line where the script is paused is
-            // expected one.
-            test._checkSourceFrameWhenLoaded(expectations, callback);
-        });
+test.assertEquals(expectations.functionsOnStack.join(","), functionsOnStack.join(","), "Unexpected stack.");
+
+
+
+test._checkSourceFrameWhenLoaded(expectations, callback);
+});
 };
 
 
-/**
- * Waits for current source frame to load, checks expectations, and invokes
- * the callback.
- * @param {Object} expectations  Dictionary of expectations
- * @param {function():void} callback
- */
+
 TestSuite.prototype._checkSourceFrameWhenLoaded = function(expectations, callback)
 {
-    var test = this;
+var test = this;
 
-    var frame = WebInspector.currentPanel.visibleView.sourceFrame;
-    if (frame._loaded)
-        checkExecLine();
-    else {
-        setTimeout(function() {
-            test._checkSourceFrameWhenLoaded(expectations, callback);
-        }, 100);
-    }
-    function checkExecLine() {
-        test._checkExecutionLine(frame, expectations.lineNumber, expectations.lineText);
-        callback();
-    }
+var frame = WebInspector.currentPanel.visibleView.sourceFrame;
+if (frame._loaded)
+checkExecLine();
+else {
+setTimeout(function() {
+test._checkSourceFrameWhenLoaded(expectations, callback);
+}, 100);
+}
+function checkExecLine() {
+test._checkExecutionLine(frame, expectations.lineNumber, expectations.lineText);
+callback();
+}
 };
 
 
-/**
- * Performs sequence of steps.
- * @param {Array.<Object|Function>} Array [expectations1,action1,expectations2,
- *     action2,...,actionN].
- */
-TestSuite.prototype._performSteps = function(actions)
-{
-    var test = this;
-    var i = 0;
-    function doNextAction() {
-        if (i > 0)
-            actions[i++]();
-        if (i < actions.length - 1)
-            test._waitForScriptPause(actions[i++], doNextAction);
-    }
-    doNextAction();
-};
 
-
-/**
- * Waits until all the scripts are parsed and asynchronously executes the code
- * in the inspected page.
- */
 TestSuite.prototype._executeCodeWhenScriptsAreParsed = function(code, expectedScripts)
 {
-    var test = this;
+var test = this;
 
-    function executeFunctionInInspectedPage() {
-        // Since breakpoints are ignored in evals' calculate() function is
-        // execute after zero-timeout so that the breakpoint is hit.
-        test.evaluateInConsole_(
-            'setTimeout("' + code + '" , 0)',
-            function(resultText) {
-                test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
-            });
-    }
+function executeFunctionInInspectedPage() {
 
-    test._waitUntilScriptsAreParsed(expectedScripts, executeFunctionInInspectedPage);
+
+test.evaluateInConsole_(
+'setTimeout("' + code + '" , 0)',
+function(resultText) {
+test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText + ". Code: " + code);
+});
+}
+
+test._waitUntilScriptsAreParsed(expectedScripts, executeFunctionInInspectedPage);
 };
 
 
-/**
- * Waits until all the scripts are parsed and invokes the callback.
- */
+
 TestSuite.prototype._waitUntilScriptsAreParsed = function(expectedScripts, callback)
 {
-    var test = this;
+var test = this;
 
-    function waitForAllScripts() {
-        if (test._scriptsAreParsed(expectedScripts))
-            callback();
-        else
-            test.addSniffer(WebInspector, "parsedScriptSource", waitForAllScripts);
-    }
+function waitForAllScripts() {
+if (test._scriptsAreParsed(expectedScripts))
+callback();
+else
+test.addSniffer(WebInspector, "parsedScriptSource", waitForAllScripts);
+}
 
-    waitForAllScripts();
+waitForAllScripts();
 };
 
 
-/**
- * Waits until all debugger scripts are parsed and executes "a()" in the
- * inspected page.
- */
-TestSuite.prototype._executeFunctionForStepTest = function()
-{
-    this._executeCodeWhenScriptsAreParsed("a()", ["debugger_step.html", "debugger_step.js"]);
-};
 
-
-/**
- * Tests step over in the debugger.
- */
-TestSuite.prototype.testStepOver = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    this._executeFunctionForStepTest();
-
-    this._performSteps([
-        {
-            functionsOnStack: ["d","a","(anonymous function)"],
-            lineNumber: 3,
-            lineText: "    debugger;"
-        },
-        function() {
-            document.getElementById("scripts-step-over").click();
-        },
-        {
-            functionsOnStack: ["d","a","(anonymous function)"],
-            lineNumber: 5,
-            lineText: "  var y = fact(10);"
-        },
-        function() {
-            document.getElementById("scripts-step-over").click();
-        },
-        {
-            functionsOnStack: ["d","a","(anonymous function)"],
-            lineNumber: 6,
-            lineText: "  return y;"
-        },
-        function() {
-            test.releaseControl();
-        }
-    ]);
-
-    test.takeControl();
-};
-
-
-/**
- * Tests step out in the debugger.
- */
-TestSuite.prototype.testStepOut = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    this._executeFunctionForStepTest();
-
-    this._performSteps([
-        {
-            functionsOnStack: ["d","a","(anonymous function)"],
-            lineNumber: 3,
-            lineText: "    debugger;"
-        },
-        function() {
-            document.getElementById("scripts-step-out").click();
-        },
-        {
-            functionsOnStack: ["a","(anonymous function)"],
-            lineNumber: 8,
-            lineText: "  printResult(result);"
-        },
-        function() {
-            test.releaseControl();
-        }
-    ]);
-
-    test.takeControl();
-};
-
-
-/**
- * Tests step in in the debugger.
- */
-TestSuite.prototype.testStepIn = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    this._executeFunctionForStepTest();
-
-    this._performSteps([
-        {
-            functionsOnStack: ["d","a","(anonymous function)"],
-            lineNumber: 3,
-            lineText: "    debugger;"
-        },
-        function() {
-            document.getElementById("scripts-step-over").click();
-        },
-        {
-            functionsOnStack: ["d","a","(anonymous function)"],
-            lineNumber: 5,
-            lineText: "  var y = fact(10);"
-        },
-        function() {
-            document.getElementById("scripts-step-into").click();
-        },
-        {
-            functionsOnStack: ["fact","d","a","(anonymous function)"],
-            lineNumber: 15,
-            lineText: "  return r;"
-        },
-        function() {
-            test.releaseControl();
-        }
-    ]);
-
-    test.takeControl();
-};
-
-
-/**
- * Gets a XPathResult matching given xpath.
- * @param {string} xpath
- * @param {number} resultType
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- *     will be used
- * @return {XPathResult} Type of returned value is determined by "resultType" parameter
- */
-
-TestSuite.prototype._evaluateXpath = function(xpath, resultType, opt_ancestor)
-{
-    if (!opt_ancestor)
-        opt_ancestor = document.documentElement;
-    try {
-        return document.evaluate(xpath, opt_ancestor, null, resultType, null);
-    } catch(e) {
-        this.fail('Error in expression: "' + xpath + '".' + e);
-    }
-};
-
-
-/**
- * Gets first Node matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- *     will be used
- * @return {?Node}
- */
-TestSuite.prototype._findNode = function(xpath, opt_ancestor)
-{
-    var result = this._evaluateXpath(xpath, XPathResult.FIRST_ORDERED_NODE_TYPE, opt_ancestor).singleNodeValue;
-    this.assertTrue(!!result, "Cannot find node on path: " + xpath);
-    return result;
-};
-
-
-/**
- * Gets a text matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified documentElement
- *     will be used
- * @return {?string}
- */
-TestSuite.prototype._findText = function(xpath, opt_ancestor)
-{
-    var result = this._evaluateXpath(xpath, XPathResult.STRING_TYPE, opt_ancestor).stringValue;
-    this.assertTrue(!!result, "Cannot find text on path: " + xpath);
-    return result;
-};
-
-
-/**
- * Gets an iterator over nodes matching given xpath.
- * @param {string} xpath
- * @param {Node} opt_ancestor Context node. If not specified, documentElement
- *     will be used
- * @return {XPathResult} Iterator over the nodes
- */
-TestSuite.prototype._nodeIterator = function(xpath, opt_ancestor)
-{
-    return this._evaluateXpath(xpath, XPathResult.ORDERED_NODE_ITERATOR_TYPE, opt_ancestor);
-};
-
-
-/**
- * Checks the scopeSectionDiv against the expectations.
- * @param {Node} scopeSectionDiv The section div
- * @param {Object} expectations Expectations dictionary
- */
-TestSuite.prototype._checkScopeSectionDiv = function(scopeSectionDiv, expectations)
-{
-    var scopeTitle = this._findText('./div[@class="header"]/div[@class="title"]/text()', scopeSectionDiv);
-    this.assertEquals(expectations.title, scopeTitle, "Unexpected scope section title.");
-    if (!expectations.properties)
-        return;
-    this.assertTrue(scopeSectionDiv.hasStyleClass("expanded"), 'Section "' + scopeTitle + '" is collapsed.');
-
-    var propertyIt = this._nodeIterator("./ol/li", scopeSectionDiv);
-    var propertyLi;
-    var foundProps = [];
-    while (propertyLi = propertyIt.iterateNext()) {
-        var name = this._findText('./span[@class="name"]/text()', propertyLi);
-        var value = this._findText('./span[@class="value"]/text()', propertyLi);
-        this.assertTrue(!!name, 'Invalid variable name: "' + name + '"');
-        this.assertTrue(name in expectations.properties, "Unexpected property: " + name);
-        this.assertEquals(expectations.properties[name], value, 'Unexpected "' + name + '" property value.');
-        delete expectations.properties[name];
-        foundProps.push(name + " = " + value);
-    }
-
-    // Check that all expected properties were found.
-    for (var p in expectations.properties)
-        this.fail('Property "' + p + '" was not found in scope "' + scopeTitle + '". Found properties: "' + foundProps.join(",") + '"');
-};
-
-
-/**
- * Expands scope sections matching the filter and invokes the callback on
- * success.
- * @param {function(WebInspector.ObjectPropertiesSection, number):boolean}
- *     filter
- * @param {Function} callback
- */
-TestSuite.prototype._expandScopeSections = function(filter, callback)
-{
-    var sections = WebInspector.currentPanel.sidebarPanes.scopechain.sections;
-
-    var toBeUpdatedCount = 0;
-    function updateListener() {
-        --toBeUpdatedCount;
-        if (toBeUpdatedCount === 0) {
-            // Report when all scopes are expanded and populated.
-            callback();
-        }
-    }
-
-    // Global scope is always the last one.
-    for (var i = 0; i < sections.length - 1; i++) {
-        var section = sections[i];
-        if (!filter(sections, i))
-            continue;
-        ++toBeUpdatedCount;
-        var populated = section.populated;
-
-        this._hookGetPropertiesCallback(updateListener,
-            function() {
-                section.expand();
-                if (populated) {
-                    // Make sure "updateProperties" callback will be called at least once
-                    // after it was overridden.
-                    section.update();
-                }
-            });
-    }
-};
-
-
-/**
- * Tests that scopes can be expanded and contain expected data.
- */
-TestSuite.prototype.testExpandScope = function()
-{
-    this.showPanel("scripts");
-    var test = this;
-
-    this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_closure.html"]);
-
-    this._waitForScriptPause(
-        {
-            functionsOnStack: ["innerFunction", "handleClick", "(anonymous function)"],
-            lineNumber: 8,
-            lineText: "    debugger;"
-        },
-        expandAllSectionsExceptGlobal);
-
-    // Expanding Global scope takes for too long so we skeep it.
-    function expandAllSectionsExceptGlobal() {
-        test._expandScopeSections(function(sections, i) {
-            return i < sections.length - 1;
-        },
-        examineScopes /* When all scopes are expanded and populated check them. */);
-    }
-
-    // Check scope sections contents.
-    function examineScopes() {
-        var scopeVariablesSection = test._findNode('//div[@id="scripts-sidebar"]/div[div[@class="title"]/text()="Scope Variables"]');
-        var expectedScopes = [
-            {
-                title: "Local",
-                properties: {
-                    x:"2009",
-                    innerFunctionLocalVar:"2011",
-                    "this": "global",
-                }
-            },
-            {
-                title: "Closure",
-                properties: {
-                    n:"TextParam",
-                    makeClosureLocalVar:"local.TextParam",
-                }
-            },
-            {
-                title: "Global",
-            },
-        ];
-        var it = test._nodeIterator('./div[@class="body"]/div', scopeVariablesSection);
-        var scopeIndex = 0;
-        var scopeDiv;
-        while (scopeDiv = it.iterateNext()) {
-            test.assertTrue(scopeIndex < expectedScopes.length, "Too many scopes.");
-            test._checkScopeSectionDiv(scopeDiv, expectedScopes[scopeIndex]);
-            ++scopeIndex;
-        }
-        test.assertEquals(expectedScopes.length, scopeIndex, "Unexpected number of scopes.");
-
-        test.releaseControl();
-    }
-
-    test.takeControl();
-};
-
-
-/**
- * Returns child tree element for a property with given name.
- * @param {TreeElement} parent Parent tree element.
- * @param {string} childName
- * @param {string} objectPath Path to the object. Will be printed in the case
- *     of failure.
- * @return {TreeElement}
- */
-TestSuite.prototype._findChildProperty = function(parent, childName, objectPath)
-{
-    var children = parent.children;
-    for (var i = 0; i < children.length; i++) {
-        var treeElement = children[i];
-        var property = treeElement.property;
-        if (property.name === childName)
-            return treeElement;
-    }
-    this.fail('Cannot find property "' + childName + '" in ' + objectPath);
-};
-
-
-/**
- * Executes the 'code' with InjectedScriptAccess.getProperties overriden
- * so that all callbacks passed to InjectedScriptAccess.getProperties are
- * extended with the "hook".
- * @param {Function} hook The hook function.
- * @param {Function} code A code snippet to be executed.
- */
 TestSuite.prototype._hookGetPropertiesCallback = function(hook, code)
 {
-    var accessor = InjectedScriptAccess.prototype;
-    var orig = accessor.getProperties;
-    accessor.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) {
-        orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate,
-            function() {
-              callback.apply(this, arguments);
-              hook();
-            });
-    };
-    try {
-        code();
-    } finally {
-        accessor.getProperties = orig;
-    }
+var accessor = InjectedScriptAccess.prototype;
+var orig = accessor.getProperties;
+accessor.getProperties = function(objectProxy, ignoreHasOwnProperty, abbreviate, callback) {
+orig.call(this, objectProxy, ignoreHasOwnProperty, abbreviate,
+function() {
+callback.apply(this, arguments);
+hook();
+});
+};
+try {
+code();
+} finally {
+accessor.getProperties = orig;
+}
 };
 
 
-/**
- * Tests that all elements in prototype chain of an object have expected
- * intrinic proprties(__proto__, constructor, prototype).
- */
-TestSuite.prototype.testDebugIntrinsicProperties = function()
-{
-    this.showPanel("scripts");
-    var test = this;
 
-    this._executeCodeWhenScriptsAreParsed("handleClick()", ["debugger_intrinsic_properties.html"]);
-
-    this._waitForScriptPause(
-        {
-            functionsOnStack: ["callDebugger", "handleClick", "(anonymous function)"],
-            lineNumber: 29,
-            lineText: "  debugger;"
-        },
-        expandLocalScope);
-
-    var localScopeSection = null;
-    function expandLocalScope() {
-      test._expandScopeSections(function(sections, i) {
-              if (i === 0) {
-                  test.assertTrue(sections[i].object.isLocal, "Scope #0 is not Local.");
-                  localScopeSection = sections[i];
-                  return true;
-              }
-              return false;
-          },
-          examineLocalScope);
-    }
-
-    function examineLocalScope() {
-      var scopeExpectations = [
-          "a", "Object", [
-              "constructor", "function Child()", [
-                  "constructor", "function Function()", null,
-                  "name", "Child", null,
-                  "prototype", "Object", [
-                      "childProtoField", 21, null
-                  ]
-              ],
-
-            "__proto__", "Object", [
-                  "__proto__", "Object", [
-                      "__proto__", "Object", [
-                          "__proto__", "null", null,
-                          "constructor", "function Object()", null,
-                      ],
-                    "constructor", "function Parent()", [
-                        "name", "Parent", null,
-                        "prototype", "Object", [
-                            "parentProtoField", 11, null,
-                        ]
-                    ],
-                    "parentProtoField", 11, null,
-                ],
-                "constructor", "function Child()", null,
-                "childProtoField", 21, null,
-            ],
-
-            "parentField", 10, null,
-            "childField", 20, null,
-          ]
-      ];
-
-      checkProperty(localScopeSection.propertiesTreeOutline, "<Local Scope>", scopeExpectations);
-    }
-
-    var propQueue = [];
-    var index = 0;
-    var expectedFinalIndex = 8;
-
-    function expandAndCheckNextProperty() {
-        if (index === propQueue.length) {
-            test.assertEquals(expectedFinalIndex, index, "Unexpected number of expanded objects.");
-            test.releaseControl();
-            return;
-        }
-
-        // Read next property data from the queue.
-        var treeElement = propQueue[index].treeElement;
-        var path = propQueue[index].path;
-        var expectations = propQueue[index].expectations;
-        index++;
-
-        // Expand the property.
-        test._hookGetPropertiesCallback(function() {
-                checkProperty(treeElement, path, expectations);
-            },
-            function() {
-                treeElement.expand();
-            });
-    }
-
-    function checkProperty(treeElement, path, expectations) {
-        for (var i = 0; i < expectations.length; i += 3) {
-            var name = expectations[i];
-            var description = expectations[i+1];
-            var value = expectations[i+2];
-
-            var propertyPath = path + "." + name;
-            var propertyTreeElement = test._findChildProperty(treeElement, name, path);
-            test.assertTrue(propertyTreeElement, 'Property "' + propertyPath + '" not found.');
-            test.assertEquals(description, propertyTreeElement.property.value.description, 'Unexpected "' + propertyPath + '" description.');
-            if (value) {
-                // Schedule property content check.
-                propQueue.push({
-                    treeElement: propertyTreeElement,
-                    path: propertyPath,
-                    expectations: value,
-                });
-            }
-        }
-        // Check next property in the queue.
-        expandAndCheckNextProperty();
-    }
-
-    test.takeControl();
-};
-
-
-/**
- * Tests "Pause" button will pause debugger when a snippet is evaluated.
- */
 TestSuite.prototype.testPauseInEval = function()
 {
-    this.showPanel("scripts");
+this.showPanel("scripts");
 
-    var test = this;
+var test = this;
 
-    var pauseButton = document.getElementById("scripts-pause");
-    pauseButton.click();
+var pauseButton = document.getElementById("scripts-pause");
+pauseButton.click();
 
-    devtools.tools.evaluateJavaScript("fib(10)");
+devtools.tools.evaluateJavaScript("fib(10)");
 
-    this.addSniffer(WebInspector, "pausedScript",
-        function() {
-            test.releaseControl();
-        });
+this.addSniffer(WebInspector, "pausedScript",
+function() {
+test.releaseControl();
+});
 
-    test.takeControl();
+test.takeControl();
 };
 
 
-/**
- * Key event with given key identifier.
- */
+
 TestSuite.createKeyEvent = function(keyIdentifier)
 {
-    var evt = document.createEvent("KeyboardEvent");
-    evt.initKeyboardEvent("keydown", true /* can bubble */, true /* can cancel */, null /* view */, keyIdentifier, "");
-    return evt;
+var evt = document.createEvent("KeyboardEvent");
+evt.initKeyboardEvent("keydown", true  , true  , null  , keyIdentifier, "");
+return evt;
 };
 
 
-/**
- * Tests console eval.
- */
-TestSuite.prototype.testConsoleEval = function()
-{
-    var test = this;
-    this.evaluateInConsole_("123",
-        function(resultText) {
-            test.assertEquals("123", resultText);
-            test.releaseControl();
-        });
 
-    this.takeControl();
-};
-
-
-/**
- * Tests console log.
- */
-TestSuite.prototype.testConsoleLog = function()
-{
-    WebInspector.console.visible = true;
-    var messages = WebInspector.console.messages;
-    var index = 0;
-
-    var test = this;
-    var assertNext = function(line, message, opt_class, opt_count, opt_substr) {
-        var elem = messages[index++].toMessageElement();
-        var clazz = elem.getAttribute("class");
-        var expectation = (opt_count || '') + 'console_test_page.html:' + line + message;
-        if (opt_substr)
-            test.assertContains(elem.textContent, expectation);
-        else
-            test.assertEquals(expectation, elem.textContent);
-        if (opt_class)
-            test.assertContains(clazz, "console-" + opt_class);
-    };
-
-    assertNext("5", "log", "log-level");
-    assertNext("7", "debug", "log-level");
-    assertNext("9", "info", "log-level");
-    assertNext("11", "warn", "warning-level");
-    assertNext("13", "error", "error-level");
-    assertNext("15", "Message format number 1, 2 and 3.5");
-    assertNext("17", "Message format for string");
-    assertNext("19", "Object Object");
-    assertNext("22", "repeated", "log-level", 5);
-    assertNext("26", "count: 1");
-    assertNext("26", "count: 2");
-    assertNext("29", "group", "group-title");
-    index++;
-    assertNext("33", "timer:", "log-level", "", true);
-    assertNext("35", "1 2 3", "log-level");
-    assertNext("37", "HTMLDocument", "log-level");
-    assertNext("39", "<html>", "log-level", "", true);
-};
-
-
-/**
- * Tests eval of global objects.
- */
-TestSuite.prototype.testEvalGlobal = function()
-{
-    WebInspector.console.visible = true;
-
-    var inputs = ["foo", "foobar"];
-    var expectations = ["foo", "fooValue", "foobar", "ReferenceError: foobar is not defined"];
-
-    // Do not change code below - simply add inputs and expectations above.
-    var initEval = function(input) {
-        WebInspector.console.prompt.text = input;
-        WebInspector.console.promptElement.dispatchEvent( TestSuite.createKeyEvent("Enter"));
-    };
-    var test = this;
-    var messagesCount = 0;
-    var inputIndex = 0;
-    this.addSniffer(WebInspector.ConsoleView.prototype, "addMessage",
-        function(commandResult) {
-            messagesCount++;
-            if (messagesCount === expectations.length) {
-                var messages = WebInspector.console.messages;
-                for (var i = 0; i < expectations; ++i) {
-                    var elem = messages[i++].toMessageElement();
-                    test.assertEquals(elem.textContent, expectations[i]);
-                }
-                test.releaseControl();
-            } else if (messagesCount % 2 === 0)
-                initEval(inputs[inputIndex++]);
-        }, true);
-
-    initEval(inputs[inputIndex++]);
-    this.takeControl();
-};
-
-
-/**
- * Tests that Storage panel can be open and that local DOM storage is added
- * to the panel.
- */
-TestSuite.prototype.testShowStoragePanel = function()
-{
-    var test = this;
-    this.addSniffer(WebInspector.panels.storage, "addDOMStorage",
-        function(storage) {
-            var orig = storage.getEntries;
-            storage.getEntries = function(callback) {
-                orig.call(this, function(entries) {
-                    callback(entries);
-                    test.releaseControl();
-                });
-            };
-            try {
-                WebInspector.currentPanel.selectDOMStorage(storage.id);
-                storage.getEntries = orig;
-            } catch (e) {
-                test.fail("Exception in selectDOMStorage: " + e);
-            }
-        });
-    this.showPanel("storage");
-
-    // Access localStorage so that it's pushed to the frontend.
-    this.evaluateInConsole_(
-        'setTimeout("localStorage.x = 10" , 0)',
-        function(resultText) {
-            test.assertTrue(!isNaN(resultText), "Failed to get timer id: " + resultText);
-        });
-
-    // Wait until DOM storage is added to the panel.
-    this.takeControl();
-};
-
-
-/**
- * Test runner for the test suite.
- */
 var uiTests = {};
 
 
-/**
- * Run each test from the test suit on a fresh instance of the suite.
- */
+
 uiTests.runAllTests = function()
 {
-    // For debugging purposes.
-    for (var name in TestSuite.prototype) {
-        if (name.substring(0, 4) === "test" && typeof TestSuite.prototype[name] === "function")
-            uiTests.runTest(name);
-    }
+
+for (var name in TestSuite.prototype) {
+if (name.substring(0, 4) === "test" && typeof TestSuite.prototype[name] === "function")
+uiTests.runTest(name);
+}
 };
 
 
-/**
- * Run specified test on a fresh instance of the test suite.
- * @param {string} name Name of a test method from TestSuite class.
- */
+
 uiTests.runTest = function(name)
 {
-    new TestSuite().runTest(name);
+if (uiTests._populatedInterface)
+new TestSuite().runTest(name);
+else
+uiTests._pendingTestName = name;
 };
 
+(function() {
+
+function runTests()
+{
+uiTests._populatedInterface = true;
+var name = uiTests._pendingTestName;
+delete uiTests._pendingTestName;
+if (name)
+new TestSuite().runTest(name);
+}
+
+var oldShowElementsPanel = WebInspector.showElementsPanel;
+WebInspector.showElementsPanel = function()
+{
+oldShowElementsPanel.call(this);
+runTests();
+}
+
+var oldShowPanel = WebInspector.showPanel;
+WebInspector.showPanel = function(name)
+{
+oldShowPanel.call(this, name);
+runTests();
+}
+
+})();
 
 }
 
diff --git a/resources/inspector/Images/applicationCache.png b/resources/inspector/Images/applicationCache.png
new file mode 100644
index 0000000..50bad87
--- /dev/null
+++ b/resources/inspector/Images/applicationCache.png
Binary files differ
diff --git a/resources/inspector/Images/auditsIcon.png b/resources/inspector/Images/auditsIcon.png
new file mode 100644
index 0000000..ebeafdc
--- /dev/null
+++ b/resources/inspector/Images/auditsIcon.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointBorder.png b/resources/inspector/Images/breakpointBorder.png
new file mode 100644
index 0000000..0b1b550
--- /dev/null
+++ b/resources/inspector/Images/breakpointBorder.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointConditionalBorder.png b/resources/inspector/Images/breakpointConditionalBorder.png
new file mode 100644
index 0000000..430e37e
--- /dev/null
+++ b/resources/inspector/Images/breakpointConditionalBorder.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointConditionalCounterBorder.png b/resources/inspector/Images/breakpointConditionalCounterBorder.png
new file mode 100644
index 0000000..b4a5030
--- /dev/null
+++ b/resources/inspector/Images/breakpointConditionalCounterBorder.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointCounterBorder.png b/resources/inspector/Images/breakpointCounterBorder.png
new file mode 100644
index 0000000..8b77b61
--- /dev/null
+++ b/resources/inspector/Images/breakpointCounterBorder.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointsActivateButtonGlyph.png b/resources/inspector/Images/breakpointsActivateButtonGlyph.png
new file mode 100644
index 0000000..ce49aac
--- /dev/null
+++ b/resources/inspector/Images/breakpointsActivateButtonGlyph.png
Binary files differ
diff --git a/resources/inspector/Images/breakpointsDeactivateButtonGlyph.png b/resources/inspector/Images/breakpointsDeactivateButtonGlyph.png
new file mode 100644
index 0000000..5c5fcf6
--- /dev/null
+++ b/resources/inspector/Images/breakpointsDeactivateButtonGlyph.png
Binary files differ
diff --git a/resources/inspector/Images/frame.png b/resources/inspector/Images/frame.png
new file mode 100644
index 0000000..0d1953c
--- /dev/null
+++ b/resources/inspector/Images/frame.png
Binary files differ
diff --git a/resources/inspector/Images/gearButtonGlyph.png b/resources/inspector/Images/gearButtonGlyph.png
new file mode 100644
index 0000000..19659c9
--- /dev/null
+++ b/resources/inspector/Images/gearButtonGlyph.png
Binary files differ
diff --git a/resources/inspector/Images/grayConnectorPoint.png b/resources/inspector/Images/grayConnectorPoint.png
deleted file mode 100644
index fddc7ea..0000000
--- a/resources/inspector/Images/grayConnectorPoint.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/networkIcon.png b/resources/inspector/Images/networkIcon.png
new file mode 100644
index 0000000..ba10bba
--- /dev/null
+++ b/resources/inspector/Images/networkIcon.png
Binary files differ
diff --git a/resources/inspector/Images/paneAddButtons.png b/resources/inspector/Images/paneAddButtons.png
new file mode 100644
index 0000000..f1c0047
--- /dev/null
+++ b/resources/inspector/Images/paneAddButtons.png
Binary files differ
diff --git a/resources/inspector/Images/popoverArrows.png b/resources/inspector/Images/popoverArrows.png
new file mode 100644
index 0000000..ccefa16
--- /dev/null
+++ b/resources/inspector/Images/popoverArrows.png
Binary files differ
diff --git a/resources/inspector/Images/popoverBackground.png b/resources/inspector/Images/popoverBackground.png
new file mode 100644
index 0000000..f20c988
--- /dev/null
+++ b/resources/inspector/Images/popoverBackground.png
Binary files differ
diff --git a/resources/inspector/Images/programCounterBorder.png b/resources/inspector/Images/programCounterBorder.png
new file mode 100644
index 0000000..fed2f3e
--- /dev/null
+++ b/resources/inspector/Images/programCounterBorder.png
Binary files differ
diff --git a/resources/inspector/Images/resourcesSilhouette.png b/resources/inspector/Images/resourcesSilhouette.png
deleted file mode 100644
index 9c8bb53..0000000
--- a/resources/inspector/Images/resourcesSilhouette.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/segmentChromium.png b/resources/inspector/Images/segmentChromium.png
index 607559b..f4248e1 100644
--- a/resources/inspector/Images/segmentChromium.png
+++ b/resources/inspector/Images/segmentChromium.png
Binary files differ
diff --git a/resources/inspector/Images/spinner.gif b/resources/inspector/Images/spinner.gif
new file mode 100644
index 0000000..5f68c02
--- /dev/null
+++ b/resources/inspector/Images/spinner.gif
Binary files differ
diff --git a/resources/inspector/Images/statusbarBackgroundChromium.png b/resources/inspector/Images/statusbarBackgroundChromium.png
index 9d326ac..7a760c1 100644
--- a/resources/inspector/Images/statusbarBackgroundChromium.png
+++ b/resources/inspector/Images/statusbarBackgroundChromium.png
Binary files differ
diff --git a/resources/inspector/Images/statusbarBottomBackgroundChromium.png b/resources/inspector/Images/statusbarBottomBackgroundChromium.png
index 7c7db0a..e3bc944 100644
--- a/resources/inspector/Images/statusbarBottomBackgroundChromium.png
+++ b/resources/inspector/Images/statusbarBottomBackgroundChromium.png
Binary files differ
diff --git a/resources/inspector/Images/statusbarButtonsChromium.png b/resources/inspector/Images/statusbarButtonsChromium.png
index 0c6635d..136d5a8 100644
--- a/resources/inspector/Images/statusbarButtonsChromium.png
+++ b/resources/inspector/Images/statusbarButtonsChromium.png
Binary files differ
diff --git a/resources/inspector/Images/statusbarMenuButtonChromium.png b/resources/inspector/Images/statusbarMenuButtonChromium.png
index bf26684..5ff61d9 100644
--- a/resources/inspector/Images/statusbarMenuButtonChromium.png
+++ b/resources/inspector/Images/statusbarMenuButtonChromium.png
Binary files differ
diff --git a/resources/inspector/Images/storageIcon.png b/resources/inspector/Images/storageIcon.png
deleted file mode 100644
index 79c7bb3..0000000
--- a/resources/inspector/Images/storageIcon.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/Images/thumbActiveHoriz.png b/resources/inspector/Images/thumbActiveHoriz.png
new file mode 100644
index 0000000..a6ee561
--- /dev/null
+++ b/resources/inspector/Images/thumbActiveHoriz.png
Binary files differ
diff --git a/resources/inspector/Images/thumbActiveVert.png b/resources/inspector/Images/thumbActiveVert.png
new file mode 100644
index 0000000..a3eabe8
--- /dev/null
+++ b/resources/inspector/Images/thumbActiveVert.png
Binary files differ
diff --git a/resources/inspector/Images/thumbHoriz.png b/resources/inspector/Images/thumbHoriz.png
new file mode 100644
index 0000000..c16559a
--- /dev/null
+++ b/resources/inspector/Images/thumbHoriz.png
Binary files differ
diff --git a/resources/inspector/Images/thumbHoverHoriz.png b/resources/inspector/Images/thumbHoverHoriz.png
new file mode 100644
index 0000000..0fe8d6a
--- /dev/null
+++ b/resources/inspector/Images/thumbHoverHoriz.png
Binary files differ
diff --git a/resources/inspector/Images/thumbHoverVert.png b/resources/inspector/Images/thumbHoverVert.png
new file mode 100644
index 0000000..30e315a
--- /dev/null
+++ b/resources/inspector/Images/thumbHoverVert.png
Binary files differ
diff --git a/resources/inspector/Images/thumbVert.png b/resources/inspector/Images/thumbVert.png
new file mode 100644
index 0000000..61fbc06
--- /dev/null
+++ b/resources/inspector/Images/thumbVert.png
Binary files differ
diff --git a/resources/inspector/Images/trackHoriz.png b/resources/inspector/Images/trackHoriz.png
new file mode 100644
index 0000000..517d306
--- /dev/null
+++ b/resources/inspector/Images/trackHoriz.png
Binary files differ
diff --git a/resources/inspector/Images/trackVert.png b/resources/inspector/Images/trackVert.png
new file mode 100644
index 0000000..d49620d
--- /dev/null
+++ b/resources/inspector/Images/trackVert.png
Binary files differ
diff --git a/resources/inspector/Images/whiteConnectorPoint.png b/resources/inspector/Images/whiteConnectorPoint.png
deleted file mode 100644
index c8fb1cf..0000000
--- a/resources/inspector/Images/whiteConnectorPoint.png
+++ /dev/null
Binary files differ
diff --git a/resources/inspector/audits.css b/resources/inspector/audits.css
deleted file mode 100644
index 31b2287..0000000
--- a/resources/inspector/audits.css
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-.audits-sidebar-tree-item .icon {
-    content: url(Images/resourcesTimeGraphIcon.png);
-}
-
-.audit-result-sidebar-tree-item .icon {
-    content: url(Images/resourceDocumentIcon.png);
-}
-
-#audit-views {
-    position: absolute;
-    top: 0;
-    right: 0;
-    left: 200px;
-    bottom: 0;
-    overflow: auto;
-}
-
-button.clear-audit-results-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);
-}
-
-.audit-launcher-view {
-    z-index: 1000;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    background-color: white;
-    font-size: 13px;
-    overflow-x: hidden;
-    overflow-y: overlay;
-    display: none;
-}
-
-.audit-launcher-view.visible {
-    display: block;
-}
-
-.audit-launcher-view .audit-launcher-view-content {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    padding: 0 0 0 16px;
-    white-space: nowrap;
-}
-
-.audit-launcher-view h1 {
-    color: rgb(110, 116, 128);
-    font-size: 16px;
-    line-height: 20px;
-    font-weight: normal;
-    padding-top: 15px;
-}
-
-.audit-launcher-view h1.no-audits {
-    text-align: center;
-    font-style: italic;
-    position: relative;
-    left: -8px;
-}
-
-.audit-launcher-view div.button-container {
-    position: absolute;
-    width: 100%;
-    bottom: 16px;
-    padding-top: 16px;
-}
-
-.audit-launcher-view div.audit-categories-container {
-    position: relative;
-    top: 11px;
-    left: 0;
-    width: 100%;
-    overflow-y: auto;
-}
-
-.audit-launcher-view button {
-    color: rgb(6, 6, 6);
-    background-color: transparent;
-    border: 1px solid rgb(165, 165, 165);
-    background-color: rgb(237, 237, 237);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-    -webkit-border-radius: 12px;
-    -webkit-appearance: none;
-}
-
-.audit-launcher-view button {
-    font-size: 13px;
-    padding: 3px 20px;
-    height: 24px;
-    margin: 0 5px 0 0;
-}
-
-.audit-launcher-view button:active {
-    background-color: rgb(215, 215, 215);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
-}
-
-body.inactive .audit-launcher-view button, .audit-launcher-view button:disabled {
-    color: rgb(130, 130, 130);
-    border-color: rgb(212, 212, 212);
-    background-color: rgb(239, 239, 239);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
-}
-
-.audit-launcher-view label {
-    position: relative;
-    display: block;
-    text-align: left;
-    word-break: break-word;
-    padding: 0 0 5px 0;
-}
-
-.audit-launcher-view label.disabled {
-    color: rgb(130, 130, 130);
-}
-
-.audit-launcher-view input[type="checkbox"] {
-    margin-left: 0;
-}
-
-.audit-launcher-view input[type="radio"] {
-    height: 17px;
-    width: 17px;
-    border: 1px solid rgb(165, 165, 165);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-    -webkit-border-radius: 8px;
-    -webkit-appearance: none;
-    vertical-align: middle;
-    margin: 0 5px 5px 0;
-}
-
-.audit-launcher-view input[type="radio"]:active:not(:disabled) {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
-}
-
-.audit-launcher-view input[type="radio"]:checked:not(:disabled), .audit-launcher-view input[type="radio"]:checked:disabled {
-    background: url(Images/radioDot.png) center no-repeat,
-                -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-}
-
-.audit-result-view {
-    overflow: auto;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    display: none;
-}
-
-.audit-result-view.visible {
-    display: block;
-}
-
-.audit-result-view .severity-severe {
-    content: url(Images/errorRedDot.png);
-}
-
-.audit-result-view .severity-warning {
-    content: url(Images/warningOrangeDot.png);
-}
-
-.audit-result-view .severity-info {
-    content: url(Images/successGreenDot.png);
-}
-
-.audit-result-tree li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 1px;
-    padding-right: 2px;
-}
-
-.audit-result-tree {
-    font-size: 11px;
-    line-height: 14px;
-}
-
-.audit-result-tree > ol {
-    position: relative;
-    padding: 2px 6px !important;
-    margin: 0;
-    color: rgb(84, 84, 84);
-    cursor: default;
-    min-width: 100%;
-}
-
-.audit-result-tree, .audit-result-tree ol {
-    list-style-type: none;
-    -webkit-padding-start: 12px;
-    margin: 0;
-}
-
-.audit-result-tree li {
-    padding: 0 0 0 14px;
-    margin-top: 1px;
-    margin-bottom: 1px;
-    word-wrap: break-word;
-    text-indent: -2px;
-}
-
-.audit-result-tree li.parent {
-    text-indent: -12px
-}
-
-.audit-result-tree li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 0;
-    padding-right: 2px;
-}
-
-.audit-result-tree li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.audit-result-tree ol.children {
-    display: none;
-}
-
-.audit-result-tree ol.children.expanded {
-    display: block;
-}
-
-.audit-result {
-    font-weight: bold;
-    color: black;
-}
-
-.audit-result img {
-    float: left;
-    margin-left: -40px;
-    margin-top: -1px;
-}
diff --git a/resources/inspector/devTools.css b/resources/inspector/devTools.css
index bb33f72..bc30ddf 100755
--- a/resources/inspector/devTools.css
+++ b/resources/inspector/devTools.css
@@ -1,50 +1,362 @@
-#scripts-files option.injected {
-    color: rgb(70, 134, 240);
+/* audits.css */
+
+/*
+ * Copyright (C) 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.audits-sidebar-tree-item .icon {
+    content: url(Images/resourcesTimeGraphIcon.png);
 }
 
-.data-grid table {
-    line-height: 120%;
+.audit-result-sidebar-tree-item .icon {
+    content: url(Images/resourceDocumentIcon.png);
 }
 
-body.attached #toolbar {
-    height: 34px;
-    border-top: 1px solid rgb(100, 100, 100);
-    cursor: default; /* overriden */
-    padding-left: 0;
+#audit-views {
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 200px;
+    bottom: 0;
+    overflow: auto;
 }
 
-/* Chrome theme overrides */
-
-body.platform-windows #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(242, 247, 253)), to(rgb(223, 234, 248)));
+.audit-launcher-view {
+    z-index: 1000;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: white;
+    font-size: 13px;
+    overflow-x: hidden;
+    overflow-y: overlay;
+    display: none;
 }
 
-body.platform-windows.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(248, 248, 248)), to(rgb(237, 237, 237)));
+.audit-launcher-view.visible {
+    display: block;
 }
 
-body.detached.platform-mac-leopard #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important;
+.audit-launcher-view .audit-launcher-view-content {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    padding: 0 0 0 16px;
+    white-space: nowrap;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
 }
 
-body.detached.platform-mac-leopard.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important;
+.audit-launcher-view h1 {
+    color: rgb(110, 116, 128);
+    font-size: 16px;
+    line-height: 20px;
+    font-weight: normal;
+    padding-top: 15px;
 }
 
-body.detached.platform-mac-snowleopard #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(151, 151, 151))) !important;
+.audit-launcher-view h1.no-audits {
+    text-align: center;
+    font-style: italic;
+    position: relative;
+    left: -8px;
 }
 
-body.detached.platform-mac-snowleopard.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(215, 215, 215)), to(rgb(207, 207, 207))) !important;
+.audit-launcher-view div.button-container {
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    width: 100%;
+    padding: 16px 0;
+}
+.audit-launcher-view .flexible-space {
+    -webkit-box-flex: 1;
 }
 
-/* Heap Profiler Styles */
-
-.heap-snapshot-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/focusButtonGlyph.png);
+.audit-launcher-view div.audit-categories-container {
+    position: relative;
+    top: 11px;
+    left: 0;
+    width: 100%;
+    overflow-y: auto;
 }
 
+.audit-launcher-view button {
+    color: rgb(6, 6, 6);
+    background-color: transparent;
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+}
+
+.audit-launcher-view button {
+    font-size: 13px;
+    padding: 3px 20px;
+    height: 24px;
+    margin: 0 5px 0 0;
+}
+
+.audit-launcher-view button:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+body.inactive .audit-launcher-view button, .audit-launcher-view button:disabled {
+    color: rgb(130, 130, 130);
+    border-color: rgb(212, 212, 212);
+    background-color: rgb(239, 239, 239);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
+}
+
+.audit-launcher-view label {
+    position: relative;
+    display: block;
+    text-align: left;
+    word-break: break-word;
+    padding: 0 0 5px 0;
+}
+
+.audit-launcher-view label.disabled {
+    color: rgb(130, 130, 130);
+}
+
+.audit-launcher-view input[type="checkbox"] {
+    margin-left: 0;
+}
+
+.audit-launcher-view input[type="radio"] {
+    height: 17px;
+    width: 17px;
+    border: 1px solid rgb(165, 165, 165);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 8px;
+    -webkit-appearance: none;
+    vertical-align: middle;
+    margin: 0 5px 5px 0;
+}
+
+.audit-launcher-view input[type="radio"]:active:not(:disabled) {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+.audit-launcher-view input[type="radio"]:checked:not(:disabled), .audit-launcher-view input[type="radio"]:checked:disabled {
+    background: url(Images/radioDot.png) center no-repeat,
+                -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+}
+
+.audit-launcher-view .resource-progress > img {
+    content: url(Images/spinner.gif);
+    vertical-align: text-top;
+    margin: 0 4px 0 8px;
+}
+
+.audit-result-view {
+    overflow: auto;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    display: none;
+}
+
+.audit-result-view.visible {
+    display: block;
+}
+
+.audit-result-view .severity-severe {
+    content: url(Images/errorRedDot.png);
+}
+
+.audit-result-view .severity-warning {
+    content: url(Images/warningOrangeDot.png);
+}
+
+.audit-result-view .severity-info {
+    content: url(Images/successGreenDot.png);
+}
+
+.audit-result-tree li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 1px;
+    padding-right: 2px;
+}
+
+.audit-result-tree {
+    font-size: 11px;
+    line-height: 14px;
+    -webkit-user-select: text;
+}
+
+.audit-result-tree > ol {
+    position: relative;
+    padding: 2px 6px !important;
+    margin: 0;
+    color: rgb(84, 84, 84);
+    cursor: default;
+    min-width: 100%;
+}
+
+.audit-result-tree, .audit-result-tree ol {
+    list-style-type: none;
+    -webkit-padding-start: 12px;
+    margin: 0;
+}
+
+.audit-result-tree li {
+    padding: 0 0 0 14px;
+    margin-top: 1px;
+    margin-bottom: 1px;
+    word-wrap: break-word;
+    text-indent: -2px;
+}
+
+.audit-result-tree li.parent {
+    text-indent: -12px
+}
+
+.audit-result-tree li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 0;
+    padding-right: 2px;
+}
+
+.audit-result-tree li.parent.expanded::before {
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+.audit-result-tree ol.children {
+    display: none;
+}
+
+.audit-result-tree ol.children.expanded {
+    display: block;
+}
+
+.audit-result {
+    font-weight: bold;
+    color: black;
+}
+
+.audit-result img {
+    float: left;
+    margin-left: -40px;
+    margin-top: -1px;
+}
+
+/* goToLineDialog.css */
+
+.go-to-line-dialog {
+    position: absolute;
+    top: 40%;
+    left: 40%;
+    z-index: 1900;
+
+    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#E9E9E9), to(#CFCFCF));
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    padding: 10px;
+    border-radius: 10px;
+    border: 1px solid gray;
+    -webkit-box-shadow: rgb(40,40,40) 0px 0px 50px;
+
+    font-size: 11px;
+    font-family: 'Lucida Grande', sans-serif;
+}
+
+.go-to-line-dialog input {
+    font-size: 11px;
+}
+
+.go-to-line-dialog button {
+    font-size: 11px;
+    color: rgb(6, 6, 6);
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+
+    padding: 3px 20px;
+    margin: 0 0 0 10px;
+}
+
+.go-to-line-dialog button:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+/* heapProfiler.css */
+
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 .heap-snapshot-sidebar-tree-item .icon {
     content: url(Images/profileIcon.png);
 }
@@ -151,77 +463,5892 @@
     left: 25%;
 }
 
-body.platform-windows .section > .header {
-    border: 1px solid rgb(92, 116, 157);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(105, 133, 180)), to(rgb(92, 116, 157)));
+/* inspector.css */
+
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+html {
+    height: 100%;
 }
 
-body.platform-windows .console-group-messages .section > .header {
+body {
+    cursor: default;
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow: hidden;
+    font-family: Lucida Grande, sans-serif;
+    font-size: 10px;
+    margin: 0;
+    -webkit-text-size-adjust: none;
+    -webkit-user-select: none;
+}
+
+* {
+    -webkit-box-sizing: border-box;
+}
+
+:focus {
+    outline: none;
+}
+
+input[type="search"]:focus, input[type="text"]:focus {
+    outline: auto 5px -webkit-focus-ring-color;
+}
+
+iframe, a img {
+    border: none;
+}
+
+img {
+    -webkit-user-drag: none;
+}
+
+.hidden {
+    display: none !important;
+}
+
+#toolbar {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 56px;
+    display: -webkit-box;
+    padding: 0 5px;
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
+    border-bottom: 1px solid rgb(80, 80, 80);
+    -webkit-box-orient: horizontal;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+body.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(207, 207, 207)));
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.detached.platform-mac-leopard #toolbar,
+body.detached.platform-mac-snowleopard #toolbar {
+    background: transparent !important;
+}
+
+body.attached #toolbar {
+    height: 34px;
+    border-top: 1px solid rgb(100, 100, 100);
+    cursor: row-resize;
+    padding-left: 0;
+}
+
+body.attached.port-qt #toolbar {
+    cursor: auto;
+}
+
+body.attached.inactive #toolbar {
+    border-top: 1px solid rgb(64%, 64%, 64%);
+}
+
+.toolbar-item {
+    display: -webkit-box;
+    padding: 4px 6px;
+    margin: 0;
+    background-color: transparent;
+    border-style: none;
+    border-color: transparent;
+    -webkit-box-orient: vertical;
+    -webkit-box-align: center;
+    -webkit-box-pack: end;
+}
+
+.toolbar-item.toggleable.toggled-on {
+    border-width: 0 2px 0 2px;
+    padding: 4px 4px;
+    -webkit-border-image: url(Images/toolbarItemSelected.png) 0 2 0 2;
+}
+
+.toolbar-item.flexable-space {
+    -webkit-box-flex: 1;
+    visibility: hidden;
+}
+
+.toolbar-item input {
+    margin-bottom: 8px;
+}
+
+.toolbar-icon {
+    display: inline-block;
+    width: 32px;
+    height: 32px;
+    -webkit-background-size: 100% auto;
+}
+
+body.attached .toolbar-icon {
+    width: 24px;
+    height: 24px;
+    vertical-align: middle;
+}
+
+.toolbar-item:active .toolbar-icon {
+    background-position: 0 32px;
+}
+
+body.attached .toolbar-item:active .toolbar-icon {
+    background-position: 0 24px;
+}
+
+.toolbar-label {
+    font-size: 11px;
+    font-family: Lucida Grande, sans-serif;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+}
+
+.toolbar-item.toggleable:active .toolbar-label {
+    text-shadow: none;
+}
+
+body.attached .toolbar-label {
+    display: inline-block;
+    vertical-align: middle;
+    margin-left: 3px;
+}
+
+body.attached #search-toolbar-label {
+    display: none;
+}
+
+#search {
+    width: 205px;
+    font-size: 16px;
+    margin-bottom: 5px;
+}
+
+body.attached #search {
+    font-size: 11px;
+    margin-bottom: 8px;
+}
+
+#search-results-matches {
+    font-size: 11px;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    margin-bottom: 22px;
+}
+
+body.attached #search-results-matches {
+    margin-bottom: 6px;
+}
+
+.toolbar-item.elements .toolbar-icon {
+    background-image: url(Images/elementsIcon.png);
+}
+
+.toolbar-item.resources .toolbar-icon {
+    background-image: url(Images/resourcesIcon.png);
+}
+
+.toolbar-item.network .toolbar-icon {
+    background-image: url(Images/networkIcon.png);
+}
+
+.toolbar-item.scripts .toolbar-icon {
+    background-image: url(Images/scriptsIcon.png);
+}
+
+.toolbar-item.timeline .toolbar-icon {
+    background-image: url(Images/timelineIcon.png);
+}
+
+.toolbar-item.profiles .toolbar-icon {
+    background-image: url(Images/profilesIcon.png);
+}
+
+.toolbar-item.audits .toolbar-icon {
+    background-image: url(Images/auditsIcon.png);
+}
+
+.toolbar-item.console .toolbar-icon {
+    background-image: url(Images/consoleIcon.png);
+}
+
+#close-button-left, #close-button-right {
+    width: 14px;
+    height: 14px;
+    background-image: url(Images/closeButtons.png);
+    background-position: 0 0;
+    background-color: transparent;
+    border: 0 none transparent;
+    margin: 5px 0;
+}
+
+#close-button-left:hover, #close-button-right:hover {
+    background-position: 14px 0;
+}
+
+#close-button-left:active, #close-button-right:active {
+    background-position: 28px 0;
+}
+
+body.detached .toolbar-item.close-left, body.detached .toolbar-item.close-right {
+    display: none;
+}
+
+body.attached.port-qt .toolbar-item.close-left, body.attached.port-qt .toolbar-item.close-right {
+    display: none;
+}
+
+body.platform-mac .toolbar-item.close-right {
+    display: none;
+}
+
+body:not(.platform-mac) .toolbar-item.close-left {
+    display: none;
+}
+
+#main {
+    position: absolute;
+    z-index: 1;
+    top: 56px;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    overflow: hidden;
+    background-color: white;
+}
+
+body.attached #main {
+    top: 34px;
+}
+
+#main-panels {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 23px;
+    overflow: hidden;
+}
+
+#main-status-bar {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+body.drawer-visible #main-status-bar {
+    height: 24px;
+    background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackground.png);
+    background-repeat: no-repeat, repeat-x;
+    background-position: right center, center;
+    cursor: row-resize;
+}
+
+body.drawer-visible #main-status-bar * {
+    cursor: default;
+}
+
+body.drawer-visible #main-panels {
+    bottom: 24px;
+}
+
+.status-bar {
+    background-color: rgb(235, 235, 235);
+    background-image: url(Images/statusbarBackground.png);
+    background-repeat: repeat-x;
+    white-space: nowrap;
+    height: 23px;
+    overflow: hidden;
+    z-index: 12;
+}
+
+.status-bar > div {
+    display: inline-block;
+    vertical-align: top;
+}
+
+.status-bar-item {
+    display: inline-block;
+    height: 24px;
+    padding: 0;
+    margin-left: -1px;
+    margin-right: 0;
+    vertical-align: top;
+    border: 0 transparent none;
+    background-color: transparent;
+}
+
+.status-bar-item:active {
+    position: relative;
+    z-index: 200;
+}
+
+.glyph {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: rgba(0, 0, 0, 0.75);
+    z-index: 1;
+}
+
+.glyph.shadow {
+    top: 1px;
+    background-color: white !important;
+    z-index: 0;
+}
+
+button.status-bar-item {
+    position: relative;
+    width: 32px;
+    background-image: url(Images/statusbarButtons.png);
+    background-position: 0 0;
+}
+
+button.status-bar-item:active {
+    background-position: 32px 0 !important;
+}
+
+button.status-bar-item .glyph.shadow {
+    background-color: rgba(255, 255, 255, 0.33) !important;
+}
+
+button.status-bar-item.toggled-on .glyph {
+    background-color: rgb(66, 129, 235);
+}
+
+button.status-bar-item.toggled-1 .glyph {
+    background-color: rgb(66, 129, 235);
+}
+
+button.status-bar-item.toggled-2 .glyph {
+    background-color: purple;   
+}
+
+button.status-bar-item:disabled {
+    opacity: 0.5;
+    background-position: 0 0 !important;
+}
+
+select.status-bar-item {
+    min-width: 48px;
+    border-width: 0 17px 0 2px;
+    padding: 0 2px 0 6px;
+    font-weight: bold;
+    color: rgb(48, 48, 48);
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+    -webkit-border-image: url(Images/statusbarMenuButton.png) 0 17 0 2;
+    -webkit-border-radius: 0;
+    -webkit-appearance: none;
+}
+
+select.status-bar-item:active {
+    color: black;
+    -webkit-border-image: url(Images/statusbarMenuButtonSelected.png) 0 17 0 2;
+}
+
+#dock-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/undockButtonGlyph.png);
+}
+
+body.detached #dock-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/dockButtonGlyph.png);
+}
+
+body.port-qt #dock-status-bar-item {
+    display: none
+}
+
+#console-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/consoleButtonGlyph.png);
+}
+
+.clear-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);
+}
+
+#changes-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/consoleButtonGlyph.png); /* TODO: Needs Image for Changes Toggle Button */
+}
+
+#counters {
+    position: absolute;
+    right: 16px;
+    top: 0;
+    cursor: pointer;
+    padding: 6px 2px 6px 0px;
+    font-size: 10px;
+    height: 19px;
+}
+
+#changes-count, #error-warning-count {
+    display: inline;
+}
+
+#error-warning-count:hover, #changes-count:hover {
+    border-bottom: 1px solid rgb(96, 96, 96);
+}
+
+#style-changes-count::before {
+    content: url(Images/styleIcon.png); /* TODO: Needs Image for Style Changes Icon */
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+
+#error-count::before {
+    content: url(Images/errorIcon.png);
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+    
+#changes-count + #error-warning-count, #error-count + #warning-count {
+    margin-left: 6px;
+}
+
+#warning-count::before {
+    content: url(Images/warningIcon.png);
+    width: 10px;
+    height: 10px;
+    vertical-align: -1px;
+    margin-right: 2px;
+}
+
+#drawer {
+    display: none;
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    height: 200px;
+    background-color: white;
+    background-image: url(Images/statusbarBottomBackground.png);
+    background-repeat: repeat-x;
+    background-position: bottom;
+}
+
+body.drawer-visible #drawer {
+    display: block;
+}
+
+#drawer-status-bar {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    background: none;
+}
+
+.monospace {
+    font-size: 10px !important;
+    font-family: monospace;
+}
+
+body.platform-mac .monospace, body.platform-mac .source-code {
+    font-family: Monaco, monospace;
+}
+
+/* Keep .platform-mac to make the rule more specific than the general one above. */
+body.platform-mac.platform-mac-snowleopard .monospace,
+body.platform-mac.platform-mac-snowleopard .source-code {
+    font-size: 11px !important;
+    font-family: Menlo, monospace;
+}
+
+body.platform-windows .monospace, body.platform-windows .source-code {
+    font-size: 12px !important;
+    font-family: Consolas, Lucida Console, monospace;
+}
+
+body.platform-linux .monospace, body.platform-linux .source-code {
+    font-size: 11px !important;
+    font-family: dejavu sans mono, monospace;
+}
+
+#console-messages {
+    position: absolute;
+    z-index: 0;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 23px;
+    padding: 2px 0;
+    overflow-y: overlay;
+    word-wrap: break-word;
+    -webkit-user-select: text;
+    -webkit-text-size-adjust: auto;
+}
+
+#console-prompt {
+    position: relative;
+    padding: 1px 22px 1px 24px;
+    min-height: 16px; 
+    white-space: pre-wrap;
+    -webkit-user-modify: read-write-plaintext-only;
+}
+
+#console-prompt::before {
+    background-image: url(Images/userInputIcon.png);
+}
+
+.console-user-command-result.console-log-level::before {
+    background-image: url(Images/userInputResultIcon.png);
+}
+
+.console-message, .console-user-command {
+    position: relative;
+    border-bottom: 1px solid rgb(240, 240, 240);
+    padding: 1px 22px 1px 24px;
+    min-height: 16px;
+}
+
+.console-adjacent-user-command-result {
+    border-bottom: none;
+}
+
+.console-adjacent-user-command-result + .console-user-command-result.console-log-level::before {
+    background-image: none;
+}
+
+.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
+    position: absolute;
+    display: block;
+    content: "";
+    left: 7px;
+    top: 0.8em;
+    width: 10px;
+    height: 10px;
+    margin-top: -5px;
+    -webkit-user-select: none;
+}
+
+.console-message .bubble {
+    display: inline-block;
+    height: 14px;
+    background-color: rgb(128, 151, 189);
+    vertical-align: middle;
+    white-space: nowrap;
+    padding: 1px 4px;
+    margin-top: -2px;
+    margin-right: 4px;
+    text-align: left;
+    font-size: 11px;
+    line-height: normal;
+    font-family: Helvetica, Arial, sans-serif;
+    font-weight: bold;
+    text-shadow: none;
+    color: white;
+    -webkit-border-radius: 7px;
+}
+
+.console-message-text {
+    white-space: pre-wrap;
+}
+
+.repeated-message {
+    padding-left: 6px;
+}
+
+.repeated-message.console-error-level::before, .repeated-message.console-warning-level:before, .repeated-message.console-debug-level:before {
+    visibility: hidden;
+}
+
+.console-group .console-group > .console-group-messages {
+    margin-left: 16px;
+}
+
+.console-group-title {
+    font-weight: bold;
+}
+
+.console-group-title::before {
+    background-image: url(Images/disclosureTriangleSmallDown.png);
+    top: 0.6em;
+    width: 11px;
+    height: 12px;
+}
+
+.console-group.collapsed .console-group-title::before {
+    background-image: url(Images/disclosureTriangleSmallRight.png);
+}
+
+.console-group.collapsed > .console-group-messages {
+    display: none;
+}
+
+.console-error-level .console-message-text {
+    color: red;
+}
+
+.console-debug-level .console-message-text {
+    color: blue;
+}
+
+.console-debug-level::before {
+    background-image: url(Images/searchSmallBrightBlue.png);
+}
+
+.console-error-level::before {
+    background-image: url(Images/errorIcon.png);
+}
+
+.console-warning-level::before {
+    background-image: url(Images/warningIcon.png);
+}
+
+.console-user-command .console-message {
+    margin-left: -24px;
+    padding-right: 0;
+    border-bottom: none;
+}
+
+.console-user-command::before {
+    background-image: url(Images/userInputPreviousIcon.png);
+}
+
+.console-user-command > .console-message-text {
+    color: rgb(0, 128, 255);
+}
+
+#console-messages a {
+    color: rgb(33%, 33%, 33%);
+    cursor: pointer;
+}
+
+#console-messages a:hover {
+    color: rgb(15%, 15%, 15%);
+}
+
+.console-message-url {
+    float: right;
+}
+
+.console-group-messages .section {
+    margin: 0 0 0 12px !important;
+}
+
+.console-group-messages .section .header {
     padding: 0 8px 0 0;
     background-image: none;
     border: none;
     min-height: 0;
 }
 
-body.platform-windows #resources-filter {
+.console-group-messages .section .header::before {
+    position: absolute;
+    top: 1px;
+    left: 1px;
+    width: 8px;
+    height: 8px;
+    content: url(Images/treeRightTriangleBlack.png);
+}
+
+.console-group-messages .section.expanded .header::before {
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+.console-group-messages .section .header .title {
+    color: black;
+    font-weight: normal;
+}
+
+.console-group-messages .section .properties li .info {
+    padding-top: 0;
+    padding-bottom: 0;
+    color: rgb(60%, 60%, 60%);
+}
+
+.console-group-messages .outline-disclosure {
+    padding-left: 0;
+}
+
+.console-group-messages .outline-disclosure > ol {
+    padding: 0 0 0 12px !important;
+}
+
+.console-group-messages .outline-disclosure, .console-group-messages .outline-disclosure ol {
+    font-size: inherit;
+    line-height: 12px;
+}
+
+.console-group-messages .outline-disclosure.single-node li {
+    padding-left: 2px;
+}
+
+.console-group-messages .outline-disclosure li .selection {
+    margin-left: -6px;
+    margin-right: -6px;
+}
+
+.console-group-messages .add-attribute {
+    display: none;
+}
+
+.console-formatted-object, .console-formatted-node {
+    position: relative;
+    display: inline-block;
+    vertical-align: top;
+}
+
+.console-formatted-object .section, .console-formatted-node .section {
+    position: static;
+}
+
+.console-formatted-object .properties, .console-formatted-node .properties {
+    padding-left: 0 !important;
+}
+
+.console-formatted-number {
+    color: rgb(28, 0, 207);
+}
+
+.console-formatted-string, .console-formatted-regexp {
+    color: rgb(196, 26, 22);
+}
+
+.console-formatted-null, .console-formatted-undefined {
+    color: rgb(128, 128, 128);
+}
+
+.error-message {
+    color: red;
+}
+
+.auto-complete-text {
+    color: rgb(128, 128, 128);
+    -webkit-user-select: none;
+    -webkit-user-modify: read-only;
+}
+
+.panel {
+    display: none;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.panel.visible {
+    display: block;
+}
+
+.webkit-line-gutter-backdrop {
+    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
+    width: 31px;
+    background-color: rgb(240, 240, 240);
+    border-right: 1px solid rgb(187, 187, 187);
+    position: absolute;
+    z-index: -1;
+    left: 0;
+    top: 0;
+    height: 100%
+}
+
+.resource-view {
+    display: none;
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 0;
+    bottom: 0;
+    overflow: auto;
+}
+
+.resource-view.visible {
+    display: block;
+}
+
+.resource-view.font {
+    font-size: 60px;
+    white-space: pre-wrap;
+    word-wrap: break-word;
+    text-align: center;
+    padding: 15px;
+}
+
+.resource-view.image > .image {
+    padding: 20px 20px 10px 20px;
+    text-align: center;
+}
+
+.resource-view.image > .info {
+    padding-bottom: 10px;
+    font-size: 11px;
+    -webkit-user-select: text;
+}
+
+.resource-view.image img.resource-image-view {
+    max-width: 100%;
+    max-height: 1000px;
+    background-image: url(Images/checker.png);
+    -webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);
+    -webkit-user-select: text;
+    -webkit-user-drag: auto;
+}
+
+.resource-url {
+    vertical-align: middle;
+}
+
+.resource-status-image {
+    margin-top: -3px;
+    vertical-align: middle;
+}
+
+.resource-view.image .title {
+    text-align: center;
+    font-size: 13px;
+}
+
+.resource-view.image .infoList {
+    margin: 0;
+}
+
+.resource-view.image .infoList dt {
+    font-weight: bold;
+    display: inline-block;
+    width: 50%;
+    text-align: right;
+    color: rgb(76, 76, 76);
+}
+
+.resource-view.image .infoList dd {
+    display: inline-block;
+    padding-left: 8px;
+    width: 50%;
+    text-align: left;
+    margin: 0;
+}
+
+.resource-view.image .infoList dd::after {
+    white-space: pre;
+    content: "\A";
+}
+
+.resource-timing-row {
+    position: relative;
+    height: 12px;
+}
+
+.resource-timing-bar {
+    position: absolute;
+    background-color: red;
+    border-left: 1px solid red;
+    opacity: 0.4;
+}
+
+.resource-timing-bar-title {
+    position: absolute;
+}
+
+#elements-content {
+    display: block;
+    overflow: auto;
+    padding: 0;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 325px;
+    bottom: 0;
+}
+
+#elements-sidebar {
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    width: 325px;
+    border-left: 1px solid rgb(64%, 64%, 64%);
+    cursor: default;
+    overflow: auto;
+}
+
+.crumbs {
+    display: inline-block;
+    font-size: 11px;
+    line-height: 19px;
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+    color: rgb(20, 20, 20);
+    margin-left: -1px;
+    padding-right: 12px;
+}
+
+.crumbs .crumb {
+    height: 24px;
+    border-width: 0 12px 0 2px;
+    -webkit-border-image: url(Images/segment.png) 0 12 0 2;
+    margin-right: -12px;
+    padding-left: 18px;
+    padding-right: 2px;
+    white-space: nowrap;
+    line-height: 23px;
+    float: right;
+}
+
+.crumbs .crumb.collapsed > * {
+    display: none;
+}
+
+.crumbs .crumb.collapsed::before {
+    content: "\2026";
+    font-weight: bold;
+}
+
+.crumbs .crumb.compact .extra {
+    display: none;
+}
+
+.crumbs .crumb.dimmed {
+    color: rgba(0, 0, 0, 0.45);
+}
+
+.crumbs .crumb.start {
+    padding-left: 7px;
+}
+
+.crumbs .crumb.end {
+    border-width: 0 2px 0 2px;
+    padding-right: 6px;
+    -webkit-border-image: url(Images/segmentEnd.png) 0 2 0 2;
+}
+
+.crumbs .crumb.selected {
+    -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
+    color: black;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+}
+
+.crumbs .crumb.selected:hover {
+    -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
+}
+
+.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
+    -webkit-border-image: url(Images/segmentSelectedEnd.png) 0 2 0 2;
+}
+
+.crumbs .crumb:hover {
+    -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
+    color: black;
+}
+
+.crumbs .crumb.dimmed:hover {
+    -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
+    color: rgba(0, 0, 0, 0.75);
+}
+
+.crumbs .crumb.end:hover {
+    -webkit-border-image: url(Images/segmentHoverEnd.png) 0 2 0 2;
+}
+
+.outline-disclosure li.hovered:not(.selected) .selection {
+    display: block;
+    left: 3px;
+    right: 3px;
+    background-color: rgba(56, 121, 217, 0.1);
+    -webkit-border-radius: 5px;
+}
+
+.outline-disclosure li.highlighted .highlight {
+    background-color: rgb(255, 230, 179);
+    -webkit-border-radius: 4px;
+    padding-bottom: 2px;
+    margin-bottom: -2px;
+}
+
+.outline-disclosure li.selected.highlighted .highlight {
+    background-color: transparent;
+    padding-bottom: 0;
+    margin-bottom: 0;
+}
+
+.outline-disclosure li .selection {
+    display: none;
+    position: absolute;
+    left: 0;
+    right: 0;
+    height: 15px;
+    z-index: -1;
+}
+
+.outline-disclosure li.selected .selection {
+    display: block;
+    background-color: rgb(212, 212, 212);
+}
+
+.outline-disclosure ol:focus li.selected .selection {
+    background-color: rgb(56, 121, 217);
+}
+
+.outline-disclosure {
+    font-size: 11px;
+}
+
+.outline-disclosure > ol {
+    position: relative;
+    padding: 2px 6px !important;
+    margin: 0;
+    color: black;
+    cursor: default;
+    min-width: 100%;
+}
+
+.outline-disclosure, .outline-disclosure ol {
+    list-style-type: none;
+    -webkit-padding-start: 12px;
+    margin: 0;
+}
+
+.source-code {
+    font-family: monospace;
+    font-size: 10px !important;
+    white-space: pre-wrap;
+}
+
+.outline-disclosure li {
+    padding: 0 0 0 14px;
+    margin-top: 1px;
+    margin-bottom: 1px;
+    word-wrap: break-word;
+    text-indent: -2px;
+}
+
+.resources .outline-disclosure li {
+    text-indent: -1px;
+}
+
+.outline-disclosure ol:focus li.selected {
+    color: white;
+}
+
+.outline-disclosure ol:focus li.selected * {
+    color: inherit;
+}
+
+.outline-disclosure li.parent {
+    text-indent: -12px
+}
+
+.outline-disclosure li .webkit-html-tag.close {
+    margin-left: -12px;
+}
+
+.outline-disclosure li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 1px;
+    padding-right: 2px;
+}
+
+.outline-disclosure li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+}
+
+.outline-disclosure ol:focus li.parent.selected::before {
+    content: url(Images/treeRightTriangleWhite.png);
+}
+
+.outline-disclosure li.parent.expanded::before {
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+.outline-disclosure ol:focus li.parent.expanded.selected::before {
+    content: url(Images/treeDownTriangleWhite.png);
+}
+
+.outline-disclosure ol.children {
+    display: none;
+}
+
+.outline-disclosure ol.children.expanded {
+    display: block;
+}
+
+.add-attribute {
+    margin-left: 1px;
+    margin-right: 1px;
+    white-space: nowrap;
+}
+
+.placard {
+    position: relative;
+    margin-top: 1px;
+    padding: 3px 8px 4px 18px;
+    min-height: 18px;
+    white-space: nowrap;
+}
+
+.placard:nth-of-type(2n) {
+    background-color: rgb(234, 243, 255);
+}
+
+.placard.selected {
+    border-top: 1px solid rgb(145, 160, 192);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+:focus .placard.selected {
+    border-top: 1px solid rgb(68, 128, 200);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
+}
+
+body.inactive .placard.selected {
+    border-top: 1px solid rgb(151, 151, 151);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
+}
+
+.placard .title {
+    color: black;
+    font-weight: normal;
+    word-wrap: break-word;
+    white-space: normal;
+}
+
+.placard.selected .title {
+    color: white;
+    font-weight: bold;
+}
+
+.placard .subtitle {
+    float: right;
+    font-size: 10px;
+    margin-left: 5px;
+    max-width: 55%;
+    color: rgba(0, 0, 0, 0.7);
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.placard.selected .subtitle {
+    color: rgba(255, 255, 255, 0.7);
+}
+
+.placard .subtitle a {
+    color: inherit;
+}
+
+.section {
+    position: relative;
+    margin-top: 1px;
+}
+
+.watch-expressions-buttons-container {
+    text-align: center;
+}
+
+.events-pane .section:not(:nth-of-type(1)) {
+    border-top: 1px solid rgb(191, 191, 191);
+}
+
+.event-bar:first-child {
+    margin-top: 1px;
+}
+
+.section .header {
+    color: black;
+    padding: 0 8px 0 18px;
+    min-height: 18px;
+    white-space: nowrap;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.section .header::before {
+    position: absolute;
+    top: 2px;
+    left: 7px;
+    width: 8px;
+    height: 8px;
+    content: url(Images/treeRightTriangleBlack.png);
+    opacity: 0.8;
+}
+
+.section.expanded .header::before {
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+.section .header .title, .event-bar .header .title {
+    font-weight: normal;
+    word-wrap: break-word;
+    white-space: normal;
+    line-height: 18px;
+}
+
+.section .header .title.blank-title {
+    font-style: italic;
+}
+
+.section .header label, .event-bar .header label {
+    display: none;
+}
+
+.section.expanded .header label, .event-bar.expanded .header label {
+    display: inline;
+}
+
+.section .header .subtitle, .event-bar .header .subtitle {
+    float: right;
+    margin-left: 5px;
+    max-width: 55%;
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.section .header .subtitle a {
+    color: inherit;
+}
+
+.section .properties, .event-bar .event-properties {
+    display: none;
+}
+
+.section.expanded .properties, .event-bar.expanded .event-properties {
+    display: block;
+    padding-left: 16px;
+}
+
+.section.no-affect .properties li {
+    opacity: 0.5;
+}
+
+.section.no-affect .properties li.editing {
+    opacity: 1.0;
+}
+
+.properties-tree {
+    margin: 0;
+    padding: 0 6px 2px;
+    list-style: none;
+    min-height: 18px;
+}
+
+.properties-tree li {
+    margin-left: 12px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    -webkit-user-select: text;
+    cursor: auto;
+}
+
+.properties-tree li.parent {
+    margin-left: 1px;
+}
+
+.properties-tree li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    opacity: 0.75;
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 0;
+    padding-right: 3px;
+    -webkit-user-select: none;
+    cursor: default;
+}
+
+.properties-tree li.parent.expanded::before {
+    content: url(Images/treeDownTriangleBlack.png);
+    margin-top: 1px;
+}
+
+.properties-tree li .info {
+    padding-top: 4px;
+    padding-bottom: 3px;
+}
+
+.properties-tree ol {
+    display: none;
+    margin: 0;
+    -webkit-padding-start: 12px;
+    list-style: none;
+}
+
+.properties-tree ol.expanded {
+    display: block;
+}
+
+.event-listener-breakpoints .event-category {
+    font-size: 11px;
+    font-weight: bold;
+    color: rgb(96, 96, 96);
+    padding-top: 2px;
+}
+
+.event-listener-breakpoints.properties-tree .children li {
+    margin-left: 12px;
+    height: 16px;
+}
+
+.event-listener-breakpoints .checkbox-elem {
+    font-size: 10px;
+    float: left;
+    top: -2px;
+    position: relative;
+    left: -1px;
+}
+
+.section .event-bars {
+    display: none;
+}
+
+.section.expanded .event-bars {
+    display: block;
+}
+
+.event-bar {
+    position: relative;
+    margin-left: 10px;
+}
+
+.event-bars .event-bar .header {
+    padding: 0 8px 0 18px;
+    min-height: 16px;
+    opacity: 1.0;
+    white-space: nowrap;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.event-bars .event-bar .header .title {
+    font-weight: normal;
+    color: black;
+    text-shadow: white 0 1px 0; 
+}
+
+.event-bars .event-bar .header .subtitle {
+    color: rgba(90, 90, 90, 0.75);
+}
+
+.event-bars .event-bar .header::before {
+    position: absolute;
+    top: 2px;
+    left: 7px;
+    width: 8px;
+    height: 8px;
+    opacity: 0.75;
+    content: url(Images/treeRightTriangleBlack.png);
+}
+
+.event-bars .event-bar.expanded .header::before {
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+.editing {
+    -webkit-user-select: text;
+    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+    outline: 1px solid rgb(66%, 66%, 66%) !important;
+    background-color: white;
+    -webkit-user-modify: read-write-plaintext-only;
+    text-overflow: clip !important;
+    padding-left: 2px;
+    margin-left: -2px;
+    padding-right: 2px;
+    margin-right: -2px;
+    margin-bottom: -1px;
+    padding-bottom: 1px;
+    opacity: 1.0 !important;
+}
+
+.editing, .editing * {
+    color: black !important;
+    text-decoration: none !important;
+}
+
+.editing br {
+    display: none;
+}
+
+.elements-tree-editor {
+    -webkit-user-select: text;
+    -webkit-user-modify: read-write-plaintext-only;
+}
+
+.section .properties li.editing {
+    margin-left: 10px;
+    text-overflow: clip;
+}
+
+li.editing .swatch, li.editing .enabled-button,  li.editing-sub-part .delete-button {
+    display: none !important;
+}
+
+.watch-expressions > li.editing-sub-part .name {
+    display: block; 
+    width: 100%;
+}
+
+.watch-expressions > li.editing-sub-part .value, .watch-expressions > li.editing-sub-part .separator  {
+    display: none;
+}
+
+.watch-expressions-error-level {
+    color: red;
+}
+
+.section .properties li.editing-sub-part {
+    padding: 3px 6px 8px 18px;
+    margin: -3px -6px -8px -6px;
+    text-overflow: clip;
+}
+
+/* FIXME: need a better icon (comment in bug 27514) */
+.section .properties .delete-button {
+    width: 10px;
+    height: 10px;
+    background-image: url(Images/errorIcon.png);
+    background-position: 0 0;
+    background-color: transparent;
+    background-repeat: no-repeat;
+    border: 0 none transparent;
+}
+
+.section .properties .name, .event-properties .name {
+    color: rgb(136, 19, 145);
+}
+
+.section .properties .value.dimmed {
+    color: rgb(100, 100, 100);
+}
+
+.section .properties .value.error {
+    color: red;
+}
+
+.section .properties .number, .event-properties .number {
+    color: blue;
+}
+
+.section .properties .keyword, .event-properties .keyword {
+    color: rgb(136, 19, 79);
+}
+
+.section .properties .color, .event-properties .color {
+    color: rgb(118, 15, 21);
+}
+
+.swatch {
+    display: inline-block;
+    vertical-align: baseline;
+    margin-left: 1px;
+    margin-right: 2px;
+    margin-bottom: -1px;
+    width: 1em;
+    height: 1em;
+    border: 1px solid rgba(128, 128, 128, 0.6);
+}
+
+.swatch:hover {
+    border: 1px solid rgba(64, 64, 64, 0.8);
+}
+
+.pane:not(.expanded) + .pane, .pane:first-of-type {
+    margin-top: -1px;
+}
+
+.pane > .title {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), color-stop(0.05, rgb(243, 243, 243)), color-stop(0.05, rgb(230, 230, 230)), to(rgb(209, 209, 209)));
+    height: 20px;
+    padding: 0 5px;
+    border-top: 1px solid rgb(189, 189, 189);
+    border-bottom: 1px solid rgb(189, 189, 189);
+    font-weight: bold;
+    font-size: 12px;
+    line-height: 18px;
+    color: rgb(110, 110, 110);
+    text-shadow: white 0 1px 0;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.pane > .title:active {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(231, 231, 231)), color-stop(0.05, rgb(231, 231, 231)), color-stop(0.05, rgb(207, 207, 207)), to(rgb(186, 186, 186)));
+    border-top: 1px solid rgb(178, 178, 178);
+    border-bottom: 1px solid rgb(178, 178, 178);
+}
+
+.pane > .title::before {
+    content: url(Images/disclosureTriangleSmallRightBlack.png);
+    float: left;
+    width: 11px;
+    height: 12px;
+    margin-right: 2px;
+    margin-top: 1px;
+}
+
+.pane.expanded > .title::before {
+    content: url(Images/disclosureTriangleSmallDownBlack.png);
+}
+
+.pane > .title > select {
+    float: right;
+    width: 23px;
+    height: 17px;
+    color: transparent;
+    background-color: transparent;
+    border: none;
+    background-image: url(Images/paneSettingsButtons.png);
+    background-repeat: no-repeat;
+    margin: 1px 0 0 0;
+    padding: 0;
+    -webkit-border-radius: 0;
+    -webkit-appearance: none;
+}
+
+.pane > .title > select:hover {
+    background-position: -23px 0px;
+}
+
+.pane > .title > select:active {
+    background-position: -46px 0px;
+}
+
+.pane > .title > select > option, .pane > .title > select > hr {
+    color: black;
+}
+
+.pane > .title > button.add {
+    float: right;
+    width: 23px;
+    height: 17px;
+    color: transparent;
+    background-color: transparent;
+    border: none;
+    background-image: url(Images/paneAddButtons.png);
+    background-repeat: no-repeat;
+    margin: 1px 0 0 0;
+    padding: 0;
+    -webkit-border-radius: 0;
+    -webkit-appearance: none;
+}
+
+.pane > .title > button.add:hover {
+    background-position: -23px 0px;
+}
+
+.pane > .title > button.add:active {
+    background-position: -46px 0px;
+}
+
+.pane > .body {
+    position: relative;
+    display: none;
+    overflow-y: auto;
+    overflow-x: hidden;
+}
+
+.pane > .body .info {
+    text-align: center;
+    font-style: italic;
+    font-size: 10px;
+    padding: 6px;
+    color: black;
+}
+
+.pane > .body .placard + .info {
+    border-top: 1px solid rgb(189, 189, 189);
+    background-color: rgb(255, 255, 194);
+}
+
+.pane.expanded > .body, .pane.expanded > .growbar {
+    display: block;
+}
+
+.pane > .body .breakpoint-condition {
+    display: block;
+    margin-top: 4px;
+    margin-bottom: 4px;
+    margin-left: 25px;
+    margin-right: 10px;
+}
+
+.pane.expanded:nth-last-of-type(1) {
+    border-bottom: 1px solid rgb(189, 189, 189);
+}
+
+.pane > .growbar {
+    display: none;
+    background-image: url(Images/paneGrowHandleLine.png), url(Images/paneBottomGrow.png);
+    background-repeat: no-repeat, repeat-x;
+    background-position: center center, bottom;
+    height: 5px;
+}
+
+.sidebar-pane-subtitle {
+    position: absolute;
+    right: 0;
+    font-weight: normal;
+}
+
+body.platform-windows .sidebar-pane-subtitle {
+    padding-top: 1px;
+}
+
+.sidebar-pane-subtitle input, .section .header input[type=checkbox] {
+    font-size: inherit;
+    hight: 1em;
+    width: 1em;
+    margin-left: 0;
+    margin-top: 0;
+    margin-bottom: 0.25em;
+    vertical-align: bottom;
+}
+
+.metrics {
+    padding: 8px;
+    font-size: 10px;
+    text-align: center;
+    white-space: nowrap;
+}
+
+.metrics .label {
+    position: absolute;
+    margin-top: -10px;
+    font-size: 9px;
+    color: grey;
+    background-color: white;
+    margin-left: 3px;
+    padding-left: 2px;
+    padding-right: 2px;
+}
+
+.metrics .position {
+    border: 1px rgb(66%, 66%, 66%) dotted;
+    display: inline-block;
+    text-align: center;
+    padding: 3px;
+    margin: 3px;
+}
+
+.metrics .margin {
+    border: 1px dashed;
+    display: inline-block;
+    text-align: center;
+    vertical-align: middle;
+    padding: 3px;
+    margin: 3px;
+}
+
+.metrics .border {
+    border: 1px black solid;
+    display: inline-block;
+    text-align: center;
+    vertical-align: middle;
+    padding: 3px;
+    margin: 3px;
+}
+
+.metrics .padding {
+    border: 1px grey dashed;
+    display: inline-block;
+    text-align: center;
+    vertical-align: middle;
+    padding: 3px;
+    margin: 3px;
+}
+
+.metrics .content {
+    position: static;
+    border: 1px grey solid;
+    display: inline-block;
+    text-align: center;
+    vertical-align: middle;
+    padding: 3px;
+    margin: 3px;
+    min-width: 80px;
+    text-align: center;
+    overflow: visible;
+}
+
+.metrics .content span {
+    display: inline-block;
+}
+
+.metrics .editing {
+    position: relative;
+    z-index: 100;
+}
+
+.metrics .left {
+    display: inline-block;
+    vertical-align: middle;
+}
+
+.metrics .right {
+    display: inline-block;
+    vertical-align: middle;
+}
+
+.metrics .top {
+    display: inline-block;
+}
+
+.metrics .bottom {
+    display: inline-block;
+}
+
+.sidebar {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    width: 200px;
+    overflow-y: auto;
+    overflow-x: hidden;
+    background-color: rgb(214, 221, 229);
+    border-right: 1px solid rgb(64%, 64%, 64%);
+}
+
+body.inactive .sidebar {
+    background-color: rgb(232, 232, 232);
+}
+
+.frame-storage-tree-item .icon {
+    content: url(Images/frame.png);
+}
+
+.database-storage-tree-item .icon {
+    content: url(Images/database.png);
+}
+
+.database-table-storage-tree-item .icon {
+    content: url(Images/databaseTable.png);
+}
+
+.domstorage-storage-tree-item.local-storage .icon {
+    content: url(Images/localStorage.png);
+}
+
+.domstorage-storage-tree-item.session-storage .icon {
+    content: url(Images/sessionStorage.png);
+}
+
+.cookie-storage-tree-item .icon {
+    content: url(Images/cookie.png);
+}
+
+.application-cache-storage-tree-item .icon {
+    content: url(Images/applicationCache.png);
+}
+
+/* FIXME: Make separate png for file-system */
+.file-system-storage-tree-item .icon {
+    content: url(Images/applicationCache.png);
+}
+
+#storage-views {
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 200px;
+    bottom: 0;
+}
+
+.resources.panel .sidebar {
+    padding-left: 0;
+    z-index: 10;
+}
+
+.resources.panel .sidebar li {
+    height: 17px;
+    white-space: nowrap;
+    text-indent: 0;
+    margin-left: -2px;
+}
+
+.resources.panel .sidebar li.parent {
+    text-indent: 0;
+    margin-left: -12px;
+}
+
+.resources.panel .sidebar li.selected {
+    color: white;
+    text-shadow: rgba(0, 0, 0, 0.33) 0 1px 0;
+    font-weight: bold;
+}
+
+.resources.panel .sidebar li.selected .selection {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
+    border-top: 1px solid #979797;
+    height: 17px;
+}
+
+.resources.panel .sidebar :focus li.selected .selection {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
+    border-top: 1px solid rgb(68, 128, 200);
+}
+
+body.inactive .resources.panel .sidebar li.selected .selection {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
+    border-top: 1px solid rgb(151, 151, 151);
+}
+
+.resources.panel .sidebar .icon {
+    width: 16px;
+    height: 16px;
+    float: left;
+}
+
+.resources.panel .base-storage-tree-element-title {
+    overflow: hidden;
+    position: relative;
+    text-overflow: ellipsis;
+    padding-left: 2px;
+    top: 1px;
+}
+
+li.selected .base-storage-tree-element-subtitle {
+    color: white;
+}
+
+.base-storage-tree-element-subtitle {
+    padding-left: 2px;
+    color: rgb(80, 80, 80);
+    text-shadow: none;
+}
+
+.resources.panel .status {
+    float: right;
+    height: 16px;
+    margin-top: 1px;
+    margin-left: 4px;
+    line-height: 1em;
+}
+
+.resources.panel li .status .bubble {
+    height: 13px;
+    padding-top: 0;
+}
+
+.storage-view {
+    display: none;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.storage-view.visible {
+    display: block;
+}
+
+.storage-view {
+    overflow: hidden;
+}
+
+.storage-view .data-grid {
+    border: none;
+    height: 100%;
+}
+
+.storage-empty-view, .storage-view .storage-table-error {
+    position: absolute;
+    top: 0;
+    bottom: 25%;
+    left: 0;
+    right: 0;
+    font-size: 24px;
+    color: rgb(75%, 75%, 75%);
+    margin-top: auto;
+    margin-bottom: auto;
+    height: 50px;
+    line-height: 26px;
+    text-align: center;
+    font-weight: bold;
+    padding: 10px;
+    white-space: pre-wrap;
+}
+
+.storage-view .storage-table-error {
+    color: rgb(66%, 33%, 33%);
+}
+
+.data-grid {
+    position: relative;
+    border: 1px solid #aaa;
+}
+
+.data-grid .highlight {
+    background-color: rgb(255, 230, 179);
+}
+
+.data-grid tr.selected .highlight {
+    background-color: transparent;
+}
+
+.data-grid table {
+    table-layout: fixed;
+    border-spacing: 0;
+    border-collapse: collapse;
+    width: 100%;
+    font-size: 10px;
+    font-family: Lucida Grande, sans-serif;
+}
+
+.data-grid .data-container {
+    position: absolute;
+    top: 16px;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    padding-right: 14px;
+    overflow-x: hidden;
+    overflow-y: overlay;
+}
+
+.data-grid.inline .data-container {
+    position: static;
+}
+
+.data-grid th {
+    text-align: left;
+    background-image: url(Images/glossyHeader.png);
+    background-repeat: repeat-x;
+    border-right: 1px solid rgb(179, 179, 179);
+    border-bottom: 1px solid rgb(179, 179, 179);
+    height: 15px;
+    font-weight: normal;
+    vertical-align: middle;
+    padding: 0 4px;
+    white-space: nowrap;
+}
+
+.data-grid th.corner {
+    width: 15px;
+    border-right: 0 none transparent;
+}
+
+.data-grid tr.filler {
+    display: table-row !important;
+    height: auto !important;
+}
+
+.data-grid tr.filler td {
+    height: auto !important;
+    padding: 0 !important;
+}
+
+.data-grid table.data {
+    position: absolute;
+    left: 0;
+    top: 0;
+    right: 16px;
+    bottom: 0;
+    height: 100%;
+    border-top: 0 none transparent;
+    background-image: -webkit-gradient(linear, left top, left bottom, from(white), color-stop(0.5, white), color-stop(0.5, rgb(234, 243, 255)), to(rgb(234, 243, 255)));
+    -webkit-background-size: 1px 32px;
+}
+
+.data-grid.inline table.data {
+    position: static;
+}
+
+.data-grid table.data tr {
+    display: none;
+}
+
+.data-grid table.data tr.revealed {
+    display: table-row;
+}
+
+.data-grid td {
+    vertical-align: top;
+    height: 12px;
+    line-height: 12px;
+    padding: 2px 4px;
+    white-space: nowrap;
+    border-right: 1px solid #aaa;
+    -webkit-user-select: text;
+}
+
+.data-grid td > div, .data-grid th > div {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.data-grid .centered div {
+    text-align: center;
+}
+
+.data-grid .right div {
+    text-align: right;
+}
+
+.data-grid th.sortable div {
+    position: relative;
+}
+
+.data-grid th.sortable:active {
+    background-image: url(Images/glossyHeaderPressed.png);
+}
+
+.data-grid th.sort-ascending, .data-grid th.sort-descending {
+    border-right: 1px solid rgb(107, 140, 196);
+    border-bottom: 1px solid rgb(107, 140, 196);
+    background-image: url(Images/glossyHeaderSelected.png);
+    background-repeat: repeat-x;
+}
+
+.data-grid th.sortable.sort-ascending:active, .data-grid th.sortable.sort-descending:active {
+    background-image: url(Images/glossyHeaderSelectedPressed.png);
+}
+
+.data-grid th.sort-ascending > div::after {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: 0;
+    height: 12px;
+    margin-bottom: auto;
+    margin-top: auto;
+    width: 8px;
+    content: url(Images/treeUpTriangleBlack.png);
+}
+
+.data-grid th.sort-descending > div::after {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: 0;
+    height: 8px;
+    margin-bottom: auto;
+    margin-top: auto;
+    width: 8px;
+    content: url(Images/treeDownTriangleBlack.png);
+}
+
+body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-descending {
+    background-image: url(Images/glossyHeader.png);
+    border-right: 1px solid rgb(179, 179, 179);
+    border-bottom: 1px solid rgb(179, 179, 179);
+}
+
+.data-grid tr.parent td.disclosure::before {
+    float: left;
+    content: url(Images/treeRightTriangleBlack.png);
+    width: 8px;
+    height: 8px;
+    margin-right: 2px;
+    -webkit-user-select: none;
+}
+
+.data-grid tr.expanded td.disclosure::before {
+    content: url(Images/treeDownTriangleBlack.png);
+    width: 8px;
+    height: 8px;
+    margin-top: 1px;
+}
+
+.data-grid tr.selected {
+    background-color: rgb(212, 212, 212);
+    color: inherit;
+}
+
+.data-grid:focus tr.selected {
+    background-color: rgb(56, 121, 217);
+    color: white;
+}
+
+.data-grid:focus tr.parent.selected td.disclosure::before {
+    content: url(Images/treeRightTriangleWhite.png);
+}
+
+.data-grid:focus tr.expanded.selected td.disclosure::before {
+    content: url(Images/treeDownTriangleWhite.png);
+}
+
+.data-grid tr:not(.parent) td.disclosure {
+    text-indent: 10px;
+}
+
+.data-grid-resizer {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    width: 5px;
+    z-index: 500;
+    cursor: col-resize;
+}
+
+.storage-view.query {
+    padding: 2px 0;
+    overflow-y: overlay;
+    overflow-x: hidden;
+    -webkit-text-size-adjust: auto;
+}
+
+.database-query-prompt {
+    position: relative;
+    padding: 1px 22px 1px 24px;
+    min-height: 16px; 
+    white-space: pre-wrap;
+    -webkit-user-modify: read-write-plaintext-only;
+    -webkit-user-select: text;
+}
+
+.database-user-query::before, .database-query-prompt::before, .database-query-result::before {
+    position: absolute;
+    display: block;
+    content: "";
+    left: 7px;
+    top: 0.8em;
+    width: 10px;
+    height: 10px;
+    margin-top: -5px;
+    -webkit-user-select: none;
+}
+
+.database-query-prompt::before {
+    background-image: url(Images/userInputIcon.png);
+}
+
+.database-user-query {
+    position: relative;
+    border-bottom: 1px solid rgb(245, 245, 245);
+    padding: 1px 22px 1px 24px;
+    min-height: 16px; 
+}
+
+.database-user-query::before {
+    background-image: url(Images/userInputPreviousIcon.png);
+}
+
+.database-query-text {
+    color: rgb(0, 128, 255);
+    -webkit-user-select: text;
+}
+
+.database-query-result {
+    position: relative;
+    padding: 1px 22px 1px 24px;
+    min-height: 16px;
+    margin-left: -24px;
+    padding-right: 0;
+}
+
+.database-query-result.error {
+    color: red;
+    -webkit-user-select: text;
+}
+
+.database-query-result.error::before {
+    background-image: url(Images/errorIcon.png);
+}
+
+.panel-enabler-view {
+    z-index: 1000;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: white;
+    font-size: 13px;
+    text-align: center;
+    overflow-x: hidden;
+    overflow-y: overlay;
+    display: none;
+}
+
+.panel-enabler-view.visible {
+    display: block;
+}
+
+.panel-enabler-view .panel-enabler-view-content {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    max-height: 390px;
+    margin: auto;
+    white-space: nowrap;
+}
+
+.panel-enabler-view h1 {
+    color: rgb(110, 116, 128);
+    font-size: 16px;
+    line-height: 20px;
+    font-weight: normal;
+    margin-top: 0;
+}
+
+.panel-enabler-disclaimer {
+    font-size: 10px;
+    color: rgb(110, 116, 128);
+    margin-bottom: 12px;
+    margin-left: 20px;
+}
+
+.panel-enabler-disclaimer:empty {
+    display: none;
+}
+
+.panel-enabler-view img, div.welcome-instructions-aligner {
+    height: 100%;
+    min-height: 200px;
+    max-width: 100%;
+    top: 0;
+    bottom: 0;
+    padding: 20px 0 20px 20px;
+    margin: auto;
+    vertical-align: middle;
+}
+
+.panel-enabler-view img.hidden {
+    display: initial !important;
+    width: 0;
+}
+
+.panel-enabler-view form {
+    display: inline-block;
+    vertical-align: middle;
+    width: 330px;
+    margin: 0;
+    padding: 15px;
+    white-space: normal;
+}
+
+.panel-enabler-view label {
+    position: relative;
+    display: block;
+    text-align: left;
+    word-break: break-word;
+    margin: 0 0 5px 20px;
+}
+
+.panel-enabler-view button:not(.status-bar-item), .pane button, button.show-all-nodes {
+    color: rgb(6, 6, 6);
+    background-color: transparent;
+    border: 1px solid rgb(165, 165, 165);
+    background-color: rgb(237, 237, 237);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 12px;
+    -webkit-appearance: none;
+}
+
+.panel-enabler-view button:not(.status-bar-item) {
+    font-size: 13px;
+    margin: 6px 0 0 0;
+    padding: 3px 20px;
+    height: 24px;
+}
+
+button.show-all-nodes {
+    font-size: 13px;
+    margin: 0;
+    padding: 0 20px;
+    height: 20px;
+}
+
+.panel-enabler-view.welcome {
+    z-index: auto;
+}
+
+.panel-enabler-view.welcome div.welcome-instructions-aligner {
+    display: inline-block;
+    width: 0;
+}
+
+.panel-enabler-view.welcome .instructions {
+    display: inline-block;
+    vertical-align: middle;
+    margin: 0;
+    white-space: normal;
+    line-height: 175%;
+}
+
+.panel-enabler-view.welcome .message {
+    margin-bottom: 2ex;
+}
+
+.panel-enabler-view.welcome button.status-bar-item {
+    background-image: none;
+    vertical-align: top;
+}
+
+.pane button {
+    margin: 6px 0 6px 3px;
+    padding: 2px 9px;
+}
+
+.panel-enabler-view button:active:not(.status-bar-item), .pane button:active, button.show-all-nodes:active {
+    background-color: rgb(215, 215, 215);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+body.inactive .panel-enabler-view button:not(.status-bar-item), .panel-enabler-view button:disabled:not(.status-bar-item), body.inactive .pane button, .pane button:disabled, body.inactive button.show-all-nodes {
+    color: rgb(130, 130, 130);
+    border-color: rgb(212, 212, 212);
+    background-color: rgb(239, 239, 239);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
+}
+
+.panel-enabler-view input {
+    height: 17px;
+    width: 17px;
+    border: 1px solid rgb(165, 165, 165);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+    -webkit-border-radius: 8px;
+    -webkit-appearance: none;
+    vertical-align: middle;
+    margin: 0 5px 5px 0;
+}
+
+.panel-enabler-view input:active {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
+}
+
+.panel-enabler-view input:checked {
+    background: url(Images/radioDot.png) center no-repeat,
+                -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
+}
+
+.panel-enabler-view.scripts img {
+    content: url(Images/scriptsSilhouette.png);
+}
+
+.panel-enabler-view.profiles img {
+    content: url(Images/profilesSilhouette.png);
+}
+
+button.enable-toggle-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/enableOutlineButtonGlyph.png);
+}
+
+button.enable-toggle-status-bar-item.toggled-on .glyph {
+    -webkit-mask-image: url(Images/enableSolidButtonGlyph.png);
+}
+
+.scripts-pause-on-exceptions-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/pauseOnExceptionButtonGlyph.png);
+}
+
+#scripts-status-bar {
+    position: absolute;
+    top: -1px;
+    left: 0;
+    right: 0;
+    height: 24px;
+}
+
+#scripts-files {
+    max-width: 250px;
+}
+
+#scripts-files option.extension-script {
+    color: rgb(70, 134, 240);
+}
+
+#scripts-functions {
+    max-width: 150px;
+}
+
+#scripts-status-bar .status-bar-item img {
+    margin-top: 2px;
+}
+
+#scripts-back img {
+    content: url(Images/back.png);
+}
+
+#scripts-forward img {
+    content: url(Images/forward.png);
+}
+
+#scripts-pause img {
+    content: url(Images/debuggerPause.png);
+}
+
+#scripts-pause.paused img {
+    content: url(Images/debuggerContinue.png);
+}
+
+#scripts-step-over img {
+    content: url(Images/debuggerStepOver.png);
+}
+
+#scripts-step-into img {
+    content: url(Images/debuggerStepInto.png);
+}
+
+#scripts-step-out img {
+    content: url(Images/debuggerStepOut.png);
+}
+
+.toggle-breakpoints .glyph {
+    -webkit-mask-image: url(Images/breakpointsActivateButtonGlyph.png);
+    background-color: rgb(96, 96, 96) !important;
+}
+
+.toggle-breakpoints.toggled-on .glyph {
+    -webkit-mask-image: url(Images/breakpointsDeactivateButtonGlyph.png);
+}
+
+#scripts-debugger-status {
+    position: absolute;
+    line-height: 24px;
+    top: 0;
+    right: 8px;
+}
+
+#scripts-sidebar-resizer-widget {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: 225px;
+    width: 16px;
+    cursor: col-resize;
+    background-image: url(Images/statusbarResizerHorizontal.png);
+    background-repeat: no-repeat;
+    background-position: center;
+}
+
+#scripts-sidebar-buttons {
+    position: absolute;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    width: 225px;
+    overflow: hidden;
+    border-left: 1px solid rgb(64%, 64%, 64%);
+}
+
+#script-resource-views {
+    display: block;
+    padding: 0;
+    position: absolute;
+    top: 23px;
+    left: 0;
+    right: 225px;
+    bottom: 0;
+}
+
+.script-view {
+    display: none;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.script-view.visible {
+    display: block;
+}
+
+#scripts-sidebar {
+    position: absolute;
+    top: 23px;
+    right: 0;
+    bottom: 0;
+    width: 225px;
+    border-left: 1px solid rgb(64%, 64%, 64%);
+    cursor: default;
+    overflow: auto;
+}
+
+.resources-larger-resources-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png);
+}
+
+#resources-filter, #console-filter.console-filter-top {
+    background: -webkit-gradient(linear, left top, left bottom, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
+    width: 100%;
+}
+
+#console-messages.console-filter-top {
+    margin-top: 23px;
+}
+
+#console-filter {
+    margin-top: 1px;
+}
+
+.tabbed-pane {
+    -webkit-box-orient: vertical;
+    height: 100%;
+}
+
+.tabbed-pane-content {
+    -webkit-box-flex: 1;
+    position: relative;
+}
+
+.tabbed-pane-header {
+    height: 23px;
+    padding: 0 10px;
+    border-bottom: 1px solid rgb(163, 163, 163);
+}
+
+.tabbed-pane-header li {
+    display: inline-block;
+    margin-top: 2px;
+    font-size: 11px;
+    font-weight: bold;
+    color: rgb(46, 46, 46);
+    background: transparent;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    vertical-align: middle;
+    padding: 3px 7px 2px;
+    height: 21px;
+    border: 1px solid transparent;
+    border-bottom: none;
+}
+
+.tabbed-pane-header li.selected {
+    background-color: white;
+    border: 1px solid rgb(163, 163, 163);
+    border-bottom: none;
+}
+
+.scope-bar {
+    height: 23px;
+    padding: 2px 10px 0;
+    overflow: hidden;
+}
+
+.scope-bar li {
+    display: inline-block;
+    margin: 1px 2px 0 0;
+    padding: 1px 7px 3px;
+    font-size: 11px;
+    line-height: 12px;
+    font-weight: bold;
+    color: rgb(46, 46, 46);
+    background: transparent;
+    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+    -webkit-border-radius: 8px;
+    vertical-align: middle;
+}
+
+.scope-bar-divider {
+    margin: 1px 9px 0 8px;
+    background-color: rgba(0, 0, 0, 0.4);
+    height: 16px;
+    width: 1px;
+    vertical-align: middle;
+    display: inline-block;
+}
+
+.scope-bar li.selected, .scope-bar li:hover, .scope-bar li:active {
+    color: white;
+    text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
+}
+
+.scope-bar li:hover {
+    background: rgba(0, 0, 0, 0.2);
+}
+
+.scope-bar li.selected {
+    background: rgba(0, 0, 0, 0.3);
+    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5);
+}
+
+.scope-bar li:active {
+    background: rgba(0, 0, 0, 0.5);
+    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5);
+}
+
+#resources-container {
+    position: absolute;
+    top: 23px;
+    left: 0;
+    bottom: 0;
+    right: 0;
+    border-right: 0 none transparent;
+    overflow-y: auto;
+    overflow-x: hidden;
+}
+
+#resources-container.viewing-resource {
+    right: auto;
+    width: 200px;
+    border-right: 1px solid rgb(64%, 64%, 64%);
+}
+
+#resources-container.viewing-resource #resources-sidebar {
+    width: 100%;
+    border-right: 0 none transparent;
+}
+
+#resources-sidebar {
+    min-height: 100%;
+    bottom: auto;
+    overflow: visible;
+}
+
+#resources-container-content {
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 200px;
+    min-height: 100%;
+}
+
+#resources-container.viewing-resource #resources-container-content {
+    display: none;
+}
+
+#resources-summary {
+    position: absolute;
+    padding-top: 20px;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 93px;
+    margin-left: -1px;
+    border-left: 1px solid rgb(102, 102, 102);
+    background-color: rgb(101, 111, 130);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.5)));
+    background-repeat: repeat-x;
+    background-position: bottom;
+    text-align: center;
+    text-shadow: black 0 1px 1px;
+    white-space: nowrap;
+    color: white;
+    -webkit-background-size: 1px 6px;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+    z-index: 400;
+}
+
+.summary-graph-legend {
+    margin-top: -10px;
+    padding-left: 15px;
+}
+
+.summary-graph-legend-item {
+    display: inline-block;
+    font-weight: bold;
+    margin-right: 15px;
+    vertical-align: top;
+}
+
+.summary-graph-legend-item.total {
+    margin-left: 10px;
+}
+
+.summary-graph-legend-label {
+    display: inline-block;
+    text-align: left;
+}
+
+.summary-graph-legend-header {
+    font-size: 12px;
+}
+
+.summary-graph-legend-value {
+    font-size: 10px;
+}
+
+.summary-graph-legend-swatch {
+    vertical-align: top;
+    margin-top: 1px;
+    margin-right: 3px;
+}
+
+.resources-dividers {
+    position: absolute;
+    left: 0;
+    right: 0;
+    height: 100%;
+    top: 0;
+    z-index: -100;
+}
+
+.resources-event-dividers {
+    position: absolute;
+    left: 0;
+    right: 5px;
+    height: 100%;
+    top: 0;
+    z-index: 300;
+    pointer-events: none;
+}
+
+.timeline .resources-event-dividers {
+    height: 19px;
+}
+
+.resources-dividers-label-bar {
+    position: absolute;
+    top: 0;
+    left: 0px;
+    right: 0;
+    background-color: rgba(255, 255, 255, 0.8);
+    background-clip: padding;
+    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
+    height: 20px;
+    z-index: 200;
+}
+
+.resources-divider {
+    position: absolute;
+    width: 1px;
+    top: 0;
+    bottom: 0;
+    background-color: rgba(0, 0, 0, 0.1);
+}
+
+.resources-event-divider-padding {
+    position: absolute;
+    width: 8px;
+    top: 0;
+    bottom: 0;
+    pointer-events: auto;
+}
+
+.resources-event-divider {
+    position: absolute;
+    width: 2px;
+    top: 0;
+    bottom: 0;
+    z-index: 300;
+}
+
+.resources-red-divider {
+    background-color: rgba(255, 0, 0, 0.5);
+}
+
+.resources-blue-divider {
+    background-color: rgba(0, 0, 255, 0.5);
+}
+
+.resources-orange-divider {
+    background-color: rgba(255, 178, 23, 0.5);
+}
+
+.resources-divider.last {
+    background-color: transparent;
+}
+
+.resources-divider-label {
+    position: absolute;
+    top: 4px;
+    right: 3px;
+    font-size: 9px;
+    color: rgb(50%, 50%, 50%);
+    white-space: nowrap;
+}
+
+.memory-graph-label {
+    position: absolute;
+    top: 5px;
+    left: 5px;
+    font-size: 9px;
+    color: rgb(50%, 50%, 50%);
+    white-space: nowrap;
+}
+
+.resources-graph-label {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    margin: auto -7px;
+    height: 13px;
+    line-height: 13px;
+    font-size: 9px;
+    color: rgba(0, 0, 0, 0.75);
+    text-shadow: rgba(255, 255, 255, 0.25) 1px 0 0, rgba(255, 255, 255, 0.25) -1px 0 0, rgba(255, 255, 255, 0.333) 0 1px 0, rgba(255, 255, 255, 0.25) 0 -1px 0;
+    z-index: 150;
+    overflow: hidden;
+    text-align: center;
+    font-weight: bold;
+    opacity: 0;
+    -webkit-transition: opacity 250ms ease-in-out;
+}
+
+.resources-graph-side:hover .resources-graph-label {
+    opacity: 1;
+}
+
+.resources-graph-label:empty {
+    display: none;
+}
+
+.resources-graph-label.waiting {
+    margin-right: 5px;
+}
+
+.resources-graph-label.waiting-right {
+    margin-left: 5px;
+}
+
+.resources-graph-label.before {
+    color: rgba(0, 0, 0, 0.7);
+    text-shadow: none;
+    text-align: right;
+    margin-right: 2px;
+}
+
+.resources-graph-label.before::after {
+    padding-left: 2px;
+    height: 6px;
+    content: url(Images/graphLabelCalloutLeft.png);
+}
+
+.resources-graph-label.after {
+    color: rgba(0, 0, 0, 0.7);
+    text-shadow: none;
+    text-align: left;
+    margin-left: 2px;
+}
+
+.resources-graph-label.after::before {
+    padding-right: 2px;
+    height: 6px;
+    content: url(Images/graphLabelCalloutRight.png);
+}
+
+.resources-graph-bar {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    margin: auto -7px;
+    border-width: 6px 7px;
+    height: 13px;
+    min-width: 14px;
+    opacity: 0.65;
+    -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
+}
+
+.resources-category-documents, .resources-category-stylesheets, .resources-category-images,
+.resources-category-scripts, .resources-category-xhr, .resources-category-fonts,
+.resources-category-websockets, .resources-category-other {
+    display: none;
+}
+
+.filter-all .resources-category-documents, .filter-documents .resources-category-documents,
+.filter-all .resources-category-stylesheets, .filter-stylesheets .resources-category-stylesheets,
+.filter-all .resources-category-images, .filter-images .resources-category-images,
+.filter-all .resources-category-scripts, .filter-scripts .resources-category-scripts,
+.filter-all .resources-category-xhr, .filter-xhr .resources-category-xhr,
+.filter-all .resources-category-fonts, .filter-fonts .resources-category-fonts,
+.filter-all .resources-category-websockets, .filter-websockets .resources-category-websockets,
+.filter-all .resources-category-other, .filter-other .resources-category-other,
+.resource-sidebar-tree-item.selected {
+    display: list-item;
+}
+
+.console-warning-level, .console-error-level, .console-log-level {
+    display: none;
+}
+
+.filter-all .console-warning-level, .filter-warnings .console-warning-level,
+.filter-all .console-error-level, .filter-errors .console-error-level,
+.filter-all .console-log-level, .filter-logs .console-log-level {
+    display: block;
+}
+
+.console-user-command-result {
+    display: block;
+}
+
+.resources-graph-bar.waiting, .resources-graph-bar.waiting-right {
+    opacity: 0.35;
+}
+
+.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
+}
+
+.resources-category-documents .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillBlue.png) 6 7 6 7;
+}
+
+.resources-category-documents.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillBlue.png) 6 7 6 7;
+}
+
+.resources-category-stylesheets .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillGreen.png) 6 7 6 7;
+}
+
+.resources-category-stylesheets.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillGreen.png) 6 7 6 7;
+}
+
+.resources-category-images .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillPurple.png) 6 7 6 7;
+}
+
+.resources-category-images.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillPurple.png) 6 7 6 7;
+}
+
+.resources-category-fonts .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillRed.png) 6 7 6 7;
+}
+
+.resources-category-fonts.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillRed.png) 6 7 6 7;
+}
+
+.resources-category-scripts .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillOrange.png) 6 7 6 7;
+}
+
+.resources-category-scripts.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillOrange.png) 6 7 6 7;
+}
+
+.resources-category-xhr .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillYellow.png) 6 7 6 7;
+}
+
+.resources-category-xhr.resource-cached .resources-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillYellow.png) 6 7 6 7;
+}
+
+/* FIXME: Create bar images for WebSocket. */
+.resources-category-websockets .resources-graph-bar {
+    -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
+}
+
+.resources-category-websockets.resource-cached .resources-graph-bar {
+   -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
+}
+
+#resource-views {
+    position: absolute;
+    top: 23px;
+    right: 0;
+    left: 200px;
+    bottom: 0;
+}
+
+.source-view-frame {
+    width: 100%;
+    height: 100%;
+}
+
+.sidebar-resizer-vertical {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    width: 5px;
+    z-index: 500;
+    cursor: col-resize;
+}
+
+.resources .sidebar-resizer-vertical {
+    top: 23px;
+}
+
+.sidebar-tree, .sidebar-tree .children {
+    position: relative;
+    padding: 0;
+    margin: 0;
+    list-style: none;
+    font-size: 11px;
+}
+
+.sidebar-tree-section {
+    position: relative;
+    height: 18px;
+    padding: 4px 10px 6px 10px;
+    white-space: nowrap;
+    margin-top: 1px;
+    color: rgb(92, 110, 129);
+    font-weight: bold;
+    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
+}
+
+.sidebar-tree-item {
+    position: relative;
+    height: 36px;
+    padding: 0 5px 0 5px;
+    white-space: nowrap;
+    margin-top: 1px;
+    line-height: 34px;
+    border-top: 1px solid transparent;
+}
+
+.sidebar-tree .children {
+    display: none;
+}
+
+.sidebar-tree .children.expanded {
+    display: block;
+}
+
+.sidebar-tree-section + .children > .sidebar-tree-item {
+    padding-left: 10px !important;
+}
+
+.sidebar-tree-section + .children.small > .sidebar-tree-item {
+    padding-left: 17px !important;
+}
+
+.sidebar-tree > .children > .sidebar-tree-item {
+    padding-left: 37px;
+}
+
+.sidebar-tree > .children > .children > .sidebar-tree-item {
+    padding-left: 37px;
+}
+
+.sidebar-tree.hide-disclosure-buttons > .children {
+    display: none;
+}
+
+.sidebar-tree > .children.hide-disclosure-buttons > .children {
+    display: none;
+}
+
+.sidebar-tree.some-expandable:not(.hide-disclosure-buttons) > .sidebar-tree-item:not(.parent) .icon {
+    margin-left: 16px;
+}
+
+.sidebar-tree-item .disclosure-button {
+    float: left;
+    width: 16px;
+    height: 100%;
+    border: 0;
+    background-color: transparent;
+    background-image: url(Images/disclosureTriangleSmallRight.png);
+    background-repeat: no-repeat;
+    background-position: center;
+    -webkit-apearance: none;
+}
+
+.sidebar-tree.hide-disclosure-buttons .sidebar-tree-item .disclosure-button {
+    display: none;
+}
+
+body.inactive .sidebar-tree-item .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
+}
+
+body.inactive .sidebar-tree-item.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
+}
+
+body.inactive .sidebar-tree-item .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDownBlack.png);
+}
+
+.sidebar-tree-item.selected .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallRightWhite.png) !important;
+}
+
+.sidebar-tree-item.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDown.png);
+}
+
+.sidebar-tree-item.selected.expanded .disclosure-button {
+    background-image: url(Images/disclosureTriangleSmallDownWhite.png) !important;
+}
+
+.sidebar-tree-item.selected .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDownWhite.png) !important;
+}
+
+.sidebar-tree-item .disclosure-button:active {
+    background-image: url(Images/disclosureTriangleSmallRightDown.png);
+}
+
+.sidebar-tree-item .icon {
+    float: left;
+    width: 32px;
+    height: 32px;
+    margin-top: 1px;
+    margin-right: 3px;
+}
+
+li .status {
+    float: right;
+    height: 16px;
+    margin-top: 9px;
+    margin-left: 4px;
+    line-height: 1em;
+}
+
+li .status:empty {
+    display: none;
+}
+
+li .status .bubble {
+    display: inline-block;
+    height: 14px;
+    min-width: 16px;
+    margin-top: 1px;
+    background-color: rgb(128, 151, 189);
+    vertical-align: middle;
+    white-space: nowrap;
+    padding: 1px 4px;
+    text-align: center;
+    font-size: 11px;
+    line-height: normal;
+    font-family: Helvetica, Arial, sans-serif;
+    font-weight: bold;
+    text-shadow: none;
+    color: white;
+    -webkit-border-radius: 7px;
+}
+
+li .status .bubble:empty {
+    display: none;
+}
+
+li.selected .status .bubble {
+    background-color: white !important;
+    color: rgb(132, 154, 190) !important;
+}
+
+:focus li.selected .status .bubble {
+    color: rgb(36, 98, 172) !important;
+}
+
+body.inactive li.selected .status .bubble {
+    color: rgb(159, 159, 159) !important;
+}
+
+.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small, .small .resources-graph-side {
+    height: 20px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .icon, .sidebar-tree .children.small .sidebar-tree-item .icon, .sidebar-tree-item.small .icon {
+    width: 16px;
+    height: 16px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
+    margin-top: 1px;
+}
+
+.sidebar-tree-item.selected {
+    color: white;
+    border-top: 1px solid rgb(145, 160, 192);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
+    text-shadow: rgba(0, 0, 0, 0.33) 0 1px 0;
+    font-weight: bold;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+:focus .sidebar-tree-item.selected {
+    border-top: 1px solid rgb(68, 128, 200);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
+}
+
+body.inactive .sidebar-tree-item.selected {
+    border-top: 1px solid rgb(151, 151, 151);
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
+}
+
+.sidebar-tree-item .titles {
+    position: relative;
+    top: 5px;
+    line-height: 11px;
+    padding-bottom: 1px;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+}
+
+.sidebar-tree-item .titles.no-subtitle {
+    top: 10px;
+}
+
+.sidebar-tree.small .sidebar-tree-item .titles, .sidebar-tree .children.small .sidebar-tree-item .titles, .sidebar-tree-item.small .titles {
+    top: 2px;
+    line-height: normal;
+}
+
+.sidebar-tree:not(.small) .sidebar-tree-item:not(.small) .title::after, .sidebar-tree .children:not(.small) .sidebar-tree-item .title::after {
+    content: "\A";
+    white-space: pre;
+}
+
+.sidebar-tree-item .subtitle {
+    font-size: 9px;
+    color: rgba(0, 0, 0, 0.7);
+}
+
+.sidebar-tree.small .sidebar-tree-item .subtitle, .sidebar-tree .children.small .sidebar-tree-item .subtitle, .sidebar-tree-item.small .subtitle {
+    display: none;
+}
+
+.sidebar-tree-item.selected .subtitle {
+    color: rgba(255, 255, 255, 0.9);
+}
+
+#resources-graphs {
+    position: absolute;
+    left: 0;
+    right: 0;
+    max-height: 100%;
+    top: 112px;
+}
+
+.resources-graph-side {
+    position: relative;
+    height: 36px;
+    padding: 0 5px;
+    white-space: nowrap;
+    margin-top: 1px;
+    border-top: 1px solid transparent;
+    overflow: hidden;
+}
+
+.resources-graph-bar-area {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: 8px;
+    left: 9px;
+}
+
+#resources-container:not(.viewing-resource) .resource-sidebar-tree-item:nth-of-type(2n) {
+    background-color: rgba(0, 0, 0, 0.05);
+}
+
+#resources-container:not(.viewing-resource) .resources-graph-side:nth-of-type(2n) {
+    background-color: rgba(0, 0, 0, 0.05);
+}
+
+.resources-time-graph-sidebar-item .icon {
+    content: url(Images/resourcesTimeGraphIcon.png);
+}
+
+.resources-size-graph-sidebar-item .icon {
+    content: url(Images/resourcesSizeGraphIcon.png);
+}
+
+.resources-size-graph-sidebar-item .icon {
+    content: url(Images/resourcesSizeGraphIcon.png);
+}
+
+.resource-sidebar-tree-item .icon {
+    content: url(Images/resourcePlainIcon.png);
+}
+
+.children.small .resource-sidebar-tree-item .icon {
+    content: url(Images/resourcePlainIconSmall.png);
+}
+
+.resource-sidebar-tree-item.resources-category-documents .icon {
+    content: url(Images/resourceDocumentIcon.png);
+}
+
+.children.small .resource-sidebar-tree-item.resources-category-documents .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.resource-sidebar-tree-item.resources-category-stylesheets .icon {
+    content: url(Images/resourceCSSIcon.png);
+}
+
+.children.small .resource-sidebar-tree-item.resources-category-stylesheets .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.resource-sidebar-tree-item.resources-category-images .icon {
+    position: relative;
+    background-image: url(Images/resourcePlainIcon.png);
+    background-repeat: no-repeat;
+    content: "";
+}
+
+.resources-category-images .image-resource-icon-preview {
+    position: absolute;
+    margin: auto;
+    top: 3px;
+    bottom: 4px;
+    left: 5px;
+    right: 5px;
+    max-width: 18px;
+    max-height: 21px;
+    min-width: 1px;
+    min-height: 1px;
+}
+
+.children.small .resource-sidebar-tree-item.resources-category-images .icon {
+    background-image: url(Images/resourcePlainIconSmall.png);
+    content: "";
+}
+
+.children.small .resources-category-images .image-resource-icon-preview {
+    top: 2px;
+    bottom: 1px;
+    left: 3px;
+    right: 3px;
+    max-width: 8px;
+    max-height: 11px;
+}
+
+.resource-sidebar-tree-item.resources-category-fonts .icon {
+    content: url(Images/resourcePlainIcon.png);
+}
+
+.children.small .resource-sidebar-tree-item.resources-category-fonts .icon {
+    content: url(Images/resourcePlainIconSmall.png);
+}
+
+.resource-sidebar-tree-item.resources-category-scripts .icon {
+    content: url(Images/resourceJSIcon.png);
+}
+
+.children.small .resource-sidebar-tree-item.resources-category-scripts .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.resource-sidebar-tree-item.resources-category-xhr .icon {
+    content: url(Images/resourcePlainIcon.png);
+}
+
+.children.small .resource-sidebar-tree-item.resources-category-xhr .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.bubble.debug, .console-debug-level .bubble {
+    background-color: rgb(0, 0, 255) !important;
+}
+
+.bubble.warning, .console-warning-level .bubble {
+    background-color: rgb(232, 164, 0) !important;
+}
+
+.bubble.error, .console-error-level .bubble {
+    background-color: rgb(216, 35, 35) !important;
+}
+
+.bubble.search-matches {
+    background-image: url(Images/searchSmallWhite.png);
+    background-repeat: no-repeat;
+    background-position: 3px 2px;
+    padding-left: 13px !important;
+}
+
+li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallBlue.png);
+}
+
+:focus li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallBrightBlue.png);
+}
+
+body.inactive li.selected .bubble.search-matches {
+    background-image: url(Images/searchSmallGray.png);
+}
+
+/* Timeline Style */
+
+#timeline-overview-panel {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 80px;
+}
+
+#timeline-overview-panel .timeline-graph-bar {
+    pointer-events: none;
+}
+
+.timeline-sidebar-background {
+    top: 90px;
+    bottom: 0;
+}
+
+.timeline .sidebar {
+    overflow-y: hidden;
+    z-index: 100;
+    min-height: 100%;
+    bottom: auto;
+}
+
+#timeline-overview-separator {
+    position: absolute;
+    top: 80px;
+    left: 0;
+    right: 0;
+    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(253, 253, 253)), to(rgb(213, 213, 213)));
+    border-top: 1px solid rgb(140, 140, 140);
+    border-bottom: 1px solid rgb(115, 115, 115);
+    height: 10px;
+}
+
+#timeline-overview-sidebar {
+    position: absolute;
+    width: 200px;
+    top: 0px;
+    bottom: 0px;
+    left: 0px;
+    padding-top: 2px;
+    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(242, 242, 242)), to(rgb(209, 209, 209)));
+    border-right: 1px solid rgb(163, 163, 163);
+}
+
+#timeline-overview-grid {
+    position: absolute;
+    top: 0px;
+    bottom: 0px;
+    left: 200px;
+    right: 0px;
+    background-color: rgb(255, 255, 255);
+}
+
+.timeline-window-selector {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    background-color: rgba(125, 173, 217, 0.5);
+    z-index: 250;
+}
+
+#timeline-overview-window {
+    background-color: white;
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 60px;
+    z-index: 150;
+}
+
+.timeline-overview-dividers-background {
+    left: 0%;
+    right: 0%;
+    top: 0px;
+    bottom: 60px;
+    background-color: black;
+    position: absolute;
+}
+
+.timeline-overview-window-rulers {
+    top: 0;
+    bottom: 0;
+    position: absolute;
+    opacity: 0.2;
+    border-right: 1px solid black;
+    border-left: 1px solid black;
+    z-index: 150;
+}
+
+.timeline-window-resizer {
+    position: absolute;
+    top: 0px;
+    bottom: 60px;
+    width: 5px;
+    margin-left: -3px;
+    margin-right: -2px;
+    background-color: rgb(153, 153, 153);
+    z-index: 500;
+    cursor: col-resize;
+    -webkit-border-radius: 2px;
+    -webkit-box-shadow: white 1px 0 0, white -1px 0 0, white 0 1px 0, white 0 -1px 0;
+}
+
+#timeline-overview-grid #resources-graphs {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    height: 80px;
+}
+
+#timeline-container {
+    position: absolute;
+    top: 90px;
+    left: 0;
+    bottom: 0;
+    right: 0;
+    border-right: 0 none transparent;
+    overflow-y: auto;
+    overflow-x: hidden;
+}
+
+.timeline-category-statusbar-item {
+    height: 24px;
+    line-height: 24px;
+    padding-left: 6px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    font-weight: bold;
+}
+
+.timeline-category-statusbar-item .timeline-category-checkbox {
+    width: 10px;
+    height: 11px;
+    margin: 0 3px 0 5px;
+    padding: 0;
+    background-image: url(Images/timelineCheckmarks.png);
+    background-repeat: no-repeat;
+    background-position: 0 -66px;
+    vertical-align: -1px;
+    -webkit-appearance: none;
+}
+
+.timeline-category-statusbar-item .timeline-category-checkbox:checked {
+    background-position-x: -10px;
+}
+
+.timeline-category-statusbar-item.timeline-category-loading .timeline-category-checkbox {
+    background-position-y: 0;
+}
+
+.timeline-category-statusbar-item.timeline-category-scripting .timeline-category-checkbox {
+    background-position-y: -33px;
+}
+
+.timeline-category-statusbar-item.timeline-category-rendering .timeline-category-checkbox {
+    background-position-y: -11px;
+}
+
+.timeline-tree-item {
+    height: 18px;
+    line-height: 15px;
+    padding-right: 5px;
+    padding-left: 10px;
+    padding-top: 2px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.timeline-expandable {
+    position: absolute;
+    border-left: 1px solid rgb(163, 163, 163);
+}
+
+.timeline-expandable-left {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    width: 3px;
+    border-top: 1px solid rgb(163, 163, 163);
+    border-bottom: 1px solid rgb(163, 163, 163);
+}
+
+.timeline-expandable-collapsed {
+    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
+    background-position-x: 1px;
+    background-position-y: 2px;
+    background-repeat: no-repeat;
+}
+
+.timeline-expandable-expanded {
+    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
+    background-position-x: 1px;
+    background-position-y: 3px;
+    background-repeat: no-repeat;
+}
+
+.timeline-tree-item .type {
+    padding-left: 14px;
+}
+
+.timeline-tree-item .count {
+    font-family: Helvetica, Arial, sans-serif;
+    font-weight: bold;
+}
+
+.timeline-tree-item .timeline-tree-icon {
+    background-image: url(Images/timelineDots.png);
+    margin-top: 2px;
+    width: 12px;
+    height: 12px;
+    position: absolute;
+}
+
+.timeline-tree-item.even {
+    background-color: rgba(0, 0, 0, 0.05);
+}
+
+.timeline-tree-item .data.dimmed {
+    color: rgba(0, 0, 0, 0.7);
+}
+
+#timeline-overview-timelines,
+#timeline-overview-memory {
+    position: absolute;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    top: 20px;
+    z-index: 160;
+}
+
+#timeline-overview-memory > canvas {
+    position: absolute;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    top: 5px;
+}
+
+
+#timeline-graphs {
+    position: absolute;
+    left: 0;
+    right: 0;
+    max-height: 100%;
+    top: 19px;
+}
+
+.timeline-graph-side {
+    position: relative;
+    height: 18px;
+    padding: 0 5px;
+    white-space: nowrap;
+    margin-top: 0px;
+    border-top: 1px solid transparent;
+    overflow: hidden;
+    pointer-events: none;
+}
+
+.timeline-overview-graph-side {
+    height: 20px;
+    z-index: 170;
+    pointer-events: none;
+}
+
+.timeline-overview-graph-side .timeline-graph-bar {
+    height: 13px;
+}
+
+.timeline-graph-bar-area {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: 0;
+    left: 3px;
+    pointer-events: none;
+}
+
+.timeline-graph-bar {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    margin: auto -2px;
+    border-width: 4px 4px 5px;
+    height: 9px;
+    min-width: 5px;
+    opacity: 0.8;
+    -webkit-border-image: url(Images/timelineBarGray.png) 4 4 5 4;
+    z-index: 180;
+    pointer-events: visibleFill;
+}
+
+.timeline-graph-bar.with-children {
+    opacity: 0.2;
+}
+
+.timeline-graph-bar.cpu {
+    opacity: 0.6;
+}
+
+.timeline-graph-side.even {
+    background-color: rgba(0, 0, 0, 0.05);
+}
+
+.timeline-category-loading .timeline-graph-bar {
+    -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4;
+}
+
+.timeline-category-scripting .timeline-graph-bar {
+    -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4;
+}
+
+.timeline-category-rendering .timeline-graph-bar {
+    -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4;
+}
+
+.timeline-aggregated-category {
+    display: inline-block;
+    height: 11px;
+    margin-right: 2px;
+    margin-left: 6px;
+    position: relative;
+    top: 2px;
+    width: 10px;
+}
+
+.timeline-loading {
+    -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4;
+}
+
+.timeline-scripting {
+    -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4;
+}
+
+.timeline-rendering {
+    -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4;
+}
+
+.popover .timeline-aggregated-category.timeline-loading {
+    margin-left: 0px;
+}
+
+.timeline-category-loading .timeline-tree-icon {
+    background-position-y: 0px;
+}
+
+.timeline-category-scripting .timeline-tree-icon {
+    background-position-y: 48px;
+}
+
+.timeline-category-rendering .timeline-tree-icon {
+    background-position-y: 72px;
+}
+
+.timeline-details {
+    -webkit-user-select: text;
+    vertical-align: top;
+}
+
+.timeline-function-name {
+    text-align: right;
+}
+
+.timeline-stacktrace-title {
+    padding-top: 4px;
+}
+
+.timeline-details-row-title {
+    font-weight: bold;
+    text-align: right;
+    white-space: nowrap;
+}
+
+.timeline-details-row-data {
+    white-space: nowrap;
+}
+
+.timeline-details-title {
+    border-bottom: 1px solid #B8B8B8;
+    font-size: 11px;
+    font-weight: bold;
+    padding-bottom: 5px;
+    padding-top: 0px;
+    white-space: nowrap;
+}
+
+.timeline-filter-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png);
+}
+
+.timeline-filter-status-bar-item.toggled-on .glyph {
+    background-color: rgb(66, 129, 235) !important;
+}
+
+.timeline-records-counter, .storage-application-cache-status, .storage-application-cache-connectivity {
+    font-size: 11px;
+    text-shadow: white 0 1px 0;
+}
+
+#main-status-bar > .timeline-records-counter {
+    float: right;
+    margin-top: 4px;
+    margin-right: 25px;
+}
+
+#counters > .timeline-records-counter {
+    float: left;
+    margin-top: -2px;
+}
+
+.storage-application-cache-status-icon, .storage-application-cache-connectivity-icon {
+    margin-bottom: -3px;
+    margin-left: 5px;
+    vertical-align: middle;
+}
+
+.status-bar-divider {
+    margin-left: 7px;
+    border-right: 1px solid #CCC;
+}
+
+.storage-application-cache-status, .storage-application-cache-connectivity {
+    position: relative;
+    top: 4px;
+}
+
+/* Profiler Style */
+
+#profile-views {
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 200px;
+    bottom: 0;
+}
+
+.status-bar-items {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 200px;
+    overflow: hidden;
+    border-left: 1px solid rgb(184, 184, 184);
+    margin-left: -1px;
+}
+
+.profile-sidebar-tree-item .icon {
+    content: url(Images/profileIcon.png);
+}
+
+.profile-sidebar-tree-item.small .icon {
+    content: url(Images/profileSmallIcon.png);
+}
+
+.profile-group-sidebar-tree-item .icon {
+    content: url(Images/profileGroupIcon.png);
+}
+
+.profile-view {
+    display: none;
+    overflow: hidden;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.profile-view.visible {
+    display: block;
+}
+
+.profile-view .data-grid {
+    border: none;
+    height: 100%;
+}
+
+.profile-view .data-grid th.average-column {
+    text-align: center;
+}
+
+.profile-view .data-grid td.average-column {
+    text-align: right;
+}
+
+.profile-view .data-grid th.self-column {
+    text-align: center;
+}
+
+.profile-view .data-grid td.self-column {
+    text-align: right;
+}
+
+.profile-view .data-grid th.total-column {
+    text-align: center;
+}
+
+.profile-view .data-grid td.total-column {
+    text-align: right;
+}
+
+.profile-view .data-grid .calls-column {
+    text-align: center;
+}
+
+.profile-node-file {
+    float: right;
+    color: gray;
+    margin-top: -1px;
+}
+
+.data-grid tr.selected .profile-node-file {
+    color: rgb(33%, 33%, 33%);
+}
+
+.data-grid:focus tr.selected .profile-node-file {
+    color: white;
+}
+
+button.enable-toggle-status-bar-item .glyph {
+}
+
+.record-profile-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/recordButtonGlyph.png);
+}
+
+.record-profile-status-bar-item.toggled-on .glyph {
+    -webkit-mask-image: url(Images/recordToggledButtonGlyph.png);
+    background-color: rgb(216, 0, 0) !important;
+}
+
+/* FIXME: should have its own glyph. */
+.heap-snapshot-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/focusButtonGlyph.png);
+}
+
+.node-search-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/nodeSearchButtonGlyph.png);
+}
+
+.percent-time-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/percentButtonGlyph.png);
+}
+
+.focus-profile-node-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/focusButtonGlyph.png);
+}
+
+.exclude-profile-node-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/excludeButtonGlyph.png);
+}
+
+.reset-profile-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/reloadButtonGlyph.png);
+}
+
+.delete-storage-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/excludeButtonGlyph.png);
+}
+
+.refresh-storage-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/reloadButtonGlyph.png);
+}
+
+ol.breakpoint-list {
+    -webkit-padding-start: 0;
+    list-style: none;
+    margin: 0;
+}
+
+.breakpoint-list li {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    padding: 2px 0;
+    color: black;
+}
+
+.breakpoint-list li:hover {
+    color: rgb(15%, 15%, 15%);
+}
+
+.breakpoint-list .checkbox-elem {
+    font-size: 10px;
+    margin: 0 4px;
+    vertical-align: top;
+    position: relative;
+    z-index: 1;
+}
+
+.breakpoint-list .source-text {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    margin: 2px 0 0px 20px;
+}
+
+.pane .breakpoint-hit {
+    background-color: rgb(255, 255, 194);
+}
+
+li.breakpoint-hit .breakpoint-hit-marker {
+    background-color: rgb(255, 255, 194);
+    height: 18px;
+    left: 0px;
+    margin-top: -16px;
+    position: absolute;
+    right: 0px;
+    z-index: -1;
+}
+
+.webkit-html-js-node, .webkit-html-css-node {
+    white-space: pre;
+}
+
+.source-frame-breakpoint-condition {
+    z-index: 30;
+    padding: 4px;
+    background-color: rgb(203, 226, 255);
+    -webkit-border-radius: 7px;
+    border: 2px solid rgb(169, 172, 203); 
+    width: 90%; 
+}
+
+.source-frame-breakpoint-message {
+    background-color: transparent;
+    font-family: Lucida Grande, sans-serif; 
+    font-weight: normal;
+    font-size: 11px;
+    text-align: left;
+    text-shadow: none;
+    color: rgb(85, 85, 85);
+    cursor: default;
+    margin: 0 0 2px 0; 
+}
+
+#source-frame-breakpoint-condition {
+    margin: 0;
+    border: 1px inset rgb(190, 190, 190) !important;
+    width: 100%;
+    box-shadow: none !important;
+    outline: none !important;
+    -webkit-user-modify: read-write;
+}
+
+.source-frame-popover-title {
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+    font-weight: bold;
+    padding-left: 18px;
+}
+
+.source-frame-popover-tree {
+    border-top: 1px solid rgb(194, 194, 147);
+    overflow: auto;
+    position: absolute;
+    top: 15px;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.source-frame-eval-expression {
+    border: 1px solid rgb(163, 41, 34);
+    margin: -1px;
+    background-color: rgb(255, 255, 194);
+}
+
+.styles-sidebar-separator {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), color-stop(0.05, rgb(243, 243, 243)), color-stop(0.05, rgb(230, 230, 230)), to(rgb(209, 209, 209)));
+    padding: 0 5px;
+    border-top: 1px solid rgb(189, 189, 189);
+    border-bottom: 1px solid rgb(189, 189, 189);
+    color: rgb(110, 110, 110);
+    text-shadow: white 0 1px 0;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    font-size: 11px;
+}
+
+.styles-selector {
+    cursor: text;
+}
+
+.workers-list {
+    list-style: none;
+    margin: 0;
+    padding: 0;
+}
+ 
+.workers-list > li {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    margin-left: 1em;
+    font-size: 12px;
+}
+
+a.worker-item {
+    color: rgb(33%, 33%, 33%);
+    cursor: pointer;
+    text-decoration: none;
+}
+
+.styles-section {
+    padding: 2px 2px 4px 4px;
+    min-height: 18px;
+    white-space: nowrap;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+    -webkit-user-select: text;
+}
+
+.styles-section:not(.first-styles-section) {
+    border-top: 1px solid rgb(191, 191, 191);
+}
+
+.styles-section.read-only {
+    background-color: rgb(240, 240, 240);
+}
+
+.styles-section .properties li.not-parsed-ok {
+    margin-left: 0px;
+}
+
+.styles-section .properties li.not-parsed-ok::before {
+    content: url(Images/warningIcon.png);
+    opacity: 0.75;
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 0;
+    padding-right: 5px;
+    vertical-align: sub;
+    -webkit-user-select: none;
+    cursor: default;
+}
+
+.styles-section .header {
+    white-space: nowrap;
+    -webkit-background-origin: padding;
+    -webkit-background-clip: padding;
+}
+
+.styles-section .header .title {
+    word-wrap: break-word;
+    white-space: normal;
+}
+
+.styles-section .header .subtitle {
+    color: rgb(85, 85, 85);
+    float: right;
+    margin-left: 5px;
+    max-width: 65%;
+    text-overflow: ellipsis;
+    overflow: hidden;
+}
+
+.styles-section .header .subtitle a {
+    color: inherit;
+}
+
+.styles-section a::before {
+    content: attr(data-uncopyable);
+}
+
+.styles-section .properties {
+    display: none;
+    margin: 0;
+    padding: 2px 4px 0 8px;
+    list-style: none;
+}
+
+.styles-section.no-affect .properties li {
+    opacity: 0.5;
+}
+
+.styles-section.no-affect .properties li.editing {
+    opacity: 1.0;
+}
+
+.styles-section.expanded .properties {
+    display: block;
+}
+
+.styles-section .properties li {
+    margin-left: 12px;
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    cursor: auto;
+}
+
+.styles-section .properties li.parent {
+    margin-left: 1px;
+}
+
+.styles-section .properties ol {
+    display: none;
+    margin: 0;
+    -webkit-padding-start: 12px;
+    list-style: none;
+}
+
+.styles-section .properties ol.expanded {
+    display: block;
+}
+
+.styles-section .properties li.parent::before {
+    content: url(Images/treeRightTriangleBlack.png);
+    opacity: 0.75;
+    float: left;
+    width: 8px;
+    height: 8px;
+    margin-top: 0;
+    padding-right: 3px;
+    -webkit-user-select: none;
+    cursor: default;
+}
+
+.styles-section .properties li.parent.expanded::before {
+    content: url(Images/treeDownTriangleBlack.png);
+    margin-top: 1px;
+}
+
+.styles-section .properties li .info {
+    padding-top: 4px;
+    padding-bottom: 3px;
+}
+
+.styles-section:hover .properties .enabled-button {
+    display: block;
+}
+
+.styles-section .properties li.disabled .enabled-button {
+    display: block;
+}
+
+.styles-section .properties .enabled-button {
+    display: none;
+    float: right;
+    font-size: 10px;
+    margin: 0 0 0 4px;
+    vertical-align: top;
+    position: relative;
+    z-index: 1;
+}
+
+.styles-section .properties .overloaded, .styles-section .properties .inactive, .styles-section .properties .disabled {
+    text-decoration: line-through;
+}
+
+.styles-section.computed-style .properties .disabled {
+    text-decoration: none;
+    opacity: 0.5;
+}
+
+.styles-section .properties .implicit, .styles-section .properties .inherited {
+    opacity: 0.5;
+}
+
+
+.body .styles-section .properties .inherited {
+    display: none;
+}
+
+.body.show-inherited .styles-section .properties .inherited {
+    display: block;
+}
+
+a.worker-item:hover {
+    color: rgb(15%, 15%, 15%);
+}
+
+.resource-content-unavailable {
+    color: rgb(50%, 50%, 50%);
+    font-style: italic;
+    font-size: 14px;
+    text-align: center;
+    padding: 32px;
+}
+
+.node-link {
+    text-decoration: underline;
+    cursor: pointer;
+}
+
+.cursor-pointer {
+    cursor: pointer;
+}
+
+.cursor-auto {
+    cursor: auto;
+}
+
+/* inspectorSyntaxHighlight.css */
+
+/*
+ * Copyright (C) 2009 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.webkit-css-comment { 
+    color: rgb(0, 116, 0);
+}
+
+.webkit-css-url, .webkit-css-color, .webkit-css-string, .webkit-css-keyword {
+    color: rgb(7, 144, 154);
+ }
+
+.webkit-css-number {
+    color: rgb(50, 0, 255);
+}
+
+.webkit-css-property, .webkit-css-at-rule {
+    color: rgb(200, 0, 0);
+}
+
+.webkit-css-selector {
+    color: black;
+}
+
+.webkit-css-important {
+    color: rgb(200, 0, 180);
+}
+
+.webkit-javascript-comment {
+    color: rgb(0, 116, 0);
+}
+
+.webkit-javascript-keyword {
+    color: rgb(170, 13, 145);
+}
+
+.webkit-javascript-number {
+    color: rgb(28, 0, 207);
+}
+
+.webkit-javascript-string, .webkit-javascript-regexp {
+    color: rgb(196, 26, 22);
+}
+
+.webkit-javascript-ident {
+    color: black;
+}
+
+.webkit-html-comment {
+    /* Keep this in sync with view-source.css (.webkit-html-comment) */
+    color: rgb(35, 110, 37);
+}
+
+.webkit-html-tag {
+    /* Keep this in sync with view-source.css (.webkit-html-tag) */
+    color: rgb(136, 18, 128);
+}
+
+.webkit-html-doctype {
+    /* Keep this in sync with view-source.css (.webkit-html-doctype) */
+    color: rgb(192, 192, 192);
+}
+
+.webkit-html-attribute-name {
+    /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
+    color: rgb(153, 69, 0);
+}
+
+.webkit-html-attribute-value {
+    /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
+    color: rgb(26, 26, 166);
+}
+
+.webkit-html-external-link, .webkit-html-resource-link {
+    /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */
+    color: #00e;
+}
+
+.webkit-html-external-link {
+    /* Keep this in sync with view-source.css (.webkit-html-external-link) */
+    text-decoration: none;
+}
+
+.webkit-html-external-link:hover {
+    /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */
+    text-decoration: underline;
+}
+
+/* networkPanel.css */
+
+.network-larger-resources-status-bar-item .glyph {
+    -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png);
+}
+
+.network-sidebar .data-grid {
+    border: none;
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    font-size: 11px;
+}
+
+.network-sidebar .data-grid table.data {
+    -webkit-background-size: 1px 82px;
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, 0.05)), to(rgba(0, 0, 0, 0.05)));
+    font-size: 11px;
+}
+
+.network-sidebar .data-grid.small table.data {
+    -webkit-background-size: 1px 42px;
+}
+
+.network-sidebar .data-grid td:not(.network-summary) {
+    line-height: 17px;
+    height: 37px;
+    border-right: 1px solid rgb(210, 210, 210);
+    vertical-align: middle;
+}
+
+.network-sidebar .data-grid.small td {
+    height: 17px;
+}
+
+.network-sidebar .data-grid th {
+    border-bottom: 1px solid rgb(64%, 64%, 64%);
+    height: 30px;
+    font-size: 11px;
+    font-weight: bold;
+}
+
+.network-sidebar .data-grid.small th {
+    height: 22px;
+}
+
+.network-sidebar .data-grid th, .network.panel .data-grid th.sort-descending, .network.panel .data-grid th.sort-ascending {
+    background: -webkit-gradient(linear, left top, left bottom, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
+}
+
+.network-sidebar .data-grid .data-container {
+    top: 31px;
+}
+
+.network-sidebar .data-grid.small .data-container {
+    top: 23px;
+}
+
+.network-sidebar .data-grid select {
+    -webkit-appearance: none;
+    background-color: transparent;
+    border: none;
+    width: 100%;
+    font-size: 11px;
+    font-weight: bold;
+}
+
+.network-sidebar .data-grid tr.filler {
+    background-color: white;
+}
+
+.network-sidebar .data-grid td.name-column {
+    font-weight: bold;
+    cursor: pointer;
+}
+
+.network.panel:not(.viewing-resource) .network-sidebar td.name-column:hover {
+    text-decoration: underline;
+}
+
+.network-sidebar .data-grid td.method-column,
+.network-sidebar .data-grid td.status-column,
+.network-sidebar .data-grid td.type-column,
+.network-sidebar .data-grid td.size-column,
+.network-sidebar .data-grid td.time-column {
+    background-color: rgba(0, 0, 0, 0.07);
+}
+
+.network-sidebar .data-grid td.size-column,
+.network-sidebar .data-grid td.time-column {
+    text-align: right;
+}
+
+.network-sidebar .small .network-graph-side {
+    height: 14px;
+}
+
+.network-sidebar .data-grid th.sortable:active {
+    background-image: none;
+}
+
+.network-cell-subtitle {
+    font-weight: normal;
+    color: gray;
+}
+
+.network-sidebar tr.selected .network-cell-subtitle {
+    color: white;
+}
+
+.network-header-subtitle {
+    color: gray;
+}
+
+.network-sidebar .data-grid.small .network-cell-subtitle,
+.network-sidebar .data-grid.small .network-header-subtitle
+{
+    display: none;
+}
+
+/* Resource preview icons */
+
+.network-sidebar .data-grid .icon {
+    content: url(Images/resourcePlainIcon.png);
+}
+
+.network-sidebar .data-grid.small .icon {
+    content: url(Images/resourcePlainIconSmall.png);
+}
+
+.network-sidebar .network-category-scripts .icon {
+    content: url(Images/resourceJSIcon.png);
+}
+
+.network-sidebar .data-grid.small .network-category-scripts .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.network-sidebar .network-category-documents .icon {
+    content: url(Images/resourceDocumentIcon.png);
+}
+
+.network-sidebar .data-grid.small .network-category-documents .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.network-sidebar .network-category-stylesheets .icon {
+    content: url(Images/resourceCSSIcon.png);
+}
+
+.network-sidebar .data-grid.small .network-category-stylesheets .icon {
+    content: url(Images/resourceDocumentIconSmall.png);
+}
+
+.network-sidebar .network-category-images .icon {
+    position: relative;
+    background-image: url(Images/resourcePlainIcon.png);
+    background-repeat: no-repeat;
+    content: "";
+}
+
+.network-sidebar .data-grid.small .network-category-images .icon {
+    background-image: url(Images/resourcePlainIconSmall.png);
+    content: "";
+}
+
+.network-sidebar .data-grid .icon {
+    float: left;
+    width: 32px;
+    height: 32px;
+    margin-top: 1px;
+    margin-right: 3px;
+}
+
+.network-sidebar .data-grid.small .icon {
+    width: 16px;
+    height: 16px;
+}
+
+.network-sidebar .image-network-icon-preview {
+    position: absolute;
+    margin: auto;
+    top: 3px;
+    bottom: 4px;
+    left: 5px;
+    right: 5px;
+    max-width: 18px;
+    max-height: 21px;
+    min-width: 1px;
+    min-height: 1px;
+}
+
+.network-sidebar .data-grid.small .image-network-icon-preview {
+    top: 2px;
+    bottom: 1px;
+    left: 3px;
+    right: 3px;
+    max-width: 8px;
+    max-height: 11px;
+}
+
+/* Graph styles */
+
+.network-graph-side {
+    position: relative;
+    height: 36px;
+    padding: 0 5px;
+    white-space: nowrap;
+    margin-top: 1px;
+    border-top: 1px solid transparent;
+    overflow: hidden;
+}
+
+.network-graph-bar-area {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    right: 8px;
+    left: 9px;
+}
+
+.network-graph-label {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    margin: auto -7px;
+    height: 13px;
+    line-height: 13px;
+    font-size: 9px;
+    color: rgba(0, 0, 0, 0.75);
+    text-shadow: rgba(255, 255, 255, 0.25) 1px 0 0, rgba(255, 255, 255, 0.25) -1px 0 0, rgba(255, 255, 255, 0.333) 0 1px 0, rgba(255, 255, 255, 0.25) 0 -1px 0;
+    z-index: 150;
+    overflow: hidden;
+    text-align: center;
+    font-weight: bold;
+    opacity: 0;
+    -webkit-transition: opacity 250ms ease-in-out;
+}
+
+.network-graph-side:hover .network-graph-label {
+    opacity: 1;
+}
+
+.network-graph-label:empty {
+    display: none;
+}
+
+.network-graph-label.waiting {
+    margin-right: 5px;
+}
+
+.network-graph-label.waiting-right {
+    margin-left: 5px;
+}
+
+.network-graph-label.before {
+    color: rgba(0, 0, 0, 0.7);
+    text-shadow: none;
+    text-align: right;
+    margin-right: 2px;
+}
+
+.network-graph-label.before::after {
+    padding-left: 2px;
+    height: 6px;
+    content: url(Images/graphLabelCalloutLeft.png);
+}
+
+.network-graph-label.after {
+    color: rgba(0, 0, 0, 0.7);
+    text-shadow: none;
+    text-align: left;
+    margin-left: 2px;
+}
+
+.network-graph-label.after::before {
+    padding-right: 2px;
+    height: 6px;
+    content: url(Images/graphLabelCalloutRight.png);
+}
+
+.network-graph-bar {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    margin: auto -7px;
+    border-width: 6px 7px;
+    height: 13px;
+    min-width: 14px;
+    opacity: 0.65;
+    -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
+}
+
+.network-graph-bar.waiting, .network-graph-bar.waiting-right {
+    opacity: 0.35;
+}
+
+/* Resource categories */
+
+
+.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
+}
+
+.network-category-documents .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillBlue.png) 6 7 6 7;
+}
+
+.network-category-documents.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillBlue.png) 6 7 6 7;
+}
+
+.network-category-stylesheets .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillGreen.png) 6 7 6 7;
+}
+
+.network-category-stylesheets.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillGreen.png) 6 7 6 7;
+}
+
+.network-category-images .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillPurple.png) 6 7 6 7;
+}
+
+.network-category-images.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillPurple.png) 6 7 6 7;
+}
+
+.network-category-fonts .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillRed.png) 6 7 6 7;
+}
+
+.network-category-fonts.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillRed.png) 6 7 6 7;
+}
+
+.network-category-scripts .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillOrange.png) 6 7 6 7;
+}
+
+.network-category-scripts.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillOrange.png) 6 7 6 7;
+}
+
+.network-category-xhr .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillYellow.png) 6 7 6 7;
+}
+
+.network-category-xhr.resource-cached .network-graph-bar {
+    -webkit-border-image: url(Images/timelineHollowPillYellow.png) 6 7 6 7;
+}
+
+.network-category-websockets .network-graph-bar {
+    -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
+}
+
+.network-category-websockets.resource-cached .network-graph-bar {
+   -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
+}
+
+
+/* Popover */
+
+.network-timing-row {
+    position: relative;
+    height: 16px;
+}
+
+.network-timing-bar {
+    position: absolute;
+    background-color: red;
+    border-left: 1px solid red;
+    opacity: 0.4;
+    top: 0;
+    bottom: 0;
+}
+
+.network-timing-bar-title {
+    position: absolute;
+    color: black;
+    top: 1px;
+}
+
+.network-dim-cell {
+    color: grey;
+}
+
+/* Dividers */
+
+.network-timeline-grid {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    pointer-events: none;
+}
+
+.network-event-divider-padding {
+    position: absolute;
+    width: 8px;
+    top: 0;
+    bottom: 0;
+    pointer-events: auto;
+}
+
+.network-event-divider {
+    position: absolute;
+    width: 2px;
+    top: 31px;
+    bottom: 0;
+    z-index: 300;
+}
+
+.network-sidebar .network-timeline-grid.small .network-event-divider {
+    top: 23px;
+}
+
+.network-red-divider {
+    background-color: rgba(255, 0, 0, 0.5);
+}
+
+.network-blue-divider {
+    background-color: rgba(0, 0, 255, 0.5);
+}
+
+.network-sidebar .resources-dividers {
+    z-index: 0;
+}
+
+.network-sidebar .resources-dividers-label-bar {
+    background-color: transparent;
+    border: none;
+    height: 30px;
+    pointer-events: none;
+}
+
+.network-sidebar .network-timeline-grid.small .resources-dividers-label-bar {
+    height: 23px;
+}
+
+.network-sidebar .resources-divider-label {
+    top: 0px;
+    margin-top: -4px;
+    color: black;
+}
+
+.network-sidebar .resources-dividers-label-bar .resources-divider {
+    top: 23px;
+}
+
+.network-sidebar .network-timeline-grid.small .resources-dividers-label-bar .resources-divider {
+    top: 15px;
+}
+
+.network-sidebar .resources-divider.first .resources-divider-label {
+    display: none;
+}
+
+.network-sidebar .resources-dividers-label-bar .resources-divider.first {
+    background-color: transparent;
+}
+
+/* Filters */
+#network-filter {
+    margin-top: 1px;
+}
+
+.data-grid table.data tr.revealed.network-item {
+    display: none;
+}
+
+.data-grid.filter-all table.data tr.revealed.network-item,
+.data-grid.filter-documents table.data tr.revealed.network-category-documents,
+.data-grid.filter-stylesheets table.data tr.revealed.network-category-stylesheets,
+.data-grid.filter-images table.data tr.revealed.network-category-images,
+.data-grid.filter-scripts table.data tr.revealed.network-category-scripts,
+.data-grid.filter-xhr table.data tr.revealed.network-category-xhr,
+.data-grid.filter-fonts table.data tr.revealed.network-category-fonts,
+.data-grid.filter-websockets table.data tr.revealed.network-category-websockets,
+.data-grid.filter-other table.data tr.revealed.network-category-other {
+    display: table-row;
+}
+
+/* Summary */
+
+.network-summary-bar {
+    background-color: rgb(101, 111, 130);
+    color: white;
+    height: 20px;
+    font-size: 11px;
+    font-weight: bold;
+    padding-top: 3px;
+    padding-left: 10px;
+    z-index: 2000;
+    white-space: pre;
+    overflow : hidden;
+    text-overflow : ellipsis;
+}
+
+.network-summary-bar-bottom {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    padding-top: 3px;
+}
+
+.data-grid td .network-summary-bar {
+    white-space: pre;
+}
+
+.network-sidebar .data-grid td.network-summary {
+    padding: 0;
+}
+
+/* Viewer */
+
+.network.panel.viewing-resource .network-sidebar .data-grid td,
+.network.panel.viewing-resource .network-sidebar .data-grid th {
+    border-right: none;
+}
+
+.network.panel.viewing-resource .data-grid th.corner {
+    display: none;
+}
+
+#network-container {
+    position: absolute;
+    top: 0;
+    left: 0;
+    bottom: 0;
+    right: 0;
+    border-right: 0 none transparent;
+    overflow-y: auto;
+    overflow-x: hidden;
+}
+
+.network.panel.viewing-resource #network-container {
+    border-right: 1px solid rgb(163, 163, 163);
+}
+
+#network-views {
+    position: absolute;
+    background: rgb(203, 203, 203);
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+}
+
+#network-close-button {
+    position: absolute;
+    width: 14px;
+    height: 14px;
+    background-image: url(Images/closeButtons.png);
+    background-position: 0 0;
+    background-color: transparent;
+    border: 0 none transparent;
+    top: 8px;
+    left: 5px;
+    z-index: 10;
+    display: none;
+}
+
+#network-views.small #network-close-button  {
+    top: 4px;
+}
+
+#network-close-button:hover {
+    background-position: 14px 0;
+}
+
+#network-close-button:active {
+    background-position: 28px 0;
+}
+
+.network.panel.viewing-resource #network-close-button  {
+    display: block;
+}
+
+
+.network-sidebar .data-grid.full-grid-mode .viewer-column {
+    display: none;
+}
+
+.network-sidebar .data-grid.brief-grid-mode .viewer-column,
+.network-sidebar .data-grid.brief-grid-mode .method-column,
+.network-sidebar .data-grid.brief-grid-mode .status-column,
+.network-sidebar .data-grid.brief-grid-mode .type-column,
+.network-sidebar .data-grid.brief-grid-mode .size-column,
+.network-sidebar .data-grid.brief-grid-mode .time-column {
+    display: none;
+}
+
+.network.panel.viewing-resource .network-timeline-grid {
+    display: none;
+}
+
+.network-sidebar .data-grid.viewing-resource-mode .method-column,
+.network-sidebar .data-grid.viewing-resource-mode .status-column,
+.network-sidebar .data-grid.viewing-resource-mode .type-column,
+.network-sidebar .data-grid.viewing-resource-mode .size-column,
+.network-sidebar .data-grid.viewing-resource-mode .time-column,
+.network-sidebar .data-grid.viewing-resource-mode .timeline-column {
+    display: none;
+}
+
+.network.panel .network-sidebar {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+}
+
+.network.panel:not(.viewing-resource) .sidebar-resizer-vertical {
+    display: none;
+}
+
+.network.panel.viewing-resource .network-sidebar .data-grid-resizer {
+    display: none;
+}
+
+.network.panel .scope-bar {
+    height: 23px;
+    padding-top: 5px;
+}
+
+.network.panel:not(.viewing-resource) .data-grid tr.selected {
+    background-color: transparent;
+    color: black;
+}
+
+#network-views .network-item-view .tabbed-pane-header {
+    height: 31px;
+    padding-top: 8px;
+    padding-left: 25px;
+    white-space: nowrap;
+}
+
+#network-views.small .network-item-view .tabbed-pane-header {
+    height: 23px;
+    padding-top: 0;
+}
+
+.network.panel.viewing-resource .data-grid .data-container {
+    padding-right: 0;
+}
+
+.network-item-view {
+    display: none;
+    position: absolute;
+    background: white;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+}
+
+.network-item-view.visible {
+    display: -webkit-box;
+}
+
+.network-item-view .tabbed-pane-header {
+    height: 20px;
+    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
+    border-bottom: 1px solid rgb(163, 163, 163);
+}
+
+.network-item-view .scope-bar li {
+    border-bottom-left-radius: 0;
+    border-bottom-right-radius: 0;
+}
+
+.resource-headers-view {
+    display: none;
+    padding: 6px;
+    -webkit-user-select: text;    
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    overflow: auto;
+}
+
+.resource-headers-view.visible {
+    display: block;
+}
+
+.resource-headers-view .outline-disclosure .parent {
+    -webkit-user-select: none;
+    font-weight: bold;
+}
+
+.resource-headers-view .outline-disclosure .children li {
+    white-space: nowrap;
+}
+
+.resource-headers-view .outline-disclosure li.expanded .header-count {
+    display: none;
+}
+
+.resource-headers-view .outline-disclosure .header-name {
+    color: rgb(33%, 33%, 33%);
+    display: inline-block;
+    margin-right: 0.5em;
+    font-weight: bold;
+    vertical-align: top;
+    white-space: pre-wrap;
+}
+
+.resource-headers-view .outline-disclosure .header-value {
+    display: inline;
+    margin-right: 100px;
+    white-space: pre-wrap;
+    word-break: break-all;
+    margin-top: 1px;
+}
+
+.resource-headers-view .outline-disclosure .raw-form-data {
+    white-space: pre-wrap;
+}
+
+.resource-cookies-view {
+    display: none;
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 0;
+    bottom: 0;
+    overflow: auto;
+    padding: 12px;
+    height: 100%;
+}
+
+.resource-cookies-view.visible {
+    display: block;
+}
+
+.resource-cookies-view .data-grid {
+    height: 100%;
+}
+
+.resource-cookies-view .data-grid .row-group {
+    font-weight: bold;
+    font-size: 11px;
+}
+
+.resource-timing-view {
+    display: none;
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 0;
+    bottom: 0;
+    padding: 6px;
+    font-weight: bold;
+    font-size: 11px;
+    color: rgb(30%, 30%, 30%);
+}
+
+.resource-timing-view table {
+    border-spacing: 21px 0;
+}
+
+.resource-timing-view .network-timing-bar {
+    opacity: 1;
+}
+
+.resource-timing-view .network-timing-bar.proxy {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(239, 228, 176)), to(rgb(139, 128, 76)));
+    border-left: 1px solid rgb(139, 128, 76);
+}
+
+.resource-timing-view .network-timing-bar.dns {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(153, 208, 216)), to(rgb(81, 174, 189)));
+    border-left: 1px solid rgb(81, 174, 189);
+}
+
+.resource-timing-view .network-timing-bar.connecting {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(203, 232, 145)), to(rgb(160, 214, 56)));
+    border-left: 1px solid rgb(160, 214, 56);
+}
+
+.resource-timing-view .network-timing-bar.ssl {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(21, 232, 145)), to(rgb(216, 149, 132)));
+    border-left: 1px solid rgb(216, 149, 132);
+}
+
+.resource-timing-view .network-timing-bar.sending {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(232, 192, 182)), to(rgb(216, 147, 130)));
+    border-left: 1px solid rgb(216, 147, 130);
+}
+
+.resource-timing-view .network-timing-bar.waiting {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(188, 179, 208)), to(rgb(141, 125, 175)));
+    border-left: 1px solid rgb(141, 125, 175);
+}
+
+.resource-timing-view .network-timing-bar.receiving {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(214, 214, 214)), to(rgb(182, 182, 182)));
+    border-left: 1px solid rgb(182, 182, 182);
+}
+
+.resource-timing-view.visible {
+    display: block;
+}
+
+/* helpScreen.css */
+
+.help-window-outer {
+    position: absolute;
+    top: 60px;
+    left: 5%;
+    width: 90%;
+    bottom: 40px;
+    z-index: 2000;
+}
+
+body.attached .help-window-outer {
+    top: 32px;
+    left: 0;
+    width: 100%;
+    bottom: 24px;
+}
+
+.help-window-main {
+    max-height: 100%;
+    opacity: 0.85;
+    color: white;
+    background-color: black;
+    display: -webkit-box;
+    -webkit-box-orient: vertical;
+    border: 20px black solid;
+    border-top-width: 0;
+    border-radius: 8px;
+    -webkit-box-shadow: 10px 10px 8px rgba(40, 40, 40, 0.40);
+}
+
+body.attached .help-window-main {
+    border-width: 10px;
+    border-radius: 0;
+    -webkit-box-shadow: 0 0 0;
+}
+
+.help-window-caption {
+    margin: 8px;
+}
+
+body.attached .help-window-caption {
+    display: none;
+}
+
+.help-window-title {
+    border-bottom: solid 1px lightGrey;
+    font-size: 18px;
+    padding-bottom: 6px;
+}
+
+.help-content {
+    overflow-y: auto;
+    overflow-x: hidden;
+    scrollbar-width: 11px;
+    -webkit-box-flex: 1;
+}
+
+.help-content::-webkit-scrollbar {
+    width: 11px;
+}
+
+.help-content::-webkit-scrollbar-corner,
+.help-content::-webkit-resizer {
+    display: none;
+}
+
+.help-content::-webkit-scrollbar-thumb:vertical {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(128, 128, 128)), to(rgb(128, 128, 128)), color-stop(40%, rgb(96, 96, 96)));
+    border-radius: 5px;
+    min-height: 20px;
+}
+
+.help-content::-webkit-scrollbar-thumb:vertical:hover,
+.help-content::-webkit-scrollbar-thumb:vertical:active {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(176, 176, 176)), to(rgb(176, 176, 176)), color-stop(40%, rgb(144, 144, 144)));
+}
+
+.help-content::-webkit-scrollbar-track:vertical {
+    background: -webkit-gradient(linear, left top, right top, from(rgb(10, 10, 10)), to(rgb(32, 32, 32)), color-stop(25%, rgb(32, 32, 32)));
+    border-radius: 5px;
+}
+
+.help-close-button {
+    border: 0;
+    padding: 0;
+    margin: 0px -20px 15px -20px;
+    font-size: 14px;
+    color: rgb(222, 222, 222);
+    background: -webkit-gradient(radial, 30% 30%, 1, 50% 50%, 8, from(rgb(128, 128, 128)), to(rgb(80, 80, 80)));
+    border-radius: 8px;
+    height: 16px;
+    width: 16px;
+}
+
+.help-close-button:hover {
+    color: white;
+}
+
+body.platform-mac .help-close-button {
+    float: left;
+    margin-right: 10px;
+    font-size: 12px;
+}
+
+body:not(.platform-mac) .help-close-button {
+    float: right;
+}
+
+.help-table {
+    width: 100%;
+    font-size: 13px;
+    -webkit-user-select: auto;
+}
+
+.help-table th {
+    padding-top: 6px;
+    text-align: left;
+    color: yellow;
+}
+
+.help-table td {
+    white-space: nowrap;
+    vertical-align: top;
+}
+
+.help-key-cell {
+    text-align: right;
+}
+
+.help-key {
+    color: yellow;
+}
+
+body:not(.platform-mac) .help-key {
+    font-weight: bold;
+    text-shadow: black 1px 1px 7px;
+}
+
+body.platform-mac .help-key {
+    font-family: Lucida Grande, sans-serif;
+    font-size: 13px;
+}
+
+.help-combine-keys {
+    color: white;
+    font-weight: bold;
+    margin: 0 0.3em;
+    font-size: 12px;
+}
+
+.help-key-delimiter {
+    color: white;
+    margin: 0 0.5em;
+}
+
+/* popover.css */
+
+.popover {
+    position: absolute;
+    -webkit-border-image: url(Images/popoverBackground.png) 25 25 25 25;
+    border-width: 25px;
+    z-index: 100;
+    pointer-events: none;
+}
+
+.popover .content {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    pointer-events: auto;
+    overflow: auto;
+}
+
+.popover .arrow {
+    position: absolute;
+    background-image: url(Images/popoverArrows.png);
+    width: 19px;
+    height: 19px;
+    margin-left: 15px;
+    margin-top: -25px;
+    top: 0;
+    left: 0;
+}
+
+.popover.top-left-arrow .arrow {
+    /* The default is top-left, no styles needed. */
+}
+
+.popover.top-right-arrow .arrow {
+    right: 25px;
+    left: auto;
+}
+
+.popover.bottom-left-arrow .arrow {
+    top: auto;
+    bottom: 0;
+    margin-top: 0;
+    margin-bottom: -25px;
+    background-position: 0 -19px;
+}
+
+.popover.bottom-right-arrow .arrow {
+    right: 15px;
+    left: auto;
+    top: auto;
+    bottom: 0;
+    margin-top: 0;
+    margin-bottom: -25px;
+    background-position: 0 -19px;
+}
+
+.popover.left-top-arrow .arrow {
+    top: 0;
+    margin-top: 15px;
+    margin-left: -25px;
+    background-position: 0 -38px;
+}
+
+.popover.left-bottom-arrow .arrow {
+    top: auto;
+    bottom: 0;
+    margin-bottom: 15px;
+    margin-left: -25px;
+    background-position: 0 -38px;
+}
+
+.popover.right-top-arrow .arrow {
+    right: 0;
+    left: auto;
+    top: 0;
+    margin-top: 15px;
+    margin-right: -25px;
+    background-position: 0 -57px;
+}
+
+.popover.right-bottom-arrow .arrow {
+    right: 0;
+    left: auto;
+    top: auto;
+    bottom: 0;
+    margin-bottom: 15px;
+    margin-right: -25px;
+    background-position: 0 -57px;
+}
+
+.popover ::-webkit-scrollbar {
+    width: 11px;
+    height: 11px;
+}
+
+.popover ::-webkit-scrollbar-corner {
+    display: none;
+}
+
+.popover ::-webkit-resizer {
+    display: none;
+}
+
+/* Horizontal Scrollbar Styles */
+
+.popover ::-webkit-scrollbar:horizontal:corner-present {
+    border-right-width: 0;
+}
+
+.popover ::-webkit-scrollbar-thumb:horizontal {
+    -webkit-border-image: url(Images/thumbHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 11px;
+    min-width: 20px;
+}
+
+.popover ::-webkit-scrollbar-thumb:horizontal:hover {
+    -webkit-border-image: url(Images/thumbHoverHoriz.png) 0 11 0 11;
+}
+
+.popover ::-webkit-scrollbar-thumb:horizontal:active {
+    -webkit-border-image: url(Images/thumbActiveHoriz.png) 0 11 0 11;
+}
+
+.popover ::-webkit-scrollbar-track-piece:horizontal:start {
+    margin-left: 5px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:horizontal:end {
+    margin-right: 5px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:horizontal:end:corner-present {
+    margin-right: 4px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:horizontal:decrement {
+    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 0 0 11px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:horizontal:increment {
+    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
+    border-color: transparent;
+    border-width: 0 11px 0 0;
+}
+
+/* Vertical Scrollbar Styles */
+
+
+.popover ::-webkit-scrollbar:vertical:corner-present {
+    border-bottom-width: 0;
+}
+
+.popover ::-webkit-scrollbar-thumb:vertical {
+    -webkit-border-image: url(Images/thumbVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 11px 0;
+    min-height: 20px;
+}
+
+.popover ::-webkit-scrollbar-thumb:vertical:hover {
+    -webkit-border-image: url(Images/thumbHoverVert.png) 11 0 11 0;
+}
+
+.popover ::-webkit-scrollbar-thumb:vertical:active {
+    -webkit-border-image: url(Images/thumbActiveVert.png) 11 0 11 0;
+}
+
+
+.popover ::-webkit-scrollbar-track-piece:vertical:start {
+    margin-top: 5px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:vertical:end {
+    margin-bottom: 5px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:vertical:end:corner-present {
+    margin-bottom: 4px;
+}
+
+.popover ::-webkit-scrollbar-track-piece:vertical:decrement {
+    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 11px 0 0 0;
+}
+
+.popover ::-webkit-scrollbar-track-piece:vertical:increment {
+    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
+    border-color: transparent;
+    border-width: 0 0 11px 0;
+}
+
+/* Forced Scrollbar Mode Styles */
+
+.popover ::-webkit-scrollbar-button {
+    display: none;
+}
+
+/* textViewer.css */
+
+.text-editor {
+    position: absolute;
+    top:0;
+    left:0;
+    right:0;
+    bottom:0;
+    white-space: pre;
+    overflow: auto;
+}
+
+.text-editor-lines {
+    border: 0;
+    -webkit-border-horizontal-spacing: 0;
+    -webkit-border-vertical-spacing: 0;
+    -webkit-user-select: text;
+}
+
+.webkit-html-message-bubble {
+    -webkit-box-shadow: black 0px 2px 5px;
+    -webkit-border-radius: 9px;
+    -webkit-border-fit: lines;
+    font-size: 10px;
+    font-family: Lucida Grande, sans-serif;
+    font-weight: bold;
+    margin: 6px 25px;
+    padding: 0 7px 1px;
+    z-index:20;
+}
+
+.webkit-html-warning-message {
+    background-color: rgb(100%, 62%, 42%);
+    border: 2px solid rgb(100%, 52%, 21%);
+}
+
+.webkit-html-error-message {
+    background-color: rgb(100%, 42%, 42%);
+    border: 2px solid rgb(100%, 31%, 31%);
+}
+
+.webkit-html-message-line {
+    padding-left: 23px;
+    text-indent: -20px;
+}
+
+.webkit-html-message-line-hover {
+    padding-left: 23px;
+    text-indent: -20px;
+    white-space: auto;
+    text-overflow: auto;
+    overflow: auto;
+}
+
+.webkit-html-message-icon {
+    position: relative;
+    top: 2px;
+    margin: 0 4px;
+}
+
+.webkit-line-number {
+    color: rgb(128, 128, 128);
+    background-color: rgb(240, 240, 240);
+    border-right: 1px solid rgb(187, 187, 187);
+    text-align: right;
+    vertical-align: top;
+    word-break: normal;
+    -webkit-user-select: none;
+    padding-right: 4px;
+    padding-left: 6px;
+}
+
+.webkit-line-number-outer {
+    margin-right: -4px;
+    margin-left: -4px;
+    border-color: transparent;
+    border-style: solid;
+    border-width: 0 0 0px 2px;
+    vertical-align: top;
+}
+
+.webkit-line-number-inner {
+    margin-right: 4px;
+}
+
+.webkit-breakpoint .webkit-line-number-inner, .webkit-breakpoint-conditional .webkit-line-number-inner, .webkit-execution-line .webkit-line-number-inner {
+    margin-right: -10px;
+}
+
+.webkit-line-content {
+    width: 100%;
+    padding-left: 2px;
+    vertical-align: top;
+}
+
+.webkit-breakpoint .webkit-line-number-outer {
+    color: white;
+    border-width: 0 14px 0px 2px;
+    -webkit-border-image: url(Images/breakpointBorder.png) 0 14 0 2;
+}
+
+.webkit-breakpoint-conditional .webkit-line-number-outer {
+    color: white;
+    border-width: 0 14px 0px 2px;
+    -webkit-border-image: url(Images/breakpointConditionalBorder.png) 0 14 0 2;
+}
+
+.webkit-execution-line .webkit-line-number-outer {
+    color: transparent;
+    border-width: 0 14px 0px 2px;
+    -webkit-border-image: url(Images/programCounterBorder.png) 0 14 0 2;
+}
+
+.webkit-breakpoint.webkit-execution-line .webkit-line-number-outer {
+    color: white;
+    -webkit-border-image: url(Images/breakpointCounterBorder.png) 0 14 0 2;
+}
+
+.webkit-breakpoint.webkit-execution-line .webkit-line-number-outer {
+    color: transparent;
+    -webkit-border-image: url(Images/breakpointCounterBorder.png) 0 14 0 2;
+}
+
+.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number-outer {
+    color: transparent;
+    -webkit-border-image: url(Images/breakpointConditionalCounterBorder.png) 0 14 0 2;
+}
+
+.webkit-breakpoint-disabled .webkit-line-number-outer {
+    opacity: 0.5;
+}
+
+.breakpoints-deactivated .webkit-breakpoint .webkit-line-number-outer {
+    opacity: 0.5;
+}
+
+.breakpoints-deactivated .webkit-breakpoint-disabled .webkit-line-number-outer {
+    opacity: 0.3;
+}
+
+.webkit-execution-line .webkit-line-content {
+    background-color: rgb(171, 191, 254);
+    outline: 1px solid rgb(64, 115, 244);
+}
+
+.diff-container .webkit-added-line .webkit-line-content {
+    background-color: rgb(220, 255, 220);
+}
+
+.diff-container .webkit-removed-line .webkit-line-content {
+    background-color: rgb(255, 220, 220);
+    text-decoration: line-through;
+}
+
+.diff-container .webkit-changed-line .webkit-line-content {
+    background-color: rgb(220, 220, 255);
+}
+
+.webkit-search-result {
+    -webkit-border-radius: 4px;
+    padding: 2px 2px 2px 3px;
+    margin: -2px -2px -2px -3px;
+    opacity: 0.8;
+    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
+    background-color: rgb(241, 234, 0);
+    color: black;
+}
+
+.webkit-highlighted-line .webkit-line-content {
+    -webkit-animation: "fadeout" 2s 0s;
+}
+
+@-webkit-keyframes fadeout {
+    from {background-color: rgb(255, 255, 120); }
+    to { background-color: white; }
+}
+
+/* devTools.css */
+
+.data-grid table {
+    line-height: 120%;
+}
+
+body.attached #toolbar {
+    height: 34px;
+    border-top: 1px solid rgb(100, 100, 100);
+    cursor: default; /* overriden */
+    padding-left: 0;
+}
+
+/* Chrome theme overrides */
+
+body.platform-windows #toolbar, body.platform-windows.inactive #toolbar {
+    background-image: none;
+}
+
+body.detached.platform-mac-leopard #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(175, 175, 175)), to(rgb(151, 151, 151))) !important;
+}
+
+body.detached.platform-mac-leopard.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(221, 221, 221)), to(rgb(207, 207, 207))) !important;
+}
+
+body.detached.platform-mac-snowleopard #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(189, 189, 189)), to(rgb(151, 151, 151))) !important;
+}
+
+body.detached.platform-mac-snowleopard.inactive #toolbar {
+    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(215, 215, 215)), to(rgb(207, 207, 207))) !important;
+}
+
+body.platform-linux #scripts-files {
+    font-size: 11px;
+    font-weight: normal;
+    line-height: 12px;
+}
+
+.console-group-messages .section > .header {
+    padding: 0 8px 0 0;
+    background-image: none;
+    border: none;
+    min-height: 0;
+}
+
+#resources-filter {
     background: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(233, 233, 233)));
 }
 
-body.platform-windows .crumbs .crumb {
+.crumbs .crumb {
     -webkit-border-image: url(Images/segmentChromium.png) 0 12 0 2;
+    margin-right: -3px;
+    padding-left: 6px;
 }
 
-body.platform-windows .crumbs .crumb.end {
-    -webkit-border-image: url(Images/segmentEndChromium.png) 0 2 0 2;
-}
-
-body.platform-windows .crumbs .crumb.selected {
+.crumbs .crumb.selected {
     -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
     color: white;
     text-shadow: rgba(255, 255, 255, 0.5) 0 0px 0;
 }
 
-body.platform-windows .crumbs .crumb.selected:hover {
+.crumbs .crumb.selected:hover {
     -webkit-border-image: url(Images/segmentSelectedChromium.png) 0 12 0 2;
 }
 
-body.platform-windows .crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
+.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
     -webkit-border-image: url(Images/segmentSelectedEndChromium.png) 0 2 0 2;
 }
 
-body.platform-windows .crumbs .crumb:hover {
+.crumbs .crumb:hover {
     -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
 }
 
-body.platform-windows .crumbs .crumb.dimmed:hover {
+.crumbs .crumb.dimmed:hover {
     -webkit-border-image: url(Images/segmentHoverChromium.png) 0 12 0 2;
 }
 
-body.platform-windows .crumbs .crumb.end:hover {
+.crumbs .crumb.end:hover {
     -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2;
 }
 
-body.platform-windows body.drawer-visible #main-status-bar {
+body.drawer-visible #main-status-bar {
     background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png);
 }
 
-body.platform-windows .status-bar {
+.status-bar {
     background-image: url(Images/statusbarBackgroundChromium.png);
 }
 
-body.platform-windows button.status-bar-item {
+button.status-bar-item {
     background-image: url(Images/statusbarButtonsChromium.png);
 }
 
-body.platform-windows select.status-bar-item:active {
+select.status-bar-item:active {
     -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2;
 }
 
-body.platform-windows #drawer {
+#drawer {
     background-image: url(Images/statusbarBottomBackgroundChromium.png);
 }
 
-body.platform-windows select.status-bar-item {
+select.status-bar-item {
     -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2;
 }
 
@@ -233,6 +6360,7 @@
     -webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0);
 }
 
-.timeline-category-tree-item input {
+.timeline-category-statusbar-item input {
     vertical-align: middle;
 }
+
diff --git a/resources/inspector/devtools.html b/resources/inspector/devtools.html
index 6c8e28e..e841433 100644
--- a/resources/inspector/devtools.html
+++ b/resources/inspector/devtools.html
@@ -29,118 +29,8 @@
 <html>
 <head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8">
-    <link rel="stylesheet" type="text/css" href="audits.css">
-    <link rel="stylesheet" type="text/css" href="inspector.css">
-    <link rel="stylesheet" type="text/css" href="inspectorSyntaxHighlight.css">
-    <link rel="stylesheet" type="text/css" href="popover.css">
-    <link rel="stylesheet" type="text/css" href="textViewer.css">
-    <script type="text/javascript" src="utilities.js"></script>
-    <script type="text/javascript" src="treeoutline.js"></script>
-    <script type="text/javascript" src="inspector.js"></script>
-    <script type="text/javascript" src="InspectorBackendStub.js"></script>
-    <script type="text/javascript" src="InspectorFrontendHostStub.js"></script>
-    <script type="text/javascript" src="Object.js"></script>
-    <script type="text/javascript" src="Settings.js"></script>
-    <script type="text/javascript" src="ContextMenu.js"></script>
-    <script type="text/javascript" src="KeyboardShortcut.js"></script>
-    <script type="text/javascript" src="TextPrompt.js"></script>
-    <script type="text/javascript" src="Popover.js"></script>
-    <script type="text/javascript" src="Placard.js"></script>
-    <script type="text/javascript" src="View.js"></script>
-    <script type="text/javascript" src="Callback.js"></script>
-    <script type="text/javascript" src="Drawer.js"></script>
-    <script type="text/javascript" src="ChangesView.js"></script>
-    <script type="text/javascript" src="ConsoleView.js"></script>
-    <script type="text/javascript" src="Panel.js"></script>
-    <script type="text/javascript" src="TimelineGrid.js"></script>    
-    <script type="text/javascript" src="AbstractTimelinePanel.js"></script>
-    <script type="text/javascript" src="Resource.js"></script>
-    <script type="text/javascript" src="ResourceCategory.js"></script>
-    <script type="text/javascript" src="Database.js"></script>
-    <script type="text/javascript" src="DOMStorage.js"></script>
-    <script type="text/javascript" src="DOMStorageItemsView.js"></script>
-    <script type="text/javascript" src="DataGrid.js"></script>
-    <script type="text/javascript" src="CookieItemsView.js"></script>
-    <script type="text/javascript" src="Script.js"></script>
-    <script type="text/javascript" src="Breakpoint.js"></script>
-    <script type="text/javascript" src="SidebarPane.js"></script>
-    <script type="text/javascript" src="ElementsTreeOutline.js"></script>
-    <script type="text/javascript" src="SidebarTreeElement.js"></script>
-    <script type="text/javascript" src="Section.js"></script>
-    <script type="text/javascript" src="PropertiesSection.js"></script>
-    <script type="text/javascript" src="ObjectProxy.js"></script>
-    <script type="text/javascript" src="ObjectPropertiesSection.js"></script>
-    <script type="text/javascript" src="BreakpointsSidebarPane.js"></script>
-    <script type="text/javascript" src="CallStackSidebarPane.js"></script>
-    <script type="text/javascript" src="ScopeChainSidebarPane.js"></script>
-    <script type="text/javascript" src="WatchExpressionsSidebarPane.js"></script>
-    <script type="text/javascript" src="MetricsSidebarPane.js"></script>
-    <script type="text/javascript" src="PropertiesSidebarPane.js"></script>
-    <script type="text/javascript" src="EventListenersSidebarPane.js"></script>
-    <script type="text/javascript" src="Color.js"></script>
-    <script type="text/javascript" src="StylesSidebarPane.js"></script>
-    <script type="text/javascript" src="PanelEnablerView.js"></script>
-    <script type="text/javascript" src="WelcomeView.js"></script>
-    <script type="text/javascript" src="StatusBarButton.js"></script>
-    <script type="text/javascript" src="SummaryBar.js"></script>
-    <script type="text/javascript" src="ElementsPanel.js"></script>
-    <script type="text/javascript" src="ResourcesPanel.js"></script>
-    <script type="text/javascript" src="InjectedFakeWorker.js"></script>
-    <script type="text/javascript" src="ScriptsPanel.js"></script>
-    <script type="text/javascript" src="StoragePanel.js"></script>
-    <script type="text/javascript" src="ProfilesPanel.js"></script>
-    <script type="text/javascript" src="ConsolePanel.js"></script>
-    <script type="text/javascript" src="AuditsPanel.js"></script>
-    <script type="text/javascript" src="AuditResultView.js"></script>
-    <script type="text/javascript" src="AuditLauncherView.js"></script>
-    <script type="text/javascript" src="AuditRules.js"></script>
-    <script type="text/javascript" src="AuditCategories.js"></script>
-    <script type="text/javascript" src="ResourceView.js"></script>
-    <script type="text/javascript" src="SourceFrame.js"></script>
-    <script type="text/javascript" src="DOMSyntaxHighlighter.js"></script>
-    <script type="text/javascript" src="TextEditorModel.js"></script>
-    <script type="text/javascript" src="TextEditorHighlighter.js"></script>
-    <script type="text/javascript" src="TextViewer.js"></script>
-    <script type="text/javascript" src="SourceTokenizer.js"></script>
-    <script type="text/javascript" src="SourceCSSTokenizer.js"></script>
-    <script type="text/javascript" src="SourceHTMLTokenizer.js"></script>
-    <script type="text/javascript" src="SourceJavaScriptTokenizer.js"></script>
-    <script type="text/javascript" src="SourceView.js"></script>
-    <script type="text/javascript" src="FontView.js"></script>
-    <script type="text/javascript" src="ImageView.js"></script>
-    <script type="text/javascript" src="DatabaseTableView.js"></script>
-    <script type="text/javascript" src="DatabaseQueryView.js"></script>
-    <script type="text/javascript" src="ScriptView.js"></script>
-    <script type="text/javascript" src="ProfileDataGridTree.js"></script>
-    <script type="text/javascript" src="BottomUpProfileDataGridTree.js"></script>
-    <script type="text/javascript" src="TopDownProfileDataGridTree.js"></script>
-    <script type="text/javascript" src="ProfileView.js"></script>
-    <script type="text/javascript" src="DOMAgent.js"></script>
-    <script type="text/javascript" src="InjectedScript.js"></script>
-    <script type="text/javascript" src="InjectedScriptAccess.js"></script>
-    <script type="text/javascript" src="TimelineAgent.js"></script>
-    <script type="text/javascript" src="TimelinePanel.js"></script>
-    <script type="text/javascript" src="TimelineOverviewPane.js"></script>
-    <script type="text/javascript" src="TestController.js"></script>
-
-    <!-- The following lines are added to include DevTools resources -->
     <link rel="stylesheet" type="text/css" href="devTools.css">
-    <script type="text/javascript" src="codemap.js"></script>
-    <script type="text/javascript" src="consarray.js"></script>
-    <script type="text/javascript" src="csvparser.js"></script>
-    <script type="text/javascript" src="logreader.js"></script>
-    <script type="text/javascript" src="profile.js"></script>
-    <script type="text/javascript" src="profile_view.js"></script>
-    <script type="text/javascript" src="splaytree.js"></script>
-    <script type="text/javascript" src="InspectorControllerImpl.js"></script>
-    <script type="text/javascript" src="DebuggerAgent.js"></script>
-    <script type="text/javascript" src="ProfilerAgent.js"></script>
-    <script type="text/javascript" src="ProfilerProcessor.js"></script>
-    <script type="text/javascript" src="HeapProfilerPanel.js"></script>
     <script type="text/javascript" src="DevTools.js"></script>
-    <script type="text/javascript" src="DevToolsHostStub.js"></script>
-    <script type="text/javascript" src="Tests.js"></script>
-    <!-- End of auto-added files list -->
 </head>
 <body class="detached">
     <div id="toolbar">
@@ -152,11 +42,11 @@
     </div>
     <div id="main">
         <div id="main-panels" spellcheck="false"></div>
-        <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><button id="dock-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="changes-status-bar-item" class="status-bar-item hidden"></button><div id="count-items"><div id="changes-count" class="hidden"></div><div id="error-warning-count" class="hidden"></div></div></div></div>
+        <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><button id="dock-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="changes-status-bar-item" class="status-bar-item hidden"></button><div id="counters"><div id="changes-count" class="hidden"></div><div id="error-warning-count" class="hidden"></div></div></div></div>
     </div>
     <div id="drawer">
         <div id="console-view"><div id="console-messages" class="monospace"><div id="console-prompt" spellcheck="false"><br></div></div></div>
-        <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="scope-bar status-bar-item"></div></div></div>
+        <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item clear-status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="scope-bar status-bar-item"></div></div></div>
     </div>
 </body>
 </html>
diff --git a/resources/inspector/inspector.css b/resources/inspector/inspector.css
deleted file mode 100644
index 870e509..0000000
--- a/resources/inspector/inspector.css
+++ /dev/null
@@ -1,3883 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2009 Anthony Ricaud <rik@webkit.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-body {
-    cursor: default;
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    overflow: hidden;
-    font-family: Lucida Grande, sans-serif;
-    font-size: 10px;
-    margin: 0;
-    -webkit-text-size-adjust: none;
-    -webkit-user-select: none;
-}
-
-* {
-    -webkit-box-sizing: border-box;
-}
-
-:focus {
-    outline: none;
-}
-
-input[type="search"]:focus, input[type="text"]:focus {
-    outline: auto 5px -webkit-focus-ring-color;
-}
-
-iframe, a img {
-    border: none;
-}
-
-img {
-    -webkit-user-drag: none;
-}
-
-.hidden {
-    display: none !important;
-}
-
-#toolbar {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    height: 56px;
-    display: -webkit-box;
-    padding: 0 5px;
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151)));
-    border-bottom: 1px solid rgb(80, 80, 80);
-    -webkit-box-orient: horizontal;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-body.inactive #toolbar {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(233, 233, 233)), to(rgb(207, 207, 207)));
-    border-bottom: 1px solid rgb(64%, 64%, 64%);
-}
-
-body.detached.platform-mac-leopard #toolbar,
-body.detached.platform-mac-snowleopard #toolbar {
-    background: transparent !important;
-}
-
-body.attached #toolbar {
-    height: 34px;
-    border-top: 1px solid rgb(100, 100, 100);
-    cursor: row-resize;
-    padding-left: 0;
-}
-
-body.attached.port-qt #toolbar {
-    cursor: auto;
-}
-
-body.attached.inactive #toolbar {
-    border-top: 1px solid rgb(64%, 64%, 64%);
-}
-
-.toolbar-item {
-    display: -webkit-box;
-    padding: 4px 6px;
-    margin: 0;
-    background-color: transparent;
-    border-style: none;
-    border-color: transparent;
-    -webkit-box-orient: vertical;
-    -webkit-box-align: center;
-    -webkit-box-pack: end;
-}
-
-.toolbar-item.toggleable.toggled-on {
-    border-width: 0 2px 0 2px;
-    padding: 4px 4px;
-    -webkit-border-image: url(Images/toolbarItemSelected.png) 0 2 0 2;
-}
-
-.toolbar-item.flexable-space {
-    -webkit-box-flex: 1;
-    visibility: hidden;
-}
-
-.toolbar-item input {
-    margin-bottom: 8px;
-}
-
-.toolbar-icon {
-    display: inline-block;
-    width: 32px;
-    height: 32px;
-    -webkit-background-size: 100% auto;
-}
-
-body.attached .toolbar-icon {
-    width: 24px;
-    height: 24px;
-    vertical-align: middle;
-}
-
-.toolbar-item:active .toolbar-icon {
-    background-position: 0 32px;
-}
-
-body.attached .toolbar-item:active .toolbar-icon {
-    background-position: 0 24px;
-}
-
-.toolbar-label {
-    font-size: 11px;
-    font-family: Lucida Grande, sans-serif;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-}
-
-.toolbar-item.toggleable:active .toolbar-label {
-    text-shadow: none;
-}
-
-body.attached .toolbar-label {
-    display: inline-block;
-    vertical-align: middle;
-    margin-left: 3px;
-}
-
-body.attached #search-toolbar-label {
-    display: none;
-}
-
-#search {
-    width: 205px;
-    font-size: 16px;
-    margin-bottom: 5px;
-}
-
-body.attached #search {
-    font-size: 11px;
-    margin-bottom: 8px;
-}
-
-#search-results-matches {
-    font-size: 11px;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-    margin-bottom: 22px;
-}
-
-body.attached #search-results-matches {
-    margin-bottom: 6px;
-}
-
-.toolbar-item.elements .toolbar-icon {
-    background-image: url(Images/elementsIcon.png);
-}
-
-.toolbar-item.resources .toolbar-icon {
-    background-image: url(Images/resourcesIcon.png);
-}
-
-.toolbar-item.scripts .toolbar-icon {
-    background-image: url(Images/scriptsIcon.png);
-}
-
-.toolbar-item.timeline .toolbar-icon {
-    background-image: url(Images/timelineIcon.png);
-}
-
-.toolbar-item.storage .toolbar-icon {
-    background-image: url(Images/storageIcon.png);
-}
-
-.toolbar-item.profiles .toolbar-icon {
-    background-image: url(Images/profilesIcon.png);
-}
-
-.toolbar-item.console .toolbar-icon {
-    background-image: url(Images/consoleIcon.png);
-}
-
-#close-button-left, #close-button-right {
-    width: 14px;
-    height: 14px;
-    background-image: url(Images/closeButtons.png);
-    background-position: 0 0;
-    background-color: transparent;
-    border: 0 none transparent;
-    margin: 5px 0;
-}
-
-#close-button-left:hover, #close-button-right:hover {
-    background-position: 14px 0;
-}
-
-#close-button-left:active, #close-button-right:active {
-    background-position: 28px 0;
-}
-
-body.detached .toolbar-item.close-left, body.detached .toolbar-item.close-right {
-    display: none;
-}
-
-body.attached.port-qt .toolbar-item.close-left, body.attached.port-qt .toolbar-item.close-right {
-    display: none;
-}
-
-body.platform-mac .toolbar-item.close-right {
-    display: none;
-}
-
-body:not(.platform-mac) .toolbar-item.close-left {
-    display: none;
-}
-
-#main {
-    position: absolute;
-    z-index: 1;
-    top: 56px;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    overflow: hidden;
-    background-color: white;
-}
-
-body.attached #main {
-    top: 34px;
-}
-
-#main-panels {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 23px;
-    overflow: hidden;
-}
-
-#main-status-bar {
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-
-body.drawer-visible #main-status-bar {
-    height: 24px;
-    background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackground.png);
-    background-repeat: no-repeat, repeat-x;
-    background-position: right center, center;
-    cursor: row-resize;
-}
-
-body.drawer-visible #main-status-bar * {
-    cursor: default;
-}
-
-body.drawer-visible #main-panels {
-    bottom: 24px;
-}
-
-.status-bar {
-    background-color: rgb(235, 235, 235);
-    background-image: url(Images/statusbarBackground.png);
-    background-repeat: repeat-x;
-    white-space: nowrap;
-    height: 23px;
-    overflow: hidden;
-    z-index: 12;
-}
-
-.status-bar > div {
-    display: inline-block;
-    vertical-align: top;
-}
-
-.status-bar-item {
-    display: inline-block;
-    height: 24px;
-    padding: 0;
-    margin-left: -1px;
-    margin-right: 0;
-    vertical-align: top;
-    border: 0 transparent none;
-    background-color: transparent;
-}
-
-.status-bar-item:active {
-    position: relative;
-    z-index: 200;
-}
-
-.glyph {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    background-color: rgba(0, 0, 0, 0.75);
-    z-index: 1;
-}
-
-.glyph.shadow {
-    top: 1px;
-    background-color: white !important;
-    z-index: 0;
-}
-
-button.status-bar-item {
-    position: relative;
-    width: 32px;
-    background-image: url(Images/statusbarButtons.png);
-    background-position: 0 0;
-}
-
-button.status-bar-item:active {
-    background-position: 32px 0 !important;
-}
-
-button.status-bar-item .glyph.shadow {
-    background-color: rgba(255, 255, 255, 0.33) !important;
-}
-
-button.status-bar-item.toggled-on .glyph {
-    background-color: rgb(66, 129, 235);
-}
-
-button.status-bar-item.toggled-1 .glyph {
-    background-color: rgb(66, 129, 235);
-}
-
-button.status-bar-item.toggled-2 .glyph {
-    background-color: purple;   
-}
-
-button.status-bar-item:disabled {
-    opacity: 0.5;
-    background-position: 0 0 !important;
-}
-
-select.status-bar-item {
-    min-width: 48px;
-    border-width: 0 17px 0 2px;
-    padding: 0 2px 0 6px;
-    font-weight: bold;
-    color: rgb(48, 48, 48);
-    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
-    -webkit-border-image: url(Images/statusbarMenuButton.png) 0 17 0 2;
-    -webkit-border-radius: 0;
-    -webkit-appearance: none;
-}
-
-select.status-bar-item:active {
-    color: black;
-    -webkit-border-image: url(Images/statusbarMenuButtonSelected.png) 0 17 0 2;
-}
-
-#dock-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/undockButtonGlyph.png);
-}
-
-body.detached #dock-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/dockButtonGlyph.png);
-}
-
-body.port-qt #dock-status-bar-item {
-    display: none
-}
-
-#console-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/consoleButtonGlyph.png);
-}
-
-#clear-console-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);
-}
-
-#changes-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/consoleButtonGlyph.png); /* TODO: Needs Image for Changes Toggle Button */
-}
-
-#clear-changes-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);
-}
-
-#count-items {
-    position: absolute;
-    right: 16px;
-    top: 0;
-    cursor: pointer;
-    padding: 6px 2px;
-    font-size: 10px;
-    height: 19px;
-}
-
-#changes-count, #error-warning-count {
-    display: inline;
-}
-
-#error-warning-count:hover, #changes-count:hover {
-    border-bottom: 1px solid rgb(96, 96, 96);
-}
-
-#style-changes-count::before {
-    content: url(Images/styleIcon.png); /* TODO: Needs Image for Style Changes Icon */
-    width: 10px;
-    height: 10px;
-    vertical-align: -1px;
-    margin-right: 2px;
-}
-
-#error-count::before {
-    content: url(Images/errorIcon.png);
-    width: 10px;
-    height: 10px;
-    vertical-align: -1px;
-    margin-right: 2px;
-}
-    
-#changes-count + #error-warning-count, #error-count + #warning-count {
-    margin-left: 6px;
-}
-
-#warning-count::before {
-    content: url(Images/warningIcon.png);
-    width: 10px;
-    height: 10px;
-    vertical-align: -1px;
-    margin-right: 2px;
-}
-
-#drawer {
-    display: none;
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    height: 200px;
-    background-color: white;
-    background-image: url(Images/statusbarBottomBackground.png);
-    background-repeat: repeat-x;
-    background-position: bottom;
-}
-
-body.drawer-visible #drawer {
-    display: block;
-}
-
-#drawer-status-bar {
-    position: absolute;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    background: none;
-}
-
-.monospace {
-    font-size: 10px;
-    font-family: monospace;
-}
-
-body.platform-mac .monospace, body.platform-mac .source-code {
-    font-family: Monaco, monospace;
-}
-
-/* Keep .platform-mac to make the rule more specific than the general one above. */
-body.platform-mac.platform-mac-snowleopard .monospace,
-body.platform-mac.platform-mac-snowleopard .source-code {
-    font-size: 11px;
-    font-family: Menlo, monospace;
-}
-
-body.platform-windows .monospace, body.platform-windows .source-code {
-    font-size: 12px;
-    font-family: Consolas, Lucida Console, monospace;
-}
-
-body.platform-linux .monospace, body.platform-linux .source-code {
-    font-size: 11px;
-    font-family: dejavu sans mono, monospace;
-}
-
-#console-messages {
-    position: absolute;
-    z-index: 0;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 23px;
-    padding: 2px 0;
-    overflow-y: overlay;
-    word-wrap: break-word;
-    -webkit-user-select: text;
-    -webkit-text-size-adjust: auto;
-}
-
-#console-prompt {
-    position: relative;
-    padding: 1px 22px 1px 24px;
-    min-height: 16px; 
-    white-space: pre-wrap;
-    -webkit-user-modify: read-write-plaintext-only;
-}
-
-#console-prompt::before {
-    background-image: url(Images/userInputIcon.png);
-}
-
-.console-user-command-result.console-log-level::before {
-    background-image: url(Images/userInputResultIcon.png);
-}
-
-.console-message, .console-user-command {
-    position: relative;
-    border-bottom: 1px solid rgb(240, 240, 240);
-    padding: 1px 22px 1px 24px;
-    min-height: 16px;
-}
-
-.console-adjacent-user-command-result {
-    border-bottom: none;
-}
-
-.console-adjacent-user-command-result + .console-user-command-result.console-log-level::before {
-    background-image: none;
-}
-
-.console-message::before, .console-user-command::before, #console-prompt::before, .console-group-title::before {
-    position: absolute;
-    display: block;
-    content: "";
-    left: 7px;
-    top: 0.8em;
-    width: 10px;
-    height: 10px;
-    margin-top: -5px;
-    -webkit-user-select: none;
-}
-
-.console-message .bubble {
-    display: inline-block;
-    height: 14px;
-    background-color: rgb(128, 151, 189);
-    vertical-align: middle;
-    white-space: nowrap;
-    padding: 1px 4px;
-    margin-top: -2px;
-    margin-right: 4px;
-    text-align: left;
-    font-size: 11px;
-    line-height: normal;
-    font-family: Helvetica, Arial, sans-serif;
-    font-weight: bold;
-    text-shadow: none;
-    color: white;
-    -webkit-border-radius: 7px;
-}
-
-.console-message-text {
-    white-space: pre-wrap;
-}
-
-.repeated-message {
-    padding-left: 6px;
-}
-
-.repeated-message.console-error-level::before, .repeated-message.console-warning-level:before, .repeated-message.console-debug-level:before {
-    visibility: hidden;
-}
-
-.console-group .console-group > .console-group-messages {
-    margin-left: 16px;
-}
-
-.console-group-title {
-    font-weight: bold;
-}
-
-.console-group-title::before {
-    background-image: url(Images/disclosureTriangleSmallDown.png);
-    top: 0.6em;
-    width: 11px;
-    height: 12px;
-}
-
-.console-group.collapsed .console-group-title::before {
-    background-image: url(Images/disclosureTriangleSmallRight.png);
-}
-
-.console-group.collapsed > .console-group-messages {
-    display: none;
-}
-
-.console-error-level .console-message-text {
-    color: red;
-}
-
-.console-debug-level .console-message-text {
-    color: blue;
-}
-
-.console-debug-level::before {
-    background-image: url(Images/searchSmallBrightBlue.png);
-}
-
-.console-error-level::before {
-    background-image: url(Images/errorIcon.png);
-}
-
-.console-warning-level::before {
-    background-image: url(Images/warningIcon.png);
-}
-
-.console-user-command .console-message {
-    margin-left: -24px;
-    padding-right: 0;
-    border-bottom: none;
-}
-
-.console-user-command::before {
-    background-image: url(Images/userInputPreviousIcon.png);
-}
-
-.console-user-command > .console-message-text {
-    color: rgb(0, 128, 255);
-}
-
-#console-messages a {
-    color: rgb(33%, 33%, 33%);
-    cursor: pointer;
-}
-
-#console-messages a:hover {
-    color: rgb(15%, 15%, 15%);
-}
-
-.console-message-url {
-    float: right;
-}
-
-.console-group-messages .section {
-    margin: 0 0 0 12px !important;
-}
-
-.console-group-messages .section .header {
-    padding: 0 8px 0 0;
-    background-image: none;
-    border: none;
-    min-height: 0;
-}
-
-.console-group-messages .section .header::before {
-    position: absolute;
-    top: 1px;
-    left: 1px;
-    width: 8px;
-    height: 8px;
-    content: url(Images/treeRightTriangleBlack.png);
-}
-
-.console-group-messages .section.expanded .header::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.console-group-messages .section .header .title {
-    color: black;
-    font-weight: normal;
-}
-
-.console-group-messages .section .properties li .info {
-    padding-top: 0;
-    padding-bottom: 0;
-    color: rgb(60%, 60%, 60%);
-}
-
-.console-group-messages .outline-disclosure {
-    padding-left: 0;
-}
-
-.console-group-messages .outline-disclosure > ol {
-    padding: 0 0 0 12px !important;
-}
-
-.console-group-messages .outline-disclosure, .console-group-messages .outline-disclosure ol {
-    font-size: inherit;
-    line-height: 12px;
-}
-
-.console-group-messages .outline-disclosure.single-node li {
-    padding-left: 2px;
-}
-
-.console-group-messages .outline-disclosure li .selection {
-    margin-left: -6px;
-    margin-right: -6px;
-}
-
-.console-group-messages .add-attribute {
-    display: none;
-}
-
-.console-formatted-object, .console-formatted-node {
-    position: relative;
-    display: inline-block;
-    vertical-align: top;
-}
-
-.console-formatted-object .section, .console-formatted-node .section {
-    position: static;
-}
-
-.console-formatted-object .properties, .console-formatted-node .properties {
-    padding-left: 0 !important;
-}
-
-.console-formatted-number {
-    color: rgb(28, 0, 207);
-}
-
-.console-formatted-string, .console-formatted-regexp {
-    color: rgb(196, 26, 22);
-}
-
-.console-formatted-null, .console-formatted-undefined {
-    color: rgb(128, 128, 128);
-}
-
-.error-message {
-    color: red;
-}
-
-.auto-complete-text {
-    color: rgb(128, 128, 128);
-    -webkit-user-select: none;
-    -webkit-user-modify: read-only;
-}
-
-.panel {
-    display: none;
-    overflow: hidden;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.panel.visible {
-    display: block;
-}
-
-.resource-view {
-    display: none;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.resource-view.visible {
-    display: block;
-}
-
-.resource-view .scope-bar {
-    display: none;
-    position: absolute;
-    height: 20px;
-    top: 0;
-    left: 0;
-    right: 0;
-    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
-    border-bottom: 1px solid rgb(163, 163, 163);
-}
-
-.resource-view.headers-visible .scope-bar {
-    display: block;
-}
-
-.resource-view .scope-bar li {
-    border-bottom-left-radius: 0;
-    border-bottom-right-radius: 0;
-}
-
-.resource-view-headers {
-    padding: 6px;
-    -webkit-user-select: text;    
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    overflow: auto;
-}
-
-.resource-view.headers-visible .resource-view-headers {
-    top: 20px;
-}
-
-.resource-view-headers .outline-disclosure .parent {
-    -webkit-user-select: none;
-    font-weight: bold;
-}
-
-.resource-view-headers .outline-disclosure .children li {
-    white-space: nowrap;
-}
-
-.resource-view-headers .outline-disclosure li.expanded .header-count {
-    display: none;
-}
-
-.resource-view-headers .outline-disclosure .header-name {
-    color: rgb(33%, 33%, 33%);
-    display: inline-block;
-    margin-right: 0.5em;
-    font-weight: bold;
-    vertical-align: top;
-    white-space: pre-wrap;
-}
-
-.resource-view-headers .outline-disclosure .header-value {
-    display: inline;
-    margin-right: 100px;
-    white-space: pre-wrap;
-    word-break: break-all;
-    margin-top: 1px;
-}
-
-.resource-view-headers .outline-disclosure .raw-form-data {
-    white-space:pre-wrap;
-}
-
-.resource-view .resource-view-content {
-    position: absolute;
-    top: 0;
-    right: 0;
-    left: 0;
-    bottom: 0;
-}
-
-.resource-view.headers-visible .resource-view-content {
-    top: 20px;
-}
-
-.webkit-line-gutter-backdrop {
-    /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */
-    width: 31px;
-    background-color: rgb(240, 240, 240);
-    border-right: 1px solid rgb(187, 187, 187);
-    position: absolute;
-    z-index: -1;
-    left: 0;
-    top: 0;
-    height: 100%
-}
-
-.resource-view.font .resource-view-content {
-    font-size: 60px;
-    white-space: pre-wrap;
-    word-wrap: break-word;
-    text-align: center;
-    padding: 15px;
-}
-
-.resource-view.image .resource-view-content > .image {
-    padding: 20px 20px 10px 20px;
-    text-align: center;
-}
-
-.resource-view.image .resource-view-content > .info {
-    padding-bottom: 10px;
-    font-size: 11px;
-    -webkit-user-select: text;
-}
-
-.resource-view.image img.resource-image-view {
-    max-width: 100%;
-    max-height: 1000px;
-    background-image: url(Images/checker.png);
-    -webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5);
-    -webkit-user-select: text;
-    -webkit-user-drag: auto;
-}
-
-.resource-url {
-    vertical-align: middle;
-}
-
-.resource-status-image {
-    margin-top: -3px;
-    vertical-align: middle;
-}
-
-.resource-view.image .title {
-    text-align: center;
-    font-size: 13px;
-}
-
-.resource-view.image .infoList {
-    margin: 0;
-}
-
-.resource-view.image .infoList dt {
-    font-weight: bold;
-    display: inline-block;
-    width: 50%;
-    text-align: right;
-    color: rgb(76, 76, 76);
-}
-
-.resource-view.image .infoList dd {
-    display: inline-block;
-    padding-left: 8px;
-    width: 50%;
-    text-align: left;
-    margin: 0;
-}
-
-.resource-view.image .infoList dd::after {
-    white-space: pre;
-    content: "\A";
-}
-
-#elements-content {
-    display: block;
-    overflow: auto;
-    padding: 0;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 225px;
-    bottom: 0;
-}
-
-#elements-sidebar {
-    position: absolute;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    width: 225px;
-    background-color: rgb(245, 245, 245);
-    border-left: 1px solid rgb(64%, 64%, 64%);
-    cursor: default;
-    overflow: auto;
-}
-
-.crumbs {
-    display: inline-block;
-    font-size: 11px;
-    line-height: 19px;
-    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
-    color: rgb(20, 20, 20);
-    margin-left: -1px;
-    padding-right: 12px;
-}
-
-.crumbs .crumb {
-    height: 24px;
-    border-width: 0 12px 0 2px;
-    -webkit-border-image: url(Images/segment.png) 0 12 0 2;
-    margin-right: -12px;
-    padding-left: 18px;
-    padding-right: 2px;
-    white-space: nowrap;
-    line-height: 23px;
-    float: right;
-}
-
-.crumbs .crumb.collapsed > * {
-    display: none;
-}
-
-.crumbs .crumb.collapsed::before {
-    content: "\2026";
-    font-weight: bold;
-}
-
-.crumbs .crumb.compact .extra {
-    display: none;
-}
-
-.crumbs .crumb.dimmed {
-    color: rgba(0, 0, 0, 0.45);
-}
-
-.crumbs .crumb.start {
-    padding-left: 7px;
-}
-
-.crumbs .crumb.end {
-    border-width: 0 2px 0 2px;
-    padding-right: 6px;
-    -webkit-border-image: url(Images/segmentEnd.png) 0 2 0 2;
-}
-
-.crumbs .crumb.selected {
-    -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
-    color: black;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-}
-
-.crumbs .crumb.selected:hover {
-    -webkit-border-image: url(Images/segmentSelected.png) 0 12 0 2;
-}
-
-.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover {
-    -webkit-border-image: url(Images/segmentSelectedEnd.png) 0 2 0 2;
-}
-
-.crumbs .crumb:hover {
-    -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
-    color: black;
-}
-
-.crumbs .crumb.dimmed:hover {
-    -webkit-border-image: url(Images/segmentHover.png) 0 12 0 2;
-    color: rgba(0, 0, 0, 0.75);
-}
-
-.crumbs .crumb.end:hover {
-    -webkit-border-image: url(Images/segmentHoverEnd.png) 0 2 0 2;
-}
-
-.outline-disclosure li.hovered:not(.selected) .selection {
-    display: block;
-    left: 3px;
-    right: 3px;
-    background-color: rgba(56, 121, 217, 0.1);
-    -webkit-border-radius: 5px;
-}
-
-.outline-disclosure li.highlighted .highlight {
-    background-color: rgb(255, 230, 179);
-    -webkit-border-radius: 4px;
-    padding-bottom: 2px;
-    margin-bottom: -2px;
-}
-
-.outline-disclosure li.selected.highlighted .highlight {
-    background-color: transparent;
-    padding-bottom: 0;
-    margin-bottom: 0;
-}
-
-.outline-disclosure li .selection {
-    display: none;
-    position: absolute;
-    left: 0;
-    right: 0;
-    height: 15px;
-    z-index: -1;
-}
-
-.outline-disclosure li.selected .selection {
-    display: block;
-    background-color: rgb(212, 212, 212);
-}
-
-.outline-disclosure ol:focus li.selected .selection {
-    background-color: rgb(56, 121, 217);
-}
-
-.outline-disclosure {
-    font-size: 11px;
-}
-
-.outline-disclosure > ol {
-    position: relative;
-    padding: 2px 6px !important;
-    margin: 0;
-    color: black;
-    cursor: default;
-    min-width: 100%;
-}
-
-.outline-disclosure, .outline-disclosure ol {
-    list-style-type: none;
-    -webkit-padding-start: 12px;
-    margin: 0;
-}
-
-.source-code {
-    font-family: monospace;
-    font-size: 10px;
-    white-space: pre-wrap;
-}
-
-.outline-disclosure li {
-    padding: 0 0 0 14px;
-    margin-top: 1px;
-    margin-bottom: 1px;
-    word-wrap: break-word;
-    text-indent: -2px;
-}
-
-.resources .outline-disclosure li {
-    text-indent: -1px;
-}
-
-.outline-disclosure ol:focus li.selected {
-    color: white;
-}
-
-.outline-disclosure ol:focus li.selected * {
-    color: inherit;
-}
-
-.outline-disclosure li.parent {
-    text-indent: -12px
-}
-
-.outline-disclosure li .webkit-html-tag.close {
-    margin-left: -12px;
-}
-
-.outline-disclosure li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 1px;
-    padding-right: 2px;
-}
-
-.outline-disclosure li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-}
-
-.outline-disclosure ol:focus li.parent.selected::before {
-    content: url(Images/treeRightTriangleWhite.png);
-}
-
-.outline-disclosure li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.outline-disclosure ol:focus li.parent.expanded.selected::before {
-    content: url(Images/treeDownTriangleWhite.png);
-}
-
-.outline-disclosure ol.children {
-    display: none;
-}
-
-.outline-disclosure ol.children.expanded {
-    display: block;
-}
-
-.add-attribute {
-    margin-left: 1px;
-    margin-right: 1px;
-    white-space: nowrap;
-}
-
-.placard {
-    position: relative;
-    margin-top: 1px;
-    padding: 3px 8px 4px 18px;
-    min-height: 18px;
-    white-space: nowrap;
-}
-
-.placard:nth-of-type(2n) {
-    background-color: rgb(234, 243, 255);
-}
-
-.placard.selected {
-    border-top: 1px solid rgb(145, 160, 192);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-:focus .placard.selected {
-    border-top: 1px solid rgb(68, 128, 200);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
-}
-
-body.inactive .placard.selected {
-    border-top: 1px solid rgb(151, 151, 151);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
-}
-
-.placard .title {
-    color: black;
-    font-weight: normal;
-    word-wrap: break-word;
-    white-space: normal;
-}
-
-.placard.selected .title {
-    color: white;
-    font-weight: bold;
-}
-
-.placard .subtitle {
-    float: right;
-    font-size: 10px;
-    margin-left: 5px;
-    max-width: 55%;
-    color: rgba(0, 0, 0, 0.7);
-    text-overflow: ellipsis;
-    overflow: hidden;
-}
-
-.placard.selected .subtitle {
-    color: rgba(255, 255, 255, 0.7);
-}
-
-.placard .subtitle a {
-    color: inherit;
-}
-
-.section {
-    position: relative;
-    margin-top: 1px;
-}
-
-.section:nth-last-of-type(1), .event-bar:nth-last-of-type(1) {
-    margin-bottom: 1px;
-}
-
-.watch-expressions-buttons-container {
-    text-align: center;
-}
-
-.event-bar:first-child {
-    margin-top: 1px;
-}
-
-.event-bar:nth-last-of-type(1) .header {
-    border-bottom: 1px solid rgb(163, 163, 163);
-}
-
-.section .header {
-    padding: 2px 8px 4px 18px;
-    border-top: 1px solid rgb(145, 160, 192);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
-    min-height: 18px;
-    white-space: nowrap;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-.section.no-affect .header {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(167, 167, 167)), to(rgb(123, 123, 123)))
-}
-
-.section .header::before {
-    position: absolute;
-    top: 4px;
-    left: 7px;
-    width: 8px;
-    height: 8px;
-    content: url(Images/treeRightTriangleWhite.png);
-}
-
-.section.blank-section .header::before {
-    display: none;
-}
-
-.section.expanded .header::before {
-    content: url(Images/treeDownTriangleWhite.png);
-}
-
-.section .header .title, .event-bar .header .title {
-    color: white;
-    font-weight: bold;
-    word-wrap: break-word;
-    white-space: normal;
-}
-
-.section .header .title.blank-title {
-    font-style: italic;
-}
-
-.section .header label, .event-bar .header label {
-    display: none;
-}
-
-.section.expanded .header label, .event-bar.expanded .header label {
-    display: inline;
-}
-
-.section .header input[type=checkbox] {
-    height: 10px;
-    width: 10px;
-    margin-left: 0;
-    margin-top: 0;
-    margin-bottom: 0;
-    vertical-align: 2px;
-}
-
-.section .header .subtitle, .event-bar .header .subtitle {
-    float: right;
-    font-size: 10px;
-    margin-left: 5px;
-    max-width: 55%;
-    color: rgba(255, 255, 255, 0.7);
-    text-overflow: ellipsis;
-    overflow: hidden;
-}
-
-.section .header .subtitle a {
-    color: inherit;
-}
-
-.section .properties, .event-bar .event-properties {
-    display: none;
-    margin: 0;
-    padding: 2px 6px 3px;
-    list-style: none;
-    min-height: 18px;
-}
-
-.section.no-affect .properties li {
-    opacity: 0.5;
-}
-
-.section.no-affect .properties li.editing {
-    opacity: 1.0;
-}
-
-.section.expanded .properties, .event-bar.expanded .event-properties {
-    display: block;
-}
-
-.section .properties li, .event-properties li {
-    margin-left: 12px;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    -webkit-user-select: text;
-    cursor: auto;
-}
-
-.section .properties li.parent, .event-properties li.parent {
-    margin-left: 1px;
-}
-
-.section .properties ol, .event-properties ol {
-    display: none;
-    margin: 0;
-    -webkit-padding-start: 12px;
-    list-style: none;
-}
-
-.section .properties ol.expanded, .event-properties ol.expanded {
-    display: block;
-}
-
-.section .properties li.parent::before, .event-properties li.parent::before {
-    content: url(Images/treeRightTriangleBlack.png);
-    opacity: 0.75;
-    float: left;
-    width: 8px;
-    height: 8px;
-    margin-top: 0;
-    padding-right: 3px;
-    -webkit-user-select: none;
-    cursor: default;
-}
-
-.section .properties li.parent.expanded::before, .event-properties li.parent.expanded::before {
-    content: url(Images/treeDownTriangleBlack.png);
-    margin-top: 1px;
-}
-
-.section .properties li .info, .event-properties li .info {
-    padding-top: 4px;
-    padding-bottom: 3px;
-}
-
-.section .event-bars {
-    display: none;
-}
-
-.section.expanded .event-bars {
-    display: block;
-}
-
-.event-bar {
-    position: relative;
-}
-
-.event-bar-connector {
-    position: absolute;
-    left: 75%;
-    bottom: -7px;
-    margin-left: -7px;
-    content: url(Images/grayConnectorPoint.png);
-    z-index: 3;
-}
-
-.event-bar.expanded .event-bar-connector {
-    content: url(Images/whiteConnectorPoint.png);
-}
-
-.event-bars .event-bar .header {
-    padding: 2px 8px 4px 18px;
-    border-top: 1px solid rgb(163, 163, 163);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), to(rgb(207, 207, 207)));
-    min-height: 18px;
-    white-space: nowrap;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-.event-bars .event-bar.expanded .header {
-    border-bottom: 1px solid rgb(163, 163, 163);
-}
-
-.event-bars .event-bar .header .title {
-    font-weight: bold;
-    color: #333;
-    text-shadow: white 0 1px 0; 
-}
-
-.event-bars .event-bar .header .subtitle {
-    color: rgba(90, 90, 90, 0.75);
-}
-
-.event-bars .event-bar .header::before {
-    position: absolute;
-    top: 4px;
-    left: 7px;
-    width: 8px;
-    height: 8px;
-    opacity: 0.75;
-    content: url(Images/treeRightTriangleBlack.png);
-}
-
-.event-bars .event-bar.expanded .header::before {
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-.editing {
-    -webkit-user-select: text;
-    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
-    outline: 1px solid rgb(66%, 66%, 66%) !important;
-    background-color: white;
-    -webkit-user-modify: read-write-plaintext-only;
-    text-overflow: clip;
-    padding-left: 2px;
-    margin-left: -2px;
-    padding-right: 2px;
-    margin-right: -2px;
-    margin-bottom: -1px;
-    padding-bottom: 1px;
-    opacity: 1.0 !important;
-}
-
-.editing, .editing * {
-    color: black !important;
-    text-decoration: none !important;
-}
-
-.elements-tree-editor {
-    -webkit-user-select: text;
-    -webkit-user-modify: read-write-plaintext-only;
-}
-
-.section .properties li.editing {
-    margin-left: 10px;
-    text-overflow: clip;
-}
-
-li.editing .swatch, li.editing .enabled-button,  li.editing-sub-part .delete-button {
-    display: none !important;
-}
-
-.watch-expressions > li.editing-sub-part .name {
-    display: block; 
-    width: 100%;
-}
-
-.watch-expressions > li.editing-sub-part .value, .watch-expressions > li.editing-sub-part .separator  {
-    display: none;
-}
-
-.watch-expressions-error-level {
-    color: red;
-}
-
-.section .properties li.editing-sub-part {
-    padding: 3px 6px 8px 18px;
-    margin: -3px -6px -8px -6px;
-    text-overflow: clip;
-}
-
-.section .properties .overloaded, .section .properties .disabled {
-    text-decoration: line-through;
-}
-
-.section.computed-style .properties .disabled {
-    text-decoration: none;
-    opacity: 0.5;
-}
-
-.section .properties .implicit, .section .properties .inherited {
-    opacity: 0.5;
-}
-
-.section:not(.show-inherited) .properties .inherited {
-    display: none;
-}
-
-.section .properties .enabled-button {
-    display: none;
-    float: right;
-    font-size: 10px;
-    margin: 0 0 0 4px;
-    vertical-align: top;
-    position: relative;
-    z-index: 1;
-}
-
-/* FIXME: need a better icon (comment in bug 27514) */
-.section .properties .delete-button {
-    width: 10px;
-    height: 10px;
-    background-image: url(Images/errorIcon.png);
-    background-position: 0 0;
-    background-color: transparent;
-    background-repeat: no-repeat;
-    border: 0 none transparent;
-}
-
-.section:hover .properties .enabled-button {
-    display: block;
-}
-
-.section .properties .name, .event-properties .name {
-    color: rgb(136, 19, 145);
-}
-
-.section .properties .value.dimmed {
-    color: rgb(100, 100, 100);
-}
-
-.section .properties .value.error {
-    color: red;
-}
-
-.section .properties .number, .event-properties .number {
-    color: blue;
-}
-
-.section .properties .priority {
-    color: rgb(128, 0, 0);
-}
-
-.section .properties .keyword, .event-properties .keyword {
-    color: rgb(136, 19, 79);
-}
-
-.section .properties .color, .event-properties .color {
-    color: rgb(118, 15, 21);
-}
-
-.swatch {
-    display: inline-block;
-    vertical-align: baseline;
-    margin-left: 1px;
-    margin-right: 2px;
-    margin-bottom: -1px;
-    width: 1em;
-    height: 1em;
-    border: 1px solid rgba(128, 128, 128, 0.6);
-}
-
-.swatch:hover {
-    border: 1px solid rgba(64, 64, 64, 0.8);
-}
-
-.pane:not(.expanded) + .pane, .pane:first-of-type {
-    margin-top: -1px;
-}
-
-.pane > .title {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(243, 243, 243)), color-stop(0.05, rgb(243, 243, 243)), color-stop(0.05, rgb(230, 230, 230)), to(rgb(209, 209, 209)));
-    height: 20px;
-    padding: 0 5px;
-    border-top: 1px solid rgb(189, 189, 189);
-    border-bottom: 1px solid rgb(189, 189, 189);
-    font-weight: bold;
-    font-size: 12px;
-    line-height: 18px;
-    color: rgb(110, 110, 110);
-    text-shadow: white 0 1px 0;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-.pane > .title:active {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(231, 231, 231)), color-stop(0.05, rgb(231, 231, 231)), color-stop(0.05, rgb(207, 207, 207)), to(rgb(186, 186, 186)));
-    border-top: 1px solid rgb(178, 178, 178);
-    border-bottom: 1px solid rgb(178, 178, 178);
-}
-
-.pane > .title::before {
-    content: url(Images/disclosureTriangleSmallRightBlack.png);
-    float: left;
-    width: 11px;
-    height: 12px;
-    margin-right: 2px;
-    margin-top: 1px;
-}
-
-.pane.expanded > .title::before {
-    content: url(Images/disclosureTriangleSmallDownBlack.png);
-}
-
-.pane > .title > select {
-    display: none;
-    float: right;
-    width: 23px;
-    height: 17px;
-    color: transparent;
-    background-color: transparent;
-    border: none;
-    background-image: url(Images/paneSettingsButtons.png);
-    background-repeat: no-repeat;
-    margin: 1px 0 0 0;
-    padding: 0;
-    -webkit-border-radius: 0;
-    -webkit-appearance: none;
-}
-
-.pane.expanded:hover > .title > select {
-    display: inline-block;
-}
-
-.pane > .title > select:hover {
-    background-position: -23px 0px;
-}
-
-.pane > .title > select:active {
-    background-position: -46px 0px;
-}
-
-.pane > .title > select > option, .pane > .title > select > hr {
-    color: black;
-}
-
-.pane > .body {
-    position: relative;
-    display: none;
-    background-color: white;
-    overflow-y: auto;
-    overflow-x: hidden;
-}
-
-.pane > .body .info {
-    text-align: center;
-    font-style: italic;
-    font-size: 10px;
-    padding: 6px;
-    color: gray;
-}
-
-.pane.expanded > .body, .pane.expanded > .growbar {
-    display: block;
-}
-
-.pane.expanded:nth-last-of-type(1) {
-    border-bottom: 1px solid rgb(189, 189, 189);
-}
-
-.pane > .growbar {
-    display: none;
-    background-image: url(Images/paneGrowHandleLine.png), url(Images/paneBottomGrow.png);
-    background-repeat: no-repeat, repeat-x;
-    background-position: center center, bottom;
-    height: 5px;
-}
-
-.metrics {
-    padding: 8px;
-    font-size: 10px;
-    text-align: center;
-    white-space: nowrap;
-}
-
-.metrics .label {
-    position: absolute;
-    margin-top: -10px;
-    font-size: 9px;
-    color: grey;
-    background-color: white;
-    margin-left: 3px;
-    padding-left: 2px;
-    padding-right: 2px;
-}
-
-.metrics .position {
-    border: 1px rgb(66%, 66%, 66%) dotted;
-    display: inline-block;
-    text-align: center;
-    padding: 3px;
-    margin: 3px;
-}
-
-.metrics .margin {
-    border: 1px dashed;
-    display: inline-block;
-    text-align: center;
-    vertical-align: middle;
-    padding: 3px;
-    margin: 3px;
-}
-
-.metrics .border {
-    border: 1px black solid;
-    display: inline-block;
-    text-align: center;
-    vertical-align: middle;
-    padding: 3px;
-    margin: 3px;
-}
-
-.metrics .padding {
-    border: 1px grey dashed;
-    display: inline-block;
-    text-align: center;
-    vertical-align: middle;
-    padding: 3px;
-    margin: 3px;
-}
-
-.metrics .content {
-    position: static;
-    border: 1px grey solid;
-    display: inline-block;
-    text-align: center;
-    vertical-align: middle;
-    padding: 3px;
-    margin: 3px;
-    min-width: 80px;
-    text-align: center;
-    overflow: visible;
-}
-
-.metrics .content span {
-    display: inline-block;
-}
-
-.metrics .editing {
-    position: relative;
-    z-index: 100;
-}
-
-.metrics .left {
-    display: inline-block;
-    vertical-align: middle;
-}
-
-.metrics .right {
-    display: inline-block;
-    vertical-align: middle;
-}
-
-.metrics .top {
-    display: inline-block;
-}
-
-.metrics .bottom {
-    display: inline-block;
-}
-
-.sidebar {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    width: 200px;
-    overflow-y: auto;
-    overflow-x: hidden;
-    background-color: rgb(214, 221, 229);
-    border-right: 1px solid rgb(64%, 64%, 64%);
-}
-
-body.inactive .sidebar {
-    background-color: rgb(232, 232, 232);
-}
-
-.database-sidebar-tree-item .icon {
-    content: url(Images/database.png);
-}
-
-.database-table-sidebar-tree-item .icon {
-    content: url(Images/databaseTable.png);
-}
-
-.domstorage-sidebar-tree-item.local-storage .icon {
-    content: url(Images/localStorage.png);
-}
-
-.domstorage-sidebar-tree-item.session-storage .icon {
-    content: url(Images/sessionStorage.png);
-}
-
-.cookie-sidebar-tree-item .icon {
-    content: url(Images/cookie.png);
-}
-
-#storage-views {
-    position: absolute;
-    top: 0;
-    right: 0;
-    left: 200px;
-    bottom: 0;
-}
-
-.storage-view {
-    display: none;
-    overflow: hidden;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.storage-view.visible {
-    display: block;
-}
-
-.storage-view.table {
-    overflow: hidden;
-}
-
-.storage-view.table .data-grid {
-    border: none;
-    height: 100%;
-}
-
-.storage-view.table .storage-table-empty, .storage-view.table .storage-table-error {
-    position: absolute;
-    top: 0;
-    bottom: 25%;
-    left: 0;
-    right: 0;
-    font-size: 24px;
-    color: rgb(75%, 75%, 75%);
-    margin-top: auto;
-    margin-bottom: auto;
-    height: 50px;
-    line-height: 26px;
-    text-align: center;
-    font-weight: bold;
-    padding: 10px;
-    white-space: pre-wrap;
-}
-
-.storage-view.table .storage-table-error {
-    color: rgb(66%, 33%, 33%);
-}
-
-.data-grid {
-    position: relative;
-    border: 1px solid #aaa;
-}
-
-.data-grid .highlight {
-    background-color: rgb(255, 230, 179);
-}
-
-.data-grid tr.selected .highlight {
-    background-color: transparent;
-}
-
-.data-grid table {
-    table-layout: fixed;
-    border-spacing: 0;
-    border-collapse: collapse;
-    width: 100%;
-    font-size: 10px;
-    font-family: Lucida Grande, sans-serif;
-}
-
-.data-grid .data-container {
-    position: absolute;
-    top: 16px;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    padding-right: 14px;
-    overflow-x: hidden;
-    overflow-y: overlay;
-    background-image: -webkit-gradient(linear, left top, left bottom, from(white), color-stop(0.5, white), color-stop(0.5, rgb(234, 243, 255)), to(rgb(234, 243, 255)));
-    -webkit-background-size: 1px 32px;
-}
-
-.data-grid.inline .data-container {
-    position: static;
-}
-
-.data-grid th {
-    text-align: left;
-    background-image: url(Images/glossyHeader.png);
-    background-repeat: repeat-x;
-    border-right: 1px solid rgb(179, 179, 179);
-    border-bottom: 1px solid rgb(179, 179, 179);
-    height: 15px;
-    font-weight: normal;
-    vertical-align: middle;
-    padding: 0 4px;
-    white-space: nowrap;
-}
-
-.data-grid th.corner {
-    width: 15px;
-    border-right: 0 none transparent;
-}
-
-.data-grid tr.filler {
-    display: table-row !important;
-    height: auto !important;
-}
-
-.data-grid tr.filler td {
-    height: auto !important;
-    padding: 0 !important;
-}
-
-.data-grid table.data {
-    position: absolute;
-    left: 0;
-    top: 0;
-    right: 16px;
-    bottom: 0;
-    height: 100%;
-    border-top: 0 none transparent;
-    background-image: -webkit-gradient(linear, left top, left bottom, from(white), color-stop(0.5, white), color-stop(0.5, rgb(234, 243, 255)), to(rgb(234, 243, 255)));
-    -webkit-background-size: 1px 32px;
-}
-
-.data-grid.inline table.data {
-    position: static;
-}
-
-.data-grid table.data tr {
-    display: none;
-}
-
-.data-grid table.data tr.revealed {
-    display: table-row;
-}
-
-.data-grid td {
-    vertical-align: top;
-    height: 12px;
-    line-height: 12px;
-    padding: 2px 4px;
-    white-space: nowrap;
-    border-right: 1px solid #aaa;
-    -webkit-user-select: text;
-}
-
-.data-grid td > div, .data-grid th > div {
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-}
-
-.data-grid .centered div {
-    text-align: center;
-}
-
-.data-grid .right div {
-    text-align: right;
-}
-
-.data-grid th.sortable div {
-    position: relative;
-}
-
-.data-grid th.sortable:active {
-    background-image: url(Images/glossyHeaderPressed.png);
-}
-
-.data-grid th.sort-ascending, .data-grid th.sort-descending {
-    border-right: 1px solid rgb(107, 140, 196);
-    border-bottom: 1px solid rgb(107, 140, 196);
-    background-image: url(Images/glossyHeaderSelected.png);
-    background-repeat: repeat-x;
-}
-
-.data-grid th.sortable.sort-ascending:active, .data-grid th.sortable.sort-descending:active {
-    background-image: url(Images/glossyHeaderSelectedPressed.png);
-}
-
-.data-grid th.sort-ascending div::after {
-    position: absolute;
-    top: 0;
-    right: 0;
-    width: 8px;
-    height: 8px;
-    content: url(Images/treeUpTriangleBlack.png);
-}
-
-.data-grid th.sort-descending div::after {
-    position: absolute;
-    top: 0;
-    right: 0;
-    margin-top: 1px;
-    width: 8px;
-    height: 8px;
-    content: url(Images/treeDownTriangleBlack.png);
-}
-
-body.inactive .data-grid th.sort-ascending, body.inactive .data-grid th.sort-descending {
-    background-image: url(Images/glossyHeader.png);
-    border-right: 1px solid rgb(179, 179, 179);
-    border-bottom: 1px solid rgb(179, 179, 179);
-}
-
-.data-grid tr.parent td.disclosure::before {
-    float: left;
-    content: url(Images/treeRightTriangleBlack.png);
-    width: 8px;
-    height: 8px;
-    margin-right: 2px;
-    -webkit-user-select: none;
-}
-
-.data-grid tr.expanded td.disclosure::before {
-    content: url(Images/treeDownTriangleBlack.png);
-    width: 8px;
-    height: 8px;
-    margin-top: 1px;
-}
-
-.data-grid tr.selected {
-    background-color: rgb(212, 212, 212);
-    color: inherit;
-}
-
-.data-grid:focus tr.selected {
-    background-color: rgb(56, 121, 217);
-    color: white;
-}
-
-.data-grid:focus tr.parent.selected td.disclosure::before {
-    content: url(Images/treeRightTriangleWhite.png);
-}
-
-.data-grid:focus tr.expanded.selected td.disclosure::before {
-    content: url(Images/treeDownTriangleWhite.png);
-}
-
-.data-grid tr:not(.parent) td.disclosure {
-    text-indent: 10px;
-}
-
-.data-grid-resizer {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    width: 5px;
-    z-index: 500;
-    cursor: col-resize;
-}
-
-.storage-view.query {
-    padding: 2px 0;
-    overflow-y: overlay;
-    overflow-x: hidden;
-    -webkit-text-size-adjust: auto;
-}
-
-.database-query-prompt {
-    position: relative;
-    padding: 1px 22px 1px 24px;
-    min-height: 16px; 
-    white-space: pre-wrap;
-    -webkit-user-modify: read-write-plaintext-only;
-    -webkit-user-select: text;
-}
-
-.database-user-query::before, .database-query-prompt::before, .database-query-result::before {
-    position: absolute;
-    display: block;
-    content: "";
-    left: 7px;
-    top: 0.8em;
-    width: 10px;
-    height: 10px;
-    margin-top: -5px;
-    -webkit-user-select: none;
-}
-
-.database-query-prompt::before {
-    background-image: url(Images/userInputIcon.png);
-}
-
-.database-user-query {
-    position: relative;
-    border-bottom: 1px solid rgb(245, 245, 245);
-    padding: 1px 22px 1px 24px;
-    min-height: 16px; 
-}
-
-.database-user-query::before {
-    background-image: url(Images/userInputPreviousIcon.png);
-}
-
-.database-query-text {
-    color: rgb(0, 128, 255);
-    -webkit-user-select: text;
-}
-
-.database-query-result {
-    position: relative;
-    padding: 1px 22px 1px 24px;
-    min-height: 16px;
-    margin-left: -24px;
-    padding-right: 0;
-}
-
-.database-query-result.error {
-    color: red;
-    -webkit-user-select: text;
-}
-
-.database-query-result.error::before {
-    background-image: url(Images/errorIcon.png);
-}
-
-.panel-enabler-view {
-    z-index: 1000;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    background-color: white;
-    font-size: 13px;
-    text-align: center;
-    overflow-x: hidden;
-    overflow-y: overlay;
-    display: none;
-}
-
-.panel-enabler-view.visible {
-    display: block;
-}
-
-.panel-enabler-view .panel-enabler-view-content {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    max-height: 390px;
-    margin: auto;
-    white-space: nowrap;
-}
-
-.panel-enabler-view h1 {
-    color: rgb(110, 116, 128);
-    font-size: 16px;
-    line-height: 20px;
-    font-weight: normal;
-    margin-top: 0;
-}
-
-.panel-enabler-disclaimer {
-    font-size: 10px;
-    color: rgb(110, 116, 128);
-    margin-bottom: 12px;
-    margin-left: 20px;
-}
-
-.panel-enabler-disclaimer:empty {
-    display: none;
-}
-
-.panel-enabler-view img, div.welcome-instructions-aligner {
-    height: 100%;
-    min-height: 200px;
-    max-width: 100%;
-    top: 0;
-    bottom: 0;
-    padding: 20px 0 20px 20px;
-    margin: auto;
-    vertical-align: middle;
-}
-
-.panel-enabler-view img.hidden {
-    display: initial !important;
-    width: 0;
-}
-
-.panel-enabler-view form {
-    display: inline-block;
-    vertical-align: middle;
-    width: 330px;
-    margin: 0;
-    padding: 15px;
-    white-space: normal;
-}
-
-.panel-enabler-view label {
-    position: relative;
-    display: block;
-    text-align: left;
-    word-break: break-word;
-    margin: 0 0 5px 20px;
-}
-
-.panel-enabler-view button:not(.status-bar-item), .pane button, button.show-all-nodes {
-    color: rgb(6, 6, 6);
-    background-color: transparent;
-    border: 1px solid rgb(165, 165, 165);
-    background-color: rgb(237, 237, 237);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-    -webkit-border-radius: 12px;
-    -webkit-appearance: none;
-}
-
-.panel-enabler-view button:not(.status-bar-item) {
-    font-size: 13px;
-    margin: 6px 0 0 0;
-    padding: 3px 20px;
-    height: 24px;
-}
-
-button.show-all-nodes {
-    font-size: 13px;
-    margin: 0;
-    padding: 0 20px;
-    height: 20px;
-}
-
-.panel-enabler-view.welcome {
-    z-index: auto;
-}
-
-.panel-enabler-view.welcome div.welcome-instructions-aligner {
-    display: inline-block;
-    width: 0;
-}
-
-.panel-enabler-view.welcome .instructions {
-    display: inline-block;
-    vertical-align: middle;
-    width: 330px;
-    margin: 0;
-    white-space: normal;
-    line-height: 175%;
-}
-
-.panel-enabler-view.welcome .message {
-    margin-bottom: 2ex;
-}
-
-.panel-enabler-view.welcome button.status-bar-item {
-    vertical-align: middle;
-}
-
-.pane button {
-    margin: 6px 0 6px 3px;
-    padding: 2px 9px;
-}
-
-.panel-enabler-view button:active:not(.status-bar-item), .pane button:active, button.show-all-nodes:active {
-    background-color: rgb(215, 215, 215);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
-}
-
-body.inactive .panel-enabler-view button:not(.status-bar-item), .panel-enabler-view button:disabled:not(.status-bar-item), body.inactive .pane button, .pane button:disabled, body.inactive button.show-all-nodes {
-    color: rgb(130, 130, 130);
-    border-color: rgb(212, 212, 212);
-    background-color: rgb(239, 239, 239);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(250, 250, 250)), to(rgb(235, 235, 235)));
-}
-
-.panel-enabler-view input {
-    height: 17px;
-    width: 17px;
-    border: 1px solid rgb(165, 165, 165);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-    -webkit-border-radius: 8px;
-    -webkit-appearance: none;
-    vertical-align: middle;
-    margin: 0 5px 5px 0;
-}
-
-.panel-enabler-view input:active {
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(194, 194, 194)), to(rgb(239, 239, 239)));
-}
-
-.panel-enabler-view input:checked {
-    background: url(Images/radioDot.png) center no-repeat,
-                -webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)));
-}
-
-.panel-enabler-view.resources img {
-    content: url(Images/resourcesSilhouette.png);
-}
-
-.panel-enabler-view.scripts img {
-    content: url(Images/scriptsSilhouette.png);
-}
-
-.panel-enabler-view.profiles img {
-    content: url(Images/profilesSilhouette.png);
-}
-
-button.enable-toggle-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/enableOutlineButtonGlyph.png);
-}
-
-button.enable-toggle-status-bar-item.toggled-on .glyph {
-    -webkit-mask-image: url(Images/enableSolidButtonGlyph.png);
-}
-
-.scripts-pause-on-exceptions-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/pauseOnExceptionButtonGlyph.png);
-}
-
-#scripts-status-bar {
-    position: absolute;
-    top: -1px;
-    left: 0;
-    right: 0;
-    height: 24px;
-}
-
-#scripts-files {
-    max-width: 250px;
-}
-
-#scripts-functions {
-    max-width: 150px;
-}
-
-#scripts-status-bar .status-bar-item img {
-    margin-top: 2px;
-}
-
-#scripts-back img {
-    content: url(Images/back.png);
-}
-
-#scripts-forward img {
-    content: url(Images/forward.png);
-}
-
-#scripts-pause img {
-    content: url(Images/debuggerPause.png);
-}
-
-#scripts-pause.paused img {
-    content: url(Images/debuggerContinue.png);
-}
-
-#scripts-step-over img {
-    content: url(Images/debuggerStepOver.png);
-}
-
-#scripts-step-into img {
-    content: url(Images/debuggerStepInto.png);
-}
-
-#scripts-step-out img {
-    content: url(Images/debuggerStepOut.png);
-}
-
-.toggle-breakpoints .glyph {
-    -webkit-mask-image: url(Images/breakpointsActivateButtonGlyph.png);
-    background-color: rgb(96, 96, 96) !important;
-}
-
-.toggle-breakpoints.toggled-on .glyph {
-    -webkit-mask-image: url(Images/breakpointsDeactivateButtonGlyph.png);
-}
-
-#scripts-debugger-status {
-    position: absolute;
-    line-height: 24px;
-    top: 0;
-    right: 8px;
-}
-
-#scripts-sidebar-resizer-widget {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    right: 225px;
-    width: 16px;
-    cursor: col-resize;
-    background-image: url(Images/statusbarResizerHorizontal.png);
-    background-repeat: no-repeat;
-    background-position: center;
-}
-
-#scripts-sidebar-buttons {
-    position: absolute;
-    right: 0;
-    top: 0;
-    bottom: 0;
-    width: 225px;
-    overflow: hidden;
-    border-left: 1px solid rgb(64%, 64%, 64%);
-}
-
-#script-resource-views {
-    display: block;
-    padding: 0;
-    position: absolute;
-    top: 23px;
-    left: 0;
-    right: 225px;
-    bottom: 0;
-}
-
-.script-view {
-    display: none;
-    overflow: hidden;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.script-view.visible {
-    display: block;
-}
-
-#scripts-sidebar {
-    position: absolute;
-    top: 23px;
-    right: 0;
-    bottom: 0;
-    width: 225px;
-    background-color: rgb(245, 245, 245);
-    border-left: 1px solid rgb(64%, 64%, 64%);
-    cursor: default;
-    overflow: auto;
-}
-
-.resources-larger-resources-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png);
-}
-
-#resources-filter, #console-filter.console-filter-top {
-    background: -webkit-gradient(linear, left top, left bottom, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));
-    border-bottom: 1px solid rgb(64%, 64%, 64%);
-    width: 100%;
-}
-
-#console-messages.console-filter-top {
-    margin-top: 23px;
-}
-
-#console-filter {
-    margin-top: 1px;
-}
-
-.scope-bar {
-    height: 23px;
-    padding: 2px 10px 0;
-    overflow: hidden;
-}
-
-.scope-bar li {
-    display: inline-block;
-    margin: 1px 2px 0 0;
-    padding: 1px 7px 3px;
-    font-size: 11px;
-    line-height: 12px;
-    font-weight: bold;
-    color: rgb(46, 46, 46);
-    background: transparent;
-    text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
-    -webkit-border-radius: 8px;
-    vertical-align: middle;
-}
-
-.scope-bar .divider {
-    margin: 1px 9px 0 8px;
-    background-color: rgba(0, 0, 0, 0.4);
-    height: 16px;
-    width: 1px;
-    vertical-align: middle;
-    display: inline-block;
-}
-
-.scope-bar li.selected, .scope-bar li:hover, .scope-bar li:active {
-    color: white;
-    text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0;
-}
-
-.scope-bar li:hover {
-    background: rgba(0, 0, 0, 0.2);
-}
-
-.scope-bar li.selected {
-    background: rgba(0, 0, 0, 0.3);
-    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5);
-}
-
-.scope-bar li:active {
-    background: rgba(0, 0, 0, 0.5);
-    -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.5) inset, 0 -1px 1px rgba(255, 255, 255, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 0.5);
-}
-
-#resources-container {
-    position: absolute;
-    top: 23px;
-    left: 0;
-    bottom: 0;
-    right: 0;
-    border-right: 0 none transparent;
-    overflow-y: auto;
-    overflow-x: hidden;
-}
-
-#resources-container.viewing-resource {
-    right: auto;
-    width: 200px;
-    border-right: 1px solid rgb(64%, 64%, 64%);
-}
-
-#resources-container.viewing-resource #resources-sidebar {
-    width: 100%;
-    border-right: 0 none transparent;
-}
-
-#resources-sidebar {
-    min-height: 100%;
-    bottom: auto;
-    overflow: visible;
-}
-
-#resources-container-content {
-    position: absolute;
-    top: 0;
-    right: 0;
-    left: 200px;
-    min-height: 100%;
-}
-
-#resources-container.viewing-resource #resources-container-content {
-    display: none;
-}
-
-#resources-summary {
-    position: absolute;
-    padding-top: 20px;
-    top: 0;
-    left: 0;
-    right: 0;
-    height: 93px;
-    margin-left: -1px;
-    border-left: 1px solid rgb(102, 102, 102);
-    background-color: rgb(101, 111, 130);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.5)));
-    background-repeat: repeat-x;
-    background-position: bottom;
-    text-align: center;
-    text-shadow: black 0 1px 1px;
-    white-space: nowrap;
-    color: white;
-    -webkit-background-size: 1px 6px;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-    z-index: 400;
-}
-
-.summary-graph-legend {
-    margin-top: -10px;
-    padding-left: 15px;
-}
-
-.summary-graph-legend-item {
-    display: inline-block;
-    font-weight: bold;
-    margin-right: 15px;
-    vertical-align: top;
-}
-
-.summary-graph-legend-item.total {
-    margin-left: 10px;
-}
-
-.summary-graph-legend-label {
-    display: inline-block;
-    text-align: left;
-}
-
-.summary-graph-legend-header {
-    font-size: 12px;
-}
-
-.summary-graph-legend-value {
-    font-size: 10px;
-}
-
-.summary-graph-legend-swatch {
-    vertical-align: top;
-    margin-top: 1px;
-    margin-right: 3px;
-}
-
-#resources-dividers {
-    position: absolute;
-    left: 0;
-    right: 0;
-    height: 100%;
-    top: 0;
-    z-index: -100;
-}
-
-#resources-event-dividers {
-    position: absolute;
-    left: 0;
-    right: 0;
-    height: 100%;
-    top: 0;
-    z-index: 300;
-    pointer-events: none;
-}
-
-#resources-dividers-label-bar {
-    position: absolute;
-    top: 0;
-    left: 0px;
-    right: 0;
-    background-color: rgba(255, 255, 255, 0.8);
-    background-clip: padding;
-    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
-    height: 20px;
-    z-index: 200;
-}
-
-.resources-divider {
-    position: absolute;
-    width: 1px;
-    top: 0;
-    bottom: 0;
-    background-color: rgba(0, 0, 0, 0.1);
-}
-
-.resources-event-divider-padding {
-    position: absolute;
-    width: 8px;
-    top: 0;
-    bottom: 0;
-    pointer-events: auto;
-}
-
-.resources-onload-divider {
-    position: absolute;
-    width: 2px;
-    top: 0;
-    bottom: 0;
-    z-index: 300;
-    background-color: rgba(255, 0, 0, 0.5);
-}
-
-.resources-ondomcontent-divider {
-    position: absolute;
-    width: 2px;
-    top: 0;
-    bottom: 0;
-    z-index: 300;
-    background-color: rgba(0, 0, 255, 0.5);
-}
-
-.resources-divider.last {
-    background-color: transparent;
-}
-
-.resources-divider-label {
-    position: absolute;
-    top: 4px;
-    right: 3px;
-    font-size: 9px;
-    color: rgb(50%, 50%, 50%);
-    white-space: nowrap;
-}
-
-.resources-graph-label {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    margin: auto -7px;
-    height: 13px;
-    line-height: 13px;
-    font-size: 9px;
-    color: rgba(0, 0, 0, 0.75);
-    text-shadow: rgba(255, 255, 255, 0.25) 1px 0 0, rgba(255, 255, 255, 0.25) -1px 0 0, rgba(255, 255, 255, 0.333) 0 1px 0, rgba(255, 255, 255, 0.25) 0 -1px 0;
-    z-index: 150;
-    overflow: hidden;
-    text-align: center;
-    font-weight: bold;
-    opacity: 0;
-    -webkit-transition: opacity 250ms ease-in-out;
-}
-
-.resources-graph-side:hover .resources-graph-label {
-    opacity: 1;
-}
-
-.resources-graph-label:empty {
-    display: none;
-}
-
-.resources-graph-label.waiting {
-    margin-right: 5px;
-}
-
-.resources-graph-label.waiting-right {
-    margin-left: 5px;
-}
-
-.resources-graph-label.before {
-    color: rgba(0, 0, 0, 0.7);
-    text-shadow: none;
-    text-align: right;
-    margin-right: 2px;
-}
-
-.resources-graph-label.before::after {
-    padding-left: 2px;
-    height: 6px;
-    content: url(Images/graphLabelCalloutLeft.png);
-}
-
-.resources-graph-label.after {
-    color: rgba(0, 0, 0, 0.7);
-    text-shadow: none;
-    text-align: left;
-    margin-left: 2px;
-}
-
-.resources-graph-label.after::before {
-    padding-right: 2px;
-    height: 6px;
-    content: url(Images/graphLabelCalloutRight.png);
-}
-
-.resources-graph-bar {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    margin: auto -7px;
-    border-width: 6px 7px;
-    height: 13px;
-    min-width: 14px;
-    opacity: 0.65;
-    -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7;
-}
-
-.resources-category-documents, .resources-category-stylesheets, .resources-category-images,
-.resources-category-scripts, .resources-category-xhr, .resources-category-fonts, .resources-category-other {
-    display: none;
-}
-
-.filter-all .resources-category-documents, .filter-documents .resources-category-documents,
-.filter-all .resources-category-stylesheets, .filter-stylesheets .resources-category-stylesheets,
-.filter-all .resources-category-images, .filter-images .resources-category-images,
-.filter-all .resources-category-scripts, .filter-scripts .resources-category-scripts,
-.filter-all .resources-category-xhr, .filter-xhr .resources-category-xhr,
-.filter-all .resources-category-fonts, .filter-fonts .resources-category-fonts,
-.filter-all .resources-category-other, .filter-other .resources-category-other,
-.resource-sidebar-tree-item.selected {
-    display: list-item;
-}
-
-.console-warning-level, .console-error-level, .console-log-level {
-    display: none;
-}
-
-.filter-all .console-warning-level, .filter-warnings .console-warning-level,
-.filter-all .console-error-level, .filter-errors .console-error-level,
-.filter-all .console-log-level, .filter-logs .console-log-level {
-    display: block;
-}
-
-.console-user-command-result {
-    display: block;
-}
-
-.resources-graph-bar.waiting, .resources-graph-bar.waiting-right {
-    opacity: 0.35;
-}
-
-.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillGray.png) 6 7 6 7;
-}
-
-.resources-category-documents .resources-graph-bar {
-    -webkit-border-image: url(Images/timelinePillBlue.png) 6 7 6 7;
-}
-
-.resources-category-documents.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillBlue.png) 6 7 6 7;
-}
-
-.resources-category-stylesheets .resources-graph-bar {
-    -webkit-border-image: url(Images/timelinePillGreen.png) 6 7 6 7;
-}
-
-.resources-category-stylesheets.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillGreen.png) 6 7 6 7;
-}
-
-.resources-category-images .resources-graph-bar {
-    -webkit-border-image: url(Images/timelinePillPurple.png) 6 7 6 7;
-}
-
-.resources-category-images.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillPurple.png) 6 7 6 7;
-}
-
-.resources-category-fonts .resources-graph-bar {
-    -webkit-border-image: url(Images/timelinePillRed.png) 6 7 6 7;
-}
-
-.resources-category-fonts.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillRed.png) 6 7 6 7;
-}
-
-.resources-category-scripts .resources-graph-bar {
-    -webkit-border-image: url(Images/timelinePillOrange.png) 6 7 6 7;
-}
-
-.resources-category-scripts.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillOrange.png) 6 7 6 7;
-}
-
-.resources-category-xhr .resources-graph-bar {
-    -webkit-border-image: url(Images/timelinePillYellow.png) 6 7 6 7;
-}
-
-.resources-category-xhr.resource-cached .resources-graph-bar {
-    -webkit-border-image: url(Images/timelineHollowPillYellow.png) 6 7 6 7;
-}
-
-#resource-views {
-    position: absolute;
-    top: 23px;
-    right: 0;
-    left: 200px;
-    bottom: 0;
-}
-
-.source-view-frame {
-    width: 100%;
-    height: 100%;
-}
-
-.sidebar-resizer-vertical {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    width: 5px;
-    z-index: 500;
-    cursor: col-resize;
-}
-
-.resources .sidebar-resizer-vertical {
-    top: 23px;
-}
-
-.sidebar-tree, .sidebar-tree .children {
-    position: relative;
-    padding: 0;
-    margin: 0;
-    list-style: none;
-    font-size: 11px;
-}
-
-.sidebar-tree-section {
-    position: relative;
-    height: 18px;
-    padding: 4px 10px 6px 10px;
-    white-space: nowrap;
-    margin-top: 1px;
-    color: rgb(92, 110, 129);
-    font-weight: bold;
-    text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0;
-}
-
-.sidebar-tree-item {
-    position: relative;
-    height: 36px;
-    padding: 0 5px 0 5px;
-    white-space: nowrap;
-    margin-top: 1px;
-    line-height: 34px;
-    border-top: 1px solid transparent;
-}
-
-.sidebar-tree .children {
-    display: none;
-}
-
-.sidebar-tree .children.expanded {
-    display: block;
-}
-
-.sidebar-tree-section + .children > .sidebar-tree-item {
-    padding-left: 10px !important;
-}
-
-.sidebar-tree-section + .children.small > .sidebar-tree-item {
-    padding-left: 17px !important;
-}
-
-.sidebar-tree > .children > .sidebar-tree-item {
-    padding-left: 37px;
-}
-
-.sidebar-tree > .children > .children > .sidebar-tree-item {
-    padding-left: 37px;
-}
-
-.sidebar-tree.hide-disclosure-buttons > .children {
-    display: none;
-}
-
-.sidebar-tree > .children.hide-disclosure-buttons > .children {
-    display: none;
-}
-
-.sidebar-tree.some-expandable:not(.hide-disclosure-buttons) > .sidebar-tree-item:not(.parent) .icon {
-    margin-left: 16px;
-}
-
-.sidebar-tree-item .disclosure-button {
-    float: left;
-    width: 16px;
-    height: 100%;
-    border: 0;
-    background-color: transparent;
-    background-image: url(Images/disclosureTriangleSmallRight.png);
-    background-repeat: no-repeat;
-    background-position: center;
-    -webkit-apearance: none;
-}
-
-.sidebar-tree.hide-disclosure-buttons .sidebar-tree-item .disclosure-button {
-    display: none;
-}
-
-body.inactive .sidebar-tree-item .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
-}
-
-body.inactive .sidebar-tree-item.expanded .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
-}
-
-body.inactive .sidebar-tree-item .disclosure-button:active {
-    background-image: url(Images/disclosureTriangleSmallRightDownBlack.png);
-}
-
-.sidebar-tree-item.selected .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallRightWhite.png) !important;
-}
-
-.sidebar-tree-item.expanded .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallDown.png);
-}
-
-.sidebar-tree-item.selected.expanded .disclosure-button {
-    background-image: url(Images/disclosureTriangleSmallDownWhite.png) !important;
-}
-
-.sidebar-tree-item.selected .disclosure-button:active {
-    background-image: url(Images/disclosureTriangleSmallRightDownWhite.png) !important;
-}
-
-.sidebar-tree-item .disclosure-button:active {
-    background-image: url(Images/disclosureTriangleSmallRightDown.png);
-}
-
-.sidebar-tree-item .icon {
-    float: left;
-    width: 32px;
-    height: 32px;
-    margin-top: 1px;
-    margin-right: 3px;
-}
-
-.sidebar-tree-item .status {
-    float: right;
-    height: 16px;
-    margin-top: 9px;
-    margin-left: 4px;
-    line-height: 1em;
-}
-
-.sidebar-tree-item .status:empty {
-    display: none;
-}
-
-.sidebar-tree-item .status .bubble {
-    display: inline-block;
-    height: 14px;
-    min-width: 16px;
-    margin-top: 1px;
-    background-color: rgb(128, 151, 189);
-    vertical-align: middle;
-    white-space: nowrap;
-    padding: 1px 4px;
-    text-align: center;
-    font-size: 11px;
-    line-height: normal;
-    font-family: Helvetica, Arial, sans-serif;
-    font-weight: bold;
-    text-shadow: none;
-    color: white;
-    -webkit-border-radius: 7px;
-}
-
-.sidebar-tree-item .status .bubble:empty {
-    display: none;
-}
-
-.sidebar-tree-item.selected .status .bubble {
-    background-color: white !important;
-    color: rgb(132, 154, 190) !important;
-}
-
-:focus .sidebar-tree-item.selected .status .bubble {
-    color: rgb(36, 98, 172) !important;
-}
-
-body.inactive .sidebar-tree-item.selected .status .bubble {
-    color: rgb(159, 159, 159) !important;
-}
-
-.sidebar-tree.small .sidebar-tree-item, .sidebar-tree .children.small .sidebar-tree-item, .sidebar-tree-item.small, .small .resources-graph-side {
-    height: 20px;
-}
-
-.sidebar-tree.small .sidebar-tree-item .icon, .sidebar-tree .children.small .sidebar-tree-item .icon, .sidebar-tree-item.small .icon {
-    width: 16px;
-    height: 16px;
-}
-
-.sidebar-tree.small .sidebar-tree-item .status, .sidebar-tree .children.small .sidebar-tree-item .status, .sidebar-tree-item.small .status {
-    margin-top: 1px;
-}
-
-.sidebar-tree-item.selected {
-    color: white;
-    border-top: 1px solid rgb(145, 160, 192);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(162, 177, 207)), to(rgb(120, 138, 177)));
-    text-shadow: rgba(0, 0, 0, 0.33) 0 1px 0;
-    font-weight: bold;
-    -webkit-background-origin: padding;
-    -webkit-background-clip: padding;
-}
-
-:focus .sidebar-tree-item.selected {
-    border-top: 1px solid rgb(68, 128, 200);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(92, 147, 213)), to(rgb(21, 83, 170)));
-}
-
-body.inactive .sidebar-tree-item.selected {
-    border-top: 1px solid rgb(151, 151, 151);
-    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(180, 180, 180)), to(rgb(138, 138, 138)));
-}
-
-.sidebar-tree-item .titles {
-    position: relative;
-    top: 5px;
-    line-height: 11px;
-    padding-bottom: 1px;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    white-space: nowrap;
-}
-
-.sidebar-tree-item .titles.no-subtitle {
-    top: 10px;
-}
-
-.sidebar-tree.small .sidebar-tree-item .titles, .sidebar-tree .children.small .sidebar-tree-item .titles, .sidebar-tree-item.small .titles {
-    top: 2px;
-    line-height: normal;
-}
-
-.sidebar-tree:not(.small) .sidebar-tree-item:not(.small) .title::after, .sidebar-tree .children:not(.small) .sidebar-tree-item .title::after {
-    content: "\A";
-    white-space: pre;
-}
-
-.sidebar-tree-item .subtitle {
-    font-size: 9px;
-    color: rgba(0, 0, 0, 0.7);
-}
-
-.sidebar-tree.small .sidebar-tree-item .subtitle, .sidebar-tree .children.small .sidebar-tree-item .subtitle, .sidebar-tree-item.small .subtitle {
-    display: none;
-}
-
-.sidebar-tree-item.selected .subtitle {
-    color: rgba(255, 255, 255, 0.9);
-}
-
-#resources-graphs {
-    position: absolute;
-    left: 0;
-    right: 0;
-    max-height: 100%;
-    top: 112px;
-}
-
-.resources-graph-side {
-    position: relative;
-    height: 36px;
-    padding: 0 5px;
-    white-space: nowrap;
-    margin-top: 1px;
-    border-top: 1px solid transparent;
-    overflow: hidden;
-}
-
-.resources-graph-bar-area {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    right: 8px;
-    left: 9px;
-}
-
-#resources-container:not(.viewing-resource) .resource-sidebar-tree-item:nth-of-type(2n) {
-    background-color: rgba(0, 0, 0, 0.05);
-}
-
-#resources-container:not(.viewing-resource) .resources-graph-side:nth-of-type(2n) {
-    background-color: rgba(0, 0, 0, 0.05);
-}
-
-.resources-time-graph-sidebar-item .icon {
-    content: url(Images/resourcesTimeGraphIcon.png);
-}
-
-.resources-size-graph-sidebar-item .icon {
-    content: url(Images/resourcesSizeGraphIcon.png);
-}
-
-.resources-size-graph-sidebar-item .icon {
-    content: url(Images/resourcesSizeGraphIcon.png);
-}
-
-.resource-sidebar-tree-item .icon {
-    content: url(Images/resourcePlainIcon.png);
-}
-
-.children.small .resource-sidebar-tree-item .icon {
-    content: url(Images/resourcePlainIconSmall.png);
-}
-
-.resource-sidebar-tree-item.resources-category-documents .icon {
-    content: url(Images/resourceDocumentIcon.png);
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-documents .icon {
-    content: url(Images/resourceDocumentIconSmall.png);
-}
-
-.resource-sidebar-tree-item.resources-category-stylesheets .icon {
-    content: url(Images/resourceCSSIcon.png);
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-stylesheets .icon {
-    content: url(Images/resourceDocumentIconSmall.png);
-}
-
-.resource-sidebar-tree-item.resources-category-images .icon {
-    position: relative;
-    background-image: url(Images/resourcePlainIcon.png);
-    background-repeat: no-repeat;
-    content: "";
-}
-
-.resource-sidebar-tree-item.resources-category-images .image-resource-icon-preview {
-    position: absolute;
-    margin: auto;
-    top: 3px;
-    bottom: 4px;
-    left: 5px;
-    right: 5px;
-    max-width: 18px;
-    max-height: 21px;
-    min-width: 1px;
-    min-height: 1px;
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-images .icon {
-    background-image: url(Images/resourcePlainIconSmall.png);
-    content: "";
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-images .image-resource-icon-preview {
-    top: 2px;
-    bottom: 1px;
-    left: 3px;
-    right: 3px;
-    max-width: 8px;
-    max-height: 11px;
-}
-
-.resource-sidebar-tree-item.resources-category-fonts .icon {
-    content: url(Images/resourcePlainIcon.png);
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-fonts .icon {
-    content: url(Images/resourcePlainIconSmall.png);
-}
-
-.resource-sidebar-tree-item.resources-category-scripts .icon {
-    content: url(Images/resourceJSIcon.png);
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-scripts .icon {
-    content: url(Images/resourceDocumentIconSmall.png);
-}
-
-.resource-sidebar-tree-item.resources-category-xhr .icon {
-    content: url(Images/resourcePlainIcon.png);
-}
-
-.children.small .resource-sidebar-tree-item.resources-category-xhr .icon {
-    content: url(Images/resourceDocumentIconSmall.png);
-}
-
-.bubble.debug, .console-debug-level .bubble {
-    background-color: rgb(0, 0, 255) !important;
-}
-
-.bubble.warning, .console-warning-level .bubble {
-    background-color: rgb(232, 164, 0) !important;
-}
-
-.bubble.error, .console-error-level .bubble {
-    background-color: rgb(216, 35, 35) !important;
-}
-
-.bubble.search-matches {
-    background-image: url(Images/searchSmallWhite.png);
-    background-repeat: no-repeat;
-    background-position: 3px 2px;
-    padding-left: 13px !important;
-}
-
-.sidebar-tree-item.selected .bubble.search-matches {
-    background-image: url(Images/searchSmallBlue.png);
-}
-
-:focus .sidebar-tree-item.selected .bubble.search-matches {
-    background-image: url(Images/searchSmallBrightBlue.png);
-}
-
-body.inactive .sidebar-tree-item.selected .bubble.search-matches {
-    background-image: url(Images/searchSmallGray.png);
-}
-
-/* Timeline Style */
-
-#timeline-overview-panel {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    height: 80px;
-}
-
-#timeline-overview-panel .timeline-graph-bar {
-    pointer-events: none;
-}
-
-.timeline-sidebar-background {
-    top: 90px;
-    bottom: 0;
-}
-
-.timeline .sidebar {
-    overflow-y: hidden;
-    z-index: 100;
-    min-height: 100%;
-    bottom: auto;
-}
-
-#timeline-overview-separator {
-    position: absolute;
-    top: 80px;
-    left: 0;
-    right: 0;
-    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(253, 253, 253)), to(rgb(213, 213, 213)));
-    border-top: 1px solid rgb(140, 140, 140);
-    border-bottom: 1px solid rgb(115, 115, 115);
-    height: 10px;
-}
-
-#timeline-overview-sidebar {
-    position: absolute;
-    width: 200px;
-    top: 0px;
-    bottom: 0px;
-    left: 0px;
-    padding-top: 1px;
-    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(242, 242, 242)), to(rgb(209, 209, 209)));
-    border-right: 1px solid rgb(163, 163, 163);
-}
-
-#timeline-overview-grid {
-    position: absolute;
-    top: 0px;
-    bottom: 0px;
-    left: 200px;
-    right: 0px;
-    background-color: rgb(224, 224, 224);
-}
-
-#timeline-overview-window {
-    background-color: white;
-    position: absolute;
-    left: 0;
-    right: 0;
-    top: 0;
-    bottom: 0;
-    z-index: 150;
-}
-
-.timeline-window-resizer {
-    position: absolute;
-    top: 35px;
-    bottom: 15px;
-    width: 5px;
-    margin-left: -3px;
-    margin-right: -2px;
-    background-color: rgb(153, 153, 153);
-    z-index: 500;
-    cursor: col-resize;
-    -webkit-border-radius: 2px;
-    -webkit-box-shadow: white 1px 0 0, white -1px 0 0, white 0 1px 0, white 0 -1px 0;
-}
-
-#timeline-overview-grid #resources-graphs {
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    height: 80px;
-}
-
-#timeline-container {
-    position: absolute;
-    top: 90px;
-    left: 0;
-    bottom: 0;
-    right: 0;
-    border-right: 0 none transparent;
-    overflow-y: auto;
-    overflow-x: hidden;
-}
-
-.timeline-clear-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);
-}
-
-.timeline-category-tree-item {
-    height: 20px;
-    line-height: 20px;
-    padding-left: 6px;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    font-weight: bold;
-}
-
-.timeline-category-tree-item .timeline-category-checkbox {
-    width: 10px;
-    height: 11px;
-    margin: 0 3px 0 5px;
-    padding: 0;
-    background-image: url(Images/timelineCheckmarks.png);
-    background-repeat: no-repeat;
-    background-position: 0 -66px;
-    vertical-align: -1px;
-    -webkit-appearance: none;
-}
-
-.timeline-category-tree-item .timeline-category-checkbox:checked {
-    background-position-x: -10px;
-}
-
-.timeline-category-tree-item.timeline-category-loading .timeline-category-checkbox {
-    background-position-y: 0;
-}
-
-.timeline-category-tree-item.timeline-category-scripting .timeline-category-checkbox {
-    background-position-y: -33px;
-}
-
-.timeline-category-tree-item.timeline-category-rendering .timeline-category-checkbox {
-    background-position-y: -11px;
-}
-
-.timeline-category-tree-item:nth-of-type(2n) {
-    background-color: rgba(0, 0, 0, 0.05);
-}
-
-.timeline-tree-item {
-    height: 18px;
-    line-height: 15px;
-    padding-right: 5px;
-    padding-left: 10px;
-    padding-top: 2px;
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-}
-
-.timeline-expandable {
-    position: absolute;
-    border-left: 1px solid rgb(163, 163, 163);
-}
-
-.timeline-expandable-left {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    width: 3px;
-    border-top: 1px solid rgb(163, 163, 163);
-    border-bottom: 1px solid rgb(163, 163, 163);
-}
-
-.timeline-expandable-collapsed {
-    background-image: url(Images/disclosureTriangleSmallRightBlack.png);
-    background-position-x: 1px;
-    background-position-y: 2px;
-    background-repeat: no-repeat;
-}
-
-.timeline-expandable-expanded {
-    background-image: url(Images/disclosureTriangleSmallDownBlack.png);
-    background-position-x: 1px;
-    background-position-y: 3px;
-    background-repeat: no-repeat;
-}
-
-.timeline-tree-item .type {
-    padding-left: 14px;
-}
-
-.timeline-tree-item .count {
-    font-family: Helvetica, Arial, sans-serif;
-    font-weight: bold;
-}
-
-.timeline-tree-item .timeline-tree-icon {
-    background-image: url(Images/timelineDots.png);
-    margin-top: 2px;
-    width: 12px;
-    height: 12px;
-    position: absolute;
-}
-
-.timeline-tree-item.even {
-    background-color: rgba(0, 0, 0, 0.05);
-}
-
-.timeline-tree-item .data.dimmed {
-    color: rgba(0, 0, 0, 0.7);
-}
-
-#timeline-overview-graphs {
-    position: absolute;
-    left: 0;
-    right: 0;
-    bottom: 0;
-    top: 20px;
-}
-
-#timeline-graphs {
-    position: absolute;
-    left: 0;
-    right: 0;
-    max-height: 100%;
-    top: 19px;
-}
-
-.timeline-graph-side {
-    position: relative;
-    height: 18px;
-    padding: 0 5px;
-    white-space: nowrap;
-    margin-top: 0px;
-    border-top: 1px solid transparent;
-    overflow: hidden;
-    pointer-events: none;
-}
-
-.timeline-overview-graph-side {
-    height: 20px;
-    z-index: 170;
-    pointer-events: none;
-}
-
-.timeline-overview-graph-side .timeline-graph-bar {
-    height: 13px;
-}
-
-.timeline-graph-bar-area {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    right: 0;
-    left: 3px;
-    pointer-events: none;
-}
-
-.timeline-graph-bar {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    margin: auto -2px;
-    border-width: 4px 4px 5px;
-    height: 9px;
-    min-width: 5px;
-    opacity: 0.8;
-    -webkit-border-image: url(Images/timelineBarGray.png) 4 4 5 4;
-    z-index: 180;
-    pointer-events: visibleFill;
-}
-
-.timeline-graph-side.even {
-    background-color: rgba(0, 0, 0, 0.05);
-}
-
-.timeline-category-loading .timeline-graph-bar {
-    -webkit-border-image: url(Images/timelineBarBlue.png) 4 4 5 4;
-}
-
-.timeline-category-scripting .timeline-graph-bar {
-    -webkit-border-image: url(Images/timelineBarOrange.png) 4 4 5 4;
-}
-
-.timeline-category-rendering .timeline-graph-bar {
-    -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4;
-}
-
-.timeline-category-loading .timeline-tree-icon {
-    background-position-y: 0px;
-}
-
-.timeline-category-scripting .timeline-tree-icon {
-    background-position-y: 48px;
-}
-
-.timeline-category-rendering .timeline-tree-icon {
-    background-position-y: 72px;
-}
-
-/* Profiler Style */
-
-#profile-views {
-    position: absolute;
-    top: 0;
-    right: 0;
-    left: 200px;
-    bottom: 0;
-}
-
-#profile-view-status-bar-items {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 200px;
-    overflow: hidden;
-    border-left: 1px solid rgb(184, 184, 184);
-    margin-left: -1px;
-}
-
-.profile-sidebar-tree-item .icon {
-    content: url(Images/profileIcon.png);
-}
-
-.profile-sidebar-tree-item.small .icon {
-    content: url(Images/profileSmallIcon.png);
-}
-
-.profile-group-sidebar-tree-item .icon {
-    content: url(Images/profileGroupIcon.png);
-}
-
-.profile-view {
-    display: none;
-    overflow: hidden;
-    position: absolute;
-    top: 0;
-    left: 0;
-    right: 0;
-    bottom: 0;
-}
-
-.profile-view.visible {
-    display: block;
-}
-
-.profile-view .data-grid {
-    border: none;
-    height: 100%;
-}
-
-.profile-view .data-grid th.average-column {
-    text-align: center;
-}
-
-.profile-view .data-grid td.average-column {
-    text-align: right;
-}
-
-.profile-view .data-grid th.self-column {
-    text-align: center;
-}
-
-.profile-view .data-grid td.self-column {
-    text-align: right;
-}
-
-.profile-view .data-grid th.total-column {
-    text-align: center;
-}
-
-.profile-view .data-grid td.total-column {
-    text-align: right;
-}
-
-.profile-view .data-grid .calls-column {
-    text-align: center;
-}
-
-.profile-node-file {
-    float: right;
-    color: gray;
-    margin-top: -1px;
-}
-
-.data-grid tr.selected .profile-node-file {
-    color: rgb(33%, 33%, 33%);
-}
-
-.data-grid:focus tr.selected .profile-node-file {
-    color: white;
-}
-
-button.enable-toggle-status-bar-item .glyph {
-}
-
-.record-profile-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/recordButtonGlyph.png);
-}
-
-.record-profile-status-bar-item.toggled-on .glyph {
-    -webkit-mask-image: url(Images/recordToggledButtonGlyph.png);
-    background-color: rgb(216, 0, 0) !important;
-}
-
-/* FIXME: should have its own glyph. */
-.heap-snapshot-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/focusButtonGlyph.png);
-}
-
-.node-search-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/nodeSearchButtonGlyph.png);
-}
-
-.percent-time-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/percentButtonGlyph.png);
-}
-
-.focus-profile-node-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/focusButtonGlyph.png);
-}
-
-.exclude-profile-node-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/excludeButtonGlyph.png);
-}
-
-.reset-profile-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/reloadButtonGlyph.png);
-}
-
-.delete-storage-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/excludeButtonGlyph.png);
-}
-
-#storage-view-status-bar-items {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 200px;
-    overflow: hidden;
-    border-left: 1px solid rgb(184, 184, 184);
-    margin-left: -1px;
-}
-
-.refresh-storage-status-bar-item .glyph {
-    -webkit-mask-image: url(Images/reloadButtonGlyph.png);
-}
-
-#storage-view-status-bar-items {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 200px;
-    overflow: hidden;
-    border-left: 1px solid rgb(184, 184, 184);
-    margin-left: -1px;
-}
-
-ol.breakpoint-list {
-    -webkit-padding-start: 2px;
-    list-style: none;
-    margin: 0;
-}
-
-.breakpoint-list li {
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    margin: 4px 0;
-    color: rgb(33%, 33%, 33%);
-    cursor: pointer;
-}
-
-.breakpoint-list li:hover {
-    color: rgb(15%, 15%, 15%);
-}
-
-.breakpoint-list .checkbox-elem {
-    font-size: 10px;
-    margin: 0 4px;
-    vertical-align: top;
-    position: relative;
-    z-index: 1;
-}
-
-.breakpoint-list .source-text {
-    white-space: nowrap;
-    text-overflow: ellipsis;
-    overflow: hidden;
-    margin: 2px 0 0px 20px;
-}
-
-.webkit-html-js-node, .webkit-html-css-node {
-    white-space: pre;
-}
-
-.source-frame-breakpoint-condition {
-    z-index: 30;
-    padding: 4px;
-    background-color: rgb(203, 226, 255);
-    -webkit-border-radius: 7px;
-    border: 2px solid rgb(169, 172, 203); 
-    width: 90%; 
-}
-
-.source-frame-breakpoint-message {
-    background-color: transparent;
-    font-family: Lucida Grande, sans-serif; 
-    font-weight: normal;
-    font-size: 11px;
-    text-align: left;
-    text-shadow: none;
-    color: rgb(85, 85, 85);
-    cursor: default;
-    margin: 0 0 2px 0; 
-}
-
-#source-frame-breakpoint-condition {
-    margin: 0;
-    border: 1px inset rgb(190, 190, 190) !important;
-    width: 100%;
-    box-shadow: none !important;
-    outline: none !important;
-    -webkit-user-modify: read-write;
-}
-
-.source-frame-popover-title {
-    text-overflow: ellipsis;
-    overflow: hidden;
-    white-space: nowrap;
-    font-weight: bold;
-    padding-left: 18px;
-}
-
-.source-frame-popover-tree {
-    border-top: 1px solid rgb(194, 194, 147);
-    overflow: auto;
-    position: absolute;
-    top: 15px;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-
-.source-frame-eval-expression {
-    border: 1px solid rgb(163, 41, 34);
-    margin: -1px;
-    background-color: rgb(255, 255, 194);
-}
-
-.timeline-details {
-    -webkit-user-select: text;
-}
-
-.timeline-details-row-title {
-    font-weight: bold;
-    text-align: right;
-    white-space: nowrap;
-}
-
-.timeline-details-row-data {
-    white-space: nowrap;
-}
-
-.timeline-details-title {
-    font-weight: bold;
-    white-space: nowrap;
-}
-
diff --git a/resources/inspector/inspector.html b/resources/inspector/inspector.html
deleted file mode 100644
index e5295f2..0000000
--- a/resources/inspector/inspector.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<!--
-Copyright (C) 2006, 2007, 2008 Apple Inc.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1.  Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-2.  Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
-3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
-    its contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-<!DOCTYPE html>
-<html>
-<head>
-    <meta http-equiv="content-type" content="text/html; charset=utf-8">
-    <link rel="stylesheet" type="text/css" href="audits.css">
-    <link rel="stylesheet" type="text/css" href="inspector.css">
-    <link rel="stylesheet" type="text/css" href="inspectorSyntaxHighlight.css">
-    <link rel="stylesheet" type="text/css" href="popover.css">
-    <link rel="stylesheet" type="text/css" href="textViewer.css">
-    <script type="text/javascript" src="utilities.js"></script>
-    <script type="text/javascript" src="treeoutline.js"></script>
-    <script type="text/javascript" src="inspector.js"></script>
-    <script type="text/javascript" src="InspectorBackendStub.js"></script>
-    <script type="text/javascript" src="InspectorFrontendHostStub.js"></script>
-    <script type="text/javascript" src="Object.js"></script>
-    <script type="text/javascript" src="Settings.js"></script>
-    <script type="text/javascript" src="ContextMenu.js"></script>
-    <script type="text/javascript" src="KeyboardShortcut.js"></script>
-    <script type="text/javascript" src="TextPrompt.js"></script>
-    <script type="text/javascript" src="Popover.js"></script>
-    <script type="text/javascript" src="Placard.js"></script>
-    <script type="text/javascript" src="View.js"></script>
-    <script type="text/javascript" src="Callback.js"></script>
-    <script type="text/javascript" src="Drawer.js"></script>
-    <script type="text/javascript" src="ChangesView.js"></script>
-    <script type="text/javascript" src="ConsoleView.js"></script>
-    <script type="text/javascript" src="Panel.js"></script>
-    <script type="text/javascript" src="TimelineGrid.js"></script>    
-    <script type="text/javascript" src="AbstractTimelinePanel.js"></script>
-    <script type="text/javascript" src="Resource.js"></script>
-    <script type="text/javascript" src="ResourceCategory.js"></script>
-    <script type="text/javascript" src="Database.js"></script>
-    <script type="text/javascript" src="DOMStorage.js"></script>
-    <script type="text/javascript" src="DOMStorageItemsView.js"></script>
-    <script type="text/javascript" src="DataGrid.js"></script>
-    <script type="text/javascript" src="CookieItemsView.js"></script>
-    <script type="text/javascript" src="Script.js"></script>
-    <script type="text/javascript" src="Breakpoint.js"></script>
-    <script type="text/javascript" src="SidebarPane.js"></script>
-    <script type="text/javascript" src="ElementsTreeOutline.js"></script>
-    <script type="text/javascript" src="SidebarTreeElement.js"></script>
-    <script type="text/javascript" src="Section.js"></script>
-    <script type="text/javascript" src="PropertiesSection.js"></script>
-    <script type="text/javascript" src="ObjectProxy.js"></script>
-    <script type="text/javascript" src="ObjectPropertiesSection.js"></script>
-    <script type="text/javascript" src="BreakpointsSidebarPane.js"></script>
-    <script type="text/javascript" src="CallStackSidebarPane.js"></script>
-    <script type="text/javascript" src="ScopeChainSidebarPane.js"></script>
-    <script type="text/javascript" src="WatchExpressionsSidebarPane.js"></script>
-    <script type="text/javascript" src="MetricsSidebarPane.js"></script>
-    <script type="text/javascript" src="PropertiesSidebarPane.js"></script>
-    <script type="text/javascript" src="EventListenersSidebarPane.js"></script>
-    <script type="text/javascript" src="Color.js"></script>
-    <script type="text/javascript" src="StylesSidebarPane.js"></script>
-    <script type="text/javascript" src="PanelEnablerView.js"></script>
-    <script type="text/javascript" src="WelcomeView.js"></script>
-    <script type="text/javascript" src="StatusBarButton.js"></script>
-    <script type="text/javascript" src="SummaryBar.js"></script>
-    <script type="text/javascript" src="ElementsPanel.js"></script>
-    <script type="text/javascript" src="ResourcesPanel.js"></script>
-    <script type="text/javascript" src="InjectedFakeWorker.js"></script>
-    <script type="text/javascript" src="ScriptsPanel.js"></script>
-    <script type="text/javascript" src="StoragePanel.js"></script>
-    <script type="text/javascript" src="ProfilesPanel.js"></script>
-    <script type="text/javascript" src="ConsolePanel.js"></script>
-    <script type="text/javascript" src="AuditsPanel.js"></script>
-    <script type="text/javascript" src="AuditResultView.js"></script>
-    <script type="text/javascript" src="AuditLauncherView.js"></script>
-    <script type="text/javascript" src="AuditRules.js"></script>
-    <script type="text/javascript" src="AuditCategories.js"></script>
-    <script type="text/javascript" src="ResourceView.js"></script>
-    <script type="text/javascript" src="SourceFrame.js"></script>
-    <script type="text/javascript" src="DOMSyntaxHighlighter.js"></script>
-    <script type="text/javascript" src="TextEditorModel.js"></script>
-    <script type="text/javascript" src="TextEditorHighlighter.js"></script>
-    <script type="text/javascript" src="TextViewer.js"></script>
-    <script type="text/javascript" src="SourceTokenizer.js"></script>
-    <script type="text/javascript" src="SourceCSSTokenizer.js"></script>
-    <script type="text/javascript" src="SourceHTMLTokenizer.js"></script>
-    <script type="text/javascript" src="SourceJavaScriptTokenizer.js"></script>
-    <script type="text/javascript" src="SourceView.js"></script>
-    <script type="text/javascript" src="FontView.js"></script>
-    <script type="text/javascript" src="ImageView.js"></script>
-    <script type="text/javascript" src="DatabaseTableView.js"></script>
-    <script type="text/javascript" src="DatabaseQueryView.js"></script>
-    <script type="text/javascript" src="ScriptView.js"></script>
-    <script type="text/javascript" src="ProfileDataGridTree.js"></script>
-    <script type="text/javascript" src="BottomUpProfileDataGridTree.js"></script>
-    <script type="text/javascript" src="TopDownProfileDataGridTree.js"></script>
-    <script type="text/javascript" src="ProfileView.js"></script>
-    <script type="text/javascript" src="DOMAgent.js"></script>
-    <script type="text/javascript" src="InjectedScript.js"></script>
-    <script type="text/javascript" src="InjectedScriptAccess.js"></script>
-    <script type="text/javascript" src="TimelineAgent.js"></script>
-    <script type="text/javascript" src="TimelinePanel.js"></script>
-    <script type="text/javascript" src="TimelineOverviewPane.js"></script>
-    <script type="text/javascript" src="TestController.js"></script>
-</head>
-<body class="detached">
-    <div id="toolbar">
-        <div class="toolbar-item close-left"><button id="close-button-left"></button></div>
-        <div class="toolbar-item flexable-space"></div>
-        <div class="toolbar-item hidden" id="search-results-matches"></div>
-        <div class="toolbar-item"><input id="search" type="search" incremental results="0"><div id="search-toolbar-label" class="toolbar-label"></div></div>
-        <div class="toolbar-item close-right"><button id="close-button-right"></button></div>
-    </div>
-    <div id="main">
-        <div id="main-panels" spellcheck="false"></div>
-        <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><button id="dock-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="changes-status-bar-item" class="status-bar-item hidden"></button><div id="count-items"><div id="changes-count" class="hidden"></div><div id="error-warning-count" class="hidden"></div></div></div></div>
-    </div>
-    <div id="drawer">
-        <div id="console-view"><div id="console-messages" class="monospace"><div id="console-prompt" spellcheck="false"><br></div></div></div>
-        <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="scope-bar status-bar-item"></div></div></div>
-    </div>
-</body>
-</html>
diff --git a/resources/inspector/inspectorSyntaxHighlight.css b/resources/inspector/inspectorSyntaxHighlight.css
deleted file mode 100644
index 0965a5c..0000000
--- a/resources/inspector/inspectorSyntaxHighlight.css
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-.webkit-css-comment { 
-    color: rgb(0, 116, 0);
-}
-
-.webkit-css-url, .webkit-css-color, .webkit-css-string, .webkit-css-keyword {
-    color: rgb(7, 144, 154);
- }
-
-.webkit-css-number {
-    color: rgb(50, 0, 255);
-}
-
-.webkit-css-property, .webkit-css-at-rule {
-    color: rgb(200, 0, 0);
-}
-
-.webkit-css-selector {
-    color: black;
-}
-
-.webkit-css-important {
-    color: rgb(200, 0, 180);
-}
-
-.webkit-javascript-comment {
-    color: rgb(0, 116, 0);
-}
-
-.webkit-javascript-keyword {
-    color: rgb(170, 13, 145);
-}
-
-.webkit-javascript-number {
-    color: rgb(28, 0, 207);
-}
-
-.webkit-javascript-string, .webkit-javascript-regexp {
-    color: rgb(196, 26, 22);
-}
-
-.webkit-javascript-ident {
-    color: black;
-}
-
-.webkit-html-comment {
-    /* Keep this in sync with view-source.css (.webkit-html-comment) */
-    color: rgb(35, 110, 37);
-}
-
-.webkit-html-tag {
-    /* Keep this in sync with view-source.css (.webkit-html-tag) */
-    color: rgb(136, 18, 128);
-}
-
-.webkit-html-doctype {
-    /* Keep this in sync with view-source.css (.webkit-html-doctype) */
-    color: rgb(192, 192, 192);
-}
-
-.webkit-html-attribute-name {
-    /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */
-    color: rgb(153, 69, 0);
-}
-
-.webkit-html-attribute-value {
-    /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */
-    color: rgb(26, 26, 166);
-}
-
-.webkit-html-external-link, .webkit-html-resource-link {
-    /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */
-    color: #00e;
-}
-
-.webkit-html-external-link {
-    /* Keep this in sync with view-source.css (.webkit-html-external-link) */
-    text-decoration: none;
-}
-
-.webkit-html-external-link:hover {
-    /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */
-    text-decoration: underline;
-}
diff --git a/resources/inspector/popover.css b/resources/inspector/popover.css
deleted file mode 100644
index ae6f610..0000000
--- a/resources/inspector/popover.css
+++ /dev/null
@@ -1,200 +0,0 @@
-.popover {
-    position: absolute;
-    -webkit-border-image: url(Images/popoverBackground.png) 25 25 25 25;
-    border-width: 25px;
-    z-index: 100;
-    pointer-events: none;
-}
-
-.popover .content {
-    position: absolute;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 0;
-    pointer-events: auto;
-    overflow: auto;
-}
-
-.popover .arrow {
-    position: absolute;
-    background-image: url(Images/popoverArrows.png);
-    width: 19px;
-    height: 19px;
-    margin-left: 15px;
-    margin-top: -25px;
-    top: 0;
-    left: 0;
-}
-
-.popover.top-left-arrow .arrow {
-    /* The default is top-left, no styles needed. */
-}
-
-.popover.top-right-arrow .arrow {
-    right: 25px;
-    left: auto;
-}
-
-.popover.bottom-left-arrow .arrow {
-    top: auto;
-    bottom: 0;
-    margin-top: 0;
-    margin-bottom: -25px;
-    background-position: 0 -19px;
-}
-
-.popover.bottom-right-arrow .arrow {
-    right: 15px;
-    left: auto;
-    top: auto;
-    bottom: 0;
-    margin-top: 0;
-    margin-bottom: -25px;
-    background-position: 0 -19px;
-}
-
-.popover.left-top-arrow .arrow {
-    top: 0;
-    margin-top: 15px;
-    margin-left: -25px;
-    background-position: 0 -38px;
-}
-
-.popover.left-bottom-arrow .arrow {
-    top: auto;
-    bottom: 0;
-    margin-bottom: 15px;
-    margin-left: -25px;
-    background-position: 0 -38px;
-}
-
-.popover.right-top-arrow .arrow {
-    right: 0;
-    left: auto;
-    top: 0;
-    margin-top: 15px;
-    margin-right: -25px;
-    background-position: 0 -57px;
-}
-
-.popover.right-bottom-arrow .arrow {
-    right: 0;
-    left: auto;
-    top: auto;
-    bottom: 0;
-    margin-bottom: 15px;
-    margin-right: -25px;
-    background-position: 0 -57px;
-}
-
-.popover ::-webkit-scrollbar {
-    width: 11px;
-    height: 11px;
-}
-
-.popover ::-webkit-scrollbar-corner {
-    display: none;
-}
-
-.popover ::-webkit-resizer {
-    display: none;
-}
-
-/* Horizontal Scrollbar Styles */
-
-.popover ::-webkit-scrollbar:horizontal:corner-present {
-    border-right-width: 0;
-}
-
-.popover ::-webkit-scrollbar-thumb:horizontal {
-    -webkit-border-image: url(Images/thumbHoriz.png) 0 11 0 11;
-    border-color: transparent;
-    border-width: 0 11px;
-    min-width: 20px;
-}
-
-.popover ::-webkit-scrollbar-thumb:horizontal:hover {
-    -webkit-border-image: url(Images/thumbHoverHoriz.png) 0 11 0 11;
-}
-
-.popover ::-webkit-scrollbar-thumb:horizontal:active {
-    -webkit-border-image: url(Images/thumbActiveHoriz.png) 0 11 0 11;
-}
-
-.popover ::-webkit-scrollbar-track-piece:horizontal:start {
-    margin-left: 5px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:horizontal:end {
-    margin-right: 5px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:horizontal:end:corner-present {
-    margin-right: 4px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:horizontal:decrement {
-    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
-    border-color: transparent;
-    border-width: 0 0 0 11px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:horizontal:increment {
-    -webkit-border-image: url(Images/trackHoriz.png) 0 11 0 11;
-    border-color: transparent;
-    border-width: 0 11px 0 0;
-}
-
-/* Vertical Scrollbar Styles */
-
-
-.popover ::-webkit-scrollbar:vertical:corner-present {
-    border-bottom-width: 0;
-}
-
-.popover ::-webkit-scrollbar-thumb:vertical {
-    -webkit-border-image: url(Images/thumbVert.png) 11 0 11 0;
-    border-color: transparent;
-    border-width: 11px 0;
-    min-height: 20px;
-}
-
-.popover ::-webkit-scrollbar-thumb:vertical:hover {
-    -webkit-border-image: url(Images/thumbHoverVert.png) 11 0 11 0;
-}
-
-.popover ::-webkit-scrollbar-thumb:vertical:active {
-    -webkit-border-image: url(Images/thumbActiveVert.png) 11 0 11 0;
-}
-
-
-.popover ::-webkit-scrollbar-track-piece:vertical:start {
-    margin-top: 5px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:vertical:end {
-    margin-bottom: 5px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:vertical:end:corner-present {
-    margin-bottom: 4px;
-}
-
-.popover ::-webkit-scrollbar-track-piece:vertical:decrement {
-    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
-    border-color: transparent;
-    border-width: 11px 0 0 0;
-}
-
-.popover ::-webkit-scrollbar-track-piece:vertical:increment {
-    -webkit-border-image: url(Images/trackVert.png) 11 0 11 0;
-    border-color: transparent;
-    border-width: 0 0 11px 0;
-}
-
-/* Forced Scrollbar Mode Styles */
-
-.popover ::-webkit-scrollbar-button {
-    display: none;
-}
diff --git a/resources/inspector/textViewer.css b/resources/inspector/textViewer.css
deleted file mode 100644
index b69545f..0000000
--- a/resources/inspector/textViewer.css
+++ /dev/null
@@ -1,162 +0,0 @@
-.text-editor {
-    position: absolute;
-    top:0;
-    left:0;
-    right:0;
-    bottom:0;
-    white-space: pre;
-    overflow: auto;
-}
-
-.text-editor-lines {
-    border: 0;
-    -webkit-border-horizontal-spacing: 0;
-    -webkit-border-vertical-spacing: 0;
-    -webkit-user-select: text;
-}
-
-.webkit-html-message-bubble {
-    -webkit-box-shadow: black 0px 2px 5px;
-    -webkit-border-radius: 9px;
-    -webkit-border-fit: lines;
-    font-size: 10px;
-    font-family: Lucida Grande, sans-serif;
-    font-weight: bold;
-    margin: 6px 25px;
-    padding: 0 7px 1px;
-    z-index:20;
-    max-width: 80%;
-    
-}
-
-.webkit-html-warning-message {
-    background-color: rgb(100%, 62%, 42%);
-    border: 2px solid rgb(100%, 52%, 21%);
-}
-
-.webkit-html-error-message {
-    background-color: rgb(100%, 42%, 42%);
-    border: 2px solid rgb(100%, 31%, 31%);
-}
-
-.webkit-html-message-line {
-    padding-left: 23px;
-    text-indent: -20px;
-}
-
-.webkit-html-message-line-hover {
-    padding-left: 23px;
-    text-indent: -20px;
-    white-space: auto;
-    text-overflow: auto;
-    overflow: auto;
-}
-
-.webkit-html-message-icon {
-    position: relative;
-    top: 2px;
-    margin: 0 4px;
-}
-
-.webkit-line-number {
-    color: rgb(128, 128, 128);
-    background-color: rgb(240, 240, 240);
-    border-right: 1px solid rgb(187, 187, 187);
-    text-align: right;
-    word-break: normal;
-    -webkit-user-select: none;
-	padding-right: 4px;
-	padding-left: 6px;
-}
-
-.webkit-line-number-outer {
-    margin-right: -4px;
-    margin-left: -4px;
-    border-color: transparent;
-    border-style: solid;
-    border-width: 0 0 0px 2px;
-    vertical-align: top;
-}
-
-.webkit-line-number-inner {
-    margin-right: 4px;
-}
-
-.webkit-breakpoint .webkit-line-number-inner, .webkit-breakpoint-conditional .webkit-line-number-inner, .webkit-execution-line .webkit-line-number-inner {
-    margin-right: -10px;
-}
-
-.webkit-line-content {
-    width: 100%;
-    padding-left: 2px;
-    vertical-align: top;
-}
-
-.webkit-breakpoint .webkit-line-number-outer {
-    color: white;
-    border-width: 0 14px 0px 2px;
-    -webkit-border-image: url(Images/breakpointBorder.png) 0 14 0 2;
-}
-
-.webkit-breakpoint-conditional .webkit-line-number-outer {
-    color: white;
-    border-width: 0 14px 0px 2px;
-    -webkit-border-image: url(Images/breakpointConditionalBorder.png) 0 14 0 2;
-}
-
-.webkit-execution-line .webkit-line-number-outer {
-    color: transparent;
-    border-width: 0 14px 0px 2px;
-    -webkit-border-image: url(Images/programCounterBorder.png) 0 14 0 2;
-}
-
-.webkit-breakpoint.webkit-execution-line .webkit-line-number-outer {
-    color: white;
-    -webkit-border-image: url(Images/breakpointCounterBorder.png) 0 14 0 2;
-}
-
-.webkit-breakpoint.webkit-execution-line .webkit-line-number-outer {
-    color: transparent;
-    -webkit-border-image: url(Images/breakpointCounterBorder.png) 0 14 0 2;
-}
-
-.webkit-breakpoint-conditional.webkit-execution-line .webkit-line-number-outer {
-    color: transparent;
-    -webkit-border-image: url(Images/breakpointConditionalCounterBorder.png) 0 14 0 2;
-}
-
-.webkit-breakpoint-disabled .webkit-line-number-outer {
-    opacity: 0.5;
-}
-
-.breakpoints-deactivated .webkit-breakpoint .webkit-line-number-outer {
-    opacity: 0.5;
-}
-
-.breakpoints-deactivated .webkit-breakpoint-disabled .webkit-line-number-outer {
-    opacity: 0.3;
-}
-
-.webkit-execution-line .webkit-line-content {
-    background-color: rgb(171, 191, 254);
-    outline: 1px solid rgb(64, 115, 244);
-}
-
-.webkit-search-result {
-    -webkit-border-radius: 4px;
-    padding: 2px 2px 2px 3px;
-    margin: -2px -2px -2px -3px;
-    opacity: 0.8;
-    -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px;
-    background-color: rgb(241, 234, 0);
-    color: black;
-}
-
-.webkit-highlighted-line .webkit-line-content {
-    -webkit-animation: "fadeout" 2s 0s;
-}
-
-@-webkit-keyframes fadeout {
-    from {background-color: rgb(255, 255, 120); }
-    to { background-color: white; }
-}
diff --git a/xdg-settings b/xdg-settings
index dda7719..7fc9f26 100644
--- a/xdg-settings
+++ b/xdg-settings
@@ -210,7 +210,7 @@
 }
 
 #------------------------------------------------------------
-# Exit script on insufficient permission to read a specified file
+# Exit script on insufficient permission to write a specified file
 
 exit_failure_file_permission_write()
 {
@@ -313,7 +313,8 @@
 {
     if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde;
     elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome;
-    elif xprop -root _DT_SAVE_MODE | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
+    elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/null 2>&1` ; then DE=gnome;
+    elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
     fi
 }
 
@@ -521,15 +522,18 @@
 read_kde_browser()
 {
     browser="`kreadconfig --file kdeglobals --group General --key BrowserApplication`"
-    if [ "$browser" ]; then
+    if [ x"$browser" != x ]; then
         echo "$browser"
+    else
+        # kreadconfig in KDE 4 may not notice Key[$*]=... localized settings, so
+        # check by hand if it didn't find anything (oddly kwriteconfig works
+        # fine though).
+        kdeglobals_dir=`kde${KDE_SESSION_VERSION}-config --path config  | cut -d ':' -f 1`
+        kdeglobals="$kdeglobals_dir/kdeglobals"
+        [ ! -f "$kdeglobals" ] && return
+        # This will only take the first value if there is more than one.
+        grep '^BrowserApplication\[$[^]=]*\]=' "$kdeglobals" | head -n 1 | cut -d= -f 2-
     fi
-    # kreadconfig in KDE 4 may not notice Key[$*]=... localized settings, so check
-    # by hand if it didn't find anything (oddly kwriteconfig works fine though).
-    kdeglobals="${KDE_HOME:-$HOME/.kde}/share/config/kdeglobals"
-    [ ! -f "$kdeglobals" ] && return
-    # This will only take the first value if there is more than one.
-    grep '^BrowserApplication\[$[^]=]*\]=' "$kdeglobals" | head -n 1 | cut -d= -f 2-
 }
 
 get_browser_kde()