incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject [20/51] [partial] Apache-ization, port to node.js
Date Wed, 15 Feb 2012 17:42:37 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/ProfilesPanel.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/ProfilesPanel.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ProfilesPanel.js
new file mode 100644
index 0000000..b87ea7f
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ProfilesPanel.js
@@ -0,0 +1,794 @@
+/*
+ * 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.
+ */
+
+const UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
+
+WebInspector.ProfileType = function(id, name)
+{
+    this._id = id;
+    this._name = name;
+}
+
+WebInspector.ProfileType.URLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
+
+WebInspector.ProfileType.prototype = {
+    get buttonTooltip()
+    {
+        return "";
+    },
+
+    get buttonStyle()
+    {
+        return undefined;
+    },
+
+    get buttonCaption()
+    {
+        return this.name;
+    },
+
+    get id()
+    {
+        return this._id;
+    },
+
+    get name()
+    {
+        return this._name;
+    },
+
+    buttonClicked: function()
+    {
+    },
+
+    viewForProfile: function(profile)
+    {
+        if (!profile._profileView)
+            profile._profileView = this.createView(profile);
+        return profile._profileView;
+    },
+
+    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.");
+    }
+}
+
+WebInspector.ProfilesPanel = function()
+{
+    WebInspector.Panel.call(this, "profiles");
+
+    this.createSidebar();
+
+    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);
+
+    this.element.appendChild(this.panelEnablerView.element);
+
+    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.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."), "clear-status-bar-item");
+    this.clearResultsButton.addEventListener("click", this._clearProfiles.bind(this), false);
+
+    this.profileViewStatusBarItemsContainer = document.createElement("div");
+    this.profileViewStatusBarItemsContainer.className = "status-bar-items";
+
+    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();
+    InspectorBackend.registerDomainDispatcher("Profiler", new WebInspector.ProfilerDispatcher(this));
+}
+
+WebInspector.ProfilesPanel.prototype = {
+    get toolbarItemLabel()
+    {
+        return WebInspector.UIString("Profiles");
+    },
+
+    get statusBarItems()
+    {
+        function clickHandler(profileType, buttonElement)
+        {
+            profileType.buttonClicked.call(profileType);
+            this.updateProfileTypeButtons();
+        }
+
+        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.clearResultsButton.element, this.profileViewStatusBarItemsContainer);
+        return items;
+    },
+
+    show: function()
+    {
+        WebInspector.Panel.prototype.show.call(this);
+        this._populateProfiles();
+    },
+
+    _profilerWasEnabled: function()
+    {
+        if (this._profilerEnabled)
+            return;
+
+        this._profilerEnabled = true;
+
+        this._reset();
+        if (this.visible)
+            this._populateProfiles();
+    },
+
+    _profilerWasDisabled: function()
+    {
+        if (!this._profilerEnabled)
+            return;
+
+        this._profilerEnabled = false;
+        this._reset();
+    },
+
+    _reset: function()
+    {
+        for (var i = 0; i < this._profiles.length; ++i)
+            delete this._profiles[i]._profileView;
+        delete this.visibleView;
+
+        delete this.currentQuery;
+        this.searchCanceled();
+
+        this._profiles = [];
+        this._profilesIdMap = {};
+        this._profileGroups = {};
+        this._profileGroupsForLinks = {};
+        this._profilesWereRequested = false;
+
+        this.sidebarTreeElement.removeStyleClass("some-expandable");
+
+        for (var typeId in this._profileTypesByIdMap)
+            this.getProfileType(typeId).treeElement.removeChildren();
+
+        this.profileViews.removeChildren();
+
+        this.profileViewStatusBarItemsContainer.removeChildren();
+
+        this.removeAllListeners();
+
+        this._updateInterface();
+        this.welcomeView.show();
+    },
+
+    _clearProfiles: function()
+    {
+        InspectorBackend.clearProfiles();
+        this._reset();
+    },
+
+    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);
+    },
+
+    _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);
+            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);
+    },
+
+    _makeKey: function(text, profileTypeId)
+    {
+        return escape(text) + '/' + escape(profileTypeId);
+    },
+
+    _addProfileHeader: function(profile)
+    {
+        if (this.hasTemporaryProfile(profile.typeId)) {
+            if (profile.typeId === WebInspector.CPUProfileType.TypeId)
+                this._removeProfileHeader(this._temporaryRecordingProfile);
+            else
+                this._removeProfileHeader(this._temporaryTakingSnapshot);
+        }
+
+        var typeId = profile.typeId;
+        var profileType = this.getProfileType(typeId);
+        var sidebarParent = profileType.treeElement;
+        var small = false;
+        var alternateTitle;
+
+        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);
+
+            if (group.length === 2) {
+                // Make a group TreeElement now that there are 2 profiles.
+                group._profilesTreeElement = new WebInspector.ProfileGroupSidebarTreeElement(profile.title);
+
+                // 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);
+
+                // 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();
+                }
+
+                group[0]._profilesTreeElement.small = true;
+                group[0]._profilesTreeElement.mainTitle = WebInspector.UIString("Run %d", 1);
+
+                this.sidebarTreeElement.addStyleClass("some-expandable");
+            }
+
+            if (group.length >= 2) {
+                sidebarParent = group._profilesTreeElement;
+                alternateTitle = WebInspector.UIString("Run %d", group.length);
+                small = true;
+            }
+        }
+
+        var profileTreeElement = profileType.createSidebarTreeElementForProfile(profile);
+        profile.sideBarElement = profileTreeElement;
+        profileTreeElement.small = small;
+        if (alternateTitle)
+            profileTreeElement.mainTitle = alternateTitle;
+        profile._profilesTreeElement = profileTreeElement;
+
+        sidebarParent.appendChild(profileTreeElement);
+        if (!profile.isTemporary) {
+            this.welcomeView.hide();
+            if (!this.visibleView)
+                this.showProfile(profile);
+            this.dispatchEventToListeners("profile added");
+        }
+    },
+
+    _removeProfileHeader: function(profile)
+    {
+        var typeId = profile.typeId;
+        var profileType = this.getProfileType(typeId);
+        var sidebarParent = profileType.treeElement;
+
+        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)];
+
+        var profileTitleKey = this._makeKey(profile.title, typeId);
+        delete this._profileGroups[profileTitleKey];
+
+        sidebarParent.removeChild(profile._profilesTreeElement);
+
+        if (!profile.isTemporary)
+            InspectorBackend.removeProfile(profile.typeId, profile.uid);
+
+        // No other item will be selected if there aren't any other profiles, so
+        // make sure that view gets cleared when the last profile is removed.
+        if (!this._profiles.length)
+            this.closeVisibleView();
+    },
+
+    showProfile: function(profile)
+    {
+        if (!profile || profile.isTemporary)
+            return;
+
+        this.closeVisibleView();
+
+        var view = profile.__profilesPanelProfileType.viewForProfile(profile);
+
+        view.show(this.profileViews);
+
+        profile._profilesTreeElement.select(true);
+        profile._profilesTreeElement.reveal();
+
+        this.visibleView = view;
+
+        this.profileViewStatusBarItemsContainer.removeChildren();
+
+        var statusBarItems = view.statusBarItems;
+        if (statusBarItems)
+            for (var i = 0; i < statusBarItems.length; ++i)
+                this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
+    },
+
+    getProfiles: function(typeId)
+    {
+        var result = [];
+        var profilesCount = this._profiles.length;
+        for (var i = 0; i < profilesCount; ++i) {
+            var profile = this._profiles[i];
+            if (!profile.isTemporary && profile.typeId === typeId)
+                result.push(profile);
+        }
+        return result;
+    },
+
+    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;
+    },
+
+    hasProfile: function(profile)
+    {
+        return !!this._profilesIdMap[this._makeKey(profile.uid, profile.typeId)];
+    },
+
+    loadHeapSnapshot: function(uid, callback)
+    {
+        var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)];
+        if (!profile)
+            return;
+
+        if (profile._loaded)
+            callback(profile);
+        else if (profile._is_loading)
+            profile._callbacks.push(callback);
+        else {
+            profile._is_loading = true;
+            profile._callbacks = [callback];
+            profile._json = "";
+            profile.sideBarElement.subtitle = WebInspector.UIString("Loading…");
+            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;
+        profile.sideBarElement.subtitle = WebInspector.UIString("Parsing…");
+        window.setTimeout(doParse, 0);
+
+        function doParse()
+        {
+            var loadedSnapshot = JSON.parse(profile._json);
+            delete profile._json;
+            delete profile._is_loading;
+            profile._loaded = true;
+            profile.sideBarElement.subtitle = "";
+            if (!Preferences.detailedHeapProfiles)
+                WebInspector.HeapSnapshotView.prototype.processLoadedSnapshot(profile, loadedSnapshot);
+            else
+                WebInspector.DetailedHeapshotView.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;
+            // FIXME: Apply profileType.buttonCaption once captions are added to button controls.
+        }
+    },
+
+    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)
+                // 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 + 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()
+    {
+        // 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.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) {
+            WebInspector.settings.profilerEnabled = false;
+            InspectorBackend.disableProfiler(true);
+        } else {
+            WebInspector.settings.profilerEnabled = !!optionalAlways;
+            InspectorBackend.enableProfiler();
+        }
+    },
+
+    _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]))
+                   this._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();
+    },
+
+    _setRecordingProfile: function(isProfiling)
+    {
+        this.getProfileType(WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling);
+        if (this.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._addProfileHeader(this._temporaryRecordingProfile);
+            else
+                this._removeProfileHeader(this._temporaryRecordingProfile);
+        }
+        this.updateProfileTypeButtons();
+    },
+
+    takeHeapSnapshot: function(detailed)
+    {
+        if (!this.hasTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId)) {
+            if (!this._temporaryTakingSnapshot) {
+                this._temporaryTakingSnapshot = {
+                    typeId: WebInspector.HeapSnapshotProfileType.TypeId,
+                    title: WebInspector.UIString("Snapshotting…"),
+                    uid: -1,
+                    isTemporary: true
+                };
+            }
+            this._addProfileHeader(this._temporaryTakingSnapshot);
+        }
+        InspectorBackend.takeHeapSnapshot(detailed);
+    },
+
+    _reportHeapSnapshotProgress: function(done, total)
+    {
+        if (this.hasTemporaryProfile(WebInspector.HeapSnapshotProfileType.TypeId)) {
+            this._temporaryTakingSnapshot.sideBarElement.subtitle = WebInspector.UIString("%.2f%%", (done / total) * 100);
+            if (done >= total)
+                this._removeProfileHeader(this._temporaryTakingSnapshot);
+        }
+    }
+}
+
+WebInspector.ProfilesPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+
+WebInspector.ProfilerDispatcher = function(profiler)
+{
+    this._profiler = profiler;
+}
+
+WebInspector.ProfilerDispatcher.prototype = {
+    profilerWasEnabled: function()
+    {
+        this._profiler._profilerWasEnabled();
+    },
+
+    profilerWasDisabled: function()
+    {
+        this._profiler._profilerWasDisabled();
+    },
+
+    resetProfiles: function()
+    {
+        this._profiler._reset();
+    },
+
+    addProfileHeader: function(profile)
+    {
+        this._profiler._addProfileHeader(profile);
+    },
+
+    addHeapSnapshotChunk: function(uid, chunk)
+    {
+        this._profiler._addHeapSnapshotChunk(uid, chunk);
+    },
+
+    finishHeapSnapshot: function(uid)
+    {
+        this._profiler._finishHeapSnapshot(uid);
+    },
+
+    setRecordingProfile: function(isProfiling)
+    {
+        this._profiler._setRecordingProfile(isProfiling);
+    },
+
+    reportHeapSnapshotProgress: function(done, total)
+    {
+        this._profiler._reportHeapSnapshotProgress(done, total);
+    }
+}
+
+WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className)
+{
+    this.profile = profile;
+    this._titleFormat = titleFormat;
+
+    if (this.profile.title.indexOf(UserInitiatedProfileName) === 0)
+        this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
+
+    WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false);
+
+    this.refreshTitles();
+}
+
+WebInspector.ProfileSidebarTreeElement.prototype = {
+    onselect: function()
+    {
+        this.treeOutline.panel.showProfile(this.profile);
+    },
+
+    ondelete: function()
+    {
+        this.treeOutline.panel._removeProfileHeader(this.profile);
+        return true;
+    },
+
+    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;
+    },
+
+    set mainTitle(x)
+    {
+        this._mainTitle = x;
+        this.refreshTitles();
+    },
+
+    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.ProfileGroupSidebarTreeElement.prototype = {
+    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;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSection.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSection.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSection.js
new file mode 100644
index 0000000..88cb1a2
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSection.js
@@ -0,0 +1,44 @@
+/*
+ * 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.PropertiesSection = function(title, subtitle)
+{
+    WebInspector.Section.call(this, title, subtitle);
+
+    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);
+}
+
+WebInspector.PropertiesSection.prototype.__proto__ = WebInspector.Section.prototype;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSidebarPane.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSidebarPane.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSidebarPane.js
new file mode 100644
index 0000000..a1e37bc
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/PropertiesSidebarPane.js
@@ -0,0 +1,66 @@
+/*
+ * 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.PropertiesSidebarPane.prototype = {
+    update: function(node)
+    {
+        var body = this.bodyElement;
+
+        if (!node) {
+            body.removeChildren();
+            this.sections = [];
+            return;
+        }
+
+        function callback(prototypes)
+        {
+            var body = this.bodyElement;
+            body.removeChildren();
+            this.sections = [];
+
+            // Get array of prototype user-friendly names.
+            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);
+                this.sections.push(section);
+                body.appendChild(section.element);
+            }
+        }
+        InspectorBackend.getNodePrototypes(node.id, callback.bind(this));
+    }
+}
+
+WebInspector.PropertiesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/RemoteObject.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/RemoteObject.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/RemoteObject.js
new file mode 100644
index 0000000..10af2e3
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/RemoteObject.js
@@ -0,0 +1,202 @@
+/*
+ * 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.RemoteObject = function(objectId, type, description, hasChildren)
+{
+    this._objectId = objectId;
+    this._type = type;
+    this._description = description;
+    this._hasChildren = hasChildren;
+}
+
+WebInspector.RemoteObject.fromPrimitiveValue = function(value)
+{
+    return new WebInspector.RemoteObject(null, typeof value, value);
+}
+
+WebInspector.RemoteObject.fromLocalObject = function(value)
+{
+    return new WebInspector.LocalJSONObject(value);
+}
+
+WebInspector.RemoteObject.resolveNode = function(node, callback)
+{
+    function mycallback(object)
+    {
+        callback(object ? WebInspector.RemoteObject.fromPayload(object) : null);
+    }
+    InspectorBackend.resolveNode(node.id, mycallback);
+}
+
+WebInspector.RemoteObject.fromPayload = function(payload)
+{
+    if (typeof payload === "object")
+        return new WebInspector.RemoteObject(payload.objectId, payload.type, payload.description, payload.hasChildren);
+    // FIXME: make sure we only get here with real payloads in the new DebuggerAgent.js.
+    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);
+        }
+        InspectorBackend.getProperties(this._objectId, !!ignoreHasOwnProperty, abbreviate, remoteObjectBinder);
+    },
+
+    setPropertyValue: function(name, value, callback)
+    {
+        if (!this._objectId) {
+            callback(false);
+            return;
+        }
+        InspectorBackend.setPropertyValue(this._objectId, name, value, callback);
+    },
+
+    pushNodeToFrontend: function(callback)
+    {
+        InspectorBackend.pushNodeToFrontend(this._objectId, callback);
+    }
+}
+
+WebInspector.RemoteObjectProperty = function(name, value)
+{
+    this.name = name;
+    this.value = value;
+}
+
+// The below is a wrapper around a local object that provides an interface comaptible
+// with RemoteObject, to be used by the UI code (primarily ObjectPropertiesSection).
+// Note that only JSON-compliant objects are currently supported, as there's no provision
+// for traversing prototypes, extracting class names via constuctor, handling properties
+// or functions.
+
+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;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/Resource.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/Resource.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/Resource.js
new file mode 100644
index 0000000..6cf5b9c
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/Resource.js
@@ -0,0 +1,748 @@
+/*
+ * 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._category = WebInspector.resourceCategories.other;
+    this._pendingContentCallbacks = [];
+    this._responseHeadersSize = 0;
+}
+
+// Keep these in sync with WebCore::InspectorResource::Type
+WebInspector.Resource.Type = {
+    Document:   0,
+    Stylesheet: 1,
+    Image:      2,
+    Font:       3,
+    Script:     4,
+    XHR:        5,
+    WebSocket:  7,
+    Other:      8,
+
+    isTextType: function(type)
+    {
+        return (type === this.Document) || (type === this.Stylesheet) || (type === this.Script) || (type === this.XHR);
+    },
+
+    toUIString: 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.WebSocket:
+                return WebInspector.UIString("WebSocket");
+            case this.Other:
+            default:
+                return WebInspector.UIString("Other");
+        }
+    },
+
+    // Returns locale-independent string identifier of resource type (primarily for use in extension API).
+    // The IDs need to be kept in sync with webInspector.resoureces.Types object in ExtensionAPI.js.
+    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.WebSocket:
+                return "websocket";
+            case this.Other:
+            default:
+                return "other";
+        }
+    }
+}
+
+WebInspector.Resource.prototype = {
+    get url()
+    {
+        return this._url;
+    },
+
+    set url(x)
+    {
+        if (this._url === x)
+            return;
+
+        this._url = x;
+        delete this._parsedQueryParameters;
+
+        var parsedURL = x.asParsedURL();
+        this.domain = parsedURL ? parsedURL.host : "";
+        this.path = parsedURL ? parsedURL.path : "";
+        this.lastPathComponent = "";
+        if (parsedURL && parsedURL.path) {
+            // First cut the query params.
+            var path = parsedURL.path;
+            var indexOfQuery = path.indexOf("?");
+            if (indexOfQuery !== -1)
+                path = path.substring(0, indexOfQuery);
+
+            // Then take last path component.
+            var lastSlashIndex = path.lastIndexOf("/");
+            if (lastSlashIndex !== -1)
+                this.lastPathComponent = path.substring(lastSlashIndex + 1);
+        }
+        this.lastPathComponentLowerCase = this.lastPathComponent.toLowerCase();
+    },
+
+    get documentURL()
+    {
+        return this._documentURL;
+    },
+
+    set documentURL(x)
+    {
+        this._documentURL = x;
+    },
+
+    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;
+    },
+
+    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;
+    },
+
+    set startTime(x)
+    {
+        this._startTime = x;
+    },
+
+    get responseReceivedTime()
+    {
+        return this._responseReceivedTime || -1;
+    },
+
+    set responseReceivedTime(x)
+    {
+        this._responseReceivedTime = x;
+    },
+
+    get endTime()
+    {
+        return this._endTime || -1;
+    },
+
+    set endTime(x)
+    {
+        if (this.timing && this.timing.requestTime) {
+            // Check against accurate responseReceivedTime.
+            this._endTime = Math.max(x, this.responseReceivedTime);
+        } else {
+            // Prefer endTime since it might be from the network stack.
+            this._endTime = x;
+            if (this._responseReceivedTime > x)
+                this._responseReceivedTime = x;
+        }
+    },
+
+    get duration()
+    {
+        if (this._endTime === -1 || this._startTime === -1)
+            return -1;
+        return this._endTime - this._startTime;
+    },
+
+    get latency()
+    {
+        if (this._responseReceivedTime === -1 || this._startTime === -1)
+            return -1;
+        return this._responseReceivedTime - this._startTime;
+    },
+
+    get receiveDuration()
+    {
+        if (this._endTime === -1 || this._responseReceivedTime === -1)
+            return -1;
+        return this._endTime - this._responseReceivedTime;
+    },
+
+    get resourceSize()
+    {
+        return this._resourceSize || 0;
+    },
+
+    set resourceSize(x)
+    {
+        this._resourceSize = x;
+    },
+
+    get transferSize()
+    {
+        if (this.cached)
+            return 0;
+        if (this.statusCode === 304) // Not modified
+            return this._responseHeadersSize;
+        // FIXME: We prefer using Content-Length over resourceSize as
+        // resourceSize may differ from actual transfer size if platform's
+        // network stack performed decoding (e.g. gzip decompression).
+        // The Content-Length, though, is expected to come from raw
+        // response headers and will reflect actual transfer length.
+        // This won't work for chunked content encoding, so fall back to
+        // resourceSize when we don't have Content-Length. This still won't
+        // work for chunks with non-trivial encodings. We need a way to
+        // get actaul transfer size from the network stack.
+        var bodySize = Number(this.responseHeaders["Content-Length"] || this.resourceSize);
+        return this._responseHeadersSize + bodySize;
+    },
+
+    get expectedContentLength()
+    {
+        return this._expectedContentLength || 0;
+    },
+
+    set expectedContentLength(x)
+    {
+        this._expectedContentLength = x;
+    },
+
+    get finished()
+    {
+        return this._finished;
+    },
+
+    set finished(x)
+    {
+        if (this._finished === x)
+            return;
+
+        this._finished = x;
+
+        if (x) {
+            this._checkWarnings();
+            this.dispatchEventToListeners("finished");
+            if (this._pendingContentCallbacks.length)
+                this._innerRequestContent();
+        }
+    },
+
+    get failed()
+    {
+        return this._failed;
+    },
+
+    set failed(x)
+    {
+        this._failed = x;
+    },
+
+    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) {
+            // Take startTime and responseReceivedTime from timing data for better accuracy.
+            // Timing's requestTime is a baseline in seconds, rest of the numbers there are ticks in millis.
+            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;
+        // FIXME: we should take actual headers size from network stack, when possible.
+        this._responseHeadersSize = this._headersSize(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) });
+
+        return this._sortedResponseHeaders;
+    },
+
+    responseHeaderValue: function(headerName)
+    {
+        return this._headerValue(this.responseHeaders, headerName);
+    },
+
+    get responseCookies()
+    {
+        if (!this._responseCookies)
+            this._responseCookies = WebInspector.CookieParser.parseSetCookie(this.responseHeaderValue("Set-Cookie"));
+        return this._responseCookies;
+    },
+
+    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 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;
+    },
+
+    _parseParameters: function(queryString)
+    {
+        function parseNameValue(pair)
+        {
+            var parameter = {};
+            var splitPair = pair.split("=", 2);
+
+            parameter.name = splitPair[0];
+            if (splitPair.length === 1)
+                parameter.value = "";
+            else
+                parameter.value = splitPair[1];
+            return parameter;
+        }
+        return queryString.split("&").map(parseNameValue);
+    },
+
+    _headerValue: function(headers, headerName)
+    {
+        headerName = headerName.toLowerCase();
+        for (var header in headers) {
+            if (header.toLowerCase() === headerName)
+                return headers[header];
+        }
+    },
+
+    _headersSize: function(headers)
+    {
+        var size = 0;
+        for (var header in headers)
+            size += header.length + headers[header].length + 3; // _typical_ overhead per herader is ": ".length + "\n".length.
+        return size;
+    },
+
+    get errors()
+    {
+        return this._errors || 0;
+    },
+
+    set errors(x)
+    {
+        this._errors = x;
+        this.dispatchEventToListeners("errors-warnings-updated");
+    },
+
+    get warnings()
+    {
+        return this._warnings || 0;
+    },
+
+    set warnings(x)
+    {
+        this._warnings = x;
+        this.dispatchEventToListeners("errors-warnings-updated");
+    },
+
+    clearErrorsAndWarnings: function()
+    {
+        this._warnings = 0;
+        this._errors = 0;
+        this.dispatchEventToListeners("errors-warnings-updated");
+    },
+
+    _mimeTypeIsConsistentWithType: function()
+    {
+        // If status is an error, content is likely to be of an inconsistent type,
+        // as it's going to be an error message. We do not want to emit a warning
+        // for this, though, as this will already be reported as resource loading failure.
+        if (this.statusCode >= 400)
+            return true;
+
+        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;
+
+        if (!this.mimeType)
+            return true; // Might be not known for cached resources with null responses.
+
+        if (this.mimeType in WebInspector.MIMETypes)
+            return this.type in WebInspector.MIMETypes[this.mimeType];
+
+        return false;
+    },
+
+    _checkWarnings: function()
+    {
+        for (var warning in WebInspector.Warnings)
+            this._checkWarning(WebInspector.Warnings[warning]);
+    },
+
+    _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;
+        }
+
+        if (msg)
+            WebInspector.console.addMessage(msg);
+    },
+
+    get content()
+    {
+        return this._content;
+    },
+
+    get contentTimestamp()
+    {
+        return this._contentTimestamp;
+    },
+
+    setInitialContent: function(content)
+    {
+        this._content = content;
+    },
+
+    isLocallyModified: function()
+    {
+        return !!this._baseRevision;
+    },
+
+    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.finished)
+            revisionResource.finished = true;
+        else {
+            function finished()
+            {
+                this.removeEventListener("finished", finished);
+                revisionResource.finished = true;
+            }
+            this.addEventListener("finished", finished.bind(this));
+        }
+
+        if (!this._baseRevision)
+            this._baseRevision = revisionResource;
+        else
+            revisionResource._baseRevision = this._baseRevision;
+
+        var data = { revision: revisionResource };
+        this._content = newContent;
+        this.timestamp = new Date();
+        this.dispatchEventToListeners("content-changed", data);
+    },
+
+    revertToThis: function()
+    {
+        if (!this._actualResource || !this._fireOnRevert)
+            return;
+
+        function callback(content)
+        {
+            if (content)
+                this._fireOnRevert(content);
+        }
+        this.requestContent(callback.bind(this));
+    },
+
+    get baseRevision()
+    {
+        return this._baseRevision;
+    },
+
+    requestContent: function(callback)
+    {
+        // We do not support content retrieval for WebSockets at the moment.
+        // Since WebSockets are potentially long-living, fail requests immediately
+        // to prevent caller blocking until resource is marked as finished.
+        if (this.type === WebInspector.Resource.Type.WebSocket) {
+            callback(null, null);
+            return;
+        }
+        if (typeof this._content !== "undefined") {
+            callback(this.content, this._contentEncoded);
+            return;
+        }
+        this._pendingContentCallbacks.push(callback);
+        if (this.finished)
+            this._innerRequestContent();
+    },
+
+    populateImageSource: function(image)
+    {
+        function onResourceContent()
+        {
+            image.src = this._contentURL();
+        }
+
+        if (Preferences.useDataURLForResourceImageIcons)
+            this.requestContent(onResourceContent.bind(this));
+        else
+            image.src = this.url;
+    },
+
+    _contentURL: function()
+    {
+        const maxDataUrlSize = 1024 * 1024;
+        // If resource content is not available or won't fit a data URL, fall back to using original URL.
+        if (this._content == null || this._content.length > maxDataUrlSize)
+            return this.url;
+
+        return "data:" + this.mimeType + (this._contentEncoded ? ";base64," : ",") + this._content;
+    },
+
+    _innerRequestContent: function()
+    {
+        if (this._contentRequested)
+            return;
+        this._contentRequested = true;
+        this._contentEncoded = !WebInspector.Resource.Type.isTextType(this.type);
+
+        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.networkManager.requestContent(this, this._contentEncoded, onResourceContent.bind(this));
+    }
+}
+
+WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCategory.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCategory.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCategory.js
new file mode 100644
index 0000000..43c7c2b
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCategory.js
@@ -0,0 +1,41 @@
+/*
+ * 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)
+{
+    this.name = name;
+    this.title = title;
+    this.color = color;
+}
+
+WebInspector.ResourceCategory.prototype = {
+    toString: function()
+    {
+        return this.title;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCookiesView.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCookiesView.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCookiesView.js
new file mode 100644
index 0000000..b60b1b6
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceCookiesView.js
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2011 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.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);
+
+        if (!this._cookiesTable) {
+            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;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceHeadersView.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceHeadersView.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceHeadersView.js
new file mode 100644
index 0000000..e79078a
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/ResourceHeadersView.js
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc.  All rights reserved.
+ * Copyright (C) IBM Corp. 2009  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.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 || this._resource.statusCode === 304)
+                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;


Mime
View raw message