Diff
Modified: trunk/LayoutTests/ChangeLog (266747 => 266748)
--- trunk/LayoutTests/ChangeLog 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/LayoutTests/ChangeLog 2020-09-08 21:08:46 UTC (rev 266748)
@@ -1,3 +1,15 @@
+2020-09-08 Alex Christensen <[email protected]>
+
+ new URL("#") should throw an error
+ https://bugs.webkit.org/show_bug.cgi?id=216115
+
+ Reviewed by Yusuke Suzuki and Darin Adler.
+
+ * fast/dom/DOMURL/url-constructor-expected.txt:
+ * fast/dom/DOMURL/url-constructor.html:
+ * inspector/unit-tests/url-utilities.html:
+ * inspector/unit-tests/url-utilities-expected.txt:
+
2020-09-08 Chris Dumez <[email protected]>
Fix precision issues in AudioParamTimeline when event times are very close
Modified: trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt (266747 => 266748)
--- trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt 2020-09-08 21:08:46 UTC (rev 266748)
@@ -7,6 +7,7 @@
PASS url.href is 'http://user:[email protected]/path?query#fragment'
One-parameter constructor - invalid URL should throw
PASS url = "" URL("%^$#") threw exception TypeError: Type error.
+PASS url = "" URL("#") threw exception TypeError: Type error.
One-parameter constructor - relative URL not valid against default base
PASS url = "" URL("foobar") threw exception TypeError: Type error.
URL with string base
Modified: trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html (266747 => 266748)
--- trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html 2020-09-08 21:08:46 UTC (rev 266748)
@@ -15,6 +15,7 @@
debug("One-parameter constructor - invalid URL should throw");
shouldThrow('url = "" URL("%^$#")');
+shouldThrow('url = "" URL("#")');
debug("One-parameter constructor - relative URL not valid against default base");
shouldThrow('url = "" URL("foobar")');
Modified: trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt (266747 => 266748)
--- trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt 2020-09-08 21:08:46 UTC (rev 266748)
@@ -499,7 +499,7 @@
PASS: Removing fragment of 'http://example.com/path/#' should be 'http://example.com/path/'.
PASS: Removing fragment of 'http://example.com/path?#' should be 'http://example.com/path?'.
PASS: Removing fragment of 'http://example.com/path/?#' should be 'http://example.com/path/?'.
-PASS: Removing fragment of '#hash' should be 'about:blank'.
+PASS: Removing fragment of 'about:blank#hash' should be 'about:blank'.
PASS: Removing fragment of 'invalid' should be 'invalid'.
-- Running test case: WI.h2Authority
Modified: trunk/LayoutTests/inspector/unit-tests/url-utilities.html (266747 => 266748)
--- trunk/LayoutTests/inspector/unit-tests/url-utilities.html 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/LayoutTests/inspector/unit-tests/url-utilities.html 2020-09-08 21:08:46 UTC (rev 266748)
@@ -573,7 +573,7 @@
test("http://example.com/path?#", "http://example.com/path?");
test("http://example.com/path/?#", "http://example.com/path/?");
- test("#hash", "about:blank");
+ test(new URL("#hash", "about:blank"), "about:blank");
test("invalid", "invalid");
return true;
Modified: trunk/Source/WebCore/ChangeLog (266747 => 266748)
--- trunk/Source/WebCore/ChangeLog 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/Source/WebCore/ChangeLog 2020-09-08 21:08:46 UTC (rev 266748)
@@ -1,3 +1,17 @@
+2020-09-08 Alex Christensen <[email protected]>
+
+ new URL("#") should throw an error
+ https://bugs.webkit.org/show_bug.cgi?id=216115
+
+ Reviewed by Yusuke Suzuki and Darin Adler.
+
+ This aligns the DOM URL object with the specification and Firefox.
+ Covered by adding to fast/dom/DOMURL/url-constructor.html.
+
+ * html/DOMURL.cpp:
+ (WebCore::DOMURL::create):
+ * html/DOMURL.h:
+
2020-09-08 Chris Dumez <[email protected]>
Fix precision issues in AudioParamTimeline when event times are very close
Modified: trunk/Source/WebCore/html/DOMURL.cpp (266747 => 266748)
--- trunk/Source/WebCore/html/DOMURL.cpp 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/Source/WebCore/html/DOMURL.cpp 2020-09-08 21:08:46 UTC (rev 266748)
@@ -47,8 +47,7 @@
ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const URL& base)
{
- if (!base.isValid())
- return Exception { TypeError };
+ ASSERT(base.isValid() || base.isNull());
URL completeURL { base, url };
if (!completeURL.isValid())
return Exception { TypeError };
@@ -57,7 +56,10 @@
ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const String& base)
{
- return create(url, base.isNull() ? aboutBlankURL() : URL { URL { }, base });
+ URL baseURL { URL { }, base };
+ if (!base.isNull() && !baseURL.isValid())
+ return Exception { TypeError };
+ return create(url, baseURL);
}
ExceptionOr<Ref<DOMURL>> DOMURL::create(const String& url, const DOMURL& base)
Modified: trunk/Source/WebCore/html/DOMURL.h (266747 => 266748)
--- trunk/Source/WebCore/html/DOMURL.h 2020-09-08 20:32:01 UTC (rev 266747)
+++ trunk/Source/WebCore/html/DOMURL.h 2020-09-08 21:08:46 UTC (rev 266748)
@@ -41,7 +41,6 @@
public:
static ExceptionOr<Ref<DOMURL>> create(const String& url, const String& base);
static ExceptionOr<Ref<DOMURL>> create(const String& url, const DOMURL& base);
- static ExceptionOr<Ref<DOMURL>> create(const String& url, const URL& base);
~DOMURL();
const URL& href() const { return m_url; }
@@ -58,6 +57,7 @@
static String createPublicURL(ScriptExecutionContext&, URLRegistrable&);
private:
+ static ExceptionOr<Ref<DOMURL>> create(const String& url, const URL& base);
DOMURL(URL&& completeURL, const URL& baseURL);
URL fullURL() const final { return m_url; }