Bug 145363

Summary: Web Inspector: Uncaught exception when using Inspect tool on SVG elements
Product: WebKit Reporter: Brian Burg <burg>
Component: Web InspectorAssignee: Brian Burg <burg>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://cse512-15s.github.io/a3-adityas-burg-aburner/dashboard/pipeline.html
Attachments:
Description Flags
Patch joepeck: review+

Description Brian Burg 2015-05-24 16:34:07 PDT
Steps to repro:

1. Go to the URL.
2. Inspect any SVG element with the "Inspect" picker. The numbered circles are an easy target.

At this point, the 1st level inspector debugger pauses, with message:

Exception with thrown value: TypeError: node.className.trim is not a function. (In 'node.className.trim()', 'node.className.trim' is undefined)

It seems that InjectedScript.prototype._nodeDescription is blowing up because SVG*Element.className will return an SVGAnimatedString instead of a DOMString.
Comment 1 Radar WebKit Bug Importer 2015-05-24 16:34:27 PDT
<rdar://problem/21092210>
Comment 2 Brian Burg 2015-05-24 16:45:31 PDT
Created attachment 253670 [details]
Patch
Comment 3 Joseph Pecoraro 2015-05-24 18:41:42 PDT
Comment on attachment 253670 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=253670&action=review

r=me. Good find!

> Source/JavaScriptCore/inspector/InjectedScriptSource.js:768
> +            if (node.hasAttribute("class"))
> +                // Using .getAttribute() is a workaround for SVG*Element.className returning SVGAnimatedString,
> +                // which doesn't have any useful String methods. See <https://webkit.org/b/145363/>.
> +                description += "." + node.getAttribute("class").trim().replace(/\s+/g, ".");

Style: This block need braces now.
Comment 4 Brian Burg 2015-05-24 19:38:38 PDT
Committed r184847: <http://trac.webkit.org/changeset/184847>