haikuwebkit/LayoutTests/inspector/dom/csp-big5-hash.html

32 lines
1.2 KiB
HTML
Raw Permalink Normal View History

Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements https://bugs.webkit.org/show_bug.cgi?id=155466 <rdar://problem/25152480> Reviewed by Joseph Pecoraro and Timothy Hatcher. Source/JavaScriptCore: Add property contentSecurityPolicyHash to store the CSP hash for an HTML style element or an applicable HTML script element. * inspector/protocol/DOM.json: Source/WebCore: For convenience, display the SHA-256 Content Security Policy (CSP) hash in the node details sidebar for the selected HTML script element or HTML style element. A CSP script hash is only applicable to inline JavaScript scripts. Therefore, we will display a hash for HTML script elements only if they do not have a src attribute. Tests: inspector/dom/csp-big5-hash.html inspector/dom/csp-hash.html * inspector/InspectorDOMAgent.cpp: (WebCore::computeContentSecurityPolicySHA256Hash): Added. (WebCore::InspectorDOMAgent::buildObjectForNode): For an applicable HTML script- or style- element, pass the computed SHA-256 CSP hash to the Inspector front end. Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: Add English localized string for the CSP hash UI label. * UserInterface/Models/DOMNode.js: (WebInspector.DOMNode): Initialize the instance variable this._contentSecurityPolicyHash with the value passed from the Inspector back end. (WebInspector.DOMNode.prototype.contentSecurityPolicyHash): Returns the CSP hash for this node. * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: (WebInspector.DOMNodeDetailsSidebarPanel): Append a row to the end of section Identity to display the CSP hash (if applicable). (WebInspector.DOMNodeDetailsSidebarPanel.prototype.refresh): Query the underlying WebInspector.DOMNode for the CSP hash of the selected node. LayoutTests: Add tests to ensure that the WebInspector.DOMNode object associated with an HTML style element or applicable HTML script element has a valid CSP hash. * inspector/dom/csp-big5-hash-expected.txt: Added. * inspector/dom/csp-big5-hash.html: Added. * inspector/dom/csp-hash-expected.txt: Added. * inspector/dom/csp-hash.html: Added. Canonical link: https://commits.webkit.org/173591@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-15 00:39:59 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset="Big5">
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test() {
let testCases = [
{selector: "#stylesheet-1", hash: "sha256-duNBvCmzrFc3RVVqS8ufweBf2QOq1THuEh3UZWP7ZpU="},
{selector: "#script-1", hash: "sha256-0eDk4my9q3qcCQTZ02clVW0RxDNPW9n9lXTCdyGY4Js="},
];
Web Inspector: rename frontend managers to be more consistent with backend agents https://bugs.webkit.org/show_bug.cgi?id=190160 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test.html: * UserInterface/Test/Test.js: * UserInterface/Main.html: * UserInterface/Base/Main.js: * UserInterface/Base/DOMUtilities.js: * UserInterface/Controllers/ApplicationCacheManager.js: * UserInterface/Controllers/CSSManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js. * UserInterface/Controllers/ConsoleManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/LogManager.js. * UserInterface/Controllers/DOMDebuggerManager.js: * UserInterface/Controllers/DOMManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js. * UserInterface/Controllers/DOMStorageManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js. * UserInterface/Controllers/DashboardManager.js: Removed. * UserInterface/Controllers/DatabaseManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/HARBuilder.js: * UserInterface/Controllers/IndexedDBManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/IssueManager.js: Removed. * UserInterface/Controllers/JavaScriptLogViewController.js: * UserInterface/Controllers/NetworkManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js. * UserInterface/Controllers/SourceMapManager.js: * UserInterface/Controllers/TimelineManager.js: * UserInterface/Debug/UncaughtExceptionReporter.js: * UserInterface/Models/CSSProperty.js: * UserInterface/Models/CSSSelector.js: * UserInterface/Models/CallFrame.js: * UserInterface/Models/Canvas.js: * UserInterface/Models/ConsoleMessage.js: * UserInterface/Models/DOMBreakpoint.js: * UserInterface/Models/DOMNode.js: * UserInterface/Models/DOMNodeStyles.js: * UserInterface/Models/DOMTree.js: * UserInterface/Models/DefaultDashboard.js: * UserInterface/Models/Script.js: * UserInterface/Models/ScriptTimelineRecord.js: * UserInterface/Models/SourceMapResource.js: * UserInterface/Models/TimelineRecording.js: * UserInterface/Protocol/CSSObserver.js: * UserInterface/Protocol/ConsoleObserver.js: * UserInterface/Protocol/DOMObserver.js: * UserInterface/Protocol/DOMStorageObserver.js: * UserInterface/Protocol/DatabaseObserver.js: * UserInterface/Protocol/InspectorFrontendAPI.js: * UserInterface/Protocol/InspectorObserver.js: * UserInterface/Protocol/MainTarget.js: * UserInterface/Protocol/NetworkObserver.js: * UserInterface/Protocol/PageObserver.js: * UserInterface/Protocol/RemoteObject.js: * UserInterface/Protocol/RuntimeObserver.js: * UserInterface/Protocol/WorkerTarget.js: * UserInterface/Views/BoxModelDetailsSectionRow.js: * UserInterface/Views/CanvasOverviewContentView.js: * UserInterface/Views/CanvasTreeElement.js: * UserInterface/Views/ContentView.js: * UserInterface/Views/ContextMenuUtilities.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DOMDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeTreeElement.js: * UserInterface/Views/DOMTreeContentView.js: * UserInterface/Views/DOMTreeDataGrid.js: * UserInterface/Views/DOMTreeElement.js: * UserInterface/Views/DOMTreeElementPathComponent.js: * UserInterface/Views/DOMTreeOutline.js: * UserInterface/Views/DOMTreeUpdater.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/ElementsTabContentView.js: * UserInterface/Views/EventBreakpointPopover.js: * UserInterface/Views/EventBreakpointTreeElement.js: * UserInterface/Views/EventListenerSectionGroup.js: * UserInterface/Views/FormattedValue.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js: * UserInterface/Views/LayerDetailsSidebarPanel.js: * UserInterface/Views/LayerTreeDataGridNode.js: * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: * UserInterface/Views/Layers3DContentView.js: * UserInterface/Views/LogContentView.js: * UserInterface/Views/NetworkTableContentView.js: * UserInterface/Views/ObjectTreeBaseTreeElement.js: * UserInterface/Views/ObjectTreeView.js: * UserInterface/Views/OpenResourceDialog.js: * UserInterface/Views/ResourceSidebarPanel.js: * UserInterface/Views/SearchSidebarPanel.js: * UserInterface/Views/SettingsTabContentView.js: * UserInterface/Views/SourceCodeTextEditor.js: * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: * UserInterface/Views/StorageSidebarPanel.js: * UserInterface/Views/StyleDetailsPanel.js: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters: LayoutTests: * http/tests/inspector/dom/cross-domain-inspected-node-access.html: * http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html: * http/tests/inspector/dom/shapes-test.js: * http/tests/inspector/network/har/har-page.html: * http/tests/inspector/network/loadResource-insecure-resource.html: * http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html: * http/tests/inspector/network/resource-response-source-memory-cache.html: * http/tests/inspector/network/resource-sizes-memory-cache.html: * http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html: * http/tests/websocket/tests/hybi/inspector/before-load.html: * http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html: * inspector/canvas/requestNode.html: * inspector/codemirror/resources/prettyprinting/utilities.js: (TestPage.registerInitializer.loadPrettyPrintingTestAndExpectedResults): (TestPage.registerInitializer.window.addPrettyPrintingTests): (TestPage.registerInitializer): * inspector/console/clearMessages.html: * inspector/console/command-line-api.html: * inspector/console/console-api.html: * inspector/console/console-count.html: * inspector/console/console-table.html: * inspector/console/console-time.html: * inspector/console/message-stack-trace.html: * inspector/console/messageAdded-from-named-evaluations.html: * inspector/console/messageRepeatCountUpdated.html: * inspector/console/messagesCleared.html: * inspector/console/webcore-logging-expected.txt: * inspector/console/webcore-logging.html: * inspector/controller/runtime-controller-import.html: * inspector/controller/runtime-controller.html: * inspector/css/add-rule.html: * inspector/css/createStyleSheet.html: * inspector/css/css-property.html: * inspector/css/getAllStyleSheets.html: * inspector/css/manager-preferredInspectorStyleSheetForFrame.html: * inspector/css/matched-style-properties.html: * inspector/css/modify-css-property.html: * inspector/css/modify-rule-selector.html: * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: * inspector/css/pseudo-element-matches.html: * inspector/css/selector-dynamic-specificity.html: * inspector/css/selector-specificity.html: * inspector/css/shadow-scoped-style.html: * inspector/css/stylesheet-events-basic.html: * inspector/css/stylesheet-events-imports.html: * inspector/css/stylesheet-events-inspector-stylesheet.html: * inspector/css/stylesheet-events-multiple-documents.html: * inspector/css/stylesheet-with-mutations.html: * inspector/debugger/csp-exceptions.html: * inspector/debugger/js-stacktrace.html: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): (TestPage.registerInitializer.window.loadMainPageContent): (TestPage.registerInitializer.window.logResolvedBreakpointLinesWithContext): (TestPage.registerInitializer.window.logLinesWithContext): * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/dom-debugger/dom-breakpoints.html: * inspector/dom-debugger/xhr-breakpoints.html: * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/csp-big5-hash.html: * inspector/dom/csp-hash.html: * inspector/dom/customElementState.html: * inspector/dom/domutilities-csspath.html: * inspector/dom/domutilities-path-dump.html: * inspector/dom/domutilities-xpath.html: * inspector/dom/event-listener-add-remove.html: * inspector/dom/getEventListenersForNode.html: * inspector/dom/getOuterHTML.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightSelector.html: * inspector/dom/insertAdjacentHTML.html: * inspector/dom/inspect.html: * inspector/dom/pseudo-element-dynamic.html: * inspector/dom/pseudo-element-static.html: * inspector/dom/push-node-by-path-to-frontend.html: * inspector/dom/setEventListenerDisabled.html: * inspector/dom/setInspectedNode.html: * inspector/dom/setOuterHTML-no-document-element.html: * inspector/dom/setOuterHTML.html: * inspector/dom/shadow-and-non-shadow-children.html: * inspector/dom/shadowRootType.html: * inspector/dom/template-content.html: * inspector/formatting/resources/utilities.js: (TestPage.registerInitializer.loadFormattingTestAndExpectedResults): (TestPage.registerInitializer.window.addFormattingTests): (TestPage.registerInitializer): * inspector/indexeddb/clearObjectStore.html: * inspector/indexeddb/deleteDatabaseNamesWithSpace.html: * inspector/indexeddb/requestData.html: * inspector/indexeddb/requestDatabase.html: * inspector/indexeddb/requestDatabaseNames.html: * inspector/layers/layer-tree-manager.html: * inspector/model/dom-node.html: * inspector/model/frame-extra-scripts.html: * inspector/model/script-resource-relationship.html: * inspector/model/stack-trace.html: * inspector/page/empty-or-missing-resources.html: * inspector/page/hidpi-snapshot-size.html: * inspector/page/main-frame-resource.html: * inspector/runtime/change-execution-context-identifier.html: * inspector/runtime/saveResult.html: * inspector/storage/domStorage-events.html: * inspector/worker/console-basic.html: * inspector/worker/resources-in-worker.html: Canonical link: https://commits.webkit.org/205172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-02 22:14:52 +00:00
WI.domManager.requestDocument(function(documentNode) {
Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements https://bugs.webkit.org/show_bug.cgi?id=155466 <rdar://problem/25152480> Reviewed by Joseph Pecoraro and Timothy Hatcher. Source/JavaScriptCore: Add property contentSecurityPolicyHash to store the CSP hash for an HTML style element or an applicable HTML script element. * inspector/protocol/DOM.json: Source/WebCore: For convenience, display the SHA-256 Content Security Policy (CSP) hash in the node details sidebar for the selected HTML script element or HTML style element. A CSP script hash is only applicable to inline JavaScript scripts. Therefore, we will display a hash for HTML script elements only if they do not have a src attribute. Tests: inspector/dom/csp-big5-hash.html inspector/dom/csp-hash.html * inspector/InspectorDOMAgent.cpp: (WebCore::computeContentSecurityPolicySHA256Hash): Added. (WebCore::InspectorDOMAgent::buildObjectForNode): For an applicable HTML script- or style- element, pass the computed SHA-256 CSP hash to the Inspector front end. Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: Add English localized string for the CSP hash UI label. * UserInterface/Models/DOMNode.js: (WebInspector.DOMNode): Initialize the instance variable this._contentSecurityPolicyHash with the value passed from the Inspector back end. (WebInspector.DOMNode.prototype.contentSecurityPolicyHash): Returns the CSP hash for this node. * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: (WebInspector.DOMNodeDetailsSidebarPanel): Append a row to the end of section Identity to display the CSP hash (if applicable). (WebInspector.DOMNodeDetailsSidebarPanel.prototype.refresh): Query the underlying WebInspector.DOMNode for the CSP hash of the selected node. LayoutTests: Add tests to ensure that the WebInspector.DOMNode object associated with an HTML style element or applicable HTML script element has a valid CSP hash. * inspector/dom/csp-big5-hash-expected.txt: Added. * inspector/dom/csp-big5-hash.html: Added. * inspector/dom/csp-hash-expected.txt: Added. * inspector/dom/csp-hash.html: Added. Canonical link: https://commits.webkit.org/173591@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-15 00:39:59 +00:00
for (let {selector, hash} of testCases) {
Web Inspector: Uncaught Exception: Missing node for given nodeId https://bugs.webkit.org/show_bug.cgi?id=204519 Reviewed by Timothy Hatcher. Source/WebInspectorUI: When a DOM node is removed from the main DOM tree, the `InspectorDOMAgent` invalidates the `DOM.NodeId` that was previously assigned to that DOM node, meaning that any future commands sent by the frontend with that `DOM.NodeId` will fail. Add logic to mark `WI.DOMNode` as being `destroyed` when this happens so the frontend can decide to not invoke any commands with that `DOM.NodeId`. Many functions have also switched to expecting a `WI.DOMNode` instead of a `DOM.NodeId` or have been moved to `WI.DOMNode.prototype` in order to also be able to use `destroyed`. This issue will eventually be mitigated by <https://webkit.org/b/189687>. * UserInterface/Models/DOMNode.js: (WI.DOMNode): (WI.DOMNode.prototype.get destroyed): Added. (WI.DOMNode.prototype.get attached): (WI.DOMNode.prototype.markDestroyed): Added. (WI.DOMNode.prototype.setNodeName): (WI.DOMNode.prototype.setNodeValue): (WI.DOMNode.prototype.setAttribute): (WI.DOMNode.prototype.setAttributeValue): (WI.DOMNode.prototype.querySelector): Added. (WI.DOMNode.prototype.querySelectorAll): Added. (WI.DOMNode.prototype.highlight): Added. (WI.DOMNode.prototype.getOuterHTML): (WI.DOMNode.prototype.setOuterHTML): (WI.DOMNode.prototype.removeNode): (WI.DOMNode.prototype.getEventListeners): * UserInterface/Base/DOMUtilities.js: (WI.bindInteractionsForNodeToElement): * UserInterface/Controllers/DOMManager.js: (WI.DOMManager.buildHighlightConfig): (WI.DOMManager.wrapClientCallback): (WI.DOMManager.prototype._loadNodeAttributes): (WI.DOMManager.prototype._setDocument): (WI.DOMManager.prototype._unbind): (WI.DOMManager.prototype.highlightDOMNodeList): (WI.DOMManager.prototype.highlightSelector): (WI.DOMManager.prototype.hideDOMNodeHighlight): (WI.DOMManager.prototype.highlightDOMNodeForTwoSeconds): (WI.DOMManager.prototype.set inspectModeEnabled): (WI.DOMManager.prototype.setInspectedNode): (WI.DOMManager.prototype.setEventListenerDisabled): (WI.DOMManager.prototype._wrapClientCallback): Deleted. (WI.DOMManager.prototype.querySelector): Deleted. (WI.DOMManager.prototype.querySelectorAll): Deleted. (WI.DOMManager.prototype.highlightDOMNode): Deleted. (WI.DOMManager.prototype._buildHighlightConfig): Deleted. * UserInterface/Models/AuditTestCaseResult.js: (WI.AuditTestCaseResult.async fromPayload): * UserInterface/Models/MediaTimelineRecord.js: (WI.MediaTimelineRecord.async fromJSON): * UserInterface/Protocol/RemoteObject.js: (WI.RemoteObject.resolveNode): * UserInterface/Views/BoxModelDetailsSectionRow.js: (WI.BoxModelDetailsSectionRow.prototype._highlightDOMNode): * UserInterface/Views/CanvasOverviewContentView.js: (WI.CanvasOverviewContentView.prototype._contentViewMouseEnter): * UserInterface/Views/CanvasTreeElement.js: (WI.CanvasTreeElement.prototype._handleMouseOver): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForDOMNode): * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: (WI.DOMNodeDetailsSidebarPanel.prototype.layout): * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView.prototype._domTreeSelectionDidChange): * UserInterface/Views/DOMTreeElement.js: (WI.DOMTreeElement.prototype.get editable): (WI.DOMTreeElement.prototype.populateDOMNodeContextMenu): * UserInterface/Views/DOMTreeElementPathComponent.js: (WI.DOMTreeElementPathComponent.prototype.mouseOver): * UserInterface/Views/DOMTreeOutline.js: (WI.DOMTreeOutline.prototype.get editable): (WI.DOMTreeOutline.prototype.populateContextMenu): (WI.DOMTreeOutline.prototype._onmousemove): (WI.DOMTreeOutline.prototype._ondragstart): (WI.DOMTreeOutline.prototype._ondragover): (WI.DOMTreeOutline.prototype._ondragleave): (WI.DOMTreeOutline.prototype._ondragend): (WI.DOMTreeOutline.prototype._hideElements): * UserInterface/Views/FormattedValue.js: (WI.FormattedValue.createElementForNodePreview): * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: (WI.GeneralStyleDetailsSidebarPanel.prototype.layout): * UserInterface/Views/LayerDetailsSidebarPanel.js: (WI.LayerDetailsSidebarPanel.prototype._dataGridMouseMove): * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: (WI.LayerTreeDetailsSidebarPanel.prototype.layout): (WI.LayerTreeDetailsSidebarPanel.prototype._highlightSelectedNode): * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: (WI.SpreadsheetCSSStyleDeclarationSection.prototype._highlightNodesWithSelector): LayoutTests: * http/tests/inspector/dom/cross-domain-inspected-node-access.html: * http/tests/inspector/dom/didFireEvent.html: * http/tests/inspector/network/resource-initiatorNode.html: * inspector/console/command-line-api.html: * inspector/css/add-css-property.html: * inspector/css/css-property.html: * inspector/css/force-page-appearance.html: * inspector/css/generateCSSRuleString.html: * inspector/css/matched-style-properties.html: * inspector/css/modify-css-property-race.html: * inspector/css/modify-css-property.html: * inspector/css/modify-inline-style.html: * inspector/css/modify-rule-selector.html: * inspector/css/overridden-property.html: * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: * inspector/css/pseudo-element-matches.html: * inspector/css/resolve-variable-value.html: * inspector/css/selector-dynamic-specificity.html: * inspector/css/selector-specificity.html: * inspector/css/shadow-scoped-style.html: * inspector/css/stylesheet-with-mutations.html: * inspector/dom-debugger/attribute-modified-style.html: * inspector/dom-debugger/dom-breakpoints.html: * inspector/dom/attributeModified.html: * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/csp-big5-hash.html: * inspector/dom/csp-hash.html: * inspector/dom/customElementState.html: * inspector/dom/domutilities-csspath.html: * inspector/dom/domutilities-path-dump.html: * inspector/dom/domutilities-xpath.html: * inspector/dom/event-listener-inspected-node.html: * inspector/dom/getEventListenersForNode.html: * inspector/dom/getOuterHTML.html: * inspector/dom/insertAdjacentHTML.html: * inspector/dom/pseudo-element-dynamic.html: * inspector/dom/pseudo-element-static.html: * inspector/dom/setAllowEditingUserAgentShadowTrees.html: * inspector/dom/setInspectedNode.html: * inspector/dom/setOuterHTML.html: * inspector/dom/shadow-and-non-shadow-children.html: * inspector/dom/shadowRootType.html: * inspector/dom/template-content.html: * inspector/model/dom-node.html: * inspector/page/hidpi-snapshot-size.html: Canonical link: https://commits.webkit.org/218189@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-12-07 06:06:27 +00:00
documentNode.querySelector(selector, function(nodeId) {
Web Inspector: rename frontend managers to be more consistent with backend agents https://bugs.webkit.org/show_bug.cgi?id=190160 Reviewed by Joseph Pecoraro. Source/WebInspectorUI: * UserInterface/Test.html: * UserInterface/Test/Test.js: * UserInterface/Main.html: * UserInterface/Base/Main.js: * UserInterface/Base/DOMUtilities.js: * UserInterface/Controllers/ApplicationCacheManager.js: * UserInterface/Controllers/CSSManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/CSSStyleManager.js. * UserInterface/Controllers/ConsoleManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/LogManager.js. * UserInterface/Controllers/DOMDebuggerManager.js: * UserInterface/Controllers/DOMManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js. * UserInterface/Controllers/DOMStorageManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/StorageManager.js. * UserInterface/Controllers/DashboardManager.js: Removed. * UserInterface/Controllers/DatabaseManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/HARBuilder.js: * UserInterface/Controllers/IndexedDBManager.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DOMStorageManager.js. * UserInterface/Controllers/IssueManager.js: Removed. * UserInterface/Controllers/JavaScriptLogViewController.js: * UserInterface/Controllers/NetworkManager.js: Renamed from Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js. * UserInterface/Controllers/SourceMapManager.js: * UserInterface/Controllers/TimelineManager.js: * UserInterface/Debug/UncaughtExceptionReporter.js: * UserInterface/Models/CSSProperty.js: * UserInterface/Models/CSSSelector.js: * UserInterface/Models/CallFrame.js: * UserInterface/Models/Canvas.js: * UserInterface/Models/ConsoleMessage.js: * UserInterface/Models/DOMBreakpoint.js: * UserInterface/Models/DOMNode.js: * UserInterface/Models/DOMNodeStyles.js: * UserInterface/Models/DOMTree.js: * UserInterface/Models/DefaultDashboard.js: * UserInterface/Models/Script.js: * UserInterface/Models/ScriptTimelineRecord.js: * UserInterface/Models/SourceMapResource.js: * UserInterface/Models/TimelineRecording.js: * UserInterface/Protocol/CSSObserver.js: * UserInterface/Protocol/ConsoleObserver.js: * UserInterface/Protocol/DOMObserver.js: * UserInterface/Protocol/DOMStorageObserver.js: * UserInterface/Protocol/DatabaseObserver.js: * UserInterface/Protocol/InspectorFrontendAPI.js: * UserInterface/Protocol/InspectorObserver.js: * UserInterface/Protocol/MainTarget.js: * UserInterface/Protocol/NetworkObserver.js: * UserInterface/Protocol/PageObserver.js: * UserInterface/Protocol/RemoteObject.js: * UserInterface/Protocol/RuntimeObserver.js: * UserInterface/Protocol/WorkerTarget.js: * UserInterface/Views/BoxModelDetailsSectionRow.js: * UserInterface/Views/CanvasOverviewContentView.js: * UserInterface/Views/CanvasTreeElement.js: * UserInterface/Views/ContentView.js: * UserInterface/Views/ContextMenuUtilities.js: * UserInterface/Views/CookieStorageContentView.js: * UserInterface/Views/DOMDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: * UserInterface/Views/DOMNodeTreeElement.js: * UserInterface/Views/DOMTreeContentView.js: * UserInterface/Views/DOMTreeDataGrid.js: * UserInterface/Views/DOMTreeElement.js: * UserInterface/Views/DOMTreeElementPathComponent.js: * UserInterface/Views/DOMTreeOutline.js: * UserInterface/Views/DOMTreeUpdater.js: * UserInterface/Views/DebuggerSidebarPanel.js: * UserInterface/Views/ElementsTabContentView.js: * UserInterface/Views/EventBreakpointPopover.js: * UserInterface/Views/EventBreakpointTreeElement.js: * UserInterface/Views/EventListenerSectionGroup.js: * UserInterface/Views/FormattedValue.js: * UserInterface/Views/FrameTreeElement.js: * UserInterface/Views/GeneralStyleDetailsSidebarPanel.js: * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js: * UserInterface/Views/LayerDetailsSidebarPanel.js: * UserInterface/Views/LayerTreeDataGridNode.js: * UserInterface/Views/LayerTreeDetailsSidebarPanel.js: * UserInterface/Views/Layers3DContentView.js: * UserInterface/Views/LogContentView.js: * UserInterface/Views/NetworkTableContentView.js: * UserInterface/Views/ObjectTreeBaseTreeElement.js: * UserInterface/Views/ObjectTreeView.js: * UserInterface/Views/OpenResourceDialog.js: * UserInterface/Views/ResourceSidebarPanel.js: * UserInterface/Views/SearchSidebarPanel.js: * UserInterface/Views/SettingsTabContentView.js: * UserInterface/Views/SourceCodeTextEditor.js: * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js: * UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js: * UserInterface/Views/StorageSidebarPanel.js: * UserInterface/Views/StyleDetailsPanel.js: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj: * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters: LayoutTests: * http/tests/inspector/dom/cross-domain-inspected-node-access.html: * http/tests/inspector/dom/disconnect-dom-tree-after-main-frame-navigation.html: * http/tests/inspector/dom/shapes-test.js: * http/tests/inspector/network/har/har-page.html: * http/tests/inspector/network/loadResource-insecure-resource.html: * http/tests/inspector/network/resource-response-source-memory-cache-revalidate-expired-only.html: * http/tests/inspector/network/resource-response-source-memory-cache.html: * http/tests/inspector/network/resource-sizes-memory-cache.html: * http/tests/inspector/network/set-resource-caching-disabled-memory-cache.html: * http/tests/websocket/tests/hybi/inspector/before-load.html: * http/tests/websocket/tests/hybi/inspector/resolveWebSocket.html: * inspector/canvas/requestNode.html: * inspector/codemirror/resources/prettyprinting/utilities.js: (TestPage.registerInitializer.loadPrettyPrintingTestAndExpectedResults): (TestPage.registerInitializer.window.addPrettyPrintingTests): (TestPage.registerInitializer): * inspector/console/clearMessages.html: * inspector/console/command-line-api.html: * inspector/console/console-api.html: * inspector/console/console-count.html: * inspector/console/console-table.html: * inspector/console/console-time.html: * inspector/console/message-stack-trace.html: * inspector/console/messageAdded-from-named-evaluations.html: * inspector/console/messageRepeatCountUpdated.html: * inspector/console/messagesCleared.html: * inspector/console/webcore-logging-expected.txt: * inspector/console/webcore-logging.html: * inspector/controller/runtime-controller-import.html: * inspector/controller/runtime-controller.html: * inspector/css/add-rule.html: * inspector/css/createStyleSheet.html: * inspector/css/css-property.html: * inspector/css/getAllStyleSheets.html: * inspector/css/manager-preferredInspectorStyleSheetForFrame.html: * inspector/css/matched-style-properties.html: * inspector/css/modify-css-property.html: * inspector/css/modify-rule-selector.html: * inspector/css/pseudo-element-matches-for-pseudo-element-node.html: * inspector/css/pseudo-element-matches.html: * inspector/css/selector-dynamic-specificity.html: * inspector/css/selector-specificity.html: * inspector/css/shadow-scoped-style.html: * inspector/css/stylesheet-events-basic.html: * inspector/css/stylesheet-events-imports.html: * inspector/css/stylesheet-events-inspector-stylesheet.html: * inspector/css/stylesheet-events-multiple-documents.html: * inspector/css/stylesheet-with-mutations.html: * inspector/debugger/csp-exceptions.html: * inspector/debugger/js-stacktrace.html: * inspector/debugger/resources/log-pause-location.js: (TestPage.registerInitializer.window.findScript): (TestPage.registerInitializer.window.loadMainPageContent): (TestPage.registerInitializer.window.logResolvedBreakpointLinesWithContext): (TestPage.registerInitializer.window.logLinesWithContext): * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/dom-debugger/dom-breakpoints.html: * inspector/dom-debugger/xhr-breakpoints.html: * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/csp-big5-hash.html: * inspector/dom/csp-hash.html: * inspector/dom/customElementState.html: * inspector/dom/domutilities-csspath.html: * inspector/dom/domutilities-path-dump.html: * inspector/dom/domutilities-xpath.html: * inspector/dom/event-listener-add-remove.html: * inspector/dom/getEventListenersForNode.html: * inspector/dom/getOuterHTML.html: * inspector/dom/hideHighlight.html: * inspector/dom/highlightFrame.html: * inspector/dom/highlightNode.html: * inspector/dom/highlightNodeList.html: * inspector/dom/highlightSelector.html: * inspector/dom/insertAdjacentHTML.html: * inspector/dom/inspect.html: * inspector/dom/pseudo-element-dynamic.html: * inspector/dom/pseudo-element-static.html: * inspector/dom/push-node-by-path-to-frontend.html: * inspector/dom/setEventListenerDisabled.html: * inspector/dom/setInspectedNode.html: * inspector/dom/setOuterHTML-no-document-element.html: * inspector/dom/setOuterHTML.html: * inspector/dom/shadow-and-non-shadow-children.html: * inspector/dom/shadowRootType.html: * inspector/dom/template-content.html: * inspector/formatting/resources/utilities.js: (TestPage.registerInitializer.loadFormattingTestAndExpectedResults): (TestPage.registerInitializer.window.addFormattingTests): (TestPage.registerInitializer): * inspector/indexeddb/clearObjectStore.html: * inspector/indexeddb/deleteDatabaseNamesWithSpace.html: * inspector/indexeddb/requestData.html: * inspector/indexeddb/requestDatabase.html: * inspector/indexeddb/requestDatabaseNames.html: * inspector/layers/layer-tree-manager.html: * inspector/model/dom-node.html: * inspector/model/frame-extra-scripts.html: * inspector/model/script-resource-relationship.html: * inspector/model/stack-trace.html: * inspector/page/empty-or-missing-resources.html: * inspector/page/hidpi-snapshot-size.html: * inspector/page/main-frame-resource.html: * inspector/runtime/change-execution-context-identifier.html: * inspector/runtime/saveResult.html: * inspector/storage/domStorage-events.html: * inspector/worker/console-basic.html: * inspector/worker/resources-in-worker.html: Canonical link: https://commits.webkit.org/205172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-02 22:14:52 +00:00
let domNode = WI.domManager.nodeForId(nodeId);
Web Inspector: Display Content Security Policy hash in details sidebar for script and style elements https://bugs.webkit.org/show_bug.cgi?id=155466 <rdar://problem/25152480> Reviewed by Joseph Pecoraro and Timothy Hatcher. Source/JavaScriptCore: Add property contentSecurityPolicyHash to store the CSP hash for an HTML style element or an applicable HTML script element. * inspector/protocol/DOM.json: Source/WebCore: For convenience, display the SHA-256 Content Security Policy (CSP) hash in the node details sidebar for the selected HTML script element or HTML style element. A CSP script hash is only applicable to inline JavaScript scripts. Therefore, we will display a hash for HTML script elements only if they do not have a src attribute. Tests: inspector/dom/csp-big5-hash.html inspector/dom/csp-hash.html * inspector/InspectorDOMAgent.cpp: (WebCore::computeContentSecurityPolicySHA256Hash): Added. (WebCore::InspectorDOMAgent::buildObjectForNode): For an applicable HTML script- or style- element, pass the computed SHA-256 CSP hash to the Inspector front end. Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: Add English localized string for the CSP hash UI label. * UserInterface/Models/DOMNode.js: (WebInspector.DOMNode): Initialize the instance variable this._contentSecurityPolicyHash with the value passed from the Inspector back end. (WebInspector.DOMNode.prototype.contentSecurityPolicyHash): Returns the CSP hash for this node. * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: (WebInspector.DOMNodeDetailsSidebarPanel): Append a row to the end of section Identity to display the CSP hash (if applicable). (WebInspector.DOMNodeDetailsSidebarPanel.prototype.refresh): Query the underlying WebInspector.DOMNode for the CSP hash of the selected node. LayoutTests: Add tests to ensure that the WebInspector.DOMNode object associated with an HTML style element or applicable HTML script element has a valid CSP hash. * inspector/dom/csp-big5-hash-expected.txt: Added. * inspector/dom/csp-big5-hash.html: Added. * inspector/dom/csp-hash-expected.txt: Added. * inspector/dom/csp-hash.html: Added. Canonical link: https://commits.webkit.org/173591@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@198178 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-03-15 00:39:59 +00:00
InspectorTest.log("");
InspectorTest.expectThat(domNode, `Got DOMNode for ${selector}`);
InspectorTest.expectThat(domNode.contentSecurityPolicyHash() === hash, `DOMNode has hash ${hash}`);
});
}
InspectorTest.completeTest();
});
}
</script>
</head>
<body onload="runTest()">
<p>Test for Content Security Policy hash support on DOM.DOMNode in a document with character set Big5.</p>
<style id="stylesheet-1">#test1 { background-color: blue; } /* <20><> */</style>
<script id="script-1">var thisIsAnInlineScript = true; // <EFBFBD><EFBFBD></script>
</body>
</html>