Skip to content

Commit

Permalink
Merge r229027 - Unreviewed, rolling out r226745.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=183132

This is breaking some websites (Requested by youenn on

Reverted changeset:

"Use no-cache fetch mode when loading main documents with
location.reload()"
https://bugs.webkit.org/show_bug.cgi?id=181285
https://trac.webkit.org/changeset/226745
  • Loading branch information
webkit-commit-queue authored and carlosgcampos committed Mar 5, 2018
1 parent 82911c5 commit b39aeba
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 45 deletions.
15 changes: 15 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
2018-02-26 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r226745.
https://bugs.webkit.org/show_bug.cgi?id=183132

This is breaking some websites (Requested by youenn on
#webkit).

Reverted changeset:

"Use no-cache fetch mode when loading main documents with
location.reload()"
https://bugs.webkit.org/show_bug.cgi?id=181285
https://trac.webkit.org/changeset/226745

2018-02-25 Fujii Hironori <Hironori.Fujii@sony.com>

[WK2] http/tests/navigation/new-window-redirect-history.html crashes
Expand Down
Expand Up @@ -43,10 +43,10 @@ HAR Page Test.
"cookies": [],
"headers": "<filtered>",
"content": {
"size": "<filtered>",
"size": 3042,
"compression": 0,
"mimeType": "text/html",
"text": "<filtered text (3171)>"
"text": "<filtered text (3042)>"
},
"redirectURL": "",
"headersSize": "<filtered>",
Expand Down Expand Up @@ -84,7 +84,7 @@ HAR Page Test.
"cookies": [],
"headers": "<filtered>",
"content": {
"size": "<filtered>",
"size": 0,
"compression": 0,
"mimeType": "application/x-javascript",
"text": "<filtered text (7039)>"
Expand Down
3 changes: 0 additions & 3 deletions LayoutTests/http/tests/inspector/network/har/har-page.html
Expand Up @@ -42,9 +42,6 @@
// Reduce the file contents.
if (key === "text")
return "<filtered text (" + value.length + ")>";
// Reduce the file size since cache may or may not be used.
if (key === "size")
return "<filtered>";

// Since cache may or may not be used, timing data may be variable.
// NOTE: SSL should always be -1 for this test case.
Expand Down
15 changes: 15 additions & 0 deletions LayoutTests/imported/w3c/ChangeLog
@@ -1,3 +1,18 @@
2018-02-26 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r226745.
https://bugs.webkit.org/show_bug.cgi?id=183132

This is breaking some websites (Requested by youenn on
#webkit).

Reverted changeset:

"Use no-cache fetch mode when loading main documents with
location.reload()"
https://bugs.webkit.org/show_bug.cgi?id=181285
https://trac.webkit.org/changeset/226745

2018-02-16 Daniel Bates <dabates@apple.com>

Remove UTF-32 BOM parsing code
Expand Down
@@ -1,4 +1,5 @@


PASS Service Worker headers in the request of a fetch event
PASS Service Worker responds to fetch event with string
PASS Service Worker responds to fetch event with blob body
Expand All @@ -11,7 +12,7 @@ PASS Service Worker responds to fetch event with POST form
PASS Multiple calls of respondWith must throw InvalidStateErrors
PASS Service Worker event.respondWith must set the used flag
PASS Service Worker should expose FetchEvent URL fragments.
PASS Service Worker responds to fetch event with the correct cache types
FAIL Service Worker responds to fetch event with the correct cache types assert_unreached: unexpected rejection: assert_equals: expected "no-cache" but got "default" Reached unreachable code
PASS Service Worker should intercept EventSource
PASS Service Worker responds to fetch event with the correct integrity_metadata
PASS FetchEvent#body is a string
Expand Down
15 changes: 15 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
2018-02-26 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r226745.
https://bugs.webkit.org/show_bug.cgi?id=183132

This is breaking some websites (Requested by youenn on
#webkit).

Reverted changeset:

"Use no-cache fetch mode when loading main documents with
location.reload()"
https://bugs.webkit.org/show_bug.cgi?id=181285
https://trac.webkit.org/changeset/226745

2018-02-24 Fujii Hironori <Hironori.Fujii@sony.com>

Null-dereference of the second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad
Expand Down
25 changes: 1 addition & 24 deletions Source/WebCore/loader/DocumentLoader.cpp
Expand Up @@ -1669,32 +1669,9 @@ void DocumentLoader::startLoadingMainResource()
});
}

static inline FetchOptions::Cache toFetchOptionsCache(ResourceRequestCachePolicy policy)
{
// We are setting FetchOptions::Cache values to keep current behavior consistency.
// FIXME: We should merge FetchOptions::Cache with ResourceRequestCachePolicy and merge related class members.
switch (policy) {
case UseProtocolCachePolicy:
return FetchOptions::Cache::Default;
case ReloadIgnoringCacheData:
return FetchOptions::Cache::Reload;
case ReturnCacheDataElseLoad:
return FetchOptions::Cache::Default;
case ReturnCacheDataDontLoad:
return FetchOptions::Cache::Default;
case DoNotUseAnyCache:
return FetchOptions::Cache::NoStore;
case RefreshAnyCacheData:
return FetchOptions::Cache::NoCache;
}
return FetchOptions::Cache::Default;
}

void DocumentLoader::loadMainResource(ResourceRequest&& request)
{
ResourceLoaderOptions mainResourceLoadOptions { SendCallbacks, SniffContent, BufferData, StoredCredentialsPolicy::Use, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, SkipSecurityCheck, FetchOptions::Mode::Navigate, IncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching };
mainResourceLoadOptions.cache = toFetchOptionsCache(request.cachePolicy());

static NeverDestroyed<ResourceLoaderOptions> mainResourceLoadOptions(SendCallbacks, SniffContent, BufferData, StoredCredentialsPolicy::Use, ClientCredentialPolicy::MayAskClientForCredentials, FetchOptions::Credentials::Include, SkipSecurityCheck, FetchOptions::Mode::Navigate, IncludeCertificateInfo, ContentSecurityPolicyImposition::SkipPolicyCheck, DefersLoadingPolicy::AllowDefersLoading, CachingPolicy::AllowCaching);
CachedResourceRequest mainResourceRequest(ResourceRequest(request), mainResourceLoadOptions);
if (!m_frame->isMainFrame() && m_frame->document()) {
// If we are loading the main resource of a subframe, use the cache partition of the main document.
Expand Down
19 changes: 8 additions & 11 deletions Source/WebCore/loader/FrameLoader.cpp
Expand Up @@ -1191,12 +1191,10 @@ void FrameLoader::loadFrameRequest(FrameLoadRequest&& request, Event* event, For
referrer = String();

FrameLoadType loadType;
if (request.resourceRequest().cachePolicy() == RefreshAnyCacheData)
if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
loadType = FrameLoadType::Reload;
else if (request.lockBackForwardList() == LockBackForwardList::Yes)
loadType = FrameLoadType::RedirectWithLockedBackForwardList;
else if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData)
loadType = FrameLoadType::ReloadFromOrigin;
else
loadType = FrameLoadType::Standard;

Expand Down Expand Up @@ -1286,7 +1284,7 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref

addExtraFieldsToRequest(request, newLoadType, true);
if (isReload(newLoadType))
request.setCachePolicy(RefreshAnyCacheData);
request.setCachePolicy(ReloadIgnoringCacheData);

ASSERT(newLoadType != FrameLoadType::Same);

Expand Down Expand Up @@ -1423,7 +1421,7 @@ void FrameLoader::load(DocumentLoader* newDocumentLoader)
FrameLoadType type;

if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->originalRequest().url())) {
r.setCachePolicy(RefreshAnyCacheData);
r.setCachePolicy(ReloadIgnoringCacheData);
type = FrameLoadType::Same;
} else if (shouldTreatURLAsSameAsCurrent(newDocumentLoader->unreachableURL()) && m_loadType == FrameLoadType::Reload)
type = FrameLoadType::Reload;
Expand Down Expand Up @@ -1648,7 +1646,8 @@ void FrameLoader::reload(OptionSet<ReloadOption> options)

ResourceRequest& request = loader->request();

request.setCachePolicy(RefreshAnyCacheData);
// FIXME: We don't have a mechanism to revalidate the main resource without reloading at the moment.
request.setCachePolicy(ReloadIgnoringCacheData);

// If we're about to re-post, set up action so the application can warn the user.
if (request.httpMethod() == "POST")
Expand Down Expand Up @@ -2623,13 +2622,13 @@ ResourceRequestCachePolicy FrameLoader::defaultRequestCachingPolicy(const Resour

if (isMainResource) {
if (isReload(loadType) || request.isConditional())
return loadType == FrameLoadType::ReloadFromOrigin ? ReloadIgnoringCacheData : RefreshAnyCacheData;
return ReloadIgnoringCacheData;

return UseProtocolCachePolicy;
}

if (request.isConditional())
return RefreshAnyCacheData;
return ReloadIgnoringCacheData;

if (documentLoader()->isLoadingInAPISense()) {
// If we inherit cache policy from a main resource, we use the DocumentLoader's
Expand Down Expand Up @@ -3489,10 +3488,8 @@ void FrameLoader::loadDifferentDocumentItem(HistoryItem& item, FrameLoadType loa
} else {
switch (loadType) {
case FrameLoadType::Reload:
case FrameLoadType::ReloadExpiredOnly:
request.setCachePolicy(RefreshAnyCacheData);
break;
case FrameLoadType::ReloadFromOrigin:
case FrameLoadType::ReloadExpiredOnly:
request.setCachePolicy(ReloadIgnoringCacheData);
break;
case FrameLoadType::Back:
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/loader/NavigationScheduler.cpp
Expand Up @@ -183,7 +183,7 @@ class ScheduledRedirect : public ScheduledURLNavigation {
UserGestureIndicator gestureIndicator { userGestureToForward() };

bool refresh = equalIgnoringFragmentIdentifier(frame.document()->url(), url());
ResourceRequest resourceRequest { url(), referrer(), refresh ? RefreshAnyCacheData : UseProtocolCachePolicy };
ResourceRequest resourceRequest { url(), referrer(), refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy };
FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };

frame.loader().changeLocation(WTFMove(frameLoadRequest));
Expand Down Expand Up @@ -217,7 +217,7 @@ class ScheduledRefresh : public ScheduledURLNavigation {
{
UserGestureIndicator gestureIndicator { userGestureToForward() };

ResourceRequest resourceRequest { url(), referrer(), RefreshAnyCacheData };
ResourceRequest resourceRequest { url(), referrer(), ReloadIgnoringCacheData };
FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };

frame.loader().changeLocation(WTFMove(frameLoadRequest));
Expand Down Expand Up @@ -320,7 +320,7 @@ class ScheduledPageBlock final : public ScheduledNavigation {
ResourceResponse replacementResponse { m_originDocument.url(), ASCIILiteral("text/plain"), 0, ASCIILiteral("UTF-8") };
SubstituteData replacementData { SharedBuffer::create(), m_originDocument.url(), replacementResponse, SubstituteData::SessionHistoryVisibility::Hidden };

ResourceRequest resourceRequest { m_originDocument.url(), emptyString(), RefreshAnyCacheData };
ResourceRequest resourceRequest { m_originDocument.url(), emptyString(), ReloadIgnoringCacheData };
FrameLoadRequest frameLoadRequest { m_originDocument, m_originDocument.securityOrigin(), resourceRequest, { }, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
frameLoadRequest.setSubstituteData(replacementData);
frame.loader().load(WTFMove(frameLoadRequest));
Expand Down

0 comments on commit b39aeba

Please sign in to comment.