Title: [207033] trunk/Source/WebCore
Revision
207033
Author
[email protected]
Date
2016-10-10 16:51:56 -0700 (Mon, 10 Oct 2016)

Log Message

Don't run SecurityOrigin's port through URLParser
https://bugs.webkit.org/show_bug.cgi?id=163253

Reviewed by Brady Eidson.

No change in behavior.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier):
(WebCore::SecurityOrigin::create):
We used to parse URLs like "file://:0/" which are valid when using URL::parse
but aren't valid when we start using the URLParser, which matches other browsers' failure
to parse URLs with a port but no host. There is no reason to write and parse the port.
Setting m_port directly accomplishes the same thing.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207032 => 207033)


--- trunk/Source/WebCore/ChangeLog	2016-10-10 23:51:25 UTC (rev 207032)
+++ trunk/Source/WebCore/ChangeLog	2016-10-10 23:51:56 UTC (rev 207033)
@@ -1,3 +1,20 @@
+2016-10-10  Alex Christensen  <[email protected]>
+
+        Don't run SecurityOrigin's port through URLParser
+        https://bugs.webkit.org/show_bug.cgi?id=163253
+
+        Reviewed by Brady Eidson.
+
+        No change in behavior.
+
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier):
+        (WebCore::SecurityOrigin::create):
+        We used to parse URLs like "file://:0/" which are valid when using URL::parse
+        but aren't valid when we start using the URLParser, which matches other browsers' failure
+        to parse URLs with a port but no host. There is no reason to write and parse the port.
+        Setting m_port directly accomplishes the same thing.
+ 
 2016-10-10  Said Abou-Hallawa  <[email protected]>
 
         <Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero

Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (207032 => 207033)


--- trunk/Source/WebCore/page/SecurityOrigin.cpp	2016-10-10 23:51:25 UTC (rev 207032)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp	2016-10-10 23:51:56 UTC (rev 207033)
@@ -520,7 +520,9 @@
     String host = databaseIdentifier.substring(separator1 + 1, separator2 - separator1 - 1);
     
     host = decodeURLEscapeSequences(host);
-    return create(URL(URL(), protocol + "://" + host + ":" + String::number(port) + "/"));
+    auto origin = create(URL(URL(), protocol + "://" + host + "/"));
+    origin->m_port = port;
+    return WTFMove(origin);
 }
 
 Ref<SecurityOrigin> SecurityOrigin::createFromDatabaseIdentifier(const String& databaseIdentifier)
@@ -535,7 +537,9 @@
     if (port < 0 || port > MaxAllowedPort)
         return createUnique();
     String decodedHost = decodeURLEscapeSequences(host);
-    return create(URL(URL(), protocol + "://" + host + ":" + String::number(port) + "/"));
+    auto origin = create(URL(URL(), protocol + "://" + host + "/"));
+    origin->m_port = port;
+    return origin;
 }
 
 String SecurityOrigin::databaseIdentifier() const 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to