Test Russian ".рф" domain support
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Sep 2015 20:54:01 +0000 (20:54 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Sep 2015 20:54:01 +0000 (20:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148721

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/url/user-visible/rf.html

* html/URLUtils.h: Made this header file work with Objective-C.

* WebCore.xcodeproj/project.pbxproj:
* bindings/scripts/CodeGeneratorJS.pm:
* testing/Internals.cpp:
(WebCore::Internals::getCurrentMediaControlsStatusForElement):
(WebCore::Internals::userVisibleString):
* testing/Internals.h:
* testing/Internals.idl:
* testing/Internals.mm: Added.
(WebCore::Internals::userVisibleString):

LayoutTests:

* TestExpectations:
* fast/url/user-visible: Added.
* fast/url/user-visible/rf-expected.txt: Added.
* fast/url/user-visible/rf.html: Added.
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189285 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/url/user-visible/rf-expected.txt [new file with mode: 0644]
LayoutTests/fast/url/user-visible/rf.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/html/URLUtils.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/Internals.mm [new file with mode: 0644]

index 0f537ef3fad7c6715fdc8b0049b137199080d495..3f2e1c2e2d4d92677da34140ede581842e1b87ac 100644 (file)
@@ -1,3 +1,16 @@
+2015-09-03  Alexey Proskuryakov  <ap@apple.com>
+
+        Test Russian ".рф" domain support
+        https://bugs.webkit.org/show_bug.cgi?id=148721
+
+        Reviewed by Darin Adler.
+
+        * TestExpectations:
+        * fast/url/user-visible: Added.
+        * fast/url/user-visible/rf-expected.txt: Added.
+        * fast/url/user-visible/rf.html: Added.
+        * platform/mac/TestExpectations:
+
 2015-09-03  Chris Dumez  <cdumez@apple.com>
 
         document.createEvent("eventname") should do a case-insensitive match on the event name
index 7c86745f1276695cd0cbd2a37e1ef10fbec11ebf..47d04e8b050f223baa5fbd7c10cff0a0f1b45beb 100644 (file)
@@ -20,6 +20,9 @@ fast/scrolling/latching [ Skip ]
 fast/forms/search/search-padding-cancel-results-buttons.html [ Skip ]
 fast/forms/search/search-results-hidden-crash.html [ Skip ]
 
+# This doesn't have to be platform-specific, but it's only implemented on Mac now.
+fast/url/user-visible [ Skip ]
+
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific tests.
 #//////////////////////////////////////////////////////////////////////////////////////////
diff --git a/LayoutTests/fast/url/user-visible/rf-expected.txt b/LayoutTests/fast/url/user-visible/rf-expected.txt
new file mode 100644 (file)
index 0000000..cb30081
--- /dev/null
@@ -0,0 +1,17 @@
+Test IDN behavior for .рф top level domain.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test('http://президент.рф/') is 'http://президент.рф/'
+PASS test('http://президент.рф./') is 'http://президент.рф./'
+PASS test('http://www.президент.рф/') is 'http://www.президент.рф/'
+PASS test('http://почта.президент.рф/') is 'http://почта.президент.рф/'
+PASS test('http://0ж9.рф/') is 'http://0ж9.рф/'
+PASS test('http://туда-сюда.рф/') is 'http://туда-сюда.рф/'
+PASS test('http://прeзидент.рф/') /* spoof: Roman 'e' */ is 'http://xn--e-htbdgf6aiiy.xn--p1ai/'
+PASS test('http://caxap.рф/') /* spoof: all characters in 'caxap' are Roman */ is 'http://caxap.xn--p1ai/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/url/user-visible/rf.html b/LayoutTests/fast/url/user-visible/rf.html
new file mode 100644 (file)
index 0000000..87cac88
--- /dev/null
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test IDN behavior for .рф top level domain.");
+
+function test(url)
+{
+    var domURL = new URL(url);
+    return internals.userVisibleString(domURL);
+}
+
+shouldBe("test('http://президент.рф/')", "'http://президент.рф/'");
+shouldBe("test('http://президент.рф./')", "'http://президент.рф./'");
+shouldBe("test('http://www.президент.рф/')", "'http://www.президент.рф/'");
+shouldBe("test('http://почта.президент.рф/')", "'http://почта.президент.рф/'");
+shouldBe("test('http://0ж9.рф/')", "'http://0ж9.рф/'");
+shouldBe("test('http://туда-сюда.рф/')", "'http://туда-сюда.рф/'");
+shouldBe("test('http://прeзидент.рф/') /* spoof: Roman 'e' */", "'http://xn--e-htbdgf6aiiy.xn--p1ai/'");
+shouldBe("test('http://caxap.рф/') /* spoof: all characters in 'caxap' are Roman */", "'http://caxap.xn--p1ai/'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
index 256861c42b3fbfaa02c411faa65371ab0557eeed..c8c6bf41251009beee8678b2d8944bd4d54c9c63 100644 (file)
@@ -13,6 +13,8 @@ fast/scrolling/latching [ Pass ]
 fast/forms/search/search-padding-cancel-results-buttons.html [ Pass ]
 fast/forms/search/search-results-hidden-crash.html [ Pass ]
 
+fast/url/user-visible [ Pass ]
+
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.
 #//////////////////////////////////////////////////////////////////////////////////////////
index 2266d40bc6c1236ca0275147e48ea8cc3882306d..6eb3a7008124ecd735487548493321d709e2577b 100644 (file)
@@ -1,3 +1,24 @@
+2015-09-03  Alexey Proskuryakov  <ap@apple.com>
+
+        Test Russian ".рф" domain support
+        https://bugs.webkit.org/show_bug.cgi?id=148721
+
+        Reviewed by Darin Adler.
+
+        Test: fast/url/user-visible/rf.html
+
+        * html/URLUtils.h: Made this header file work with Objective-C.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * testing/Internals.cpp:
+        (WebCore::Internals::getCurrentMediaControlsStatusForElement):
+        (WebCore::Internals::userVisibleString):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        * testing/Internals.mm: Added.
+        (WebCore::Internals::userVisibleString):
+
 2015-09-03  Chris Dumez  <cdumez@apple.com>
 
         document.createEvent("eventname") should do a case-insensitive match on the event name
index b67571b356ac39db1e1fbc64bc47f8a1f2648989..36a986b2a108039bae76a1997e2d588829f6707d 100644 (file)
                E172AF70180F289500FBADB9 /* CryptoKeyUsage.h in Headers */ = {isa = PBXBuildFile; fileRef = E172AF6F180F289500FBADB9 /* CryptoKeyUsage.h */; };
                E172AF8F1811BC3700FBADB9 /* JSDOMPromise.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E172AF8D1811BC3700FBADB9 /* JSDOMPromise.cpp */; };
                E172AF901811BC3700FBADB9 /* JSDOMPromise.h in Headers */ = {isa = PBXBuildFile; fileRef = E172AF8E1811BC3700FBADB9 /* JSDOMPromise.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               E179F0DA1B9774FE00ED0A27 /* Internals.mm in Sources */ = {isa = PBXBuildFile; fileRef = E179F0D91B9774FE00ED0A27 /* Internals.mm */; };
                E17B491516A9B094001C8839 /* TransitionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E17B491316A9B093001C8839 /* TransitionEvent.cpp */; };
                E17B491616A9B094001C8839 /* TransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E17B491416A9B093001C8839 /* TransitionEvent.h */; };
                E17B492116A9B8FF001C8839 /* JSTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */; };
                E172AF8D1811BC3700FBADB9 /* JSDOMPromise.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMPromise.cpp; sourceTree = "<group>"; };
                E172AF8E1811BC3700FBADB9 /* JSDOMPromise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMPromise.h; sourceTree = "<group>"; };
                E176580C180DF3A0005A96D1 /* OESElementIndexUint.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = OESElementIndexUint.idl; sourceTree = "<group>"; };
+               E179F0D91B9774FE00ED0A27 /* Internals.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Internals.mm; sourceTree = "<group>"; };
                E17B490B16A97269001C8839 /* TransitionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TransitionEvent.idl; sourceTree = "<group>"; };
                E17B491316A9B093001C8839 /* TransitionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransitionEvent.cpp; sourceTree = "<group>"; };
                E17B491416A9B093001C8839 /* TransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TransitionEvent.h; sourceTree = "<group>"; };
                        children = (
                                41815C1B138319630057AAA4 /* js */,
                                417DA4CF13734326007C57FB /* Internals.cpp */,
