<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[280313] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/280313">280313</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2021-07-26 14:19:18 -0700 (Mon, 26 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageLocationcpp">trunk/Source/WebCore/page/Location.cpp</a></li>
<li><a href="#trunkSourceWebCorepageLocationh">trunk/Source/WebCore/page/Location.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (280312 => 280313)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2021-07-26  Chris Dumez  <cdumez@apple.com>
+
+        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:
+
</ins><span class="cx"> 2021-07-26  Frédéric Wang  <fwang@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Crash in InsertParagraphSeparatorCommand::doApply
</span></span></pre></div>
<a id="trunkSourceWebCorepageLocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Location.cpp (280312 => 280313)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -122,14 +122,14 @@
</span><span class="cx">     return url().fragmentIdentifier().isEmpty() ? emptyString() : url().fragmentIdentifierWithLeadingNumberSign().toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setHref(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)
</del><ins>+ExceptionOr<void> Location::setHref(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& url)
</ins><span class="cx"> {
</span><span class="cx">     if (!frame())
</span><span class="cx">         return { };
</span><del>-    return setLocation(activeWindow, firstWindow, url);
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setProtocol(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& protocol)
</del><ins>+ExceptionOr<void> Location::setProtocol(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& protocol)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -137,10 +137,10 @@
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     if (!url.setProtocol(protocol))
</span><span class="cx">         return Exception { SyntaxError };
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setHost(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& host)
</del><ins>+ExceptionOr<void> Location::setHost(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& host)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -147,10 +147,10 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setHostAndPort(host);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setHostname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hostname)
</del><ins>+ExceptionOr<void> Location::setHostname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& hostname)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -157,10 +157,10 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setHost(hostname);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setPort(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& portString)
</del><ins>+ExceptionOr<void> Location::setPort(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& portString)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -167,10 +167,10 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setPort(parseInteger<uint16_t>(portString));
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setPathname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& pathname)
</del><ins>+ExceptionOr<void> Location::setPathname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& pathname)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -177,10 +177,10 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setPath(pathname);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setSearch(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& search)
</del><ins>+ExceptionOr<void> Location::setSearch(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& search)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -187,10 +187,10 @@
</span><span class="cx">         return { };
</span><span class="cx">     URL url = frame->document()->url();
</span><span class="cx">     url.setQuery(search);
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setHash(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& hash)
</del><ins>+ExceptionOr<void> Location::setHash(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& hash)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -207,17 +207,17 @@
</span><span class="cx">     // cases where fragment identifiers are ignored or invalid. 
</span><span class="cx">     if (equalIgnoringNullity(oldFragmentIdentifier, url.fragmentIdentifier()))
</span><span class="cx">         return { };
</span><del>-    return setLocation(activeWindow, firstWindow, url.string());
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url.string());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& url)
</del><ins>+ExceptionOr<void> Location::assign(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& url)
</ins><span class="cx"> {
</span><span class="cx">     if (!frame())
</span><span class="cx">         return { };
</span><del>-    return setLocation(activeWindow, firstWindow, url);
</del><ins>+    return setLocation(incumbentWindow, firstWindow, url);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::replace(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString)
</del><ins>+ExceptionOr<void> Location::replace(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& urlString)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="lines">@@ -234,21 +234,21 @@
</span><span class="cx">         return Exception { SyntaxError };
</span><span class="cx"> 
</span><span class="cx">     // We call DOMWindow::setLocation directly here because replace() always operates on the current frame.
</span><del>-    frame->document()->domWindow()->setLocation(activeWindow, completedURL, LockHistoryAndBackForwardList);
</del><ins>+    frame->document()->domWindow()->setLocation(incumbentWindow, completedURL, LockHistoryAndBackForwardList);
</ins><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Location::reload(DOMWindow& activeWindow)
</del><ins>+void Location::reload(DOMWindow& incumbentWindow)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     if (!frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ASSERT(activeWindow.document());
</del><ins>+    ASSERT(incumbentWindow.document());
</ins><span class="cx">     ASSERT(frame->document());
</span><span class="cx">     ASSERT(frame->document()->domWindow());
</span><span class="cx"> 
</span><del>-    auto& activeDocument = *activeWindow.document();
</del><ins>+    auto& activeDocument = *incumbentWindow.document();
</ins><span class="cx">     auto& targetDocument = *frame->document();
</span><span class="cx"> 
</span><span class="cx">     // FIXME: It's not clear this cross-origin security check is valuable.
</span><span class="lines">@@ -256,7 +256,7 @@
</span><span class="cx">     // Other location operations simply block use of JavaScript URLs cross origin.
</span><span class="cx">     if (!activeDocument.securityOrigin().isSameOriginDomain(targetDocument.securityOrigin())) {
</span><span class="cx">         auto& targetWindow = *targetDocument.domWindow();
</span><del>-        targetWindow.printErrorMessage(targetWindow.crossDomainAccessErrorMessage(activeWindow, IncludeTargetOrigin::Yes));
</del><ins>+        targetWindow.printErrorMessage(targetWindow.crossDomainAccessErrorMessage(incumbentWindow, IncludeTargetOrigin::Yes));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -266,7 +266,7 @@
</span><span class="cx">     frame->navigationScheduler().scheduleRefresh(activeDocument);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ExceptionOr<void> Location::setLocation(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString)
</del><ins>+ExceptionOr<void> Location::setLocation(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String& urlString)
</ins><span class="cx"> {
</span><span class="cx">     auto* frame = this->frame();
</span><span class="cx">     ASSERT(frame);
</span><span class="lines">@@ -275,17 +275,21 @@
</span><span class="cx">     if (!firstFrame || !firstFrame->document())
</span><span class="cx">         return { };
</span><span class="cx"> 
</span><ins>+    // 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().
</ins><span class="cx">     URL completedURL = firstFrame->document()->completeURL(urlString);
</span><ins>+
</ins><span class="cx">     // FIXME: The specification says to throw a SyntaxError if the URL is not valid.
</span><span class="cx">     if (completedURL.isNull())
</span><span class="cx">         return { };
</span><span class="cx"> 
</span><del>-    if (!activeWindow.document()->canNavigate(frame, completedURL))
</del><ins>+    if (!incumbentWindow.document()->canNavigate(frame, completedURL))
</ins><span class="cx">         return Exception { SecurityError };
</span><span class="cx"> 
</span><span class="cx">     ASSERT(frame->document());
</span><span class="cx">     ASSERT(frame->document()->domWindow());
</span><del>-    frame->document()->domWindow()->setLocation(activeWindow, completedURL);
</del><ins>+    frame->document()->domWindow()->setLocation(incumbentWindow, completedURL);
</ins><span class="cx">     return { };
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageLocationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Location.h (280312 => 280313)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -42,26 +42,26 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref<Location> create(DOMWindow& window) { return adoptRef(*new Location(window)); }
</span><span class="cx"> 
</span><del>-    ExceptionOr<void> setHref(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setHref(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String href() const;
</span><span class="cx"> 
</span><del>-    ExceptionOr<void> assign(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
-    ExceptionOr<void> replace(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
-    void reload(DOMWindow& activeWindow);
</del><ins>+    ExceptionOr<void> assign(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
+    ExceptionOr<void> replace(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
+    void reload(DOMWindow& incumbentWindow);
</ins><span class="cx"> 
</span><del>-    ExceptionOr<void> setProtocol(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setProtocol(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String protocol() const;
</span><del>-    ExceptionOr<void> setHost(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setHost(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     WEBCORE_EXPORT String host() const;
</span><del>-    ExceptionOr<void> setHostname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setHostname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String hostname() const;
</span><del>-    ExceptionOr<void> setPort(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setPort(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String port() const;
</span><del>-    ExceptionOr<void> setPathname(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setPathname(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String pathname() const;
</span><del>-    ExceptionOr<void> setSearch(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setSearch(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String search() const;
</span><del>-    ExceptionOr<void> setHash(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setHash(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx">     String hash() const;
</span><span class="cx">     String origin() const;
</span><span class="cx"> 
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> private:
</span><span class="cx">     explicit Location(DOMWindow&);
</span><span class="cx"> 
</span><del>-    ExceptionOr<void> setLocation(DOMWindow& activeWindow, DOMWindow& firstWindow, const String&);
</del><ins>+    ExceptionOr<void> setLocation(DOMWindow& incumbentWindow, DOMWindow& firstWindow, const String&);
</ins><span class="cx"> 
</span><span class="cx">     const URL& url() const;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>