Changeset 117293 in webkit
- Timestamp:
- May 16, 2012 8:41:08 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r117289 r117293 1 2012-05-16 Andrey Kosyakov <caseq@chromium.org> 2 3 Web Inspector: [Extensions API] expose evaluateOptions in audit formatters 4 https://bugs.webkit.org/show_bug.cgi?id=86617 5 6 Reviewed by Pavel Feldman. 7 8 * inspector/extensions/extensions-audits-content-script-expected.txt: Added. 9 * inspector/extensions/extensions-audits-content-script.html: Added. 10 * platform/gtk/test_expectations.txt: 11 * platform/mac/Skipped: 12 * platform/qt/Skipped: 13 * platform/win/Skipped: 14 * platform/wk2/Skipped: 15 1 16 2012-05-16 Rob Buis <rbuis@rim.com> 2 17 -
trunk/LayoutTests/platform/gtk/test_expectations.txt
r117250 r117293 783 783 BUGWK72434 SKIP : inspector/styles/svg-style.xhtml = FAIL 784 784 BUGWK43034 SKIP : inspector/debugger/debugger-breakpoints-not-activated-on-reload.html = FAIL 785 BUGWK81089 SKIP : inspector/debugger/snippets-model.html = FAIL786 785 BUGWK43332 SKIP : inspector/debugger/dom-breakpoints.html = FAIL 787 786 BUGWK43332 SKIP : inspector/debugger/event-listener-breakpoints.html = FAIL … … 792 791 BUGWK50868 SKIP : inspector/styles/styles-source-lines-inline.html = FAIL 793 792 BUGWK85709 SKIP : inspector/extensions/extensions-eval-content-script.html = FAIL 793 BUGWK85709 SKIP : inspector/extensions/extensions-audits-content-script.html = FAIL 794 794 795 795 // These inspector tests fell out of the radar after the transition to NRWT -
trunk/LayoutTests/platform/mac/Skipped
r117060 r117293 843 843 # Inspector only supports evaluation in content script world with v8, see https://bugs.webkit.org/show_bug.cgi?id=85709 844 844 inspector/extensions/extensions-eval-content-script.html 845 inspector/extensions/extensions-audits-content-script.html 845 846 846 847 # https://bugs.webkit.org/show_bug.cgi?id=86480 -
trunk/LayoutTests/platform/qt/Skipped
r117275 r117293 2489 2489 # Inspector only supports evaluation in content script world with v8, see https://bugs.webkit.org/show_bug.cgi?id=85709 2490 2490 inspector/extensions/extensions-eval-content-script.html 2491 inspector/extensions/extensions-audits-content-script.html 2491 2492 2492 2493 # [Qt][GTK] New fast/multicol/split-in-top-margin.html fails -
trunk/LayoutTests/platform/win/Skipped
r117051 r117293 1748 1748 # Inspector only supports evaluation in content script world with v8, see https://bugs.webkit.org/show_bug.cgi?id=85709 1749 1749 inspector/extensions/extensions-eval-content-script.html 1750 1750 inspector/extensions/extensions-audits-content-script.html 1751 -
trunk/LayoutTests/platform/wk2/Skipped
r117090 r117293 74 74 # Inspector only supports evaluation in content script world with v8, see https://bugs.webkit.org/show_bug.cgi?id=85709 75 75 inspector/extensions/extensions-eval-content-script.html 76 inspector/extensions/extensions-audits-content-script.html 76 77 77 78 # A bunch of inspector tests time out on Lion Intel Debug WebKit2 testers. -
trunk/Source/WebCore/ChangeLog
r117291 r117293 1 2012-05-16 Andrey Kosyakov <caseq@chromium.org> 2 3 Web Inspector: [Extensions API] expose evaluateOptions in audit formatters 4 https://bugs.webkit.org/show_bug.cgi?id=86617 5 6 Reviewed by Pavel Feldman. 7 8 Test: inspector/extensions/extensions-audits-content-script.html 9 10 - apply extension-specific audit formatters earlier (in ExtensionAduitCategory, not along with the rest in AuditFormatters); 11 - use ExtensionServer.evaluate() to handle evaluateOptions instead of PageAgent.evaluate(); 12 13 * inspector/front-end/AuditFormatters.js: Move node and object formatters to ExtensionAuditCategory. 14 (WebInspector.partiallyApplyFormatters): Added a method to traverse formatters tree and apply formatters that are passed as input. 15 * inspector/front-end/ExtensionAuditCategory.js: 16 (WebInspector.ExtensionAuditCategory): Pass extensionOrigin. 17 (WebInspector.ExtensionAuditCategoryResults.prototype._addNode): Apply extensions formatters before adding the result. 18 (WebInspector.ExtensionAuditCategoryResults.prototype._addResult): 19 (WebInspector.ExtensionAuditCategoryResults.prototype.evaluate): moved from AuditFormatters. 20 (WebInspector.ExtensionAuditFormatters.object.onEvaluate): 21 (WebInspector.ExtensionAuditFormatters.object): 22 (WebInspector.ExtensionAuditFormatters.node.onNodeAvailable): 23 (WebInspector.ExtensionAuditFormatters.node.onEvaluate): 24 (WebInspector.ExtensionAuditFormatters.node): 25 * inspector/front-end/ExtensionServer.js: 26 (WebInspector.ExtensionServer.prototype._onAddAuditCategory): Plumb extensionOrigin through to audit category. 27 1 28 2012-05-16 Donald Carr <donald.carr@nokia.com> 2 29 -
trunk/Source/WebCore/inspector/front-end/AuditFormatters.js
r117235 r117293 29 29 */ 30 30 31 WebInspector.applyFormatters = function(value) 31 /** 32 * @constructor 33 */ 34 WebInspector.AuditFormatters = function() 32 35 { 33 var formatter;34 var type = typeof value;35 var args;36 37 switch (type) {38 case "string":39 case "boolean":40 case "number":41 formatter = WebInspector.AuditFormatters.text;42 args = [ value.toString() ];43 break;44 45 case "object":46 if (value instanceof Node)47 return value;48 if (value instanceof Array) {49 formatter = WebInspector.AuditFormatters.concat;50 args = value;51 } else if (value.type && value.arguments) {52 formatter = WebInspector.AuditFormatters[value.type];53 args = value.arguments;54 }55 }56 if (!formatter)57 throw "Invalid value or formatter: " + type + JSON.stringify(value);58 59 return formatter.apply(null, args);60 36 } 61 37 62 WebInspector.AuditFormatters = {38 WebInspector.AuditFormatters.Registry = { 63 39 text: function(text) 64 40 { … … 78 54 var parent = document.createElement("span"); 79 55 for (var arg = 0; arg < arguments.length; ++arg) 80 parent.appendChild(WebInspector.a pplyFormatters(arguments[arg]));56 parent.appendChild(WebInspector.auditFormatters.apply(arguments[arg])); 81 57 return parent; 82 58 }, … … 97 73 // FIXME: use WebInspector.Linkifier 98 74 return WebInspector.linkifyResourceAsNode(url, line, "console-message-url webkit-html-resource-link"); 75 } 76 }; 77 78 WebInspector.AuditFormatters.prototype = { 79 /** 80 * @param {string|boolean|number|Object} value 81 */ 82 apply: function(value) 83 { 84 var formatter; 85 var type = typeof value; 86 var args; 87 88 switch (type) { 89 case "string": 90 case "boolean": 91 case "number": 92 formatter = WebInspector.AuditFormatters.Registry.text; 93 args = [ value.toString() ]; 94 break; 95 96 case "object": 97 if (value instanceof Node) 98 return value; 99 if (value instanceof Array) { 100 formatter = WebInspector.AuditFormatters.Registry.concat; 101 args = value; 102 } else if (value.type && value.arguments) { 103 formatter = WebInspector.AuditFormatters.Registry[value.type]; 104 args = value.arguments; 105 } 106 } 107 if (!formatter) 108 throw "Invalid value or formatter: " + type + JSON.stringify(value); 109 110 return formatter.apply(null, args); 99 111 }, 100 112 101 113 /** 102 * @param {string} expression 103 * @param {string} title 114 * @param {Object} formatters 115 * @param {Object} thisArgument 116 * @param {string|boolean|number|Object} value 104 117 */ 105 object: function(expression, title)118 partiallyApply: function(formatters, thisArgument, value) 106 119 { 107 var parentElement = document.createElement("div"); 108 function onEvaluate(remoteObject) 109 { 110 var section = new WebInspector.ObjectPropertiesSection(remoteObject, title); 111 section.expanded = true; 112 section.editable = false; 113 parentElement.appendChild(section.element); 114 } 115 WebInspector.AuditFormatters.Utilities.evaluate(expression, onEvaluate); 116 return parentElement; 117 }, 120 if (value instanceof Array) 121 return value.map(this.partiallyApply.bind(this, formatters, thisArgument)); 122 if (typeof value === "object" && typeof formatters[value.type] === "function" && value.arguments) 123 return formatters[value.type].apply(thisArgument, value.arguments); 124 return value; 125 } 126 } 118 127 119 /** 120 * @param {string} expression 121 */ 122 node: function(expression) 123 { 124 var parentElement = document.createElement("div"); 125 /** 126 * @param {?number} nodeId 127 */ 128 function onNodeAvailable(nodeId) 129 { 130 if (!nodeId) 131 return; 132 var treeOutline = new WebInspector.ElementsTreeOutline(false, false, true); 133 treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); 134 treeOutline.element.addStyleClass("outline-disclosure"); 135 treeOutline.setVisible(true); 136 parentElement.appendChild(treeOutline.element); 137 } 138 /** 139 * @param {WebInspector.RemoteObject} remoteObject 140 */ 141 function onEvaluate(remoteObject) 142 { 143 remoteObject.pushNodeToFrontend(onNodeAvailable); 144 } 145 WebInspector.AuditFormatters.Utilities.evaluate(expression, onEvaluate); 146 return parentElement; 147 } 148 }; 149 150 WebInspector.AuditFormatters.Utilities = { 151 /** 152 * @param {string} expression 153 * @param {function(WebInspector.RemoteObject)} callback 154 */ 155 evaluate: function(expression, callback) 156 { 157 /** 158 * @param {?string} error 159 * @param {?RuntimeAgent.RemoteObject} result 160 * @param {boolean=} wasThrown 161 */ 162 function onEvaluate(error, result, wasThrown) 163 { 164 if (wasThrown) 165 return; 166 var object = WebInspector.RemoteObject.fromPayload(result); 167 callback(object); 168 } 169 RuntimeAgent.evaluate(expression, "extension-watch", true, undefined, undefined, undefined, onEvaluate); 170 } 171 }; 172 128 WebInspector.auditFormatters = new WebInspector.AuditFormatters(); -
trunk/Source/WebCore/inspector/front-end/AuditResultView.js
r101341 r117293 115 115 treeElement.listItemElement.addStyleClass(result.className); 116 116 if (typeof result.value !== "string") 117 treeElement.listItemElement.appendChild(WebInspector.a pplyFormatters(result.value));117 treeElement.listItemElement.appendChild(WebInspector.auditFormatters.apply(result.value)); 118 118 119 119 if (result.children) { -
trunk/Source/WebCore/inspector/front-end/ExtensionAuditCategory.js
r97152 r117293 1 1 /* 2 * Copyright (C) 201 0Google Inc. All rights reserved.2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 /** 32 32 * @constructor 33 * @param {string} extensionOrigin 34 * @param {string} id 35 * @param {string} displayName 36 * @param {number} ruleCount 33 37 */ 34 WebInspector.ExtensionAuditCategory = function( id, displayName, ruleCount)38 WebInspector.ExtensionAuditCategory = function(extensionOrigin, id, displayName, ruleCount) 35 39 { 40 this._extensionOrigin = extensionOrigin; 36 41 this._id = id; 37 42 this._displayName = displayName; … … 64 69 /** 65 70 * @constructor 71 * @param {WebInspector.ExtensionAuditCategory} category 72 * @param {function(WebInspector.AuditRuleResult)} callback 66 73 */ 67 74 WebInspector.ExtensionAuditCategoryResults = function(category, callback) … … 99 106 _addNode: function(parent, node) 100 107 { 101 var addedNode = parent.addChild(node.contents, node.expanded); 108 var contents = WebInspector.auditFormatters.partiallyApply(WebInspector.ExtensionAuditFormatters, this, node.contents); 109 var addedNode = parent.addChild(contents, node.expanded); 102 110 if (node.children) { 103 111 for (var i = 0; i < node.children.length; ++i) … … 112 120 if (!this._pendingRules) 113 121 WebInspector.extensionServer.stopAuditRun(this); 122 }, 123 124 /** 125 * @param {string} expression 126 * @param {function(WebInspector.RemoteObject)} callback 127 */ 128 evaluate: function(expression, evaluateOptions, callback) 129 { 130 /** 131 * @param {?string} error 132 * @param {?RuntimeAgent.RemoteObject} result 133 * @param {boolean=} wasThrown 134 */ 135 function onEvaluate(error, result, wasThrown) 136 { 137 if (wasThrown) 138 return; 139 var object = WebInspector.RemoteObject.fromPayload(result); 140 callback(object); 141 } 142 WebInspector.extensionServer.evaluate(expression, false, false, evaluateOptions, this._category._extensionOrigin, onEvaluate); 114 143 } 115 144 } 116 145 146 WebInspector.ExtensionAuditFormatters = { 147 /** 148 * @this {WebInspector.ExtensionAuditCategoryResults} 149 * @param {string} expression 150 * @param {string} title 151 * @param {Object} evaluateOptions 152 */ 153 object: function(expression, title, evaluateOptions) 154 { 155 var parentElement = document.createElement("div"); 156 function onEvaluate(remoteObject) 157 { 158 var section = new WebInspector.ObjectPropertiesSection(remoteObject, title); 159 section.expanded = true; 160 section.editable = false; 161 parentElement.appendChild(section.element); 162 } 163 this.evaluate(expression, evaluateOptions, onEvaluate); 164 return parentElement; 165 }, 166 167 /** 168 * @this {WebInspector.ExtensionAuditCategoryResults} 169 * @param {string} expression 170 * @param {Object} evaluateOptions 171 */ 172 node: function(expression, evaluateOptions) 173 { 174 var parentElement = document.createElement("div"); 175 /** 176 * @param {?number} nodeId 177 */ 178 function onNodeAvailable(nodeId) 179 { 180 if (!nodeId) 181 return; 182 var treeOutline = new WebInspector.ElementsTreeOutline(false, false, true); 183 treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(nodeId); 184 treeOutline.element.addStyleClass("outline-disclosure"); 185 treeOutline.setVisible(true); 186 parentElement.appendChild(treeOutline.element); 187 } 188 /** 189 * @param {WebInspector.RemoteObject} remoteObject 190 */ 191 function onEvaluate(remoteObject) 192 { 193 remoteObject.pushNodeToFrontend(onNodeAvailable); 194 } 195 this.evaluate(expression, evaluateOptions, onEvaluate); 196 return parentElement; 197 } 198 } 199 117 200 WebInspector.ExtensionAuditCategoryResults._lastId = 0; -
trunk/Source/WebCore/inspector/front-end/ExtensionServer.js
r116957 r117293 501 501 }, 502 502 503 _onAddAuditCategory: function(message )504 { 505 var category = new WebInspector.ExtensionAuditCategory( message.id, message.displayName, message.resultCount);503 _onAddAuditCategory: function(message, port) 504 { 505 var category = new WebInspector.ExtensionAuditCategory(port._extensionOrigin, message.id, message.displayName, message.resultCount); 506 506 if (WebInspector.panels.audits.getCategory(category.id)) 507 507 return this._status.E_EXISTS(category.id);
Note: See TracChangeset
for help on using the changeset viewer.