OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 return; | 241 return; |
242 } | 242 } |
243 if (!contentSecurityPolicy()->allowScriptFromSource(url)) { | 243 if (!contentSecurityPolicy()->allowScriptFromSource(url)) { |
244 exceptionState.throwDOMException(NetworkError, "The script at '" + u
rl.elidedString() + "' failed to load."); | 244 exceptionState.throwDOMException(NetworkError, "The script at '" + u
rl.elidedString() + "' failed to load."); |
245 return; | 245 return; |
246 } | 246 } |
247 completedURLs.append(url); | 247 completedURLs.append(url); |
248 } | 248 } |
249 | 249 |
250 for (const KURL& completeURL : completedURLs) { | 250 for (const KURL& completeURL : completedURLs) { |
251 WorkerScriptLoader scriptLoader; | 251 RefPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::create()); |
252 scriptLoader.setRequestContext(WebURLRequest::RequestContextScript); | 252 scriptLoader->setRequestContext(WebURLRequest::RequestContextScript); |
253 scriptLoader.loadSynchronously(executionContext, completeURL, AllowCross
OriginRequests); | 253 scriptLoader->loadSynchronously(executionContext, completeURL, AllowCros
sOriginRequests); |
254 | 254 |
255 // If the fetching attempt failed, throw a NetworkError exception and ab
ort all these steps. | 255 // If the fetching attempt failed, throw a NetworkError exception and ab
ort all these steps. |
256 if (scriptLoader.failed()) { | 256 if (scriptLoader->failed()) { |
257 exceptionState.throwDOMException(NetworkError, "The script at '" + c
ompleteURL.elidedString() + "' failed to load."); | 257 exceptionState.throwDOMException(NetworkError, "The script at '" + c
ompleteURL.elidedString() + "' failed to load."); |
258 return; | 258 return; |
259 } | 259 } |
260 | 260 |
261 InspectorInstrumentation::scriptImported(&executionContext, scriptLoader
.identifier(), scriptLoader.script()); | 261 InspectorInstrumentation::scriptImported(&executionContext, scriptLoader
->identifier(), scriptLoader->script()); |
262 scriptLoaded(scriptLoader.script().length(), scriptLoader.cachedMetadata
() ? scriptLoader.cachedMetadata()->size() : 0); | 262 scriptLoaded(scriptLoader->script().length(), scriptLoader->cachedMetada
ta() ? scriptLoader->cachedMetadata()->size() : 0); |
263 | 263 |
264 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = nullptr; | 264 RefPtrWillBeRawPtr<ErrorEvent> errorEvent = nullptr; |
265 OwnPtr<Vector<char>> cachedMetaData(scriptLoader.releaseCachedMetadata()
); | 265 OwnPtr<Vector<char>> cachedMetaData(scriptLoader->releaseCachedMetadata(
)); |
266 OwnPtrWillBeRawPtr<CachedMetadataHandler> handler(createWorkerScriptCach
edMetadataHandler(completeURL, cachedMetaData.get())); | 266 OwnPtrWillBeRawPtr<CachedMetadataHandler> handler(createWorkerScriptCach
edMetadataHandler(completeURL, cachedMetaData.get())); |
267 m_script->evaluate(ScriptSourceCode(scriptLoader.script(), scriptLoader.
responseURL()), &errorEvent, handler.get(), m_v8CacheOptions); | 267 m_script->evaluate(ScriptSourceCode(scriptLoader->script(), scriptLoader
->responseURL()), &errorEvent, handler.get(), m_v8CacheOptions); |
268 if (errorEvent) { | 268 if (errorEvent) { |
269 m_script->rethrowExceptionFromImportedScript(errorEvent.release(), e
xceptionState); | 269 m_script->rethrowExceptionFromImportedScript(errorEvent.release(), e
xceptionState); |
270 return; | 270 return; |
271 } | 271 } |
272 } | 272 } |
273 } | 273 } |
274 | 274 |
275 EventTarget* WorkerGlobalScope::errorEventTarget() | 275 EventTarget* WorkerGlobalScope::errorEventTarget() |
276 { | 276 { |
277 return this; | 277 return this; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 visitor->trace(m_messageStorage); | 405 visitor->trace(m_messageStorage); |
406 visitor->trace(m_pendingMessages); | 406 visitor->trace(m_pendingMessages); |
407 HeapSupplementable<WorkerGlobalScope>::trace(visitor); | 407 HeapSupplementable<WorkerGlobalScope>::trace(visitor); |
408 #endif | 408 #endif |
409 ExecutionContext::trace(visitor); | 409 ExecutionContext::trace(visitor); |
410 EventTargetWithInlineData::trace(visitor); | 410 EventTargetWithInlineData::trace(visitor); |
411 SecurityContext::trace(visitor); | 411 SecurityContext::trace(visitor); |
412 } | 412 } |
413 | 413 |
414 } // namespace blink | 414 } // namespace blink |
OLD | NEW |