RESOLVED FIXED 201046
Web Inspector: provide a way to view XML/HTML/SVG resource responses as a DOM tree
https://bugs.webkit.org/show_bug.cgi?id=201046
Summary Web Inspector: provide a way to view XML/HTML/SVG resource responses as a DOM...
Devin Rousso
Reported 2019-08-22 11:48:14 PDT
Similar to how JSON can be viewed as an object (<https://webkit.org/b/122898>), we should have a DOM tree view for XML/HTML/SVG responses.
Attachments
Patch (83.22 KB, patch)
2019-08-22 16:10 PDT, Devin Rousso
no flags
[Image] After Patch is applied (251.66 KB, image/png)
2019-08-22 16:11 PDT, Devin Rousso
no flags
Patch (86.37 KB, patch)
2019-09-03 18:41 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-08-22 12:02:28 PDT
Devin Rousso
Comment 2 2019-08-22 16:10:59 PDT
Devin Rousso
Comment 3 2019-08-22 16:11:13 PDT
Created attachment 377066 [details] [Image] After Patch is applied
Joseph Pecoraro
Comment 4 2019-09-03 16:27:02 PDT
Comment on attachment 377065 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377065&action=review r=me > Source/WebInspectorUI/UserInterface/Views/LocalDOMContentView.js:45 > + let content = this._content.replace(/`/g, "\\`"); > + let mimeType = this._mimeType.replace(/"/g, "\\\""); > + return `(new DOMParser).parseFromString(\`${content}\`, "${mimeType}")`; Can these just be `JSON.stringify(x)` calls? return `(new DOMParser).parseFromString(${JSON.stringify(content)}), ${JSON.stringify(mimeType)})`; > Source/WebInspectorUI/UserInterface/Views/LocalDOMContentView.js:56 > + treeOutline[WI.DOMTreeOutline.usingLocalDOMNodeSymbol] = true; Why not make this an API method instead of a symbol property? > Source/WebInspectorUI/UserInterface/Views/LocalRemoteObjectContentView.js:59 > + RuntimeAgent.evaluate.invoke(options, (error, result, wasThrown) => { I wonder if we should give this a `target` now? I think this could be any target, in which case we could just use `WI.mainTarget`. > Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js:408 > + case "text/xml": > + case "application/xml": > + case "application/xhtml+xml": > + case "image/svg+xml": It is very common for arbitrary mime types to have a "+xml" suffix, so we should probably do: if (mimeType.endsWith("/xml") || mimeType.endsWith("+xml")) ...; > Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js:412 > + } catch {} Style: We normally have a space in here: `catch { }`. > Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js:497 > + Request: "request", > + RequestJSON: "request-json", Why not Request DOM? I'm sure someone out there still sends XML to their server!
Devin Rousso
Comment 5 2019-09-03 18:34:20 PDT
Comment on attachment 377065 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377065&action=review >> Source/WebInspectorUI/UserInterface/Views/LocalDOMContentView.js:45 >> + return `(new DOMParser).parseFromString(\`${content}\`, "${mimeType}")`; > > Can these just be `JSON.stringify(x)` calls? > > return `(new DOMParser).parseFromString(${JSON.stringify(content)}), ${JSON.stringify(mimeType)})`; Doh! >> Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js:408 >> + case "image/svg+xml": > > It is very common for arbitrary mime types to have a "+xml" suffix, so we should probably do: > > if (mimeType.endsWith("/xml") || mimeType.endsWith("+xml")) > ...; Ooooo, that's true! >> Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js:497 >> + RequestJSON: "request-json", > > Why not Request DOM? I'm sure someone out there still sends XML to their server! Why not indeed! I'll add it :D
Devin Rousso
Comment 6 2019-09-03 18:41:17 PDT
WebKit Commit Bot
Comment 7 2019-09-03 19:57:33 PDT
Comment on attachment 377946 [details] Patch Clearing flags on attachment: 377946 Committed r249451: <https://trac.webkit.org/changeset/249451>
WebKit Commit Bot
Comment 8 2019-09-03 19:57:34 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.