| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 RefPtr<MessageChannel> channel = MessageChannel::create(context); | 64 RefPtr<MessageChannel> channel = MessageChannel::create(context); |
| 65 worker->m_port = channel->port1(); | 65 worker->m_port = channel->port1(); |
| 66 OwnPtr<blink::WebMessagePortChannel> remotePort = channel->port2()->disentan
gle(); | 66 OwnPtr<blink::WebMessagePortChannel> remotePort = channel->port2()->disentan
gle(); |
| 67 ASSERT(remotePort); | 67 ASSERT(remotePort); |
| 68 | 68 |
| 69 worker->suspendIfNeeded(); | 69 worker->suspendIfNeeded(); |
| 70 | 70 |
| 71 // We don't currently support nested workers, so workers can only be created
from documents. | 71 // We don't currently support nested workers, so workers can only be created
from documents. |
| 72 Document* document = toDocument(context); | 72 Document* document = toDocument(context); |
| 73 if (!document->securityOrigin()->canAccessSharedWorkers()) { | 73 if (!document->securityOrigin()->canAccessSharedWorkers()) { |
| 74 exceptionState.throwSecurityError("Failed to create 'SharedWorker': acce
ss to shared workers is denied to origin '" + document->securityOrigin()->toStri
ng() + "'."); | 74 exceptionState.throwSecurityError("Access to shared workers is denied to
origin '" + document->securityOrigin()->toString() + "'."); |
| 75 return 0; | 75 return 0; |
| 76 } | 76 } |
| 77 | 77 |
| 78 KURL scriptURL = worker->resolveURL(url, exceptionState); | 78 KURL scriptURL = worker->resolveURL(url, exceptionState); |
| 79 if (scriptURL.isEmpty()) | 79 if (scriptURL.isEmpty()) |
| 80 return 0; | 80 return 0; |
| 81 | 81 |
| 82 if (document->page() && document->page()->sharedWorkerRepositoryClient()) | 82 if (document->page() && document->page()->sharedWorkerRepositoryClient()) |
| 83 document->page()->sharedWorkerRepositoryClient()->connect(worker.get(),
remotePort.release(), scriptURL, name, exceptionState); | 83 document->page()->sharedWorkerRepositoryClient()->connect(worker.get(),
remotePort.release(), scriptURL, name, exceptionState); |
| 84 | 84 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 { | 98 { |
| 99 setPendingActivity(this); | 99 setPendingActivity(this); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void SharedWorker::unsetPreventGC() | 102 void SharedWorker::unsetPreventGC() |
| 103 { | 103 { |
| 104 unsetPendingActivity(this); | 104 unsetPendingActivity(this); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace WebCore | 107 } // namespace WebCore |
| OLD | NEW |