OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 request.setHTTPBody(FormData::create("PING")); | 78 request.setHTTPBody(FormData::create("PING")); |
79 request.setHTTPHeaderField("Cache-Control", "max-age=0"); | 79 request.setHTTPHeaderField("Cache-Control", "max-age=0"); |
80 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); | 80 frame->loader().fetchContext().addAdditionalRequestHeaders(frame->document() , request, FetchSubresource); |
81 | 81 |
82 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); | 82 RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL); |
83 // addAdditionalRequestHeaders() will have added a referrer for same origin requests, | 83 // addAdditionalRequestHeaders() will have added a referrer for same origin requests, |
84 // but the spec omits the referrer for same origin. | 84 // but the spec omits the referrer for same origin. |
85 if (frame->document()->securityOrigin()->isSameSchemeHostPort(pingOrigin.get ())) | 85 if (frame->document()->securityOrigin()->isSameSchemeHostPort(pingOrigin.get ())) |
86 request.clearHTTPReferrer(); | 86 request.clearHTTPReferrer(); |
87 | 87 |
88 request.setHTTPHeaderField("Ping-To", destinationURL.string()); | 88 request.setHTTPHeaderField("Ping-To", AtomicString(destinationURL.string())) ; |
89 | 89 |
90 // Ping-From follows the same rules as the default referrer beahavior for su bresource requests. | 90 // Ping-From follows the same rules as the default referrer beahavior for su bresource requests. |
91 // FIXME: Should Ping-From obey ReferrerPolicy? | 91 // FIXME: Should Ping-From obey ReferrerPolicy? |
92 if (!SecurityPolicy::shouldHideReferrer(pingURL, frame->document()->url().st ring())) | 92 if (!SecurityPolicy::shouldHideReferrer(pingURL, frame->document()->url().st ring())) |
93 request.setHTTPHeaderField("Ping-From", frame->document()->url().string( )); | 93 request.setHTTPHeaderField("Ping-From", AtomicString(frame->document()-> url().string())); |
eseidel
2013/12/31 22:05:03
KURL doesn't have an atomicString accessor?
Inactive
2013/12/31 22:47:25
No, and KURL::string() merely returns m_string mem
| |
94 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request)); | 94 OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request)); |
95 | 95 |
96 // Leak the ping loader, since it will kill itself as soon as it receives a response. | 96 // Leak the ping loader, since it will kill itself as soon as it receives a response. |
97 PingLoader* ALLOW_UNUSED leakedPingLoader = pingLoader.leakPtr(); | 97 PingLoader* ALLOW_UNUSED leakedPingLoader = pingLoader.leakPtr(); |
98 } | 98 } |
99 | 99 |
100 void PingLoader::sendViolationReport(Frame* frame, const KURL& reportURL, PassRe fPtr<FormData> report, ViolationReportType type) | 100 void PingLoader::sendViolationReport(Frame* frame, const KURL& reportURL, PassRe fPtr<FormData> report, ViolationReportType type) |
101 { | 101 { |
102 ResourceRequest request(reportURL); | 102 ResourceRequest request(reportURL); |
103 request.setTargetType(ResourceRequest::TargetIsSubresource); | 103 request.setTargetType(ResourceRequest::TargetIsSubresource); |
(...skipping 26 matching lines...) Expand all Loading... | |
130 m_timeout.startOneShot(60000); | 130 m_timeout.startOneShot(60000); |
131 } | 131 } |
132 | 132 |
133 PingLoader::~PingLoader() | 133 PingLoader::~PingLoader() |
134 { | 134 { |
135 if (m_loader) | 135 if (m_loader) |
136 m_loader->cancel(); | 136 m_loader->cancel(); |
137 } | 137 } |
138 | 138 |
139 } | 139 } |
OLD | NEW |