Title: [280313] trunk/Source/WebCore
Revision
280313
Author
[email protected]
Date
2021-07-26 14:19:18 -0700 (Mon, 26 Jul 2021)

Log Message

Rename activeWindow to incumbentWindow in the Location class
https://bugs.webkit.org/show_bug.cgi?id=228295

Reviewed by Darin Adler.

Rename activeWindow to incumbentWindow in the Location class, since this is the naming used
both in the HTML specification and Location.idl.

* page/Location.cpp:
(WebCore::Location::setHref):
(WebCore::Location::setProtocol):
(WebCore::Location::setHost):
(WebCore::Location::setHostname):
(WebCore::Location::setPort):
(WebCore::Location::setPathname):
(WebCore::Location::setSearch):
(WebCore::Location::setHash):
(WebCore::Location::assign):
(WebCore::Location::replace):
(WebCore::Location::reload):
(WebCore::Location::setLocation):
* page/Location.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (280312 => 280313)


--- trunk/Source/WebCore/ChangeLog	2021-07-26 20:47:30 UTC (rev 280312)
+++ trunk/Source/WebCore/ChangeLog	2021-07-26 21:19:18 UTC (rev 280313)
@@ -1,3 +1,28 @@
+2021-07-26  Chris Dumez  <[email protected]>
+
+        Rename activeWindow to incumbentWindow in the Location class
+        https://bugs.webkit.org/show_bug.cgi?id=228295
+
+        Reviewed by Darin Adler.
+
+        Rename activeWindow to incumbentWindow in the Location class, since this is the naming used
+        both in the HTML specification and Location.idl.
+
+        * page/Location.cpp:
+        (WebCore::Location::setHref):
+        (WebCore::Location::setProtocol):
+        (WebCore::Location::setHost):
+        (WebCore::Location::setHostname):
+        (WebCore::Location::setPort):
+        (WebCore::Location::setPathname):
+        (WebCore::Location::setSearch):
+        (WebCore::Location::setHash):
+        (WebCore::Location::assign):
+        (WebCore::Location::replace):
+        (WebCore::Location::reload):
+        (WebCore::Location::setLocation):
+        * page/Location.h:
+
 2021-07-26  Frédéric Wang  <[email protected]>
 
         Crash in InsertParagraphSeparatorCommand::doApply

Modified: trunk/Source/WebCore/page/Location.cpp (280312 => 280313)


--- trunk/Source/WebCore/page/Location.cpp	2021-07-26 20:47:30 UTC (rev 280312)
+++ trunk/Source/WebCore/page/Location.cpp	2021-07-26 21:19:18 UTC (rev 280313)
@@ -122,14 +122,14 @@
     return url().fragmentIdentifier().isEmpty() ? emptyString() : url().fragmentIdentifierWithLeadingNumberSign().toString();
 }
 
-ExceptionOr<void> Location::setHref(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)
+ExceptionOr<void> Location::setHref(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& url)
 {
     if (!frame())
         return { };
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(incumbentWindow, firstWindow, url);
 }
 
-ExceptionOr<void> Location::setProtocol(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& protocol)
+ExceptionOr<void> Location::setProtocol(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& protocol)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -137,10 +137,10 @@
     URL url = ""
     if (!url.setProtocol(protocol))
         return Exception { SyntaxError };
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::setHost(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& host)
+ExceptionOr<void> Location::setHost(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& host)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -147,10 +147,10 @@
         return { };
     URL url = ""
     url.setHostAndPort(host);
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::setHostname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hostname)
+ExceptionOr<void> Location::setHostname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& hostname)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -157,10 +157,10 @@
         return { };
     URL url = ""
     url.setHost(hostname);
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::setPort(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& portString)
+ExceptionOr<void> Location::setPort(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& portString)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -167,10 +167,10 @@
         return { };
     URL url = ""
     url.setPort(parseInteger<uint16_t>(portString));
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::setPathname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& pathname)
+ExceptionOr<void> Location::setPathname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& pathname)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -177,10 +177,10 @@
         return { };
     URL url = ""
     url.setPath(pathname);
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::setSearch(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& search)
+ExceptionOr<void> Location::setSearch(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& search)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -187,10 +187,10 @@
         return { };
     URL url = ""
     url.setQuery(search);
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::setHash(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hash)
+ExceptionOr<void> Location::setHash(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& hash)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -207,17 +207,17 @@
     // cases where fragment identifiers are ignored or invalid. 
     if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier()))
         return { };
-    return setLocation(activeWindow, firstWindow, url.string());
+    return setLocation(incumbentWindow, firstWindow, url.string());
 }
 
-ExceptionOr<void> Location::assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)
+ExceptionOr<void> Location::assign(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& url)
 {
     if (!frame())
         return { };
-    return setLocation(activeWindow, firstWindow, url);
+    return setLocation(incumbentWindow, firstWindow, url);
 }
 
