Changeset 242386 in webkit
- Timestamp:
- Mar 4, 2019, 1:48:04 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/inspector/protocol/DOM.json (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/inspector/agents/InspectorDOMAgent.cpp (modified) (1 diff)
-
WebCore/inspector/agents/InspectorDOMAgent.h (modified) (1 diff)
-
WebInspectorUI/ChangeLog (modified) (1 diff)
-
WebInspectorUI/Localizations/en.lproj/localizedStrings.js (modified) (5 diffs)
-
WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.css (modified) (1 diff)
-
WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (modified) (6 diffs)
-
WebInspectorUI/UserInterface/Views/ObjectTreeView.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r242382 r242386 1 2019-03-04 Joseph Pecoraro <pecoraro@apple.com> 2 3 ITMLKit Inspector: Data Bindings / Associated Data for nodes 4 https://bugs.webkit.org/show_bug.cgi?id=195290 5 <rdar://problem/48304019> 6 7 Reviewed by Devin Rousso. 8 9 * inspector/protocol/DOM.json: 10 1 11 2019-03-04 Yusuke Suzuki <ysuzuki@apple.com> 2 12 -
trunk/Source/JavaScriptCore/inspector/protocol/DOM.json
r241547 r242386 67 67 { "name": "pseudoElements", "type": "array", "items": { "$ref": "Node" }, "optional": true, "description": "Pseudo elements associated with this node." }, 68 68 { "name": "contentSecurityPolicyHash", "type": "string", "optional": true, "description": "Computed SHA-256 Content Security Policy hash source for given element." } 69 ] 70 }, 71 { 72 "id": "DataBinding", 73 "type": "object", 74 "description": "Relationship between data that is associated with a node and the node itself.", 75 "properties": [ 76 { "name": "binding", "type": "string", "description": "The binding key that is specified." }, 77 { "name": "type", "optional": true, "type": "string", "description": "A more descriptive name for the type of binding that represents this paritcular data relationship" }, 78 { "name": "value", "type": "string", "description": "The value that is resolved to with this data binding relationship." } 69 79 ] 70 80 }, … … 257 267 }, 258 268 { 269 "name": "getDataBindingsForNode", 270 "description": "Returns all data binding relationships between data that is associated with the node and the node itself.", 271 "parameters": [ 272 { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to get data bindings for." } 273 ], 274 "returns": [ 275 { "name": "dataBindings", "type": "array", "items": { "$ref": "DataBinding"}, "description": "Array of binding relationships between data and node" } 276 ] 277 }, 278 { 279 "name": "getAssociatedDataForNode", 280 "description": "Returns all data that has been associated with the node and is available for data binding.", 281 "parameters": [ 282 { "name": "nodeId", "$ref": "NodeId", "description": "Id of the node to get associated data for." } 283 ], 284 "returns": [ 285 { "name": "associatedData", "type": "string", "optional": true, "description": "Associated data bound to this node. Sent as a JSON string." } 286 ] 287 }, 288 { 259 289 "name": "getEventListenersForNode", 260 290 "description": "Returns event listeners relevant to the node.", -
trunk/Source/WebCore/ChangeLog
r242379 r242386 1 2019-03-04 Joseph Pecoraro <pecoraro@apple.com> 2 3 ITMLKit Inspector: Data Bindings / Associated Data for nodes 4 https://bugs.webkit.org/show_bug.cgi?id=195290 5 <rdar://problem/48304019> 6 7 Reviewed by Devin Rousso. 8 9 * inspector/agents/InspectorDOMAgent.h: 10 * inspector/agents/InspectorDOMAgent.cpp: 11 (WebCore::InspectorDOMAgent::getDataBindingsForNode): 12 (WebCore::InspectorDOMAgent::getAssociatedDataForNode): 13 Stub these for web pages, they will only be used for ITMLKit right now. 14 1 15 2019-03-04 Daniel Bates <dabates@apple.com> 2 16 -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r241547 r242386 867 867 } 868 868 869 void InspectorDOMAgent::getDataBindingsForNode(ErrorString& errorString, int /* nodeId */, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::DataBinding>>& /* dataBindings */) 870 { 871 errorString = "Not supported"_s; 872 } 873 874 void InspectorDOMAgent::getAssociatedDataForNode(ErrorString& errorString, int /* nodeId */, Optional<String>& /* associatedData */) 875 { 876 errorString = "Not supported"_s; 877 } 878 869 879 void InspectorDOMAgent::getEventListenersForNode(ErrorString& errorString, int nodeId, const String* objectGroup, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::EventListener>>& listenersArray) 870 880 { -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h
r241495 r242386 128 128 void setNodeValue(ErrorString&, int nodeId, const String& value) override; 129 129 void getSupportedEventNames(ErrorString&, RefPtr<JSON::ArrayOf<String>>& eventNames) override; 130 void getDataBindingsForNode(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::DataBinding>>& dataArray) override; 131 void getAssociatedDataForNode(ErrorString&, int nodeId, Optional<String>& associatedData) override; 130 132 void getEventListenersForNode(ErrorString&, int nodeId, const WTF::String* objectGroup, RefPtr<JSON::ArrayOf<Inspector::Protocol::DOM::EventListener>>& listenersArray) override; 131 133 void setEventListenerDisabled(ErrorString&, int eventListenerId, bool disabled) override; -
trunk/Source/WebInspectorUI/ChangeLog
r242374 r242386 1 2019-03-04 Joseph Pecoraro <pecoraro@apple.com> 2 3 ITMLKit Inspector: Data Bindings / Associated Data for nodes 4 https://bugs.webkit.org/show_bug.cgi?id=195290 5 <rdar://problem/48304019> 6 7 Reviewed by Devin Rousso. 8 9 * Localizations/en.lproj/localizedStrings.js: 10 New title and empty message strings. 11 12 * UserInterface/Views/DOMNodeDetailsSidebarPanel.css: 13 (.sidebar > .panel.dom-node-details .details-section.dom-node-associated-data > .content .row): 14 * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: 15 (WI.DOMNodeDetailsSidebarPanel.prototype.initialLayout): 16 (WI.DOMNodeDetailsSidebarPanel.prototype.layout): 17 (WI.DOMNodeDetailsSidebarPanel.prototype._refreshDataBindings): 18 (WI.DOMNodeDetailsSidebarPanel.prototype._refreshAssociatedData): 19 (WI.DOMNodeDetailsSidebarPanel.prototype._attributesChanged): 20 New Node sections only enabled for ITMLKit `WI.sharedApp.hasExtraDomains`. 21 22 * UserInterface/Views/ObjectTreeView.js: 23 (WI.ObjectTreeView): 24 Provide a way, like TreeElement/View to access the ObjectTreeView from an element. 25 1 26 2019-03-04 Devin Rousso <drousso@apple.com> 2 27 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r242300 r242386 130 130 localizedStrings["Assertion with message: %s"] = "Assertion with message: %s"; 131 131 localizedStrings["Assertive"] = "Assertive"; 132 localizedStrings["Associated Data"] = "Associated Data"; 132 133 localizedStrings["Async audits are not supported."] = "Async audits are not supported."; 133 134 localizedStrings["Attribute"] = "Attribute"; … … 151 152 localizedStrings["Beacons"] = "Beacons"; 152 153 localizedStrings["Binary Frame"] = "Binary Frame"; 154 localizedStrings["Binding"] = "Binding"; 153 155 localizedStrings["Block Variables"] = "Block Variables"; 154 156 localizedStrings["Body:"] = "Body:"; … … 289 291 localizedStrings["Damping"] = "Damping"; 290 292 localizedStrings["Data"] = "Data"; 293 localizedStrings["Data Bindings"] = "Data Bindings"; 291 294 localizedStrings["Data returned from the database is too large."] = "Data returned from the database is too large."; 292 295 localizedStrings["Database"] = "Database"; … … 639 642 localizedStrings["No Accessibility Information"] = "No Accessibility Information"; 640 643 localizedStrings["No Application Cache information available"] = "No Application Cache information available"; 644 localizedStrings["No Associated Data"] = "No Associated Data"; 641 645 localizedStrings["No Attributes"] = "No Attributes"; 642 646 localizedStrings["No Audits"] = "No Audits"; … … 647 651 localizedStrings["No Chart Available"] = "No Chart Available"; 648 652 localizedStrings["No Child Layers"] = "No Child Layers"; 653 localizedStrings["No Data Bindings"] = "No Data Bindings"; 649 654 localizedStrings["No Entries"] = "No Entries"; 650 655 localizedStrings["No Event Listeners"] = "No Event Listeners"; -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.css
r239760 r242386 67 67 } 68 68 } 69 70 .sidebar > .panel.dom-node-details .details-section.dom-node-associated-data > .content .row { 71 -webkit-margin-start: 6px; 72 margin-bottom: 4px; 73 } -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
r236766 r242386 102 102 this.contentView.element.appendChild(propertiesSection.element); 103 103 this.contentView.element.appendChild(eventListenersSection.element); 104 105 if (WI.sharedApp.hasExtraDomains) { 106 if (InspectorBackend.domains.DOM.getDataBindingsForNode) { 107 this._dataBindingsSection = new WI.DetailsSection("dom-node-data-bindings", WI.UIString("Data Bindings"), []); 108 this.contentView.element.appendChild(this._dataBindingsSection.element); 109 } 110 111 if (InspectorBackend.domains.DOM.getAssociatedDataForNode) { 112 this._associatedDataGrid = new WI.DetailsSectionRow(WI.UIString("No Associated Data")); 113 114 let associatedDataGroup = new WI.DetailsSectionGroup([this._associatedDataGrid]); 115 116 let associatedSection = new WI.DetailsSection("dom-node-associated-data", WI.UIString("Associated Data"), [associatedDataGroup]); 117 this.contentView.element.appendChild(associatedSection.element); 118 } 119 } 104 120 105 121 if (this._accessibilitySupported()) { … … 149 165 this._refreshProperties(); 150 166 this._refreshEventListeners(); 167 this._refreshDataBindings(); 168 this._refreshAssociatedData(); 151 169 this._refreshAccessibility(); 152 170 } … … 229 247 230 248 let domNode = this.domNode; 231 RuntimeAgent.releaseObjectGroup(WI.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName); 232 233 WI.RemoteObject.resolveNode(domNode, WI.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName).then((object) => { 249 250 const objectGroup = "dom-node-details-sidebar-properties-object-group"; 251 RuntimeAgent.releaseObjectGroup(objectGroup); 252 253 WI.RemoteObject.resolveNode(domNode, objectGroup).then((object) => { 234 254 // Bail if the DOM node changed while we were waiting for the async response. 235 255 if (this.domNode !== domNode) … … 410 430 411 431 domNode.getEventListeners(eventListenersCallback.bind(this)); 432 } 433 434 _refreshDataBindings() 435 { 436 if (!this._dataBindingsSection) 437 return; 438 439 let domNode = this.domNode; 440 if (!domNode) 441 return; 442 443 DOMAgent.getDataBindingsForNode(this.domNode.id).then(({dataBindings}) => { 444 if (this.domNode !== domNode) 445 return; 446 447 if (!dataBindings.length) { 448 let emptyRow = new WI.DetailsSectionRow(WI.UIString("No Data Bindings")); 449 emptyRow.showEmptyMessage(); 450 this._dataBindingsSection.groups = [new WI.DetailsSectionGroup([emptyRow])]; 451 return; 452 } 453 454 let groups = []; 455 for (let {binding, type, value} of dataBindings) { 456 groups.push(new WI.DetailsSectionGroup([ 457 new WI.DetailsSectionSimpleRow(WI.UIString("Binding"), binding), 458 new WI.DetailsSectionSimpleRow(WI.UIString("Type"), type), 459 new WI.DetailsSectionSimpleRow(WI.UIString("Value"), value), 460 ])); 461 } 462 this._dataBindingsSection.groups = groups; 463 }); 464 } 465 466 _refreshAssociatedData() 467 { 468 if (!this._associatedDataGrid) 469 return; 470 471 const objectGroup = "dom-node-details-sidebar-associated-data-object-group"; 472 RuntimeAgent.releaseObjectGroup(objectGroup); 473 474 let domNode = this.domNode; 475 if (!domNode) 476 return; 477 478 DOMAgent.getAssociatedDataForNode(domNode.id).then(({associatedData}) => { 479 if (this.domNode !== domNode) 480 return; 481 482 if (!associatedData) { 483 this._associatedDataGrid.showEmptyMessage(); 484 return; 485 } 486 487 let expression = associatedData; 488 const options = { 489 objectGroup, 490 doNotPauseOnExceptionsAndMuteConsole: true, 491 }; 492 WI.runtimeManager.evaluateInInspectedWindow(expression, options, (result, wasThrown) => { 493 console.assert(!wasThrown); 494 495 if (!result) { 496 this._associatedDataGrid.showEmptyMessage(); 497 return; 498 } 499 500 this._associatedDataGrid.hideEmptyMessage(); 501 502 const propertyPath = null; 503 const forceExpanding = true; 504 let element = WI.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(result, propertyPath, forceExpanding); 505 506 let objectTree = element.__objectTree; 507 if (objectTree) { 508 objectTree.showOnlyProperties(); 509 objectTree.expand(); 510 } 511 512 this._associatedDataGrid.element.appendChild(element); 513 }); 514 }); 412 515 } 413 516 … … 768 871 this._refreshAttributes(); 769 872 this._refreshAccessibility(); 873 this._refreshDataBindings(); 770 874 } 771 875 … … 847 951 Node: "node", 848 952 }; 849 850 WI.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName = "dom-node-details-sidebar-properties-object-group"; -
trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js
r242076 r242386 52 52 53 53 this._element = document.createElement("div"); 54 this._element.__objectTree = this; 54 55 this._element.className = "object-tree"; 55 56
Note:
See TracChangeset
for help on using the changeset viewer.