Title: [184847] trunk/Source/_javascript_Core
Revision
184847
Author
[email protected]
Date
2015-05-24 19:38:22 -0700 (Sun, 24 May 2015)

Log Message

Web Inspector: Uncaught exception when using Inspect tool on SVG elements
https://bugs.webkit.org/show_bug.cgi?id=145363

Reviewed by Joseph Pecoraro.

The injected script failed by chaining a call to String.prototype.trim to the result of
SVG*Element.className, which is an SVGAnimatedString and lacks useful methods. So, obtain
the class name using Node.getAttribute, which always returns a DOMString.

* inspector/InjectedScriptSource.js:
(InjectedScriptSource.prototype._getDescription): use getAttribute instead of className.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (184846 => 184847)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-24 23:22:06 UTC (rev 184846)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-25 02:38:22 UTC (rev 184847)
@@ -1,3 +1,17 @@
+2015-05-24  Brian J. Burg  <[email protected]>
+
+        Web Inspector: Uncaught exception when using Inspect tool on SVG elements
+        https://bugs.webkit.org/show_bug.cgi?id=145363
+
+        Reviewed by Joseph Pecoraro.
+
+        The injected script failed by chaining a call to String.prototype.trim to the result of
+        SVG*Element.className, which is an SVGAnimatedString and lacks useful methods. So, obtain
+        the class name using Node.getAttribute, which always returns a DOMString.
+
+        * inspector/InjectedScriptSource.js:
+        (InjectedScriptSource.prototype._getDescription): use getAttribute instead of className.
+
 2015-05-23  Dan Bernstein  <[email protected]>
 
         Remove unused definitions of WEBKIT_VERSION_MIN_REQUIRED

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (184846 => 184847)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2015-05-24 23:22:06 UTC (rev 184846)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2015-05-25 02:38:22 UTC (rev 184847)
@@ -762,8 +762,11 @@
         case 1: // Node.ELEMENT_NODE
             if (node.id)
                 description += "#" + node.id;
-            if (node.className)
-                description += "." + node.className.trim().replace(/\s+/g, ".");
+            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, ".");
+            }
             return description;
 
         default:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to