Bug 145363 - Web Inspector: Uncaught exception when using Inspect tool on SVG elements
Summary: Web Inspector: Uncaught exception when using Inspect tool on SVG elements
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brian Burg
URL: http://cse512-15s.github.io/a3-aditya...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-05-24 16:34 PDT by Brian Burg
Modified: 2015-05-24 19:38 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.10 KB, patch)
2015-05-24 16:45 PDT, Brian Burg
joepeck: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>