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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 { | 57 { |
58 m_url = url; | 58 m_url = url; |
59 | 59 |
60 OwnPtr<ResourceRequest> request(createResourceRequest()); | 60 OwnPtr<ResourceRequest> request(createResourceRequest()); |
61 if (!request) | 61 if (!request) |
62 return; | 62 return; |
63 | 63 |
64 ASSERT_WITH_SECURITY_IMPLICATION(executionContext.isWorkerGlobalScope()); | 64 ASSERT_WITH_SECURITY_IMPLICATION(executionContext.isWorkerGlobalScope()); |
65 | 65 |
66 ThreadableLoaderOptions options; | 66 ThreadableLoaderOptions options; |
67 options.allowCredentials = AllowStoredCredentials; | |
68 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 67 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
69 // FIXME: Should we add EnforceScriptSrcDirective here? | 68 // FIXME: Should we add EnforceScriptSrcDirective here? |
70 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy
; | 69 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy
; |
71 | 70 |
72 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(execut
ionContext), *request, *this, options); | 71 ResourceLoaderOptions resourceLoaderOptions; |
| 72 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; |
| 73 |
| 74 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(execut
ionContext), *request, *this, options, resourceLoaderOptions); |
73 } | 75 } |
74 | 76 |
75 void WorkerScriptLoader::loadAsynchronously(ExecutionContext& executionContext,
const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScript
LoaderClient* client) | 77 void WorkerScriptLoader::loadAsynchronously(ExecutionContext& executionContext,
const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScript
LoaderClient* client) |
76 { | 78 { |
77 ASSERT(client); | 79 ASSERT(client); |
78 m_client = client; | 80 m_client = client; |
79 m_url = url; | 81 m_url = url; |
80 | 82 |
81 OwnPtr<ResourceRequest> request(createResourceRequest()); | 83 OwnPtr<ResourceRequest> request(createResourceRequest()); |
82 if (!request) | 84 if (!request) |
83 return; | 85 return; |
84 | 86 |
85 ThreadableLoaderOptions options; | 87 ThreadableLoaderOptions options; |
86 options.allowCredentials = AllowStoredCredentials; | |
87 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 88 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
88 | 89 |
| 90 ResourceLoaderOptions resourceLoaderOptions; |
| 91 resourceLoaderOptions.allowCredentials = AllowStoredCredentials; |
| 92 |
89 // During create, callbacks may happen which remove the last reference to th
is object. | 93 // During create, callbacks may happen which remove the last reference to th
is object. |
90 RefPtr<WorkerScriptLoader> protect(this); | 94 RefPtr<WorkerScriptLoader> protect(this); |
91 m_threadableLoader = ThreadableLoader::create(executionContext, this, *reque
st, options); | 95 m_threadableLoader = ThreadableLoader::create(executionContext, this, *reque
st, options, resourceLoaderOptions); |
92 } | 96 } |
93 | 97 |
94 const KURL& WorkerScriptLoader::responseURL() const | 98 const KURL& WorkerScriptLoader::responseURL() const |
95 { | 99 { |
96 ASSERT(!failed()); | 100 ASSERT(!failed()); |
97 return m_responseURL; | 101 return m_responseURL; |
98 } | 102 } |
99 | 103 |
100 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() | 104 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() |
101 { | 105 { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void WorkerScriptLoader::notifyFinished() | 186 void WorkerScriptLoader::notifyFinished() |
183 { | 187 { |
184 if (!m_client || m_finishing) | 188 if (!m_client || m_finishing) |
185 return; | 189 return; |
186 | 190 |
187 m_finishing = true; | 191 m_finishing = true; |
188 m_client->notifyFinished(); | 192 m_client->notifyFinished(); |
189 } | 193 } |
190 | 194 |
191 } // namespace WebCore | 195 } // namespace WebCore |
OLD | NEW |