OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 ASSERT(document->page()); | 58 ASSERT(document->page()); |
59 WorkerGlobalScopeProxyProvider* proxyProvider = WorkerGlobalScopeProxyProvid
er::from(*document->page()); | 59 WorkerGlobalScopeProxyProvider* proxyProvider = WorkerGlobalScopeProxyProvid
er::from(*document->page()); |
60 ASSERT(proxyProvider); | 60 ASSERT(proxyProvider); |
61 | 61 |
62 RefPtr<Worker> worker = adoptRef(new Worker(context)); | 62 RefPtr<Worker> worker = adoptRef(new Worker(context)); |
63 | 63 |
64 worker->suspendIfNeeded(); | 64 worker->suspendIfNeeded(); |
65 | 65 |
66 KURL scriptURL = worker->resolveURL(url, exceptionState); | 66 KURL scriptURL = worker->resolveURL(url, exceptionState); |
67 if (scriptURL.isEmpty()) | 67 if (scriptURL.isEmpty()) |
68 return 0; | 68 return nullptr; |
69 | 69 |
70 // The worker context does not exist while loading, so we must ensure that t
he worker object is not collected, nor are its event listeners. | 70 // The worker context does not exist while loading, so we must ensure that t
he worker object is not collected, nor are its event listeners. |
71 worker->setPendingActivity(worker.get()); | 71 worker->setPendingActivity(worker.get()); |
72 | 72 |
73 worker->m_scriptLoader = WorkerScriptLoader::create(); | 73 worker->m_scriptLoader = WorkerScriptLoader::create(); |
74 worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOrig
inRequests, worker.get()); | 74 worker->m_scriptLoader->loadAsynchronously(context, scriptURL, DenyCrossOrig
inRequests, worker.get()); |
75 worker->m_contextProxy = proxyProvider->createWorkerGlobalScopeProxy(worker.
get()); | 75 worker->m_contextProxy = proxyProvider->createWorkerGlobalScopeProxy(worker.
get()); |
76 return worker.release(); | 76 return worker.release(); |
77 } | 77 } |
78 | 78 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 startMode = PauseWorkerGlobalScopeOnStart; | 128 startMode = PauseWorkerGlobalScopeOnStart; |
129 m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), executionC
ontext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMode)
; | 129 m_contextProxy->startWorkerGlobalScope(m_scriptLoader->url(), executionC
ontext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMode)
; |
130 InspectorInstrumentation::scriptImported(executionContext(), m_scriptLoa
der->identifier(), m_scriptLoader->script()); | 130 InspectorInstrumentation::scriptImported(executionContext(), m_scriptLoa
der->identifier(), m_scriptLoader->script()); |
131 } | 131 } |
132 m_scriptLoader = nullptr; | 132 m_scriptLoader = nullptr; |
133 | 133 |
134 unsetPendingActivity(this); | 134 unsetPendingActivity(this); |
135 } | 135 } |
136 | 136 |
137 } // namespace WebCore | 137 } // namespace WebCore |
OLD | NEW |