Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 1783653002: save-data header value gets appended on page refreshes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 request.addHTTPOriginIfNeeded(outgoingOrigin); 112 request.addHTTPOriginIfNeeded(outgoingOrigin);
113 } 113 }
114 114
115 if (m_document) 115 if (m_document)
116 request.setExternalRequestStateFromRequestorAddressSpace(m_document->add ressSpace()); 116 request.setExternalRequestStateFromRequestorAddressSpace(m_document->add ressSpace());
117 117
118 // The remaining modifications are only necessary for HTTP and HTTPS. 118 // The remaining modifications are only necessary for HTTP and HTTPS.
119 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) 119 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily())
120 return; 120 return;
121 121
122 if (frame()->loader().loadType() == FrameLoadTypeReload)
123 request.clearHTTPHeaderField("Save-Data");
124
122 if (frame()->settings() && frame()->settings()->dataSaverEnabled()) 125 if (frame()->settings() && frame()->settings()->dataSaverEnabled())
123 request.addHTTPHeaderField("Save-Data", "on"); 126 request.setHTTPHeaderField("Save-Data", "on");
124 127
125 frame()->loader().applyUserAgent(request); 128 frame()->loader().applyUserAgent(request);
126 } 129 }
127 130
128 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request) 131 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request)
129 { 132 {
130 if (frame()->tree().top()->isLocalFrame()) 133 if (frame()->tree().top()->isLocalFrame())
131 request.setFirstPartyForCookies(toLocalFrame(frame()->tree().top())->doc ument()->firstPartyForCookies()); 134 request.setFirstPartyForCookies(toLocalFrame(frame()->tree().top())->doc ument()->firstPartyForCookies());
132 } 135 }
133 136
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 805 }
803 806
804 DEFINE_TRACE(FrameFetchContext) 807 DEFINE_TRACE(FrameFetchContext)
805 { 808 {
806 visitor->trace(m_document); 809 visitor->trace(m_document);
807 visitor->trace(m_documentLoader); 810 visitor->trace(m_documentLoader);
808 FetchContext::trace(visitor); 811 FetchContext::trace(visitor);
809 } 812 }
810 813
811 } // namespace blink 814 } // namespace blink
OLDNEW
« no previous file with comments | « chrome/browser/data_saver/data_saver_browsertest.cc ('k') | third_party/WebKit/Source/core/loader/FrameFetchContextTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698