The length of scheme is at least five characters even when the scheme has 'web+'...
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2013 03:08:31 +0000 (03:08 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Aug 2013 03:08:31 +0000 (03:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=119779

Reviewed by Ryosuke Niwa.

Source/WebCore:

The content-scheme handler specification requires that it is SecurityError if the length of
scheme isn't five characters at least, including 'web+' prefix. Thus, we need to check the length
of scheme on the 'web+' scheme.

Spec: http://www.whatwg.org/specs/web-apps/current-work/#custom-handlers

No new tests, just modify existing tests.

* Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
(WebCore::verifyProtocolHandlerScheme):

LayoutTests:

Add a test case to check if the length of 'web+' is five characters at least.

* fast/dom/register-protocol-handler-expected.txt:
* fast/dom/register-protocol-handler.html:
* fast/dom/unregister-protocol-handler-expected.txt:
* fast/dom/unregister-protocol-handler.html:
* platform/efl/fast/dom/register-protocol-handler-expected.txt:
* platform/efl/fast/dom/unregister-protocol-handler-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/fast/dom/register-protocol-handler-expected.txt
LayoutTests/fast/dom/register-protocol-handler.html
LayoutTests/fast/dom/unregister-protocol-handler-expected.txt
LayoutTests/fast/dom/unregister-protocol-handler.html
LayoutTests/platform/efl/fast/dom/register-protocol-handler-expected.txt
LayoutTests/platform/efl/fast/dom/unregister-protocol-handler-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/navigatorcontentutils/NavigatorContentUtils.cpp

index cdd63de..09d0124 100644 (file)
@@ -1,3 +1,19 @@
+2013-08-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        The length of scheme is at least five characters even when the scheme has 'web+' prefix
+        https://bugs.webkit.org/show_bug.cgi?id=119779
+
+        Reviewed by Ryosuke Niwa.
+
+        Add a test case to check if the length of 'web+' is five characters at least.
+
+        * fast/dom/register-protocol-handler-expected.txt:
+        * fast/dom/register-protocol-handler.html:
+        * fast/dom/unregister-protocol-handler-expected.txt:
+        * fast/dom/unregister-protocol-handler.html:
+        * platform/efl/fast/dom/register-protocol-handler-expected.txt:
+        * platform/efl/fast/dom/unregister-protocol-handler-expected.txt:
+
 2013-08-13  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION(r150187): Safari fails to render allrecipe.com comment popups
index 616f648..6666100 100644 (file)
@@ -4,6 +4,7 @@ Fail: window.navigator.registerProtocolHandler is not defined.
 Fail: Invalid protocol "http" allowed.
 Fail: Invalid protocol "https" allowed.
 Fail: Invalid protocol "file" allowed.
+Fail: Invalid protocol "web+" allowed.
 Fail: Valid protocol "bitcoin" failed.
 Fail: Valid protocol "geo" failed.
 Fail: Valid protocol "im" failed.
index ffa64f9..edd02f9 100644 (file)
@@ -17,7 +17,7 @@ if (window.navigator.registerProtocolHandler)
 else
     debug('Fail: window.navigator.registerProtocolHandler is not defined.');
 
-var invalid_protocols = ['http', 'https', 'file'];
+var invalid_protocols = ['http', 'https', 'file', 'web+'];
 invalid_protocols.forEach(function (protocol) {
     var succeeded = false;
     try {
index ee49fff..6039e0e 100644 (file)
@@ -4,6 +4,7 @@ Fail: window.navigator.unregisterProtocolHandler is not defined.
 Fail: Invalid protocol "http" allowed.
 Fail: Invalid protocol "https" allowed.
 Fail: Invalid protocol "file" allowed.
+Fail: Invalid protocol "web+" allowed.
 Fail: Valid protocol "bitcoin" failed.
 Fail: Valid protocol "geo" failed.
 Fail: Valid protocol "im" failed.
index 24a8565..0a299be 100644 (file)
@@ -17,7 +17,7 @@ if (window.navigator.unregisterProtocolHandler)
 else
     debug('Fail: window.navigator.unregisterProtocolHandler is not defined.');
 
-var invalid_protocols = ['http', 'https', 'file'];
+var invalid_protocols = ['http', 'https', 'file', 'web+'];
 invalid_protocols.forEach(function (protocol) {
     var succeeded = false;
     try {
index 75a78d7..88d3d7b 100644 (file)
@@ -4,6 +4,7 @@ Pass: window.navigator.registerProtocolHandler is defined.
 Pass: Invalid protocol "http" threw SecurityError exception.
 Pass: Invalid protocol "https" threw SecurityError exception.
 Pass: Invalid protocol "file" threw SecurityError exception.
+Pass: Invalid protocol "web+" threw SecurityError exception.
 Pass: Valid protocol "bitcoin" allowed.
 Pass: Valid protocol "geo" allowed.
 Pass: Valid protocol "im" allowed.
index 1f0f306..f8a7f01 100644 (file)
@@ -4,6 +4,7 @@ Pass: window.navigator.unregisterProtocolHandler is defined.
 Pass: Invalid protocol "http" threw SecurityError exception.
 Pass: Invalid protocol "https" threw SecurityError exception.
 Pass: Invalid protocol "file" threw SecurityError exception.
+Pass: Invalid protocol "web+" threw SecurityError exception.
 Pass: Valid protocol "bitcoin" allowed.
 Pass: Valid protocol "geo" allowed.
 Pass: Valid protocol "im" allowed.
index d6f24c2..5594d7b 100644 (file)
@@ -1,3 +1,21 @@
+2013-08-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        The length of scheme is at least five characters even when the scheme has 'web+' prefix
+        https://bugs.webkit.org/show_bug.cgi?id=119779
+
+        Reviewed by Ryosuke Niwa.
+
+        The content-scheme handler specification requires that it is SecurityError if the length of
+        scheme isn't five characters at least, including 'web+' prefix. Thus, we need to check the length
+        of scheme on the 'web+' scheme.
+
+        Spec: http://www.whatwg.org/specs/web-apps/current-work/#custom-handlers
+
+        No new tests, just modify existing tests.
+
+        * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
+        (WebCore::verifyProtocolHandlerScheme):
+
 2013-08-13  Filip Pizlo  <fpizlo@apple.com>
 
         Foo::s_info should be Foo::info(), so that you can change how the s_info is actually linked
index 5753433..99b96cf 100644 (file)
@@ -107,7 +107,8 @@ static bool isProtocolWhitelisted(const String& scheme)
 static bool verifyProtocolHandlerScheme(const String& scheme, ExceptionCode& ec)
 {
     if (scheme.startsWith("web+")) {
-        if (isValidProtocol(scheme))
+        // The specification requires that the length of scheme is at least five characteres (including 'web+' prefix).
+        if (scheme.length() >= 5 && isValidProtocol(scheme))
             return true;
         ec = SECURITY_ERR;
         return false;