Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 , m_targetType(ResourceRequest::TargetIsWorker) | 48 , m_targetType(ResourceRequest::TargetIsWorker) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 WorkerScriptLoader::~WorkerScriptLoader() | 52 WorkerScriptLoader::~WorkerScriptLoader() |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 void WorkerScriptLoader::loadSynchronously(ExecutionContext* executionContext, c onst KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) | 56 void WorkerScriptLoader::loadSynchronously(ExecutionContext* executionContext, c onst KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) |
| 57 { | 57 { |
| 58 m_url = url; | 58 m_url = url; |
|
Inactive
2014/03/31 17:43:26
We should probably add an ASSERT(executionContext)
maheshkk
2014/03/31 20:46:49
I have moved this method and all the callers to us
| |
| 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; | 67 options.allowCredentials = AllowStoredCredentials; |
| 68 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 68 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
| 69 // FIXME: Should we add EnforceScriptSrcDirective here? | 69 // FIXME: Should we add EnforceScriptSrcDirective here? |
| 70 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy ; | 70 options.contentSecurityPolicyEnforcement = DoNotEnforceContentSecurityPolicy ; |
| 71 | 71 |
| 72 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(execut ionContext), *request, *this, options); | 72 WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(*execu tionContext), *request, *this, options); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void WorkerScriptLoader::loadAsynchronously(ExecutionContext* executionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScript LoaderClient* client) | 75 void WorkerScriptLoader::loadAsynchronously(ExecutionContext* executionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScript LoaderClient* client) |
| 76 { | 76 { |
| 77 ASSERT(client); | 77 ASSERT(client); |
|
Inactive
2014/03/31 17:43:26
We should probably add an ASSERT(executionContext)
maheshkk
2014/03/31 20:46:49
I have moved this method and all the callers to us
| |
| 78 m_client = client; | 78 m_client = client; |
| 79 m_url = url; | 79 m_url = url; |
| 80 | 80 |
| 81 OwnPtr<ResourceRequest> request(createResourceRequest()); | 81 OwnPtr<ResourceRequest> request(createResourceRequest()); |
| 82 if (!request) | 82 if (!request) |
| 83 return; | 83 return; |
| 84 | 84 |
| 85 ThreadableLoaderOptions options; | 85 ThreadableLoaderOptions options; |
| 86 options.allowCredentials = AllowStoredCredentials; | 86 options.allowCredentials = AllowStoredCredentials; |
| 87 options.crossOriginRequestPolicy = crossOriginRequestPolicy; | 87 options.crossOriginRequestPolicy = crossOriginRequestPolicy; |
| 88 | 88 |
| 89 // During create, callbacks may happen which remove the last reference to th is object. | 89 // During create, callbacks may happen which remove the last reference to th is object. |
| 90 RefPtr<WorkerScriptLoader> protect(this); | 90 RefPtr<WorkerScriptLoader> protect(this); |
| 91 m_threadableLoader = ThreadableLoader::create(executionContext, this, *reque st, options); | 91 m_threadableLoader = ThreadableLoader::create(*executionContext, this, *requ est, options); |
| 92 } | 92 } |
| 93 | 93 |
| 94 const KURL& WorkerScriptLoader::responseURL() const | 94 const KURL& WorkerScriptLoader::responseURL() const |
| 95 { | 95 { |
| 96 ASSERT(!failed()); | 96 ASSERT(!failed()); |
| 97 return m_responseURL; | 97 return m_responseURL; |
| 98 } | 98 } |
| 99 | 99 |
| 100 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() | 100 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() |
| 101 { | 101 { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 void WorkerScriptLoader::notifyFinished() | 182 void WorkerScriptLoader::notifyFinished() |
| 183 { | 183 { |
| 184 if (!m_client || m_finishing) | 184 if (!m_client || m_finishing) |
| 185 return; | 185 return; |
| 186 | 186 |
| 187 m_finishing = true; | 187 m_finishing = true; |
| 188 m_client->notifyFinished(); | 188 m_client->notifyFinished(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace WebCore | 191 } // namespace WebCore |
| OLD | NEW |