OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 OwnPtr<ResourceRequest> request(createResourceRequest()); | 93 OwnPtr<ResourceRequest> request(createResourceRequest()); |
94 if (!request) | 94 if (!request) |
95 return; | 95 return; |
96 | 96 |
97 ThreadableLoaderOptions options; | 97 ThreadableLoaderOptions options; |
98 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 98 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
99 | 99 |
100 ResourceLoaderOptions resourceLoaderOptions; | 100 ResourceLoaderOptions resourceLoaderOptions; |
101 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; | 101 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; |
102 | 102 |
| 103 // During create, callbacks may happen which could remove the last reference |
| 104 // to this object, while some of the callchain assumes that the client and |
| 105 // loader wouldn't be deleted within callbacks. |
| 106 // (E.g. see crbug.com/524694 for why we can't easily remove this protect) |
| 107 RefPtr<WorkerScriptLoader> protect(this); |
103 m_needToCancel = true; | 108 m_needToCancel = true; |
104 m_threadableLoader = ThreadableLoader::create(executionContext, this, *reque
st, options, resourceLoaderOptions); | 109 m_threadableLoader = ThreadableLoader::create(executionContext, this, *reque
st, options, resourceLoaderOptions); |
105 if (m_failed) | 110 if (m_failed) |
106 notifyFinished(); | 111 notifyFinished(); |
107 // Do nothing here since notifyFinished() could delete |this|. | |
108 } | 112 } |
109 | 113 |
110 const KURL& WorkerScriptLoader::responseURL() const | 114 const KURL& WorkerScriptLoader::responseURL() const |
111 { | 115 { |
112 ASSERT(!failed()); | 116 ASSERT(!failed()); |
113 return m_responseURL; | 117 return m_responseURL; |
114 } | 118 } |
115 | 119 |
116 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() | 120 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() |
117 { | 121 { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // document (which is implemented in WorkerMessagingProxy, and | 229 // document (which is implemented in WorkerMessagingProxy, and |
226 // m_contentSecurityPolicy should be left as nullptr to inherit the policy). | 230 // m_contentSecurityPolicy should be left as nullptr to inherit the policy). |
227 if (!response.url().protocolIs("blob") && !response.url().protocolIs("file")
&& !response.url().protocolIs("filesystem")) { | 231 if (!response.url().protocolIs("blob") && !response.url().protocolIs("file")
&& !response.url().protocolIs("filesystem")) { |
228 m_contentSecurityPolicy = ContentSecurityPolicy::create(); | 232 m_contentSecurityPolicy = ContentSecurityPolicy::create(); |
229 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); | 233 m_contentSecurityPolicy->setOverrideURLForSelf(response.url()); |
230 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponse
Headers(response)); | 234 m_contentSecurityPolicy->didReceiveHeaders(ContentSecurityPolicyResponse
Headers(response)); |
231 } | 235 } |
232 } | 236 } |
233 | 237 |
234 } // namespace blink | 238 } // namespace blink |
OLD | NEW |