+                               E179F0D91B9774FE00ED0A27 /* Internals.mm */,
                                417DA4CE13734326007C57FB /* Internals.h */,
                                41813F9113818AD60057AAA4 /* Internals.idl */,
                                A7BF7EDC14C9175A0014489D /* InternalSettings.cpp */,
                                53E29E5E167A8A1900586D3D /* InternalSettingsGenerated.cpp in Sources */,
                                417DA71D13735DFA007C57FB /* JSInternals.cpp in Sources */,
                                A740B5A714C935AF00A77FA4 /* JSInternalSettings.cpp in Sources */,
+                               E179F0DA1B9774FE00ED0A27 /* Internals.mm in Sources */,
                                53ED3FDE167A88E7006762E6 /* JSInternalSettingsGenerated.cpp in Sources */,
                                A740B59714C935AF00A77FA4 /* JSMallocStatistics.cpp in Sources */,
                                CD5393D3175E018600C07123 /* JSMemoryInfo.cpp in Sources */,
index bf134b3dd5eea6ce8eaa54766929a16195111cef..d08daa7c249bcf1da6baa1280964158c4e81d9db 100644 (file)
@@ -248,6 +248,7 @@ my %classesNeedingWebCoreExport = (
     "JSCSSStyleDeclaration" => 1,
     "JSDocument" => 1,
     "JSDOMPath" => 1,
+    "JSDOMURL" => 1,
     "JSDOMWindow" => 1,
     "JSElement" => 1,
     "JSFile" => 1,
index 21b9f47790b7c074d7710e30104c818875151073..593e53eb7859add9a7759c177690de72f65f1492 100644 (file)
@@ -245,7 +245,7 @@ void URLUtils<T>::setPathname(const String& value)
     if (!url.canSetPathname())
         return;
 
-    if (value[0] == '/')
+    if (value[0U] == '/')
         url.setPath(value);
     else
         url.setPath("/" + value);
@@ -264,7 +264,7 @@ template <typename T>
 void URLUtils<T>::setSearch(const String& value)
 {
     URL url = href();
-    String newSearch = (value[0] == '?') ? value.substring(1) : value;
+    String newSearch = (value[0U] == '?') ? value.substring(1) : value;
     // Make sure that '#' in the query does not leak to the hash.
     url.setQuery(newSearch.replaceWithLiteral('#', "%23"));
 
@@ -284,7 +284,7 @@ template <typename T>
 void URLUtils<T>::setHash(const String& value)
 {
     URL url = href();
-    if (value[0] == '#')
+    if (value[0U] == '#')
         url.setFragmentIdentifier(value.substring(1));
     else
         url.setFragmentIdentifier(value);
index 5dd446a0a039a948204f5068ebf218f7b5d985f0..31bf51743a881cfcb825a578b46ab2cc2ccf5557 100644 (file)
@@ -3071,4 +3071,12 @@ String Internals::getCurrentMediaControlsStatusForElement(HTMLMediaElement* medi
 #endif
 }
 
+#if !PLATFORM(COCOA)
+String Internals::userVisibleString(const DOMURL*)
+{
+    // Not implemented in WebCore.
+    return String();
+}
+#endif
+
 }
index 3339466abe369b8e5249a28c67de513233cd1c6f..b71bdc93975a9d1643b395d51f8f83cd9112aa4b 100644 (file)
@@ -46,6 +46,7 @@ class ClientRect;
 class ClientRectList;
 class DOMPath;
 class DOMStringList;
+class DOMURL;
 class DOMWindow;
 class Document;
 class Element;
@@ -433,6 +434,8 @@ public:
 
     String getCurrentMediaControlsStatusForElement(HTMLMediaElement*);
 
+    String userVisibleString(const DOMURL*);
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;
index 62d9d4e19b63bcb74a2434a6ff0eee698f8d4bdd..274b5a33943d893472023a99aa775538578513e6 100644 (file)
@@ -401,4 +401,6 @@ enum MediaControlEvent {
     [RaisesException] DOMString pathStringWithShrinkWrappedRects(sequence<double> rectComponents, double radius);
 
     DOMString getCurrentMediaControlsStatusForElement(HTMLMediaElement element);
+
+    DOMString userVisibleString(DOMURL url);
 };
diff --git a/Source/WebCore/testing/Internals.mm b/Source/WebCore/testing/Internals.mm
new file mode 100644 (file)
index 0000000..443e2de
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Internals.h"
+
+#include "DOMURL.h"
+#include "Document.h"
+#include "Editor.h"
+#include "EditorClient.h"
+#include "Frame.h"
+
+namespace WebCore {
+
+String Internals::userVisibleString(const DOMURL* url)
+{
+    return contextDocument()->frame()->editor().client()->userVisibleString(url->href());
+}
+
+}