OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "bindings/core/v8/ScriptPromiseResolver.h" | 33 #include "bindings/core/v8/ScriptPromiseResolver.h" |
34 #include "bindings/core/v8/ScriptState.h" | 34 #include "bindings/core/v8/ScriptState.h" |
35 #include "bindings/core/v8/SerializedScriptValue.h" | 35 #include "bindings/core/v8/SerializedScriptValue.h" |
36 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 36 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
37 #include "bindings/core/v8/V8ThrowException.h" | 37 #include "bindings/core/v8/V8ThrowException.h" |
38 #include "core/dom/DOMException.h" | 38 #include "core/dom/DOMException.h" |
39 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
40 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
41 #include "core/dom/ExecutionContext.h" | 41 #include "core/dom/ExecutionContext.h" |
42 #include "core/dom/MessagePort.h" | 42 #include "core/dom/MessagePort.h" |
43 #include "core/events/MessageEvent.h" | |
43 #include "core/frame/LocalDOMWindow.h" | 44 #include "core/frame/LocalDOMWindow.h" |
44 #include "core/frame/UseCounter.h" | 45 #include "core/frame/UseCounter.h" |
45 #include "core/frame/csp/ContentSecurityPolicy.h" | 46 #include "core/frame/csp/ContentSecurityPolicy.h" |
46 #include "modules/EventTargetModules.h" | 47 #include "modules/EventTargetModules.h" |
47 #include "modules/serviceworkers/ServiceWorker.h" | 48 #include "modules/serviceworkers/ServiceWorker.h" |
48 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 49 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
49 #include "modules/serviceworkers/ServiceWorkerError.h" | 50 #include "modules/serviceworkers/ServiceWorkerError.h" |
50 #include "modules/serviceworkers/ServiceWorkerMessageEvent.h" | |
51 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 51 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
52 #include "platform/RuntimeEnabledFeatures.h" | 52 #include "platform/RuntimeEnabledFeatures.h" |
53 #include "platform/weborigin/SchemeRegistry.h" | 53 #include "platform/weborigin/SchemeRegistry.h" |
54 #include "public/platform/WebString.h" | 54 #include "public/platform/WebString.h" |
55 #include "public/platform/WebURL.h" | 55 #include "public/platform/WebURL.h" |
56 #include "public/platform/modules/serviceworker/WebServiceWorker.h" | 56 #include "public/platform/modules/serviceworker/WebServiceWorker.h" |
57 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 57 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
58 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" | 58 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" |
59 #include "wtf/PtrUtil.h" | 59 #include "wtf/PtrUtil.h" |
60 #include <memory> | 60 #include <memory> |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 const WebString& message, | 503 const WebString& message, |
504 const WebMessagePortChannelArray& webChannels) { | 504 const WebMessagePortChannelArray& webChannels) { |
505 if (!getExecutionContext() || !getExecutionContext()->executingWindow()) | 505 if (!getExecutionContext() || !getExecutionContext()->executingWindow()) |
506 return; | 506 return; |
507 | 507 |
508 MessagePortArray* ports = | 508 MessagePortArray* ports = |
509 MessagePort::toMessagePortArray(getExecutionContext(), webChannels); | 509 MessagePort::toMessagePortArray(getExecutionContext(), webChannels); |
510 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); | 510 RefPtr<SerializedScriptValue> value = SerializedScriptValue::create(message); |
511 ServiceWorker* source = | 511 ServiceWorker* source = |
512 ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); | 512 ServiceWorker::from(getExecutionContext(), wrapUnique(handle.release())); |
513 dispatchEvent(ServiceWorkerMessageEvent::create( | 513 dispatchEvent(MessageEvent::create( |
514 ports, value, source, | 514 ports, value, getExecutionContext()->getSecurityOrigin()->toString(), |
515 getExecutionContext()->getSecurityOrigin()->toString())); | 515 String(), source, String())); |
nhiroki
2016/11/14 05:48:55
nit:
Adding arg names would be a bit more readabl
jungkees
2016/11/14 14:17:11
Yes. Addressed.
| |
516 } | 516 } |
517 | 517 |
518 const AtomicString& ServiceWorkerContainer::interfaceName() const { | 518 const AtomicString& ServiceWorkerContainer::interfaceName() const { |
519 return EventTargetNames::ServiceWorkerContainer; | 519 return EventTargetNames::ServiceWorkerContainer; |
520 } | 520 } |
521 | 521 |
522 ServiceWorkerContainer::ServiceWorkerContainer( | 522 ServiceWorkerContainer::ServiceWorkerContainer( |
523 ExecutionContext* executionContext) | 523 ExecutionContext* executionContext) |
524 : ContextLifecycleObserver(executionContext), m_provider(0) { | 524 : ContextLifecycleObserver(executionContext), m_provider(0) { |
525 if (!executionContext) | 525 if (!executionContext) |
526 return; | 526 return; |
527 | 527 |
528 if (ServiceWorkerContainerClient* client = | 528 if (ServiceWorkerContainerClient* client = |
529 ServiceWorkerContainerClient::from(executionContext)) { | 529 ServiceWorkerContainerClient::from(executionContext)) { |
530 m_provider = client->provider(); | 530 m_provider = client->provider(); |
531 if (m_provider) | 531 if (m_provider) |
532 m_provider->setClient(this); | 532 m_provider->setClient(this); |
533 } | 533 } |
534 } | 534 } |
535 | 535 |
536 } // namespace blink | 536 } // namespace blink |
OLD | NEW |