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 worker->m_port = channel->port1(); | 62 worker->m_port = channel->port1(); |
63 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(); | 63 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(); |
64 ASSERT(remotePort); | 64 ASSERT(remotePort); |
65 | 65 |
66 worker->suspendIfNeeded(); | 66 worker->suspendIfNeeded(); |
67 | 67 |
68 // We don't currently support nested workers, so workers can only be created
from documents. | 68 // We don't currently support nested workers, so workers can only be created
from documents. |
69 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); | 69 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); |
70 Document* document = toDocument(context); | 70 Document* document = toDocument(context); |
71 if (!document->securityOrigin()->canAccessSharedWorkers()) { | 71 if (!document->securityOrigin()->canAccessSharedWorkers()) { |
72 es.throwDOMException(SecurityError, "Failed to create 'SharedWorker': ac
cess to shared workers is denied to origin '" + document->securityOrigin()->toSt
ring() + "'."); | 72 es.throwSecurityError("Failed to create 'SharedWorker': access to shared
workers is denied to origin '" + document->securityOrigin()->toString() + "'.")
; |
73 return 0; | 73 return 0; |
74 } | 74 } |
75 | 75 |
76 KURL scriptURL = worker->resolveURL(url, es); | 76 KURL scriptURL = worker->resolveURL(url, es); |
77 if (scriptURL.isEmpty()) | 77 if (scriptURL.isEmpty()) |
78 return 0; | 78 return 0; |
79 | 79 |
80 SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptUR
L, name, es); | 80 SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptUR
L, name, es); |
81 | 81 |
82 return worker.release(); | 82 return worker.release(); |
83 } | 83 } |
84 | 84 |
85 SharedWorker::~SharedWorker() | 85 SharedWorker::~SharedWorker() |
86 { | 86 { |
87 } | 87 } |
88 | 88 |
89 const AtomicString& SharedWorker::interfaceName() const | 89 const AtomicString& SharedWorker::interfaceName() const |
90 { | 90 { |
91 return eventNames().interfaceForSharedWorker; | 91 return eventNames().interfaceForSharedWorker; |
92 } | 92 } |
93 | 93 |
94 } // namespace WebCore | 94 } // namespace WebCore |
OLD | NEW |