Diff
Modified: trunk/LayoutTests/ChangeLog (290848 => 290849)
--- trunk/LayoutTests/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/LayoutTests/ChangeLog 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,5 +1,17 @@
2022-03-04 Chris Dumez <[email protected]>
+ Home link on weather.gov is not working
+ https://bugs.webkit.org/show_bug.cgi?id=237451
+ <rdar://60409277>
+
+ Reviewed by Geoff Garen.
+
+ Skip WPT tests that is timing out. I have verified that this WPT test is timing out in Blink as well.
+
+ * TestExpectations:
+
+2022-03-04 Chris Dumez <[email protected]>
+
Load event never firing after form is submitted
https://bugs.webkit.org/show_bug.cgi?id=235407
<rdar://problem/87831049>
Modified: trunk/LayoutTests/TestExpectations (290848 => 290849)
--- trunk/LayoutTests/TestExpectations 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/LayoutTests/TestExpectations 2022-03-04 22:57:42 UTC (rev 290849)
@@ -344,6 +344,9 @@
imported/w3c/web-platform-tests/referrer-policy/generic/subresource-test/xhr-messaging.html [ Skip ]
imported/w3c/web-platform-tests/referrer-policy/generic/unsupported-csp-referrer-directive.html [ Skip ]
+# This test is timing out in both WebKit and Blink (one of the subtests is timing out in Gecko).
+imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav.html [ Skip ]
+
# This test times out. We should fix that.
imported/w3c/web-platform-tests/selection/collapse-30.html [ Skip ]
imported/w3c/web-platform-tests/selection/dir-manual.html [ Skip ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290848 => 290849)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,5 +1,22 @@
2022-03-04 Chris Dumez <[email protected]>
+ Home link on weather.gov is not working
+ https://bugs.webkit.org/show_bug.cgi?id=237451
+ <rdar://60409277>
+
+ Reviewed by Geoff Garen.
+
+ * web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click-expected.txt: Added.
+ * web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click.html: Added.
+ Add layout test coverage (already upstreamed to WPT).
+
+ * web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt:
+ * web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt:
+ Rebaseline a couple of WPT tests that are now failing. I have verified that these tests are fully failing (and in the same way) in Blink.
+ In Gecko, only the second subtest in each of these tests is failing.
+
+2022-03-04 Chris Dumez <[email protected]>
+
Load event never firing after form is submitted
https://bugs.webkit.org/show_bug.cgi?id=235407
<rdar://problem/87831049>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click-expected.txt (0 => 290849)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click-expected.txt 2022-03-04 22:57:42 UTC (rev 290849)
@@ -0,0 +1,3 @@
+
+PASS Anchor with a fragment href and a click handler that navigates back
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click.html (0 => 290849)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click.html 2022-03-04 22:57:42 UTC (rev 290849)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script>
+promise_test(async t => {
+ // Wait for after the load event so that the navigation doesn't get converted
+ // into a replace navigation.
+ await new Promise(resolve => window._onload_ = () => t.step_timeout(resolve, 0));
+
+ location.hash = "#1";
+ assert_equals(location.hash, "#1");
+ location.hash = "#2";
+ assert_equals(location.hash, "#2");
+
+ let anchor = document.createElement("a");
+ anchor.href = ""
+ anchor._onclick_ = () => {
+ history.back();
+ };
+
+ let navigations = [];
+ let navigationsPromise = new Promise(resolve => {
+ _onpopstate_ = () => {
+ navigations.push(location.hash);
+ if (navigations.length == 2)
+ resolve();
+ }
+ });
+
+ anchor.click();
+ await navigationsPromise;
+
+ // We were on #2 when history.back() was called so we should be on #1 now.
+ assert_equals(location.hash, "#1");
+
+ // While the history navigation back to "#1" was pending, we should have navigated to "#3".
+ assert_array_equals(navigations, ["#3", "#1"]);
+}, "Anchor with a fragment href and a click handler that navigates back");
+</script>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt (290848 => 290849)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/cross-document-traversal-same-document-nav-expected.txt 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,4 +1,3 @@
+FAIL: Timed out waiting for notifyDone to be called
-PASS same-document traversals are not canceled by fragment navigations
-PASS same-document traversals are not canceled by pushState()
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt (290848 => 290849)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/same-document-traversal-same-document-nav-expected.txt 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,4 +1,4 @@
-PASS same-document traversals are not canceled by fragment navigations
-PASS same-document traversals are not canceled by pushState()
+FAIL same-document traversals are not canceled by fragment navigations step_wait_func: Timed out waiting on condition
+FAIL same-document traversals are not canceled by pushState() step_wait_func: Timed out waiting on condition
Modified: trunk/Source/WebCore/ChangeLog (290848 => 290849)
--- trunk/Source/WebCore/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebCore/ChangeLog 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,3 +1,45 @@
+2022-03-04 Chris Dumez <[email protected]>
+
+ Home link on weather.gov is not working
+ https://bugs.webkit.org/show_bug.cgi?id=237451
+ <rdar://60409277>
+
+ Reviewed by Geoff Garen.
+
+ According to the HTML specification [1], when history.back() is called, we are supposed to
+ resolve the history entry based on the delta (-1), then we're supposed to queue a task to
+ traverse the history to that particular entry.
+
+ However, WebKit was merely scheduling a task to navigate the history with a delta of -1.
+ We only resolve the target history entry once the scheduled task runs asynchronously.
+ As a result, we could end up navigating to a different history entry than we'd expect if
+ the history list changes between the call to history.back() and the actual execution of
+ the task to traverse the history list. In particular, fragment navigations can cause
+ synchronous navigations and thus add new history entries.
+
+ On weather.gov, the "HOME" anchor looks like so:
+ `<a href="" _onclick_="history.back();">HOME</a>`
+
+ Per the DOM specification, when clicking the anchor, we'd first call `history.back()` and
+ then run the anchor activation behavior that would do a fragment navigation to "#".
+ The `history.back()` call would schedule to task to navigate back, then we'd navigate to
+ "#" synchronously, which would add a new history entry. Once the task to navigate back
+ would run asynchronously, we would navigate back to the same page (but without the fragment)
+ instead of going back to the home page.
+
+ [1] https://html.spec.whatwg.org/multipage/history.html#traverse-the-history-by-a-delta
+
+ Test: imported/w3c/web-platform-tests/html/browsers/browsing-the-web/overlapping-navigations-and-traversals/tentative/anchor-fragment-history-back-on-click.html
+
+ * history/BackForwardClient.h:
+ * history/BackForwardController.cpp:
+ (WebCore::BackForwardController::containsItem const):
+ * history/BackForwardController.h:
+ * loader/EmptyClients.cpp:
+ * loader/NavigationScheduler.cpp:
+ (WebCore::ScheduledHistoryNavigation::ScheduledHistoryNavigation):
+ (WebCore::NavigationScheduler::scheduleHistoryNavigation):
+
2022-03-04 Simon Fraser <[email protected]>
Use an OptionSet<> for GraphicsContextCGFlags
Modified: trunk/Source/WebCore/history/BackForwardClient.h (290848 => 290849)
--- trunk/Source/WebCore/history/BackForwardClient.h 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebCore/history/BackForwardClient.h 2022-03-04 22:57:42 UTC (rev 290849)
@@ -47,6 +47,7 @@
virtual RefPtr<HistoryItem> itemAtIndex(int) = 0;
virtual unsigned backListCount() const = 0;
virtual unsigned forwardListCount() const = 0;
+ virtual bool containsItem(const HistoryItem&) const = 0;
virtual void close() = 0;
};
Modified: trunk/Source/WebCore/history/BackForwardController.cpp (290848 => 290849)
--- trunk/Source/WebCore/history/BackForwardController.cpp 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebCore/history/BackForwardController.cpp 2022-03-04 22:57:42 UTC (rev 290849)
@@ -119,6 +119,11 @@
m_client->goToItem(item);
}
+bool BackForwardController::containsItem(const HistoryItem& item) const
+{
+ return m_client->containsItem(item);
+}
+
unsigned BackForwardController::count() const
{
return m_client->backListCount() + 1 + m_client->forwardListCount();
Modified: trunk/Source/WebCore/history/BackForwardController.h (290848 => 290849)
--- trunk/Source/WebCore/history/BackForwardController.h 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebCore/history/BackForwardController.h 2022-03-04 22:57:42 UTC (rev 290849)
@@ -58,6 +58,7 @@
WEBCORE_EXPORT unsigned forwardCount() const;
WEBCORE_EXPORT RefPtr<HistoryItem> itemAtIndex(int);
+ bool containsItem(const HistoryItem&) const;
void close();
Modified: trunk/Source/WebCore/loader/EmptyClients.cpp (290848 => 290849)
--- trunk/Source/WebCore/loader/EmptyClients.cpp 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebCore/loader/EmptyClients.cpp 2022-03-04 22:57:42 UTC (rev 290849)
@@ -109,6 +109,7 @@
RefPtr<HistoryItem> itemAtIndex(int) final { return nullptr; }
unsigned backListCount() const final { return 0; }
unsigned forwardListCount() const final { return 0; }
+ bool containsItem(const HistoryItem&) const final { return false; }
void close() final { }
};
Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (290848 => 290849)
--- trunk/Source/WebCore/loader/NavigationScheduler.cpp 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp 2022-03-04 22:57:42 UTC (rev 290849)
@@ -265,17 +265,21 @@
class ScheduledHistoryNavigation : public ScheduledNavigation {
public:
- explicit ScheduledHistoryNavigation(int historySteps)
+ explicit ScheduledHistoryNavigation(Ref<HistoryItem>&& historyItem)
: ScheduledNavigation(0, LockHistory::No, LockBackForwardList::No, false, true)
- , m_historySteps(historySteps)
+ , m_historyItem(WTFMove(historyItem))
{
}
void fire(Frame& frame) override
{
+ // If the destination HistoryItem is no longer in the back/forward list, then we don't proceed.
+ if (!frame.page()->backForward().containsItem(m_historyItem))
+ return;
+
UserGestureIndicator gestureIndicator(userGestureToForward());
- if (!m_historySteps) {
+ if (frame.page()->backForward().currentItem() == m_historyItem.ptr()) {
// Special case for go(0) from a frame -> reload only the frame
// To follow Firefox and IE's behavior, history reload can only navigate the self frame.
frame.loader().changeLocation(frame.document()->url(), selfTargetFrameName(), 0, ReferrerPolicy::EmptyString, shouldOpenExternalURLs());
@@ -284,11 +288,11 @@
// go(i!=0) from a frame navigates into the history of the frame only,
// in both IE and NS (but not in Mozilla). We can't easily do that.
- frame.page()->backForward().goBackOrForward(m_historySteps);
+ frame.page()->goToItem(m_historyItem, FrameLoadType::IndexedBackForward, ShouldTreatAsContinuingLoad::No);
}
private:
- int m_historySteps;
+ Ref<HistoryItem> m_historyItem;
};
class ScheduledFormSubmission final : public ScheduledNavigation {
@@ -555,8 +559,14 @@
return;
}
+ auto historyItem = backForward.itemAtIndex(steps);
+ if (!historyItem) {
+ cancel();
+ return;
+ }
+
// In all other cases, schedule the history traversal to occur asynchronously.
- schedule(makeUnique<ScheduledHistoryNavigation>(steps));
+ schedule(makeUnique<ScheduledHistoryNavigation>(historyItem.releaseNonNull()));
}
void NavigationScheduler::schedulePageBlock(Document& originDocument)
Modified: trunk/Source/WebKit/ChangeLog (290848 => 290849)
--- trunk/Source/WebKit/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKit/ChangeLog 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,3 +1,16 @@
+2022-03-04 Chris Dumez <[email protected]>
+
+ Home link on weather.gov is not working
+ https://bugs.webkit.org/show_bug.cgi?id=237451
+ <rdar://60409277>
+
+ Reviewed by Geoff Garen.
+
+ * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+ (WebKit::WebBackForwardListProxy::removeItem):
+ (WebKit::WebBackForwardListProxy::containsItem const):
+ * WebProcess/WebPage/WebBackForwardListProxy.h:
+
2022-03-04 Simon Fraser <[email protected]>
Crash under ScrollingCoordinatorMac::hasNodeWithAnimatedScrollChanged()
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp (290848 => 290849)
--- trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.cpp 2022-03-04 22:57:42 UTC (rev 290849)
@@ -79,7 +79,7 @@
RefPtr<HistoryItem> item = idToHistoryItemMap().take(itemID);
if (!item)
return;
-
+
BackForwardCache::singleton().remove(*item);
WebCore::Page::clearPreviousItemFromAllPages(item.get());
}
@@ -139,6 +139,11 @@
return cacheListCountsIfNecessary().forwardCount;
}
+bool WebBackForwardListProxy::containsItem(const WebCore::HistoryItem& item) const
+{
+ return idToHistoryItemMap().contains(item.identifier());
+}
+
const WebBackForwardListCounts& WebBackForwardListProxy::cacheListCountsIfNecessary() const
{
if (!m_cachedBackForwardListCounts) {
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h (290848 => 290849)
--- trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebBackForwardListProxy.h 2022-03-04 22:57:42 UTC (rev 290849)
@@ -62,6 +62,7 @@
RefPtr<WebCore::HistoryItem> itemAtIndex(int) override;
unsigned backListCount() const override;
unsigned forwardListCount() const override;
+ bool containsItem(const WebCore::HistoryItem&) const final;
const WebBackForwardListCounts& cacheListCountsIfNecessary() const;
void clearCachedListCounts();
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (290848 => 290849)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,3 +1,16 @@
+2022-03-04 Chris Dumez <[email protected]>
+
+ Home link on weather.gov is not working
+ https://bugs.webkit.org/show_bug.cgi?id=237451
+ <rdar://60409277>
+
+ Reviewed by Geoff Garen.
+
+ * History/BackForwardList.h:
+ * History/BackForwardList.mm:
+ (BackForwardList::containsItem const):
+ (BackForwardList::containsItem): Deleted.
+
2022-03-02 Michael Saboff <[email protected]>
Copy WebKit frameworks and XPC processes to Secondary Path
Modified: trunk/Source/WebKitLegacy/mac/History/BackForwardList.h (290848 => 290849)
--- trunk/Source/WebKitLegacy/mac/History/BackForwardList.h 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/mac/History/BackForwardList.h 2022-03-04 22:57:42 UTC (rev 290849)
@@ -61,7 +61,7 @@
void setEnabled(bool);
unsigned backListCount() const override;
unsigned forwardListCount() const override;
- bool containsItem(WebCore::HistoryItem&);
+ bool containsItem(const WebCore::HistoryItem&) const final;
void close() override;
bool closed();
Modified: trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm (290848 => 290849)
--- trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/mac/History/BackForwardList.mm 2022-03-04 22:57:42 UTC (rev 290849)
@@ -256,7 +256,7 @@
}
}
-bool BackForwardList::containsItem(HistoryItem& entry)
+bool BackForwardList::containsItem(const HistoryItem& entry) const
{
- return m_entryHash.contains(&entry);
+ return m_entryHash.contains(const_cast<HistoryItem*>(&entry));
}
Modified: trunk/Source/WebKitLegacy/win/BackForwardList.cpp (290848 => 290849)
--- trunk/Source/WebKitLegacy/win/BackForwardList.cpp 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/win/BackForwardList.cpp 2022-03-04 22:57:42 UTC (rev 290849)
@@ -258,7 +258,7 @@
}
}
-bool BackForwardList::containsItem(HistoryItem* entry)
+bool BackForwardList::containsItem(const HistoryItem& entry) const
{
- return m_entryHash.contains(entry);
+ return m_entryHash.contains(const_cast<HistoryItem*>(&entry));
}
Modified: trunk/Source/WebKitLegacy/win/BackForwardList.h (290848 => 290849)
--- trunk/Source/WebKitLegacy/win/BackForwardList.h 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/win/BackForwardList.h 2022-03-04 22:57:42 UTC (rev 290849)
@@ -58,7 +58,7 @@
void setEnabled(bool);
unsigned backListCount() const final;
unsigned forwardListCount() const final;
- bool containsItem(WebCore::HistoryItem*);
+ bool containsItem(const WebCore::HistoryItem&) const final;
void close() override;
bool closed();
Modified: trunk/Source/WebKitLegacy/win/ChangeLog (290848 => 290849)
--- trunk/Source/WebKitLegacy/win/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/win/ChangeLog 2022-03-04 22:57:42 UTC (rev 290849)
@@ -1,3 +1,17 @@
+2022-03-04 Chris Dumez <[email protected]>
+
+ Home link on weather.gov is not working
+ https://bugs.webkit.org/show_bug.cgi?id=237451
+ <rdar://60409277>
+
+ Reviewed by Geoff Garen.
+
+ * BackForwardList.cpp:
+ (BackForwardList::containsItem):
+ * BackForwardList.h:
+ * WebBackForwardList.cpp:
+ (WebBackForwardList::containsItem):
+
2022-02-23 Chris Dumez <[email protected]>
Adopt more widely the new URL constructor that takes in a String
Modified: trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp (290848 => 290849)
--- trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp 2022-03-04 22:43:58 UTC (rev 290848)
+++ trunk/Source/WebKitLegacy/win/WebBackForwardList.cpp 2022-03-04 22:57:42 UTC (rev 290849)
@@ -273,7 +273,8 @@
if (!item || FAILED(item->QueryInterface(&webHistoryItem)))
return E_FAIL;
- *result = m_backForwardList->containsItem(webHistoryItem->historyItem());
+ auto historyItem = webHistoryItem->historyItem();
+ *result = historyItem ? m_backForwardList->containsItem(*historyItem) : false;
return S_OK;
}