| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 SharedWorker* worker = new SharedWorker(context); | 63 SharedWorker* worker = new SharedWorker(context); |
| 64 | 64 |
| 65 MessageChannel* channel = MessageChannel::create(context); | 65 MessageChannel* channel = MessageChannel::create(context); |
| 66 worker->m_port = channel->port1(); | 66 worker->m_port = channel->port1(); |
| 67 WebMessagePortChannelUniquePtr remotePort = channel->port2()->disentangle(); | 67 WebMessagePortChannelUniquePtr remotePort = channel->port2()->disentangle(); |
| 68 DCHECK(remotePort); | 68 DCHECK(remotePort); |
| 69 | 69 |
| 70 worker->suspendIfNeeded(); | 70 worker->suspendIfNeeded(); |
| 71 | 71 |
| 72 // We don't currently support nested workers, so workers can only be created f
rom documents. | 72 // We don't currently support nested workers, so workers can only be created |
| 73 // from documents. |
| 73 Document* document = toDocument(context); | 74 Document* document = toDocument(context); |
| 74 if (!document->getSecurityOrigin()->canAccessSharedWorkers()) { | 75 if (!document->getSecurityOrigin()->canAccessSharedWorkers()) { |
| 75 exceptionState.throwSecurityError( | 76 exceptionState.throwSecurityError( |
| 76 "Access to shared workers is denied to origin '" + | 77 "Access to shared workers is denied to origin '" + |
| 77 document->getSecurityOrigin()->toString() + "'."); | 78 document->getSecurityOrigin()->toString() + "'."); |
| 78 return nullptr; | 79 return nullptr; |
| 79 } | 80 } |
| 80 | 81 |
| 81 KURL scriptURL = worker->resolveURL( | 82 KURL scriptURL = worker->resolveURL( |
| 82 url, exceptionState, WebURLRequest::RequestContextSharedWorker); | 83 url, exceptionState, WebURLRequest::RequestContextSharedWorker); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 104 return m_isBeingConnected; | 105 return m_isBeingConnected; |
| 105 } | 106 } |
| 106 | 107 |
| 107 DEFINE_TRACE(SharedWorker) { | 108 DEFINE_TRACE(SharedWorker) { |
| 108 visitor->trace(m_port); | 109 visitor->trace(m_port); |
| 109 AbstractWorker::trace(visitor); | 110 AbstractWorker::trace(visitor); |
| 110 Supplementable<SharedWorker>::trace(visitor); | 111 Supplementable<SharedWorker>::trace(visitor); |
| 111 } | 112 } |
| 112 | 113 |
| 113 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |