Title: [203516] trunk/Source/WebCore
Revision
203516
Author
cdu...@apple.com
Date
2016-07-21 11:40:00 -0700 (Thu, 21 Jul 2016)

Log Message

Kill legacy valueToStringWithNullCheck() utility function
https://bugs.webkit.org/show_bug.cgi?id=159991

Reviewed by Sam Weinig.

Kill legacy valueToStringWithNullCheck() utility function. Treating null as
a null string is legacy behavior so drop this function so that people are
not tempted to use it. We should be using either:
1. JSValue::toWTFString() for non-nullable DOMStrings
2. valueToStringWithUndefinedOrNullCheck() for nullable DOMStrings
3. valueToStringTreatingNullAsEmptyString() for strings with [TreatNullAs=EmptyString]

No new tests, no web-exposed behavior change.

* bindings/js/JSDOMBinding.cpp:
(WebCore::valueToStringWithNullCheck): Deleted.
* bindings/js/JSDOMBinding.h:
* bindings/js/JSHTMLFrameElementCustom.cpp:
(WebCore::JSHTMLFrameElement::setLocation):
* html/HTMLFrameElement.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (203515 => 203516)


--- trunk/Source/WebCore/ChangeLog	2016-07-21 18:23:48 UTC (rev 203515)
+++ trunk/Source/WebCore/ChangeLog	2016-07-21 18:40:00 UTC (rev 203516)
@@ -1,3 +1,26 @@
+2016-07-21  Chris Dumez  <cdu...@apple.com>
+
+        Kill legacy valueToStringWithNullCheck() utility function
+        https://bugs.webkit.org/show_bug.cgi?id=159991
+
+        Reviewed by Sam Weinig.
+
+        Kill legacy valueToStringWithNullCheck() utility function. Treating null as
+        a null string is legacy behavior so drop this function so that people are
+        not tempted to use it. We should be using either:
+        1. JSValue::toWTFString() for non-nullable DOMStrings
+        2. valueToStringWithUndefinedOrNullCheck() for nullable DOMStrings
+        3. valueToStringTreatingNullAsEmptyString() for strings with [TreatNullAs=EmptyString]
+
+        No new tests, no web-exposed behavior change.
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::valueToStringWithNullCheck): Deleted.
+        * bindings/js/JSDOMBinding.h:
+        * bindings/js/JSHTMLFrameElementCustom.cpp:
+        (WebCore::JSHTMLFrameElement::setLocation):
+        * html/HTMLFrameElement.idl:
+
 2016-07-21  Zalan Bujtas  <za...@apple.com>
 
         Do not keep invalid IOSurface in ImageBufferData.

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (203515 => 203516)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2016-07-21 18:23:48 UTC (rev 203515)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp	2016-07-21 18:40:00 UTC (rev 203516)
@@ -103,13 +103,6 @@
     return jsStringWithCache(exec, url.string());
 }
 
-String valueToStringWithNullCheck(ExecState* exec, JSValue value)
-{
-    if (value.isNull())
-        return String();
-    return value.toString(exec)->value(exec);
-}
-
 String valueToStringTreatingNullAsEmptyString(ExecState* exec, JSValue value)
 {
     if (value.isNull())

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (203515 => 203516)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2016-07-21 18:23:48 UTC (rev 203515)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2016-07-21 18:40:00 UTC (rev 203516)
@@ -196,9 +196,6 @@
 
 AtomicString propertyNameToAtomicString(JSC::PropertyName);
 
-// FIXME: This is only used by legacy code and should go away. Use valueToStringTreatingNullAsEmptyString() instead.
-String valueToStringWithNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null
-
 String valueToStringTreatingNullAsEmptyString(JSC::ExecState*, JSC::JSValue);
 String valueToStringWithUndefinedOrNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null or undefined
 

Modified: trunk/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp (203515 => 203516)


--- trunk/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp	2016-07-21 18:23:48 UTC (rev 203515)
+++ trunk/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp	2016-07-21 18:40:00 UTC (rev 203516)
@@ -54,7 +54,7 @@
 void JSHTMLFrameElement::setLocation(ExecState& state, JSValue value)
 {
     HTMLFrameElement& imp = wrapped();
-    String locationValue = valueToStringWithNullCheck(&state, value);
+    String locationValue = value.isNull() ? String() : value.toWTFString(&state);
 
     if (!allowSettingJavascriptURL(state, &imp, locationValue))
         return;

Modified: trunk/Source/WebCore/html/HTMLFrameElement.idl (203515 => 203516)


--- trunk/Source/WebCore/html/HTMLFrameElement.idl	2016-07-21 18:23:48 UTC (rev 203515)
+++ trunk/Source/WebCore/html/HTMLFrameElement.idl	2016-07-21 18:40:00 UTC (rev 203516)
@@ -41,6 +41,7 @@
     [CheckSecurityForNode, RaisesException] SVGDocument getSVGDocument();
 #endif
 
+    // FIXME: No other browser has this attribute.
     [CustomSetter] attribute DOMString location;
 
     readonly attribute long width;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to