Title: [197139] trunk
Revision
197139
Author
cdu...@apple.com
Date
2016-02-25 15:24:14 -0800 (Thu, 25 Feb 2016)

Log Message

Drop [TreatReturnedNullStringAs=Undefined] WebKit-specific IDL attribute
https://bugs.webkit.org/show_bug.cgi?id=154662

Reviewed by Darin Adler.

Source/WebCore:

Drop [TreatReturnedNullStringAs=Undefined] WebKit-specific IDL attribute.
This has no standard equivalent and all uses in WebKit are either useless
or wrong.

Test: fast/frames/detached-frame-document-defaultCharset.html

* bindings/scripts/CodeGeneratorJS.pm:
(NativeToJSValue): Deleted.
* bindings/scripts/IDLAttributes.txt:
Drop support for [TreatReturnedNullStringAs=X] entirely.

* dom/Document.cpp:
(WebCore::Document::defaultCharset):
Fall back to return "UTF-8" instead of the null string, similarly to
what is done in for Document.characterSet. Note that this attribute
is non-standard and is an IE extension. Firefox never supported it
and Chrome dropped it last year.

* dom/Document.idl:
- Drop extended attribute for Document.defaultCharset as the
  implementation has been updated to never return a null String.
- Drop extended attribute for Document.readyState. It was useless
  because the implementation could never return a null String.

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::getAllResponseHeaders):
Update implementation to return emptyString() instead of "" in case
of error.

* xml/XMLHttpRequest.idl:
Drop extended attribute from XMLHttpRequest.getAllResponseHeaders().
It was useless because the implementation could never return a
null String.

* xml/XSLTProcessor.idl:
Drop extended attribute from XSLTProcessor.getParameter(). The
operation is already marked as [Custom] so the extended attribute
had no effect.

LayoutTests:

Add layout test to cover the return value of document.defaultCharset before
and after its frame is detached.

* fast/frames/detached-frame-document-defaultCharset-expected.txt: Added.
* fast/frames/detached-frame-document-defaultCharset.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (197138 => 197139)


--- trunk/LayoutTests/ChangeLog	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/LayoutTests/ChangeLog	2016-02-25 23:24:14 UTC (rev 197139)
@@ -1,3 +1,16 @@
+2016-02-25  Chris Dumez  <cdu...@apple.com>
+
+        Drop [TreatReturnedNullStringAs=Undefined] WebKit-specific IDL attribute
+        https://bugs.webkit.org/show_bug.cgi?id=154662
+
+        Reviewed by Darin Adler.
+
+        Add layout test to cover the return value of document.defaultCharset before
+        and after its frame is detached.
+
+        * fast/frames/detached-frame-document-defaultCharset-expected.txt: Added.
+        * fast/frames/detached-frame-document-defaultCharset.html: Added.
+
 2016-02-25  Ryan Haddad  <ryanhad...@apple.com>
 
         Removing failure expectation for 26 editing tests that now pass on ios-simulator

Added: trunk/LayoutTests/fast/frames/detached-frame-document-defaultCharset-expected.txt (0 => 197139)


--- trunk/LayoutTests/fast/frames/detached-frame-document-defaultCharset-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/detached-frame-document-defaultCharset-expected.txt	2016-02-25 23:24:14 UTC (rev 197139)
@@ -0,0 +1,13 @@
+Tests the value returned by document.defaultCharset before and after its frame is detached.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS childDocument.defaultCharset is "ISO-8859-1"
+Detaching frame.
+PASS childDocument.defaultCharset is "UTF-8"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/frames/detached-frame-document-defaultCharset.html (0 => 197139)


--- trunk/LayoutTests/fast/frames/detached-frame-document-defaultCharset.html	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/detached-frame-document-defaultCharset.html	2016-02-25 23:24:14 UTC (rev 197139)
@@ -0,0 +1,18 @@
+<script src=""
+<script>
+description("Tests the value returned by document.defaultCharset before and after its frame is detached.");
+jsTestIsAsync = true;
+
+_onload_ = function()
+{
+    childDocument = frames[0].document;
+    shouldBeEqualToString("childDocument.defaultCharset", "ISO-8859-1");
+    debug("Detaching frame.");
+    document.body.removeChild(document.getElementsByTagName("iframe")[0]);
+    shouldBeEqualToString("childDocument.defaultCharset", "UTF-8");
+    debug("");
+    finishJSTest();
+}
+</script>
+<iframe src=""
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (197138 => 197139)


