You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pm...@apache.org on 2012/02/15 18:42:36 UTC
[8/51] [partial] Apache-ization, port to node.js
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/AuditsPanel.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/AuditsPanel.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/AuditsPanel.js
new file mode 100644
index 0000000..47c0b30
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/AuditsPanel.js
@@ -0,0 +1,474 @@
+/*
+ * 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.AuditsPanel = function()
+{
+ WebInspector.Panel.call(this, "audits");
+
+ 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.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.viewsContainerElement = document.createElement("div");
+ this.viewsContainerElement.id = "audit-views";
+ this.element.appendChild(this.viewsContainerElement);
+
+ this._constructCategories();
+
+ this._launcherView = new WebInspector.AuditLauncherView(this.initiateAudit.bind(this));
+ for (id in this.categoriesById)
+ this._launcherView.addCategory(this.categoriesById[id]);
+}
+
+WebInspector.AuditsPanel.prototype = {
+ get toolbarItemLabel()
+ {
+ return WebInspector.UIString("Audits");
+ },
+
+ get statusBarItems()
+ {
+ return [this.clearResultsButton.element];
+ },
+
+ get mainResourceLoadTime()
+ {
+ return this._mainResourceLoadTime;
+ },
+
+ set mainResourceLoadTime(x)
+ {
+ this._mainResourceLoadTime = x;
+ this._didMainResourceLoad();
+ },
+
+ get mainResourceDOMContentTime()
+ {
+ return this._mainResourceDOMContentTime;
+ },
+
+ set mainResourceDOMContentTime(x)
+ {
+ this._mainResourceDOMContentTime = x;
+ },
+
+ get categoriesById()
+ {
+ return this._auditCategoriesById;
+ },
+
+ addCategory: function(category)
+ {
+ this.categoriesById[category.id] = category;
+ this._launcherView.addCategory(category);
+ },
+
+ getCategory: function(id)
+ {
+ return this.categoriesById[id];
+ },
+
+ _constructCategories: function()
+ {
+ this._auditCategoriesById = {};
+ for (var categoryCtorID in WebInspector.AuditCategories) {
+ var auditCategory = new WebInspector.AuditCategories[categoryCtorID]();
+ auditCategory._id = categoryCtorID;
+ this.categoriesById[categoryCtorID] = auditCategory;
+ }
+ },
+
+ _executeAudit: function(categories, resultCallback)
+ {
+ var resources = WebInspector.networkResources;
+
+ var rulesRemaining = 0;
+ for (var i = 0; i < categories.length; ++i)
+ rulesRemaining += categories[i].ruleCount;
+
+ var results = [];
+ var mainResourceURL = WebInspector.mainResource.url;
+
+ function ruleResultReadyCallback(categoryResult, ruleResult)
+ {
+ if (ruleResult && ruleResult.children)
+ categoryResult.addRuleResult(ruleResult);
+
+ --rulesRemaining;
+
+ if (!rulesRemaining && resultCallback)
+ resultCallback(mainResourceURL, results);
+ }
+
+ if (!rulesRemaining) {
+ resultCallback(mainResourceURL, results);
+ 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));
+ }
+ },
+
+ _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++;
+ }
+
+ var resultTreeElement = new WebInspector.AuditResultSidebarTreeElement(results, mainResourceURL, ordinal);
+ this.auditResultsTreeElement.appendChild(resultTreeElement);
+ resultTreeElement.reveal();
+ resultTreeElement.select();
+ if (launcherCallback)
+ launcherCallback();
+ },
+
+ initiateAudit: function(categoryIds, runImmediately, launcherCallback)
+ {
+ if (!categoryIds || !categoryIds.length)
+ return;
+
+ var categories = [];
+ for (var i = 0; i < categoryIds.length; ++i)
+ categories.push(this.categoriesById[categoryIds[i]]);
+
+ function initiateAuditCallback(categories, launcherCallback)
+ {
+ this._executeAudit(categories, this._auditFinishedCallback.bind(this, launcherCallback));
+ }
+
+ if (runImmediately)
+ initiateAuditCallback.call(this, categories, launcherCallback);
+ else
+ this._reloadResources(initiateAuditCallback.bind(this, categories, launcherCallback));
+ },
+
+ _reloadResources: function(callback)
+ {
+ this._pageReloadCallback = callback;
+ InspectorBackend.reloadPage(false);
+ },
+
+ _didMainResourceLoad: function()
+ {
+ if (this._pageReloadCallback) {
+ var callback = this._pageReloadCallback;
+ delete this._pageReloadCallback;
+ callback();
+ }
+ },
+
+ showResults: function(categoryResults)
+ {
+ if (!categoryResults._resultView)
+ categoryResults._resultView = new WebInspector.AuditResultView(categoryResults);
+
+ this.visibleView = categoryResults._resultView;
+ },
+
+ showLauncherView: function()
+ {
+ this.visibleView = this._launcherView;
+ },
+
+ get visibleView()
+ {
+ return this._visibleView;
+ },
+
+ set visibleView(x)
+ {
+ if (this._visibleView === x)
+ return;
+
+ if (this._visibleView)
+ this._visibleView.hide();
+
+ this._visibleView = x;
+
+ if (x)
+ x.show(this.viewsContainerElement);
+ },
+
+ attach: function()
+ {
+ WebInspector.Panel.prototype.attach.call(this);
+
+ this.auditsItemTreeElement.select();
+ },
+
+ updateMainViewWidth: function(width)
+ {
+ this.viewsContainerElement.style.left = width + "px";
+ },
+
+ _clearButtonClicked: function()
+ {
+ this.auditsItemTreeElement.reveal();
+ this.auditsItemTreeElement.select();
+ this.auditResultsTreeElement.removeChildren();
+ }
+}
+
+WebInspector.AuditsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
+
+
+
+WebInspector.AuditCategory = function(displayName)
+{
+ this._displayName = displayName;
+ this._rules = [];
+}
+
+WebInspector.AuditCategory.prototype = {
+ get id()
+ {
+ // this._id value is injected at construction time.
+ return this._id;
+ },
+
+ get displayName()
+ {
+ return this._displayName;
+ },
+
+ get ruleCount()
+ {
+ this._ensureInitialized();
+ return this._rules.length;
+ },
+
+ addRule: function(rule, severity)
+ {
+ rule.severity = severity;
+ this._rules.push(rule);
+ },
+
+ 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;
+}
+
+WebInspector.AuditRule.Severity = {
+ Info: "info",
+ Warning: "warning",
+ Severe: "severe"
+}
+
+WebInspector.AuditRule.SeverityOrder = {
+ "info": 3,
+ "warning": 2,
+ "severe": 1
+}
+
+WebInspector.AuditRule.prototype = {
+ get id()
+ {
+ return this._id;
+ },
+
+ get displayName()
+ {
+ return this._displayName;
+ },
+
+ 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);
+ },
+
+ doRun: function(resources, result, callback)
+ {
+ throw new Error("doRun() not implemented");
+ }
+}
+
+WebInspector.AuditCategoryResult = function(category)
+{
+ this.title = category.displayName;
+ this.ruleResults = [];
+}
+
+WebInspector.AuditCategoryResult.prototype = {
+ 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;
+}
+
+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;
+ },
+
+ 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]);
+ },
+
+ addSnippet: function(snippet)
+ {
+ return this.addChild(snippet, false, "source-code");
+ }
+}
+
+WebInspector.AuditsSidebarTreeElement = function()
+{
+ this.small = 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);
+ },
+
+ onselect: function()
+ {
+ WebInspector.panels.audits.showLauncherView();
+ },
+
+ get selectable()
+ {
+ return true;
+ },
+
+ refresh: function()
+ {
+ this.refreshTitles();
+ }
+}
+
+WebInspector.AuditsSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype;
+
+
+WebInspector.AuditResultSidebarTreeElement = function(results, mainResourceURL, ordinal)
+{
+ this.results = results;
+ this.mainResourceURL = mainResourceURL;
+
+ 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);
+ },
+
+ 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 = {};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js
new file mode 100644
index 0000000..5aaae0c
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/BottomUpProfileDataGridTree.js
@@ -0,0 +1,264 @@
+/*
+ * 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.
+ */
+
+// 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.ProfileDataGridNode.call(this, profileView, profileNode, owningTree, this._willHaveChildren(profileNode));
+
+ this._remainingNodeInfos = [];
+}
+
+WebInspector.BottomUpProfileDataGridNode.prototype = {
+ _takePropertiesFromProfileDataGridNode: function(/*ProfileDataGridNode*/ profileDataGridNode)
+ {
+ this._save();
+
+ 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);
+ },
+
+ _exclude: function(aCallUID)
+ {
+ if (this._remainingNodeInfos)
+ this._populate();
+
+ this._save();
+
+ var children = this.children;
+ var index = this.children.length;
+
+ while (index--)
+ children[index]._exclude(aCallUID);
+
+ var child = this.childrenByCallUID[aCallUID];
+
+ if (child)
+ this._merge(child, true);
+ },
+
+ _restore: function()
+ {
+ WebInspector.ProfileDataGridNode.prototype._restore();
+
+ if (!this.children.length)
+ this.hasChildren = this._willHaveChildren();
+ },
+
+ _merge: function(/*ProfileDataGridNode*/ child, /*Boolean*/ shouldAbsorb)
+ {
+ this.selfTime -= child.selfTime;
+
+ WebInspector.ProfileDataGridNode.prototype._merge.call(this, child, shouldAbsorb);
+ },
+
+ _sharedPopulate: function()
+ {
+ var remainingNodeInfos = this._remainingNodeInfos;
+ var count = remainingNodeInfos.length;
+
+ for (var index = 0; index < count; ++index) {
+ var nodeInfo = remainingNodeInfos[index];
+ var ancestor = nodeInfo.ancestor;
+ var focusNode = nodeInfo.focusNode;
+ var child = this.findChild(ancestor);
+
+ // If we already have this child, then merge the data together.
+ if (child) {
+ var totalTimeAccountedFor = nodeInfo.totalTimeAccountedFor;
+
+ 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 (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;
+ }
+
+ 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;
+ // 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);
+ }
+}
+
+WebInspector.BottomUpProfileDataGridNode.prototype.__proto__ = WebInspector.ProfileDataGridNode.prototype;
+
+WebInspector.BottomUpProfileDataGridTree = function(/*ProfileView*/ aProfileView, /*ProfileNode*/ aProfileNode)
+{
+ WebInspector.ProfileDataGridTree.call(this, aProfileView, aProfileNode);
+
+ // Iterate each node in pre-order.
+ var profileNodeUIDs = 0;
+ var profileNodeGroups = [[], [aProfileNode]];
+ var visitedProfileNodesForCallUID = {};
+
+ this._remainingNodeInfos = [];
+
+ for (var profileNodeGroupIndex = 0; profileNodeGroupIndex < profileNodeGroups.length; ++profileNodeGroupIndex) {
+ var parentProfileNodes = profileNodeGroups[profileNodeGroupIndex];
+ var profileNodes = profileNodeGroups[++profileNodeGroupIndex];
+ var count = profileNodes.length;
+
+ for (var index = 0; index < count; ++index) {
+ var profileNode = profileNodes[index];
+
+ if (!profileNode.UID)
+ profileNode.UID = ++profileNodeUIDs;
+
+ 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 (!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;
+ }
+ }
+ }
+
+ 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);
+ }
+ }
+ }
+
+ // Populate the top level nodes.
+ 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();
+
+ var currentNode = profileDataGridNode;
+ var focusNode = profileDataGridNode;
+
+ while (currentNode.parent && (currentNode instanceof WebInspector.ProfileDataGridNode)) {
+ currentNode._takePropertiesFromProfileDataGridNode(profileDataGridNode);
+
+ focusNode = currentNode;
+ currentNode = currentNode.parent;
+
+ if (currentNode instanceof WebInspector.ProfileDataGridNode)
+ currentNode._keepOnlyChild(focusNode);
+ }
+
+ this.children = [focusNode];
+ this.totalTime = profileDataGridNode.totalTime;
+ },
+
+ exclude: function(/*ProfileDataGridNode*/ profileDataGridNode)
+ {
+ if (!profileDataGridNode)
+ return;
+
+ this._save();
+
+ var excludedCallUID = profileDataGridNode.callUID;
+ var excludedTopLevelChild = this.childrenByCallUID[excludedCallUID];
+
+ // 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 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;
+
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/Breakpoint.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/Breakpoint.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/Breakpoint.js
new file mode 100644
index 0000000..ebc6029
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/Breakpoint.js
@@ -0,0 +1,49 @@
+/*
+ * 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:
+ *
+ * * 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.Breakpoint = function(id, url, sourceID, lineNumber, columnNumber, condition, enabled)
+{
+ this.id = id;
+ this.url = url;
+ this.sourceID = sourceID;
+ this.lineNumber = lineNumber;
+ this.columnNumber = columnNumber;
+ this.condition = condition;
+ this.enabled = enabled;
+ this.locations = [];
+}
+
+WebInspector.Breakpoint.prototype = {
+ addLocation: function(sourceID, lineNumber, columnNumber)
+ {
+ this.locations.push({ sourceID: sourceID, lineNumber: lineNumber, columnNumber: columnNumber });
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointManager.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointManager.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointManager.js
new file mode 100644
index 0000000..94345d5
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointManager.js
@@ -0,0 +1,624 @@
+/*
+ * 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.BreakpointManager = function()
+{
+ this._stickyBreakpoints = {};
+ var breakpoints = WebInspector.settings.findSettingForAllProjects("nativeBreakpoints");
+ for (var projectId in breakpoints)
+ this._stickyBreakpoints[projectId] = this._validateBreakpoints(breakpoints[projectId]);
+
+ this._breakpoints = {};
+ this._domBreakpointsRestored = false;
+
+ WebInspector.settings.addEventListener(WebInspector.Settings.Events.ProjectChanged, this._projectChanged, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
+}
+
+WebInspector.BreakpointManager.BreakpointTypes = {
+ DOM: "DOM",
+ EventListener: "EventListener",
+ XHR: "XHR"
+}
+
+WebInspector.BreakpointManager.Events = {
+ DOMBreakpointAdded: "dom-breakpoint-added",
+ EventListenerBreakpointAdded: "event-listener-breakpoint-added",
+ XHRBreakpointAdded: "xhr-breakpoint-added",
+ ProjectChanged: "project-changed"
+}
+
+WebInspector.BreakpointManager.prototype = {
+ createDOMBreakpoint: function(nodeId, type)
+ {
+ this._createDOMBreakpoint(nodeId, type, true, false);
+ },
+
+ _createDOMBreakpoint: function(nodeId, type, enabled, restored)
+ {
+ var node = WebInspector.domAgent.nodeForId(nodeId);
+ if (!node)
+ return;
+
+ var breakpointId = this._createDOMBreakpointId(nodeId, type);
+ if (breakpointId in this._breakpoints)
+ return;
+
+ var breakpoint = new WebInspector.DOMBreakpoint(node, type);
+ this._setBreakpoint(breakpointId, breakpoint, enabled, restored);
+ if (enabled && restored)
+ breakpoint._enable();
+
+ breakpoint.view = new WebInspector.DOMBreakpointView(this, breakpointId, enabled, node, type);
+ this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.DOMBreakpointAdded, breakpoint.view);
+ },
+
+ createEventListenerBreakpoint: function(eventName)
+ {
+ this._createEventListenerBreakpoint(eventName, true, false);
+ },
+
+ _createEventListenerBreakpoint: function(eventName, enabled, restored)
+ {
+ var breakpointId = this._createEventListenerBreakpointId(eventName);
+ if (breakpointId in this._breakpoints)
+ return;
+
+ var breakpoint = new WebInspector.EventListenerBreakpoint(eventName);
+ this._setBreakpoint(breakpointId, breakpoint, enabled, restored);
+
+ breakpoint.view = new WebInspector.EventListenerBreakpointView(this, breakpointId, enabled, eventName);
+ this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.EventListenerBreakpointAdded, breakpoint.view);
+ },
+
+ createXHRBreakpoint: function(url)
+ {
+ this._createXHRBreakpoint(url, true, false);
+ },
+
+ _createXHRBreakpoint: function(url, enabled, restored)
+ {
+ var breakpointId = this._createXHRBreakpointId(url);
+ if (breakpointId in this._breakpoints)
+ return;
+
+ var breakpoint = new WebInspector.XHRBreakpoint(url);
+ this._setBreakpoint(breakpointId, breakpoint, enabled, restored);
+
+ breakpoint.view = new WebInspector.XHRBreakpointView(this, breakpointId, enabled, url);
+ this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.XHRBreakpointAdded, breakpoint.view);
+ },
+
+ _setBreakpoint: function(breakpointId, breakpoint, enabled, restored)
+ {
+ this._breakpoints[breakpointId] = breakpoint;
+ breakpoint.enabled = enabled;
+ if (restored)
+ return;
+ if (enabled)
+ breakpoint._enable();
+ this._saveBreakpoints();
+ },
+
+ _setBreakpointEnabled: function(breakpointId, enabled)
+ {
+ var breakpoint = this._breakpoints[breakpointId];
+ if (breakpoint.enabled === enabled)
+ return;
+ if (enabled)
+ breakpoint._enable();
+ else
+ breakpoint._disable();
+ breakpoint.enabled = enabled;
+ this._saveBreakpoints();
+ },
+
+ _removeBreakpoint: function(breakpointId)
+ {
+ var breakpoint = this._breakpoints[breakpointId];
+ if (breakpoint.enabled)
+ breakpoint._disable();
+ delete this._breakpoints[breakpointId];
+ this._saveBreakpoints();
+ },
+
+ breakpointViewForEventData: function(eventData)
+ {
+ var breakpointId;
+ if (eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.DOM)
+ breakpointId = this._createDOMBreakpointId(eventData.nodeId, eventData.type);
+ else if (eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.EventListener)
+ breakpointId = this._createEventListenerBreakpointId(eventData.eventName);
+ else if (eventData.breakpointType === WebInspector.BreakpointManager.BreakpointTypes.XHR)
+ breakpointId = this._createXHRBreakpointId(eventData.breakpointURL);
+ else
+ return;
+
+ var breakpoint = this._breakpoints[breakpointId];
+ if (breakpoint)
+ return breakpoint.view;
+ },
+
+ _debuggerPaused: function(event)
+ {
+ var eventType = event.data.eventType;
+ var eventData = event.data.eventData;
+
+ if (eventType !== WebInspector.DebuggerEventTypes.NativeBreakpoint)
+ return;
+
+ var breakpointView = this.breakpointViewForEventData(eventData);
+ if (!breakpointView)
+ return;
+
+ breakpointView.hit = true;
+ this._lastHitBreakpointView = breakpointView;
+ },
+
+ _debuggerResumed: function(event)
+ {
+ if (!this._lastHitBreakpointView)
+ return;
+ this._lastHitBreakpointView.hit = false;
+ delete this._lastHitBreakpointView;
+ },
+
+ _projectChanged: function(event)
+ {
+ this._breakpoints = {};
+ this._domBreakpointsRestored = false;
+ this.dispatchEventToListeners(WebInspector.BreakpointManager.Events.ProjectChanged);
+
+ var breakpoints = this._stickyBreakpoints[WebInspector.settings.projectId] || [];
+ for (var i = 0; i < breakpoints.length; ++i) {
+ var breakpoint = breakpoints[i];
+ if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.EventListener)
+ this._createEventListenerBreakpoint(breakpoint.condition.eventName, breakpoint.enabled, true);
+ else if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.XHR)
+ this._createXHRBreakpoint(breakpoint.condition.url, breakpoint.enabled, true);
+ }
+
+ if (!this._breakpointsPushedToFrontend) {
+ InspectorBackend.setAllBrowserBreakpoints(this._stickyBreakpoints);
+ this._breakpointsPushedToFrontend = true;
+ }
+ },
+
+ 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];
+ if (breakpoint.type !== WebInspector.BreakpointManager.BreakpointTypes.DOM)
+ continue;
+ var nodeId = pathToNodeId[breakpoint.condition.path];
+ if (nodeId)
+ this._createDOMBreakpoint(nodeId, breakpoint.condition.type, breakpoint.enabled, true);
+ }
+ this._domBreakpointsRestored = true;
+ this._saveBreakpoints();
+ }
+
+ var breakpoints = this._stickyBreakpoints[WebInspector.settings.projectId] || [];
+ var pathToNodeId = {};
+ var pendingCalls = 0;
+ for (var i = 0; i < breakpoints.length; ++i) {
+ if (breakpoints[i].type !== WebInspector.BreakpointManager.BreakpointTypes.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));
+ }
+ if (!pendingCalls)
+ this._domBreakpointsRestored = true;
+ },
+
+ _saveBreakpoints: function()
+ {
+ var breakpoints = [];
+ for (var breakpointId in this._breakpoints) {
+ var breakpoint = this._breakpoints[breakpointId];
+ var persistentBreakpoint = breakpoint._serializeToJSON();
+ persistentBreakpoint.enabled = breakpoint.enabled;
+ breakpoints.push(persistentBreakpoint);
+ }
+ if (!this._domBreakpointsRestored) {
+ var stickyBreakpoints = this._stickyBreakpoints[WebInspector.settings.projectId] || [];
+ for (var i = 0; i < stickyBreakpoints.length; ++i) {
+ if (stickyBreakpoints[i].type === WebInspector.BreakpointManager.BreakpointTypes.DOM)
+ breakpoints.push(stickyBreakpoints[i]);
+ }
+ }
+ WebInspector.settings.nativeBreakpoints = breakpoints;
+
+ this._stickyBreakpoints[WebInspector.settings.projectId] = breakpoints;
+ InspectorBackend.setAllBrowserBreakpoints(this._stickyBreakpoints);
+ },
+
+ _validateBreakpoints: function(persistentBreakpoints)
+ {
+ var breakpoints = [];
+ var breakpointsSet = {};
+ for (var i = 0; i < persistentBreakpoints.length; ++i) {
+ var breakpoint = persistentBreakpoints[i];
+ if (!("type" in breakpoint && "enabled" in breakpoint && "condition" in breakpoint))
+ continue;
+ var id = breakpoint.type + ":";
+ var condition = breakpoint.condition;
+ if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.DOM) {
+ if (typeof condition.path !== "string" || typeof condition.type !== "number")
+ continue;
+ id += condition.path + ":" + condition.type;
+ } else if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.EventListener) {
+ if (typeof condition.eventName !== "string")
+ continue;
+ id += condition.eventName;
+ } else if (breakpoint.type === WebInspector.BreakpointManager.BreakpointTypes.XHR) {
+ if (typeof condition.url !== "string")
+ continue;
+ id += condition.url;
+ } else
+ continue;
+ if (id in breakpointsSet)
+ continue;
+ breakpointsSet[id] = true;
+ breakpoints.push(breakpoint);
+ }
+ return breakpoints;
+ },
+
+ _createDOMBreakpointId: function(nodeId, type)
+ {
+ return "dom:" + nodeId + ":" + type;
+ },
+
+ _createEventListenerBreakpointId: function(eventName)
+ {
+ return "eventListner:" + eventName;
+ },
+
+ _createXHRBreakpointId: function(url)
+ {
+ return "xhr:" + url;
+ }
+}
+
+WebInspector.BreakpointManager.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.DOMBreakpoint = function(node, type)
+{
+ this._nodeId = node.id;
+ this._path = node.path();
+ this._type = type;
+}
+
+WebInspector.DOMBreakpoint.prototype = {
+ _enable: function()
+ {
+ InspectorBackend.setDOMBreakpoint(this._nodeId, this._type);
+ },
+
+ _disable: function()
+ {
+ InspectorBackend.removeDOMBreakpoint(this._nodeId, this._type);
+ },
+
+ _serializeToJSON: function()
+ {
+ var type = WebInspector.BreakpointManager.BreakpointTypes.DOM;
+ return { type: type, condition: { path: this._path, type: this._type } };
+ }
+}
+
+WebInspector.EventListenerBreakpoint = function(eventName)
+{
+ this._eventName = eventName;
+}
+
+WebInspector.EventListenerBreakpoint.prototype = {
+ _enable: function()
+ {
+ InspectorBackend.setEventListenerBreakpoint(this._eventName);
+ },
+
+ _disable: function()
+ {
+ InspectorBackend.removeEventListenerBreakpoint(this._eventName);
+ },
+
+ _serializeToJSON: function()
+ {
+ var type = WebInspector.BreakpointManager.BreakpointTypes.EventListener;
+ return { type: type, condition: { eventName: this._eventName } };
+ }
+}
+
+WebInspector.XHRBreakpoint = function(url)
+{
+ this._url = url;
+}
+
+WebInspector.XHRBreakpoint.prototype = {
+ _enable: function()
+ {
+ InspectorBackend.setXHRBreakpoint(this._url);
+ },
+
+ _disable: function()
+ {
+ InspectorBackend.removeXHRBreakpoint(this._url);
+ },
+
+ _serializeToJSON: function()
+ {
+ var type = WebInspector.BreakpointManager.BreakpointTypes.XHR;
+ return { type: type, condition: { url: this._url } };
+ }
+}
+
+
+
+WebInspector.NativeBreakpointView = function(manager, id, enabled)
+{
+ this._manager = manager;
+ this._id = id;
+ this._enabled = enabled;
+ this._hit = false;
+}
+
+WebInspector.NativeBreakpointView.prototype = {
+ get enabled()
+ {
+ return this._enabled;
+ },
+
+ set enabled(enabled)
+ {
+ this._manager._setBreakpointEnabled(this._id, enabled);
+ this._enabled = enabled;
+ this.dispatchEventToListeners("enable-changed");
+ },
+
+ get hit()
+ {
+ return this._hit;
+ },
+
+ set hit(hit)
+ {
+ this._hit = hit;
+ this.dispatchEventToListeners("hit-state-changed");
+ },
+
+ remove: function()
+ {
+ this._manager._removeBreakpoint(this._id);
+ this._onRemove();
+ this.dispatchEventToListeners("removed");
+ },
+
+ _compare: function(x, y)
+ {
+ if (x !== y)
+ return x < y ? -1 : 1;
+ return 0;
+ },
+
+ _onRemove: function()
+ {
+ }
+}
+
+WebInspector.NativeBreakpointView.prototype.__proto__ = WebInspector.Object.prototype;
+
+WebInspector.DOMBreakpointView = function(manager, id, enabled, node, type)
+{
+ WebInspector.NativeBreakpointView.call(this, manager, id, enabled);
+ this._node = node;
+ this._nodeId = node.id;
+ this._type = type;
+ node.breakpoints[this._type] = this;
+}
+
+WebInspector.DOMBreakpointView.prototype = {
+ compareTo: function(other)
+ {
+ return this._compare(this._type, other._type);
+ },
+
+ populateLabelElement: function(element)
+ {
+ // FIXME: this should belong to the view, not the manager.
+ 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._type);
+ element.appendChild(description);
+ },
+
+ populateStatusMessageElement: function(element, eventData)
+ {
+ var substitutions = [WebInspector.domBreakpointTypeLabel(this._type), 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._type === 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()
+ {
+ delete this._node.breakpoints[this._type];
+ }
+}
+
+WebInspector.DOMBreakpointView.prototype.__proto__ = WebInspector.NativeBreakpointView.prototype;
+
+WebInspector.EventListenerBreakpointView = function(manager, id, enabled, eventName)
+{
+ WebInspector.NativeBreakpointView.call(this, manager, id, enabled);
+ this._eventName = eventName;
+}
+
+WebInspector.EventListenerBreakpointView.eventNameForUI = function(eventName)
+{
+ if (!WebInspector.EventListenerBreakpointView._eventNamesForUI) {
+ WebInspector.EventListenerBreakpointView._eventNamesForUI = {
+ "instrumentation:setTimer": WebInspector.UIString("Set Timer"),
+ "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"),
+ "instrumentation:timerFired": WebInspector.UIString("Timer Fired")
+ };
+ }
+ return WebInspector.EventListenerBreakpointView._eventNamesForUI[eventName] || eventName.substring(eventName.indexOf(":") + 1);
+}
+
+WebInspector.EventListenerBreakpointView.prototype = {
+ get eventName()
+ {
+ return this._eventName;
+ },
+
+ 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.EventListenerBreakpointView.eventNameForUI(this._eventName);
+ }
+}
+
+WebInspector.EventListenerBreakpointView.prototype.__proto__ = WebInspector.NativeBreakpointView.prototype;
+
+WebInspector.XHRBreakpointView = function(manager, id, enabled, url)
+{
+ WebInspector.NativeBreakpointView.call(this, manager, id, enabled);
+ this._url = url;
+}
+
+WebInspector.XHRBreakpointView.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.XHRBreakpointView.prototype.__proto__ = WebInspector.NativeBreakpointView.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];
+}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js
new file mode 100644
index 0000000..0c46463
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/BreakpointsSidebarPane.js
@@ -0,0 +1,623 @@
+/*
+ * 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.JavaScriptBreakpointsSidebarPane = function(title)
+{
+ WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints"));
+
+ 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.bodyElement.appendChild(this.emptyElement);
+
+ this._items = {};
+
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointRemoved, this._breakpointRemoved, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this);
+ WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this);
+ WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
+}
+
+WebInspector.JavaScriptBreakpointsSidebarPane.prototype = {
+ _breakpointAdded: function(event)
+ {
+ var breakpoint = event.data;
+ var breakpointId = breakpoint.id;
+
+ if (breakpoint.url && !WebInspector.debuggerModel.scriptsForURL(breakpoint.url).length)
+ return;
+
+ var element = document.createElement("li");
+
+ var checkbox = document.createElement("input");
+ checkbox.className = "checkbox-elem";
+ checkbox.type = "checkbox";
+ checkbox.checked = breakpoint.enabled;
+ checkbox.addEventListener("click", this._breakpointItemCheckboxClicked.bind(this, breakpointId), false);
+ element.appendChild(checkbox);
+
+ var label = document.createElement("span");
+ element.appendChild(label);
+
+ element._data = breakpoint;
+ var currentElement = this.listElement.firstChild;
+ while (currentElement) {
+ if (currentElement._data && this._compareBreakpoints(currentElement._data, element._data) > 0)
+ break;
+ currentElement = currentElement.nextSibling;
+ }
+ this._addListElement(element, currentElement);
+
+ element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointId), true);
+
+ this._setupBreakpointElement(breakpoint, element);
+
+ var breakpointItem = {};
+ breakpointItem.element = element;
+ breakpointItem.checkbox = checkbox;
+ this._items[breakpointId] = breakpointItem;
+
+ if (!this.expanded)
+ this.expanded = true;
+ },
+
+ _breakpointRemoved: function(event)
+ {
+ var breakpointId = event.data;
+ var breakpointItem = this._items[breakpointId];
+ if (breakpointItem) {
+ delete this._items[breakpointId];
+ this._removeListElement(breakpointItem.element);
+ }
+ },
+
+ _breakpointResolved: function(event)
+ {
+ var breakpoint = event.data;
+ this._breakpointRemoved({ data: breakpoint.id });
+ this._breakpointAdded({ data: breakpoint });
+ },
+
+ _parsedScriptSource: function(event)
+ {
+ var url = event.data.sourceURL;
+ var breakpoints = WebInspector.debuggerModel.breakpoints;
+ for (var id in breakpoints) {
+ if (!(id in this._items))
+ this._breakpointAdded({ data: breakpoints[id] });
+ }
+ },
+
+ _breakpointEnableChanged: function(enabled, event)
+ {
+ var breakpointId = event.data;
+ var breakpointItem = this._items[breakpointId];
+ if (breakpointItem)
+ breakpointItem.checkbox.checked = enabled;
+ },
+
+ _breakpointItemCheckboxClicked: function(breakpointId, event)
+ {
+ var breakpoint = WebInspector.debuggerModel.breakpointForId(breakpointId);
+ WebInspector.debuggerModel.updateBreakpoint(breakpointId, breakpoint.condition, event.target.checked);
+
+ // Breakpoint element may have it's own click handler.
+ event.stopPropagation();
+ },
+
+ _contextMenuEventFired: function(breakpointId, event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._removeBreakpoint.bind(this, breakpointId));
+ contextMenu.show(event);
+ },
+
+ _debuggerPaused: function(event)
+ {
+ var breakpoint = event.data.breakpoint;
+ if (!breakpoint)
+ return;
+ var breakpointItem = this._items[breakpoint.id];
+ if (!breakpointItem)
+ return;
+ breakpointItem.element.addStyleClass("breakpoint-hit");
+ this._lastHitBreakpointItem = breakpointItem;
+ },
+
+ _debuggerResumed: function()
+ {
+ if (this._lastHitBreakpointItem) {
+ this._lastHitBreakpointItem.element.removeStyleClass("breakpoint-hit");
+ delete this._lastHitBreakpointItem;
+ }
+ },
+
+ _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);
+ }
+ },
+
+ _removeListElement: function(element)
+ {
+ this.listElement.removeChild(element);
+ if (!this.listElement.firstChild) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ },
+
+ _projectChanged: function()
+ {
+ this.listElement.removeChildren();
+ if (this.listElement.parentElement) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ this._items = {};
+ },
+
+ _compare: function(x, y)
+ {
+ if (x !== y)
+ return x < y ? -1 : 1;
+ return 0;
+ },
+
+ _compareBreakpoints: function(b1, b2)
+ {
+ return this._compare(b1.url, b2.url) || this._compare(b1.lineNumber, b2.lineNumber);
+ },
+
+ _setupBreakpointElement: function(data, element)
+ {
+ var sourceID;
+ var lineNumber = data.lineNumber;
+ if (data.locations.length) {
+ sourceID = data.locations[0].sourceID;
+ lineNumber = data.locations[0].lineNumber;
+ }
+
+ var displayName = data.url ? WebInspector.displayNameForURL(data.url) : WebInspector.UIString("(program)");
+ var labelElement = document.createTextNode(displayName + ":" + (lineNumber + 1));
+ element.appendChild(labelElement);
+
+ var sourceTextElement = document.createElement("div");
+ sourceTextElement.className = "source-text monospace";
+ element.appendChild(sourceTextElement);
+
+ if (sourceID) {
+ function didGetSourceLine(text)
+ {
+ sourceTextElement.textContent = text;
+ }
+ var script = WebInspector.debuggerModel.scriptForSourceID(sourceID);
+ script.sourceLine(lineNumber, didGetSourceLine.bind(this));
+ }
+
+ element.addStyleClass("cursor-pointer");
+ var clickHandler = WebInspector.panels.scripts.showSourceLine.bind(WebInspector.panels.scripts, data.url, lineNumber + 1);
+ element.addEventListener("click", clickHandler, false);
+ },
+
+ _removeBreakpoint: function(breakpointId)
+ {
+ WebInspector.debuggerModel.removeBreakpoint(breakpointId);
+ }
+}
+
+WebInspector.JavaScriptBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+
+WebInspector.NativeBreakpointsSidebarPane = function(title)
+{
+ WebInspector.SidebarPane.call(this, title);
+
+ 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.bodyElement.appendChild(this.emptyElement);
+
+ WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
+}
+
+WebInspector.NativeBreakpointsSidebarPane.prototype = {
+ addBreakpointItem: function(breakpointItem)
+ {
+ var element = breakpointItem.element;
+ element._breakpointItem = breakpointItem;
+
+ breakpointItem.addEventListener("breakpoint-hit", this.expand, this);
+ breakpointItem.addEventListener("removed", this._removeListElement.bind(this, element), 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);
+
+ if (breakpointItem.click) {
+ element.addStyleClass("cursor-pointer");
+ element.addEventListener("click", breakpointItem.click.bind(breakpointItem), false);
+ }
+ element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointItem), true);
+ },
+
+ _contextMenuEventFired: function(breakpointItem, event)
+ {
+ var contextMenu = new WebInspector.ContextMenu();
+ contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), breakpointItem.remove.bind(breakpointItem));
+ contextMenu.show(event);
+ },
+
+ _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);
+ }
+ },
+
+ _removeListElement: function(element)
+ {
+ this.listElement.removeChild(element);
+ if (!this.listElement.firstChild) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ },
+
+ _projectChanged: function()
+ {
+ this.listElement.removeChildren();
+ if (this.listElement.parentElement) {
+ this.bodyElement.removeChild(this.listElement);
+ this.bodyElement.appendChild(this.emptyElement);
+ }
+ }
+}
+
+WebInspector.NativeBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
+
+WebInspector.XHRBreakpointsSidebarPane = function()
+{
+ WebInspector.NativeBreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints"));
+
+ 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.NativeBreakpointsSidebarPane.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: commitHandler,
+ cancelHandler: 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.NativeBreakpointsSidebarPane.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;
+
+ // Breakpoint element may have it's own click handler.
+ 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(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this);
+ WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.EventListenerBreakpointAdded, this._breakpointAdded, this);
+
+ this._breakpointItems = {};
+ this._createCategory(WebInspector.UIString("Keyboard"), "listener", ["keydown", "keyup", "keypress", "textInput"]);
+ this._createCategory(WebInspector.UIString("Mouse"), "listener", ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"]);
+ // FIXME: uncomment following once inspector stops being drop targer in major ports.
+ // Otherwise, inspector page reacts on drop event and tries to load the event data.
+ // this._createCategory(WebInspector.UIString("Drag"), "listener", ["drag", "drop", "dragstart", "dragend", "dragenter", "dragleave", "dragover"]);
+ this._createCategory(WebInspector.UIString("Control"), "listener", ["resize", "scroll", "zoom", "focus", "blur", "select", "change", "submit", "reset"]);
+ this._createCategory(WebInspector.UIString("Clipboard"), "listener", ["copy", "cut", "paste", "beforecopy", "beforecut", "beforepaste"]);
+ this._createCategory(WebInspector.UIString("Load"), "listener", ["load", "unload", "abort", "error"]);
+ this._createCategory(WebInspector.UIString("DOM Mutation"), "listener", ["DOMActivate", "DOMFocusIn", "DOMFocusOut", "DOMAttrModified", "DOMCharacterDataModified", "DOMNodeInserted", "DOMNodeInsertedIntoDocument", "DOMNodeRemoved", "DOMNodeRemovedFromDocument", "DOMSubtreeModified", "DOMContentLoaded"]);
+ this._createCategory(WebInspector.UIString("Device"), "listener", ["deviceorientation", "devicemotion"]);
+ this._createCategory(WebInspector.UIString("Timer"), "instrumentation", ["setTimer", "clearTimer", "timerFired"]);
+}
+
+WebInspector.EventListenerBreakpointsSidebarPane.prototype = {
+ _createCategory: function(name, type, eventNames)
+ {
+ var categoryItem = {};
+ categoryItem.element = new TreeElement(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.EventListenerBreakpointView.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;
+
+ var breakpointItem = this._breakpointItems[breakpoint.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;
+ },
+
+ _projectChanged: 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;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/c4fbd3d0/weinre.build/vendor/webkit/WebCore/inspector/front-end/CSSCompletions.js
----------------------------------------------------------------------
diff --git a/weinre.build/vendor/webkit/WebCore/inspector/front-end/CSSCompletions.js b/weinre.build/vendor/webkit/WebCore/inspector/front-end/CSSCompletions.js
new file mode 100644
index 0000000..ba3aca2
--- /dev/null
+++ b/weinre.build/vendor/webkit/WebCore/inspector/front-end/CSSCompletions.js
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 Nikita Vasilyev. All rights reserved.
+ * Copyright (C) 2010 Joseph Pecoraro. 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:
+ *
+ * * 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.CSSCompletions = function(values, acceptEmptyPrefix)
+{
+ this._values = values.slice();
+ this._values.sort();
+ this._acceptEmptyPrefix = acceptEmptyPrefix;
+}
+
+WebInspector.CSSCompletions.prototype = {
+ startsWith: function(prefix)
+ {
+ var firstIndex = this._firstIndexOfPrefix(prefix);
+ if (firstIndex === -1)
+ return [];
+
+ var results = [];
+ while (firstIndex < this._values.length && this._values[firstIndex].indexOf(prefix) === 0)
+ results.push(this._values[firstIndex++]);
+ return results;
+ },
+
+ firstStartsWith: function(prefix)
+ {
+ var foundIndex = this._firstIndexOfPrefix(prefix);
+ return (foundIndex === -1 ? "" : this._values[foundIndex]);
+ },
+
+ _firstIndexOfPrefix: function(prefix)
+ {
+ if (!this._values.length)
+ return -1;
+ if (!prefix)
+ return this._acceptEmptyPrefix ? 0 : -1;
+
+ var maxIndex = this._values.length - 1;
+ var minIndex = 0;
+ var foundIndex;
+
+ do {
+ var middleIndex = (maxIndex + minIndex) >> 1;
+ if (this._values[middleIndex].indexOf(prefix) === 0) {
+ foundIndex = middleIndex;
+ break;
+ }
+ if (this._values[middleIndex] < prefix)
+ minIndex = middleIndex + 1;
+ else
+ maxIndex = middleIndex - 1;
+ } while (minIndex <= maxIndex);
+
+ if (foundIndex === undefined)
+ return -1;
+
+ while (foundIndex && this._values[foundIndex - 1].indexOf(prefix) === 0)
+ foundIndex--;
+
+ return foundIndex;
+ },
+
+ keySet: function()
+ {
+ return this._values.keySet();
+ },
+
+ next: function(str, prefix)
+ {
+ return this._closest(str, prefix, 1);
+ },
+
+ previous: function(str, prefix)
+ {
+ return this._closest(str, prefix, -1);
+ },
+
+ _closest: function(str, prefix, shift)
+ {
+ if (!str)
+ return "";
+
+ var index = this._values.indexOf(str);
+ if (index === -1)
+ return "";
+
+ if (!prefix) {
+ index = (index + this._values.length + shift) % this._values.length;
+ return this._values[index];
+ }
+
+ var propertiesWithPrefix = this.startsWith(prefix);
+ var j = propertiesWithPrefix.indexOf(str);
+ j = (j + propertiesWithPrefix.length + shift) % propertiesWithPrefix.length;
+ return propertiesWithPrefix[j];
+ }
+}