-ExceptionOr<void> Location::replace(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString)
+ExceptionOr<void> Location::replace(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& urlString)
 {
     auto* frame = this->frame();
     if (!frame)
@@ -234,21 +234,21 @@
         return Exception { SyntaxError };
 
     // We call DOMWindow::setLocation directly here because replace() always operates on the current frame.
-    frame->document()->domWindow()->setLocation(activeWindow, completedURL, LockHistoryAndBackForwardList);
+    frame->document()->domWindow()->setLocation(incumbentWindow, completedURL, LockHistoryAndBackForwardList);
     return { };
 }
 
-void Location::reload(DOMWindow& activeWindow)
+void Location::reload(DOMWindow& incumbentWindow)
 {
     auto* frame = this->frame();
     if (!frame)
         return;
 
-    ASSERT(activeWindow.document());
+    ASSERT(incumbentWindow.document());
     ASSERT(frame->document());
     ASSERT(frame->document()->domWindow());
 
-    auto& activeDocument = *activeWindow.document();
+    auto& activeDocument = *incumbentWindow.document();
     auto& targetDocument = *frame->document();
 
     // FIXME: It's not clear this cross-origin security check is valuable.
@@ -256,7 +256,7 @@
     // Other location operations simply block use of _javascript_ URLs cross origin.
     if (!activeDocument.securityOrigin().isSameOriginDomain(targetDocument.securityOrigin())) {
         auto& targetWindow = *targetDocument.domWindow();
-        targetWindow.printErrorMessage(targetWindow.crossDomainAccessErrorMessage(activeWindow, IncludeTargetOrigin::Yes));
+        targetWindow.printErrorMessage(targetWindow.crossDomainAccessErrorMessage(incumbentWindow, IncludeTargetOrigin::Yes));
         return;
     }
 
@@ -266,7 +266,7 @@
     frame->navigationScheduler().scheduleRefresh(activeDocument);
 }
 
-ExceptionOr<void> Location::setLocation(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString)
+ExceptionOr<void> Location::setLocation(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& urlString)
 {
     auto* frame = this->frame();
     ASSERT(frame);
@@ -275,17 +275,21 @@
     if (!firstFrame || !firstFrame->document())
         return { };
 
+    // FIXME: Using firstWindow to complete the URL is wrong. Per the specification, we should be using the entry window:
+    // https://html.spec.whatwg.org/#entry-settings-object
+    // Blink seems to be using v8's GetEnteredOrMicrotaskContext().
     URL completedURL = firstFrame->document()->completeURL(urlString);
+
     // FIXME: The specification says to throw a SyntaxError if the URL is not valid.
     if (completedURL.isNull())
         return { };
 
-    if (!activeWindow.document()->canNavigate(frame, completedURL))
+    if (!incumbentWindow.document()->canNavigate(frame, completedURL))
         return Exception { SecurityError };
 
     ASSERT(frame->document());
     ASSERT(frame->document()->domWindow());
-    frame->document()->domWindow()->setLocation(activeWindow, completedURL);
+    frame->document()->domWindow()->setLocation(incumbentWindow, completedURL);
     return { };
 }
 

Modified: trunk/Source/WebCore/page/Location.h (280312 => 280313)


--- trunk/Source/WebCore/page/Location.h	2021-07-26 20:47:30 UTC (rev 280312)
+++ trunk/Source/WebCore/page/Location.h	2021-07-26 21:19:18 UTC (rev 280313)
@@ -42,26 +42,26 @@
 public:
     static Ref<Location> create(DOMWindow& window) { return adoptRef(*new Location(window)); }
 
-    ExceptionOr<void> setHref(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setHref(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String href() const;
 
-    ExceptionOr<void> assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
-    ExceptionOr<void> replace(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
-    void reload(DOMWindow& activeWindow);
+    ExceptionOr<void> assign(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> replace(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
+    void reload(DOMWindow& incumbentWindow);
 
-    ExceptionOr<void> setProtocol(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setProtocol(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String protocol() const;
-    ExceptionOr<void> setHost(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setHost(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     WEBCORE_EXPORT String host() const;
-    ExceptionOr<void> setHostname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setHostname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String hostname() const;
-    ExceptionOr<void> setPort(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setPort(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String port() const;
-    ExceptionOr<void> setPathname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setPathname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String pathname() const;
-    ExceptionOr<void> setSearch(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setSearch(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String search() const;
-    ExceptionOr<void> setHash(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setHash(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
     String hash() const;
     String origin() const;
 
@@ -72,7 +72,7 @@
 private:
     explicit Location(DOMWindow&);
 
-    ExceptionOr<void> setLocation(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> setLocation(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
 
     const URL& url() const;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to