--- trunk/Source/WebCore/ChangeLog	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/ChangeLog	2016-02-25 23:24:14 UTC (rev 197139)
@@ -1,3 +1,49 @@
+2016-02-25  Chris Dumez  <cdu...@apple.com>
+
+        Drop [TreatReturnedNullStringAs=Undefined] WebKit-specific IDL attribute
+        https://bugs.webkit.org/show_bug.cgi?id=154662
+
+        Reviewed by Darin Adler.
+
+        Drop [TreatReturnedNullStringAs=Undefined] WebKit-specific IDL attribute.
+        This has no standard equivalent and all uses in WebKit are either useless
+        or wrong.
+
+        Test: fast/frames/detached-frame-document-defaultCharset.html
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (NativeToJSValue): Deleted.
+        * bindings/scripts/IDLAttributes.txt:
+        Drop support for [TreatReturnedNullStringAs=X] entirely.
+
+        * dom/Document.cpp:
+        (WebCore::Document::defaultCharset):
+        Fall back to return "UTF-8" instead of the null string, similarly to
+        what is done in for Document.characterSet. Note that this attribute
+        is non-standard and is an IE extension. Firefox never supported it
+        and Chrome dropped it last year.
+
+        * dom/Document.idl:
+        - Drop extended attribute for Document.defaultCharset as the
+          implementation has been updated to never return a null String.
+        - Drop extended attribute for Document.readyState. It was useless
+          because the implementation could never return a null String.
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::getAllResponseHeaders):
+        Update implementation to return emptyString() instead of "" in case
+        of error.
+
+        * xml/XMLHttpRequest.idl:
+        Drop extended attribute from XMLHttpRequest.getAllResponseHeaders().
+        It was useless because the implementation could never return a
+        null String.
+
+        * xml/XSLTProcessor.idl:
+        Drop extended attribute from XSLTProcessor.getParameter(). The
+        operation is already marked as [Custom] so the extended attribute
+        had no effect.
+
 2016-02-25  Gavin Barraclough  <barraclo...@apple.com>
 
         Should template RefCounter instead of RefCounter::Token

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (197138 => 197139)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-02-25 23:24:14 UTC (rev 197139)
@@ -4260,12 +4260,6 @@
 
     if ($codeGenerator->IsStringType($type)) {
         AddToImplIncludes("URL.h", $conditional);
-        my $conv = $signature->extendedAttributes->{"TreatReturnedNullStringAs"};
-        if (defined $conv) {
-            return "jsStringOrUndefined(state, $value)" if $conv eq "Undefined";
-
-            die "Unknown value for TreatReturnedNullStringAs extended attribute";
-        }
         return "jsStringOrNull(state, $value)" if $signature->isNullable;
         AddToImplIncludes("<runtime/JSString.h>", $conditional);
         return "jsStringWithCache(state, $value)";

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (197138 => 197139)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2016-02-25 23:24:14 UTC (rev 197139)
@@ -121,7 +121,6 @@
 SuppressToJSObject
 TreatNullAs=NullString
 TreatReturnedNaNDateAs=Null|NaN
-TreatReturnedNullStringAs=Undefined
 TreatUndefinedAs=NullString
 TypedArray=*
 URL

Modified: trunk/Source/WebCore/dom/Document.cpp (197138 => 197139)


--- trunk/Source/WebCore/dom/Document.cpp	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-02-25 23:24:14 UTC (rev 197139)
@@ -1294,7 +1294,7 @@
 {
     if (Settings* settings = this->settings())
         return settings->defaultTextEncodingName();
-    return String();
+    return UTF8Encoding().domName();
 }
 
 void Document::setCharset(const String& charset)

Modified: trunk/Source/WebCore/dom/Document.idl (197138 => 197139)


--- trunk/Source/WebCore/dom/Document.idl	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/dom/Document.idl	2016-02-25 23:24:14 UTC (rev 197139)
@@ -188,12 +188,12 @@
     // IE extensions
 
 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C || defined(LANGUAGE_GOBJECT) && LANGUAGE_GOBJECT
-    [TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
+    attribute DOMString charset;
 #else
     [ImplementedAs=characterSetWithUTF8Fallback] readonly attribute DOMString charset;
 #endif
-    [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
-    [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
+    readonly attribute DOMString defaultCharset;
+    readonly attribute DOMString readyState;
 
     Element            elementFromPoint([Default=Undefined] optional long x, 
                                         [Default=Undefined] optional long y);

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (197138 => 197139)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2016-02-25 23:24:14 UTC (rev 197139)
@@ -961,7 +961,7 @@
 String XMLHttpRequest::getAllResponseHeaders() const
 {
     if (m_state < HEADERS_RECEIVED || m_error)
-        return "";
+        return emptyString();
 
     StringBuilder stringBuilder;
 

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.idl (197138 => 197139)


--- trunk/Source/WebCore/xml/XMLHttpRequest.idl	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.idl	2016-02-25 23:24:14 UTC (rev 197139)
@@ -69,7 +69,7 @@
     readonly attribute XMLHttpRequestUpload upload;
 
     // response
-    [TreatReturnedNullStringAs=Undefined] DOMString getAllResponseHeaders();
+    DOMString getAllResponseHeaders();
     DOMString? getResponseHeader(DOMString header);
     [GetterRaisesException, CustomGetter] readonly attribute DOMString? responseText;
     [GetterRaisesException] readonly attribute Document responseXML;

Modified: trunk/Source/WebCore/xml/XSLTProcessor.idl (197138 => 197139)


--- trunk/Source/WebCore/xml/XSLTProcessor.idl	2016-02-25 23:12:50 UTC (rev 197138)
+++ trunk/Source/WebCore/xml/XSLTProcessor.idl	2016-02-25 23:24:14 UTC (rev 197139)
@@ -41,7 +41,7 @@
     Document transformToDocument([Default=Undefined] optional Node source);
 
     [Custom] void setParameter(DOMString namespaceURI, DOMString localName, DOMString value);
-    [Custom, TreatReturnedNullStringAs=Undefined] DOMString getParameter(DOMString namespaceURI, DOMString localName);
+    [Custom] DOMString getParameter(DOMString namespaceURI, DOMString localName);
     [Custom] void removeParameter(DOMString namespaceURI, DOMString localName);
     void clearParameters();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to