Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Side by Side Diff: Source/core/workers/WorkerMessagingProxy.cpp

Issue 594803002: Transfer SecurityOrigin overrides to Workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add tests Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const S tring& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) 110 void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const S tring& userAgent, const String& sourceCode, WorkerThreadStartMode startMode)
111 { 111 {
112 // FIXME: This need to be revisited when we support nested worker one day 112 // FIXME: This need to be revisited when we support nested worker one day
113 ASSERT(m_executionContext->isDocument()); 113 ASSERT(m_executionContext->isDocument());
114 if (m_askedToTerminate) { 114 if (m_askedToTerminate) {
115 // Worker.terminate() could be called from JS before the thread was crea ted. 115 // Worker.terminate() could be called from JS before the thread was crea ted.
116 return; 116 return;
117 } 117 }
118 Document* document = toDocument(m_executionContext.get()); 118 Document* document = toDocument(m_executionContext.get());
119 119
120 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu pData::create(scriptURL, userAgent, sourceCode, startMode, document->contentSecu rityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedH eaderType(), m_workerClients.release()); 120 SecurityOrigin::PolicyOverrides originPolicyOverrides;
121 if (document->securityOrigin())
Mike West 2014/09/26 11:29:10 When do we ever have Documents without SecurityOri
122 originPolicyOverrides = document->securityOrigin()->policyOverrides();
123
124 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu pData::create(scriptURL, userAgent, sourceCode, startMode, document->contentSecu rityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedH eaderType(), originPolicyOverrides, m_workerClients.release());
121 double originTime = document->loader() ? document->loader()->timing()->refer enceMonotonicTime() : monotonicallyIncreasingTime(); 125 double originTime = document->loader() ? document->loader()->timing()->refer enceMonotonicTime() : monotonicallyIncreasingTime();
122 126
123 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(*this, *m_workerObjectProxy.get(), originTime, startupData.release()); 127 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(*this, *m_workerObjectProxy.get(), originTime, startupData.release());
124 thread->start(); 128 thread->start();
125 workerThreadCreated(thread); 129 workerThreadCreated(thread);
126 m_workerInspectorProxy->workerThreadCreated(m_executionContext.get(), m_work erThread.get(), scriptURL); 130 m_workerInspectorProxy->workerThreadCreated(m_executionContext.get(), m_work erThread.get(), scriptURL);
127 } 131 }
128 132
129 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript Value> message, PassOwnPtr<MessagePortChannelArray> channels) 133 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript Value> message, PassOwnPtr<MessagePortChannelArray> channels)
130 { 134 {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 290
287 // FIXME: This need to be revisited when we support nested worker one day 291 // FIXME: This need to be revisited when we support nested worker one day
288 ASSERT(m_executionContext->isDocument()); 292 ASSERT(m_executionContext->isDocument());
289 Document* document = toDocument(m_executionContext.get()); 293 Document* document = toDocument(m_executionContext.get());
290 LocalFrame* frame = document->frame(); 294 LocalFrame* frame = document->frame();
291 if (frame) 295 if (frame)
292 frame->console().adoptWorkerMessagesAfterTermination(this); 296 frame->console().adoptWorkerMessagesAfterTermination(this);
293 } 297 }
294 298
295 } // namespace blink 299 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698